PageSourceSearch

https://ushiro-pocke-my-upscaler-v2.hf.space/static/js/index.DATGLwZn.js

js ushiro-pocke-my-upscaler-v2.hf.space collected 2026-10-03 10:22:14 UTC 2,701,588 bytes, 5,336 lines download raw bytes

vendor: 39,503 bytes, lines 1-6
1import{r as It,cU as Tr,d0 as At,ag as _h,d1 as c5,bs as zu,_ as $D,j as Jf,a0 as l5,x as WD,k as JD,R as XD,d2 as AB,bn as u5,L as f5,g as h5,l as gB,ck as d5,d3 as mB}from"./index.3bHSf9gi.js";import{_ as gs,a as p5,C as A5}from"./toConsumableArray.DmYuqCFN.js";import{f as of,e as af,d as Ux,_ as Bp,a as zx}from"./possibleConstructorReturn.D2vivPxX.js";import{E as KD,w as g5}from"./withFullScreenWrapper.CWEBbO_P.js";import{a as m5,T as _5}from"./Toolbar.0YdWjZhn.js";import{l as r2}from"./index.8HslT92O.js";import{a as y5}from"./useBasicWidgetState.CSKMY_WY.js";import{u as v5,s as b5}from"./threshold.Q1mXg5rX.js";import"./FormClearHelper.DyYuMYyM.js";import"./value.B4vHRSi7.js";function x5(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(r,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}function o_(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const Gx=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),_B=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);_B&&parseFloat(_B[1]);const a_=globalThis,c_=globalThis.process||{},w5=globalThis.navigator||{};function qD(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function Al(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||qD()}function C5(r){return Al()?qD()?"Electron":(w5.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const iy="4.1.0";function T5(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}let E5=class{constructor(e,t,n="sessionStorage"){this.storage=T5(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function B5(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function S5(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var l_;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(l_||(l_={}));const I5=10;function yB(r){return typeof r!="string"?r:(r=r.toUpperCase(),l_[r]||l_.WHITE)}function M5(r,e,t){return!Al&&typeof r=="string"&&(e&&(r=`\x1B[${yB(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${yB(t)+I5}m${r}\x1B[49m`)),r}function P5(r,e=["constructor"]){const t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),i=r;for(const s of n){const o=i[s];typeof o=="function"&&(e.find(c=>s===c)||(i[s]=o.bind(r)))}}function Vx(r,e){if(!r)throw new Error("Assertion failed")}function md(){let r;if(Al()&&a_.performance)r=a_?.performance?.now?.();else if("hrtime"in c_){const e=c_?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const _d={debug:Al()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},R5={enabled:!0,level:0};function yd(){}const vB={},bB={once:!0};let YD=class{constructor({id:e}={id:""}){this.VERSION=iy,this._startTs=md(),this._deltaTs=md(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new E5(`__probe-${this.id}__`,R5),this.timeStamp(`${this.id} started`),P5(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((md()-this._startTs).toPrecision(10))}getDelta(){return Number((md()-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,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,_d.warn,arguments,bB)}error(e){return this._getLogFunction(0,e,_d.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,_d.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,_d.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,_d.debug||_d.info,arguments,bB)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||yd,n&&[n],{tag:D5(t)}):yd}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||yd)}group(e,t,n={collapsed:!1}){const i=xB({logLevel:e,message:t,opts:n}),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||yd)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=ZD(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=xB({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,Vx(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=md();const o=s.tag||s.message;if(s.once&&o)if(!vB[o])vB[o]=md();else return yd;return t=F5(this.id,s.message,s),n.bind(console,t,...s.args)}return yd}};YD.VERSION=iy;function ZD(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Vx(Number.isFinite(e)&&e>=0),e}function xB(r){const{logLevel:e,message:t}=r;r.logLevel=ZD(e);const n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const i=typeof r.message;return Vx(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function F5(r,e,t){if(typeof e=="string"){const n=t.time?S5(B5(t.total)):"";e=t.time?`${r}: ${n}  ${e}`:`${r}: ${e}`,e=M5(e,t.color,t.background)}return e}function D5(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}function O5(r,e){return QD(r||{},e)}function QD(r,e,t=0){if(t>3)return e;const n={...r};for(const[i,s]of Object.entries(e))s&&typeof s=="object"&&!Array.isArray(s)?n[i]=QD(n[i]||{},e[i],t+1):n[i]=e[i];return n}const L5="latest";function k5(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.4"),globalThis._loadersgl_.version}const N5=k5();function Yu(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const rh=typeof process!="object"||String(process)!=="[object process]"||process.browser,U5=typeof window<"u"&&typeof window.orientation<"u",wB=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);wB&&parseFloat(wB[1]);let z5=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){Yu(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Yu(this.isRunning),this.isRunning=!1,this._reject(e)}},Nv=class{terminate(){}};const Uv=new Map;function G5(r){Yu(r.source&&!r.url||!r.source&&r.url);let e=Uv.get(r.source||r.url);return e||(r.url&&(e=V5(r.url),Uv.set(r.url,e)),r.source&&(e=eO(r.source),Uv.set(r.source,e))),Yu(e),e}function V5(r){if(!r.startsWith("http"))return r;const e=H5(r);return eO(e)}function eO(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function H5(r){return`try {
2  importScripts('${r}');
3} catch (error) {
4  console.error(error);
5  throw error;
6}`}function tO(r,e=!0,t){const n=t||new Set;if(r){if(CB(r))n.add(r);else if(CB(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(const i in r)tO(r[i],e,n)}}return t===void 0?Array.from(n):[]}function CB(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}const zv=()=>{};let n2=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&rh||typeof Nv<"u"&&!rh}constructor(e){const{name:t,source:n,url:i}=e;Yu(n||i),this.name=t,this.source=n,this.url=i,this.onMessage=zv,this.onError=s=>console.log(s),this.worker=rh?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=zv,this.onError=zv,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,t){t=t||tO(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=G5({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},e.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},e.onmessageerror=t=>console.error(t),e}_createNodeWorker(){let e;if(this.url){const n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new Nv(n,{eval:!1})}else if(this.source)e=new Nv(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",t=>{this.onMessage(t)}),e.on("error",t=>{this.onError(t)}),e.on("exit",t=>{}),e}},j5=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return n2.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,t=(i,s,o)=>i.done(o),n=(i,s)=>i.error(s)){const i=new Promise(s=>(this.jobQueue.push({name:e,onMessage:t,onError:n,onStart:s}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const n=new z5(t.name,e);e.onMessage=i=>t.onMessage(n,i.type,i.payload),e.onError=i=>t.onError(n,i),t.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!rh||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++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new n2({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return U5?this.maxMobileConcurrency:this.maxConcurrency}};const $5={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};let rO=class Yd{props;workerPools=new Map;static _workerFarm;static isSupported(){return n2.isSupported()}static getWorkerFarm(e={}){return Yd._workerFarm=Yd._workerFarm||new Yd({}),Yd._workerFarm.setProps(e),Yd._workerFarm}constructor(e){this.props={...$5},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:n,url:i}=e;let s=this.workerPools.get(t);return s||(s=new j5({name:t,source:n,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};function W5(r,e={}){const t=e[r.id]||{},n=rh?`${r.id}-worker.js`:`${r.id}-worker-node.js`;let i=t.workerUrl;if(!i&&r.id==="compression"&&(i=e.workerUrl),e._workerType==="test"&&(rh?i=`modules/${r.module}/dist/${n}`:i=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!i){let s=r.version;s==="latest"&&(s=L5);const o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return Yu(i),i}function J5(r,e=N5){Yu(r,"no worker provided");const t=r.version;return!(!e||!t)}const Fu={};function X5(r,e){return!rO.isSupported()||!rh&&!e?._nodeWorkers?!1:r.worker&&e?.worker}async function K5(r,e,t,n,i){const s=r.id,o=W5(r,t),f=rO.getWorkerFarm(t).getWorkerPool({name:s,url:o});t=JSON.parse(JSON.stringify(t)),n=JSON.parse(JSON.stringify(n||{}));const A=await f.startJob("process-on-worker",q5.bind(null,i));return A.postMessage("process",{input:e,options:t,context:n}),await(await A.result).result}async function q5(r,e,t,n){switch(t){case"done":e.done(n);break;case"error":e.error(new Error(n.error));break;case"process":const{id:i,input:s,options:o}=n;try{const c=await r(s,o);e.postMessage("done",{id:i,result:c})}catch(c){const f=c instanceof Error?c.message:"unknown error";e.postMessage("error",{id:i,error:f})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function Y5(r,e,t){if(t=t||r.byteLength,r.byteLength<t||e.byteLength<t)return!1;const n=new Uint8Array(r),i=new Uint8Array(e);for(let s=0;s<n.length;++s)if(n[s]!==i[s])return!1;return!0}function Z5(...r){return Q5(r)}function Q5(r){const e=r.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),t=e.reduce((s,o)=>s+o.byteLength,0),n=new Uint8Array(t);let i=0;for(const s of e)n.set(s,i),i+=s.byteLength;return n.buffer}async function ez(r){const e=[];for await(const t of r)e.push(t);return Z5(...e)}let tz="";const TB={};function rz(r){for(const e in TB)if(r.startsWith(e)){const t=TB[e];r=r.replace(e,t)}return!r.startsWith("http://")&&!r.startsWith("https://")&&(r=`${tz}${r}`),r}function nz(r){return r&&typeof r=="object"&&r.isBuffer}function nO(r){if(nz(r))return r;if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r))return r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);if(typeof r=="string"){const e=r;return new TextEncoder().encode(e).buffer}if(r&&typeof r=="object"&&r._toArrayBuffer)return r._toArrayBuffer();throw new Error("toArrayBuffer")}function iO(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(e+1):""}function iz(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(0,e):""}const sz=r=>typeof r=="boolean",QA=r=>typeof r=="function",Og=r=>r!==null&&typeof r=="object",EB=r=>Og(r)&&r.constructor==={}.constructor,oz=r=>!!r&&typeof r[Symbol.iterator]=="function",az=r=>r&&typeof r[Symbol.asyncIterator]=="function",yh=r=>typeof Response<"u"&&r instanceof Response||r&&r.arrayBuffer&&r.text&&r.json,vh=r=>typeof Blob<"u"&&r instanceof Blob,cz=r=>r&&typeof r=="object"&&r.isBuffer,lz=r=>typeof ReadableStream<"u"&&r instanceof ReadableStream||Og(r)&&QA(r.tee)&&QA(r.cancel)&&QA(r.getReader),uz=r=>Og(r)&&QA(r.read)&&QA(r.pipe)&&sz(r.readable),sO=r=>lz(r)||uz(r);let fz=class extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response};const hz=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,dz=/^([-\w.]+\/[-\w.+]+)/;function BB(r,e){return r.toLowerCase()===e.toLowerCase()}function pz(r){const e=dz.exec(r);return e?e[1]:r}function SB(r){const e=hz.exec(r);return e?e[1]:""}const oO=/\?.*/;function Az(r){const e=r.match(oO);return e&&e[0]}function Hx(r){return r.replace(oO,"")}function gz(r){if(r.length<50)return r;const e=r.slice(r.length-15);return`${r.substr(0,32)}...${e}`}function sy(r){return yh(r)?r.url:vh(r)?r.name||"":typeof r=="string"?r:""}function jx(r){if(yh(r)){const e=r,t=e.headers.get("content-type")||"",n=Hx(e.url);return pz(t)||SB(n)}return vh(r)?r.type||"":typeof r=="string"?SB(r):""}function mz(r){return yh(r)?r.headers["content-length"]||-1:vh(r)?r.size:typeof r=="string"?r.length:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:-1}async function aO(r){if(yh(r))return r;const e={},t=mz(r);t>=0&&(e["content-length"]=String(t));const n=sy(r),i=jx(r);i&&(e["content-type"]=i);const s=await vz(r);s&&(e["x-first-bytes"]=s),typeof r=="string"&&(r=new TextEncoder().encode(r));const o=new Response(r,{headers:e});return Object.defineProperty(o,"url",{value:n}),o}async function _z(r){if(!r.ok)throw await yz(r)}async function yz(r){const e=gz(r.url);let t=`Failed to fetch resource (${r.status}) ${r.statusText}: ${e}`;t=t.length>100?`${t.slice(0,100)}...`:t;const n={reason:r.statusText,url:r.url,response:r};try{const i=r.headers.get("Content-Type");n.reason=i?.includes("application/json")?await r.json():r.text()}catch{}return new fz(t,n)}async function vz(r){if(typeof r=="string")return`data:,${r.slice(0,5)}`;if(r instanceof Blob){const t=r.slice(0,5);return await new Promise(n=>{const i=new FileReader;i.onload=s=>n(s?.target?.result),i.readAsDataURL(t)})}if(r instanceof ArrayBuffer){const t=r.slice(0,5);return`data:base64,${bz(t)}`}return null}function bz(r){let e="";const t=new Uint8Array(r);for(let n=0;n<t.byteLength;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function xz(r){return!wz(r)&&!Cz(r)}function wz(r){return r.startsWith("http:")||r.startsWith("https:")}function Cz(r){return r.startsWith("data:")}async function IB(r,e){if(typeof r=="string"){const t=rz(r);return xz(t)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(t,e):await fetch(t,e)}return await aO(r)}const MB=globalThis,PB=globalThis.process||{};function Tz(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function $x(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Tz()}const cO="4.0.7";function Ez(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}let Bz=class{constructor(e,t,n="sessionStorage"){this.storage=Ez(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function Sz(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Iz(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var u_;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(u_||(u_={}));const Mz=10;function RB(r){return typeof r!="string"?r:(r=r.toUpperCase(),u_[r]||u_.WHITE)}function Pz(r,e,t){return!$x&&typeof r=="string"&&(e&&(r=`\x1B[${RB(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${RB(t)+Mz}m${r}\x1B[49m`)),r}function Rz(r,e=["constructor"]){const t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),i=r;for(const s of n){const o=i[s];typeof o=="function"&&(e.find(c=>s===c)||(i[s]=o.bind(r)))}}function Wx(r,e){if(!r)throw new Error("Assertion failed")}function vd(){let r;if($x()&&MB.performance)r=MB?.performance?.now?.();else if("hrtime"in PB){const e=PB?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const bd={debug:$x()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Fz={enabled:!0,level:0};function xd(){}const FB={},DB={once:!0};let Jx=class{constructor({id:e}={id:""}){this.VERSION=cO,this._startTs=vd(),this._deltaTs=vd(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Bz(`__probe-${this.id}__`,Fz),this.timeStamp(`${this.id} started`),Rz(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((vd()-this._startTs).toPrecision(10))}getDelta(){return Number((vd()-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,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,bd.warn,arguments,DB)}error(e){return this._getLogFunction(0,e,bd.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,bd.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,bd.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,bd.debug||bd.info,arguments,DB)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||xd,n&&[n],{tag:Oz(t)}):xd}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||xd)}group(e,t,n={collapsed:!1}){const i=OB({logLevel:e,message:t,opts:n}),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||xd)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=lO(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=OB({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,Wx(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=vd();const o=s.tag||s.message;if(s.once&&o)if(!FB[o])FB[o]=vd();else return xd;return t=Dz(this.id,s.message,s),n.bind(console,t,...s.args)}return xd}};Jx.VERSION=cO;function lO(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Wx(Number.isFinite(e)&&e>=0),e}function OB(r){const{logLevel:e,message:t}=r;r.logLevel=lO(e);const n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const i=typeof r.message;return Wx(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function Dz(r,e,t){if(typeof e=="string"){const n=t.time?Iz(Sz(t.total)):"";e=t.time?`${r}: ${n}  ${e}`:`${r}: ${e}`,e=Pz(e,t.color,t.background)}return e}function Oz(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}const LB=new Jx({id:"loaders.gl"});let Lz=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},kz=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)}};const uO={fetch:null,mimeType:void 0,nothrow:!1,log:new kz,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Gx,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Nz={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 fO(){globalThis.loaders=globalThis.loaders||{};const{loaders:r}=globalThis;return r._state||(r._state={}),r._state}function hO(){const r=fO();return r.globalOptions=r.globalOptions||{...uO},r.globalOptions}function Uz(r,e,t,n){return t=t||[],t=Array.isArray(t)?t:[t],zz(r,t),Vz(e,r,n)}function zz(r,e){kB(r,null,uO,Nz,e);for(const t of e){const n=r&&r[t.id]||{},i=t.options&&t.options[t.id]||{},s=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};kB(n,t.id,i,s,e)}}function kB(r,e,t,n,i){const s=e||"Top level",o=e?`${e}.`:"";for(const c in r){const f=!e&&Og(r[c]),A=c==="baseUri"&&!e,v=c==="workerUrl"&&e;if(!(c in t)&&!A&&!v){if(c in n)LB.warn(`${s} loader option '${o}${c}' no longer supported, use '${n[c]}'`)();else if(!f){const w=Gz(c,i);LB.warn(`${s} loader option '${o}${c}' not recognized. ${w}`)()}}}}function Gz(r,e){const t=r.toLowerCase();let n="";for(const i of e)for(const s in i.options){if(r===s)return`Did you mean '${i.id}.${s}'?`;const o=s.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(n=n||`Did you mean '${i.id}.${s}'?`)}return n}function Vz(r,e,t){const i={...r.options||{}};return Hz(i,t),i.log===null&&(i.log=new Lz),NB(i,hO()),NB(i,e),i}function NB(r,e){for(const t in e)if(t in e){const n=e[t];EB(n)&&EB(r[t])?r[t]={...r[t],...e[t]}:r[t]=e[t]}}function Hz(r,e){e&&!("baseUri"in r)&&(r.baseUri=e)}function Xx(r){return r?(Array.isArray(r)&&(r=r[0]),Array.isArray(r?.extensions)):!1}function Kx(r){o_(r,"null loader"),o_(Xx(r),"invalid loader");let e;return Array.isArray(r)&&(e=r[1],r=r[0],r={...r,options:{...r.options,...e}}),(r?.parseTextSync||r?.parseText)&&(r.text=!0),r.text||(r.binary=!0),r}const dO=()=>{const r=fO();return r.loaderRegistry=r.loaderRegistry||[],r.loaderRegistry};function jz(r){const e=dO();r=Array.isArray(r)?r:[r];for(const t of r){const n=Kx(t);e.find(i=>n===i)||e.unshift(n)}}function $z(){return dO()}const Wz=new Jx({id:"loaders.gl"}),Jz=/\.([^.]+)$/;async function Xz(r,e=[],t,n){if(!pO(r))return null;let i=UB(r,e,{...t,nothrow:!0},n);if(i)return i;if(vh(r)&&(r=await r.slice(0,10).arrayBuffer(),i=UB(r,e,t,n)),!i&&!t?.nothrow)throw new Error(AO(r));return i}function UB(r,e=[],t,n){if(!pO(r))return null;if(e&&!Array.isArray(e))return Kx(e);let i=[];e&&(i=i.concat(e)),t?.ignoreRegisteredLoaders||i.push(...$z()),qz(i);const s=Kz(r,i,t,n);if(!s&&!t?.nothrow)throw new Error(AO(r));return s}function Kz(r,e,t,n){const i=sy(r),s=jx(r),o=Hx(i)||n?.url;let c=null,f="";return t?.mimeType&&(c=Gv(e,t?.mimeType),f=`match forced by supplied MIME type ${t?.mimeType}`),c=c||Yz(e,o),f=f||(c?`matched url ${o}`:""),c=c||Gv(e,s),f=f||(c?`matched MIME type ${s}`:""),c=c||Qz(e,r),f=f||(c?`matched initial data ${gO(r)}`:""),t?.fallbackMimeType&&(c=c||Gv(e,t?.fallbackMimeType),f=f||(c?`matched fallback MIME type ${s}`:"")),f&&Wz.log(1,`selectLoader selected ${c?.name}: ${f}.`),c}function pO(r){return!(r instanceof Response&&r.status===204)}function AO(r){const e=sy(r),t=jx(r);let n="No valid loader found (";n+=e?`${iO(e)}, `:"no url provided, ",n+=`MIME type: ${t?`"${t}"`:"not provided"}, `;const i=r?gO(r):"";return n+=i?` first bytes: "${i}"`:"first bytes: not available",n+=")",n}function qz(r){for(const e of r)Kx(e)}function Yz(r,e){const t=e&&Jz.exec(e),n=t&&t[1];return n?Zz(r,n):null}function Zz(r,e){e=e.toLowerCase();for(const t of r)for(const n of t.extensions)if(n.toLowerCase()===e)return t;return null}function Gv(r,e){for(const t of r)if(t.mimeTypes?.some(n=>BB(e,n))||BB(e,`application/x.${t.id}`))return t;return null}function Qz(r,e){if(!e)return null;for(const t of r)if(typeof e=="string"){if(eG(e,t))return t}else if(ArrayBuffer.isView(e)){if(zB(e.buffer,e.byteOffset,t))return t}else if(e instanceof ArrayBuffer&&zB(e,0,t))return t;return null}function eG(r,e){return e.testText?e.testText(r):(Array.isArray(e.tests)?e.tests:[e.tests]).some(n=>r.startsWith(n))}function zB(r,e,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>tG(r,e,t,i))}function tG(r,e,t,n){if(n instanceof ArrayBuffer)return Y5(n,r,n.byteLength);switch(typeof n){case"function":return n(r);case"string":const i=i2(r,e,n.length);return n===i;default:return!1}}function gO(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?i2(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?i2(r,0,e):""}function i2(r,e,t){if(r.byteLength<e+t)return"";const n=new DataView(r);let i="";for(let s=0;s<t;s++)i+=String.fromCharCode(n.getUint8(e+s));return i}const rG=256*1024;function*nG(r,e){const t=e?.chunkSize||rG;let n=0;const i=new TextEncoder;for(;n<r.length;){const s=Math.min(r.length-n,t),o=r.slice(n,n+s);n+=s,yield i.encode(o)}}const iG=256*1024;function*sG(r,e={}){const{chunkSize:t=iG}=e;let n=0;for(;n<r.byteLength;){const i=Math.min(r.byteLength-n,t),s=new ArrayBuffer(i),o=new Uint8Array(r,n,i);new Uint8Array(s).set(o),n+=i,yield s}}const oG=1024*1024;async function*aG(r,e){const t=e?.chunkSize||oG;let n=0;for(;n<r.size;){const i=n+t,s=await r.slice(n,i).arrayBuffer();n=i,yield s}}function GB(r,e){return Gx?cG(r,e):lG(r)}async function*cG(r,e){const t=r.getReader();let n;try{for(;;){const i=n||t.read();e?._streamReadAhead&&(n=t.read());const{done:s,value:o}=await i;if(s)return;yield nO(o)}}catch{t.releaseLock()}}async function*lG(r,e){for await(const t of r)yield nO(t)}function uG(r,e){if(typeof r=="string")return nG(r,e);if(r instanceof ArrayBuffer)return sG(r,e);if(vh(r))return aG(r,e);if(sO(r))return GB(r,e);if(yh(r))return GB(r.body,e);throw new Error("makeIterator")}const mO="Cannot convert supplied data type";function fG(r,e,t){if(e.text&&typeof r=="string")return r;if(cz(r)&&(r=r.buffer),r instanceof ArrayBuffer){const n=r;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(r)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(r);let n=r.buffer;const i=r.byteLength||r.length;return(r.byteOffset!==0||i!==n.byteLength)&&(n=n.slice(r.byteOffset,r.byteOffset+i)),n}throw new Error(mO)}async function hG(r,e,t){const n=r instanceof ArrayBuffer||ArrayBuffer.isView(r);if(typeof r=="string"||n)return fG(r,e);if(vh(r)&&(r=await aO(r)),yh(r)){const i=r;return await _z(i),e.binary?await i.arrayBuffer():await i.text()}if(sO(r)&&(r=uG(r,t)),oz(r)||az(r))return ez(r);throw new Error(mO)}function _O(r,e){const t=hO(),n=r||t;return typeof n.fetch=="function"?n.fetch:Og(n.fetch)?i=>IB(i,n.fetch):e?.fetch?e?.fetch:IB}function dG(r,e,t){if(t)return t;const n={fetch:_O(e,r),...r};if(n.url){const i=Hx(n.url);n.baseUrl=i,n.queryString=Az(n.url),n.filename=iO(i),n.baseUrl=iz(i)}return Array.isArray(n.loaders)||(n.loaders=null),n}function pG(r,e){if(r&&!Array.isArray(r))return r;let t;if(r&&(t=Array.isArray(r)?r:[r]),e&&e.loaders){const n=Array.isArray(e.loaders)?e.loaders:[e.loaders];t=t?[...t,...n]:n}return t&&t.length?t:void 0}async function f_(r,e,t,n){e&&!Array.isArray(e)&&!Xx(e)&&(n=void 0,t=e,e=void 0),r=await r,t=t||{};const i=sy(r),o=pG(e,n),c=await Xz(r,o,t);return c?(t=Uz(t,c,o,i),n=dG({url:i,_parse:f_,loaders:o},t,n||null),await AG(c,r,t,n)):null}async function AG(r,e,t,n){if(J5(r),t=O5(r.options,t),yh(e)){const s=e,{ok:o,redirected:c,status:f,statusText:A,type:v,url:w}=s,S=Object.fromEntries(s.headers.entries());n.response={headers:S,ok:o,redirected:c,status:f,statusText:A,type:v,url:w}}e=await hG(e,r,t);const i=r;if(i.parseTextSync&&typeof e=="string")return i.parseTextSync(e,t,n);if(X5(r,t))return await K5(r,e,t,n,f_);if(i.parseText&&typeof e=="string")return await i.parseText(e,t,n);if(i.parse)return await i.parse(e,t,n);throw Yu(!i.parseSync),new Error(`${r.id} loader - no parser found and worker is disabled`)}async function s2(r,e,t,n){let i,s;!Array.isArray(e)&&!Xx(e)?(i=[],s=e):(i=e,s=t);const o=_O(s);let c=r;return typeof r=="string"&&(c=await o(r)),vh(r)&&(c=await o(r)),Array.isArray(i)?await f_(c,i,s):await f_(c,i,s)}const gG="4.2.4",mG=globalThis.loaders?.parseImageNode,o2=typeof Image<"u",a2=typeof ImageBitmap<"u",_G=!!mG,c2=Gx?!0:_G;function yG(r){switch(r){case"auto":return a2||o2||c2;case"imagebitmap":return a2;case"image":return o2;case"data":return c2;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function vG(){if(a2)return"imagebitmap";if(o2)return"image";if(c2)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function bG(r){const e=wG(r);if(!e)throw new Error("Not an image");return e}function xG(r){switch(bG(r)){case"data":return r;case"image":case"imagebitmap":const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)throw new Error("getImageData");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height);default:throw new Error("getImageData")}}function wG(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&r instanceof Image?"image":r&&typeof r=="object"&&r.data&&r.width&&r.height?"data":null}const CG=/^data:image\/svg\+xml/,TG=/\.svg((\?|#).*)?$/;function qx(r){return r&&(CG.test(r)||TG.test(r))}function EG(r,e){if(qx(e)){let n=new TextDecoder().decode(r);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(s){throw new Error(s.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return yO(r,e)}function yO(r,e){if(qx(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}async function vO(r,e,t){const n=EG(r,t),i=self.URL||self.webkitURL,s=typeof n!="string"&&i.createObjectURL(n);try{return await BG(s||n,e)}finally{s&&i.revokeObjectURL(s)}}async function BG(r,e){const t=new Image;return t.src=r,e.image&&e.image.decode&&t.decode?(await t.decode(),t):await new Promise((n,i)=>{try{t.onload=()=>n(t),t.onerror=s=>{const o=s instanceof Error?s.message:"error";i(new Error(o))}}catch(s){i(s)}})}const SG={};let VB=!0;async function IG(r,e,t){let n;qx(t)?n=await vO(r,e,t):n=yO(r,t);const i=e&&e.imagebitmap;return await MG(n,i)}async function MG(r,e=null){if((PG(e)||!VB)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),VB=!1}return await createImageBitmap(r)}function PG(r){for(const e in r||SG)return!1;return!0}function RG(r){return!LG(r,"ftyp",4)||(r[8]&96)===0?null:FG(r)}function FG(r){switch(DG(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function DG(r,e,t){return String.fromCharCode(...r.slice(e,t))}function OG(r){return[...r].map(e=>e.charCodeAt(0))}function LG(r,e,t=0){const n=OG(e);for(let i=0;i<n.length;++i)if(n[i]!==r[i+t])return!1;return!0}const il=!1,eg=!0;function bO(r){const e=Lg(r);return NG(e)||GG(e)||UG(e)||zG(e)||kG(e)}function kG(r){const e=new Uint8Array(r instanceof DataView?r.buffer:r),t=RG(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function NG(r){const e=Lg(r);return e.byteLength>=24&&e.getUint32(0,il)===2303741511?{mimeType:"image/png",width:e.getUint32(16,il),height:e.getUint32(20,il)}:null}function UG(r){const e=Lg(r);return e.byteLength>=10&&e.getUint32(0,il)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,eg),height:e.getUint16(8,eg)}:null}function zG(r){const e=Lg(r);return e.byteLength>=14&&e.getUint16(0,il)===16973&&e.getUint32(2,eg)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,eg),height:e.getUint32(22,eg)}:null}function GG(r){const e=Lg(r);if(!(e.byteLength>=3&&e.getUint16(0,il)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:n,sofMarkers:i}=VG();let s=2;for(;s+9<e.byteLength;){const o=e.getUint16(s,il);if(i.has(o))return{mimeType:"image/jpeg",height:e.getUint16(s+5,il),width:e.getUint16(s+7,il)};if(!n.has(o))return null;s+=2,s+=e.getUint16(s,il)}return null}function VG(){const r=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)r.add(t);return{tableMarkers:r,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Lg(r){if(r instanceof DataView)return r;if(ArrayBuffer.isView(r))return new DataView(r.buffer);if(r instanceof ArrayBuffer)return new DataView(r);throw new Error("toDataView")}async function HG(r,e){const{mimeType:t}=bO(r)||{},n=globalThis.loaders?.parseImageNode;return o_(n),await n(r,t)}async function jG(r,e,t){e=e||{};const i=(e.image||{}).type||"auto",{url:s}=t||{},o=$G(i);let c;switch(o){case"imagebitmap":c=await IG(r,e,s);break;case"image":c=await vO(r,e,s);break;case"data":c=await HG(r);break;default:o_(!1)}return i==="data"&&(c=xG(c)),c}function $G(r){switch(r){case"auto":case"data":return vG();default:return yG(r),r}}const WG=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],JG=["image/png","image/jpeg","image/gif","
6image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],XG={image:{type:"auto",decode:!0}},KG={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:gG,mimeTypes:JG,extensions:WG,parse:jG,tests:[r=>!!bO(new DataView(r))],options:XG},Yr=new YD({id:"deck"});let l2={};function qG(r){l2=r}function Ao(r,e,t,n){Yr.level>0&&l2[r]&&l2[r].call(null,e,t,n)}function YG(r){const e=r[0],t=r[r.length-1];return e==="{"&&t==="}"||e==="["&&t==="]"}const ZG={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:YG,parseTextSync:JSON.parse};function QG(){const r="9.1.14",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==r)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${r}`);return e||(Yr.log(1,`deck.gl ${r}`)(),globalThis.deck={...globalThis.deck,VERSION:r,version:r,log:Yr,_registerLoggers:qG},jz([ZG,[KG,{imagebitmap:{premultiplyAlpha:"none"}}]])),r}const eV=QG();function Yx(r,e){if(!r)throw new Error(e||"shadertools: assertion failed.")}const Vv={number:{type:"number",validate(r,e){return Number.isFinite(r)&&typeof e=="object"&&(e.max===void 0||r<=e.max)&&(e.min===void 0||r>=e.min)}},array:{type:"array",validate(r,e){return Array.isArray(r)||ArrayBuffer.isView(r)}}};function tV(r){const e={};for(const[t,n]of Object.entries(r))e[t]=rV(n);return e}function rV(r){let e=HB(r);if(e!=="object")return{value:r,...Vv[e],type:e};if(typeof r=="object")return r?r.type!==void 0?{...r,...Vv[r.type],type:r.type}:r.value===void 0?{type:"object",value:r}:(e=HB(r.value),{...r,...Vv[e],type:e}):{type:"object",value:null};throw new Error("props")}function HB(r){return Array.isArray(r)||ArrayBuffer.isView(r)?"array":typeof r}const nV=`#ifdef MODULE_LOGDEPTH
7  logdepth_adjustPosition(gl_Position);
8#endif
9`,iV=`#ifdef MODULE_MATERIAL
10  fragColor = material_filterColor(fragColor);
11#endif
12
13#ifdef MODULE_LIGHTING
14  fragColor = lighting_filterColor(fragColor);
15#endif
16
17#ifdef MODULE_FOG
18  fragColor = fog_filterColor(fragColor);
19#endif
20
21#ifdef MODULE_PICKING
22  fragColor = picking_filterHighlightColor(fragColor);
23  fragColor = picking_filterPickingColor(fragColor);
24#endif
25
26#ifdef MODULE_LOGDEPTH
27  logdepth_setFragDepth();
28#endif
29`,sV={vertex:nV,fragment:iV},jB=/void\s+main\s*\([^)]*\)\s*\{\n?/,$B=/}\n?[^{}]*$/,Hv=[],D0="__LUMA_INJECT_DECLARATIONS__";function oV(r){const e={vertex:{},fragment:{}};for(const t in r){let n=r[t];const i=aV(t);typeof n=="string"&&(n={order:0,injection:n}),e[i][t]=n}return e}function aV(r){const e=r.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function h_(r,e,t,n=!1){const i=e==="vertex";for(const s in t){const o=t[s];o.sort((f,A)=>f.order-A.order),Hv.length=o.length;for(let f=0,A=o.length;f<A;++f)Hv[f]=o[f].injection;const c=`${Hv.join(`
30`)}
31`;switch(s){case"vs:#decl":i&&(r=r.replace(D0,c));break;case"vs:#main-start":i&&(r=r.replace(jB,f=>f+c));break;case"vs:#main-end":i&&(r=r.replace($B,f=>c+f));break;case"fs:#decl":i||(r=r.replace(D0,c));break;case"fs:#main-start":i||(r=r.replace(jB,f=>f+c));break;case"fs:#main-end":i||(r=r.replace($B,f=>c+f));break;default:r=r.replace(s,f=>f+c)}}return r=r.replace(D0,""),n&&(r=r.replace(/\}\s*$/,s=>s+sV[e])),r}function d_(r){r.map(e=>xO(e))}function xO(r){if(r.instance)return;d_(r.dependencies||[]);const{propTypes:e={},deprecations:t=[],inject:n={}}=r,i={normalizedInjections:oV(n),parsedDeprecations:cV(t)};e&&(i.propValidators=tV(e)),r.instance=i;let s={};e&&(s=Object.entries(e).reduce((o,[c,f])=>{const A=f?.value;return A&&(o[c]=A),o},{})),r.defaultUniforms={...r.defaultUniforms,...s}}function wO(r,e,t){r.deprecations?.forEach(n=>{n.regex?.test(e)&&(n.deprecated?t.deprecated(n.old,n.new)():t.removed(n.old,n.new)())})}function cV(r){return r.forEach(e=>{switch(e.type){case"function":e.regex=new RegExp(`\\b${e.old}\\(`);break;default:e.regex=new RegExp(`${e.type} ${e.old};`)}}),r}function Zx(r){d_(r);const e={},t={};CO({modules:r,level:0,moduleMap:e,moduleDepth:t});const n=Object.keys(t).sort((i,s)=>t[s]-t[i]).map(i=>e[i]);return d_(n),n}function CO(r){const{modules:e,level:t,moduleMap:n,moduleDepth:i}=r;if(t>=5)throw new Error("Possible loop in shader dependency graph");for(const s of e)n[s.name]=s,(i[s.name]===void 0||i[s.name]<t)&&(i[s.name]=t);for(const s of e)s.dependencies&&CO({modules:s.dependencies,level:t+1,moduleMap:n,moduleDepth:i})}function lV(r){switch(r?.gpu.toLowerCase()){case"apple":return`#define APP
31LE_GPU
32// Apple optimizes away the calculation necessary for emulated fp64
33#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
34#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
35// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
36#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
37`;case"nvidia":return`#define NVIDIA_GPU
38// Nvidia optimizes away the calculation necessary for emulated fp64
39#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
40`;case"intel":return`#define INTEL_GPU
41// Intel optimizes away the calculation necessary for emulated fp64
42#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
43// Intel's built-in 'tan' function doesn't have acceptable precision
44#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
45// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
46#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
47`;case"amd":return`#define AMD_GPU
48`;default:return`#define DEFAULT_GPU
49// Prevent driver from optimizing away the calculation necessary for emulated fp64
50#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
51// Headless Chrome's software shader 'tan' function doesn't have acceptable precision
52#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
53// If the GPU doesn't have full 32 bits precision, will causes overflow
54#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
55`}}function uV(r,e){if(Number(r.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 r=WB(r,fV),r;case"fragment":return r=WB(r,hV),r;default:throw new Error(e)}}const TO=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
56`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],fV=[...TO,[u2("attribute"),"in $1"],[u2("varying"),"out $1"]],hV=[...TO,[u2("varying"),"in $1"]];function WB(r,e){for(const[t,n]of e)r=r.replace(t,n);return r}function u2(r){return new RegExp(`\\b${r}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function EO(r,e){let t="";for(const n in r){const i=r[n];if(t+=`void ${i.signature} {
57`,i.header&&(t+=`  ${i.header}`),e[n]){const s=e[n];s.sort((o,c)=>o.order-c.order);for(const o of s)t+=`  ${o.injection}
58`}i.footer&&(t+=`  ${i.footer}`),t+=`}
59`}return t}function BO(r){const e={vertex:{},fragment:{}};for(const t of r){let n,i;typeof t!="string"?(n=t,i=n.hook):(n={},i=t),i=i.trim();const[s,o]=i.split(":"),c=i.replace(/\(.+/,""),f=Object.assign(n,{signature:o});switch(s){case"vs":e.vertex[c]=f;break;case"fs":e.fragment[c]=f;break;default:throw new Error(s)}}return e}function dV(r,e){return{name:pV(r,e),language:"glsl",version:AV(r)}}function pV(r,e="unnamed"){const n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(r);return n?n[1]:e}function AV(r){let e=100;const t=r.match(/[^\s]+/g);if(t&&t.length>=2&&t[0]==="#version"){const n=parseInt(t[1],10);Number.isFinite(n)&&(e=n)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}const SO=`
60
61${D0}
62`,gV=`precision highp float;
63`;function mV(r){const e=Zx(r.modules||[]);return{source:yV(r.platformInfo,{...r,source:r.source,stage:"vertex",modules:e}),getUniforms:IO(e)}}function _V(r){const{vs:e,fs:t}=r,n=Zx(r.modules||[]);return{vs:JB(r.platformInfo,{...r,source:e,stage:"vertex",modules:n}),fs:JB(r.platformInfo,{...r,source:t,stage:"fragment",modules:n}),getUniforms:IO(n)}}function yV(r,e){const{source:t,stage:n,modules:i,hookFunctions:s=[],inject:o={},log:c}=e;Yx(typeof t=="string","shader source must be a string");const f=t;let A="";const v=BO(s),w={},S={},F={};for(const U in o){const $=typeof o[U]=="string"?{injection:o[U],order:0}:o[U],G=/^(v|f)s:(#)?([\w-]+)$/.exec(U);if(G){const H=G[2],J=G[3];H?J==="decl"?S[U]=[$]:F[U]=[$]:w[U]=[$]}else F[U]=[$]}const N=i;for(const U of N){c&&wO(U,f,c);const $=MO(U,"wgsl");A+=$;const G=U.injections?.[n]||{};for(const H in G){const J=/^(v|f)s:#([\w-]+)$/.exec(H);if(J){const q=J[2]==="decl"?S:F;q[H]=q[H]||[],q[H].push(G[H])}else w[H]=w[H]||[],w[H].push(G[H])}}return A+=SO,A=h_(A,n,S),A+=EO(v[n],w),A+=f,A=h_(A,n,F),A}function JB(r,e){const{id:t,source:n,stage:i,language:s="glsl",modules:o,defines:c={},hookFunctions:f=[],inject:A={},prologue:v=!0,log:w}=e;Yx(typeof n=="string","shader source must be a string");const S=s==="glsl"?dV(n).version:-1,F=r.shaderLanguageVersion,N=S===100?"#version 100":"#version 300 es",$=n.split(`
64`).slice(1).join(`
65`),G={};o.forEach(Te=>{Object.assign(G,Te.defines)}),Object.assign(G,c);let H="";switch(s){case"wgsl":break;case"glsl":H=v?`${N}
66
67// ----- PROLOGUE -------------------------
68${vV({id:t,source:n,stage:i})}
69${`#define SHADER_TYPE_${i.toUpperCase()}`}
70
71${lV(r)}
72${i==="fragment"?gV:""}
73
74// ----- APPLICATION DEFINES -------------------------
75
76${bV(G)}
77
78`:`${N}
79`;break}
79const J=BO(f),ue={},q={},se={};for(const Te in A){const Ue=typeof A[Te]=="string"?{injection:A[Te],order:0}:A[Te],de=/^(v|f)s:(#)?([\w-]+)$/.exec(Te);if(de){const me=de[2],pe=de[3];me?pe==="decl"?q[Te]=[Ue]:se[Te]=[Ue]:ue[Te]=[Ue]}else se[Te]=[Ue]}for(const Te of o){w&&wO(Te,$,w);const Ue=MO(Te,i);H+=Ue;const de=Te.instance?.normalizedInjections[i]||{};for(const me in de){const pe=/^(v|f)s:#([\w-]+)$/.exec(me);if(pe){const re=pe[2]==="decl"?q:se;re[me]=re[me]||[],re[me].push(de[me])}else ue[me]=ue[me]||[],ue[me].push(de[me])}}return H+="// ----- MAIN SHADER SOURCE -------------------------",H+=SO,H=h_(H,i,q),H+=EO(J[i],ue),H+=$,H=h_(H,i,se),s==="glsl"&&S!==F&&(H=uV(H,i)),H.trim()}function IO(r){return function(t){const n={};for(const i of r){const s=i.getUniforms?.(t,n);Object.assign(n,s)}return n}}function vV(r){const{id:e,source:t,stage:n}=r;return e&&t.indexOf("SHADER_NAME")===-1?`
80#define SHADER_NAME ${e}_${n}`:""}function bV(r={}){let e="";for(const t in r){const n=r[t];(n||Number.isFinite(n))&&(e+=`#define ${t.toUpperCase()} ${r[t]}
81`)}return e}function MO(r,e){let t;switch(e){case"vertex":t=r.vs||"";break;case"fragment":t=r.fs||"";break;case"wgsl":t=r.source||"";break;default:Yx(!1)}if(!r.name)throw new Error("Shader module must have a name");const n=r.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");let i=`// ----- MODULE ${r.name} ---------------
82
83`;return e!=="wgsl"&&(i+=`#define MODULE_${n}
84`),i+=`${t}
85`,i}const xV=/^\s*\#\s*ifdef\s*([a-zA-Z_]+)\s*$/,wV=/^\s*\#\s*endif\s*$/;function CV(r,e){const t=r.split(`
86`),n=[];let i=!0,s=null;for(const o of t){const c=o.match(xV),f=o.match(wV);c?(s=c[1],i=!!e?.defines?.[s]):f?i=!0:i&&n.push(o)}return n.join(`
87`)}class qf{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return qf.defaultShaderAssembler=qf.defaultShaderAssembler||new qf,qf.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(t=>t.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){const t=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==t)}addShaderHook(e,t){t&&(e=Object.assign(t,{hook:e})),this._hookFunctions.push(e)}assembleWGSLShader(e){const t=this._getModuleList(e.modules),n=this._hookFunctions,{source:i,getUniforms:s}=mV({...e,source:e.source,modules:t,hookFunctions:n});return{source:e.platformInfo.shaderLanguage==="wgsl"?CV(i):i,getUniforms:s,modules:t}}assembleGLSLShaderPair(e){const t=this._getModuleList(e.modules),n=this._hookFunctions;return{..._V({...e,vs:e.vs,fs:e.fs,modules:t,hookFunctions:n}),modules:t}}_getModuleList(e=[]){const t=new Array(this._defaultModules.length+e.length),n={};let i=0;for(let s=0,o=this._defaultModules.length;s<o;++s){const c=this._defaultModules[s],f=c.name;t[i++]=c,n[f]=!0}for(let s=0,o=e.length;s<o;++s){const c=e[s],f=c.name;n[f]||(t[i++]=c,n[f]=!0)}return t.length=i,d_(t),t}}const TV=`out vec4 transform_output;
88void main() {
89  transform_output = vec4(0);
90}`,EV=`#version 300 es
91${TV}`;function PO(r){const{input:e,inputChannels:t,output:n}=r||{};if(!e)return EV;if(!t)throw new Error("inputChannels");const i=BV(t),s=SV(e,t);return`#version 300 es
92in ${i} ${e};
93out vec4 ${n};
94void main() {
95  ${n} = ${s};
96}`}function BV(r){switch(r){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${r}`)}}function SV(r,e){switch(e){case 1:return`vec4(${r}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${r}, 0.0, 1.0)`;case 3:return`vec4(${r}, 1.0)`;case 4:return r;default:throw new Error(`invalid channels: ${e}`)}}function XB(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}let KB=class{constructor(e,t){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=t,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=XB(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(XB()-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)}},IV=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e of Object.values(this.stats))e.reset();return this}forEach(e){for(const t of Object.values(this.stats))e(t)}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){const{name:t,type:n}=e;let i=this.stats[t];
vendor: 8,722 bytes, line 96
96return i||(e instanceof KB?i=e:i=new KB(t,n),this.stats[t]=i),i}};class MV{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new IV({id:e})),this.stats.get(e)}}const RO=new MV;function PV(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}let RV=class{constructor(e,t,n="sessionStorage"){this.storage=PV(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function FV(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function DV(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var p_;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(p_||(p_={}));const OV=10;function qB(r){return typeof r!="string"?r:(r=r.toUpperCase(),p_[r]||p_.WHITE)}function LV(r,e,t){return!Al&&typeof r=="string"&&(e&&(r=`\x1B[${qB(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${qB(t)+OV}m${r}\x1B[49m`)),r}function kV(r,e=["constructor"]){const t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),i=r;for(const s of n){const o=i[s];typeof o=="function"&&(e.find(c=>s===c)||(i[s]=o.bind(r)))}}function Qx(r,e){if(!r)throw new Error("Assertion failed")}function wd(){let r;if(Al()&&a_.performance)r=a_?.performance?.now?.();else if("hrtime"in c_){const e=c_?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const Cd={debug:Al()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},NV={enabled:!0,level:0};function Td(){}const YB={},ZB={once:!0};let FO=class{constructor({id:e}={id:""}){this.VERSION=iy,this._startTs=wd(),this._deltaTs=wd(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new RV(`__probe-${this.id}__`,NV),this.timeStamp(`${this.id} started`),kV(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((wd()-this._startTs).toPrecision(10))}getDelta(){return Number((wd()-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,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Cd.warn,arguments,ZB)}error(e){return this._getLogFunction(0,e,Cd.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,Cd.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Cd.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Cd.debug||Cd.info,arguments,ZB)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||Td,n&&[n],{tag:zV(t)}):Td}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Td)}group(e,t,n={collapsed:!1}){const i=QB({logLevel:e,message:t,opts:n}),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Td)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=DO(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=QB({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,Qx(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=wd();const o=s.tag||s.message;if(s.once&&o)if(!YB[o])YB[o]=wd();else return Td;return t=UV(this.id,s.message,s),n.bind(console,t,...s.args)}return Td}};FO.VERSION=iy;function DO(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Qx(Number.isFinite(e)&&e>=0),e}function QB(r){const{logLevel:e,message:t}=r;r.logLevel=DO(e);const n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const i=typeof r.message;return Qx(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function UV(r,e,t){if(typeof e=="string"){const n=t.time?DV(FV(t.total)):"";e=t.time?`${r}: ${n}  ${e}`:`${r}: ${e}`,e=LV(e,t.color,t.background)}return e}function zV(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}const Zt=new FO({id:"luma.gl"}),jv={};function oy(r="id"){jv[r]=jv[r]||1;const e=jv[r]++;return`${r}-${e}`}let mi=class{static defaultProps={id:"undefined",handle:void 0,userData:void 0};toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,n){if(!e)throw new Error("no device");this._device=e,this.props=GV(t,n);const i=this.props.id!=="undefined"?this.props.id:oy(this[Symbol.toStringTag]);this.props.id=i,this.id=i,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}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(const e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){const e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){const n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(e),n.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){const t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){const e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};function GV(r,e){const t={...e};for(const n in r)r[n]!==void 0&&(t[n]=r[n]);return t}let ji=class O0 extends mi{static defaultProps={...mi.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1};static MAP_READ=1;static MAP_WRITE=2;static COPY_SRC=4;static COPY_DST=8;static INDEX=16;static VERTEX=32;static UNIFORM=64;static STORAGE=128;static INDIRECT=256;static QUERY_RESOLVE=512;get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){const n={...t};(t.usage||0)&O0.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(e,n,O0.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}
96readSyncWebGL(e,t){throw new Error("not implemented")}static DEBUG_DATA_MAX_LENGTH=32;debugData=new ArrayBuffer(0);_setDebugData(e,t,n){const i=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:n,O0.DEBUG_DATA_MAX_LENGTH);i===null?this.debugData=new ArrayBuffer(s):t===0&&n===i.byteLength?this.debugData=i.slice(0,s):this.debugData=i.slice(t,t+s)}};function OO(r){const e=eS[r],t=VV(e),n=r.includes("norm"),i=!n&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:eS[r],byteLength:t,integer:i,signed:s,normalized:n}}function VV(r){return HV[r]}const eS={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},HV={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4},lo="texture-compression-bc",pi="texture-compression-astc",Qc="texture-compression-etc2",jV="texture-compression-etc1-webgl",Om="texture-compression-pvrtc-webgl",$v="texture-compression-atc-webgl",Lm="float32-renderable-webgl",Wv="float16-renderable-webgl",$V="rgb9e5ufloat-renderable-webgl",Jv="snorm8-renderable-webgl",PA="norm16-renderable-webgl",Xv="snorm16-renderable-webgl",km="float32-filterable",tS="float16-filterable-webgl";function LO(r){const e=WV[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}const WV={r8unorm:{},r8snorm:{render:Jv},r8uint:{},r8sint:{},rg8unorm:{},rg8snorm:{render:Jv},rg8uint:{},rg8sint:{},r16uint:{},r16sint:{},r16float:{render:Wv,filter:"float16-filterable-webgl"},"r16unorm-webgl":{f:PA},"r16snorm-webgl":{f:Xv},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},"rgb8unorm-webgl":{},"rgb8snorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},rgba8snorm:{render:Jv},rgba8uint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{},rg16sint:{},rg16float:{render:Wv,filter:tS},"rg16unorm-webgl":{render:PA},"rg16snorm-webgl":{render:Xv},r32uint:{},r32sint:{},r32float:{render:Lm,filter:km},rgb9e5ufloat:{channels:"rgb",packed:!0,render:$V},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:Lm},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},"rgb10a2uint-webgl":{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1,wgpu:!1},"rgb16unorm-webgl":{f:PA},"rgb16snorm-webgl":{f:PA},rg32uint:{},rg32sint:{},rg32float:{render:!1,filter:km},rgba16uint:{},rgba16sint:{},rgba16float:{render:Wv,filter:tS},"rgba16unorm-webgl":{render:PA},"rgba16snorm-webgl":{render:Xv},"rgb32float-webgl":{render:Lm,filter:km},rgba32uint:{},rgba32sint:{},rgba32float:{render:Lm,filter:km},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0},"bc1-rgb-unorm-webgl":{f:lo},"bc1-rgb-unorm-srgb-webgl":{f:lo},"bc1-rgba-unorm":{f:lo},"bc1-rgba-unorm-srgb":{f:lo},"bc2-rgba-unorm":{f:lo},"bc2-rgba-unorm-srgb":{f:lo},"bc3-rgba-unorm":{f:lo},"bc3-rgba-unorm-srgb":{f:lo},"bc4-r-unorm":{f:lo},"bc4-r-snorm":{f:lo},"bc5-rg-unorm":{f:lo},"bc5-rg-snorm":{f:lo},"bc6h-rgb-ufloat":{f:lo},"bc6h-rgb-float":{f:lo},"bc7-rgba-unorm":{f:lo},"bc7-rgba-unorm-srgb":{f:lo},"etc2-rgb8unorm":{f:Qc},"etc2-rgb8unorm-srgb":{f:Qc},"etc2-rgb8a1unorm":{f:Qc},"etc2-rgb8a1unorm-srgb":{f:Qc},"etc2-rgba8unorm":{f:Qc},"etc2-rgba8unorm-srgb":{f:Qc},"eac-r11unorm":{f:Qc},"eac-r11snorm":{f:Qc},"eac-rg11unorm":{f:Qc},"eac-rg11snorm":{f:Qc},"astc-4x4-unorm":{f:pi},"astc-4x4-unorm-srgb":{f:pi},"astc-5x4-unorm":{f:pi},"astc-5x4-unorm-srgb":{f:pi},"astc-5x5-unorm":{f:pi},"astc-5x5-unorm-srgb":{f:pi},"astc-6x5-unorm":{f:pi},"astc-6x5-unorm-srgb":{f:pi},"astc-6x6-unorm":{f:pi},"astc-6x6-unorm-srgb":{f:pi},"astc-8x5-unorm":{f:pi},"astc-8x5-unorm-srgb":{f:pi},"astc-8x6-unorm":{f:pi},"astc-8x6-unorm-srgb":{f:pi},"astc-8x8-unorm":{f:pi},"astc-8x8-unorm-srgb":{f:pi},"astc-10x5-unorm":{f:pi},"astc-10x5-unorm-srgb":{f:pi},"astc-10x6-unorm":{f:pi},"astc-10x6-unorm-srgb":{f:pi},"astc-10x8-unorm":{f:pi},"astc-10x8-unorm-srgb":{f:pi},"astc-10x10-unorm":{f:pi},"astc-10x10-unorm-srgb":{f:pi},"astc-12x10-unorm":{f:pi},"astc-12x10-unorm-srgb":{f:pi},"astc-12x12-unorm":{f:pi},"astc-12x12-unorm-srgb":{f:pi},"pvrtc-rgb4unorm-webgl":{f:Om},"pvrtc-rgba4unorm-webgl":{f:Om},"pvrtc-rbg2unorm-webgl":{f:Om},"pvrtc-rgba2unorm-webgl":{f:Om},"etc1-rbg-unorm-webgl":{f:jV},"atc-rgb-unorm-webgl":{f:$v},"atc-rgba-unorm-webgl":{f:$v},"atc-rgbai-unorm-webgl":{f:$v}},JV=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],XV=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function kO(r){return JV.some(e=>r.startsWith(e))}function ew(r){let e=KV(r);if(kO(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;const n=qV(r);n&&(e.blockWidth=n.blockWidth,e.blockHeight=n.blockHeight)}const t=XV.exec(r);if(t){const[,n,i,s,o,c]=t,f=`${s}${i}`,A=OO(f),v=A.byteLength*8,w=n.length,S=[v,w>=2?v:0,w>=3?v:0,w>=4?v:0];e={format:r,attachment:e.attachment,dataType:A.dataType,components:w,channels:n,integer:A.integer,signed:A.signed,normalized:A.normalized,bitsPerChannel:S,bytesPerPixel:A.byteLength*n.length,packed:e.packed,srgb:e.srgb},c==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function KV(r){const e=LO(r),t=e.bytesPerPixel||1,n=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:r,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||e.channels?.length||1,bytesPerPixel:t,bitsPerChannel:n,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function qV(r){const t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){const[,n,i]=t;return{blockWidth:Number(n),blockHeight:Number(i)}}return null}function YV(r){const e=LO(r),t={format:r,create:e.f??!0,render:e.render??!0,filter:e.filter??!0,blend:e.blend??!0,store:e.store??!0},n=ew(r),i=r.startsWith("depth")||r.startsWith("stencil"),s=n?.signed,o=n?.integer,c=n?.webgl;return t.render&&=!s,t.filter&&=!i&&!s&&!o&&!c,t}class ZV{}class QV{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}}class Ju{static defaultProps={id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:e=>Zt.error(e.message)(),_reuseDevices:!1,_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:Zt.get("debug")||void 0,debugShaders:Zt.get("debug-shaders")||void 0,debugFramebuffers:!!Zt.get("debug-framebuffers"),debugWebGL:!!Zt.get("debug-webgl"),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0};get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...Ju.defaultProps,...e},this.id=this.props.id||oy(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=RO;timestamp=0;_reused=!1;_lumaData={};getTextureFormatCapabilities(e){const t=YV(e),n=o=>
96(typeof o=="string"?this.features.has(o):o)??!0,i=n(t.create),s={format:e,create:i,render:i&&n(t.render),filter:i&&n(t.filter),blend:i&&n(t.blend),store:i&&n(t.store)};return this._getDeviceSpecificTextureFormatCapabilities(s)}isTextureFormatSupported(e,t){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return kO(e)}loseDevice(){return!1}reportError(e){this.props.onError(e)}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createCommandEncoder(e={}){throw new Error("not implemented")}incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t={...e};return(e.usage||0)&ji.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":Zt.warn("indices buffer content must be of integer type")()),t}}const e7=Al()&&typeof document<"u",t7=()=>e7&&document.readyState==="complete",r7="set luma.log.level=1 (or higher) to trace rendering",rS="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.";class rp{static defaultProps={...Ju.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0};static pageLoaded=n7().then(()=>{Zt.probe(2,"DOM is loaded")()});stats=RO;log=Zt;VERSION="9.1.9";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw Zt.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),Zt.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");Zt.error("This version of luma.gl has already been initialized")()}Zt.log(1,`${this.VERSION} - ${r7}`)(),globalThis.luma=this}registerAdapters(e){for(const t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){const t=this.getAdapterMap(e);return Array.from(t).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapter(e=[]){const t=this.getAdapterMap(e);return t.get("webgpu")?.isSupported?.()?"webgpu":t.get("webgl")?.isSupported?.()?"webgl":null}setDefaultDeviceProps(e){Object.assign(rp.defaultProps,e)}async createDevice(e={}){e={...rp.defaultProps,...e},e.waitForPageLoad&&await rp.pageLoaded;const t=this.getAdapterMap(e.adapters);let n=e.type||"";n==="best-available"&&(n=this.getBestAvailableAdapter(e.adapters)||n);const o=await(this.getAdapterMap(e.adapters)||t).get(n)?.create?.(e);if(o)return o;throw new Error(rS)}async attachDevice(e){const t=this.getAdapterMap(e.adapters);let n="";e.handle instanceof WebGL2RenderingContext&&(n="webgl"),e.createCanvasContext&&await rp.pageLoaded,e.handle===null&&(n="unknown");const s=await t.get(n)?.attach?.(null);if(s)return s;throw new Error(rS)}enforceWebGL2(e=!0,t=[]){const i=this.getAdapterMap(t).get("webgl");i||Zt.warn("enforceWebGL2: webgl adapter not found")(),i?.enforceWebGL2?.(e)}getAdapterMap(e=[]){const t=new Map(this.preregisteredAdapters);for(const n of e)t.set(n.type,n);return t}registerDevices(e){Zt.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");for(const t of e){const n=t.adapter;n&&this.preregisteredAdapters.set(n.type,n)}}}const f2=new rp;function n7(){return t7()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}class i7{}class tw{static defaultProps={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb"};id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...tw.defaultProps,...e},e=this.props,!Al()){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=o7(e.canvas):this.canvas=e.canvas;else{const t=a7(e),n=s7(e?.container||null);n.insertBefore(t,n.firstChild),this.canvas=t,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(t=>{for(const n of t)n.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":const e=this.getDevicePixelRatio(),t=this.canvas;return t.parentElement?[t.clientWidth*e,t.clientHeight*e]:[this.canvas.width,this.canvas.height];
96default:throw new Error(this.type)}}getAspect(){const[e,t]=this.getPixelSize();return e/t}cssToDeviceRatio(){try{const[e]=this.getDrawingBufferSize(),t=this._canvasSizeInfo.clientWidth||this.htmlCanvas?.clientWidth;return t?e/t:1}catch{return 1}}cssToDevicePixels(e,t=!0){const n=this.cssToDeviceRatio(),[i,s]=this.getDrawingBufferSize();return c7(e,n,i,s,t)}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let n="width"in t?t.width:this.htmlCanvas.clientWidth,i="height"in t?t.height:this.htmlCanvas.clientHeight;(!n||!i)&&(Zt.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,n=this.htmlCanvas.width||1,i=this.htmlCanvas.height||1);const s=this._canvasSizeInfo;if(s.clientWidth!==n||s.clientHeight!==i||s.devicePixelRatio!==e){let o=e;const c=Math.floor(n*o),f=Math.floor(i*o);if(this.htmlCanvas.width=c,this.htmlCanvas.height=f,this.device.gl){const[v,w]=this.getDrawingBufferSize();(v!==c||w!==f)&&(o=Math.min(v/n,w/i),this.htmlCanvas.width=Math.floor(n*o),this.htmlCanvas.height=Math.floor(i*o),Zt.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=i,this._canvasSizeInfo.devicePixelRatio=e}}}getDrawingBufferSize(){const e=this.device.gl;return e?[e.drawingBufferWidth,e.drawingBufferHeight]:this.getPixelSize()}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}}function s7(r){if(typeof r=="string"){const e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}else if(r)return r;return document.body}function o7(r){const e=document.getElementById(r);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function a7(r){const{width:e,height:t}=r,n=document.createElement("canvas");return n.id=oy("lumagl-auto-created-canvas"),n.width=e||1,n.height=t||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(t)?`${t}px`:"100%",n}function c7(r,e,t,n,i){const s=r,o=nS(s[0],e,t);let c=iS(s[1],e,n,i),f=nS(s[0]+1,e,t);const A=f===t-1?f:f-1;f=iS(s[1]+1,e,n,i);let v;return i?(f=f===0?f:f+1,v=c,c=f):v=f===n-1?f:f-1,{x:o,y:c,width:Math.max(A-o+1,1),height:Math.max(v-c+1,1)}}function nS(r,e,t){return Math.min(Math.round(r*e),t-1)}function iS(r,e,t,n){return n?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}class si extends mi{static COPY_SRC=1;static COPY_DST=2;static TEXTURE=4;static STORAGE=8;static RENDER_ATTACHMENT=16;static CubeFaces=["+X","-X","+Y","-Y","+Z","-Z"];static defaultProps={...mi.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0,flipY:void 0};get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}dimension;format;width;height;depth;mipLevels;updateTimestamp;constructor(e,t){if(t=si.normalizeProps(e,t),super(e,t,si.defaultProps),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.props.width===void 0||this.props.height===void 0){const n=si.getTextureDataSize(this.props.data);this.width=n?.width||1,this.height=n?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?si.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}static isExternalImage(e){return typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof VideoFrame<"u"&&e instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}static getExternalImageSize(e){if(typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)return{width:e.naturalWi
96dth,height:e.naturalHeight};if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if(typeof VideoFrame<"u"&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw new Error("Unknown image type")}static isTextureLevelData(e){const t=e?.data;return ArrayBuffer.isView(t)}static getTextureDataSize(e){if(!e||ArrayBuffer.isView(e))return null;if(Array.isArray(e))return si.getTextureDataSize(e[0]);if(si.isExternalImage(e))return si.getExternalImageSize(e);if(e&&typeof e=="object"&&e.constructor===Object){const n=Object.values(e)[0];return{width:n.width,height:n.height}}throw new Error("texture size deduction failed")}static normalizeTextureData(e,t){let n;return ArrayBuffer.isView(e)?n=[{data:e,width:t.width,height:t.height}]:Array.isArray(e)?n=e:n=[e],n}static getMipLevelCount(e,t){return Math.floor(Math.log2(Math.max(e,t)))+1}static getCubeFaceDepth(e){switch(e){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(e)}}static defaultCopyExternalImageOptions={image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1};static normalizeProps(e,t){const n={...t},i=e?.props?._resourceDefaults?.texture||{};Object.assign(n,i);const{width:s,height:o}=n;return typeof s=="number"&&(n.width=Math.max(1,Math.ceil(s))),typeof o=="number"&&(n.height=Math.max(1,Math.ceil(o))),n}}class ay extends mi{static defaultProps={...mi.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0};get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,ay.defaultProps)}}function l7(r,e,t){let n="";const i=e.split(/\r?\n/),s=r.slice().sort((o,c)=>o.lineNum-c.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let c=1;c<=i.length;c++)for(n+=NO(i[c-1],c,t);s.length>o&&s[o].lineNum===c;){const f=s[o++];n+=sS(f,i,f.lineNum,{...t,inlineSource:!1})}return n;case"issues":case"no":for(const c of r)n+=sS(c,i,c.lineNum,{inlineSource:t?.showSourceCode!=="no"});return n}}function sS(r,e,t,n){if(n?.inlineSource){const s=u7(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
97`:"";return`
98${s}${o}${r.type.toUpperCase()}: ${r.message}
99
100`}const i=r.type==="error"?"red":"#8B4000";return n?.html?`<div class='luma-compiler-log-error' style="color:${i};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function u7(r,e,t){let n="";for(let i=e-2;i<=e;i++){const s=r[i-1];s!==void 0&&(n+=NO(s,e,t))}return n}function NO(r,e,t){const n=t?.html?h7(r):r;return`${f7(String(e),4)}: ${n}${t?.html?"<br/>":`
101`}`}function f7(r,e){let t="";for(let n=r.length;n<e;++n)t+=" ";return t+r}function h7(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}class cy extends mi{static defaultProps={...mi.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0};get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:d7(t),...t},cy.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){const e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break}const t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;const t=UO(this.source),n=`${this.stage} ${t}`;let i=l7(e,this.source,{showSourceCode:"all",html:!0});const s=this.getTranslatedSource();s&&(i+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${s}</pre></code>`);const o=document.createElement("Button");o.innerHTML=`
102<h1>Shader Compilation Error in ${n}</h1><br /><br />
103<code style="user-select:text;"><pre>
104${i}
105</pre></code>`,o.style.top="10px",o.style.left="10px",o.style.position="absolute",o.style.zIndex="9999",o.style.width="100%",o.style.textAlign="left",document.body.appendChild(o),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),o.onclick=()=>{const f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}}function d7(r){return UO(r.source)||r.id||oy(`unnamed ${r.stage}-shader`)}function UO(r,e="unnamed"){const n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);
105return n?n[1]:e}class _g extends mi{static defaultProps={...mi.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1};get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=_g.normalizeProps(e,t),super(e,t,_g.defaultProps)}static normalizeProps(e,t){const n=e?.props?._resourceDefaults?.sampler||{};return{...t,...n}}}class ly extends mi{static defaultProps={...mi.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null};get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,ly.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){const t=this.colorAttachments.map(i=>i.texture.clone(e)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:n})}resize(e){let t=!e;if(e){const[n,i]=Array.isArray(e)?e:[e.width,e.height];t=t||i!==this.height||n!==this.width,this.width=n,this.height=i}t&&(Zt.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((t,n)=>{if(typeof t=="string"){const i=this.createColorTexture(t,n);return this.attachResource(i),i.view}return t instanceof si?t.view:t});const e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){const t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof si?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:si.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:si.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,t){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){const i=this.colorAttachments[n].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=i.view,this.attachResource(i.view)}if(this.depthStencilAttachment){const n=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}}class Sp extends mi{static defaultProps={...mi.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}};get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Sp.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}}class Xf extends mi{static defaultClearColor=[0,0,0,1];static defaultClearDepth=1;static defaultClearStencil=0;static defaultProps={...mi.defaultProps,framebuffer:null,parameters:void 0,clearColor:Xf.defaultClearColor,clearColors:void 0,clearDepth:Xf.defaultClearDepth,clearStencil:Xf.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0};get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=Xf.normalizeProps(e,t),super(e,t,Xf.defaultProps)}static normalizeProps(e,t){return{...e.props._resourceDefaults?.renderPass,...t}}}class A_ extends mi{static defaultProps={...mi.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0};get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,A_.defaultProps),this.shaderLayout=t.shaderLayout}}class rw extends mi{static defaultProps={...mi.defaultProps,measureExecutionTime:void 0};get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,rw.defaultProps)}}class nw extends mi{static defaultProps={...mi.defaultProps};get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,nw.defaultProps)}}function p7(r){const[e,t]=g7[r],n=e==="i32"||e==="u32",i=e!=="u32",s=m7[e]*t,o=A7(e,t);return{dataType:e,components:t,defaultVertexFormat:o,byteLength:s,integer:n,signed:i}}function A7(r,e){let t;switch(r){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?t:`${t}x${e}`}const g7={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]},m7={f32:4,f16:2,i32:4,u32:4};function zO(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);const[t,n]=r.split("x"),i=t,s=n?parseInt(n):1,o=OO(i),c={type:i,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(c.webglOnly=!0),c}function GO(r,e){const t={};for(const n of r.attributes){const i=y7(r,e,n.name);i&&(t[n.name]=i)}return t}function _7(r,e,t=16){const n=GO(r,e),i=new Array(t).fill(null);for(const s of Object.values(n))i[s.location]=s;return i}function y7(r,e,t){const n=v7(r,t),i=b7(e,t);if(!n)return null;const s=p7(n.type),o=i?.vertexFormat||s.defaultVertexFormat,c=zO(o);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:o,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:s.integer,stepMode:i?.stepMode||n.stepMode||"vertex",byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function v7(r,e){const t=r.attributes.find(n=>n.name===e);return t||Zt.warn(`shader layout attribute "${e}" not present in shader`),t||null}function b7(r,e){x7(r);let t=w7(r,e);return t||(t=C7(r,e),t)?t:(Zt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function x7(r){for(const e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&Zt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function w7(r,e){for(const t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function C7(r,e){for(const t of r){let n=t.byteStride;if(typeof t.byteStride!="number")for(const s of t.attributes||[]){const o=zO(s.format);n+=o.byteLength}const i=t.attributes?.find(s=>
105s.attribute===e);if(i)return{attributeName:i.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:i.format,byteOffset:i.byteOffset,byteStride:n}}return null}class iw extends mi{static defaultProps={...mi.defaultProps,renderPipeline:null};get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,iw.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null);const{shaderLayout:n,bufferLayout:i}=t.renderPipeline||{};if(!n||!i)throw new Error("VertexArray");this.attributeInfos=_7(n,i,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"))}}class sw extends mi{static defaultProps={...mi.defaultProps,layout:void 0,buffers:{}};get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,sw.defaultProps)}}class ow extends mi{static defaultProps={...mi.defaultProps,type:void 0,count:void 0};get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,ow.defaultProps)}}const T7={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 E7(r){return T7[r]}function B7(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}let Nm;function VO(r){return(!Nm||Nm.byteLength<r)&&(Nm=new ArrayBuffer(r)),Nm}function S7(r,e){const t=VO(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function I7(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function g_(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":I7(r)}const oS=1024;class M7{layout={};byteLength;constructor(e){let t=0;for(const[i,s]of Object.entries(e)){const o=E7(s),{type:c,components:f}=o;
105t=B7(t,f);const A=t;t+=f,this.layout[i]={type:c,size:f,offset:A}}t+=(4-t%4)%4;const n=t*4;this.byteLength=Math.max(n,oS)}getData(e){const t=Math.max(this.byteLength,oS),n=VO(t),i={i32:new Int32Array(n),u32:new Uint32Array(n),f32:new Float32Array(n),f16:new Uint16Array(n)};for(const[s,o]of Object.entries(e)){const c=this.layout[s];if(!c){Zt.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}const{type:f,size:A,offset:v}=c,w=i[f];if(A===1){if(typeof o!="number"&&typeof o!="boolean"){Zt.warn(`Supplied value for single component uniform ${s} is not a number: ${o}`)();continue}w[v]=Number(o)}else{if(!g_(o)){Zt.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${o}`)();continue}w.set(o,v)}}return new Uint8Array(n)}has(e){return!!this.layout[e]}get(e){return this.layout[e]}}function P7(r,e,t=16){if(r!==e)return!1;const n=r,i=e;if(!g_(n))return!1;if(g_(i)&&n.length===i.length){for(let s=0;s<n.length;++s)if(i[s]!==n[s])return!1}return!0}function R7(r){return g_(r)?r.slice():r}class F7{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){const t=e?.shaderLayout.bindings?.find(i=>i.type==="uniform"&&i.name===e?.name);if(!t)throw new Error(e?.name);const n=t;for(const i of n.uniforms||[])this.bindingLayout[i.name]=i}}setUniforms(e){for(const[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){P7(this.uniforms[e],t)||(this.uniforms[e]=R7(t),this.modifiedUniforms[e]=!0,this.modified=!0)}}class D7{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(const[t,n]of Object.entries(e)){const i=t,s=new M7(n.uniformTypes||{});this.uniformBufferLayouts.set(i,s);const o=new F7({name:t});o.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(i,o)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(const[t,n]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){const t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);const i=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:ji.UNIFORM|ji.COPY_DST,byteLength:i}),o=this.getUniformBufferData(t);return s.write(o),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){const n=this.getUniformBufferByteLength(t),i=e.createBuffer({usage:ji.UNIFORM|ji.COPY_DST,byteLength:n});this.uniformBuffers.set(t,i)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(const t of this.uniformBlocks.keys()){const n=this.updateUniformBuffer(t);e||=n}return e&&Zt.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){const t=this.uniformBlocks.get(e);let n=this.uniformBuffers.get(e),i=!1;if(n&&t?.needsRedraw){i||=t.needsRedraw;const s=this.getUniformBufferData(e);n=this.uniformBuffers.get(e),n?.write(s);const o=this.uniformBlocks.get(e)?.getAllUniforms();Zt.log(4,`Writing to uniform buffer ${String(e)}`,s,o)()}return i}}function HO(r){const e=ArrayBuffer.isView(r)?r.constructor:r;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 jO(r){switch(r){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(r)}}function O7(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);const n=e;let i=HO(r);if(i==="uint8"&&t&&n===1)return"unorm8-webgl";if(i==="uint8"&&t&&n===3)return"unorm8x3-webgl";if(i==="uint8"||i==="sint8"){if(n===1||n===3)throw new Error(`size: ${e}`);return t&&(i=i.replace("int","norm")),`${i}x${n}`}if(i==="uint16"||i==="sint16"){if(n===1||n===3)throw new Error(`size: ${e}`);return t&&(i=i.replace("int","norm")),`${i}x${n}`}return n===1?i:`${i}x${n}`}class Kv{bufferLayouts;constructor(e){this.bufferLayouts=e}getBufferLayout(e){return this.bufferLayouts.find(t=>t.name===e)||null}getAttributeNamesForBuffer(e){return e.attributes?e.attributes?.map(t=>t.attribute):[e.name]}mergeBufferLayouts(e,t){const n=[...e];for(const i of t){const s=n.findIndex(o=>o.name===i.name);s<0?n.push(i):n[s]=i}return n}getBufferIndex(e){const t=this.bufferLayouts.findIndex(n=>n.name===e);return t===-1&&Zt.warn(`BufferLayout: Missing buffer for "${e}".`)(),t}}function L7(r,e){const t=Object.fromEntries(r.attributes.map(i=>[i.name,i.location])),n=e.slice();return n.sort((i,s)=>{const o=i.attributes?i.attributes.map(v=>v.attribute):[i.name],c=s.attributes?s.attributes.map(v=>v.attribute):[s.name],f=Math.min(...o.map(v=>t[v])),A=Math.min(...c.map(v=>t[v]));return f-A}),n}class Va{constructor(e,t){this.name=e,this.attributes=t,this.size=0}get isArray(){return!1}
105get isStruct(){return!1}get isTemplate(){return!1}get isPointer(){return!1}getTypeName(){return this.name}}class aS{constructor(e,t,n){this.name=e,this.type=t,this.attributes=n,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.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}}let Hu=class extends Va{constructor(e,t){super(e,t),this.members=[],this.align=0,this.startLine=-1,this.endLine=-1,this.inUse=!1}get isStruct(){return!0}},Xu=class extends Va{constructor(e,t){super(e,t),this.count=0,this.stride=0}get isArray(){return!0}getTypeName(){return`array<${this.format.getTypeName()}, ${this.count}>`}},h2=class extends Va{constructor(e,t,n){super(e,n),this.format=t}get isPointer(){return!0}getTypeName(){return`&${this.format.getTypeName()}`}},lh=class extends Va{constructor(e,t,n,i){super(e,n),this.format=t,this.access=i}get isTemplate(){return!0}getTypeName(){let e=this.name;if(this.format!==null){if(e==="vec2"||e==="vec3"||e==="vec4"||e==="mat2x2"||e==="mat2x3"||e==="mat2x4"||e==="mat3x2"||e==="mat3x3"||e==="mat3x4"||e==="mat4x2"||e==="mat4x3"||e==="mat4x4"){if(this.format.name==="f32")return e+="f",e;if(this.format.name==="i32")return e+="i",e;if(this.format.name==="u32")return e+="u",e;if(this.format.name==="bool")return e+="b",e;if(this.format.name==="f16")return e+="h",e}e+=`<${this.format.name}>`}else if(e==="vec2"||e==="vec3"||e==="vec4")return e;return e}};var Gu;(r=>{r[r.Uniform=0]="Uniform",r[r.Storage=1]="Storage",r[r.Texture=2]="Texture",r[r.Sampler=3]="Sampler",r[r.StorageTexture=4]="StorageTexture"})(Gu||(Gu={}));let Um=class{constructor(e,t,n,i,s,o,c){this.name=e,this.type=t,this.group=n,this.binding=i,this.attributes=s,this.resourceType=o,this.access=c}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.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}};class k7{constructor(e,t){this.name=e,this.type=t}}let N7=class{constructor(e,t,n,i){this.name=e,this.type=t,this.locationType=n,this.location=i,this.interpolation=null}};class cS{constructor(e,t,n,i){this.name=e,this.type=t,this.locationType=n,this.location=i}}class U7{constructor(e,t,n,i){this.name=e,this.type=t,this.attributes=n,this.id=i}}let z7=class{constructor(e,t,n){this.name=e,this.type=t,this.attributes=n}};class G7{constructor(e,t=null,n){this.stage=null,this.inputs=[],this.outputs=[],this.arguments=[],this.returnType=null,this.resources=[],this.overrides=[],this.startLine=-1,this.endLine=-1,this.inUse=!1,this.calls=new Set,this.name=e,this.stage=t,this.attributes=n}}class V7{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}}function H7(r){var e=(32768&r)>>15,t=(31744&r)>>10,n=1023&r;return t==0?(e?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):t==31?n?NaN:1/0*(e?-1:1):(e?-1:1)*Math.pow(2,t-15)*(1+n/Math.pow(2,10))}const $O=new Float32Array(1),j7=new Int32Array($O.buffer),uo=new Uint16Array(1);function $7(r){$O[0]=r;const e=j7[0],t=e>>31&1;let n=e>>23&255,i=8388607&e;if(n===255)return uo[0]=t<<15|31744|(i!==0?512:0),uo[0];if(n===0){if(i===0)return uo[0]=t<<15,uo[0];i|=8388608;let s=113;for(;!(8388608&i);)i<<=1,s--;return n=127-s,i&=8388607,n>0?(i=(i>>126-n)+(i>>127-n&1),uo[0]=t<<15|n<<10|i>>13,uo[0]):(uo[0]=t<<15,uo[0])}return n=n-127+15,n>=31?(uo[0]=t<<15|31744,uo[0]):n<=0?n<-10?(uo[0]=t<<15,uo[0]):(i=(8388608|i)>>1-n,uo[0]=t<<15|i>>13,uo[0]):(i>>=13,uo[0]=t<<15|n<<10|i,uo[0])}const aw=new Uint32Array(1),WO=new Float32Array(aw.buffer,0,1);function lS(r){const e=112+(r>>6&31)<<23|(63&r)<<17;return aw[0]=e,WO[0]}function W7(r,e,t,n,i,s,o,c,f){const A=n*(o>>=i)*(s>>=i)+t*o+e*c;switch(f){case"r8unorm":return[Kn(r,A,"8unorm",1)[0]];case"r8snorm":return[Kn(r,A,"8snorm",1)[0]];case"r8uint":return[Kn(r,A,"8uint",1)[0]];case"r8sint":return[Kn(r,A,"8sint",1)[0]];case"rg8unorm":{const v=Kn(r,A,"8unorm",2);return[v[0],v[1]]}case"rg8snorm":{const v=Kn(r,A,"8snorm",2);return[v[0],v[1]]}case"rg8uint":{const v=Kn(r,A,"8uint",2);return[v[0],v[1]]}case"rg8sint":{const v=Kn(r,A,"8sint",2);return[v[0],v[1]]}case"rgba8unorm-srgb":case"rgba8unorm":{const v=Kn(r,A,"8unorm",4);return[v[0],v[1],v[2],v[3]]}case"rgba8snorm":{const v=Kn(r,A,"8snorm",4);return[v[0],v[1],v[2],v[3]]}case"rgba8uint":{const v=Kn(r,A,"8uint",4);return[v[0],v[1],v[2],v[3]]}case"rgba8sint":{const v=Kn(r,A,"8sint",4);return[v[0],v[1],v[2],v[3]]}case"bgra8unorm-srgb":case"bgra8unorm":{const v=Kn(r,A,"8unorm",4);return[v[2],v[1],v[0],v[3]]}case"r16uint":return[Kn(r,A,"16uint",1)[0]];case"r16sint":return[Kn(r,A,"16sint",1)[0]];case"r16float":return[Kn(r,A,"16float",1)[0]];case"rg16uint":{const v=Kn(r,A,"16uint",2);return[v[0],v[1]]}case"rg16sint":{const v=Kn(r,A,"16sint",2);return[v[0],v[1]]}case"rg16float":{const v=Kn(r,A,"16float",2);return[v[0],v[1]]}case"rgba16uint":{const v=Kn(r,A,"16uint",4);return[v[0],v[1],v[2],v[3]]}case"rgba16sint":{const v=Kn(r,A,"16sint",4);return[v[0],v[1],v[2],v[3]]}case"rgba16float":{const v=Kn(r,A,"16float",4);return[v[0],v[1],v[2],v[3]]}case"r32uint":return[Kn(r,A,"32uint",1)[0]];case"r32sint":return[Kn(r,A,"32sint",1)[0]];case"depth16unorm":case"depth24plus":case"depth24plus-stencil8":case"depth32float":case"depth32float-stencil8":case"r32float":return[Kn(r,A,"32float",1)[0]];case"rg32uint":{const v=Kn(r,A,"32uint",2);return[v[0],v[1]]}case"rg32sint":{const v=Kn(r,A,"32sint",2);return[v[0],v[1]]}case"rg32float":{const v=Kn(r,A,"32float",2);return[v[0],v[1]]}case"rgba32uint":{const v=Kn(r,A,"32uint",4);return[v[0],v[1],v[2],v[3]]}case"rgba32sint":{const v=Kn(r,A,"32sint",4);return[v[0],v[1],v[2],v[3]]}case"rgba32float":{const v=Kn(r,A,"32float",4);return[v[0],v[1],v[2],v[3]]}case"rg11b10ufloat":{const v=new Uint32Array(r.buffer,A,1)[0],w=(4192256&v)>>11,S=(4290772992&v)>>22;return[lS(2047&v),lS(w),function(F){const N=112+(F>>5&31)<<23|(31&F)<<18;return aw[0]=N,WO[0]}(S),1]}}return null}function Kn(r,e,t,n){const i=[0,0,0,0];for(let s=0;s<n;++s)switch(t){case"8unorm":i[s]=r[e]/255,e++;break;case"8snorm":i[s]=r[e]/255*2-1,e++;break;case"8uint":i[s]=r[e],e++;break;case"8sint":i[s]=r[e]-127,e++;break;case"16uint":i[s]=r[e]|r[e+1]<<8,e+=2;break;case"16sint":i[s]=(r[e]|r[e+1]<<8)-32768,e+=2;break;case"16float":i[s]=H7(r[e]|r[e+1]<<8),e+=2;break;case"32uint":case"32sint":i[s]=r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24,e+=4;break;case"32float":i[s]=new Float32Array(r.buffer,e,1)[0],e+=4}return i}function ei(r,e,t,n,i){for(let s=0;s<n;++s)switch(t){case"8unorm":r[e]=255*i[s],e++;break;case"8snorm":r[e]=.5*(i[s]+1)*255,e++;break;case"8uint":r[e]=i[s],e++;break;case"8sint":r[e]=i[s]+127,e++;break;case"16uint":new Uint16Array(r.buffer,e,1)[0]=i[s],e+=2;break;case"16sint":new Int16Array(r.buffer,e,1)[0]=i[s],e+=2;break;case"16float":{const o=$7(i[s]);new Uint16Array(r.buffer,e,1)[0]=o,e+=2;break}case"32uint":new Uint32Array(r.buffer,e,1)[0]=i[s],e+=4;break;case"32sint":new Int32Array(r.buffer,e,1)[0]=i[s],e+=4;break;case"32float":new Float32Array(r.buffer,e,1)[0]=i[s],e+=4}return i}const qv={r8unorm:{bytesPerBlock:1,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},r8snorm:{bytesPerBlock:1,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},r8uint:{bytesPerBlock:1,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},r8sint:{bytesPerBlock:1,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},rg8unorm:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rg8snorm:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rg8uint:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rg8sint:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rgba8unorm:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},"rgba8unorm-srgb":{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgba8snorm:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgba8uint:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgba8sint:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},bgra8unorm:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},"bgra8unorm-srgb":{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},r16uint:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},r16sint:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},r16float:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},rg16uint:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rg16sint:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rg16float:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rgba16uint:{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgba16sint:{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgba16float:{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},r32uint:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},r32sint:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},r32float:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:1},rg32uint:{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rg32sint:{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rg32float:{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,channels:2},rgba32uint:{bytesPerBlock:16,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgba32sint:{bytesPerBlock:16,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgba32float:{bytesPerBlock:16,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgb10a2uint:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rgb10a2unorm:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},rg11b10ufloat:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},stencil8:{bytesPerBlock:1,blockWidth:1,blockHeight:1,isCompressed:!1,isDepthStencil:!0,hasDepth:!1,hasStencil:!0,channels:1},depth16unorm:{bytesPerBlock:2,blockWidth:1,blockHeight:1,isCompressed:!1,isDepthStencil:!0,hasDepth:!0,hasStencil:!1,channels:1},depth24plus:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,isDepthStencil:!0,hasDepth:!0,hasStencil:!1,depthOnlyFormat:"depth32float",channels:1},"depth24plus-stencil8":{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,isDepthStencil:!0,hasDepth:!0,hasStencil:!0,depthOnlyFormat:"depth32float",channels:1},depth32float:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,isDepthStencil:!0,hasDepth:!0,hasStencil:!1,channels:1},"depth32float-stencil8":{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!1,isDepthStencil:!0,hasDepth:!0,hasStencil:!0,stencilOnlyFormat:"depth32float",channels:1},rgb9e5ufloat:{bytesPerBlock:4,blockWidth:1,blockHeight:1,isCompressed:!1,channels:4},"bc1-rgba-unorm":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc1-rgba-unorm-srgb":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc2-rgba-unorm":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc2-rgba-unorm-srgb":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc3-rgba-unorm":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc3-rgba-unorm-srgb":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc4-r-unorm":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:1},"bc4-r-snorm":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:1},"bc5-rg-unorm":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:2},"bc5-rg-snorm":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:2},"bc6h-rgb-ufloat":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc6h-rgb-float":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc7-rgba-unorm":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"bc7-rgba-unorm-srgb":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"etc2-rgb8unorm":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"etc2-rgb8unorm-srgb":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"etc2-rgb8a1unorm":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"etc2-rgb8a1unorm-srgb":{bytesPerBlock:8,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"etc2-rgba8unorm":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"etc2-rgba8unorm-srgb":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"eac-r11unorm":{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!0,channels:1},"eac-r11snorm":{bytesPerBlock:8,blockWidth:1,blockHeight:1,isCompressed:!0,channels:1},"eac-rg11unorm":{bytesPerBlock:16,blockWidth:1,blockHeight:1,isCompressed:!0,channels:2},"eac-rg11snorm":{bytesPerBlock:16,blockWidth:1,blockHeight:1,isCompressed:!0,channels:2},"astc-4x4-unorm":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"astc-4x4-unorm-srgb":{bytesPerBlock:16,blockWidth:4,blockHeight:4,isCompressed:!0,channels:4},"astc-5x4-unorm":{bytesPerBlock:16,blockWidth:5,blockHeight:4,isCompressed:!0,channels:4},"astc-5x4-unorm-srgb":{bytesPerBlock:16,blockWidth:5,blockHeight:4,isCompressed:!0,channels:4},"astc-5x5-unorm":{bytesPerBlock:16,blockWidth:5,blockHeight:5,isCompressed:!0,channels:4},"astc-5x5-unorm-srgb":{bytesPerBlock:16,blockWidth:5,blockHeight:5,isCompressed:!0,channels:4},"astc-6x5-unorm":{bytesPerBlock:16,blockWidth:6,blockHeight:5,isCompressed:!0,channels:4},"astc-6x5-unorm-srgb":{bytesPerBlock:16,blockWidth:6,blockHeight:5,isCompressed:!0,channels:4},"astc-6x6-unorm":{bytesPerBlock:16,blockWidth:6,blockHeight:6,isCompressed:!0,channels:4},"astc-6x6-unorm-srgb":{bytesPerBlock:16,blockWidth:6,blockHeight:6,isCompressed:!0,channels:4},"astc-8x5-unorm":{bytesPerBlock:16,blockWidth:8,blockHeight:5,isCompressed:!0,channels:4},"astc-8x5-unorm-srgb":{bytesPerBlock:16,blockWidth:8,blockHeight:5,isCompressed:!0,channels:4},"astc-8x6-unorm":{bytesPerBlock:16,blockWidth:8,blockHeight:6,isCompressed:!0,channels:4},"astc-8x6-unorm-srgb":{bytesPerBlock:16,blockWidth:8,blockHeight:6,isCompressed:!0,channels:4},"astc-8x8-unorm":{bytesPerBlock:16,blockWidth:8,blockHeight:8,isCompressed:!0,channels:4},"astc-8x8-unorm-srgb":{bytesPerBlock:16,blockWidth:8,blockHeight:8,isCompressed:!0,channels:4},"astc-10x5-unorm":{bytesPerBlock:16,blockWidth:10,blockHeight:5,isCompressed:!0,channels:4},"astc-10x5-unorm-srgb":{bytesPerBlock:16,blockWidth:10,blockHeight:5,isCompressed:!0,channels:4},"astc-10x6-unorm":{bytesPerBlock:16,blockWidth:10,blockHeight:6,isCompressed:!0,channels:4},"astc-10x6-unorm-srgb":{bytesPerBlock:16,blockWidth:10,blockHeight:6,isCompressed:!0,channels:4},"astc-10x8-unorm":{bytesPerBlock:16,blockWidth:10,blockHeight:8,isCompressed:!0,channels:4},"astc-10x8-unorm-srgb":{bytesPerBlock:16,blockWidth:10,blockHeight:8,isCompressed:!0,channels:4},"astc-10x10-unorm":{bytesPerBlock:16,blockWidth:10,blockHeight:10,isCompressed:!0,channels:4},"astc-10x10-unorm-srgb":{bytesPerBlock:16,blockWidth:10,blockHeight:10,isCompressed:!0,channels:4},"astc-12x10-unorm":{bytesPerBlock:16,blockWidth:12,blockHeight:10,isCompressed:!0,channels:4},"astc-12x10-unorm-srgb":{bytesPerBlock:16,blockWidth:12,blockHeight:10,isCompressed:!0,channels:4},"astc-12x12-unorm":{bytesPerBlock:16,blockWidth:12,blockHeight:12,isCompressed:!0,channels:4},"astc-12x12-unorm-srgb":{bytesPerBlock:16,blockWidth:12,blockHeight:12,isCompressed:!0,channels:4}};class $a{constructor(){this.id=$a._id++
105,this.line=0}get isAstNode(){return!0}get astNodeType(){return""}search(e){e(this)}searchBlock(e,t){if(e){t(m_.instance);for(const n of e)n instanceof Array?this.searchBlock(n,t):n.search(t);t(__.instance)}}constEvaluate(e,t){throw new Error("Cannot evaluate node")}constEvaluateString(e){return this.constEvaluate(e).toString()}}$a._id=0;class m_ extends $a{}m_.instance=new m_;class __ extends $a{}__.instance=new __;const JO=new Set(["all","all","any","select","arrayLength","abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","clamp","cos","cosh","countLeadingZeros","countOneBits","countTrailingZeros","cross","degrees","determinant","distance","dot","dot4U8Packed","dot4I8Packed","exp","exp2","extractBits","faceForward","firstLeadingBit","firstTrailingBit","floor","fma","fract","frexp","insertBits","inverseSqrt","ldexp","length","log","log2","max","min","mix","modf","normalize","pow","quantizeToF16","radians","reflect","refract","reverseBits","round","saturate","sign","sin","sinh","smoothStep","sqrt","step","tan","tanh","transpose","trunc","dpdx","dpdxCoarse","dpdxFine","dpdy","dpdyCoarse","dpdyFine","fwidth","fwidthCoarse","fwidthFine","textureDimensions","textureGather","textureGatherCompare","textureLoad","textureNumLayers","textureNumLevels","textureNumSamples","textureSample","textureSampleBias","textureSampleCompare","textureSampleCompareLevel","textureSampleGrad","textureSampleLevel","textureSampleBaseClampToEdge","textureStore","atomicLoad","atomicStore","atomicAdd","atomicSub","atomicMax","atomicMin","atomicAnd","atomicOr","atomicXor","atomicExchange","atomicCompareExchangeWeak","pack4x8snorm","pack4x8unorm","pack4xI8","pack4xU8","pack4x8Clamp","pack4xU8Clamp","pack2x16snorm","pack2x16unorm","pack2x16float","unpack4x8snorm","unpack4x8unorm","unpack4xI8","unpack4xU8","unpack2x16snorm","unpack2x16unorm","unpack2x16float","storageBarrier","textureBarrier","workgroupBarrier","workgroupUniformLoad","subgroupAdd","subgroupExclusiveAdd","subgroupInclusiveAdd","subgroupAll","subgroupAnd","subgroupAny","subgroupBallot","subgroupBroadcast","subgroupBroadcastFirst","subgroupElect","subgroupMax","subgroupMin","subgroupMul","subgroupExclusiveMul","subgroupInclusiveMul","subgroupOr","subgroupShuffle","subgroupShuffleDown","subgroupShuffleUp","subgroupShuffleXor","subgroupXor","quadBroadcast","quadSwapDiagonal","quadSwapX","quadSwapY"]);class Ui extends $a{constructor(){super()}}class yg extends Ui{constructor(e,t,n,i,s,o){super(),this.calls=new Set,this.name=e,this.args=t,this.returnType=n,this.body=i,this.startLine=s,this.endLine=o}get astNodeType(){return"function"}search(e){if(this.attributes)for(const t of this.attributes)e(t);e(this);for(const t of this.args)e(t);this.searchBlock(this.body,e)}}class J7 extends Ui{constructor(e){super(),this.expression=e}get astNodeType(){return"staticAssert"}search(e){this.expression.search(e)}}class XO extends Ui{constructor(e,t){super(),this.condition=e,this.body=t}get astNodeType(){return"while"}search(e){this.condition.search(e),this.searchBlock(this.body,e)}}class d2 extends Ui{constructor(e,t){super(),this.body=e,this.loopId=t}get astNodeType(){return"continuing"}search(e){this.searchBlock(this.body,e)}}let KO=class extends Ui{constructor(e,t,n,i){super(),this.init=e,this.condition=t,this.increment=n,this.body=i}get astNodeType(){return"for"}search(e){var t,n,i;(t=this.init)===null||t===void 0||t.search(e),(n=this.condition)===null||n===void 0||n.search(e),(i=this.increment)===null||i===void 0||i.search(e),this.searchBlock(this.body,e)}};class Jl extends Ui{constructor(e,t,n,i,s){super(),this.attributes=null,this.name=e,this.type=t,this.storage=n,this.access=i,this.value=s}get astNodeType(){return"var"}search(e){var t;e(this),(t=this.value)===null||t===void 0||t.search(e)}}class cw extends Ui{constructor(e,t,n){super(),this.attributes=null,this.name=e,this.type=t,this.value=n}get astNodeType(){return"override"}search(e){var t;(t=this.value)===null||t===void 0||t.search(e)}}class tg extends Ui{constructor(e,t,n,i,s){super(),this.attributes=null,this.name=e,this.type=t,this.storage=n,this.access=i,this.value=s}get astNodeType(){return"let"}search(e){var t;e(this),(t=this.value)===null||t===void 0||t.search(e)}}class L0 extends Ui{constructor(e,t,n,i,s){super(),this.attributes=null,this.name=e,this.type=t,this.storage=n,this.access=i,this.value=s}get astNodeType(){return"const"}constEvaluate(e,t){return this.value.constEvaluate(e,t)}search(e){var t;e(this),(t=this.value)===null||t===void 0||t.search(e)}}var np,HA,_t,ot;(r=>{r.increment="++",r.decrement="--"})(np||(np={})),(r=>{r.parse=function(e){const t=e;if(t=="parse")throw new Error("Invalid value for IncrementOperator");return r[t]}})(np||(np={}));class qO extends Ui{constructor(e,t){super(),this.operator=e,this.variable=t}get astNodeType(){return"increment"}search(e){this.variable.search(e)}}(r=>{r.assign="=",r.addAssign="+=",r.subtractAssin="-=",r.multiplyAssign="*=",r.divideAssign="/=",r.moduloAssign="%=",r.andAssign="&=",r.orAssign="|=",r.xorAssign="^=",r.shiftLeftAssign="<<=",r.shiftRightAssign=">>="})(HA||(HA={})),(r=>{r.parse=function(e){const t=e;if(t=="parse")throw new Error("Invalid value for AssignOperator");return t}})(HA||(HA={}));class YO extends Ui{constructor(e,t,n){super(),this.operator=e,this.variable=t,this.value=n}get astNodeType(){return"assign"}search(e){this.variable.search(e),this.value.search(e)}}class lw extends Ui{constructor(e,t){super(),this.name=e,this.args=t}get astNodeType(){return"call"}isBuiltin(){return JO.has(this.name)}search(e){for(const t of this.args)t.search(e);e(this)}}class ZO extends Ui{constructor(e,t){super(),this.body=e,this.continuing=t}get astNodeType(){return"loop"}search(e){var t;this.searchBlock(this.body,e),(t=this.continuing)===null||t===void 0||t.search(e)}}class QO extends Ui{constructor(e,t){super(),this.condition=e,this.cases=t}get astNodeType(){return"switch"}search(e){e(this);for(const t of this.cases)t.search(e)}}class e4 extends Ui{constructor(e,t,n,i){super(),this.condition=e,this.body=t,this.elseif=n,this.else=i}get astNodeType(){return"if"}search(e){this.condition.search(e),this.searchBlock(this.body,e),this.searchBlock(this.elseif,e),this.searchBlock(this.else,e)}}class t4 extends Ui{constructor(e){super(),this.value=e}get astNodeType(){return"return"}search(e){var t;(t=this.value)===null||t===void 0||t.search(e)}}class X7 extends Ui{constructor(e){super(),this.name=e}get astNodeType(){return"enable"}}class K7 extends Ui{constructor(e){super(),this.extensions=e}get astNodeType(){return"requires"}}class r4 extends Ui{constructor(e,t){super(),this.severity=e,this.rule=t}get astNodeType(){return"diagnostic"}}class uw extends Ui{constructor(e,t){super(),this.name=e,this.type=t}get astNodeType(){return"alias"}}class q7 extends Ui{constructor(){super()}get astNodeType(){return"discard"}}class n4 extends Ui{constructor(){super(),this.condition=null,this.loopId=-1}get astNodeType(){return"break"}}class i4 extends Ui{constructor(){super(),this.loopId=-1}get astNodeType(){return"continue"}}class Ut extends Ui{constructor(e){super(),this.attributes=null,this.name=e}get astNodeType(){return"type"}
105get isStruct(){return!1}get isArray(){return!1}static maxFormatType(e){let t=e[0];if(t.name==="f32")return t;for(let n=1;n<e.length;++n){const i=Ut._priority.get(t.name);Ut._priority.get(e[n].name)<i&&(t=e[n])}return t.name==="x32"?Ut.i32:t}getTypeName(){return this.name}}Ut.x32=new Ut("x32"),Ut.f32=new Ut("f32"),Ut.i32=new Ut("i32"),Ut.u32=new Ut("u32"),Ut.f16=new Ut("f16"),Ut.bool=new Ut("bool"),Ut.void=new Ut("void"),Ut._priority=new Map([["f32",0],["f16",1],["u32",2],["i32",3],["x32",3]]);class uS extends Ut{constructor(e){super(e)}}class $l extends Ut{constructor(e,t,n,i){super(e),this.members=t,this.startLine=n,this.endLine=i}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(e){for(let t=0;t<this.members.length;t++)if(this.members[t].name==e)return t;return-1}search(e){for(const t of this.members)e(t)}}class ft extends Ut{constructor(e,t,n){super(e),this.format=t,this.access=n}get astNodeType(){return"template"}getTypeName(){let e=this.name;if(this.format!==null){if(e==="vec2"||e==="vec3"||e==="vec4"||e==="mat2x2"||e==="mat2x3"||e==="mat2x4"||e==="mat3x2"||e==="mat3x3"||e==="mat3x4"||e==="mat4x2"||e==="mat4x3"||e==="mat4x4"){if(this.format.name==="f32")return e+="f",e;if(this.format.name==="i32")return e+="i",e;if(this.format.name==="u32")return e+="u",e;if(this.format.name==="bool")return e+="b",e;if(this.format.name==="f16")return e+="h",e}e+=`<${this.format.name}>`}else if(e==="vec2"||e==="vec3"||e==="vec4")return e;return e}}ft.vec2f=new ft("vec2",Ut.f32,null),ft.vec3f=new ft("vec3",Ut.f32,null),ft.vec4f=new ft("vec4",Ut.f32,null),ft.vec2i=new ft("vec2",Ut.i32,null),ft.vec3i=new ft("vec3",Ut.i32,null),ft.vec4i=new ft("vec4",Ut.i32,null),ft.vec2u=new ft("vec2",Ut.u32,null),ft.vec3u=new ft("vec3",Ut.u32,null),ft.vec4u=new ft("vec4",Ut.u32,null),ft.vec2h=new ft("vec2",Ut.f16,null),ft.vec3h=new ft("vec3",Ut.f16,null),ft.vec4h=new ft("vec4",Ut.f16,null),ft.vec2b=new ft("vec2",Ut.bool,null),ft.vec3b=new ft("vec3",Ut.bool,null),ft.vec4b=new ft("vec4",Ut.bool,null),ft.mat2x2f=new ft("mat2x2",Ut.f32,null),ft.mat2x3f=new ft("mat2x3",Ut.f32,null),ft.mat2x4f=new ft("mat2x4",Ut.f32,null),ft.mat3x2f=new ft("mat3x2",Ut.f32,null),ft.mat3x3f=new ft("mat3x3",Ut.f32,null),ft.mat3x4f=new ft("mat3x4",Ut.f32,null),ft.mat4x2f=new ft("mat4x2",Ut.f32,null),ft.mat4x3f=new ft("mat4x3",Ut.f32,null),ft.mat4x4f=new ft("mat4x4",Ut.f32,null),ft.mat2x2h=new ft("mat2x2",Ut.f16,null),ft.mat2x3h=new ft("mat2x3",Ut.f16,null),ft.mat2x4h=new ft("mat2x4",Ut.f16,null),ft.mat3x2h=new ft("mat3x2",Ut.f16,null),ft.mat3x3h=new ft("mat3x3",Ut.f16,null),ft.mat3x4h=new ft("mat3x4",Ut.f16,null),ft.mat4x2h=new ft("mat4x2",Ut.f16,null),ft.mat4x3h=new ft("mat4x3",Ut.f16,null),ft.mat4x4h=new ft("mat4x4",Ut.f16,null),ft.mat2x2i=new ft("mat2x2",Ut.i32,null),ft.mat2x3i=new ft("mat2x3",Ut.i32,null),ft.mat2x4i=new ft("mat2x4",Ut.i32,null),ft.mat3x2i=new ft("mat3x2",Ut.i32,null),ft.mat3x3i=new ft("mat3x3",Ut.i32,null),ft.mat3x4i=new ft("mat3x4",Ut.i32,null),ft.mat4x2i=new ft("mat4x2",Ut.i32,null),ft.mat4x3i=new ft("mat4x3",Ut.i32,null),ft.mat4x4i=new ft("mat4x4",Ut.i32,null),ft.mat2x2u=new ft("mat2x2",Ut.u32,null),ft.mat2x3u=new ft("mat2x3",Ut.u32,null),ft.mat2x4u=new ft("mat2x4",Ut.u32,null),ft.mat3x2u=new ft("mat3x2",Ut.u32,null),ft.mat3x3u=new ft("mat3x3",Ut.u32,null),ft.mat3x4u=new ft("mat3x4",Ut.u32,null),ft.mat4x2u=new ft("mat4x2",Ut.u32,null),ft.mat4x3u=new ft("mat4x3",Ut.u32,null),ft.mat4x4u=new ft("mat4x4",Ut.u32,null);class k0 extends Ut{constructor(e,t,n,i){super(e),this.storage=t,this.type=n,this.access=i}get astNodeType(){return"pointer"}}class rg extends Ut{constructor(e,t,n,i){super(e),this.attributes=t,this.format=n,this.count=i}get astNodeType(){return"array"}get isArray(){return!0}}class jA extends Ut{constructor(e,t,n){super(e),this.format=t,this.access=n}get astNodeType(){return"sampler"}}class Sc extends $a{constructor(){super(),this.postfix=null}}class uh extends Sc{constructor(e){super(),this.value=e}get astNodeType(){return"stringExpr"}toString(){return this.value}constEvaluateString(){return this.value}}class nl extends Sc{constructor(e,t){super(),this.type=e,this.args=t}get astNodeType(){return"createExpr"}search(e){if(e(this),this.args)for(const t of this.args)t.search(e)}constEvaluate(e,t){return t&&(t[0]=this.type),e.evalExpression(this,e.context)}}class fw extends Sc{constructor(e,t){super(),this.cachedReturnValue=null,this.name=e,this.args=t}get astNodeType(){return"callExpr"}setCachedReturnValue(e){this.cachedReturnValue=e}get isBuiltin(){return JO.has(this.name)}constEvaluate(e,t){return e.evalExpression(this,e.context)}search(e){for(const t of this.args)t.search(e);e(this)}}class ha extends Sc{constructor(e){super(),this.name=e}get astNodeType(){return"varExpr"}search(e){e(this),this.postfix&&this.postfix.search(e)}constEvaluate(e,t){return e.evalExpression(this,e.context)}}class s4 extends Sc{constructor(e,t){super(),this.name=e,this.initializer=t}get astNodeType(){return"constExpr"}constEvaluate(e,t){if(this.initializer){const n=e.evalExpression(this.initializer,e.context);return n!==null&&this.postfix?n.getSubData(e,this.postfix,e.context):n}return null}search(e){this.initializer.search(e)}}class ws extends Sc{constructor(e,t){super(),this.value=e,this.type=t}get astNodeType(){return"literalExpr"}constEvaluate(e,t){return t!==void 0&&(t[0]=this.type),this.value}get isScalar(){return this.value instanceof it}get isVector(){return this.value instanceof ze||this.value instanceof on}get scalarValue(){return this.value instanceof it?this.value.value:(console.error("Value is not scalar."),0)}get vectorValue(){return this.value instanceof ze||this.value instanceof on?this.value.data:(console.error("Value is not a vector or matrix."),new Float32Array(0))}}class o4 extends Sc{constructor(e,t){super(),this.type=e,this.value=t}get astNodeType(){return"bitcastExpr"}search(e){this.value.search(e)}}class Ip extends Sc{constructor(e){super(),this.index=e}search(e){this.index.search(e)}}class a4 extends Sc{constructor(){super()}}class ds extends a4{constructor(e,t){super(),this.operator=e,this.right=t}get astNodeType(){return"unaryOp"}constEvaluate(e,t){return e.evalExpression(this,e.context)}search(e){this.right.search(e)}}class hc extends a4{constructor(e,t,n){super(),this.operator=e,this.left=t,this.right=n}get astNodeType(){return"binaryOp"}_getPromotedType(e,t){return e.name===t.name?e:e.name==="f32"||t.name==="f32"?Ut.f32:e.name==="u32"||t.name==="u32"?Ut.u32:Ut.i32}constEvaluate(e,t){return e.evalExpression(this,e.context)}search(e){this.left.search(e),this.right.search(e)}}class c4 extends $a{constructor(e){super(),this.body=e}search(e){e(this),this.searchBlock(this.body,e)}}class N0 extends Sc{constructor(){super()}get astNodeType(){return"default"}}class l4 extends c4{constructor(e,t){super(t),this.selectors=e}get astNodeType(){return"case"}search(e){this.searchBlock(this.body,e)}}class u4 extends c4{constructor(e){super(e)}get astNodeType(){return"default"}search(e){this.searchBlock(this.body,e)}}class fS extends $a{constructor(e,t,n){super(),this.name=e,this.type=t,this.attributes=n}get astNodeType(){return"argument"}}class Y7 extends $a{constructor(e,t){super(),this.condition=e,this.body=t}get astNodeType(){return"elseif"}search(e){this.condition.search(e),this.searchBlock(this.body,e)}}class hS extends $a{constructor(e,t,n){super(),this.name=e,this.type=t,this.attributes=n}get astNodeType(){return"member"}}class f4 extends $a{constructor(e,t){super(),this.name=e,this.value=t}get astNodeType(){return"attribute"}}class ja{constructor(e,t){this.parent=null,this.typeInfo=e,this.parent=t,this.id=ja._id++}clone(){throw`Clone: Not implemented for ${this.constructor.name}`}setDataValue(e,t,n,i){console.error(`SetDataValue: Not implemented for ${this.constructor.name}`)}getSubData(e,t,n){return console.error(`GetDataValue: Not implemented for ${this.constructor.name}`),null}toString(){return`<${this.typeInfo.getTypeName()}>`}}ja._id=0;class p2 extends ja{constructor(){super(new Va("void",null),null)}toString(){return"void"}}p2.void=new p2;class Ed extends ja{constructor(e){super(new h2("pointer",e.typeInfo,null),null),this.reference=e}clone(){return this}setDataValue(e,t,n,i){this.reference.setDataValue(e,t,n,i)}getSubData(e,t,n){return t?this.reference.getSubData(e,t,n):this}toString(){return`&${this.reference.toString()}`}}class it extends ja{constructor(e,t,n=null){super(t,n),e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array?this.data=e:this.t
105ypeInfo.name==="x32"?e-Math.floor(e)!==0?this.data=new Float32Array([e]):this.data=e>=0?new Uint32Array([e]):new Int32Array([e]):this.typeInfo.name==="i32"||this.typeInfo.name==="bool"?this.data=new Int32Array([e]):this.typeInfo.name==="u32"?this.data=new Uint32Array([e]):this.typeInfo.name==="f32"||this.typeInfo.name==="f16"?this.data=new Float32Array([e]):console.error("ScalarData2: Invalid type",t)}clone(){if(this.data instanceof Float32Array)return new it(new Float32Array(this.data),this.typeInfo,null);if(this.data instanceof Int32Array)return new it(new Int32Array(this.data),this.typeInfo,null);if(this.data instanceof Uint32Array)return new it(new Uint32Array(this.data),this.typeInfo,null);throw"ScalarData: Invalid data type"}get value(){return this.data[0]}set value(e){this.data[0]=e}setDataValue(e,t,n,i){if(n)return void console.error("SetDataValue: Scalar data does not support postfix",n);if(!(t instanceof it))return void console.error("SetDataValue: Invalid value",t);let s=t.data[0];this.typeInfo.name==="i32"||this.typeInfo.name==="u32"?s=Math.floor(s):this.typeInfo.name==="bool"&&(s=s?1:0),this.data[0]=s}getSubData(e,t,n){return t?(console.error("getSubData: Scalar data does not support postfix",t),null):this}toString(){return`${this.value}`}}function Z7(r,e,t){const n=e.length;return n===2?t==="f32"?new ze(new Float32Array(e),r.getTypeInfo("vec2f")):t==="i32"||t==="bool"?new ze(new Int32Array(e),r.getTypeInfo("vec2i")):t==="u32"?new ze(new Uint32Array(e),r.getTypeInfo("vec2u")):t==="f16"?new ze(new Float32Array(e),r.getTypeInfo("vec2h")):(console.error(`getSubData: Unknown format ${t}`),null):n===3?t==="f32"?new ze(new Float32Array(e),r.getTypeInfo("vec3f")):t==="i32"||t==="bool"?new ze(new Int32Array(e),r.getTypeInfo("vec3i")):t==="u32"?new ze(new Uint32Array(e),r.getTypeInfo("vec3u")):t==="f16"?new ze(new Float32Array(e),r.getTypeInfo("vec3h")):(console.error(`getSubData: Unknown format ${t}`),null):n===4?t==="f32"?new ze(new Float32Array(e),r.getTypeInfo("vec4f")):t==="i32"||t==="bool"?new ze(new Int32Array(e),r.getTypeInfo("vec4i")):t==="u32"?new ze(new Uint32Array(e),r.getTypeInfo("vec4u")):t==="f16"?new ze(new Float32Array(e),r.getTypeInfo("vec4h")):(console.error(`getSubData: Unknown format ${t}`),null):(console.error(`getSubData: Invalid vector size ${e.length}`),null)}class ze extends ja{constructor(e,t,n=null){if(super(t,n),e instanceof Float32Array||e instanceof Uint32Array||e instanceof Int32Array)this.data=e;else{const i=this.typeInfo.name;i==="vec2f"||i==="vec3f"||i==="vec4f"?this.data=new Float32Array(e):i==="vec2i"||i==="vec3i"||i==="vec4i"?this.data=new Int32Array(e):i==="vec2u"||i==="vec3u"||i==="vec4u"?this.data=new Uint32Array(e):i==="vec2h"||i==="vec3h"||i==="vec4h"?this.data=new Float32Array(e):i==="vec2b"||i==="vec3b"||i==="vec4b"?this.data=new Int32Array(e):i==="vec2"||i==="vec3"||i==="vec4"?this.data=new Float32Array(e):console.error(`VectorData: Invalid type ${i}`)}}clone(){if(this.data instanceof Float32Array)return new ze(new Float32Array(this.data),this.typeInfo,null);if(this.data instanceof Int32Array)return new ze(new Int32Array(this.data),this.typeInfo,null);if(this.data instanceof Uint32Array)return new ze(new Uint32Array(this.data),this.typeInfo,null);throw"VectorData: Invalid data type"}setDataValue(e,t,n,i){n instanceof uh?console.error("TODO: Set vector postfix"):t instanceof ze?this.data=t.data:console.error("SetDataValue: Invalid value",t)}getSubData(e,t,n){if(t===null)return this;let i=e.getTypeInfo("f32");if(this.typeInfo instanceof lh)i=this.typeInfo.format||i;else{const o=this.typeInfo.name;o==="vec2f"||o==="vec3f"||o==="vec4f"?i=e.getTypeInfo("f32"):o==="vec2i"||o==="vec3i"||o==="vec4i"?i=e.getTypeInfo("i32"):o==="vec2b"||o==="vec3b"||o==="vec4b"?i=e.getTypeInfo("bool"):o==="vec2u"||o==="vec3u"||o==="vec4u"?i=e.getTypeInfo("u32"):o==="vec2h"||o==="vec3h"||o==="vec4h"?i=e.getTypeInfo("f16"):console.error(`GetSubData: Unknown type ${o}`)}let s=this;for(;t!==null&&s!==null;){if(t instanceof Ip){const o=t.index;let c=-1;if(o instanceof ws){if(!(o.value instanceof it))return console.error(`GetSubData: Invalid array index ${o.value}`),null;c=o.value.value}else{const f=e.evalExpression(o,n);if(!(f instanceof it))return console.error("GetSubData: Unknown index type",o),null;c=f.value}if(c<0||c>=s.data.length)return console.error("GetSubData: Index out of range",c),null;if(s.data instanceof Float32Array){const f=new Float32Array(s.data.buffer,s.data.byteOffset+4*c,1);return new it(f,i)}if(s.data instanceof Int32Array){const f=new Int32Array(s.data.buffer,s.data.byteOffset+4*c,1);return new it(f,i)}if(s.data instanceof Uint32Array){const f=new Uint32Array(s.data.buffer,s.data.byteOffset+4*c,1);return new it(f,i)}throw"GetSubData: Invalid data type"}if(!(t instanceof uh))return console.error("GetSubData: Unknown postfix",t),null;{const o=t.value.toLowerCase();if(o.length===1){let f=0;if(o==="x"||o==="r")f=0;else if(o==="y"||o==="g")f=1;else if(o==="z"||o==="b")f=2;else{if(o!=="w"&&o!=="a")return console.error(`GetSubData: Unknown member ${o}`),null;f=3}if(this.data instanceof Float32Array){let A=new Float32Array(this.data.buffer,this.data.byteOffset+4*f,1);return new it(A,i,this)}if(this.data instanceof Int32Array){let A=new Int32Array(this.data.buffer,this.data.byteOffset+4*f,1);return new it(A,i,this)}if(this.data instanceof Uint32Array){let A=new Uint32Array(this.data.buffer,this.data.byteOffset+4*f,1);return new it(A,i,this)}}const c=[];for(const f of o)f==="x"||f==="r"?c.push(this.data[0]):f==="y"||f==="g"?c.push(this.data[1]):f==="z"||f==="b"?c.push(this.data[2]):f==="w"||f==="a"?c.push(this.data[3]):console.error(`GetDataValue: Unknown member ${f}`);s=Z7(e,c,i.name)}t=t.postfix}return s}toString(){let e=`${this.data[0]}`;for(let t=1;t<this.data.length;++t)e+=`, ${this.data[t]}`;return e}}class on extends ja{constructor(e,t,n=null){super(t,n),e instanceof Float32Array?this.data=e:this.data=new Float32Array(e)}clone(){return new on(new Float32Array(this.data),this.typeInfo,null)}setDataValue(e,t,n,i){n instanceof uh?console.error("TODO: Set matrix postfix"):t instanceof on?this.data=t.data:console.error("SetDataValue: Invalid value",t)}getSubData(e,t,n){if(t===null)return this;const i=this.typeInfo.name;if(e.getTypeInfo("f32"),this.typeInfo instanceof lh)this.typeInfo.format;else if(i.endsWith("f"))e.getTypeInfo("f32");else if(i.endsWith("i"))e.getTypeInfo("i32");else if(i.endsWith("u"))e.getTypeInfo("u32");else{if(!i.endsWith("h"))return console.error(`GetDataValue: Unknown type ${i}`),null;e.getTypeInfo("f16")}if(t instanceof Ip){const s=t.index;let o=-1;if(s instanceof ws){if(!(s.value instanceof it))return console.error(`GetDataValue: Invalid array index ${s.value}`),null;o=s.value.value}else{const A=e.evalExpression(s,n);if(!(A instanceof it))return console.error("GetDataValue: Unknown index type",s),null;o=A.value}if(o<0||o>=this.data.length)return console.error("GetDataValue: Index out of range",o),null;const c=i.endsWith("h")?"h":"f";let f;if(i==="mat2x2"||i==="mat2x2f"||i==="mat2x2h"||i==="mat3x2"||i==="mat3x2f"||i==="mat3x2h"||i==="mat4x2"||i==="mat4x2f"||i==="mat4x2h")f=new ze(new Float32Array(this.data.buffer,this.data.byteOffset+2*o*4,2),e.getTypeInfo(`vec2${c}`));else if(i==="mat2x3"||i==="mat2x3f"||i==="mat2x3h"||i==="mat3x3"||i==="mat3x3f"||i==="mat3x3h"||i==="mat4x3"||i==="mat4x3f"||i==="mat4x3h")f=new ze(new Float32Array(this.data.buffer,this.data.byteOffset+3*o*4,3),e.getTypeInfo(`vec3${c}`));else{if(i!=="mat2x4"&&i!=="mat2x4f"&&i!=="mat2x4h"&&i!=="mat3x4"&&i!=="mat3x4f"&&i!=="mat3x4h"&&i!=="mat4x4"&&i!=="mat4x4f"&&i!=="mat4x4h")return console.error(`GetDataValue: Unknown type ${i}`),null;f=new ze(new Float32Array(this.data.buffer,this.data.byteOffset+4*o*4,4),e.getTypeInfo(`vec4${c}`))}return t.postfix?f.getSubData(e,t.postfix,n):f}return console.error("GetDataValue: Invalid postfix",t),null}toString(){let e=`${this.data[0]}`;for(let t=1;t<this.data.length;++t)e+=`, ${this.data[t]}`;return e}}class ts extends ja{constructor(e,t,n=0,i=null){super(t,i),this.buffer=e instanceof ArrayBuffer?e:e.buffer,this.offset=n}clone(){const e=new Uint8Array(new Uint8Array(this.buffer,this.offset,this.typeInfo.size));return new ts(e.buffer,this.typeInfo,0,null)}setDataValue(e,t,n,i){if(t===null)return void console.log("setDataValue: NULL data.");let s=this.offset,o=this.typeInfo;for(;n;){if(n instanceof Ip)if(o instanceof Xu){const c=n.index;if(c instanceof ws){if(!(c.value instanceof it))return void console.error(`SetDataValue: Invalid index type ${c.value}`);s+=c.value.value*o.stride}else{const f=e.evalExpression(c,i);if(!(f instanceof it))return void console.error("SetDataValue: Unknown index type",c);s+=f.value*o.stride}o=o.format}else console.error(`SetDataValue: Type ${o.getTypeName()} is not an array`);else{if(!(n instanceof uh))return void console.error("SetDataValue: Unknown postfix type",n);{const c=n.value;if(o instanceof Hu){let f=!1;for(const A of o.members)if(A.name===c){s+=A.offset,o=A.type,f=!0;break}if(!f)return void console.error(`SetDataValue: Member ${c}
105 not found`)}else if(o instanceof Va){const f=o.getTypeName();let A=0;if(c==="x"||c==="r")A=0;else if(c==="y"||c==="g")A=1;else if(c==="z"||c==="b")A=2;else{if(c!=="w"&&c!=="a")return void console.error(`SetDataValue: Unknown member ${c}`);A=3}if(!(t instanceof it))return void console.error("SetDataValue: Invalid value",t);const v=t.value;return f==="vec2f"?void(new Float32Array(this.buffer,s,2)[A]=v):f==="vec3f"?void(new Float32Array(this.buffer,s,3)[A]=v):f==="vec4f"?void(new Float32Array(this.buffer,s,4)[A]=v):f==="vec2i"?void(new Int32Array(this.buffer,s,2)[A]=v):f==="vec3i"?void(new Int32Array(this.buffer,s,3)[A]=v):f==="vec4i"?void(new Int32Array(this.buffer,s,4)[A]=v):f==="vec2u"?void(new Uint32Array(this.buffer,s,2)[A]=v):f==="vec3u"?void(new Uint32Array(this.buffer,s,3)[A]=v):f==="vec4u"?void(new Uint32Array(this.buffer,s,4)[A]=v):void console.error(`SetDataValue: Type ${f} is not a struct`)}}}n=n.postfix}this.setData(e,t,o,s,i)}setData(e,t,n,i,s){const o=n.getTypeName();if(o!=="f32"&&o!=="f16")if(o!=="i32"&&o!=="atomic<i32>"&&o!=="x32")if(o!=="u32"&&o!=="atomic<u32>")if(o!=="bool"){if(o==="vec2f"||o==="vec2h"){const c=new Float32Array(this.buffer,i,2);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1]):(c[0]=t[0],c[1]=t[1]))}if(o==="vec3f"||o==="vec3h"){const c=new Float32Array(this.buffer,i,3);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2]):(c[0]=t[0],c[1]=t[1],c[2]=t[2]))}if(o==="vec4f"||o==="vec4h"){const c=new Float32Array(this.buffer,i,4);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3]))}if(o==="vec2i"){const c=new Int32Array(this.buffer,i,2);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1]):(c[0]=t[0],c[1]=t[1]))}if(o==="vec3i"){const c=new Int32Array(this.buffer,i,3);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2]):(c[0]=t[0],c[1]=t[1],c[2]=t[2]))}if(o==="vec4i"){const c=new Int32Array(this.buffer,i,4);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3]))}if(o==="vec2u"){const c=new Uint32Array(this.buffer,i,2);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1]):(c[0]=t[0],c[1]=t[1]))}if(o==="vec3u"){const c=new Uint32Array(this.buffer,i,3);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2]):(c[0]=t[0],c[1]=t[1],c[2]=t[2]))}if(o==="vec4u"){const c=new Uint32Array(this.buffer,i,4);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3]))}if(o==="vec2b"){const c=new Uint32Array(this.buffer,i,2);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1]):(c[0]=t[0],c[1]=t[1]))}if(o==="vec3b"){const c=new Uint32Array(this.buffer,i,3);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2]):(c[0]=t[0],c[1]=t[1],c[2]=t[2]))}if(o==="vec4b"){const c=new Uint32Array(this.buffer,i,4);return void(t instanceof ze?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3]))}if(o==="mat2x2f"||o==="mat2x2h"){const c=new Float32Array(this.buffer,i,4);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3]))}if(o==="mat2x3f"||o==="mat2x3h"){const c=new Float32Array(this.buffer,i,6);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5]))}if(o==="mat2x4f"||o==="mat2x4h"){const c=new Float32Array(this.buffer,i,8);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5],c[6]=t.data[6],c[7]=t.data[7]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5],c[6]=t[6],c[7]=t[7]))}if(o==="mat3x2f"||o==="mat3x2h"){const c=new Float32Array(this.buffer,i,6);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5]))}if(o==="mat3x3f"||o==="mat3x3h"){const c=new Float32Array(this.buffer,i,9);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5],c[6]=t.data[6],c[7]=t.data[7],c[8]=t.data[8]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5],c[6]=t[6],c[7]=t[7],c[8]=t[8]))}if(o==="mat3x4f"||o==="mat3x4h"){const c=new Float32Array(this.buffer,i,12);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5],c[6]=t.data[6],c[7]=t.data[7],c[8]=t.data[8],c[9]=t.data[9],c[10]=t.data[10],c[11]=t.data[11]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5],c[6]=t[6],c[7]=t[7],c[8]=t[8],c[9]=t[9],c[10]=t[10],c[11]=t[11]))}if(o==="mat4x2f"||o==="mat4x2h"){const c=new Float32Array(this.buffer,i,8);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5],c[6]=t.data[6],c[7]=t.data[7]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5],c[6]=t[6],c[7]=t[7]))}if(o==="mat4x3f"||o==="mat4x3h"){const c=new Float32Array(this.buffer,i,12);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5],c[6]=t.data[6],c[7]=t.data[7],c[8]=t.data[8],c[9]=t.data[9],c[10]=t.data[10],c[11]=t.data[11]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5],c[6]=t[6],c[7]=t[7],c[8]=t[8],c[9]=t[9],c[10]=t[10],c[11]=t[11]))}if(o==="mat4x4f"||o==="mat4x4h"){const c=new Float32Array(this.buffer,i,16);return void(t instanceof on?(c[0]=t.data[0],c[1]=t.data[1],c[2]=t.data[2],c[3]=t.data[3],c[4]=t.data[4],c[5]=t.data[5],c[6]=t.data[6],c[7]=t.data[7],c[8]=t.data[8],c[9]=t.data[9],c[10]=t.data[10],c[11]=t.data[11],c[12]=t.data[12],c[13]=t.data[13],c[14]=t.data[14],c[15]=t.data[15]):(c[0]=t[0],c[1]=t[1],c[2]=t[2],c[3]=t[3],c[4]=t[4],c[5]=t[5],c[6]=t[6],c[7]=t[7],c[8]=t[8],c[9]=t[9],c[10]=t[10],c[11]=t[11],c[12]=t[12],c[13]=t[13],c[14]=t[14],c[15]=t[15]))}if(t instanceof ts){if(n===t.typeInfo)return void new Uint8Array(this.buffer,i,t.buffer.byteLength).set(new Uint8Array(t.buffer));console.error("SetDataValue: Type mismatch",o,t.typeInfo.getTypeName())}else console.error(`SetData: Unknown type ${o}`)}else t instanceof it&&(new Int32Array(this.buffer,i,1)[0]=t.value);else t instanceof it&&(new Uint32Array(this.buffer,i,1)[0]=t.value);else t instanceof it&&(new Int32Array(this.buffer,i,1)[0]=t.value);else t instanceof it&&(new Float32Array(this.buffer,i,1)[0]=t.value)}getSubData(e,t,n){var i,s,o;if(t===null)return this;
105let c=this.offset,f=this.typeInfo;for(;t;){if(t instanceof Ip){const v=t.index,w=v instanceof Sc?e.evalExpression(v,n):v;let S=0;if(w instanceof it?S=w.value:typeof w=="number"?S=w:console.error("GetDataValue: Invalid index type",v),f instanceof Xu)c+=S*f.stride,f=f.format;else{const F=f.getTypeName();F==="mat4x4"||F==="mat4x4f"||F==="mat4x4h"?(c+=16*S,f=e.getTypeInfo("vec4f")):console.error(`getDataValue: Type ${f.getTypeName()} is not an array`)}}else{if(!(t instanceof uh))return console.error("GetDataValue: Unknown postfix type",t),null;{const v=t.value;if(f instanceof Hu){let w=!1;for(const S of f.members)if(S.name===v){c+=S.offset,f=S.type,w=!0;break}if(!w)return console.error(`GetDataValue: Member ${v} not found`),null}else if(f instanceof Va){const w=f.getTypeName();if(w==="vec2f"||w==="vec3f"||w==="vec4f"||w==="vec2i"||w==="vec3i"||w==="vec4i"||w==="vec2u"||w==="vec3u"||w==="vec4u"||w==="vec2b"||w==="vec3b"||w==="vec4b"||w==="vec2h"||w==="vec3h"||w==="vec4h"||w==="vec2"||w==="vec3"||w==="vec4"){if(v.length>0&&v.length<5){let S="f";const F=[];for(let N=0;N<v.length;++N){const U=v[N].toLowerCase();let $=0;if(U==="x"||U==="r")$=0;else if(U==="y"||U==="g")$=1;else if(U==="z"||U==="b")$=2;else{if(U!=="w"&&U!=="a")return console.error(`Unknown member ${v}`),null;$=3}if(v.length===1){if(w.endsWith("f"))return this.buffer.byteLength<c+4*$+4?(console.log("Insufficient buffer data"),null):new it(new Float32Array(this.buffer,c+4*$,1),e.getTypeInfo("f32"),this);if(w.endsWith("h"))return new it(new Float32Array(this.buffer,c+4*$,1),e.getTypeInfo("f16"),this);if(w.endsWith("i"))return new it(new Int32Array(this.buffer,c+4*$,1),e.getTypeInfo("i32"),this);if(w.endsWith("b"))return new it(new Int32Array(this.buffer,c+4*$,1),e.getTypeInfo("bool"),this);if(w.endsWith("u"))return new it(new Uint32Array(this.buffer,c+4*$,1),e.getTypeInfo("i32"),this)}if(w==="vec2f")F.push(new Float32Array(this.buffer,c,2)[$]);else if(w==="vec3f"){if(c+12>=this.buffer.byteLength)return console.log("Insufficient buffer data"),null;const G=new Float32Array(this.buffer,c,3);F.push(G[$])}else if(w==="vec4f")F.push(new Float32Array(this.buffer,c,4)[$]);else if(w==="vec2i")S="i",F.push(new Int32Array(this.buffer,c,2)[$]);else if(w==="vec3i")S="i",F.push(new Int32Array(this.buffer,c,3)[$]);else if(w==="vec4i")S="i",F.push(new Int32Array(this.buffer,c,4)[$]);else if(w==="vec2u"){S="u";const G=new Uint32Array(this.buffer,c,2);F.push(G[$])}else w==="vec3u"?(S="u",F.push(new Uint32Array(this.buffer,c,3)[$])):w==="vec4u"&&(S="u",F.push(new Uint32Array(this.buffer,c,4)[$]))}return F.length===2?f=e.getTypeInfo(`vec2${S}`):F.length===3?f=e.getTypeInfo(`vec3${S}`):F.length===4?f=e.getTypeInfo(`vec4${S}`):console.error(`GetDataValue: Invalid vector length ${F.length}`),new ze(F,f,null)}return console.error(`GetDataValue: Unknown member ${v}`),null}return console.error(`GetDataValue: Type ${w} is not a struct`),null}}}t=t.postfix}const A=f.getTypeName();return A==="f32"?new it(new Float32Array(this.buffer,c,1),f,this):A==="i32"?new it(new Int32Array(this.buffer,c,1),f,this):A==="u32"?new it(new Uint32Array(this.buffer,c,1),f,this):A==="vec2f"?new ze(new Float32Array(this.buffer,c,2),f,this):A==="vec3f"?new ze(new Float32Array(this.buffer,c,3),f,this):A==="vec4f"?new ze(new Float32Array(this.buffer,c,4),f,this):A==="vec2i"?new ze(new Int32Array(this.buffer,c,2),f,this):A==="vec3i"?new ze(new Int32Array(this.buffer,c,3),f,this):A==="vec4i"?new ze(new Int32Array(this.buffer,c,4),f,this):A==="vec2u"?new ze(new Uint32Array(this.buffer,c,2),f,this):A==="vec3u"?new ze(new Uint32Array(this.buffer,c,3),f,this):A==="vec4u"?new ze(new Uint32Array(this.buffer,c,4),f,this):f instanceof lh&&f.name==="atomic"?((i=f.format)===null||i===void 0?void 0:i.name)==="u32"?new it(new Uint32Array(this.buffer,c,1)[0],f.format,this):((s=f.format)===null||s===void 0?void 0:s.name)==="i32"?new it(new Int32Array(this.buffer,c,1)[0],f.format,this):(console.error(`GetDataValue: Invalid atomic format ${(o=f.format)===null||o===void 0?void 0:o.name}`),null):new ts(this.buffer,f,c,this)}toString(){let e="";
105if(this.typeInfo instanceof Xu)if(this.typeInfo.format.name==="f32"){const t=new Float32Array(this.buffer,this.offset);e=`[${t[0]}`;for(let n=1;n<t.length;++n)e+=`, ${t[n]}`}else if(this.typeInfo.format.name==="i32"){const t=new Int32Array(this.buffer,this.offset);e=`[${t[0]}`;for(let n=1;n<t.length;++n)e+=`, ${t[n]}`}else if(this.typeInfo.format.name==="u32"){const t=new Uint32Array(this.buffer,this.offset);e=`[${t[0]}`;for(let n=1;n<t.length;++n)e+=`, ${t[n]}`}else if(this.typeInfo.format.name==="vec2f"){const t=new Float32Array(this.buffer,this.offset);e=`[${t[0]}, ${t[1]}]`;for(let n=1;n<t.length/2;++n)e+=`, [${t[2*n]}, ${t[2*n+1]}]`}else if(this.typeInfo.format.name==="vec3f"){const t=new Float32Array(this.buffer,this.offset);e=`[${t[0]}, ${t[1]}, ${t[2]}]`;for(let n=4;n<t.length;n+=4)e+=`, [${t[n]}, ${t[n+1]}, ${t[n+2]}]`}else if(this.typeInfo.format.name==="vec4f"){const t=new Float32Array(this.buffer,this.offset);e=`[${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}]`;for(let n=4;n<t.length;n+=4)e+=`, [${t[n]}, ${t[n+1]}, ${t[n+2]}, ${t[n+3]}]`}else e="[...]";else this.typeInfo instanceof Hu?e+="{...}":e="[...]";return e}}class Wl extends ja{constructor(e,t,n,i){super(t,null),this.data=e,this.descriptor=n,this.view=i}clone(){return new Wl(this.data,this.typeInfo,this.descriptor,this.view)}get width(){var e,t;const n=this.descriptor.size;return n instanceof Array&&n.length>0?(e=n[0])!==null&&e!==void 0?e:0:n instanceof Object&&(t=n.width)!==null&&t!==void 0?t:0}get height(){var e,t;const n=this.descriptor.size;return n instanceof Array&&n.length>1?(e=n[1])!==null&&e!==void 0?e:0:n instanceof Object&&(t=n.height)!==null&&t!==void 0?t:0}get depthOrArrayLayers(){var e,t;const n=this.descriptor.size;return n instanceof Array&&n.length>2?(e=n[2])!==null&&e!==void 0?e:0:n instanceof Object&&(t=n.depthOrArrayLayers)!==null&&t!==void 0?t:0}get format(){var e;return this.descriptor&&(e=this.descriptor.format)!==null&&e!==void 0?e:"rgba8unorm"}get sampleCount(){var e;return this.descriptor&&(e=this.descriptor.sampleCount)!==null&&e!==void 0?e:1}get mipLevelCount(){var e;return this.descriptor&&(e=this.descriptor.mipLevelCount)!==null&&e!==void 0?e:1}get dimension(){var e;return this.descriptor&&(e=this.descriptor.dimension)!==null&&e!==void 0?e:"2d"}getMipLevelSize(e){if(e>=this.mipLevelCount)return[0,0,0];const t=[this.width,this.height,this.depthOrArrayLayers];for(let n=0;n<t.length;++n)t[n]=Math.max(1,t[n]>>e);return t}get texelByteSize(){const e=this.format,t=qv[e];return t?t.isDepthStencil?4:t.bytesPerBlock:0}get bytesPerRow(){return this.width*this.texelByteSize}get isDepthStencil(){const e=this.format,t=qv[e];return!!t&&t.isDepthStencil}getGpuSize(){const e=this.format,t=qv[e],n=this.width;if(!e||n<=0||!t)return-1;const i=this.height,s=this.depthOrArrayLayers,o=this.dimension;return n/t.blockWidth*(o==="1d"?1:i/t.blockHeight)*t.bytesPerBlock*s}getPixel(e,t,n=0,i=0){const s=this.texelByteSize,o=this.bytesPerRow,c=this.height,f=this.data[i];return W7(new Uint8Array(f),e,t,n,i,c,o,s,this.format)}setPixel(e,t,n,i,s){const o=this.texelByteSize,c=this.bytesPerRow,f=this.height,A=this.data[i];(function(v,w,S,F,N,U,$,G,H,J){const ue=F*($>>=N)*(U>>=N)+S*$+w*G;switch(H){case"r8unorm":return void ei(v,ue,"8unorm",1,J);case"r8snorm":return void ei(v,ue,"8snorm",1,J);case"r8uint":return void ei(v,ue,"8uint",1,J);case"r8sint":return void ei(v,ue,"8sint",1,J);case"rg8unorm":return void ei(v,ue,"8unorm",2,J);case"rg8snorm":return void ei(v,ue,"8snorm",2,J);case"rg8uint":return void ei(v,ue,"8uint",2,J);case"rg8sint":return void ei(v,ue,"8sint",2,J);case"rgba8unorm-srgb":case"rgba8unorm":case"bgra8unorm-srgb":case"bgra8unorm":return void ei(v,ue,"8unorm",4,J);case"rgba8snorm":return void ei(v,ue,"8snorm",4,J);case"rgba8uint":return void ei(v,ue,"8uint",4,J);case"rgba8sint":return void ei(v,ue,"8sint",4,J);case"r16uint":return void ei(v,ue,"16uint",1,J);case"r16sint":return void ei(v,ue,"16sint",1,J);case"r16float":return void ei(v,ue,"16float",1,J);case"rg16uint":return void ei(v,ue,"16uint",2,J);case"rg16sint":return void ei(v,ue,"16sint",2,J);case"rg16float":return void ei(v,ue,"16float",2,J);case"rgba16uint":return void ei(v,ue,"16uint",4,J);case"rgba16sint":return void ei(v,ue,"16sint",4,J);case"rgba16float":return void ei(v,ue,"16float",4,J);case"r32uint":return void ei(v,ue,"32uint",1,J);case"r32sint":return void ei(v,ue,"32sint",1,J);case"depth16unorm":case"depth24plus":case"depth24plus-stencil8":case"depth32float":case"depth32float-stencil8":case"r32float":return void ei(v,ue,"32float",1,J);case"rg32uint":return void ei(v,ue,"32uint",2,J);case"rg32sint":return void ei(v,ue,"32sint",2,J);case"rg32float":return void ei(v,ue,"32float",2,J);case"rgba32uint":return void ei(v,ue,"32uint",4,J);case"rgba32sint":return void ei(v,ue,"32sint",4,J);case"rgba32float":return void ei(v,ue,"32float",4,J);case"rg11b10ufloat":console.error("TODO: rg11b10ufloat not supported for writing")}})(new Uint8Array(A),e,t,n,i,f,c,o,this.format,s)}}(r=>{r[r.token=0]="token",r[r.keyword=1]="keyword",r[r.reserved=2]="reserved"})(ot||(ot={}));class at{constructor(e,t,n){this.name=e,this.type=t,this.rule=n}toString(){return this.name}}class De{}_t=De,De.none=new at("",ot.reserved,""),De.eof=new at("EOF",ot.token,""),De.reserved={asm:new at("asm",ot.reserved,"asm"),bf16:new at("bf16",ot.reserved,"bf16"),do:new at("do",ot.reserved,"do"),enum:new at("enum",ot.reserved,"enum"),f16:new at("f16",ot.reserved,"f16"),f64:new at("f64",ot.reserved,"f64"),handle:new at("handle",ot.reserved,"handle"),i8:new at("i8",ot.reserved,"i8"),i16:new at("i16",ot.reserved,"i16"),i64:new at("i64",ot.reserved,"i64"),mat:new at("mat",ot.reserved,"mat"),premerge:new at("premerge",ot.reserved,"premerge"),regardless:new at("regardless",ot.reserved,"regardless"),typedef:new at("typedef",ot.reserved,"typedef"),u8:new at("u8",ot.reserved,"u8"),u16:new at("u16",ot.reserved,"u16"),u64:new at("u64",ot.reserved,"u64"),unless:new at("unless",ot.reserved,"unless"),using:new at("using",ot.reserved,"using"),vec:new at("vec",ot.reserved,"vec"),void:new at("void",ot.reserved,"void")},De.keywords={array:new at("array",ot.keyword,"array"),atomic:new at("atomic",ot.keyword,"atomic"),bool:new at("bool",ot.keyword,"bool"),f32:new at("f32",ot.keyword,"f32"),i32:new at("i32",ot.keyword,"i32"),mat2x2:new at("mat2x2",ot.keyword,"mat2x2"),mat2x3:new at("mat2x3",ot.keyword,"mat2x3"),mat2x4:new at("mat2x4",ot.keyword,"mat2x4"),mat3x2:new at("mat3x2",ot.keyword,"mat3x2"),mat3x3:new at("mat3x3",ot.keyword,"mat3x3"),mat3x4:ne
vendor: 11,604 bytes, line 105
105w at("mat3x4",ot.keyword,"mat3x4"),mat4x2:new at("mat4x2",ot.keyword,"mat4x2"),mat4x3:new at("mat4x3",ot.keyword,"mat4x3"),mat4x4:new at("mat4x4",ot.keyword,"mat4x4"),ptr:new at("ptr",ot.keyword,"ptr"),sampler:new at("sampler",ot.keyword,"sampler"),sampler_comparison:new at("sampler_comparison",ot.keyword,"sampler_comparison"),struct:new at("struct",ot.keyword,"struct"),texture_1d:new at("texture_1d",ot.keyword,"texture_1d"),texture_2d:new at("texture_2d",ot.keyword,"texture_2d"),texture_2d_array:new at("texture_2d_array",ot.keyword,"texture_2d_array"),texture_3d:new at("texture_3d",ot.keyword,"texture_3d"),texture_cube:new at("texture_cube",ot.keyword,"texture_cube"),texture_cube_array:new at("texture_cube_array",ot.keyword,"texture_cube_array"),texture_multisampled_2d:new at("texture_multisampled_2d",ot.keyword,"texture_multisampled_2d"),texture_storage_1d:new at("texture_storage_1d",ot.keyword,"texture_storage_1d"),texture_storage_2d:new at("texture_storage_2d",ot.keyword,"texture_storage_2d"),texture_storage_2d_array:new at("texture_storage_2d_array",ot.keyword,"texture_storage_2d_array"),texture_storage_3d:new at("texture_storage_3d",ot.keyword,"texture_storage_3d"),texture_depth_2d:new at("texture_depth_2d",ot.keyword,"texture_depth_2d"),texture_depth_2d_array:new at("texture_depth_2d_array",ot.keyword,"texture_depth_2d_array"),texture_depth_cube:new at("texture_depth_cube",ot.keyword,"texture_depth_cube"),texture_depth_cube_array:new at("texture_depth_cube_array",ot.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new at("texture_depth_multisampled_2d",ot.keyword,"texture_depth_multisampled_2d"),texture_external:new at("texture_external",ot.keyword,"texture_external"),u32:new at("u32",ot.keyword,"u32"),vec2:new at("vec2",ot.keyword,"vec2"),vec3:new at("vec3",ot.keyword,"vec3"),vec4:new at("vec4",ot.keyword,"vec4"),bitcast:new at("bitcast",ot.keyword,"bitcast"),block:new at("block",ot.keyword,"block"),break:new at("break",ot.keyword,"break"),case:new at("case",ot.keyword,"case"),continue:new at("continue",ot.keyword,"continue"),continuing:new at("continuing",ot.keyword,"continuing"),default:new at("default",ot.keyword,"default"),diagnostic:new at("diagnostic",ot.keyword,"diagnostic"),discard:new at("discard",ot.keyword,"discard"),else:new at("else",ot.keyword,"else"),enable:new at("enable",ot.keyword,"enable"),fallthrough:new at("fallthrough",ot.keyword,"fallthrough"),false:new at("false",ot.keyword,"false"),fn:new at("fn",ot.keyword,"fn"),for:new at("for",ot.keyword,"for"),function:new at("function",ot.keyword,"function"),if:new at("if",ot.keyword,"if"),let:new at("let",ot.keyword,"let"),const:new at("const",ot.keyword,"const"),loop:new at("loop",ot.keyword,"loop"),while:new at("while",ot.keyword,"while"),private:new at("private",ot.keyword,"private"),read:new at("read",ot.keyword,"read"),read_write:new at("read_write",ot.keyword,"read_write"),return:new at("return",ot.keyword,"return"),requires:new at("requires",ot.keyword,"requires"),storage:new at("storage",ot.keyword,"storage"),switch:new at("switch",ot.keyword,"switch"),true:new at("true",ot.keyword,"true"),alias:new at("alias",ot.keyword,"alias"),type:new at("type",ot.keyword,"type"),uniform:new at("uniform",ot.keyword,"uniform"),var:new at("var",ot.keyword,"var"),override:new at("override",ot.keyword,"override"),workgroup:new at("workgroup",ot.keyword,"workgroup"),write:new at("write",ot.keyword,"write"),r8unorm:new at("r8unorm",ot.keyword,"r8unorm"),r8snorm:new at("r8snorm",ot.keyword,"r8snorm"),r8uint:new at("r8uint",ot.keyword,"r8uint"),r8sint:new at("r8sint",ot.keyword,"r8sint"),r16uint:new at("r16uint",ot.keyword,"r16uint"),r16sint:new at("r16sint",ot.keyword,"r16sint"),r16float:new at("r16float",ot.keyword,"r16float"),rg8unorm:new at("rg8unorm",ot.keyword,"rg8unorm"),rg8snorm:new at("rg8snorm",ot.keyword,"rg8snorm"),rg8uint:new at("rg8uint",ot.keyword,"rg8uint"),rg8sint:new at("rg8sint",ot.keyword,"rg8sint"),r32uint:new at("r32uint",ot.keyword,"r32uint"),r32sint:new at("r32sint",ot.keyword,"r32sint"),r32float:new at("r32float",ot.keyword,"r32float"),rg16uint:new at("rg16uint",ot.keyword,"rg16uint"),rg16sint:new at("rg16sint",ot.keyword,"rg16sint"),rg16float:new at("rg16float",ot.keyword,"rg16float"),rgba8unorm:new at("rgba8unorm",ot.keyword,"rgba8unorm"),rgba8unorm_srgb:new at("rgba8unorm_srgb",ot.keyword,"rgba8unorm_srgb"),rgba8snorm:new at("rgba8snorm",ot.keyword,"rgba8snorm"),rgba8uint:new at("rgba8uint",ot.keyword,"rgba8uint"),rgba8sint:new at("rgba8sint",ot.keyword,"rgba8sint"),bgra8unorm:new at("bgra8unorm",ot.keyword,"bgra8unorm"),bgra8unorm_srgb:new at("bgra8unorm_srgb",ot.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new at("rgb10a2unorm",ot.keyword,"rgb10a2unorm"),rg11b10float:new at("rg11b10float",ot.keyword,"rg11b10float"),rg32uint:new at("rg32uint",ot.keyword,"rg32uint"),rg32sint:new at("rg32sint",ot.keyword,"rg32sint"),rg32float:new at("rg32float",ot.keyword,"rg32float"),rgba16uint:new at("rgba16uint",ot.keyword,"rgba16uint"),rgba16sint:new at("rgba16sint",ot.keyword,"rgba16sint"),rgba16float:new at("rgba16float",ot.keyword,"rgba16float"),rgba32uint:new at("rgba32uint",ot.keyword,"rgba32uint"),rgba32sint:new at("rgba32sint",ot.keyword,"rgba32sint"),rgba32float:new at("rgba32float",ot.keyword,"rgba32float"),static_assert:new at("static_assert",ot.keyword,"static_assert")},De.tokens={decimal_float_literal:new at("decimal_float_literal",ot.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?[fh]?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+[fh]?)|(-?[0-9]+[fh])/),hex_float_literal:new at("hex_float_literal",ot.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+[fh]?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+[fh]?))/),int_literal:new at("int_literal",ot.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new at("uint_literal",ot.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),name:new at("name",ot.token,/([_\p{XID_Start}][\p{XID_Continue}]+)|([\p{XID_Start}])/u),ident:new at("ident",ot.token,/[_a-zA-Z][0-9a-zA-Z_]*/),and:new at("and",ot.token,"&"),and_and:new at("and_and",ot.token,"&&"),arrow:new at("arrow ",ot.token,"->"),attr:new at("attr",ot.token,"@"),forward_slash:new at("forward_slash",ot.token,"/"),bang:new at("bang",ot.token,"!"),bracket_left:new at("bracket_left",ot.token,"["),bracket_right:new at("bracket_right",ot.token,"]"),brace_left:new at("brace_left",ot.token,"{"),brace_right:new at("brace_right",ot.token,"}"),colon:new at("colon",ot.token,":"),comma:new at("comma",ot.token,","),equal:new at("equal",ot.token,"="),equal_equal:new at("equal_equal",ot.token,"=="),not_equal:new at("not_equal",ot.token,"!="),greater_than:new at("greater_than",ot.token,">"),greater_than_equal:new at("greater_than_equal",ot.token,">="),shift_right:new at("shift_right",ot.token,">>"),less_than:new at("less_than",ot.token,"<"),less_than_equal:new at("less_than_equal",ot.token,"<="),shift_left:new at("shift_left",ot.token,"<<"),modulo:new at("modulo",ot.token,"%"),minus:new at("minus",ot.token,"-"),minus_minus:new at("minus_minus",ot.token,"--"),period:new at("period",ot.token,"."),plus:new at("plus",ot.token,"+"),plus_plus:new at("plus_plus",ot.token,"++"),or:new at("or",ot.token,"|"),or_or:new at("or_or",ot.token,"||"),paren_left:new at("paren_left",ot.token,"("),paren_right:new at("paren_right",ot.token,")"),semicolon:new at("semicolon",ot.token,";"),star:new at("star",ot.token,"*"),tilde:new at("tilde",ot.token,"~"),underscore:new at("underscore",ot.token,"_"),xor:new at("xor",ot.token,"^"),plus_equal:new at("plus_equal",ot.token,"+="),minus_equal:new at("minus_equal",ot.token,"-="),times_equal:new at("times_equal",ot.token,"*="),division_equal:new at("division_equal",ot.token,"/="),modulo_equal:new at("modulo_equal",ot.token,"%="),and_equal:new at("and_equal",ot.token,"&="),or_equal:new at("or_equal",ot.token,"|="),xor_equal:new at("xor_equal",ot.token,"^="),shift_right_equal:new at("shift_right_equal",ot.token,">>="),shift_left_equal:new at("shift_left_equal",ot.token,"<<=")},De.simpleTokens={"@":_t.tokens.attr,"{":_t.tokens.brace_left,"}":_t.tokens.brace_right,":":_t.tokens.colon,",":_t.tokens.comma,"(":_t.tokens.paren_left,")":_t.tokens.paren_right,";":_t.tokens.semicolon},De.literalTokens={"&":_t.tokens.and,"&&":_t.tokens.and_and,"->":_t.tokens.arrow,"/":_t.tokens.forward_slash,"!":_t.tokens.bang,"[":_t.tokens.bracket_left,"]":_t.tokens.bracket_right,"=":_t.tokens.equal,"==":_t.tokens.equal_equal,"!=":_t.tokens.not_equal,">":_t.tokens.greater_than,">=":_t.tokens.greater_than_equal,">>":_t.tokens.shift_right,"<":_t.tokens.less_than,"<=":_t.tokens.less_than_equal,"<<":_t.tokens.shift_left,"%":_t.tokens.modulo,"-":_t.tokens.minus,"--":_t.tokens.minus_minus,".":_t.tokens.period,"+":_t.tokens.plus,"++":_t.tokens.plus_plus,"|":_t.tokens.or,"||":_t.tokens.or_or,"*":_t.tokens.star,"~":_t.tokens.tilde,_:_t.tokens.underscore,"^":_t.tokens.xor,"+=":_t.tokens.plus_equal,"-=":_t.tokens.minus_equal,"*=":_t.tokens.times_equal,"/=":_t.tokens.division_equal,"%=":_t.tokens.modulo_equal,"&=":_t.tokens.and_equal,"|=":_t.tokens.or_equal,"^=":_t.tokens.xor_equal,">>=":_t.tokens.shift_right_equal,"<<=":_t.tokens.shift_left_equal},De.regexTokens={decimal_float_literal:_t.tokens.decimal_float_literal,hex_float_literal:_t.tokens.hex_float_literal,int_literal:_t.tokens.int_literal,uint_literal:_t.tokens.uint_literal,ident:_t.tokens.ident},De.storage_class=[_t.keywords.function,_t.keywords.private,_t.keywords.workgroup,_t.keywords.uniform,_t.keywords.storage],De.access_mode=[_t.keywords.read,_t.keywords.write,_t.keywords.read_write],De.sampler_type=[_t.keywords.sampler,_t.keywords.sampler_comparison],De.sampled_texture_type=[_t.keywords.texture_1d,_t.keywords.texture_2d,_t.keywords.texture_2d_array,_t.keywords.texture_3d,_t.keywords.texture_cube,_t.keywords.texture_cube_array],De.multisampled_texture_type=[_t.keywords.texture_multisampled_2d],De.storage_texture_type=[_t.keywords.texture_storage_1d,_t.keywords.texture_storage_2d,_t.keywords.texture_storage_2d_array,_t.keywords.texture_storage_3d],De.depth_texture_type=[_t.keywords.texture_depth_2d,_t.keywords.texture_depth_2d_array,_t.keywords.texture_depth_cube,_t.keywords.texture_depth_cube_array,_t.keywords.texture_depth_multisampled_2d],De.texture_external_type=[_t.keywords.texture_external],De.any_texture_type=[..._t.sampled_texture_type,..._t.multisampled_texture_type,..._t.storage_texture_type,..._t.depth_texture_type,..._t.texture_external_type],De.texel_format=[_t.keywords.r8unorm,_t.keywords.r8snorm,_t.keywords.r8uint,_t.keywords.r8sint,_t.keywords.r16uint,_t.keywords.r16sint,_t.keywords.r16float,_t.keywords.rg8unorm,_t.keywords.rg8snorm,_t.keywords.rg8uint,_t.keywords.rg8sint,_t.keywords.r32uint,_t.keywords.r32sint,_t.keywords.r32float,_t.keywords.rg16uint,_t.keywords.rg16sint,_t.keywords.rg16float,_t.keywords.rgba8unorm,_t.keywords.rgba8unorm_srgb,_t.keywords.rgba8snorm,_t.keywords.rgba8uint,_t.keywords.rgba8sint,_t.keywords.bgra8unorm,_t.keywords.bgra8unorm_srgb,_t.keywords.rgb10a2unorm,_t.keywords.rg11b10float,_t.keywords.rg32uint,_t.keywords.rg32sint,_t.keywords.rg32float,_t.keywords.rgba16uint,_t.keywords.rgba16sint,_t.keywords.rgba16float,_t.keywords.rgba32uint,_t.keywords.rgba32sint,_t.keywords.rgba32float],De.const_literal=[_t.tokens.int_literal,_t.tokens.uint_literal,_t.tokens.decimal_float_literal,_t.tokens.hex_float_literal,_t.keywords.true,_t.keywords.false],De.literal_or_ident=[_t.tokens.ident,_t.tokens.int_literal,_t.tokens.uint_literal,_t.tokens.decimal_float_literal,_t.tokens.hex_float_literal,_t.tokens.name],De.element_c
105ount_expression=[_t.tokens.int_literal,_t.tokens.uint_literal,_t.tokens.ident],De.template_types=[_t.keywords.vec2,_t.keywords.vec3,_t.keywords.vec4,_t.keywords.mat2x2,_t.keywords.mat2x3,_t.keywords.mat2x4,_t.keywords.mat3x2,_t.keywords.mat3x3,_t.keywords.mat3x4,_t.keywords.mat4x2,_t.keywords.mat4x3,_t.keywords.mat4x4,_t.keywords.atomic,_t.keywords.bitcast,..._t.any_texture_type],De.attribute_name=[_t.tokens.ident,_t.keywords.block,_t.keywords.diagnostic],De.assignment_operators=[_t.tokens.equal,_t.tokens.plus_equal,_t.tokens.minus_equal,_t.tokens.times_equal,_t.tokens.division_equal,_t.tokens.modulo_equal,_t.tokens.and_equal,_t.tokens.or_equal,_t.tokens.xor_equal,_t.tokens.shift_right_equal,_t.tokens.shift_left_equal],De.increment_operators=[_t.tokens.plus_plus,_t.tokens.minus_minus];class dS{constructor(e,t,n,i,s){this.type=e,this.lexeme=t,this.line=n,this.start=i,this.end=s}toString(){return this.lexeme}isTemplateType(){return De.template_types.indexOf(this.type)!=-1}isArrayType(){return this.type==De.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}}class Q7{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 dS(De.eof,"",this._line,this._current,this._current)),this._tokens}scanToken(){let e=this._advance();if(e==`
106`)return this._line++,!0;if(this._isWhitespace(e))return!0;if(e=="/"){if(this._peekAhead()=="/"){for(;e!=`
107`;){if(this._isAtEnd())return!0;e=this._advance()}return this._line++,!0}if(this._peekAhead()=="*"){this._advance();let o=1;for(;o>0;){if(this._isAtEnd())return!0;if(e=this._advance(),e==`
108`)this._line++;else if(e=="*"){if(this._peekAhead()=="/"&&(this._advance(),o--,o==0))return!0}else e=="/"&&this._peekAhead()=="*"&&(this._advance(),o++)}return!0}}const t=De.simpleTokens[e];if(t)return this._addToken(t),!0;let n=De.none;const i=this._isAlpha(e),s=e==="_";if(this._isAlphaNumeric(e)){let o=this._peekAhead();for(;this._isAlphaNumeric(o);)e+=this._advance(),o=this._peekAhead()}if(i){const o=De.keywords[e];if(o)return this._addToken(o),!0}if(i||s)return this._addToken(De.tokens.ident),!0;for(;;){let o=this._findType(e);const c=this._peekAhead();if(e=="-"&&this._tokens.length>0){if(c=="=")return this._current++,e+=c,this._addToken(De.tokens.minus_equal),!0;if(c=="-")return this._current++,e+=c,this._addToken(De.tokens.minus_minus),!0;const f=this._tokens.length-1;if((De.literal_or_ident.indexOf(this._tokens[f].type)!=-1||this._tokens[f].type==De.tokens.paren_right)&&c!=">")return this._addToken(o),!0}if(e==">"&&(c==">"||c=="=")){let f=!1,A=this._tokens.length-1;for(let v=0;v<5&&A>=0&&De.assignment_operators.indexOf(this._tokens[A].type)===-1;++v,--A)if(this._tokens[A].type===De.tokens.less_than){A>0&&this._tokens[A-1].isArrayOrTemplateType()&&(f=!0);break}if(f)return this._addToken(o),!0}if(o===De.none){let f=e,A=0;const v=2;for(let w=0;w<v;++w)if(f+=this._peekAhead(w),o=this._findType(f),o!==De.none){A=w;break}if(o===De.none)return n!==De.none&&(this._current--,this._addToken(n),!0);e=f,this._current+=A+1}if(n=o,this._isAtEnd())break;e+=this._advance()}return n!==De.none&&(this._addToken(n),!0)}_findType(e){for(const n in De.regexTokens){const i=De.regexTokens[n];if(this._match(e,i.rule))return i}return De.literalTokens[e]||De.none}_match(e,t){const n=t.exec(e);return n&&n.index==0&&n[0]==e}_isAtEnd(){return this._current>=this._source.length}_isAlpha(e){return!this._isNumeric(e)&&!this._isWhitespace(e)&&e!=="_"&&e!=="."&&e!=="("&&e!==")"&&e!=="["&&e!=="]"&&e!=="{"&&e!=="}"&&e!==","&&e!==";"&&e!==":"&&e!=="="&&e!=="!"&&e!=="<"&&e!==">"&&e!=="+"&&e!=="-"&&e!=="*"&&e!=="/"&&e!=="%"&&e!=="&"&&e!=="|"&&e!=="^"&&e!=="~"&&e!=="@"&&e!=="#"&&e!=="?"&&e!=="'"&&e!=="`"&&e!=='"'&&e!=="\\"&&e!==`
109`&&e!=="\r"&&e!=="	"&&e!=="\0"}_isNumeric(e){return e>="0"&&e<="9"}_isAlphaNumeric(e){return this._isAlpha(e)||this._isNumeric(e)||e==="_"}_isWhitespace(e){return e==" "||e=="	"||e=="\r"}_advance(e=0){let t=this._source[this._current];return e=e||0,e++,this._current+=e,t}_peekAhead(e=0){return e=e||0,this._current+e>=this._source.length?"\0":this._source[this._current+e]}_addToken(e){const t=this._source.substring(this._start,this._current);this._tokens.push(new dS(e,t,this._line,this._start,this._current))}}function gr(r){return Array.isArray(r)||r?.buffer instanceof ArrayBuffer}const y_=new Float32Array(1),eH=new Uint32Array(y_.buffer),tH=new Uint32Array(y_.buffer),v_=new Int32Array(1),rH=new Float32Array(v_.buffer),nH=new Uint32Array(v_.buffer),b_=new Uint32Array(1),iH=new Float32Array(b_.buffer),sH=new Int32Array(b_.buffer);function pS(r,e,t){if(e===t)return r;if(e==="f32"){if(t==="i32"||t==="x32")return y_[0]=r,eH[0];if(t==="u32")return y_[0]=r,tH[0]}else if(e==="i32"||e==="x32"){if(t==="f32")return v_[0]=r,rH[0];if(t==="u32")return v_[0]=r,nH[0]}else if(e==="u32"){if(t==="f32")return b_[0]=r,iH[0];if(t==="i32"||t==="x32")return b_[0]=r,sH[0]}return console.error(`Unsupported cast from ${e} to ${t}`),r}class oH{constructor(e){this.resources=null,this.inUse=!1,this.info=null,this.node=e}}class zm{constructor(e,t){this.align=e,this.size=t}}class cl{constructor(){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new V7,this.functions=[],this._types=new Map,this._functions=new Map}_isStorageTexture(e){return e.name=="texture_storage_1d"||e.name=="texture_storage_2d"||e.name=="texture_storage_2d_array"||e.name=="texture_storage_3d"}updateAST(e){for(const t of e)t instanceof yg&&this._functions.set(t.name,new oH(t));for(const t of e)if(t instanceof $l){const n=this.getTypeInfo(t,null);n instanceof Hu&&this.structs.push(n)}for(const t of e)if(t instanceof uw)this.aliases.push(this._getAliasInfo(t));else{if(t instanceof cw){const n=t,i=this._getAttributeNum(n.attributes,"id",0),s=n.type!=null?this.getTypeInfo(n.type,n.attributes):null;this.overrides.push(new U7(n.name,s,n.attributes,i));continue}if(this._isUniformVar(t)){const n=t,i=this._getAttributeNum(n.attributes,"group",0),s=this._getAttributeNum(n.attributes,"binding",0),o=this.getTypeInfo(n.type,n.attributes),c=new Um(n.name,o,i,s,n.attributes,Gu.Uniform,n.access);c.access||(c.access="read"),this.uniforms.push(c);continue}if(this._isStorageVar(t)){const n=t,i=this._getAttributeNum(n.attributes,"group",0),s=this._getAttributeNum(n.attributes,"binding",0),o=this.getTypeInfo(n.type,n.attributes),c=this._isStorageTexture(o),f=new Um(n.name,o,i,s,n.attributes,c?Gu.StorageTexture:Gu.Storage,n.access);f.access||(f.access="read"),this.storage.push(f);continue}if(this._isTextureVar(t)){const n=t,i=this._getAttributeNum(n.attributes,"group",0),s=this._getAttributeNum(n.attributes,"binding",0),o=this.getTypeInfo(n.type,n.attributes),c=this._isStorageTexture(o),f=new Um(n.name,o,i,s,n.attributes,c?Gu.StorageTexture:Gu.Texture,n.access);f.access||(f.access="read"),c?this.storage.push(f):this.textures.push(f);continue}if(this._isSamplerVar(t)){const n=t,i=this._getAttributeNum(n.attributes,"group",0),s=this._getAttributeNum(n.attributes,"binding",0),o=this.getTypeInfo(n.type,n.attributes),c=new Um(n.name,o,i,s,n.attributes,Gu.Sampler,n.access);this.samplers.push(c);continue}}for(const t of e)if(t instanceof yg){const n=this._getAttribute(t,"vertex"),i=this._getAttribute(t,"fragment"),s=this._getAttribute(t,"compute"),o=n||i||s,c=new G7(t.name,o?.name,t.attributes);c.attributes=t.attributes,c.startLine=t.startLine,c.endLine=t.endLine,this.functions.push(c),this._functions.get(t.name).info=c,o&&(this._functions.get(t.name).inUse=!0,c.inUse=!0,c.resources=this._findResources(t,!!o),c.inputs=this._getInputs(t.args),c.outputs=this._getOutputs(t.returnType),this.entry[o.name].push(c)),c.arguments=t.args.map(f=>new z7(f.name,this.getTypeInfo(f.type,f.attributes),f.attributes)),c.returnType=t.returnType?this.getTypeInfo(t.returnType,t.attributes):null;continue}for(const t of this._functions.values())t.info&&(t.info.inUse=t.inUse,this._addCalls(t.node,t.info.calls));for(const t of this._functions.values())t.node.search(n=>{var i,s,o;if(n instanceof f4){if(n.value)if(gr(n.value))for(const c of n.value)for(const f of this.overrides)c===f.name&&((i=t.info)===null||i===void 0||i.overrides.push(f));else for(const c of this.overrides)n.value===c.name&&((s=t.info)===null||s===void 0||s.overrides.push(c))}else if(n instanceof ha)for(const c of this.overrides)n.name===c.name&&((o=t.info)===null||o===void 0||o.overrides.push(c))});for(const t of this.uniforms)this._markStructsInUse(t.type);for(const t of this.storage)this._markStructsInUse(t.type)}getFunctionInfo(e){for(const t of this.functions)if(t.name==e)return t;return null}getStructInfo(e){for(const t of this.structs)if(t.name==e)return t;return null}getOverrideInfo(e){for(const t of this.overrides)if(t.name==e)return t;return null}_markStructsInUse(e){if(e)if(e.isStruct){if(e.inUse=!0,e.members)for(const t of e.members)this._markStructsInUse(t.type)}else if(e.isArray)this._markStructsInUse(e.format);else if(e.isTemplate)e.format&&this._markStructsInUse(e.format);else{const t=this._getAlias(e.name);t&&this._markStructsInUse(t)}}_addCalls(e,t){var n;for(const i of e.calls){const s=(n=this._functions.get(i.name))===null||n===void 0?void 0:n.info;s&&t.add(s)}}findResource(e,t,n){if(n){for(const i of this.entry.compute)if(i.name===n){for(const s of i.resources)if(s.group==e&&s.binding==t)return s}for(const i of this.entry.vertex)if(i.name===n){for(const s of i.resources)if(s.group==e&&s.binding==t)return s}for(const i of this.entry.fragment)if(i.name===n){for(const s of i.resources)if(s.group==e&&s.binding==t)return s}}for(const i of this.uniforms)if(i.group==e&&i.binding==t)return i;for(const i of this.storage)if(i.group==e&&i.binding==t)return i;for(const i of this.textures)if(i.group==e&&i.binding==t)return i;for(const i of this.samplers)if(i.group==e&&i.binding==t)return i;return null}_findResource(e){for(const t of this.uniforms)if(t.name==e)return t;for(const t of this.storage)if(t.name==e)return t;for(const t of this.textures)if(t.name==e)return t;for(const t of this.samplers)if(t.name==e)return t;return null}_markStructsFromAST(e){const t=this.getTypeInfo(e,null);this._markStructsInUse(t)}_findResources(e,t){const n=[],i=this,s=[];return e.search(o=>{if(o instanceof m_)s.push({});else if(o instanceof __)s.pop();else if(o instanceof Jl){const c=o;t&&c.type!==null&&this._markStructsFromAST(c.type),s.length>0&&(s[s.length-1][c.name]=c)}else if(o instanceof nl){const c=o;t&&c.type!==null&&this._markStructsFromAST(c.type)}else if(o instanceof tg){const c=o;t&&c.type!==null&&this._markStructsFromAST(c.type),s.length>0&&(s[s.length-1][c.name]=c)}else if(o instanceof ha){const c=o;if(s.length>0&&s[s.length-1][c.name])return;const f=i._findResource(c.name);f&&n.push(f)}else if(o instanceof fw){const c=o,f=i._functions.get(c.name);f&&(t&&(f.inUse=!0),e.calls.add(f.node),f.resources===null&&(f.resources=i._findResources(f.node,t)),n.push(...f.resources))}else if(o instanceof lw){const c=o,f=i._functions.get(c.name);f&&(t&&(f.inUse=!0),e.calls.add(f.node),f.resources===null&&(f.resources=i._findResources(f.node,t)),n.push(...f.resources))}}),[...new Map(n.map(o=>[o.name,o])).values()]}getBindGroups(){const e=[];function t(n,i){n>=e.length&&(e.length=n+1),e[n]===void 0&&(e[n]=[]),i>=e[n].length&&(e[n].length=i+1)}for(const n of this.uniforms)t(n.group,n.binding),e[n.group][n.binding]=n;for(const n of this.storage)t(n.group,n.binding),e[n.group][n.binding]=n;for(const n of this.textures)t(n.group,n.binding),e[n.group][n.binding]=n;for(const n of this.samplers)t(n.group,n.binding),e[n.group][n.binding]=n;return e}_getOutputs(e,t=void 0){if(t===void 0&&(t=[]),e instanceof $l)this._getStructOutputs(e,t);else{const n=this._getOutputInfo(e);n!==null&&t.push(n)}return t}_getStructOutputs(e,t){for(const n of e.members)if(n.type instanceof $l)this._getStructOutputs(n.t
vendor: 4,146 bytes, line 109
109ype,t);else{const i=this._getAttribute(n,"location")||this._getAttribute(n,"builtin");if(i!==null){const s=this.getTypeInfo(n.type,n.type.attributes),o=this._parseInt(i.value),c=new cS(n.name,s,i.name,o);t.push(c)}}}_getOutputInfo(e){const t=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(t!==null){const n=this.getTypeInfo(e,e.attributes),i=this._parseInt(t.value);return new cS("",n,t.name,i)}return null}_getInputs(e,t=void 0){t===void 0&&(t=[]);for(const n of e)if(n.type instanceof $l)this._getStructInputs(n.type,t);else{const i=this._getInputInfo(n);i!==null&&t.push(i)}return t}_getStructInputs(e,t){for(const n of e.members)if(n.type instanceof $l)this._getStructInputs(n.type,t);else{const i=this._getInputInfo(n);i!==null&&t.push(i)}}_getInputInfo(e){const t=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(t!==null){const n=this._getAttribute(e,"interpolation"),i=this.getTypeInfo(e.type,e.attributes),s=this._parseInt(t.value),o=new N7(e.name,i,t.name,s);return n!==null&&(o.interpolation=this._parseString(n.value)),o}return null}_parseString(e){return e instanceof Array&&(e=e[0]),e}_parseInt(e){e instanceof Array&&(e=e[0]);const t=parseInt(e);return isNaN(t)?e:t}_getAlias(e){for(const t of this.aliases)if(t.name==e)return t.type;return null}_getAliasInfo(e){return new k7(e.name,this.getTypeInfo(e.type,null))}getTypeInfoByName(e){for(const t of this.structs)if(t.name==e)return t;for(const t of this.aliases)if(t.name==e)return t.type;return null}getTypeInfo(e,t=null){if(this._types.has(e))return this._types.get(e);if(e instanceof k0){const i=e.type?this.getTypeInfo(e.type,e.attributes):null,s=new h2(e.name,i,t);return this._types.set(e,s),this._updateTypeInfo(s),s}if(e instanceof rg){const i=e,s=i.format?this.getTypeInfo(i.format,i.attributes):null,o=new Xu(i.name,t);return o.format=s,o.count=i.count,this._types.set(e,o),this._updateTypeInfo(o),o}if(e instanceof $l){const i=e,s=new Hu(i.name,t);s.startLine=i.startLine,s.endLine=i.endLine;for(const o of i.members){const c=this.getTypeInfo(o.type,o.attributes);s.members.push(new aS(o.name,c,o.attributes))}return this._types.set(e,s),this._updateTypeInfo(s),s}if(e instanceof jA){const i=e,s=i.format instanceof Ut,o=i.format?s?this.getTypeInfo(i.format,null):new Va(i.format,null):null,c=new lh(i.name,o,t,i.access);return this._types.set(e,c),this._updateTypeInfo(c),c}if(e instanceof ft){const i=e,s=i.format?this.getTypeInfo(i.format,null):null,o=new lh(i.name,s,t,i.access);return this._types.set(e,o),this._updateTypeInfo(o),o}const n=new Va(e.name,t);return this._types.set(e,n),this._updateTypeInfo(n),n}_updateTypeInfo(e){var t,n,i;const s=this._getTypeSize(e);if(e.size=(t=s?.size)!==null&&t!==void 0?t:0,e instanceof Xu&&e.format){const o=this._getTypeSize(e.format);e.stride=Math.max((n=o?.size)!==null&&n!==void 0?n:0,(i=o?.align)!==null&&i!==void 0?i:0),this._updateTypeInfo(e.format)}e instanceof h2&&this._updateTypeInfo(e.format),e instanceof Hu&&this._updateStructInfo(e)}_updateStructInfo(e){var t;let n=0,i=0,s=0,o=0;for(let c=0,f=e.members.length;c<f;++c){const A=e.members[c],v=this._getTypeSize(A);if(!v)continue;(t=this._getAlias(A.type.name))!==null&&t!==void 0||A.type;const w=v.align,S=v.size;n=this._roundUp(w,n+i),i=S,s=n,o=Math.max(o,w),A.offset=n,A.size=S,this._updateTypeInfo(A.type)}e.size=this._roundUp(o,s+i),e.align=o}_getTypeSize(e){var t,n;if(e==null)return null;const i=this._getAttributeNum(e.attributes,"size",0),s=this._getAttributeNum(e.attributes,"align",0);if(e instanceof aS&&(e=e.type),e instanceof Va){const o=this._getAlias(e.name);o!==null&&(e=o)}{const o=cl._typeInfo[e.name];if(o!==void 0){const c=((t=e.format)===null||t===void 0?void 0:t.name)==="f16"?2:1;return new zm(Math.max(s,o.align/c),Math.max(i,o.size/c))}}{const o=cl._typeInfo[e.name.substring(0,e.name.length-1)];if(o){const c=e.name[e.name.length-1]==="h"?2:1;return new zm(Math.max(s,o.align/c),Math.max(i,o.size/c))}}if(e instanceof Xu){let o=e,c=8,f=8;const A=this._getTypeSize(o.format);return A!==null&&(f=A.size,c=A.align),f=o.count*this._getAttributeNum((n=e?.attributes)!==null&&n!==void 0?n:null,"
109stride",this._roundUp(c,f)),i&&(f=i),new zm(Math.max(s,c),Math.max(i,f))}if(e instanceof Hu){let o=0,c=0,f=0,A=0,v=0;for(const w of e.members){const S=this._getTypeSize(w.type);S!==null&&(o=Math.max(S.align,o),f=this._roundUp(S.align,f+A),A=S.size,v=f)}return c=this._roundUp(o,v+A),new zm(Math.max(s,o),Math.max(i,c))}return null}_isUniformVar(e){return e instanceof Jl&&e.storage=="uniform"}_isStorageVar(e){return e instanceof Jl&&e.storage=="storage"}_isTextureVar(e){return e instanceof Jl&&e.type!==null&&cl._textureTypes.indexOf(e.type.name)!=-1}_isSamplerVar(e){return e instanceof Jl&&e.type!==null&&cl._samplerTypes.indexOf(e.type.name)!=-1}_getAttribute(e,t){const n=e;if(!n||!n.attributes)return null;const i=n.attributes;for(let s of i)if(s.name==t)return s;return null}_getAttributeNum(e,t,n){if(e===null)return n;for(let i of e)if(i.name==t){let s=i!==null&&i.value!==null?i.value:n;return s instanceof Array&&(s=s[0]),typeof s=="number"?s:typeof s=="string"?parseInt(s):n}return n}_roundUp(e,t){return Math.ceil(t/e)*e}}cl._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}},cl._textureTypes=De.any_texture_type.map(r=>r.name),cl._samplerTypes=De.sampler_type.map(r=>r.name);let hw=0;class dw{constructor(e,t,n){this.id=hw++,this.name=e,this.value=t,this.node=n}clone(){return new dw(this.name,this.value,this.node)}}class pw{constructor(e){this.id=hw++,this.name=e.name,this.node=e}clone(){return new pw(this.node)}}class Aw{constructor(e){this.parent=null,this.variables=new Map,this.functions=new Map,this.currentFunctionName="",this.id=hw++,e&&(this.parent=e,this.currentFunctionName=e.currentFunctionName)}getVariable(e){var t;return this.variables.has(e)?(t=this.variables.get(e))!==null&&t!==void 0?t:null:this.parent?this.parent.getVariable(e):null}getFunction(e){var t;return this.functions.has(e)?(t=this.functions.get(e))!==null&&t!==void 0?t:null:this.parent?this.parent.getFunction(e):null}createVariable(e,t,n){this.variables.set(e,new dw(e,t,n??null))}setVariable(e,t,n){const i=this.getVariable(e);i!==null?i.value=t:this.createVariable(e,t,n)}getVariableValue(e){var t;const n=this.getVariable(e);return(t=n?.value)!==null&&t!==void 0?t:null}clone(){return new Aw(this)}}class aH{evalExpression(e,t){return null}getTypeInfo(e){return null}getVariableName(e,t){return""}}class cH{constructor(e){this.exec=e}getTypeInfo(e){return this.exec.getTypeInfo(e)}All(e,t){const n=this.exec.evalExpression(e.args[0],t);let i=!0;if(n instanceof ze)return n.data.forEach(s=>{s||(i=!1)}),new it(i?1:0,this.getTypeInfo("bool"));throw new Error(`All() expects a vector argument. Line ${e.line}`)}Any(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze){const i=n.data.some(s=>s);return new it(i?1:0,this.getTypeInfo("bool"))}throw new Error(`Any() expects a vector argument. Line ${e.line}`)}Select(e,t){const n=this.exec.evalExpression(e.args[2],t);if(!(n instanceof it))throw new Error(`Select() expects a bool condition. Line ${e.line}`);return n.value?this.exec.evalExpression(e.args[1],t):this.exec.evalExpression(e.args[0],t)}ArrayLength(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.evalExpression(n,t);if(i instanceof ts&&i.typeInfo.size===0){const s=i.typeInfo,o=i.buffer.byteLength/s.stride;return new it(o,this.getTypeInfo("u32"))}return new it(i.typeInfo.size,this.getTypeInfo("u32"))}Abs(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.abs(s)),n.typeInfo);const i=n;return new it(Math.abs(i.value),i.typeInfo)}Acos(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.acos(s)),n.typeInfo);const i=n;return new it(Math.acos(i.value),n.typeInfo)}Acosh(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>Math.acosh(s)),n.typeInfo);const i=n;return new it(Math.acosh(i.value),n.typeInfo)}Asin(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.asin(s)),n.typeInfo);const i=n;return new it(Math.asin(i.value),n.typeInfo)}Asinh(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.asinh(s)),n.typeInfo);const i=n;return new it(Math.asinh(i.value),n.typeInfo)}Atan(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.atan(s)),n.typeInfo);const i=n;return new it(Math.atan(i.value),n.typeInfo)}Atanh(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.atanh(s)),n.typeInfo);const i=n;return new it(Math.atanh(i.value),n.typeInfo)}Atan2(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze)return new ze(n.data.map((c,f)=>Math.atan2(c,i.data[f])),n.typeInfo);const s=n,o=i;return new it(Math.atan2(s.value,o.value),n.typeInfo)}Ceil(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>Math.ceil(s)),n.typeInfo);const i=n;return new it(Math.ceil(i.value),n.typeInfo)}_clamp(e,t,n){return Math.min(Math.max(e,t),n)}Clamp(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t);if(n instanceof ze&&i instanceof ze&&s instanceof ze)return new ze(n.data.map((A,v)=>this._clamp(A,i.data[v],s.data[v])),n.typeInfo);const o=n,c=i,f=s;return new it(this._clamp(o.value,c.value,f.value),n.typeInfo)}Cos(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.cos(s)),n.typeInfo);const i=n;return new it(Math.cos(i.value),n.typeInfo)}Cosh(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.cosh(s)),n.typeInfo);const i=n;return new it(Math.cos(i.value),n.typeInfo)}CountLeadingZeros(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.clz32(s)),n.typeInfo);const i=n;return new it(Math.clz32(i.value),n.typeInfo)}_countOneBits(e){let t=0;for(;e!==0;)1&e&&t++,e>>=1;return t}CountOneBits(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>this._countOneBits(s)),n.typeInfo);const i=n;return new it(this._countOneBits(i.value),n.typeInfo)}_countTrailingZeros(e){if(e===0)return 32;let t=0;for(;!(1&e);)e>>=1,t++;return t}CountTrailingZeros(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>this._countTrailingZeros(s)),n.typeInfo);const i=n;return new it(this._countTrailingZeros(i.value),n.typeInfo)}Cross(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze){if(n.data.length!==3||i.data.length!==3)return console.error(`Cross() expects 3D vectors. Line ${e.line}`),null;const s=n.data,o=i.data;return new ze([s[1]*o[2]-o[1]*s[2],s[2]*o[0]-o[2]*s[0],s[0]*o[1]-o[0]*s[1]],n.typeInfo)}return console.error(`Cross() expects vector arguments. Line ${e.line}`),null}Degrees(e,t){const n=this.exec.evalExpression(e.args[0],t),i=180/Math.PI;return n instanceof ze?new ze(n.data.map(s=>s*i),n.typeInfo):new it(n.value*i,this.getTypeInfo("f32"))}Determinant(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof on){const i=n.data,s=n.typeInfo.getTypeName(),o=s.endsWith("h")?this.getTypeInfo("f16"):this.getTypeInfo("f32");if(s==="mat2x2"||s==="mat2x2f"||s==="mat2x2h")return new it(i[0]*i[3]-i[1]*i[2],o);if(s==="mat2x3"||s==="mat2x3f"||s==="mat2x3h")return new it(i[0]*(i[4]*i[8]-i[5]*i[7])-i[1]*(i[3]*i[8]-i[5]*i[6])+i[2]*(i[3]*i[7]-i[4]*i[6]),o);if(s==="mat2x4"||s==="mat2x4f"||s==="mat2x4h")console.error(`TODO: Determinant for ${s}`);else if(s==="mat3x2"||s==="mat3x2f"||s==="mat3x2h")console.error(`TODO: Determinant for ${s}`);else{if(s==="mat3x3"||s==="mat3x3f"||s==="mat3x3h")return new it(i[0]*(i[4]*i[8]-i[5]*i[7])-i[1]*(i[3]*i[8]-i[5]*i[6])+i[2]*(i[3]*i[7]-i[4]*i[6]),o);s==="mat3x4"||s==="mat3x4f"||s==="mat3x4h"||s==="mat4x2"||s==="mat4x2f"||s==="mat4x2h"||s==="mat4x3"||s==="mat4x3f"||s==="mat4x3h"?console.error(`TODO: Determinant for ${s}`):s!=="mat4x4"&&s!=="mat4x4f"&&s!=="mat4x4h"||console.error(`TODO: Determinant for ${s}`)}}return console.error(`Determinant expects a matrix argument. Line ${e.line}`),null}Distance(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze){let c=0;for(let f=0;f<n.data.length;++f)c+=(n.data[f]-i.data[f])*(n.data[f]-i.data[f]);return new it(Math.sqrt(c),this.getTypeInfo("f32"))}const s=n,o=i;return new it(Math.abs(s.value-o.value),n.typeInfo)}_dot(e,t){let n=0;for(let i=0;i<e.length;++i)n+=t[i]*e[i];return n}Dot(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);return n instanceof ze&&i instanceof ze?new it(this._dot(n.data,i.data),this.getTypeInfo("f32")):(console.error(`Dot() expects vector arguments. Line ${e.line}`),null)}Dot4U8Packed(e,t){return console.error(`TODO: dot4U8Packed. Line ${e.line}`),null}Dot4I8Packed(e,t){return console.error(`TODO: dot4I8Packed. Line ${e.line}`),null}Exp(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>Math.exp(s)),n.typeInfo);const i=n;return new it(Math.exp(i.value),n.typeInfo)}Exp2(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.pow(2,s)),n.typeInfo);const i=n;return new it(Math.pow(2,i.value),n.typeInfo)}ExtractBits(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t);if(i.typeInfo.name!=="u32"&&i.typeInfo.name!=="x32")return console.error(`ExtractBits() expects an i32 offset argument. Line ${e.line}`),null;if(s.typeInfo.name!=="u32"&&s.typeInfo.name!=="x32")return console.error(`ExtractBits() expects an i32 count argument. Line ${e.line}`),null;const o=i.value,c=s.value;if(n instanceof ze)return new ze(n.data.map(A=>A>>o&(1<<c)-1),n.typeInfo);if(n.typeInfo.name!=="i32"&&n.typeInfo.name!=="x32")return console.error(`ExtractBits() expects an i32 argument. Line ${e.line}`),null;const f=n.value;return new it(f>>o&(1<<c)-1,this.getTypeInfo("i32"))}FaceForward(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t);if(n instanceof ze&&i instanceof ze&&s instanceof ze){const o=this._dot(i.data,s.data);return new ze(o<0?Array.from(n.data):n.data.map(c=>-c),n.typeInfo)}return console.error(`FaceForward() expects vector arguments. Line ${e.line}`),null}_firstLeadingBit(e){return e===0?-1:31-Math.clz32(e)}FirstLeadingBit(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>this._firstLeadingBit(s)),n.typeInfo);const i=n;return new it(this._firstLeadingBit(i.value),n.typeInfo)}_firstTrailingBit(e){return e===0?-1:Math.log2(e&-e)}FirstTrailingBit(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>this._firstTrailingBit(s)),n.typeInfo);const i=n;return new it(this._firstTrailingBit(i.value),n.typeInfo)}Floor(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.floor(s)),n.typeInfo);const i=n;return new it(Math.floor(i.value),n.typeInfo)}Fma(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t);if(n instanceof ze&&i instanceof ze&&s instanceof ze)return n.data.length!==i.data.length||n.data.length!==s.data.length?(console.error(`Fma() expects vectors of the same length. Line ${e.line}`),null):new ze(n.data.map((A,v)=>A*i.data[v]+s.data[v]),n.typeInfo);const o=n,c=i,f=s;return new it(o.value*c.value+f.value,o.typeInfo)}Fract(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>s-Math.floor(s)),n.typeInfo);const i=n;return new it(i.value-Math.floor(i.value),n.typeInfo)}Frexp(e,t){return console.error(`TODO: frexp. Line ${e.line}`),null}InsertBits(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t),o=this.exec.evalExpression(e.args[3],t);if(s.typeInfo.name!=="u32"&&s.typeInfo.name!=="x32")return console.error(`InsertBits() expects an i32 offset argument. Line ${e.line}`),null;const c=s.value,f=(1<<o.value)-1<<c,A=~f;if(n instanceof ze&&i instanceof ze)return new ze(n.data.map((S,F)=>S&A|i.data[F]<<c&f),n.typeInfo);const v=n.value,w=i.value;return new it(v&A|w<<c&f,n.typeInfo)}InverseSqrt(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>1/Math.sqrt(s)),n.typeInfo);const i=n;return new it(1/Math.sqrt(i.value),n.typeInfo)}Ldexp(e,t){return console.error(`TODO: ldexp. Line ${e.line}`),null}Length(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze){let s=0;return n.data.forEach(o=>{s+=o*o}),new it(Math.sqrt(s),this.getTypeInfo("f32"))}const i=n;return new it(Math.abs(i.value),n.typeInfo)}Log(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.log(s)),n.typeInfo);const i=n;return new it(Math.log(i.value),n.typeInfo)}Log2(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.log2(s)),n.typeInfo);const i=n;return new it(Math.log2(i.value),n.typeInfo)}Max(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze)return new ze(n.data.map((c,f)=>Math.max(c,i.data[f])),n.typeInfo);const s=n,o=i;return new it(Math.max(s.value,o.value),n.typeInfo)}Min(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze)return new ze(n.data.map((c,f)=>Math.min(c,i.data[f])),n.typeInfo);const s=n,o=i;return new it(Math.min(s.value,o.value),n.typeInfo)}Mix(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t);if(n instanceof ze&&i instanceof ze&&s instanceof ze)return new ze(n.data.map((f,A)=>n.data[A]*(1-s.data[A])+i.data[A]*s.data[A]),n.typeInfo);const o=i,c=s;return new it(n.value*(1-c.value)+o.value*c.value,n.typeInfo)}Modf(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze)return new ze(n.data.map((o,c)=>o%i.data[c]),n.typeInfo);const s=i;return new it(n.value%s.value,n.typeInfo)}Normalize(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze){const i=this.Length(e,t).value;return new ze(n.data.map(s=>s/i),n.typeInfo)}return console.error(`Normalize() expects a vector argument. Line ${e.line}`),null}Pow(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze)return new ze(n.data.map((c,f)=>Math.pow(c,i.data[f])),n.typeInfo);const s=n,o=i;return new it(Math.pow(s.value,o.value),n.typeInfo)}QuantizeToF16(e,t){const n=this.exec.evalExpression(e.args[0],t);return n instanceof ze?new ze(n.data.map(i=>i),n.typeInfo):new it(n.value,n.typeInfo)}Radians(e,t){const n=this.exec.evalExpression(e.args[0],t);return n instanceof ze?new ze(n.data.map(i=>i*Math.PI/180),n.typeInfo):new it(n.value*Math.PI/180,this.getTypeInfo("f32"))}Reflect(e,t){let n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(n instanceof ze&&i instanceof ze){const s=this._dot(n.data,i.data);return new ze(n.data.map((o,c)=>o-2*s*i.data[c]),n.typeInfo)}return console.error(`Reflect() expects vector arguments. Line ${e.line}`),null}Refract(e,t){let n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t);if(n instanceof ze&&i instanceof ze&&s instanceof it){const o=this._dot(i.data,n.data);return new ze(n.data.map((c,f)=>{const A=1-s.value*s.value*(1-o*o);if(A<0)return 0;const v=Math.sqrt(A);return s.value*c-(s.value*o+v)*i.data[f]}),n.typeInfo)}return console.error(`Refract() expects vector arguments and a scalar argument. Line ${e.line}`),null}ReverseBits(e,t){return console.error(`TODO: reverseBits. Line ${e.line}`),null}Round(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>Math.round(s)),n.typeInfo);const i=n;return new it(Math.round(i.value),n.typeInfo)}Saturate(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.min(Math.max(s,0),1)),n.typeInfo);const i=n;return new it(Math.min(Math.max(i.value,0),1),n.typeInfo)}Sign(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.sign(s)),n.typeInfo);const i=n;return new it(Math.sign(i.value),n.typeInfo)}Sin(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.sin(s)),n.typeInfo);const i=n;return new it(Math.sin(i.value),n.typeInfo)}Sinh(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.sinh(s)),n.typeInfo);const i=n;return new it(Math.sinh(i.value),n.typeInfo)}_smoothstep(e,t,n){const i=Math.min(Math.max((n-e)/(t-e),0),1);return i*i*(3-2*i)}SmoothStep(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t),s=this.exec.evalExpression(e.args[2],t);if(s instanceof ze&&n instanceof ze&&i instanceof ze)return new ze(s.data.map((A,v)=>this._smoothstep(n.data[v],i.data[v],A)),s.typeInfo);const o=n,c=i,f=s;return new it(this._smoothstep(o.value,c.value,f.value),s.typeInfo)}Sqrt(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>Math.sqrt(s)),n.typeInfo);const i=n;return new it(Math.sqrt(i.value),n.typeInfo)}Step(e,t){const n=this.exec.evalExpression(e.args[0],t),i=this.exec.evalExpression(e.args[1],t);if(i instanceof ze&&n instanceof ze)return new ze(i.data.map((o,c)=>o<n.data[c]?0:1),i.typeInfo);const s=n;return new it(i.value<s.value?0:1,s.typeInfo)}Tan(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.tan(s)),n.typeInfo);const i=n;return new it(Math.tan(i.value),n.typeInfo)}Tanh(e,t){const n=this.exec.evalExpression(e.args[0],t);if(n instanceof ze)return new ze(n.data.map(s=>Math.tanh(s)),n.typeInfo);const i=n;return new it(Math.tanh(i.value),n.typeInfo)}_getTransposeType(e){const t=e.getTypeName();return t==="mat2x2f"||t==="mat2x2h"?e:t==="mat2x3f"?this.getTypeInfo("mat3x2f"):t==="mat2x3h"?this.getTypeInfo("mat3x2h"):t==="mat2x4f"?this.getTypeInfo("mat4x2f"):t==="mat2x4h"?this.getTypeInfo("mat4x2h"):t==="mat3x2f"?this.getTypeInfo("mat2x3f"):t==="mat3x2h"?this.getTypeInfo("mat2x3h"):t==="mat3x3f"||t==="mat3x3h"?e:t==="mat3x4f"?this.getTypeInfo("mat4x3f"):t==="mat3x4h"?this.getTypeInfo("mat4x3h"):t==="mat4x2f"?this.getTypeInfo("mat2x4f"):t==="mat4x2h"?this.getTypeInfo("mat2x4h"):t==="mat4x3f"?this.getTypeInfo("mat3x4f"):t==="mat4x3h"?this.getTypeInfo("mat3x4h"):(t==="mat4x4f"||t==="mat4x4h"||console.error(`Invalid matrix type ${t}`),e)}Transpose(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(!(n instanceof on))return console.error(`Transpose() expects a matrix argument. Line ${e.line}`),null;const i=this._getTransposeType(n.typeInfo);if(n.typeInfo.name==="mat2x2"||n.typeInfo.name==="mat2x2f"||n.typeInfo.name==="mat2x2h"){const s=n.data;return new on([s[0],s[2],s[1],s[3]],i)}if(n.typeInfo.name==="mat2x3"||n.typeInfo.name==="mat2x3f"||n.typeInfo.name==="mat2x3h"){const s=n.data;return new on([s[0],s[3],s[6],s[1],s[4],s[7]],i)}if(n.typeInfo.name==="mat2x4"||n.typeInfo.name==="mat2x4f"||n.typeInfo.name==="mat2x4h"){const s=n.data;return new on([s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13]],i)}if(n.typeInfo.name==="mat3x2"||n.typeInfo.name==="mat3x2f"||n.typeInfo.name==="mat3x2h"){const s=n.data;return new on([s[0],s[3],s[1],s[4],s[2],s[5]],i)}if(n.typeInfo.name==="mat3x3"||n.typeInfo.name==="mat3x3f"||n.typeInfo.name==="mat3x3h"){const s=n.data;return new on([s[0],s[3],s[6],s[1],s[4],s[7],s[2],s[5],s[8]],i)}if(n.typeInfo.name==="mat3x4"||n.typeInfo.name==="mat3x4f"||n.typeInfo.name==="mat3x4h"){const s=n.data;return new on([s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13],s[2],s[6],s[10],s[14]],i)}if(n.typeInfo.name==="mat4x2"||n.typeInfo.name==="mat4x2f"||n.typeInfo.name==="mat4x2h"){const s=n.data;return new on([s[0],s[4],s[1],s[5],s[2],s[6]],i)}if(n.typeInfo.name==="mat4x3"||n.typeInfo.name==="mat4x3f"||n.typeInfo.name==="mat4x3h"){const s=n.data;return new on([s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]],i)}if(n.typeInfo.name==="mat4x4"||n.typeInfo.name==="mat4x4f"||n.typeInfo.name==="mat4x4h"){const s=n.data;return new on([s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13],s[2],s[6],s[10],s[14],s[3],s[7],s[11],s[15]],i)}return console.error(`Invalid matrix type ${n.typeInfo.name}`),null}Trunc(e,t){const n=this.exec.evalExpression(e.args[0],t);
109if(n instanceof ze)return new ze(n.data.map(s=>Math.trunc(s)),n.typeInfo);const i=n;return new it(Math.trunc(i.value),n.typeInfo)}Dpdx(e,t){return console.error(`TODO: dpdx. Line ${e.line}`),null}DpdxCoarse(e,t){return console.error(`TODO: dpdxCoarse. Line ${e.line}`),null}DpdxFine(e,t){return console.error("TODO: dpdxFine"),null}Dpdy(e,t){return console.error("TODO: dpdy"),null}DpdyCoarse(e,t){return console.error("TODO: dpdyCoarse"),null}DpdyFine(e,t){return console.error("TODO: dpdyFine"),null}Fwidth(e,t){return console.error("TODO: fwidth"),null}FwidthCoarse(e,t){return console.error("TODO: fwidthCoarse"),null}FwidthFine(e,t){return console.error("TODO: fwidthFine"),null}TextureDimensions(e,t){const n=e.args[0],i=e.args.length>1?this.exec.evalExpression(e.args[1],t).value:0;if(n instanceof ha){const s=n.name,o=t.getVariableValue(s);if(o instanceof Wl){if(i<0||i>=o.mipLevelCount)return console.error(`Invalid mip level for textureDimensions. Line ${e.line}`),null;const c=o.getMipLevelSize(i),f=o.dimension;return f==="1d"?new it(c[0],this.getTypeInfo("u32")):f==="3d"?new ze(c,this.getTypeInfo("vec3u")):f==="2d"?new ze(c.slice(0,2),this.getTypeInfo("vec2u")):(console.error(`Invalid texture dimension ${f} not found. Line ${e.line}`),null)}return console.error(`Texture ${s} not found. Line ${e.line}`),null}return console.error(`Invalid texture argument for textureDimensions. Line ${e.line}`),null}TextureGather(e,t){return console.error("TODO: textureGather"),null}TextureGatherCompare(e,t){return console.error("TODO: textureGatherCompare"),null}TextureLoad(e,t){const n=e.args[0],i=this.exec.evalExpression(e.args[1],t),s=e.args.length>2?this.exec.evalExpression(e.args[2],t).value:0;if(!(i instanceof ze)||i.data.length!==2)return console.error(`Invalid UV argument for textureLoad. Line ${e.line}`),null;if(n instanceof ha){const o=n.name,c=t.getVariableValue(o);if(c instanceof Wl){const f=Math.floor(i.data[0]),A=Math.floor(i.data[1]);if(f<0||f>=c.width||A<0||A>=c.height)return console.error(`Texture ${o} out of bounds. Line ${e.line}`),null;const v=c.getPixel(f,A,0,s);return v===null?(console.error(`Invalid texture format for textureLoad. Line ${e.line}`),null):new ze(v,this.getTypeInfo("vec4f"))}return console.error(`Texture ${o} not found. Line ${e.line}`),null}return console.error(`Invalid texture argument for textureLoad. Line ${e.line}`),null}TextureNumLayers(e,t){const n=e.args[0];if(n instanceof ha){const i=n.name,s=t.getVariableValue(i);return s instanceof Wl?new it(s.depthOrArrayLayers,this.getTypeInfo("u32")):(console.error(`Texture ${i} not found. Line ${e.line}`),null)}return console.error(`Invalid texture argument for textureNumLayers. Line ${e.line}`),null}TextureNumLevels(e,t){const n=e.args[0];if(n instanceof ha){const i=n.name,s=t.getVariableValue(i);return s instanceof Wl?new it(s.mipLevelCount,this.getTypeInfo("u32")):(console.error(`Texture ${i} not found. Line ${e.line}`),null)}return console.error(`Invalid texture argument for textureNumLevels. Line ${e.line}`),null}TextureNumSamples(e,t){const n=e.args[0];if(n instanceof ha){const i=n.name,s=t.getVariableValue(i);return s instanceof Wl?new it(s.sampleCount,this.getTypeInfo("u32")):(console.error(`Texture ${i} not found. Line ${e.line}`),null)}return console.error(`Invalid texture argument for textureNumSamples. Line ${e.line}`),null}TextureSample(e,t){return console.error("TODO: textureSample"),null}TextureSampleBias(e,t){return console.error("TODO: textureSampleBias"),null}TextureSampleCompare(e,t){return console.error("TODO: textureSampleCompare"),null}TextureSampleCompareLevel(e,t){return console.error("TODO: textureSampleCompareLevel"),null}TextureSampleGrad(e,t){return console.error("TODO: textureSampleGrad"),null}TextureSampleLevel(e,t){return console.error("TODO: textureSampleLevel"),null}TextureSampleBaseClampToEdge(e,t){return console.error("TODO: textureSampleBaseClampToEdge"),null}TextureStore(e,t){const n=e.args[0],i=this.exec.evalExpression(e.args[1],t),s=e.args.length===4?this.exec.evalExpression(e.args[2],t).value:0,o=e.args.length===4?this.exec.evalExpression(e.args[3],t).data:this.exec.evalExpression(e.args[2],t).data;if(o.length!==4)return console.error(`Invalid value argument for textureStore. Line ${e.line}`),null;if(!(i instanceof ze)||i.data.length!==2)return console.error(`Invalid UV argument for textureStore. Line ${e.line}`),null;if(n instanceof ha){const c=n.name,f=t.getVariableValue(c);if(f instanceof Wl){const A=f.getMipLevelSize(0),v=Math.floor(i.data[0]),w=Math.floor(i.data[1]);return v<0||v>=A[0]||w<0||w>=A[1]?(console.error(`Texture ${c} out of bounds. Line ${e.line}`),null):(f.setPixel(v,w,0,s,Array.from(o)),null)}return console.error(`Texture ${c} not found. Line ${e.line}`),null}return console.error(`Invalid texture argument for textureStore. Line ${e.line}`),null}AtomicLoad(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t);return t.getVariable(i).value.getSubData(this.exec,n.postfix,t)}
109AtomicStore(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t);return f instanceof it&&c instanceof it&&(f.value=c.value),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),null}AtomicAdd(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value+=c.value),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicSub(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value-=c.value),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicMax(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value=Math.max(f.value,c.value)),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicMin(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value=Math.min(f.value,c.value)),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicAnd(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value=f.value&c.value),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicOr(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value=f.value|c.value),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicXor(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value=f.value^c.value),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicExchange(e,t){let n=e.args[0];n instanceof ds&&(n=n.right);const i=this.exec.getVariableName(n,t),s=t.getVariable(i);let o=e.args[1];const c=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t),A=new it(f.value,f.typeInfo);return f instanceof it&&c instanceof it&&(f.value=c.value),s.value instanceof ts&&s.value.setDataValue(this.exec,f,n.postfix,t),A}AtomicCompareExchangeWeak(e,t){return console.error("TODO: atomicCompareExchangeWeak"),null}Pack4x8snorm(e,t){return console.error("TODO: pack4x8snorm"),null}Pack4x8unorm(e,t){return console.error("TODO: pack4x8unorm"),null}Pack4xI8(e,t){return console.error("TODO: pack4xI8"),null}Pack4xU8(e,t){return console.error("TODO: pack4xU8"),null}Pack4x8Clamp(e,t){return console.error("TODO: pack4x8Clamp"),null}Pack4xU8Clamp(e,t){return console.error("TODO: pack4xU8Clamp"),null}Pack2x16snorm(e,t){return console.error("TODO: pack2x16snorm"),null}Pack2x16unorm(e,t){return console.error("TODO: pack2x16unorm"),null}Pack2x16float(e,t){return console.error("TODO: pack2x16float"),null}Unpack4x8snorm(e,t){return console.error("TODO: unpack4x8snorm"),null}Unpack4x8unorm(e,t){return console.error("TODO: unpack4x8unorm"),null}Unpack4xI8(e,t){return console.error("TODO: unpack4xI8"),null}Unpack4xU8(e,t){return console.error("TODO: unpack4xU8"),null}Unpack2x16snorm(e,t){return console.error("TODO: unpack2x16snorm"),null}Unpack2x16unorm(e,t){return console.error("TODO: unpack2x16unorm"),null}Unpack2x16float(e,t){return console.error("TODO: unpack2x16float"),null}StorageBarrier(e,t){return null}TextureBarrier(e,t){return null}WorkgroupBarrier(e,t){return null}WorkgroupUniformLoad(e,t){return null}SubgroupAdd(e,t){return console.error("TODO: subgroupAdd"),null}SubgroupExclusiveAdd(e,t){return console.error("TODO: subgroupExclusiveAdd"),null}SubgroupInclusiveAdd(e,t){return console.error("TODO: subgroupInclusiveAdd"),null}SubgroupAll(e,t){return console.error("TODO: subgroupAll"),null}SubgroupAnd(e,t){return console.error("TODO: subgroupAnd"),null}SubgroupAny(e,t){return console.error("TODO: subgroupAny"),null}SubgroupBallot(e,t){return console.error("TODO: subgroupBallot"),null}SubgroupBroadcast(e,t){return console.error("TODO: subgroupBroadcast"),null}SubgroupBroadcastFirst(e,t){return console.error("TODO: subgroupBroadcastFirst"),null}SubgroupElect(e,t){return console.error("TODO: subgroupElect"),null}SubgroupMax(e,t){return console.error("TODO: subgroupMax"),null}SubgroupMin(e,t){return console.error("TODO: subgroupMin"),null}SubgroupMul(e,t){return console.error("TODO: subgroupMul"),null}SubgroupExclusiveMul(e,t){return console.error("TODO: subgroupExclusiveMul"),null}SubgroupInclusiveMul(e,t){return console.error("TODO: subgroupInclusiveMul"),null}SubgroupOr(e,t){return console.error("TODO: subgroupOr"),null}SubgroupShuffle(e,t){return console.error("TODO: subgroupShuffle"),null}SubgroupShuffleDown(e,t){return console.error("TODO: subgroupShuffleDown"),null}SubgroupShuffleUp(e,t){return console.error("TODO: subgroupShuffleUp"),null}SubgroupShuffleXor(e,t){return console.error("TODO: subgroupShuffleXor"),null}SubgroupXor(e,t){return console.error("TODO: subgroupXor"),null}QuadBroadcast(e,t){return console.error("TODO: quadBroadcast"),null}QuadSwapDiagonal(e,t){return console.error("TODO: quadSwapDiagonal"),null}QuadSwapX(e,t){return console.error("TODO: quadSwapX"),null}QuadSwapY(e,t){return console.error("TODO: quadSwapY"),null}}const Yv={vec2:2,vec2f:2,vec2i:2,vec2u:2,vec2b:2,vec2h:2,vec3:3,vec3f:3,vec3i:3,vec3u:3,vec3b:3,vec3h:3,vec4:4,vec4f:4,vec4i:4,vec4u:4,vec4b:4,vec4h:4},Io={mat2x2:[2,2,4],mat2x2f:[2,2,4],mat2x2h:[2,2,4],mat2x3:[2,3,6],mat2x3f:[2,3,6],mat2x3h:[2,3,6],mat2x4:[2,4,8],mat2x4f:[2,4,8],mat2x4h:[2,4,8],mat3x2:[3,2,6],mat3x2f:[3,2,6],mat3x2h:[3,2,6],mat3x3:[3,3,9],mat3x3f:[3,3,9],mat3x3h:[3,3,9],mat3x4:[3,4,12],mat3x4f:[3,4,12],mat3x4h:[3,4,12],mat4x2:[4,2,8],mat4x2f:[4,2,8],mat4x2h:[4,2,8],mat4x3:[4,3,12],mat4x3f
109:[4,3,12],mat4x3h:[4,3,12],mat4x4:[4,4,16],mat4x4f:[4,4,16],mat4x4h:[4,4,16]};class po extends aH{constructor(e,t){var n;super(),this.ast=e??[],this.reflection=new cl,this.reflection.updateAST(this.ast),this.context=(n=t?.clone())!==null&&n!==void 0?n:new Aw,this.builtins=new cH(this),this.typeInfo={bool:this.getTypeInfo(Ut.bool),i32:this.getTypeInfo(Ut.i32),u32:this.getTypeInfo(Ut.u32),f32:this.getTypeInfo(Ut.f32),f16:this.getTypeInfo(Ut.f16),vec2f:this.getTypeInfo(ft.vec2f),vec2u:this.getTypeInfo(ft.vec2u),vec2i:this.getTypeInfo(ft.vec2i),vec2h:this.getTypeInfo(ft.vec2h),vec3f:this.getTypeInfo(ft.vec3f),vec3u:this.getTypeInfo(ft.vec3u),vec3i:this.getTypeInfo(ft.vec3i),vec3h:this.getTypeInfo(ft.vec3h),vec4f:this.getTypeInfo(ft.vec4f),vec4u:this.getTypeInfo(ft.vec4u),vec4i:this.getTypeInfo(ft.vec4i),vec4h:this.getTypeInfo(ft.vec4h),mat2x2f:this.getTypeInfo(ft.mat2x2f),mat2x3f:this.getTypeInfo(ft.mat2x3f),mat2x4f:this.getTypeInfo(ft.mat2x4f),mat3x2f:this.getTypeInfo(ft.mat3x2f),mat3x3f:this.getTypeInfo(ft.mat3x3f),mat3x4f:this.getTypeInfo(ft.mat3x4f),mat4x2f:this.getTypeInfo(ft.mat4x2f),mat4x3f:this.getTypeInfo(ft.mat4x3f),mat4x4f:this.getTypeInfo(ft.mat4x4f)}}getVariableValue(e){var t,n;const i=(n=(t=this.context.getVariable(e))===null||t===void 0?void 0:t.value)!==null&&n!==void 0?n:null;if(i===null)return null;if(i instanceof it)return i.value;if(i instanceof ze||i instanceof on)return Array.from(i.data);if(i instanceof ts&&i.typeInfo instanceof Xu){if(i.typeInfo.format.name==="u32")return Array.from(new Uint32Array(i.buffer,i.offset,i.typeInfo.count));if(i.typeInfo.format.name==="i32")return Array.from(new Int32Array(i.buffer,i.offset,i.typeInfo.count));if(i.typeInfo.format.name==="f32")return Array.from(new Float32Array(i.buffer,i.offset,i.typeInfo.count))}return console.error(`Unsupported return variable type ${i.typeInfo.name}`),null}execute(e){(e=e??{}).constants&&this._setOverrides(e.constants,this.context),this._execStatements(this.ast,this.context)}dispatchWorkgroups(e,t,n,i){const s=this.context.clone();(i=i??{}).constants&&this._setOverrides(i.constants,s),this._execStatements(this.ast,s);const o=s.getFunction(e);if(!o)return void console.error(`Function ${e} not found`);if(typeof t=="number")t=[t,1,1];else{if(t.length===0)return void console.error("Invalid dispatch count");t.length===1?t=[t[0],1,1]:t.length===2?t=[t[0],t[1],1]:t.length>3&&(t=[t[0],t[1],t[2]])}const c=t[0],f=t[1],A=t[2],v=this.getTypeInfo("vec3u");s.setVariable("@num_workgroups",new ze(t,v));const w=this.reflection.getFunctionInfo(e);w===null&&console.error(`Function ${e} not found in reflection data`);for(const S in n)for(const F in n[S]){const N=n[S][F];
109s.variables.forEach(U=>{var $;const G=U.node;if(G?.attributes){let H=null,J=null;for(const ue of G.attributes)ue.name==="binding"?H=ue.value:ue.name==="group"&&(J=ue.value);if(F==H&&S==J){let ue=!1;for(const q of w.resources)if(q.name===U.name&&q.group===parseInt(S)&&q.binding===parseInt(F)){ue=!0;break}if(ue)if(N.texture!==void 0&&N.descriptor!==void 0){const q=new Wl(N.texture,this.getTypeInfo(G.type),N.descriptor,($=N.texture.view)!==null&&$!==void 0?$:null);U.value=q}else N.uniform!==void 0?U.value=new ts(N.uniform,this.getTypeInfo(G.type)):U.value=new ts(N,this.getTypeInfo(G.type))}}})}for(let S=0;S<A;++S)for(let F=0;F<f;++F)for(let N=0;N<c;++N)s.setVariable("@workgroup_id",new ze([N,F,S],this.getTypeInfo("vec3u"))),this._dispatchWorkgroup(o,[N,F,S],s)}execStatement(e,t){if(e instanceof t4)return this.evalExpression(e.value,t);if(e instanceof n4){if(e.condition){const n=this.evalExpression(e.condition,t);if(!(n instanceof it))throw new Error("Invalid break-if condition");if(!n.value)return null}return po._breakObj}if(e instanceof i4)return po._continueObj;if(e instanceof tg)this._let(e,t);else if(e instanceof Jl)this._var(e,t);else if(e instanceof L0)this._const(e,t);else if(e instanceof yg)this._function(e,t);else{if(e instanceof e4)return this._if(e,t);if(e instanceof QO)return this._switch(e,t);if(e instanceof KO)return this._for(e,t);if(e instanceof XO)return this._while(e,t);if(e instanceof ZO)return this._loop(e,t);if(e instanceof d2){const n=t.clone();return n.currentFunctionName=t.currentFunctionName,this._execStatements(e.body,n)}if(e instanceof YO)this._assign(e,t);else if(e instanceof qO)this._increment(e,t);else{if(e instanceof $l)return null;if(e instanceof cw){const n=e.name;t.getVariable(n)===null&&t.setVariable(n,new it(0,this.getTypeInfo("u32")))}else if(e instanceof lw)this._call(e,t);else{if(e instanceof r4||e instanceof uw)return null;console.error("Invalid statement type.",e,`Line ${e.line}`)}}}return null}evalExpression(e,t){return e instanceof hc?this._evalBinaryOp(e,t):e instanceof ws?this._evalLiteral(e,t):e instanceof ha?this._evalVariable(e,t):e instanceof fw?this._evalCall(e,t):e instanceof nl?this._evalCreate(e,t):e instanceof s4?this._evalConst(e,t):e instanceof o4?this._evalBitcast(e,t):e instanceof ds?this._evalUnaryOp(e,t):(console.error("Invalid expression type",e,`Line ${e.line}`),null)}getTypeInfo(e){var t;if(e instanceof Ut){const i=this.reflection.getTypeInfo(e);if(i!==null)return i}let n=(t=this.typeInfo[e])!==null&&t!==void 0?t:null;return n!==null||(n=this.reflection.getTypeInfoByName(e)),n}_setOverrides(e,t){for(const n in e){const i=e[n],s=this.reflection.getOverrideInfo(n);s!==null?(s.type===null&&(s.type=this.getTypeInfo("u32")),s.type.name==="u32"||s.type.name==="i32"||s.type.name==="f32"||s.type.name==="f16"?t.setVariable(n,new it(i,s.type)):s.type.name==="bool"?t.setVariable(n,new it(i?1:0,s.type)):s.type.name==="vec2"||s.type.name==="vec3"||s.type.name==="vec4"||s.type.name==="vec2f"||s.type.name==="vec3f"||s.type.name==="vec4f"||s.type.name==="vec2i"||s.type.name==="vec3i"||s.type.name==="vec4i"||s.type.name==="vec2u"||s.type.name==="vec3u"||s.type.name==="vec4u"||s.type.name==="vec2h"||s.type.name==="vec3h"||s.type.name==="vec4h"?t.setVariable(n,new ze(i,s.type)):console.error(`Invalid constant type for ${n}`)):console.error(`Override ${n} does not exist in the shader.`)}}_dispatchWorkgroup(e,t,n){const i=[1,1,1];for(const v of e.node.attributes)if(v.name==="workgroup_size"){if(v.value.length>0){const w=n.getVariableValue(v.value[0]);i[0]=w instanceof it?w.value:parseInt(v.value[0])}if(v.value.length>1){const w=n.getVariableValue(v.value[1]);i[1]=w instanceof it?w.value:parseInt(v.value[1])}if(v.value.length>2){const w=n.getVariableValue(v.value[2]);i[2]=w instanceof it?w.value:parseInt(v.value[2])}}const s=this.getTypeInfo("vec3u"),o=this.getTypeInfo("u32");n.setVariable("@workgroup_size",new ze(i,s));const c=i[0],f=i[1],A=i[2];for(let v=0,w=0;v<A;++v)for(let S=0;S<f;++S)for(let F=0;F<c;++F,++w){const N=[F,S,v],U=[F+t[0]*i[0],S+t[1]*i[1],v+t[2]*i[2]];n.setVariable("@local_invocation_id",new ze(N,s)),n.setVariable("@global_invocation_id",new ze(U,s)),n.setVariable("@local_invocation_index",new it(w,o)),this._dispatchExec(e,n)}}_dispatchExec(e,t){for(const n of e.node.args)for(const i of n.attributes)if(i.name==="builtin"){const s=`@${i.value}`,o=t.getVariable(s);o!==void 0&&t.variables.set(n.name,o)}this._execStatements(e.node.body,t)}getVariableName(e,t){for(;e instanceof ds;)e=e.right;return e instanceof ha?e.name:(console.error("Unknown variable type",e,"Line",e.line),null)}_execStatements(e,t){for(const n of e){if(n instanceof Array){const s=t.clone(),o=this._execStatements(n,s);if(o)return o;continue}
109const i=this.execStatement(n,t);if(i)return i}return null}_call(e,t){const n=t.clone();n.currentFunctionName=e.name;const i=t.getFunction(e.name);if(i){for(let s=0;s<i.node.args.length;++s){const o=i.node.args[s],c=this.evalExpression(e.args[s],n);n.setVariable(o.name,c,o)}this._execStatements(i.node.body,n)}else e.isBuiltin?this._callBuiltinFunction(e,n):this.getTypeInfo(e.name)&&this._evalCreate(e,t)}_increment(e,t){const n=this.getVariableName(e.variable,t),i=t.getVariable(n);i?e.operator==="++"?i.value instanceof it?i.value.value++:console.error(`Variable ${n} is not a scalar. Line ${e.line}`):e.operator==="--"?i.value instanceof it?i.value.value--:console.error(`Variable ${n} is not a scalar. Line ${e.line}`):console.error(`Unknown increment operator ${e.operator}. Line ${e.line}`):console.error(`Variable ${n} not found. Line ${e.line}`)}_getVariableData(e,t){if(e instanceof ha){const n=this.getVariableName(e,t),i=t.getVariable(n);return i===null?(console.error(`Variable ${n} not found. Line ${e.line}`),null):i.value.getSubData(this,e.postfix,t)}if(e instanceof ds){if(e.operator==="*"){const n=this._getVariableData(e.right,t);return n instanceof Ed?n.reference.getSubData(this,e.postfix,t):(console.error(`Variable ${e.right} is not a pointer. Line ${e.line}`),null)}if(e.operator==="&"){const n=this._getVariableData(e.right,t);return new Ed(n)}}return null}_assign(e,t){let n=null,i="<var>",s=null;if(e.variable instanceof ds){const f=this._getVariableData(e.variable,t),A=this.evalExpression(e.value,t),v=e.operator;if(v==="="){if(f instanceof it||f instanceof ze||f instanceof on){if(A instanceof it||A instanceof ze||A instanceof on&&f.data.length===A.data.length)return void f.data.set(A.data);console.error(`Invalid assignment. Line ${e.line}`)}else if(f instanceof ts&&A instanceof ts&&f.buffer.byteLength-f.offset>=A.buffer.byteLength-A.offset)return void(f.buffer.byteLength%4==0?new Uint32Array(f.buffer,f.offset,f.typeInfo.size/4).set(new Uint32Array(A.buffer,A.offset,A.typeInfo.size/4)):new Uint8Array(f.buffer,f.offset,f.typeInfo.size).set(new Uint8Array(A.buffer,A.offset,A.typeInfo.size)));return console.error(`Invalid assignment. Line ${e.line}`),null}if(v==="+=")return f instanceof it||f instanceof ze||f instanceof on?A instanceof it||A instanceof ze||A instanceof on?void f.data.set(A.data.map((w,S)=>f.data[S]+w)):void console.error(`Invalid assignment . Line ${e.line}`):void console.error(`Invalid assignment. Line ${e.line}`);if(v==="-=")return(f instanceof it||f instanceof ze||f instanceof on)&&(A instanceof it||A instanceof ze||A instanceof on)?void f.data.set(A.data.map((w,S)=>f.data[S]-w)):void console.error(`Invalid assignment. Line ${e.line}`)}if(e.variable instanceof ds){if(e.variable.operator==="*"){i=this.getVariableName(e.variable.right,t);const f=t.getVariable(i);if(!(f&&f.value instanceof Ed))return void console.error(`Variable ${i} is not a pointer. Line ${e.line}`);n=f.value.reference;let A=e.variable.postfix;if(!A){let v=e.variable.right;for(;v instanceof ds;){if(v.postfix){A=v.postfix;break}v=v.right}}A&&(n=n.getSubData(this,A,t))}}else{s=e.variable.postfix,i=this.getVariableName(e.variable,t);const f=t.getVariable(i);if(f===null)return void console.error(`Variable ${i} not found. Line ${e.line}`);n=f.value}if(n instanceof Ed&&(n=n.reference),n===null)return void console.error(`Variable ${i} not found. Line ${e.line}`);const o=this.evalExpression(e.value,t),c=e.operator;if(c!=="="){const f=n.getSubData(this,s,t);if(f instanceof ze&&o instanceof it){const A=f.data,v=o.value;if(c==="+=")for(let w=0;w<A.length;++w)A[w]+=v;else if(c==="-=")for(let w=0;w<A.length;++w)A[w]-=v;else if(c==="*=")for(let w=0;w<A.length;++w)A[w]*=v;else if(c==="/=")for(let w=0;w<A.length;++w)A[w]/=v;else if(c==="%=")for(let w=0;w<A.length;++w)A[w]%=v;else if(c==="&=")for(let w=0;w<A.length;++w)A[w]&=v;else if(c==="|=")for(let w=0;w<A.length;++w)A[w]|=v;else if(c==="^=")for(let w=0;w<A.length;++w)A[w]^=v;else if(c==="<<=")for(let w=0;w<A.length;++w)A[w]<<=v;else if(c===">>=")for(let w=0;w<A.length;++w)A[w]>>=v;else console.error(`Invalid operator ${c}. Line ${e.line}`)}else if(f instanceof ze&&o instanceof ze){const A=f.data,v=o.data;if(A.length!==v.length)return void console.error(`Vector length mismatch. Line ${e.line}`);if(c==="+=")for(let w=0;w<A.length;++w)A[w]+=v[w];else if(c==="-=")for(let w=0;w<A.length;++w)A[w]-=v[w];else if(c==="*=")for(let w=0;w<A.length;++w)A[w]*=v[w];else if(c==="/=")for(let w=0;w<A.length;++w)A[w]/=v[w];else if(c==="%=")for(let w=0;w<A.length;++w)A[w]%=v[w];else if(c==="&=")for(let w=0;w<A.length;++w)A[w]&=v[w];else if(c==="|=")for(let w=0;w<A.length;++w)A[w]|=v[w];else if(c==="^=")for(let w=0;w<A.length;++w)A[w]^=v[w];else if(c==="<<=")for(let w=0;w<A.length;++w)A[w]<<=v[w];else if(c===">>=")for(let w=0;w<A.length;++w)A[w]>>=v[w];else console.error(`Invalid operator ${c}. Line ${e.line}`)}else{if(!(f instanceof it&&o instanceof it))return void console.error(`Invalid type for ${e.operator} operator. Line ${e.line}`);c==="+="?f.value+=o.value:c==="-="?f.value-=o.value:c==="*="?f.value*=o.value:c==="/="?f.value/=o.value:c==="%="?f.value%=o.value:c==="&="?f.value&=o.value:c==="|="?f.value|=o.value:c==="^="?f.value^=o.value:c==="<<="?f.value<<=o.value:c===">>="?f.value>>=o.value:console.error(`Invalid operator ${c}. Line ${e.line}`)}return void(n instanceof ts&&n.setDataValue(this,f,s,t))}if(n instanceof ts)n.setDataValue(this,o,s,t);else if(s){if(!(n instanceof ze||n instanceof on))return void console.error(`Variable ${i} is not a vector or matrix. Line ${e.line}`);if(s instanceof Ip){const f=this.evalExpression(s.index,t).value;if(n instanceof ze){if(!(o instanceof it))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[f]=o.value}else{if(!(n instanceof on))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);{const A=this.evalExpression(s.index,t).value;if(A<0)return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);if(!(o instanceof ze))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);{const v=n.typeInfo.getTypeName();if(v==="mat2x2"||v==="mat2x2f"||v==="mat2x2h"){if(!(A<2&&o.data.length===2))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[2*A]=o.data[0],n.data[2*A+1]=o.data[1]}else if(v==="mat2x3"||v==="mat2x3f"||v==="mat2x3h"){if(!(A<2&&o.data.length===3))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[3*A]=o.data[0],n.data[3*A+1]=o.data[1],n.data[3*A+2]=o.data[2]}else if(v==="mat2x4"||v==="mat2x4f"||v==="mat2x4h"){if(!(A<2&&o.data.length===4))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[4*A]=o.data[0],n.data[4*A+1]=o.data[1],n.data[4*A+2]=o.data[2],n.data[4*A+3]=o.data[3]}else if(v==="mat3x2"||v==="mat3x2f"||v==="mat3x2h"){if(!(A<3&&o.data.length===2))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[2*A]=o.data[0],n.data[2*A+1]=o.data[1]}else if(v==="mat3x3"||v==="mat3x3f"||v==="mat3x3h"){if(!(A<3&&o.data.length===3))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[3*A]=o.data[0],n.data[3*A+1]=o.data[1],n.data[3*A+2]=o.data[2]}else if(v==="mat3x4"||v==="mat3x4f"||v==="mat3x4h"){if(!(A<3&&o.data.length===4))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[4*A]=o.data[0],n.data[4*A+1]=o.data[1],n.data[4*A+2]=o.data[2],n.data[4*A+3]=o.data[3]}else if(v==="mat4x2"||v==="mat4x2f"||v==="mat4x2h"){if(!(A<4&&o.data.length===2))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[2*A]=o.data[0],n.data[2*A+1]=o.data[1]}else if(v==="mat4x3"||v==="mat4x3f"||v==="mat4x3h"){if(!(A<4&&o.data.length===3))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[3*A]=o.data[0],n.data[3*A+1]=o.data[1],n.data[3*A+2]=o.data[2]}else{if(v!=="mat4x4"&&v!=="mat4x4f"&&v!=="mat4x4h")return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);if(!(A<4&&o.data.length===4))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);n.data[4*A]=o.data[0],n.data[4*A+1]=o.data[1],n.data[4*A+2]=o.data[2],n.data[4*A+3]=o.data[3]}}}}}else if(s instanceof uh){const f=s.value;if(!(n instanceof ze))return void console.error(`Invalid assignment to ${f}. Variable ${i} is not a vector. Line ${e.line}`);if(o instanceof it){if(f.length>1)return void console.error(`Invalid assignment to ${f} for variable ${i}. Line ${e.line}`);if(f==="x")n.data[0]=o.value;else if(f==="y"){if(n.data.length<2)return void console.error(`Invalid assignment to ${f} for variable ${i}. Line ${e.line}`);n.data[1]=o.value}else if(f==="z"){if(n.data.length<3)return void console.error(`Invalid assignment to ${f} for variable ${i}. Line ${e.line}`);n.data[2]=o.value}else if(f==="w"){if(n.data.length<4)return void console.error(`Invalid assignment to ${f} for variable ${i}. Line ${e.line}`);n.data[3]=o.value}}else{if(!(o instanceof ze))return void console.error(`Invalid assignment to ${i}. Line ${e.line}`);if(f.length!==o.data.length)return void console.error(`Invalid assignment to ${f} for variable ${i}. Line ${e.line}`);for(let A=0;A<f.length;++A){const v=f[A];if(v==="x"||v==="r")n.data[0]=o.data[A];else if(v==="y"||v==="g"){if(o.data.length<2)return void console.error(`Invalid assignment to ${v} for variable ${i}. Line ${e.line}`);n.data[1]=o.data[A]}else if(v==="z"||v==="b"){if(o.data.length<3)return void console.error(`Invalid assignment to ${v} for variable ${i}. Line ${e.line}`);n.data[2]=o.data[A]}else{if(v!=="w"&&v!=="a")return void console.error(`Invalid assignment to ${v} for variable ${i}. Line ${e.line}`);if(o.data.length<4)return void console.error(`Invalid assignment to ${v} for variable ${i}. Line ${e.line}`);n.data[3]=o.data[A]}}}}}else n instanceof it&&o instanceof it?n.value=o.value:n instanceof ze&&o instanceof ze||n instanceof on&&o instanceof on?n.data.set(o.data):console.error(`Invalid assignment to ${i}. Line ${e.line}`)}_function(e,t){const n=new pw(e);t.functions.set(e.name,n)}_const(e,t){let n=null;e.value!==null&&(n=this.evalExpression(e.value,t)),t.createVariable(e.name,n,e)}_let(e,t){let n=null;if(e.value!==null){if(n=this.evalExpression(e.value,t),n===null)return void console.error(`Invalid value for variable ${e.name}. Line ${e.line}`);e.value instanceof ds||(n=n.clone())}
109else{const i=e.type.name;if(i==="f32"||i==="i32"||i==="u32"||i==="bool"||i==="f16"||i==="vec2"||i==="vec3"||i==="vec4"||i==="vec2f"||i==="vec3f"||i==="vec4f"||i==="vec2i"||i==="vec3i"||i==="vec4i"||i==="vec2u"||i==="vec3u"||i==="vec4u"||i==="vec2h"||i==="vec3h"||i==="vec4h"||i==="vec2b"||i==="vec3b"||i==="vec4b"||i==="mat2x2"||i==="mat2x3"||i==="mat2x4"||i==="mat3x2"||i==="mat3x3"||i==="mat3x4"||i==="mat4x2"||i==="mat4x3"||i==="mat4x4"||i==="mat2x2f"||i==="mat2x3f"||i==="mat2x4f"||i==="mat3x2f"||i==="mat3x3f"||i==="mat3x4f"||i==="mat4x2f"||i==="mat4x3f"||i==="mat4x4f"||i==="mat2x2h"||i==="mat2x3h"||i==="mat2x4h"||i==="mat3x2h"||i==="mat3x3h"||i==="mat3x4h"||i==="mat4x2h"||i==="mat4x3h"||i==="mat4x4h"||i==="array"){const s=new nl(e.type,[]);n=this._evalCreate(s,t)}}t.createVariable(e.name,n,e)}_var(e,t){let n=null;if(e.value!==null){if(n=this.evalExpression(e.value,t),n===null)return void console.error(`Invalid value for variable ${e.name}. Line ${e.line}`);e.value instanceof ds||(n=n.clone())}else{if(e.type===null)return void console.error(`Variable ${e.name} has no type. Line ${e.line}`);const i=e.type.name;if(i==="f32"||i==="i32"||i==="u32"||i==="bool"||i==="f16"||i==="vec2"||i==="vec3"||i==="vec4"||i==="vec2f"||i==="vec3f"||i==="vec4f"||i==="vec2i"||i==="vec3i"||i==="vec4i"||i==="vec2u"||i==="vec3u"||i==="vec4u"||i==="vec2h"||i==="vec3h"||i==="vec4h"||i==="vec2b"||i==="vec3b"||i==="vec4b"||i==="mat2x2"||i==="mat2x3"||i==="mat2x4"||i==="mat3x2"||i==="mat3x3"||i==="mat3x4"||i==="mat4x2"||i==="mat4x3"||i==="mat4x4"||i==="mat2x2f"||i==="mat2x3f"||i==="mat2x4f"||i==="mat3x2f"||i==="mat3x3f"||i==="mat3x4f"||i==="mat4x2f"||i==="mat4x3f"||i==="mat4x4f"||i==="mat2x2h"||i==="mat2x3h"||i==="mat2x4h"||i==="mat3x2h"||i==="mat3x3h"||i==="mat3x4h"||i==="mat4x2h"||i==="mat4x3h"||i==="mat4x4h"||e.type instanceof rg||e.type instanceof $l||e.type instanceof ft){const s=new nl(e.type,[]);n=this._evalCreate(s,t)}}t.createVariable(e.name,n,e)}_switch(e,t){t=t.clone();const n=this.evalExpression(e.condition,t);if(!(n instanceof it))return console.error(`Invalid if condition. Line ${e.line}`),null;let i=null;for(const s of e.cases)if(s instanceof l4)for(const o of s.selectors){if(o instanceof N0){i=s;continue}const c=this.evalExpression(o,t);if(!(c instanceof it))return console.error(`Invalid case selector. Line ${e.line}`),null;if(c.value===n.value)return this._execStatements(s.body,t)}else s instanceof u4&&(i=s);return i?this._execStatements(i.body,t):null}_if(e,t){t=t.clone();const n=this.evalExpression(e.condition,t);if(!(n instanceof it))return console.error(`Invalid if condition. Line ${e.line}`),null;if(n.value)return this._execStatements(e.body,t);for(const i of e.elseif){const s=this.evalExpression(i.condition,t);if(!(s instanceof it))return console.error(`Invalid if condition. Line ${e.line}`),null;if(s.value)return this._execStatements(i.body,t)}return e.else?this._execStatements(e.else,t):null}_getScalarValue(e){return e instanceof it?e.value:(console.error("Expected scalar value.",e),0)}_for(e,t){for(t=t.clone(),this.execStatement(e.init,t);this._getScalarValue(this.evalExpression(e.condition,t));){const n=this._execStatements(e.body,t);if(n===po._breakObj)break;if(n!==null&&n!==po._continueObj)return n;this.execStatement(e.increment,t)}return null}_loop(e,t){for(t=t.clone();;){const n=this._execStatements(e.body,t);if(n===po._breakObj)break;if(n===po._continueObj){if(e.continuing&&this._execStatements(e.continuing.body,t)===po._breakObj)break}else if(n!==null)return n}return null}_while(e,t){for(t=t.clone();this._getScalarValue(this.evalExpression(e.condition,t));){const n=this._execStatements(e.body,t);if(n===po._breakObj)break;if(n!==po._continueObj&&n!==null)return n}return null}_evalBitcast(e,t){const n=this.evalExpression(e.value,t),i=e.type;if(n instanceof it){const s=pS(n.value,n.typeInfo.name,i.name);return new it(s,this.getTypeInfo(i))}if(n instanceof ze){const s=n.typeInfo.getTypeName();let o="";if(s.endsWith("f"))o="f32";else if(s.endsWith("i"))o="i32";else if(s.endsWith("u"))o="u32";else if(s.endsWith("b"))o="bool";else{if(!s.endsWith("h"))return console.error(`Unknown vector type ${s}. Line ${e.line}`),null;o="f16"}const c=i.getTypeName();let f="";if(c.endsWith("f"))f="f32";else if(c.endsWith("i"))f="i32";else if(c.endsWith("u"))f="u32";else if(c.endsWith("b"))f="bool";else{if(!c.endsWith("h"))return console.error(`Unknown vector type ${f}. Line ${e.line}`),null;f="f16"}
109const A=function(v,w,S){if(w===S)return v;const F=new Array(v.length);for(let N=0;N<v.length;N++)F[N]=pS(v[N],w,S);return F}(Array.from(n.data),o,f);return new ze(A,this.getTypeInfo(i))}return console.error(`TODO: bitcast for ${n.typeInfo.name}. Line ${e.line}`),null}_evalConst(e,t){return t.getVariableValue(e.name).clone().getSubData(this,e.postfix,t)}_evalCreate(e,t){var n;if(e instanceof nl){if(e.type===null)return p2.void;switch(e.type.getTypeName()){case"bool":case"i32":case"u32":case"f32":case"f16":return this._callConstructorValue(e,t);case"vec2":case"vec3":case"vec4":case"vec2f":case"vec3f":case"vec4f":case"vec2h":case"vec3h":case"vec4h":case"vec2i":case"vec3i":case"vec4i":case"vec2u":case"vec3u":case"vec4u":case"vec2b":case"vec3b":case"vec4b":return this._callConstructorVec(e,t);case"mat2x2":case"mat2x2f":case"mat2x2h":case"mat2x3":case"mat2x3f":case"mat2x3h":case"mat2x4":case"mat2x4f":case"mat2x4h":case"mat3x2":case"mat3x2f":case"mat3x2h":case"mat3x3":case"mat3x3f":case"mat3x3h":case"mat3x4":case"mat3x4f":case"mat3x4h":case"mat4x2":case"mat4x2f":case"mat4x2h":case"mat4x3":case"mat4x3f":case"mat4x3h":case"mat4x4":case"mat4x4f":case"mat4x4h":return this._callConstructorMatrix(e,t)}}const i=e instanceof nl?e.type.name:e.name,s=e instanceof nl?this.getTypeInfo(e.type):this.getTypeInfo(e.name);if(s===null)return console.error(`Unknown type ${i}. Line ${e.line}`),null;if(s.size===0)return null;const o=new ts(new ArrayBuffer(s.size),s,0);if(s instanceof Hu){if(e.args)for(let c=0;c<e.args.length;++c){const f=s.members[c],A=e.args[c],v=this.evalExpression(A,t);o.setData(this,v,f.type,f.offset,t)}}else if(s instanceof Xu){let c=0;if(e.args)for(let f=0;f<e.args.length;++f){const A=e.args[f],v=this.evalExpression(A,t);s.format===null&&(((n=v.typeInfo)===null||n===void 0?void 0:n.name)==="x32"?s.format=this.getTypeInfo("i32"):s.format=v.typeInfo),o.setData(this,v,s.format,c,t),c+=s.stride}}else console.error(`Unknown type "${i}". Line ${e.line}`);return e instanceof nl?o.getSubData(this,e.postfix,t):o}_evalLiteral(e,t){const n=this.getTypeInfo(e.type),i=n.name;return i==="x32"||i==="u32"||i==="f32"||i==="f16"||i==="i32"||i==="bool"?new it(e.scalarValue,n):i==="vec2"||i==="vec3"||i==="vec4"||i==="vec2f"||i==="vec3f"||i==="vec4f"||i==="vec2h"||i==="vec3h"||i==="vec4h"||i==="vec2i"||i==="vec3i"||i==="vec4i"||i==="vec2u"||i==="vec3u"||i==="vec4u"?this._callConstructorVec(e,t):i==="mat2x2"||i==="mat2x3"||i==="mat2x4"||i==="mat3x2"||i==="mat3x3"||i==="mat3x4"||i==="mat4x2"||i==="mat4x3"||i==="mat4x4"||i==="mat2x2f"||i==="mat2x3f"||i==="mat2x4f"||i==="mat3x2f"||i==="mat3x3f"||i==="mat3x4f"||i==="mat4x2f"||i==="mat4x3f"||i==="mat4x4f"||i==="mat2x2h"||i==="mat2x3h"||i==="mat2x4h"||i==="mat3x2h"||i==="mat3x3h"||i==="mat3x4h"||i==="mat4x2h"||i==="mat4x3h"||i==="mat4x4h"?this._callConstructorMatrix(e,t):e.value}_evalVariable(e,t){const n=t.getVariableValue(e.name);return n===null?n:n.getSubData(this,e.postfix,t)}_maxFormatTypeInfo(e){let t=e[0];if(t.name==="f32")return t;for(let n=1;n<e.length;++n){const i=po._priority.get(t.name);po._priority.get(e[n].name)<i&&(t=e[n])}return t.name==="x32"?this.getTypeInfo("i32"):t}_evalUnaryOp(e,t){const n=this.evalExpression(e.right,t);if(e.operator==="&")return new Ed(n);if(e.operator==="*")return n instanceof Ed?n.reference.getSubData(this,e.postfix,t):(console.error(`Invalid dereference. Line ${e.line}`),null);const i=n instanceof it?n.value:n instanceof ze?Array.from(n.data):null;switch(e.operator){case"+":{if(gr(i)){const c=i.map((f,A)=>+f);return new ze(c,n.typeInfo)}const s=i,o=this._maxFormatTypeInfo([n.typeInfo,n.typeInfo]);return new it(+s,o)}case"-":{if(gr(i)){const c=i.map((f,A)=>-f);return new ze(c,n.typeInfo)}const s=i,o=this._maxFormatTypeInfo([n.typeInfo,n.typeInfo]);return new it(-s,o)}case"!":{if(gr(i)){const c=i.map((f,A)=>f?0:1);return new ze(c,n.typeInfo)}const s=i,o=this._maxFormatTypeInfo([n.typeInfo,n.typeInfo]);return new it(s?0:1,o)}case"~":{if(gr(i)){const c=i.map((f,A)=>~f);return new ze(c,n.typeInfo)}const s=i,o=this._maxFormatTypeInfo([n.typeInfo,n.typeInfo]);return new it(~s,o)}}return console.error(`Invalid unary operator ${e.operator}. Line ${e.line}`),null}_evalBinaryOp(e,t){const n=this.evalExpression(e.left,t),i=this.evalExpression(e.right,t),s=n instanceof it?n.value:n instanceof ze||n instanceof on?Array.from(n.data):null,o=i instanceof it?i.value:i instanceof ze||i instanceof on?Array.from(i.data):null;switch(e.operator){case"+":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F+w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S+v);return new ze(w,n.typeInfo)}
109if(gr(o)){const v=s,w=o.map((S,F)=>v+S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c+f,A)}case"-":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F-w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S-v);return new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v-S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c-f,A)}case"*":{if(gr(s)&&gr(o)){const v=s,w=o;if(n instanceof on&&i instanceof on){const S=function($,G,H,J){if(Io[G.name]===void 0||Io[J.name]===void 0)return null;const ue=Io[G.name][0],q=Io[G.name][1],se=Io[J.name][0];if(ue!==Io[J.name][1])return null;const Te=new Array(se*q);for(let Ue=0;Ue<q;Ue++)for(let de=0;de<se;de++){let me=0;for(let pe=0;pe<ue;pe++)me+=$[pe*q+Ue]*H[de*ue+pe];Te[Ue*se+de]=me}return Te}(v,n.typeInfo,w,i.typeInfo);if(S===null)return console.error(`Matrix multiplication failed. Line ${e.line}.`),null;const F=Io[i.typeInfo.name][0],N=Io[n.typeInfo.name][1],U=this.getTypeInfo(`mat${F}x${N}f`);return new on(S,U)}if(n instanceof on&&i instanceof ze){const S=function(F,N,U,$){if(Io[N.name]===void 0||Yv[$.name]===void 0)return null;const G=Io[N.name][0],H=Io[N.name][1];if(G!==U.length)return null;const J=new Array(H);for(let ue=0;ue<H;ue++){let q=0;for(let se=0;se<G;se++)q+=F[se*H+ue]*U[se];J[ue]=q}return J}(v,n.typeInfo,w,i.typeInfo);return S===null?(console.error(`Matrix vector multiplication failed. Line ${e.line}.`),null):new ze(S,i.typeInfo)}if(n instanceof ze&&i instanceof on){const S=function(F,N,U,$){if(Yv[N.name]===void 0||Io[$.name]===void 0)return null;const G=Io[$.name][0],H=Io[$.name][1];if(H!==F.length)return null;const J=[];for(let ue=0;ue<G;ue++){let q=0;for(let se=0;se<H;se++)q+=F[se]*U[se*G+ue];J[ue]=q}return J}(v,n.typeInfo,w,i.typeInfo);return S===null?(console.error(`Matrix vector multiplication failed. Line ${e.line}.`),null):new ze(S,n.typeInfo)}{if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F*w[N]);return new ze(S,n.typeInfo)}}if(gr(s)){const v=o,w=s.map((S,F)=>S*v);return n instanceof on?new on(w,n.typeInfo):new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v*S);return i instanceof on?new on(w,i.typeInfo):new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c*f,A)}case"%":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F%w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S%v);return new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v%S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c%f,A)}case"/":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F/w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S/v);return new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v/S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c/f,A)}case"&":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F&w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S&v);return new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v&S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c&f,A)}case"|":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F|w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S|v);return new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v|S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c|f,A)}case"^":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F^w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S^v);return new ze(w,n.typeInfo)}
109if(gr(o)){const v=s,w=o.map((S,F)=>v^S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c^f,A)}case"<<":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F<<w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S<<v);return new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v<<S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c<<f,A)}case">>":{if(gr(s)&&gr(o)){const v=s,w=o;if(v.length!==w.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const S=v.map((F,N)=>F>>w[N]);return new ze(S,n.typeInfo)}if(gr(s)){const v=o,w=s.map((S,F)=>S>>v);return new ze(w,n.typeInfo)}if(gr(o)){const v=s,w=o.map((S,F)=>v>>S);return new ze(w,i.typeInfo)}const c=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(c>>f,A)}case">":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v>f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A>c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c>A?1:0);
109return new ze(f,i.typeInfo)}return new it(s>o?1:0,this.getTypeInfo("bool"));case"<":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v<f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A<c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c<A?1:0);return new ze(f,i.typeInfo)}return new it(s<o?1:0,this.getTypeInfo("bool"));case"==":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v===f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A==c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c==A?1:0);return new ze(f,i.typeInfo)}return new it(s===o?1:0,this.getTypeInfo("bool"));case"!=":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v!==f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A!==c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c!==A?1:0);
109return new ze(f,i.typeInfo)}return new it(s!==o?1:0,this.getTypeInfo("bool"));case">=":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v>=f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A>=c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c>=A?1:0);return new ze(f,i.typeInfo)}return new it(s>=o?1:0,this.getTypeInfo("bool"));case"<=":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v<=f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A<=c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c<=A?1:0);return new ze(f,i.typeInfo)}return new it(s<=o?1:0,this.getTypeInfo("bool"));case"&&":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v&&f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A&&c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c&&A?1:0);
109return new ze(f,i.typeInfo)}return new it(s&&o?1:0,this.getTypeInfo("bool"));case"||":if(gr(s)&&gr(o)){const c=s,f=o;if(c.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=c.map((v,w)=>v||f[w]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const c=o,f=s.map((A,v)=>A||c?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const c=s,f=o.map((A,v)=>c||A?1:0);return new ze(f,i.typeInfo)}return new it(s||o?1:0,this.getTypeInfo("bool"))}return console.error(`Unknown operator ${e.operator}. Line ${e.line}`),null}_evalCall(e,t){if(e.cachedReturnValue!==null)return e.cachedReturnValue;const n=t.clone();n.currentFunctionName=e.name;const i=t.getFunction(e.name);if(!i)return e.isBuiltin?this._callBuiltinFunction(e,n):this.getTypeInfo(e.name)?this._evalCreate(e,t):(console.error(`Unknown function "${e.name}". Line ${e.line}`),null);for(let s=0;s<i.node.args.length;++s){const o=i.node.args[s],c=this.evalExpression(e.args[s],n);n.createVariable(o.name,c,o)}return this._execStatements(i.node.body,n)}_callBuiltinFunction(e,t){switch(e.name){case"all":return this.builtins.All(e,t);case"any":return this.builtins.Any(e,t);case"select":return this.builtins.Select(e,t);case"arrayLength":return this.builtins.ArrayLength(e,t);case"abs":return this.builtins.Abs(e,t);case"acos":return this.builtins.Acos(e,t);case"acosh":return this.builtins.Acosh(e,t);case"asin":return this.builtins.Asin(e,t);case"asinh":return this.builtins.Asinh(e,t);case"atan":return this.builtins.Atan(e,t);case"atanh":return this.builtins.Atanh(e,t);case"atan2":return this.builtins.Atan2(e,t);case"ceil":return this.builtins.Ceil(e,t);case"clamp":return this.builtins.Clamp(e,t);case"cos":return this.builtins.Cos(e,t);case"cosh":return this.builtins.Cosh(e,t);case"countLeadingZeros":return this.builtins.CountLeadingZeros(e,t);case"countOneBits":return this.builtins.CountOneBits(e,t);case"countTrailingZeros":return this.builtins.CountTrailingZeros(e,t);case"cross":return this.builtins.Cross(e,t);case"degrees":return this.builtins.Degrees(e,t);case"determinant":return this.builtins.Determinant(e,t);case"distance":return this.builtins.Distance(e,t);case"dot":return this.builtins.Dot(e,t);case"dot4U8Packed":return this.builtins.Dot4U8Packed(e,t);case"dot4I8Packed":return this.builtins.Dot4I8Packed(e,t);case"exp":return this.builtins.Exp(e,t);case"exp2":return this.builtins.Exp2(e,t);case"extractBits":return this.builtins.ExtractBits(e,t);case"faceForward":return this.builtins.FaceForward(e,t);case"firstLeadingBit":return this.builtins.FirstLeadingBit(e,t);case"firstTrailingBit":return this.builtins.FirstTrailingBit(e,t);case"floor":return this.builtins.Floor(e,t);case"fma":return this.builtins.Fma(e,t);case"fract":return this.builtins.Fract(e,t);case"frexp":return this.builtins.Frexp(e,t);case"insertBits":return this.builtins.InsertBits(e,t);case"inverseSqrt":return this.builtins.InverseSqrt(e,t);case"ldexp":return this.builtins.Ldexp(e,t);case"length":return this.builtins.Length(e,t);case"log":return this.builtins.Log(e,t);case"log2":return this.builtins.Log2(e,t);case"max":return this.builtins.Max(e,t);case"min":return this.builtins.Min(e,t);case"mix":return this.builtins.Mix(e,t);case"modf":return this.builtins.Modf(e,t);case"normalize":return this.builtins.Normalize(e,t);case"pow":return this.builtins.Pow(e,t);case"quantizeToF16":return this.builtins.QuantizeToF16(e,t);case"radians":return this.builtins.Radians(e,t);case"reflect":return this.builtins.Reflect(e,t);case"refract":return this.builtins.Refract(e,t);case"reverseBits":return this.builtins.ReverseBits(e,t);case"round":return this.builtins.Round(e,t);case"saturate":return this.builtins.Saturate(e,t);case"sign":return this.builtins.Sign(e,t);case"sin":return this.builtins.Sin(e,t);case"sinh":return this.builtins.Sinh(e,t);case"smoothstep":return this.builtins.SmoothStep(e,t);case"sqrt":return this.builtins.Sqrt(e,t);case"step":return this.builtins.Step(e,t);case"tan":return this.builtins.Tan(e,t);case"tanh":return this.builtins.Tanh(e,t);case"transpose":return this.builtins.Transpose(e,t);case"trunc":return this.builtins.Trunc(e,t);case"dpdx":return this.builtins.Dpdx(e,t);case"dpdxCoarse":return this.builtins.DpdxCoarse(e,t);case"dpdxFine":return this.builtins.DpdxFine(e,t);case"dpdy":return this.builtins.Dpdy(e,t);case"dpdyCoarse":return this.builtins.DpdyCoarse(e,t);case"dpdyFine":return this.builtins.DpdyFine(e,t);case"fwidth":return this.builtins.Fwidth(e,t);case"fwidthCoarse":return this.builtins.FwidthCoarse(e,t);case"fwidthFine":return this.builtins.FwidthFine(e,t);case"textureDimensions":return this.builtins.TextureDimensions(e,t);case"textureGather":return this.builtins.TextureGather(e,t);case"textureGatherCompare":return this.builtins.TextureGatherCompare(e,t);case"textureLoad":return this.builtins.TextureLoad(e,t);case"textureNumLayers":return this.builtins.TextureNumLayers(e,t);case"textureNumLevels":return this.builtins.TextureNumLevels(e,t);case"textureNumSamples":return this.builtins.TextureNumSamples(e,t);case"textureSample":return this.builtins.TextureSample(e,t);case"textureSampleBias":return this.builtins.TextureSampleBias(e,t);case"textureSampleCompare":return this.builtins.TextureSampleCompare(e,t);case"textureSampleCompareLevel":return this.builtins.TextureSampleCompareLevel(e,t);case"textureSampleGrad":return this.builtins.TextureSampleGrad(e,t);case"textureSampleLevel":return this.builtins.TextureSampleLevel(e,t);case"textureSampleBaseClampToEdge":return this.builtins.TextureSampleBaseClampToEdge(e,t);case"textureStore":return this.builtins.TextureStore(e,t);case"atomicLoad":return this.builtins.AtomicLoad(e,t);case"atomicStore":return this.builtins.AtomicStore(e,t);case"atomicAdd":return this.builtins.AtomicAdd(e,t);case"atomicSub":return this.builtins.AtomicSub(e,t);case"atomicMax":return this.builtins.AtomicMax(e,t);case"atomicMin":return this.builtins.AtomicMin(e,t);case"atomicAnd":return this.builtins.AtomicAnd(e,t);case"atomicOr":return this.builtins.AtomicOr(e,t);case"atomicXor":return this.builtins.AtomicXor(e,t);case"atomicExchange":return this.builtins.AtomicExchange(e,t);case"atomicCompareExchangeWeak":return this.builtins.AtomicCompareExchangeWeak(e,t);case"pack4x8snorm":return this.builtins.Pack4x8snorm(e,t);case"pack4x8unorm":return this.builtins.Pack4x8unorm(e,t);case"pack4xI8":return this.builtins.Pack4xI8(e,t);case"pack4xU8":return this.builtins.Pack4xU8(e,t);case"pack4x8Clamp":return this.builtins.Pack4x8Clamp(e,t);case"pack4xU8Clamp":return this.builtins.Pack4xU8Clamp(e,t);case"pack2x16snorm":return this.builtins.Pack2x16snorm(e,t);case"pack2x16unorm":return this.builtins.Pack2x16unorm(e,t);case"pack2x16float":return this.builtins.Pack2x16float(e,t);case"unpack4x8snorm":return this.builtins.Unpack4x8snorm(e,t);case"unpack4x8unorm":return this.builtins.Unpack4x8unorm(e,t);case"unpack4xI8":return this.builtins.Unpack4xI8(e,t);case"unpack4xU8":return this.builtins.Unpack4xU8(e,t);case"unpack2x16snorm":return this.builtins.Unpack2x16snorm(e,t);case"unpack2x16unorm":return this.builtins.Unpack2x16unorm(e,t);case"unpack2x16float":return this.builtins.Unpack2x16float(e,t);case"storageBarrier":return this.builtins.StorageBarrier(e,t);case"textureBarrier":return this.builtins.TextureBarrier(e,t);case"workgroupBarrier":return this.builtins.WorkgroupBarrier(e,t);case"workgroupUniformLoad":return this.builtins.WorkgroupUniformLoad(e,t);case"subgroupAdd":return this.builtins.SubgroupAdd(e,t);case"subgroupExclusiveAdd":return this.builtins.SubgroupExclusiveAdd(e,t);case"subgroupInclusiveAdd":return this.builtins.SubgroupInclusiveAdd(e,t);case"subgroupAll":return this.builtins.SubgroupAll(e,t);case"subgroupAnd":return this.builtins.SubgroupAnd(e,t);case"subgroupAny":return this.builtins.SubgroupAny(e,t);case"subgroupBallot":return this.builtins.SubgroupBallot(e,t);case"subgroupBroadcast":return this.builtins.SubgroupBroadcast(e,t);case"subgroupBroadcastFirst":return this.builtins.SubgroupBroadcastFirst(e,t);case"subgroupElect":return this.builtins.SubgroupElect(e,t);case"subgroupMax":return this.builtins.SubgroupMax(e,t);case"subgroupMin":return this.builtins.SubgroupMin(e,t);case"subgroupMul":return this.builtins.SubgroupMul(e,t);case"subgroupExclusiveMul":return this.builtins.SubgroupExclusiveMul(e,t);case"subgroupInclusiveMul":return this.builtins.SubgroupInclusiveMul(e,t);case"subgroupOr":return this.builtins.SubgroupOr(e,t);case"subgroupShuffle":return this.builtins.SubgroupShuffle(e,t);case"subgroupShuffleDown":return this.builtins.SubgroupShuffleDown(e,t);case"subgroupShuffleUp":return this.builtins.SubgroupShuffleUp(e,t);case"subgroupShuffleXor":return this.builtins.SubgroupShuffleXor(e,t);case"subgroupXor":return this.builtins.SubgroupXor(e,t);case"quadBroadcast":return this.builtins.QuadBroadcast(e,t);case"quadSwapDiagonal":return this.builtins.QuadSwapDiagonal(e,t);case"quadSwapX":return this.builtins.QuadSwapX(e,t);case"quadSwapY":return this.builtins.QuadSwapY(e,t)}const n=t.getFunction(e.name);if(n){const i=t.clone();for(let s=0;s<n.node.args.length;++s){const o=n.node.args[s],c=this.evalExpression(e.args[s],i);i.setVariable(o.name,c,o)}return this._execStatements(n.node.body,i)}return null}_callConstructorValue(e,t){if(!e.args||e.args.length===0)return new it(0,this.getTypeInfo(e.type));const n=this.evalExpression(e.args[0],t);return n.typeInfo=this.getTypeInfo(e.type),n.getSubData(this,e.postfix,t).clone()}_callConstructorVec(e,t){const n=this.getTypeInfo(e.type),i=e.type.getTypeName(),s=Yv[i];if(s===void 0)return console.error(`Invalid vec constructor ${i}. Line ${e.line}`),null;const o=[];if(e instanceof ws)if(e.isVector){const c=e.vectorValue;for(const f of c)o.push(f)}else o.push(e.scalarValue);else if(e.args)for(const c of e.args){const f=this.evalExpression(c,t);if(f instanceof ze){const A=f.data;for(let v=0;v<A.length;++v){let w=A[v];o.push(w)}}else if(f instanceof it){let A=f.value;o.push(A)}}if(e.type instanceof ft&&e.type.format===null&&(e.type.format=ft.f32),o.length===0){const c=new Array(s).fill(0);return new ze(c,n).getSubData(this,e.postfix,t)}if(o.length===1)for(;o.length<s;)o.push(o[0]);return o.length<s?(console.error(`Invalid vec constructor. Line ${e.line}`),null):new ze(o.length>s?o.slice(0,s):o,n).getSubData(this,e.postfix,t)}_callConstructorMatrix(e,t){const n=this.getTypeInfo(e.type),i=e.type.getTypeName(),s=Io[i];if(s===void 0)return console.error(`Invalid matrix constructor ${i}. Line ${e.line}`),null;const o=[];if(e instanceof ws)if(e.isVector){const c=e.vectorValue;for(const f of c)o.push(f)}else o.push(e.scalarValue);else if(e.args)for(const c of e.args){const f=this.evalExpression(c,t);f instanceof ze?o.push(...f.data):f instanceof it?o.push(f.value):f instanceof on&&o.push(...f.data)}if(n instanceof lh&&n.format===null&&(n.format=this.getTypeInfo("f32")),o.length===0){const c=new Array(s[2]).fill(0);return new on(c,n).getSubData(this,e.postfix,t)}return o.length!==s[2]?(console.error(`Invalid matrix constructor. Line ${e.line}`),null):new on(o,n).getSubData(this,e.postfix,t)}}po._breakObj=new ja(new Va("BREAK",null),null),po._continueObj=new ja(new Va("CONTINUE",null),null),po._priority=new Map([["f32",0],["f16",1],["u32",2],["i32",3],["x32",3]]);class lH{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}}class uH{constructor(){this._tokens=[],this._current=0,this._currentLine=1,this._deferArrayCountEval=[],this._currentLoop=[],this._context=new lH,this._exec=new po,this._forwardTypeCount=0}parse(e){this._initialize(e),this._deferArrayCountEval.length=0;const t=[];for(;!this._isAtEnd();){const n=this._global_decl_or_directive();if(!n)break;t.push(n)}if(this._deferArrayCountEval.length>0){for(const n of this._deferArrayCountEval){const i=n.arrayType,s=n.countNode;if(s instanceof ha){const o=s.name,c=this._context.constants.get(o);if(c)try{const f=c.constEvaluate(this._exec);i.count=f}catch{}}}this._deferArrayCountEval.length=0}if(this._forwardTypeCount>0)for(const n of t)n.search(i=>{i instanceof hS||i instanceof k0?i.type=this._forwardType(i.type):i instanceof rg?i.format=this._forwardType(i.format):i instanceof Jl||i instanceof tg||i instanceof L0?i.type=this._forwardType(i.type):i instanceof yg?i.returnType=this._forwardType(i.returnType):i instanceof fS&&(i.type=this._forwardType(i.type))});return t}_forwardType(e){if(e instanceof uS){const t=this._getType(e.name);if(t)return t}else e instanceof k0?e.type=this._forwardType(e.type):e instanceof rg&&(e.format=this._forwardType(e.format));return e}_initialize(e){if(e)if(typeof e=="string"){const t=new Q7(e);this._tokens=t.scanTokens()}else this._tokens=e;else this._tokens=[];this._current=0}_updateNode(e,t){return e.line=t??this._currentLine,e}_error(e,t){return{token:e,message:t,toString:()=>`${t}`}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==De.eof}_match(e){if(e instanceof at)return!!this._check(e)&&(this._advance(),!0);for(let t=0,n=e.length;t<n;++t){const i=e[t];if(this._check(i))return this._advance(),!0}return!1}_consume(e,t){if(this._check(e))return this._advance();throw this._error(this._peek(),`${t}. Line:${this._currentLine}`)}_check(e){if(this._isAtEnd())return!1;const t=this._peek();if(e instanceof Array){const n=t.type;let i=!1;for(const s of e){if(n===s)return!0;s===De.tokens.name&&(i=!0)}if(i){const s=De.tokens.name.rule.exec(t.lexeme);if(s&&s.index==0&&s[0]==t.lexeme)return!0}return!1}if(t.type===e)return!0;
109if(e===De.tokens.name){const n=De.tokens.name.rule.exec(t.lexeme);return n&&n.index==0&&n[0]==t.lexeme}return!1}_advance(){var e,t;return this._currentLine=(t=(e=this._peek())===null||e===void 0?void 0:e.line)!==null&&t!==void 0?t:-1,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(De.tokens.semicolon)&&!this._isAtEnd(););if(this._match(De.keywords.alias)){const t=this._type_alias();return this._consume(De.tokens.semicolon,"Expected ';'"),this._exec.reflection.updateAST([t]),t}if(this._match(De.keywords.diagnostic)){const t=this._diagnostic();return this._consume(De.tokens.semicolon,"Expected ';'"),this._exec.reflection.updateAST([t]),t}if(this._match(De.keywords.requires)){const t=this._requires_directive();return this._consume(De.tokens.semicolon,"Expected ';'"),this._exec.reflection.updateAST([t]),t}if(this._match(De.keywords.enable)){const t=this._enable_directive();return this._consume(De.tokens.semicolon,"Expected ';'"),this._exec.reflection.updateAST([t]),t}const e=this._attribute();if(this._check(De.keywords.var)){const t=this._global_variable_decl();return t!=null&&(t.attributes=e),this._consume(De.tokens.semicolon,"Expected ';'."),this._exec.reflection.updateAST([t]),t}if(this._check(De.keywords.override)){const t=this._override_variable_decl();return t!=null&&(t.attributes=e),this._consume(De.tokens.semicolon,"Expected ';'."),this._exec.reflection.updateAST([t]),t}if(this._check(De.keywords.let)){const t=this._global_let_decl();return t!=null&&(t.attributes=e),this._consume(De.tokens.semicolon,"Expected ';'."),this._exec.reflection.updateAST([t]),t}if(this._check(De.keywords.const)){const t=this._global_const_decl();return t!=null&&(t.attributes=e),this._consume(De.tokens.semicolon,"Expected ';'."),this._exec.reflection.updateAST([t]),t}if(this._check(De.keywords.struct)){const t=this._struct_decl();return t!=null&&(t.attributes=e),this._exec.reflection.updateAST([t]),t}if(this._check(De.keywords.fn)){const t=this._function_decl();return t!=null&&(t.attributes=e),this._exec.reflection.updateAST([t]),t}return null}_function_decl(){if(!this._match(De.keywords.fn))return null;const e=this._currentLine,t=this._consume(De.tokens.ident,"Expected function name.").toString();this._consume(De.tokens.paren_left,"Expected '(' for function arguments.");const n=[];if(!this._check(De.tokens.paren_right))do{if(this._check(De.tokens.paren_right))break;const c=this._attribute(),f=this._consume(De.tokens.name,"Expected argument name.").toString();this._consume(De.tokens.colon,"Expected ':' for argument type.");const A=this._attribute(),v=this._type_decl();v!=null&&(v.attributes=A,n.push(this._updateNode(new fS(f,v,c))))}while(this._match(De.tokens.comma));this._consume(De.tokens.paren_right,"Expected ')' after function arguments.");let i=null;if(this._match(De.tokens.arrow)){const c=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=c)}const s=this._compound_statement(),o=this._currentLine;return this._updateNode(new yg(t,n,i,s,e,o),e)}_compound_statement(){const e=[];for(this._consume(De.tokens.brace_left,"Expected '{' for block.");!this._check(De.tokens.brace_right);){const t=this._statement();t!==null&&e.push(t)}return this._consume(De.tokens.brace_right,"Expected '}' for block."),e}_statement(){for(;this._match(De.tokens.semicolon)&&!this._isAtEnd(););if(this._check(De.tokens.attr)&&this._attribute(),this._check(De.keywords.if))return this._if_statement();if(this._check(De.keywords.switch))return this._switch_statement();if(this._check(De.keywords.loop))return this._loop_statement();if(this._check(De.keywords.for))return this._for_statement();if(this._check(De.keywords.while))return this._while_statement();if(this._check(De.keywords.continuing))return this._continuing_statement();if(this._check(De.keywords.static_assert))return this._static_assert_statement();if(this._check(De.tokens.brace_left))return this._compound_statement();let e=null;
109if(this._check(De.keywords.return))e=this._return_statement();else if(this._check([De.keywords.var,De.keywords.let,De.keywords.const]))e=this._variable_statement();else if(this._match(De.keywords.discard))e=this._updateNode(new q7);else if(this._match(De.keywords.break)){const t=this._updateNode(new n4);if(this._currentLoop.length>0){const n=this._currentLoop[this._currentLoop.length-1];t.loopId=n.id}e=t,this._check(De.keywords.if)&&(this._advance(),t.condition=this._optional_paren_expression())}else if(this._match(De.keywords.continue)){const t=this._updateNode(new i4);if(!(this._currentLoop.length>0))throw this._error(this._peek(),`Continue statement must be inside a loop. Line: ${t.line}`);{const n=this._currentLoop[this._currentLoop.length-1];t.loopId=n.id}e=t}else e=this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement();return e!=null&&this._consume(De.tokens.semicolon,"Expected ';' after statement."),e}_static_assert_statement(){if(!this._match(De.keywords.static_assert))return null;const e=this._currentLine,t=this._optional_paren_expression();return this._updateNode(new J7(t),e)}_while_statement(){if(!this._match(De.keywords.while))return null;const e=this._updateNode(new XO(null,null));return this._currentLoop.push(e),e.condition=this._optional_paren_expression(),this._check(De.tokens.attr)&&this._attribute(),e.body=this._compound_statement(),this._currentLoop.pop(),e}_continuing_statement(){const e=this._currentLoop.length>0?this._currentLoop[this._currentLoop.length-1].id:-1;if(!this._match(De.keywords.continuing))return null;const t=this._currentLine,n=this._compound_statement();return this._updateNode(new d2(n,e),t)}_for_statement(){if(!this._match(De.keywords.for))return null;this._consume(De.tokens.paren_left,"Expected '('.");const e=this._updateNode(new KO(null,null,null,null));return this._currentLoop.push(e),e.init=this._check(De.tokens.semicolon)?null:this._for_init(),this._consume(De.tokens.semicolon,"Expected ';'."),e.condition=this._check(De.tokens.semicolon)?null:this._short_circuit_or_expression(),this._consume(De.tokens.semicolon,"Expected ';'."),e.increment=this._check(De.tokens.paren_right)?null:this._for_increment(),this._consume(De.tokens.paren_right,"Expected ')'."),this._check(De.tokens.attr)&&this._attribute(),e.body=this._compound_statement(),this._currentLoop.pop(),e}_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(De.keywords.var)){const e=this._variable_decl();if(e===null)throw this._error(this._peek(),"Variable declaration expected.");let t=null;return this._match(De.tokens.equal)&&(t=this._short_circuit_or_expression()),this._updateNode(new Jl(e.name,e.type,e.storage,e.access,t),e.line)}if(this._match(De.keywords.let)){const e=this._currentLine,t=this._consume(De.tokens.name,"Expected name for let.").toString();let n=null;if(this._match(De.tokens.colon)){const s=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=s)}this._consume(De.tokens.equal,"Expected '=' for let.");const i=this._short_circuit_or_expression();return this._updateNode(new tg(t,n,null,null,i),e)}if(this._match(De.keywords.const)){const e=this._currentLine,t=this._consume(De.tokens.name,"Expected name for const.").toString();let n=null;if(this._match(De.tokens.colon)){const s=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=s)}this._consume(De.tokens.equal,"Expected '=' for const.");const i=this._short_circuit_or_expression();return n===null&&i instanceof ws&&(n=i.type),this._updateNode(new L0(t,n,null,null,i),e)}return null}_increment_decrement_statement(){const e=this._current,t=this._unary_expression();if(t==null)return null;if(!this._check(De.increment_operators))return this._current=e,null;const n=this._consume(De.increment_operators,"Expected increment operator");return this._updateNode(new qO(n.type===De.tokens.plus_plus?np.increment:np.decrement,t))}
109_assignment_statement(){let e=null;const t=this._currentLine;if(this._check(De.tokens.brace_right))return null;let n=this._match(De.tokens.underscore);if(n||(e=this._unary_expression()),!n&&e==null)return null;const i=this._consume(De.assignment_operators,"Expected assignment operator."),s=this._short_circuit_or_expression();return this._updateNode(new YO(HA.parse(i.lexeme),e,s),t)}_func_call_statement(){if(!this._check(De.tokens.ident))return null;const e=this._currentLine,t=this._current,n=this._consume(De.tokens.ident,"Expected function name."),i=this._argument_expression_list();return i===null?(this._current=t,null):this._updateNode(new lw(n.lexeme,i),e)}_loop_statement(){if(!this._match(De.keywords.loop))return null;this._check(De.tokens.attr)&&this._attribute(),this._consume(De.tokens.brace_left,"Expected '{' for loop.");const e=this._updateNode(new ZO([],null));this._currentLoop.push(e);let t=this._statement();for(;t!==null;){if(Array.isArray(t))for(let n of t)e.body.push(n);else e.body.push(t);if(t instanceof d2){e.continuing=t;break}t=this._statement()}return this._currentLoop.pop(),this._consume(De.tokens.brace_right,"Expected '}' for loop."),e}_switch_statement(){if(!this._match(De.keywords.switch))return null;const e=this._updateNode(new QO(null,[]));if(this._currentLoop.push(e),e.condition=this._optional_paren_expression(),this._check(De.tokens.attr)&&this._attribute(),this._consume(De.tokens.brace_left,"Expected '{' for switch."),e.cases=this._switch_body(),e.cases==null||e.cases.length==0)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(De.tokens.brace_right,"Expected '}' for switch."),this._currentLoop.pop(),e}_switch_body(){const e=[];let t=!1;for(;this._check([De.keywords.default,De.keywords.case]);){if(this._match(De.keywords.case)){const n=this._case_selectors();for(const s of n)if(s instanceof N0){if(t)throw this._error(this._previous(),"Multiple default cases in switch statement.");t=!0;break}this._match(De.tokens.colon),this._check(De.tokens.attr)&&this._attribute(),this._consume(De.tokens.brace_left,"Exected '{' for switch case.");const i=this._case_body();this._consume(De.tokens.brace_right,"Exected '}' for switch case."),e.push(this._updateNode(new l4(n,i)))}if(this._match(De.keywords.default)){if(t)throw this._error(this._previous(),"Multiple default cases in switch statement.");this._match(De.tokens.colon),this._check(De.tokens.attr)&&this._attribute(),this._consume(De.tokens.brace_left,"Exected '{' for switch default.");const n=this._case_body();this._consume(De.tokens.brace_right,"Exected '}' for switch default."),e.push(this._updateNode(new u4(n)))}}return e}_case_selectors(){const e=[];for(this._match(De.keywords.default)?e.push(this._updateNode(new N0)):e.push(this._shift_expression());this._match(De.tokens.comma);)this._match(De.keywords.default)?e.push(this._updateNode(new N0)):e.push(this._shift_expression());return e}_case_body(){if(this._match(De.keywords.fallthrough))return this._consume(De.tokens.semicolon,"Expected ';'"),[];let e=this._statement();if(e==null)return[];e instanceof Array||(e=[e]);const t=this._case_body();return t.length==0?e:[...e,t[0]]}_if_statement(){if(!this._match(De.keywords.if))return null;const e=this._currentLine,t=this._optional_paren_expression();this._check(De.tokens.attr)&&this._attribute();const n=this._compound_statement();let i=[];this._match_elseif()&&(this._check(De.tokens.attr)&&this._attribute(),i=this._elseif_statement(i));let s=null;return this._match(De.keywords.else)&&(this._check(De.tokens.attr)&&this._attribute(),s=this._compound_statement()),this._updateNode(new e4(t,n,i,s),e)}_match_elseif(){return this._tokens[this._current].type===De.keywords.else&&this._tokens[this._current+1].type===De.keywords.if&&(this._advance(),this._advance(),!0)}_elseif_statement(e=[]){const t=this._optional_paren_expression(),n=this._compound_statement();return e.push(this._updateNode(new Y7(t,n))),this._match_elseif()&&(this._check(De.tokens.attr)&&this._attribute(),this._elseif_statement(e)),e}_return_statement(){if(!this._match(De.keywords.return))return null;const e=this._short_circuit_or_expression();return this._updateNode(new t4(e))}_short_circuit_or_expression(){let e=this._short_circuit_and_expr();for(;this._match(De.tokens.or_or);
109)e=this._updateNode(new hc(this._previous().toString(),e,this._short_circuit_and_expr()));return e}_short_circuit_and_expr(){let e=this._inclusive_or_expression();for(;this._match(De.tokens.and_and);)e=this._updateNode(new hc(this._previous().toString(),e,this._inclusive_or_expression()));return e}_inclusive_or_expression(){let e=this._exclusive_or_expression();for(;this._match(De.tokens.or);)e=this._updateNode(new hc(this._previous().toString(),e,this._exclusive_or_expression()));return e}_exclusive_or_expression(){let e=this._and_expression();for(;this._match(De.tokens.xor);)e=this._updateNode(new hc(this._previous().toString(),e,this._and_expression()));return e}_and_expression(){let e=this._equality_expression();for(;this._match(De.tokens.and);)e=this._updateNode(new hc(this._previous().toString(),e,this._equality_expression()));return e}_equality_expression(){const e=this._relational_expression();return this._match([De.tokens.equal_equal,De.tokens.not_equal])?this._updateNode(new hc(this._previous().toString(),e,this._relational_expression())):e}_relational_expression(){let e=this._shift_expression();for(;this._match([De.tokens.less_than,De.tokens.greater_than,De.tokens.less_than_equal,De.tokens.greater_than_equal]);)e=this._updateNode(new hc(this._previous().toString(),e,this._shift_expression()));return e}_shift_expression(){let e=this._additive_expression();for(;this._match([De.tokens.shift_left,De.tokens.shift_right]);)e=this._updateNode(new hc(this._previous().toString(),e,this._additive_expression()));return e}_additive_expression(){let e=this._multiplicative_expression();for(;this._match([De.tokens.plus,De.tokens.minus]);)e=this._updateNode(new hc(this._previous().toString(),e,this._multiplicative_expression()));return e}_multiplicative_expression(){let e=this._unary_expression();for(;this._match([De.tokens.star,De.tokens.forward_slash,De.tokens.modulo]);)e=this._updateNode(new hc(this._previous().toString(),e,this._unary_expression()));return e}_unary_expression(){return this._match([De.tokens.minus,De.tokens.bang,De.tokens.tilde,De.tokens.star,De.tokens.and])?this._updateNode(new ds(this._previous().toString(),this._unary_expression())):this._singular_expression()}_singular_expression(){const e=this._primary_expression(),t=this._postfix_expression();return t&&(e.postfix=t),e}_postfix_expression(){if(this._match(De.tokens.bracket_left)){const e=this._short_circuit_or_expression();this._consume(De.tokens.bracket_right,"Expected ']'.");const t=this._updateNode(new Ip(e)),n=this._postfix_expression();return n&&(t.postfix=n),t}if(this._match(De.tokens.period)){const e=this._consume(De.tokens.name,"Expected member name."),t=this._postfix_expression(),n=this._updateNode(new uh(e.lexeme));return t&&(n.postfix=t),n}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}_getType(e){const t=this._getStruct(e);if(t!==null)return t;switch(e){case"void":return Ut.void;case"bool":return Ut.bool;case"i32":return Ut.i32;case"u32":return Ut.u32;case"f32":return Ut.f32;case"f16":return Ut.f16;case"vec2f":return ft.vec2f;case"vec3f":return ft.vec3f;case"vec4f":return ft.vec4f;case"vec2i":return ft.vec2i;case"vec3i":return ft.vec3i;case"vec4i":return ft.vec4i;case"vec2u":return ft.vec2u;case"vec3u":return ft.vec3u;case"vec4u":return ft.vec4u;case"vec2h":return ft.vec2h;case"vec3h":return ft.vec3h;case"vec4h":return ft.vec4h;case"mat2x2f":return ft.mat2x2f;case"mat2x3f":return ft.mat2x3f;case"mat2x4f":return ft.mat2x4f;case"mat3x2f":return ft.mat3x2f;case"mat3x3f":return ft.mat3x3f;case"mat3x4f":return ft.mat3x4f;case"mat4x2f":return ft.mat4x2f;case"mat4x3f":return ft.mat4x3f;case"mat4x4f":return ft.mat4x4f;case"mat2x2h":return ft.mat2x2h;case"mat2x3h":return ft.mat2x3h;case"mat2x4h":return ft.mat2x4h;case"mat3x2h":return ft.mat3x2h;case"mat3x3h":return ft.mat3x3h;case"mat3x4h":return ft.mat3x4h;case"mat4x2h":return ft.mat4x2h;case"mat4x3h":return ft.mat4x3h;case"mat4x4h":return ft.mat4x4h;case"mat2x2i":return ft.mat2x2i;case"mat2x3i":return ft.mat2x3i;case"mat2x4i":return ft.mat2x4i;case"mat3x2i":return ft.mat3x2i;case"mat3x3i":return ft.mat3x3i;case"mat3x4i":return ft.mat3x4i;case"mat4x2i":return ft.mat4x2i;case"mat4x3i":return ft.mat4x3i;case"mat4x4i":return ft.mat4x4i;case"mat2x2u":return ft.mat2x2u;case"mat2x3u":return ft.mat2x3u;case"mat2x4u":return ft.mat2x4u;case"mat3x2u":return ft.mat3x2u;case"mat3x3u":return ft.mat3x3u;case"mat3x4u":return ft.mat3x4u;case"mat4x2u":return ft.mat4x2u;case"mat4x3u":return ft.mat4x3u;case"mat4x4u":return ft.mat4x4u}return null}_validateTypeRange(e,t){if(t.name==="i32"){if(e<-2147483648||e>2147483647)throw this._error(this._previous(),`Value out of range for i32: ${e}. Line: ${this._currentLine}.`)}else if(t.name==="u32"&&(e<0||e>4294967295))throw this._error(this._previous(),`Value out of range for u32: ${e}. Line: ${this._currentLine}.`)}_primary_expression(){if(this._match(De.tokens.ident)){const n=this._previous().toString();if(this._check(De.tokens.paren_left)){const i=this._argument_expression_list(),s=this._getType(n);return s!==null?this._updateNode(new nl(s,i)):this._updateNode(new fw(n,i))}if(this._context.constants.has(n)){const i=this._context.constants.get(n);return this._updateNode(new s4(n,i.value))}return this._updateNode(new ha(n))}if(this._match(De.tokens.int_literal)){const n=this._previous().toString();let i=n.endsWith("i")||n.endsWith("i")?Ut.i32:n.endsWith("u")||n.endsWith("U")?Ut.u32:Ut.x32;const s=parseInt(n);
109return this._validateTypeRange(s,i),this._updateNode(new ws(new it(s,this._exec.getTypeInfo(i)),i))}if(this._match(De.tokens.uint_literal)){const n=parseInt(this._previous().toString());return this._validateTypeRange(n,Ut.u32),this._updateNode(new ws(new it(n,this._exec.getTypeInfo(Ut.u32)),Ut.u32))}if(this._match([De.tokens.decimal_float_literal,De.tokens.hex_float_literal])){let n=this._previous().toString(),i=n.endsWith("h");i&&(n=n.substring(0,n.length-1));const s=parseFloat(n);this._validateTypeRange(s,i?Ut.f16:Ut.f32);const o=i?Ut.f16:Ut.f32;return this._updateNode(new ws(new it(s,this._exec.getTypeInfo(o)),o))}if(this._match([De.keywords.true,De.keywords.false])){let n=this._previous().toString()===De.keywords.true.rule;return this._updateNode(new ws(new it(n?1:0,this._exec.getTypeInfo(Ut.bool)),Ut.bool))}if(this._check(De.tokens.paren_left))return this._paren_expression();if(this._match(De.keywords.bitcast)){this._consume(De.tokens.less_than,"Expected '<'.");const n=this._type_decl();this._consume(De.tokens.greater_than,"Expected '>'.");const i=this._paren_expression();return this._updateNode(new o4(n,i))}const e=this._type_decl(),t=this._argument_expression_list();return this._updateNode(new nl(e,t))}_argument_expression_list(){if(!this._match(De.tokens.paren_left))return null;const e=[];do{if(this._check(De.tokens.paren_right))break;const t=this._short_circuit_or_expression();e.push(t)}while(this._match(De.tokens.comma));return this._consume(De.tokens.paren_right,"Expected ')' for agument list"),e}_optional_paren_expression(){this._match(De.tokens.paren_left);const e=this._short_circuit_or_expression();return this._match(De.tokens.paren_right),e}_paren_expression(){this._consume(De.tokens.paren_left,"Expected '('.");const e=this._short_circuit_or_expression();return this._consume(De.tokens.paren_right,"Expected ')'."),e}_struct_decl(){if(!this._match(De.keywords.struct))return null;const e=this._currentLine,t=this._consume(De.tokens.ident,"Expected name for struct.").toString();this._consume(De.tokens.brace_left,"Expected '{' for struct body.");const n=[];for(;!this._check(De.tokens.brace_right);){const o=this._attribute(),c=this._consume(De.tokens.name,"Expected variable name.").toString();this._consume(De.tokens.colon,"Expected ':' for struct member type.");const f=this._attribute(),A=this._type_decl();A!=null&&(A.attributes=f),this._check(De.tokens.brace_right)?this._match(De.tokens.comma):this._consume(De.tokens.comma,"Expected ',' for struct member."),n.push(this._updateNode(new hS(c,A,o)))}this._consume(De.tokens.brace_right,"Expected '}' after struct body.");const i=this._currentLine,s=this._updateNode(new $l(t,n,e,i),e);return this._context.structs.set(t,s),s}_global_variable_decl(){const e=this._variable_decl();if(!e)return null;if(this._match(De.tokens.equal)){const t=this._const_expression();e.value=t}if(e.type!==null&&e.value instanceof ws){if(e.value.type.name!=="x32"&&e.type.getTypeName()!==e.value.type.getTypeName())throw this._error(this._peek(),`Invalid cast from ${e.value.type.name} to ${e.type.name}. Line:${this._currentLine}`);e.value.isScalar&&this._validateTypeRange(e.value.scalarValue,e.type),e.value.type=e.type}else e.type===null&&e.value instanceof ws&&(e.type=e.value.type.name==="x32"?Ut.i32:e.value.type,e.value.isScalar&&this._validateTypeRange(e.value.scalarValue,e.type));return e}_override_variable_decl(){const e=this._override_decl();return e&&this._match(De.tokens.equal)&&(e.value=this._const_expression()),e}_global_const_decl(){var e;if(!this._match(De.keywords.const))return null;const t=this._consume(De.tokens.name,"Expected variable name"),n=this._currentLine;let i=null;if(this._match(De.tokens.colon)){const f=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=f)}let s=null;this._consume(De.tokens.equal,"const declarations require an assignment");const o=this._short_circuit_or_expression();try{let f=[Ut.f32],A=o.constEvaluate(this._exec,f);A instanceof it&&this._validateTypeRange(A.value,f[0]),f[0]instanceof ft&&f[0].format===null&&A.typeInfo instanceof lh&&A.typeInfo.format!==null&&(A.typeInfo.format.name==="f16"?f[0].format=Ut.f16:A.typeInfo.format.name==="f32"?f[0].format=Ut.f32:A.typeInfo.format.name==="i32"?f[0].format=Ut.i32:A.typeInfo.format.name==="u32"?f[0].format=Ut.u32:A.typeInfo.format.name==="bool"?f[0].format=Ut.bool:console.error(`TODO: impelement template format type ${A.typeInfo.format.name}`)),s=this._updateNode(new ws(A,f[0])),this._exec.context.setVariable(t.toString(),A)}catch{s=o}if(i!==null&&s instanceof ws){if(s.type.name!=="x32"&&i.getTypeName()!==s.t
109ype.getTypeName())throw this._error(this._peek(),`Invalid cast from ${s.type.name} to ${i.name}. Line:${this._currentLine}`);s.type=i,s.isScalar&&this._validateTypeRange(s.scalarValue,s.type)}else i===null&&s instanceof ws&&(i=(e=s?.type)!==null&&e!==void 0?e:Ut.f32,i===Ut.x32&&(i=Ut.i32));const c=this._updateNode(new L0(t.toString(),i,"","",s),n);return this._context.constants.set(c.name,c),c}_global_let_decl(){if(!this._match(De.keywords.let))return null;const e=this._currentLine,t=this._consume(De.tokens.name,"Expected variable name");let n=null;if(this._match(De.tokens.colon)){const s=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=s)}let i=null;if(this._match(De.tokens.equal)&&(i=this._const_expression()),n!==null&&i instanceof ws){if(i.type.name!=="x32"&&n.getTypeName()!==i.type.getTypeName())throw this._error(this._peek(),`Invalid cast from ${i.type.name} to ${n.name}. Line:${this._currentLine}`);i.type=n}else n===null&&i instanceof ws&&(n=i.type.name==="x32"?Ut.i32:i.type);return i instanceof ws&&i.isScalar&&this._validateTypeRange(i.scalarValue,n),this._updateNode(new tg(t.toString(),n,"","",i),e)}_const_expression(){return this._short_circuit_or_expression()}_variable_decl(){if(!this._match(De.keywords.var))return null;const e=this._currentLine;let t="",n="";this._match(De.tokens.less_than)&&(t=this._consume(De.storage_class,"Expected storage_class.").toString(),this._match(De.tokens.comma)&&(n=this._consume(De.access_mode,"Expected access_mode.").toString()),this._consume(De.tokens.greater_than,"Expected '>'."));const i=this._consume(De.tokens.name,"Expected variable name");let s=null;if(this._match(De.tokens.colon)){const o=this._attribute();s=this._type_decl(),s!=null&&(s.attributes=o)}return this._updateNode(new Jl(i.toString(),s,t,n,null),e)}_override_decl(){if(!this._match(De.keywords.override))return null;const e=this._consume(De.tokens.name,"Expected variable name");let t=null;if(this._match(De.tokens.colon)){const n=this._attribute();t=this._type_decl(),t!=null&&(t.attributes=n)}return this._updateNode(new cw(e.toString(),t,null))}_diagnostic(){this._consume(De.tokens.paren_left,"Expected '('");const e=this._consume(De.tokens.ident,"Expected severity control name.");this._consume(De.tokens.comma,"Expected ','");let t=this._consume(De.tokens.ident,"Expected diagnostic rule name.").toString();return this._match(De.tokens.period)&&(t+=`.${this._consume(De.tokens.ident,"Expected diagnostic message.").toString()}`),this._consume(De.tokens.paren_right,"Expected ')'"),this._updateNode(new r4(e.toString(),t))}_enable_directive(){const e=this._consume(De.tokens.ident,"identity expected.");return this._updateNode(new X7(e.toString()))}_requires_directive(){const e=[this._consume(De.tokens.ident,"identity expected.").toString()];for(;this._match(De.tokens.comma);){const t=this._consume(De.tokens.ident,"identity expected.");e.push(t.toString())}return this._updateNode(new K7(e))}_type_alias(){const e=this._consume(De.tokens.ident,"identity expected.");this._consume(De.tokens.equal,"Expected '=' for type alias.");let t=this._type_decl();if(t===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(t.name)&&(t=this._context.aliases.get(t.name).type);const n=this._updateNode(new uw(e.toString(),t));return this._context.aliases.set(n.name,n),n}_type_decl(){if(this._check([De.tokens.ident,...De.texel_format,De.keywords.bool,De.keywords.f32,De.keywords.i32,De.keywords.u32])){const n=this._advance().toString();if(this._context.structs.has(n))return this._context.structs.get(n);if(this._context.aliases.has(n))return this._context.aliases.get(n).type;if(!this._getType(n)){const i=this._updateNode(new uS(n));return this._forwardTypeCount++,i}return this._updateNode(new Ut(n))}let e=this._texture_sampler_types();if(e)return e;if(this._check(De.template_types)){let n=this._advance().toString(),i=null,s=null;return this._match(De.tokens.less_than)&&(i=this._type_decl(),s=null,this._match(De.tokens.comma)&&(s=this._consume(De.access_mode,"Expected access_mode for pointer").toString()),this._consume(De.tokens.greater_than,"Expected '>' for type.")),this._updateNode(new ft(n,i,s))}if(this._match(De.keywords.ptr)){let n=this._previous().toString();this._consume(De.tokens.less_than,"Expected '<' for pointer.");const i=this._consume(De.storage_class,"Expected storage_class for pointer");this._consume(De.tokens.comma,"Expected ',' for pointer.");const s=this._type_decl();let o=null;return this._match(De.tokens.comma)&&(o=this._consume(De.access_mode,"Expected access_mode for pointer").toString()),this._consume(De.tokens.greater_than,"Expected '>' for pointer."),this._updateNode(new k0(n,i.toString(),s,o))}const t=this._attribute();if(this._match(De.keywords.array)){let n=null,i=-1;const s=this._previous();let o=null;if(this._match(De.tokens.less_than)){n=this._type_decl(),this._context.aliases.has(n.name)&&(n=this._context.aliases.get(n.name).type);let f="";if(this._match(De.tokens.comma)){o=this._shift_expression();try{f=o.constEvaluate(this._exec).toString(),o=null}catch{f="1"}}this._consume(De.tokens.greater_than,"Expected '>' for array."),i=f?parseInt(f):0}const c=this._updateNode(new rg(s.toString(),t,n,i));return o&&this._deferArrayCountEval.push({arrayType:c,countNode:o}),c}return null}_texture_sampler_types(){if(this._match(De.sampler_type))return this._updateNode(new jA(this._previous().toString(),null,null));if(this._match(De.depth_texture_type))return this._updateNode(new jA(this._previous().toString(),null,null));if(this._match(De.sampled_texture_type)||this._match(De.multisampled_texture_type)){const e=this._previous();this._consume(De.tokens.less_than,"Expected '<' for sampler type.");const t=this._type_decl();return this._consume(De.tokens.greater_than,"Expected '>' for sampler type."),this._updateNode(new jA(e.toString(),t,null))}if(this._match(De.storage_texture_type)){const e=this._previous();this._consume(De.tokens.less_than,"Expected '<' for sampler type.");const t=this._consume(De.texel_format,"Invalid texel format.").toString();this._consume(De.tokens.comma,"Expected ',' after texel format.");const n=this._consume(De.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(De.tokens.greater_than,"Expected '>' for sampler type."),this._updateNode(new jA(e.toString(),t,n))}return null}_attribute(){let e=[];for(;this._match(De.tokens.attr);){const t=this._consume(De.attribute_name,"Expected attribute name"),n=this._updateNode(new f4(t.toString(),null));if(this._match(De.tokens.paren_left)){if(n.value=this._consume(De.literal_or_ident,"Expected attribute value").toString(),this._check(De.tokens.comma)){this._advance();do{const i=this._consume(De.literal_or_ident,"Expected attribute value").toString();n.value instanceof Array||(n.value=[n.value]),n.value.push(i)}while(this._match(De.tokens.comma))}this._consume(De.tokens.paren_right,"Expected ')'")}e.push(n)}return e.length==0?null:e}}class fH extends cl{constructor(e){super(),e&&this.update(e)}update(e){const t=new uH().parse(e);this.updateAST(t)}}function hH(r){const e={attributes:[],bindings:[]};let t;try{t=dH(r)}catch(s){return Zt.error(s.message)(),e}for(const s of t.uniforms){const o=[];for(const c of s.type?.members||[])o.push({name:c.name,type:AS(c.type)});e.bindings.push({type:"uniform",name:s.name,group:s.group,location:s.binding,members:o})}for(const s of t.textures)e.bindings.push({type:"texture",name:s.name,group:s.group,location:s.binding});for(const s of t.samplers)e.bindings.push({type:"sampler",name:s.name,group:s.group,location:s.binding});const n=t.entry.vertex[0],i=n?.inputs.length||0;for(let s=0;s<i;s++){const o=n.inputs[s];if(o.locationType==="location"){const c=AS(o.type);e.attributes.push({name:o.name,location:Number(o.location),type:c})}}return e}function AS(r){return r.format?`${r.name}<${r.format.name}>`:r.name}function dH(r){try{return new fH(r)}catch(e){if(e instanceof Error)throw e;let t="WGSL parse error";throw typeof e=="object"&&e?.message&&(t+=`: ${e.message} `),typeof e=="object"&&e?.token&&(t+=e.token.line||""),new Error(t,{cause:e})}}const pH=1/Math.PI*180,AH=1/180*Math.PI,gH={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...gH}};const Ts=globalThis.mathgl.config;function mH(r,{precision:e=Ts.precision}={}){return r=bH(r),`${parseFloat(r.toPrecision(e))}`}function Zu(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function _H(r){return vH(r)}function yH(r){return Ac(r)}function vH(r,e){return gw(r,t=>t*AH,e)}function Ac(r,e){return gw(r,t=>t*pH,e)}function Kl(r,e,t){return gw(r,n=>Math.max(e,Math.min(t,n)))}function Cc(r,e,t){return Zu(r)?r.map((n,i)=>Cc(n,e[i],t)):t*e+(1-t)*r}function ma(r,e,t){const n=Ts.EPSILON;t&&(Ts.EPSILON=t);try{if(r===e)return!0;
vendor: 34,275 bytes, line 109
109if(Zu(r)&&Zu(e)){if(r.length!==e.length)return!1;for(let i=0;i<r.length;++i)if(!ma(r[i],e[i]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=Ts.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{Ts.EPSILON=n}}function bH(r){return Math.round(r/Ts.EPSILON)*Ts.EPSILON}function xH(r){return r.clone?r.clone():new Array(r.length)}function gw(r,e,t){if(Zu(r)){const n=r;t=t||xH(n);for(let i=0;i<t.length&&i<n.length;++i){const s=typeof r=="number"?r:r[i];t[i]=e(s,i,t)}return t}return e(r)}class mw extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+t];return this.check()}toArray(e=[],t=0){for(let n=0;n<this.ELEMENTS;++n)e[t+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Zu(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Ts)}formatString(e){let t="";for(let n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+mH(this[n],e);return`${e.printTypes?this.constructor.name:""}[${t}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!ma(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,n){if(n===void 0)return this.lerp(this,e,t);for(let i=0;i<this.ELEMENTS;++i){const s=e[i],o=typeof t=="number"?t:t[i];this[i]=s+n*(o-s)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),t[n]);return this.check()}add(...e){for(const t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n];return this.check()}subtract(...e){for(const t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=t[n];return this.check()}scale(e){if(typeof e=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(Ts.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 t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),t);return this.check()}get elements(){return this}}function wH(r,e){if(r.length!==e)return!1;for(let t=0;t<r.length;++t)if(!Number.isFinite(r[t]))return!1;return!0}function qn(r){if(!Number.isFinite(r))throw new Error(`Invalid number ${JSON.stringify(r)}`);return r}function ng(r,e,t=""){if(Ts.debug&&!wH(r,e))throw new Error(`math.gl: ${t} some fields set to invalid numbers'`);return r}function mc(r,e){if(!r)throw new Error(`math.gl assertion ${e}`)}class _w extends mw{get x(){return this[0]}set x(e){this[0]=qn(e)}get y(){return this[1]}set y(e){this[1]=qn(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let n=0;n<this.ELEMENTS;++n){const i=this[n]-e[n];t+=i*i}return qn(t)}dot(e){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return qn(t)}normalize(){const e=this.magnitude();if(e!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=t[n];return this.check()}divide(...e){for(const t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return mc(e>=0&&e<this.ELEMENTS,"index is out of range"),qn(this[e])}setComponent(e,t){return mc(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}const ig=1e-6;let Ec=typeof Float32Array<"u"?Float32Array:Array;function CH(){const r=new Ec(2);return Ec!=Float32Array&&(r[0]=0,r[1]=0),r}function gS(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function TH(r,e){return r[0]=-e[0],r[1]=-e[1],r}function h4(r,e,t,n){const i=e[0],s=e[1];return r[0]=i+n*(t[0]-i),r[1]=s+n*(t[1]-s),r}function EH(r,e,t){const n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r}function BH(r,e,t){const n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i+t[4],r[1]=t[1]*n+t[3]*i+t[5],r}function d4(r,e,t){const n=e[0],i=e[1];return r[0]=t[0]*n+t[3]*i+t[6],r[1]=t[1]*n+t[4]*i+t[7],r}function p4(r,e,t){const n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r}(function(){const r=CH();return function(e,t,n,i,s,o){let c,f;for(t||(t=2),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,c=n;c<f;c+=t)r[0]=e[c],r[1]=e[c+1],s(r,r,o),e[c]=r[0],e[c+1]=r[1];return e}})();function A4(r,e,t){const n=e[0],i=e[1],s=t[3]*n+t[7]*i||1;return r[0]=(t[0]*n+t[4]*i)/s,r[1]=(t[1]*n+t[5]*i)/s,r}function g4(r,e,t){const n=e[0],i=e[1],s=e[2],o=t[3]*n+t[7]*i+t[11]*s||1;return r[0]=(t[0]*n+t[4]*i+t[8]*s)/o,r[1]=(t[1]*n+t[5]*i+t[9]*s)/o,r[2]=(t[2]*n+t[6]*i+t[10]*s)/o,r}function SH(r,e,t){const n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r[2]=e[2],r}function IH(r,e,t){const n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r[2]=e[2],r[3]=e[3],r}function m4(r,e,t){const n=e[0],i=e[1],s=e[2];return r[0]=t[0]*n+t[3]*i+t[6]*s,r[1]=t[1]*n+t[4]*i+t[7]*s,r[2]=t[2]*n+t[5]*i+t[8]*s,r[3]=e[3],r}class yw extends _w{constructor(e=0,t=0){super(2),Zu(e)&&arguments.length===1?this.copy(e):(Ts.debug&&(qn(e),qn(t)),this[0]=e,this[1]=t)}set(e,t){return this[0]=e,this[1]=t,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return Ts.debug&&(qn(e.x),qn(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 p4(this,this,e),this.check()}transformAsVector(e){return A4(this,this,e),this.check()}transformByMatrix3(e){return d4(this,this,e),this.check()}transformByMatrix2x3(e){return BH(this,this,e),this.check()}transformByMatrix2(e){return EH(this,this,e),this.check()}}function _4(){const r=new Ec(3);return Ec!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function y4(r){const e=r[0],t=r[1],n=r[2];return Math.sqrt(e*e+t*t+n*n)}function mS(r,e,t){const n=new Ec(3);return n[0]=r,n[1]=e,n[2]=t,n}function MH(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function PH(r){const e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function RH(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function FH(r,e){const t=e[0],n=e[1],i=e[2];let s=t*t+n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r}function vw(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function U0(r,e,t){const n=e[0],i=e[1],s=e[2],o=t[0],c=t[1],f=t[2];return r[0]=i*f-s*c,r[1]=s*o-n*f,r[2]=n*c-i*o,r}function DH(r,e,t,n){const i=e[0],s=e[1],o=e[2];return r[0]=i+n*(t[0]-i),r[1]=s+n*(t[1]-s),r[2]=o+n*(t[2]-o),r}function bw(r,e,t){const n=e[0],i=e[1],s=e[2];let o=t[3]*n+t[7]*i+t[11]*s+t[15];return o=o||1,r[0]=(t[0]*n+t[4]*i+t[8]*s+t[12])/o,r[1]=(t[1]*n+t[5]*i+t[9]*s+t[13])/o,r[2]=(t[2]*n+t[6]*i+t[10]*s+t[14])/o,r}function v4(r,e,t){const n=e[0],i=e[1],s=e[2];return r[0]=n*t[0]+i*t[3]+s*t[6],r[1]=n*t[1]+i*t[4]+s*t[7],r[2]=n*t[2]+i*t[5]+s*t[8],r}function b4(r,e,t){const n=t[0],i=t[1],s=t[2],o=t[3],c=e[0],f=e[1],A=e[2];let v=i*A-s*f,w=s*c-n*A,S=n*f-i*c,F=i*S-s*w,N=s*v-n*S,U=n*w-i*v;const $=o*2;return v*=$,w*=$,S*=$,F*=2,N*=2,U*=2,r[0]=c+v+F,r[1]=f+w+N,r[2]=A+S+U,r}function OH(r,e,t,n){const i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[0],s[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),s[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function LH(r,e,t,n){const i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),s[1]=i[1],s[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function kH(r,e,t,n){const i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),s[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),s[2]=i[2],r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function NH(r,e){const t=r[0],n=r[1],i=r[2],s=e[0],o=e[1],c=e[2],f=Math.sqrt((t*t+n*n+i*i)*(s*s+o*o+c*c)),A=f&&vw(r,e)/f;return Math.acos(Math.min(Math.max(A,-1),1))}const x4=MH,w4=y4,Zv=PH;(function(){const r=_4();return function(e,t,n,i,s,o){let c,f;for(t||(t=3),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,c=n;c<f;c+=t)r[0]=e[c],r[1]=e[c+1],r[2]=e[c+2],s(r,r,o),e[c]=r[0],e[c+1]=r[1],e[c+2]=r[2];return e}})();const Qv=[0,0,0];let Gm;class dt extends _w{static get ZERO(){return Gm||(Gm=new dt(0,0,0),Object.freeze(Gm)),Gm}constructor(e=0,t=0,n=0){super(-0,-0,-0),arguments.length===1&&Zu(e)?this.copy(e):(Ts.debug&&(qn(e),qn(t),qn(n)),this[0]=e,this[1]=t,this[2]=n)}set(e,t,n){return this[0]=e,this[1]=t,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Ts.debug&&(qn(e.x),qn(e.y),qn(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]=qn(e)}angle(e){return NH(this,e)}cross(e){return U0(this,this,e),this.check()}rotateX({radians:e,origin:t=Qv}){return OH(this,this,t,e),this.check()}rotateY({radians:e,origin:t=Qv}){return LH(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=Qv}){return kH(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return bw(this,this,e),this.check()}transformAsVector(e){return g4(this,this,e),this.check()}transformByMatrix3(e){return v4(this,this,e),this.check()}transformByMatrix2(e){return SH(this,this,e),this.check()}transformByQuaternion(e){return b4(this,this,e),this.check()}}let Vm;class xw extends _w{static get ZERO(){return Vm||(Vm=new xw(0,0,0,0),Object.freeze(Vm)),Vm}constructor(e=0,t=0,n=0,i=0){super(-0,-0,-0,-0),Zu(e)&&arguments.length===1?this.copy(e):(Ts.debug&&(qn(e),qn(t),qn(n),qn(i)),this[0]=e,this[1]=t,this[2]=n,this[3]=i)}set(e,t,n,i){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,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 Ts.debug&&(qn(e.x),qn(e.y),qn(e.z),qn(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]=qn(e)}get w(){return this[3]}set w(e){this[3]=qn(e)}transform(e){return bw(this,this,e),this.check()}transformByMatrix3(e){return m4(this,this,e),this.check()}transformByMatrix2(e){return IH(this,this,e),this.check()}transformByQuaternion(e){return b4(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}class C4 extends mw{toString(){let e="[";if(Ts.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+t]}`}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=` ${this[t]}`}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,n){return this[t*this.RANK+e]=qn(n),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const n=e*this.RANK;for(let i=0;i<this.RANK;++i)t[i]=this[n+i];return t}setColumn(e,t){const n=e*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=t[i];return this}}function UH(){const r=new Ec(9);return Ec!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function zH(r,e){if(r===e){const t=e[1],n=e[2],i=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=i}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function GH(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],f=e[6],A=e[7],v=e[8],w=v*o-c*A,S=-v*s+c*f,F=A*s-o*f;let N=t*w+n*S+i*F;return N?(N=1/N,r[0]=w*N,r[1]=(-v*n+i*A)*N,r[2]=(c*n-i*o)*N,r[3]=S*N,r[4]=(v*t-i*f)*N,r[5]=(-c*t+i*s)*N,r[6]=F*N,r[7]=(-A*t+n*f)*N,r[8]=(o*t-n*s)*N,r):null}function VH(r){const e=r[0],t=r[1],n=r[2],i=r[3],s=r[4],o=r[5],c=r[6],f=r[7],A=r[8];return e*(A*s-o*f)+t*(-A*i+o*c)+n*(f*i-s*c)}function _S(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],c=e[4],f=e[5],A=e[6],v=e[7],w=e[8],S=t[0],F=t[1],N=t[2],U=t[3],$=t[4],G=t[5],H=t[6],J=t[7],ue=t[8];return r[0]=S*n+F*o+N*A,r[1]=S*i+F*c+N*v,r[2]=S*s+F*f+N*w,r[3]=U*n+$*o+G*A,r[4]=U*i+$*c+G*v,r[5]=U*s+$*f+G*w,r[6]=H*n+J*o+ue*A,r[7]=H*i+J*c+ue*v,r[8]=H*s+J*f+ue*w,r}function HH(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],c=e[4],f=e[5],A=e[6],v=e[7],w=e[8],S=t[0],F=t[1];return r[0]=n,r[1]=i,r[2]=s,r[3]=o,r[4]=c,r[5]=f,r[6]=S*n+F*o+A,r[7]=S*i+F*c+v,r[8]=S*s+F*f+w,r}function jH(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],c=e[4],f=e[5],A=e[6],v=e[7],w=e[8],S=Math.sin(t),F=Math.cos(t);return r[0]=F*n+S*o,r[1]=F*i+S*c,r[2]=F*s+S*f,r[3]=F*o-S*n,r[4]=F*c-S*i,r[5]=F*f-S*s,r[6]=A,r[7]=v,r[8]=w,r}function yS(r,e,t){const n=t[0],i=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=i*e[3],r[4]=i*e[4],r[5]=i*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function $H(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=t+t,c=n+n,f=i+i,A=t*o,v=n*o,w=n*c,S=i*o,F=i*c,N=i*f,U=s*o,$=s*c,G=s*f;return r[0]=1-w-N,r[3]=v-G,r[6]=S+$,r[1]=v+G,r[4]=1-A-N,r[7]=F-U,r[2]=S-$,r[5]=F+U,r[8]=1-A-w,r}var A2;(function(r){r[r.COL0ROW0=0]="COL0ROW0",r[r.COL0ROW1=1]="COL0ROW1",r[r.COL0ROW2=2]="COL0ROW2",r[r.COL1ROW0=3]="COL1ROW0",r[r.COL1ROW1=4]="COL1ROW1",r[r.COL1ROW2=5]="COL1ROW2",r[r.COL2ROW0=6]="COL2ROW0",r[r.COL2ROW1=7]="COL2ROW1",r[r.COL2ROW2=8]="COL2ROW2"})(A2||(A2={}));const WH=Object.freeze([1,0,0,0,1,0,0,0,1]);class gi extends C4{static get IDENTITY(){return XH()}static get ZERO(){return JH()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return A2}constructor(e,...t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):t.length>0?this.copy([e,...t]):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(WH)}fromObject(e){return this.check()}fromQuaternion(e){return $H(this,e),this.check()}set(e,t,n,i,s,o,c,f,A){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=s,this[5]=o,this[6]=c,this[7]=f,this[8]=A,this.check()}setRowMajor(e,t,n,i,s,o,c,f,A){return this[0]=e,this[1]=i,this[2]=c,this[3]=t,this[4]=s,this[5]=f,this[6]=n,this[7]=o,this[8]=A,this.check()}determinant(){return VH(this)}transpose(){return zH(this,this),this.check()}invert(){return GH(this,this),this.check()}multiplyLeft(e){return _S(this,e,this),this.check()}multiplyRight(e){return _S(this,this,e),this.check()}rotate(e){return jH(this,this,e),this.check()}scale(e){return Array.isArray(e)?yS(this,this,e):yS(this,this,[e,e]),this.check()}translate(e){return HH(this,this,e),this.check()}transform(e,t){let n;switch(e.length){case 2:n=d4(t||[-0,-0],e,this);break;case 3:n=v4(t||[-0,-0,-0],e,this);break;case 4:n=m4(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ng(n,e.length),n}transformVector(e,t){return this.transform(e,t)}transformVector2(e,t){return this.transform(e,t)}transformVector3(e,t){return this.transform(e,t)}}let Hm,jm=null;function JH(){return Hm||(Hm=new gi([0,0,0,0,0,0,0,0,0]),Object.freeze(Hm)),Hm}function XH(){return jm||(jm=new gi,Object.freeze(jm)),jm}function KH(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function qH(r,e){if(r===e){const t=e[1],n=e[2],i=e[3],s=e[6],o=e[7],c=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=s,r[11]=e[14],r[12]=i,r[13]=o,r[14]=c}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function g2(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],f=e[6],A=e[7],v=e[8],w=e[9],S=e[10],F=e[11],N=e[12],U=e[13],$=e[14],G=e[15],H=t*c-n*o,J=t*f-i*o,ue=t*A-s*o,q=n*f-i*c,se=n*A-s*c,Te=i*A-s*f,Ue=v*U-w*N,de=v*$-S*N,me=v*G-F*N,pe=w*$-S*U,W=w*G-F*U,re=S*G-F*$;let Ee=H*re-J*W+ue*pe+q*me-se*de+Te*Ue;return Ee?(Ee=1/Ee,r[0]=(c*re-f*W+A*pe)*Ee,r[1]=(i*W-n*re-s*pe)*Ee,r[2]=(U*Te-$*se+G*q)*Ee,r[3]=(S*se-w*Te-F*q)*Ee,r[4]=(f*me-o*re-A*de)*Ee,r[5]=(t*re-i*me+s*de)*Ee,r[6]=($*ue-N*Te-G*J)*Ee,r[7]=(v*Te-S*ue+F*J)*Ee,r[8]=(o*W-c*me+A*Ue)*Ee,r[9]=(n*me-t*W-s*Ue)*Ee,r[10]=(N*se-U*ue+G*H)*Ee,r[11]=(w*ue-v*se-F*H)*Ee,r[12]=(c*de-o*pe-f*Ue)*Ee,r[13]=(t*pe-n*de+i*Ue)*Ee,r[14]=(U*J-N*q-$*H)*Ee,r[15]=(v*q-w*J+S*H)*Ee,r):null}function YH(r){const e=r[0],t=r[1],n=r[2],i=r[3],s=r[4],o=r[5],c=r[6],f=r[7],A=r[8],v=r[9],w=r[10],S=r[11],F=r[12],N=r[13],U=r[14],$=r[15],G=e*o-t*s,H=e*c-n*s,J=t*c-n*o,ue=A*N-v*F,q=A*U-w*F,se=v*U-w*N,Te=e*se-t*q+n*ue,Ue=s*se-o*q+c*ue,de=A*J-v*H+w*G,me=F*J-N*H+U*G;return f*Te-i*Ue+$*de-S*me}function nh(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],c=e[4],f=e[5],A=e[6],v=e[7],w=e[8],S=e[9],F=e[10],N=e[11],U=e[12],$=e[13],G=e[14],H=e[15];let J=t[0],ue=t[1],q=t[2],se=t[3];return r[0]=J*n+ue*c+q*w+se*U,r[1]=J*i+ue*f+q*S+se*$,r[2]=J*s+ue*A+q*F+se*G,r[3]=J*o+ue*v+q*N+se*H,J=t[4],ue=t[5],q=t[6],se=t[7],r[4]=J*n+ue*c+q*w+se*U,r[5]=J*i+ue*f+q*S+se*$,r[6]=J*s+ue*A+q*F+se*G,r[7]=J*o+ue*v+q*N+se*H,J=t[8],ue=t[9],q=t[10],se=t[11],r[8]=J*n+ue*c+q*w+se*U,r[9]=J*i+ue*f+q*S+se*$,r[10]=J*s+ue*A+q*F+se*G,r[11]=J*o+ue*v+q*N+se*H,J=t[12],ue=t[13],q=t[14],se=t[15],r[12]=J*n+ue*c+q*w+se*U,r[13]=J*i+ue*f+q*S+se*$,r[14]=J*s+ue*A+q*F+se*G,r[15]=J*o+ue*v+q*N+se*H,r}function x_(r,e,t){const n=t[0],i=t[1],s=t[2];let o,c,f,A,v,w,S,F,N,U,$,G;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*s+e[12],r[13]=e[1]*n+e[5]*i+e[9]*s+e[13],r[14]=e[2]*n+e[6]*i+e[10]*s+e[14],r[15]=e[3]*n+e[7]*i+e[11]*s+e[15]):(o=e[0],c=e[1],f=e[2],A=e[3],v=e[4],w=e[5],S=e[6],F=e[7],N=e[8],U=e[9],$=e[10],G=e[11],r[0]=o,r[1]=c,r[2]=f,r[3]=A,r[4]=v,r[5]=w,r[6]=S,r[7]=F,r[8]=N,r[9]=U,r[10]=$,r[11]=G,r[12]=o*n+v*i+N*s+e[12],r[13]=c*n+w*i+U*s+e[13],r[14]=f*n+S*i+$*s+e[14],r[15]=A*n+F*i+G*s+e[15]),r}function ww(r,e,t){const n=t[0],i=t[1],s=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*i,r[6]=e[6]*i,r[7]=e[7]*i,r[8]=e[8]*s,r[9]=e[9]*s,r[10]=e[10]*s,r[11]=e[11]*s,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function ZH(r,e,t,n){let i=n[0],s=n[1],o=n[2],c=Math.sqrt(i*i+s*s+o*o),f,A,v,w,S,F,N,U,$,G,H,J,ue,q,se,Te,Ue,de,me,pe,W,re,Ee,et;return c<ig?null:(c=1/c,i*=c,s*=c,o*=c,A=Math.sin(t),f=Math.cos(t),v=1-f,w=e[0],S=e[1],F=e[2],N=e[3],U=e[4],$=e[5],G=e[6],H=e[7],J=e[8],ue=e[9],q=e[10],se=e[11],Te=i*i*v+f,Ue=s*i*v+o*A,de=o*i*v-s*A,me=i*s*v-o*A,pe=s*s*v+f,W=o*s*v+i*A,re=i*o*v+s*A,Ee=s*o*v-i*A,et=o*o*v+f,r[0]=w*Te+U*Ue+J*de,r[1]=S*Te+$*Ue+ue*de,r[2]=F*Te+G*Ue+q*de,r[3]=N*Te+H*Ue+se*de,r[4]=w*me+U*pe+J*W,r[5]=S*me+$*pe+ue*W,r[6]=F*me+G*pe+q*W,r[7]=N*me+H*pe+se*W,r[8]=w*re+U*Ee+J*et,r[9]=S*re+$*Ee+ue*et,r[10]=F*re+G*Ee+q*et,r[11]=N*re+H*Ee+se*et,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function T4(r,e,t){const n=Math.sin(t),i=Math.cos(t),s=e[4],o=e[5],c=e[6],f=e[7],A=e[8],v=e[9],w=e[10],S=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=s*i+A*n,r[5]=o*i+v*n,r[6]=c*i+w*n,r[7]=f*i+S*n,r[8]=A*i-s*n,r[9]=v*i-o*n,r[10]=w*i-c*n,r[11]=S*i-f*n,r}function QH(r,e,t){const n=Math.sin(t),i=Math.cos(t),s=e[0],o=e[1],c=e[2],f=e[3],A=e[8],v=e[9],w=e[10],S=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=s*i-A*n,r[1]=o*i-v*n,r[2]=c*i-w*n,r[3]=f*i-S*n,r[8]=s*n+A*i,r[9]=o*n+v*i,r[10]=c*n+w*i,r[11]=f*n+S*i,r}function E4(r,e,t){const n=Math.sin(t),i=Math.cos(t),s=e[0],o=e[1],c=e[2],f=e[3],A=e[4],v=e[5],w=e[6],S=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=s*i+A*n,r[1]=o*i+v*n,r[2]=c*i+w*n,r[3]=f*i+S*n,r[4]=A*i-s*n,r[5]=v*i-o*n,r[6]=w*i-c*n,r[7]=S*i-f*n,r}function ej(r,e){const t=e[0],n=e[1],i=e[2],s=e[4],o=e[5],c=e[6],f=e[8],A=e[9],v=e[10];return r[0]=Math.sqrt(t*t+n*n+i*i),r[1]=Math.sqrt(s*s+o*o+c*c),r[2]=Math.sqrt(f*f+A*A+v*v),r}function tj(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=t+t,c=n+n,f=i+i,A=t*o,v=n*o,w=n*c,S=i*o,F=i*c,N=i*f,U=s*o,$=s*c,G=s*f;return r[0]=1-w-N,r[1]=v+G,r[2]=S-$,r[3]=0,r[4]=v-G,r[5]=1-A-N,r[6]=F+U,r[7]=0,r[8]=S+$,r[9]=F-U,r[10]=1-A-w,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function rj(r,e,t,n,i,s,o){const c=1/(t-e),f=1/(i-n),A=1/(s-o);return r[0]=s*2*c,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=s*2*f,r[6]=0,r[7]=0,r[8]=(t+e)*c,r[9]=(i+n)*f,r[10]=(o+s)*A,r[11]=-1,r[12]=0,r[13]=0,r[14]=o*s*2*A,r[15]=0,r}function nj(r,e,t,n,i){const s=1/Math.tan(e/2);if(r[0]=s/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=s,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0){const o=1/(n-i);r[10]=(i+n)*o,r[14]=2*i*n*o}else r[10]=-1,r[14]=-2*n;return r}const ij=nj;function sj(r,e,t,n,i,s,o){const c=1/(e-t),f=1/(n-i),A=1/(s-o);return r[0]=-2*c,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*f,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*A,r[11]=0,r[12]=(e+t)*c,r[13]=(i+n)*f,r[14]=(o+s)*A,r[15]=1,r}const oj=sj;function aj(r,e,t,n){let i,s,o,c,f,A,v,w,S,F;const N=e[0],U=e[1],$=e[2],G=n[0],H=n[1],J=n[2],ue=t[0],q=t[1],se=t[2];return Math.abs(N-ue)<ig&&Math.abs(U-q)<ig&&Math.abs($-se)<ig?KH(r):(w=N-ue,S=U-q,F=$-se,i=1/Math.sqrt(w*w+S*S+F*F),w*=i,S*=i,F*=i,s=H*F-J*S,o=J*w-G*F,c=G*S-H*w,i=Math.sqrt(s*s+o*o+c*c),i?(i=1/i,s*=i,o*=i,c*=i):(s=0,o=0,c=0),f=S*c-F*o,A=F*s-w*c,v=w*o-S*s,i=Math.sqrt(f*f+A*A+v*v),i?(i=1/i,f*=i,A*=i,v*=i):(f=0,A=0,v=0),r[0]=s,r[1]=f,r[2]=w,r[3]=0,r[4]=o,r[5]=A,r[6]=S,r[7]=0,r[8]=c,r[9]=v,r[10]=F,r[11]=0,r[12]=-(s*N+o*U+c*$),r[13]=-(f*N+A*U+v*$),r[14]=-(w*N+S*U+F*$),r[15]=1,r)}function cj(){const r=new Ec(4);return Ec!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function lj(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function Cw(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function uj(r){const e=r[0],t=r[1],n=r[2],i=r[3];return Math.sqrt(e*e+t*t+n*n+i*i)}function fj(r){const e=r[0],t=r[1],n=r[2],i=r[3];return e*e+t*t+n*n+i*i}function hj(r,e){const t=e[0],n=e[1],i=e[2],s=e[3];let o=t*t+n*n+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),r[0]=t*o,r[1]=n*o,r[2]=i*o,r[3]=s*o,r}function dj(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function pj(r,e,t,n){const i=e[0],s=e[1],o=e[2],c=e[3];return r[0]=i+n*(t[0]-i),r[1]=s+n*(t[1]-s),r[2]=o+n*(t[2]-o),r[3]=c+n*(t[3]-c),r}function jp(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*s+t[12]*o,r[1]=t[1]*n+t[5]*i+t[9]*s+t[13]*o,r[2]=t[2]*n+t[6]*i+t[10]*s+t[14]*o,r[3]=t[3]*n+t[7]*i+t[11]*s+t[15]*o,r}function Aj(r,e,t){const n=e[0],i=e[1],s=e[2],o=t[0],c=t[1],f=t[2],A=t[3],v=A*n+c*s-f*i,w=A*i+f*n-o*s,S=A*s+o*i-c*n,F=-o*n-c*i-f*s;return r[0]=v*A+F*-o+w*-f-S*-c,r[1]=w*A+F*-c+S*-o-v*-f,r[2]=S*A+F*-f+v*-c-w*-o,r[3]=e[3],r}(function(){const r=cj();return function(e,t,n,i,s,o){let c,f;for(t||(t=4),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,c=n;c<f;c+=t)r[0]=e[c],r[1]=e[c+1],r[2]=e[c+2],r[3]=e[c+3],s(r,r,o),e[c]=r[0],e[c+1]=r[1],e[c+2]=r[2],e[c+3]=r[3];return e}})();var m2;(function(r){r[r.COL0ROW0=0]="COL0ROW0",r[r.COL0ROW1=1]="COL0ROW1",r[r.COL0ROW2=2]="COL0ROW2",r[r.COL0ROW3=3]="COL0ROW3",r[r.COL1ROW0=4]="COL1ROW0",r[r.COL1ROW1=5]="COL1ROW1",r[r.COL1ROW2=6]="COL1ROW2",r[r.COL1ROW3=7]="COL1ROW3",r[r.COL2ROW0=8]="COL2ROW0",r[r.COL2ROW1=9]="COL2ROW1",r[r.COL2ROW2=10]="COL2ROW2",r[r.COL2ROW3=11]="COL2ROW3",r[r.COL3ROW0=12]="COL3ROW0",r[r.COL3ROW1=13]="COL3ROW1",r[r.COL3ROW2=14]="COL3ROW2",r[r.COL3ROW3=15]="COL3ROW3"})(m2||(m2={}));const gj=45*Math.PI/180,mj=1,eb=.1,tb=500,_j=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class vn extends C4{static get IDENTITY(){return vj()}static get ZERO(){return yj()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return m2}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,t,n,i,s,o,c,f,A,v,w,S,F,N,U,$){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=s,this[5]=o,this[6]=c,this[7]=f,this[8]=A,this[9]=v,this[10]=w,this[11]=S,this[12]=F,this[13]=N,this[14]=U,this[15]=$,this.check()}setRowMajor(e,t,n,i,s,o,c,f,A,v,w,S,F,N,U,$){return this[0]=e,this[1]=s,this[2]=A,this[3]=F,this[4]=t,this[5]=o,this[6]=v,this[7]=N,this[8]=n,this[9]=c,this[10]=w,this[11]=U,this[12]=i,this[13]=f,this[14]=S,this[15]=$,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(_j)}fromObject(e){return this.check()}fromQuaternion(e){return tj(this,e),this.check()}frustum(e){const{left:t,right:n,bottom:i,top:s,near:o=eb,far:c=tb}=e;return c===1/0?bj(this,t,n,i,s,o):rj(this,t,n,i,s,o,c),this.check()}lookAt(e){const{eye:t,center:n=[0,0,0],up:i=[0,1,0]}=e;return aj(this,t,n,i),this.check()}ortho(e){const{left:t,right:n,bottom:i,top:s,near:o=eb,far:c=tb}=e;return oj(this,t,n,i,s,o,c),this.check()}orthographic(e){const{fovy:t=gj,aspect:n=mj,focalDistance:i=1,near:s=eb,far:o=tb}=e;vS(t);const c=t/2,f=i*Math.tan(c),A=f*n;return this.ortho({left:-A,right:A,bottom:-f,top:f,near:s,far:o})}perspective(e){const{fovy:t=45*Math.PI/180,aspect:n=1,near:i=.1,far:s=500}=e;return vS(t),ij(this,t,n,i,s),this.check()}determinant(){return YH(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,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const n=this.getScale(t),i=1/n[0],s=1/n[1],o=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*s,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*s,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*s,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const n=this.getScale(t),i=1/n[0],s=1/n[1],o=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*s,e[2]=this[2]*o,e[3]=this[4]*i,e[4]=this[5]*s,e[5]=this[6]*o,e[6]=this[8]*i,e[7]=this[9]*s,e[8]=this[10]*o,e}transpose(){return qH(this,this),this.check()}invert(){return g2(this,this),this.check()}multiplyLeft(e){return nh(this,e,this),this.check()}multiplyRight(e){return nh(this,this,e),this.check()}rotateX(e){return T4(this,this,e),this.check()}rotateY(e){return QH(this,this,e),this.check()}rotateZ(e){return E4(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return ZH(this,this,e,t),this.check()}scale(e){return ww(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return x_(this,this,e),this.check()}transform(e,t){return e.length===4?(t=jp(t||[-0,-0,-0,-0],e,this),ng(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:n}=e;let i;switch(n){case 2:i=p4(t||[-0,-0],e,this);break;case 3:i=bw(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ng(i,e.length),i}transformAsVector(e,t){let n;switch(e.length){case 2:n=A4(t||[-0,-0],e,this);break;case 3:n=g4(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ng(n,e.length),n}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,n){return this.identity().translate([e,t,n])}}let $m,Wm;function yj(){return $m||($m=new vn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze($m)),$m}function vj(){return Wm||(Wm=new vn,Object.freeze(Wm)),Wm}function vS(r){if(r>Math.PI*2)throw Error("expected radians")}function bj(r,e,t,n,i,s){const o=2*s/(t-e),c=2*s/(i-n),f=(t+e)/(t-e),A=(i+n)/(i-n),v=-1,w=-1,S=-2*s;return r[0]=o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=f,r[9]=A,r[10]=v,r[11]=w,r[12]=0,r[13]=0,r[14]=S,r[15]=0,r}function bS(){const r=new Ec(4);return Ec!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function xj(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function B4(r,e,t){t=t*.5;const n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function xS(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],c=t[0],f=t[1],A=t[2],v=t[3];return r[0]=n*v+o*c+i*A-s*f,r[1]=i*v+o*f+s*c-n*A,r[2]=s*v+o*A+n*f-i*c,r[3]=o*v-n*c-i*f-s*A,r}function wj(r,e,t){t*=.5;const n=e[0],i=e[1],s=e[2],o=e[3],c=Math.sin(t),f=Math.cos(t);return r[0]=n*f+o*c,r[1]=i*f+s*c,r[2]=s*f-i*c,r[3]=o*f-n*c,r}function Cj(r,e,t){t*=.5;const n=e[0],i=e[1],s=e[2],o=e[3],c=Math.sin(t),f=Math.cos(t);return r[0]=n*f-s*c,r[1]=i*f+o*c,r[2]=s*f+n*c,r[3]=o*f-i*c,r}function Tj(r,e,t){t*=.5;const n=e[0],i=e[1],s=e[2],o=e[3],c=Math.sin(t),f=Math.cos(t);return r[0]=n*f+i*c,r[1]=i*f-n*c,r[2]=s*f+o*c,r[3]=o*f-s*c,r}function Ej(r,e){const t=e[0],n=e[1],i=e[2];return r[0]=t,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-i*i)),r}function z0(r,e,t,n){const i=e[0],s=e[1],o=e[2],c=e[3];let f=t[0],A=t[1],v=t[2],w=t[3],S,F,N,U,$;return S=i*f+s*A+o*v+c*w,S<0&&(S=-S,f=-f,A=-A,v=-v,w=-w),1-S>ig?(F=Math.acos(S),$=Math.sin(F),N=Math.sin((1-n)*F)/$,U=Math.sin(n*F)/$):(N=1-n,U=n),r[0]=N*i+U*f,r[1]=N*s+U*A,r[2]=N*o+U*v,r[3]=N*c+U*w,r}function Bj(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=t*t+n*n+i*i+s*s,c=o?1/o:0;return r[0]=-t*c,r[1]=-n*c,r[2]=-i*c,r[3]=s*c,r}function Sj(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function S4(r,e){const t=e[0]+e[4]+e[8];let n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{let i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);const s=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[s*3+s]-e[o*3+o]+1),r[i]=.5*n,n=.5/n,r[3]=(e[s*3+o]-e[o*3+s])*n,r[s]=(e[s*3+i]+e[i*3+s])*n,r[o]=(e[o*3+i]+e[i*3+o])*n}return r}const Ij=lj,Mj=Cw,Pj=dj,Rj=pj,Fj=uj,Dj=fj,I4=hj,Oj=function(){const r=_4(),e=mS(1,0,0),t=mS(0,1,0);return function(n,i,s){const o=vw(i,s);return o<-.999999?(U0(r,e,i),w4(r)<1e-6&&U0(r,t,i),FH(r,r),B4(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(U0(r,i,s),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,I4(n,n))}}();(function(){const r=bS(),e=bS();return function(t,n,i,s,o,c){return z0(r,n,o,c),z0(e,i,s,c),z0(t,r,e,2*c*(1-c)),t}})();(function(){const r=UH();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],I4(e,S4(e,r))}})();const Lj=[0,0,0,1];class vg extends mw{constructor(e=0,t=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,t,n,i)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,n,i){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,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 S4(this,e),this.check()}fromAxisRotation(e,t){return B4(this,e,t),this.check()}identity(){return xj(this),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=qn(e)}get y(){return this[1]}set y(e){this[1]=qn(e)}get z(){return this[2]}set z(e){this[2]=qn(e)}get w(){return this[3]}set w(e){this[3]=qn(e)}len(){return Fj(this)}lengthSquared(){return Dj(this)}dot(e){return Pj(this,e)}rotationTo(e,t){return Oj(this,e,t),this.check()}add(e){return Ij(this,this,e),this.check()}calculateW(){return Ej(this,this),this.check()}conjugate(){return Sj(this,this),this.check()}invert(){return Bj(this,this),this.check()}lerp(e,t,n){return n===void 0?this.lerp(this,e,t):(Rj(this,e,t,n),this.check())}multiplyRight(e){return xS(this,this,e),this.check()}multiplyLeft(e){return xS(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,e===0&&(this[3]=1),this.check()}rotateX(e){return wj(this,this,e),this.check()}rotateY(e){return Cj(this,this,e),this.check()}rotateZ(e){return Tj(this,this,e),this.check()}scale(e){return Mj(this,this,e),this.check()}slerp(e,t,n){let i,s,o;switch(arguments.length){case 1:({start:i=Lj,target:s,ratio:o}=e);break;case 2:i=this,s=e,o=t;break;default:i=e,s=t,o=n}return z0(this,i,s,o),this.check()}transformVector4(e,t=new xw){return Aj(t,e,this),ng(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}}const kj=.1,Nj=1e-12,M4=1e-15,Uj=1e-20;function P4(r,e=[],t=0){const n=Math.fround(r),i=r-n;
109return e[t]=n,e[t+1]=i,e}function zj(r){return r-Math.fround(r)}function Gj(r){const e=new Float32Array(32);for(let t=0;t<4;++t)for(let n=0;n<4;++n){const i=t*4+n;P4(r[n*4+t],e,i*2)}return e}const Vj=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
110
111// All these functions are for substituting tan() function from Intel GPU only
112const float TWO_PI = 6.2831854820251465;
113const float PI_2 = 1.5707963705062866;
114const float PI_16 = 0.1963495463132858;
115
116const float SIN_TABLE_0 = 0.19509032368659973;
117const float SIN_TABLE_1 = 0.3826834261417389;
118const float SIN_TABLE_2 = 0.5555702447891235;
119const float SIN_TABLE_3 = 0.7071067690849304;
120
121const float COS_TABLE_0 = 0.9807852506637573;
122const float COS_TABLE_1 = 0.9238795042037964;
123const float COS_TABLE_2 = 0.8314695954322815;
124const float COS_TABLE_3 = 0.7071067690849304;
125
126const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3!
127const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5!
128const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7!
129const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9!
130
131float sin_taylor_fp32(float a) {
132  float r, s, t, x;
133
134  if (a == 0.0) {
135    return 0.0;
136  }
137
138  x = -a * a;
139  s = a;
140  r = a;
141
142  r = r * x;
143  t = r * INVERSE_FACTORIAL_3;
144  s = s + t;
145
146  r = r * x;
147  t = r * INVERSE_FACTORIAL_5;
148  s = s + t;
149
150  r = r * x;
151  t = r * INVERSE_FACTORIAL_7;
152  s = s + t;
153
154  r = r * x;
155  t = r * INVERSE_FACTORIAL_9;
156  s = s + t;
157
158  return s;
159}
160
161void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {
162  if (a == 0.0) {
163    sin_t = 0.0;
164    cos_t = 1.0;
165  }
166  sin_t = sin_taylor_fp32(a);
167  cos_t = sqrt(1.0 - sin_t * sin_t);
168}
169
170float tan_taylor_fp32(float a) {
171    float sin_a;
172    float cos_a;
173
174    if (a == 0.0) {
175        return 0.0;
176    }
177
178    // 2pi range reduction
179    float z = floor(a / TWO_PI);
180    float r = a - TWO_PI * z;
181
182    float t;
183    float q = floor(r / PI_2 + 0.5);
184    int j = int(q);
185
186    if (j < -2 || j > 2) {
187        return 1.0 / 0.0;
188    }
189
190    t = r - PI_2 * q;
191
192    q = floor(t / PI_16 + 0.5);
193    int k = int(q);
194    int abs_k = int(abs(float(k)));
195
196    if (abs_k > 4) {
197        return 1.0 / 0.0;
198    } else {
199        t = t - PI_16 * q;
200    }
201
202    float u = 0.0;
203    float v = 0.0;
204
205    float sin_t, cos_t;
206    float s, c;
207    sincos_taylor_fp32(t, sin_t, cos_t);
208
209    if (k == 0) {
210        s = sin_t;
211        c = cos_t;
212    } else {
213        if (abs(float(abs_k) - 1.0) < 0.5) {
214            u = COS_TABLE_0;
215            v = SIN_TABLE_0;
216        } else if (abs(float(abs_k) - 2.0) < 0.5) {
217            u = COS_TABLE_1;
218            v = SIN_TABLE_1;
219        } else if (abs(float(abs_k) - 3.0) < 0.5) {
220            u = COS_TABLE_2;
221            v = SIN_TABLE_2;
222        } else if (abs(float(abs_k) - 4.0) < 0.5) {
223            u = COS_TABLE_3;
224            v = SIN_TABLE_3;
225        }
226        if (k > 0) {
227            s = u * sin_t + v * cos_t;
228            c = u * cos_t - v * sin_t;
229        } else {
230            s = u * sin_t - v * cos_t;
231            c = u * cos_t + v * sin_t;
232        }
233    }
234
235    if (j == 0) {
236        sin_a = s;
237        cos_a = c;
238    } else if (j == 1) {
239        sin_a = c;
240        cos_a = -s;
241    } else if (j == -1) {
242        sin_a = -c;
243        cos_a = s;
244    } else {
245        sin_a = -s;
246        cos_a = -c;
247    }
248    return sin_a / cos_a;
249}
250#endif
251
252float tan_fp32(float a) {
253#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
254  return tan_taylor_fp32(a);
255#else
256  return tan(a);
257#endif
258}
259`,Hj={name:"fp32",vs:Vj},jj=`
260uniform fp64arithmeticUniforms {
261  uniform float ONE;
262} fp64;
263
264/*
265About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
266
267The purpose of this workaround is to prevent shader compilers from
268optimizing away necessary arithmetic operations by swapping their sequences
269or transform the equation to some 'equivalent' form.
270
271The method is to multiply an artifical variable, ONE, which will be known to
272the compiler to be 1 only at runtime. The whole expression is then represented
273as a polynomial with respective to ONE. In the coefficients of all terms, only one a
274and one b should appear
275
276err = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE
277*/
278
279// Divide float number to high and low floats to extend fraction bits
280vec2 split(float a) {
281  const float SPLIT = 4097.0;
282  float t = a * SPLIT;
283#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
284  float a_hi = t * fp64.ONE - (t - a);
285  float a_lo = a * fp64.ONE - a_hi;
286#else
287  float a_hi = t - (t - a);
288  float a_lo = a - a_hi;
289#endif
290  return vec2(a_hi, a_lo);
291}
292
293// Divide float number again when high float uses too many fraction bits
294vec2 split2(vec2 a) {
295  vec2 b = split(a.x);
296  b.y += a.y;
297  return b;
298}
299
300// Special sum operation when a > b
301vec2 quickTwoSum(float a, float b) {
302#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
303  float sum = (a + b) * fp64.ONE;
304  float err = b - (sum - a) * fp64.ONE;
305#else
306  float sum = a + b;
307  float err = b - (sum - a);
308#endif
309  return vec2(sum, err);
310}
311
312// General sum operation
313vec2 twoSum(float a, float b) {
314  float s = (a + b);
315#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
316  float v = (s * fp64.ONE - a) * fp64.ONE;
317  float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE + (b - v);
318#else
319  float v = s - a;
320  float err = (a - (s - v)) + (b - v);
321#endif
322  return vec2(s, err);
323}
324
325vec2 twoSub(float a, float b) {
326  float s = (a - b);
327#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
328  float v = (s * fp64.ONE - a) * fp64.ONE;
329  float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE - (b + v);
330#else
331  float v = s - a;
332  float err = (a - (s - v)) - (b + v);
333#endif
334  return vec2(s, err);
335}
336
337vec2 twoSqr(float a) {
338  float prod = a * a;
339  vec2 a_fp64 = split(a);
340#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
341  float err = ((a_fp64.x * a_fp64.x - prod) * fp64.ONE + 2.0 * a_fp64.x *
342    a_fp64.y * fp64.ONE * fp64.ONE) + a_fp64.y * a_fp64.y * fp64.ONE * fp64.ONE * fp64.ONE;
343#else
344  float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;
345#endif
346  return vec2(prod, err);
347}
348
349vec2 twoProd(float a, float b) {
350  float prod = a * b;
351  vec2 a_fp64 = split(a);
352  vec2 b_fp64 = split(b);
353  float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +
354    a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;
355  return vec2(prod, err);
356}
357
358vec2 sum_fp64(vec2 a, vec2 b) {
359  vec2 s, t;
360  s = twoSum(a.x, b.x);
361  t = twoSum(a.y, b.y);
362  s.y += t.x;
363  s = quickTwoSum(s.x, s.y);
364  s.y += t.y;
365  s = quickTwoSum(s.x, s.y);
366  return s;
367}
368
369vec2 sub_fp64(vec2 a, vec2 b) {
370  vec2 s, t;
371  s = twoSub(a.x, b.x);
372  t = twoSub(a.y, b.y);
373  s.y += t.x;
374  s = quickTwoSum(s.x, s.y);
375  s.y += t.y;
376  s = quickTwoSum(s.x, s.y);
377  return s;
378}
379
380vec2 mul_fp64(vec2 a, vec2 b) {
381  vec2 prod = twoProd(a.x, b.x);
382  // y component is for the error
383  prod.y += a.x * b.y;
384#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
385  prod = split2(prod);
386#endif
387  prod = quickTwoSum(prod.x, prod.y);
388  prod.y += a.y * b.x;
389#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
390  prod = split2(prod);
391#endif
392  prod = quickTwoSum(prod.x, prod.y);
393  return prod;
394}
395
396vec2 div_fp64(vec2 a, vec2 b) {
397  float xn = 1.0 / b.x;
398#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
399  vec2 yn = mul_fp64(a, vec2(xn, 0));
400#else
401  vec2 yn = a * xn;
402#endif
403  float diff = (sub_fp64(a, mul_fp64(b, yn))).x;
404  vec2 prod = twoProd(xn, diff);
405  return sum_fp64(yn, prod);
406}
407
408vec2 sqrt_fp64(vec2 a) {
409  if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);
410  if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
411
412  float x = 1.0 / sqrt(a.x);
413  float yn = a.x * x;
414#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
415  vec2 yn_sqr = twoSqr(yn) * fp64.ONE;
416#else
417  vec2 yn_sqr = twoSqr(yn);
418#endif
419  float diff = sub_fp64(a, yn_sqr).x;
420  vec2 prod = twoProd(x * 0.5, diff);
421#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
422  return sum_fp64(split(yn), prod);
423#else
424  return sum_fp64(vec2(yn, 0.0), prod);
425#endif
426}
427`,$j={ONE:1},Wj={name:"fp64arithmetic",vs:jj,defaultUniforms:$j,uniformTypes:{ONE:"f32"},fp64ify:P4,fp64LowPart:zj,fp64ifyMatrix4:Gj},Jj=[0,1,1,1],Xj=`uniform pickingUniforms {
428  float isActive;
429  float isAttribute;
430  float isHighlightActive;
431  float useFloatColors;
432  vec3 highlightedObjectColor;
433  vec4 highlightColor;
434} picking;
435
436out vec4 picking_vRGBcolor_Avalid;
437
438// Normalize unsigned byte color to 0-1 range
439vec3 picking_normalizeColor(vec3 color) {
440  return picking.useFloatColors > 0.5 ? color : color / 255.0;
441}
442
443// Normalize unsigned byte color to 0-1 range
444vec4 picking_normalizeColor(vec4 color) {
445  return picking.useFloatColors > 0.5 ? color : color / 255.0;
446}
447
448bool picking_isColorZero(vec3 color) {
449  return dot(color, vec3(1.0)) < 0.00001;
450}
451
452bool picking_isColorValid(vec3 color) {
453  return dot(color, vec3(1.0)) > 0.00001;
454}
455
456// Check if this vertex is highlighted 
457bool isVertexHighlighted(vec3 vertexColor) {
458  vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
459  return
460    bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor));
461}
462
463// Set the current picking color
464void picking_setPickingColor(vec3 pickingColor) {
465  pickingColor = picking_normalizeColor(pickingColor);
466
467  if (bool(picking.isActive)) {
468    // Use alpha as the validity flag. If pickingColor is [0, 0, 0] fragment is non-pickable
469    picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));
470
471    if (!bool(picking.isAttribute)) {
472      // Stores the picking color so that the fragment shader can render it during picking
473      picking_vRGBcolor_Avalid.rgb = pickingColor;
474    }
475  } else {
476    // Do the comparison with selected item color in vertex shader as it should mean fewer compares
477    picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor));
478  }
479}
480
481void picking_setPickingAttribute(float value) {
482  if (bool(picking.isAttribute)) {
483    picking_vRGBcolor_Avalid.r = value;
484  }
485}
486
487void picking_setPickingAttribute(vec2 value) {
488  if (bool(picking.isAttribute)) {
489    picking_vRGBcolor_Avalid.rg = value;
490  }
491}
492
493void picking_setPickingAttribute(vec3 value) {
494  if (bool(picking.isAttribute)) {
495    picking_vRGBcolor_Avalid.rgb = value;
496  }
497}
498`,Kj=`uniform pickingUniforms {
499  float isActive;
500  float isAttribute;
501  float isHighlightActive;
502  float useFloatColors;
503  vec3 highlightedObjectColor;
504  vec4 highlightColor;
505} picking;
506
507in vec4 picking_vRGBcolor_Avalid;
508
509/*
510 * Returns highlight color if this item is selected.
511 */
512vec4 picking_filterHighlightColor(vec4 color) {
513  // If we are still picking, we don't highlight
514  if (picking.isActive > 0.5) {
515    return color;
516  }
517
518  bool selected = bool(picking_vRGBcolor_Avalid.a);
519
520  if (selected) {
521    // Blend in highlight color based on its alpha value
522    float highLightAlpha = picking.highlightColor.a;
523    float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
524    float highLightRatio = highLightAlpha / blendedAlpha;
525
526    vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio);
527    return vec4(blendedRGB, blendedAlpha);
528  } else {
529    return color;
530  }
531}
532
533/*
534 * Returns picking color if picking enabled else unmodified argument.
535 */
536vec4 picking_filterPickingColor(vec4 color) {
537  if (bool(picking.isActive)) {
538    if (picking_vRGBcolor_Avalid.a == 0.0) {
539      discard;
540    }
541    return picking_vRGBcolor_Avalid;
542  }
543  return color;
544}
545
546/*
547 * Returns picking color if picking is enabled if not
548 * highlight color if this item is selected, otherwise unmodified argument.
549 */
550vec4 picking_filterColor(vec4 color) {
551  vec4 highlightColor = picking_filterHighlightColor(color);
552  return picking_filterPickingColor(highlightColor);
553}
554`,wS={props:{},uniforms:{},name:"picking",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:[0,0,0],highlightColor:Jj},vs:Xj,fs:Kj,getUniforms:qj};function qj(r={},e){const t={};if(r.highlightedObjectColor!==void 0)if(r.highlightedObjectColor===null)t.isHighlightActive=!1;else{t.isHighlightActive=!0;const n=r.highlightedObjectColor.slice(0,3);t.highlightedObjectColor=n}if(r.highlightColor){const n=Array.from(r.highlightColor,i=>i/255);Number.isFinite(n[3])||(n[3]=1),t.highlightColor=n}return r.isActive!==void 0&&(t.isActive=!!r.isActive,t.isAttribute=!!r.isAttribute),r.useFloatColors!==void 0&&(t.useFloatColors=!!r.useFloatColors),t}const CS=`precision highp int;
555
556// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
557struct AmbientLight {
558  vec3 color;
559};
560
561struct PointLight {
562  vec3 color;
563  vec3 position;
564  vec3 attenuation; // 2nd order x:Constant-y:Linear-z:Exponential
565};
566
567struct DirectionalLight {
568  vec3 color;
569  vec3 direction;
570};
571
572uniform lightingUniforms {
573  int enabled;
574  int lightType;
575
576  int directionalLightCount;
577  int pointLightCount;
578
579  vec3 ambientColor;
580
581  vec3 lightColor0;
582  vec3 lightPosition0;
583  vec3 lightDirection0;
584  vec3 lightAttenuation0;
585
586  vec3 lightColor1;
587  vec3 lightPosition1;
588  vec3 lightDirection1;
589  vec3 lightAttenuation1;
590
591  vec3 lightColor2;
592  vec3 lightPosition2;
593  vec3 lightDirection2;
594  vec3 lightAttenuation2;
595} lighting;
596
597PointLight lighting_getPointLight(int index) {
598  switch (index) {
599    case 0:
600      return PointLight(lighting.lightColor0, lighting.lightPosition0, lighting.lightAttenuation0);
601    case 1:
602      return PointLight(lighting.lightColor1, lighting.lightPosition1, lighting.lightAttenuation1);
603    case 2:
604    default:  
605      return PointLight(lighting.lightColor2, lighting.lightPosition2, lighting.lightAttenuation2);
606  }
607}
608
609DirectionalLight lighting_getDirectionalLight(int index) {
610  switch (index) {
611    case 0:
612      return DirectionalLight(lighting.lightColor0, lighting.lightDirection0);
613    case 1:
614      return DirectionalLight(lighting.lightColor1, lighting.lightDirection1);
615    case 2:
616    default:   
617      return DirectionalLight(lighting.lightColor2, lighting.lightDirection2);
618  }
619} 
620
621float getPointLightAttenuation(PointLight pointLight, float distance) {
622  return pointLight.attenuation.x
623       + pointLight.attenuation.y * distance
624       + pointLight.attenuation.z * distance * distance;
625}
626
627// #endif
628`,Yj=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
629struct AmbientLight {
630  color: vec3<f32>,
631};
632
633struct PointLight {
634  color: vec3<f32>,
635  position: vec3<f32>,
636  attenuation: vec3<f32>, // 2nd order x:Constant-y:Linear-z:Exponential
637};
638
639struct DirectionalLight {
640  color: vec3<f32>,
641  direction: vec3<f32>,
642};
643
644struct lightingUniforms {
645  enabled: i32,
646  pointLightCount: i32,
647  directionalLightCount: i32,
648
649  ambientColor: vec3<f32>,
650
651  // TODO - support multiple lights by uncommenting arrays below
652  lightType: i32,
653  lightColor: vec3<f32>,
654  lightDirection: vec3<f32>,
655  lightPosition: vec3<f32>,
656  lightAttenuation: vec3<f32>,
657
658  // AmbientLight ambientLight;
659  // PointLight pointLight[MAX_LIGHTS];
660  // DirectionalLight directionalLight[MAX_LIGHTS];
661};
662
663// Binding 0:1 is reserved for lighting (Note: could go into separate bind group as it is stable across draw calls)
664@binding(1) @group(0) var<uniform> lighting : lightingUniforms;
665
666fn lighting_getPointLight(index: i32) -> PointLight {
667  return PointLight(lighting.lightColor, lighting.lightPosition, lighting.lightAttenuation);
668}
669
670fn lighting_getDirectionalLight(index: i32) -> DirectionalLight {
671  return DirectionalLight(lighting.lightColor, lighting.lightDirection);
672} 
673
674fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
675  return pointLight.attenuation.x
676       + pointLight.attenuation.y * distance
677       + pointLight.attenuation.z * distance * distance;
678}
679`,R4=3,Zj=255;var bg;(function(r){r[r.POINT=0]="POINT",r[r.DIRECTIONAL=1]="DIRECTIONAL"})(bg||(bg={}));const mp={props:{},uniforms:{},name:"lighting",defines:{MAX_LIGHTS:R4},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientLightColor:"vec3<f32>",lightColor0:"vec3<f32>",lightPosition0:"vec3<f32>",lightDirection0:"vec3<f32>",lightAttenuation0:"vec3<f32>",lightColor1:"vec3<f32>",lightPosition1:"vec3<f32>",lightDirection1:"vec3<f32>",lightAttenuation1:"vec3<f32>",lightColor2:"vec3<f32>",lightPosition2:"vec3<f32>",lightDirection2:"vec3<f32>",lightAttenuation2:"vec3<f32>"},defaultUniforms:{enabled:1,lightType:bg.POINT,directionalLightCount:0,pointLightCount:0,ambientLightColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0]},source:Yj,vs:CS,fs:CS,getUniforms:Qj};function Qj(r,e={}){if(r=r&&{...r},!r)return{...mp.defaultUniforms};r.lights&&(r={...r,...t$(r.lights),lights:void 0});const{ambientLight:t,pointLights:n,directionalLights:i}=r||{};if(!(t||n&&n.length>0||i&&i.length>0))return{...mp.defaultUniforms,enabled:0};const o={...mp.defaultUniforms,...e,...e$({ambientLight:t,pointLights:n,directionalLights:i})};return r.enabled!==void 0&&(o.enabled=r.enabled?1:0),o}function e$({ambientLight:r,pointLights:e=[],directionalLights:t=[]}){const n={};n.ambientLightColor=rb(r);let i=0;for(const s of e){n.lightType=bg.POINT;const o=i;n[`lightColor${o}`]=rb(s),n[`lightPosition${o}`]=s.position,n[`lightAttenuation${o}`]=s.attenuation||[1,0,0],i++}for(const s of t){n.lightType=bg.DIRECTIONAL;const o=i;n[`lightColor${o}`]=rb(s),n[`lightDirection${o}`]=s.direction,i++}return i>R4&&Zt.warn("MAX_LIGHTS exceeded")(),n.directionalLightCount=t.length,n.pointLightCount=e.length,n}function t$(r){const e={pointLights:[],directionalLights:[]};for(const t of r||[])switch(t.type){case"ambient":e.ambientLight=t;break;case"directional":e.directionalLights?.push(t);break;case"point":e.pointLights?.push(t);break}return e}function rb(r={}){const{color:e=[0,0,0],intensity:t=1}=r;return e.map(n=>n*t/Zj)}const F4=`uniform phongMaterialUniforms {
680  uniform float ambient;
681  uniform float diffuse;
682  uniform float shininess;
683  uniform vec3  specularColor;
684} material;
685`,D4=`uniform phongMaterialUniforms {
686  uniform float ambient;
687  uniform float diffuse;
688  uniform float shininess;
689  uniform vec3  specularColor;
690} material;
691
692vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {
693  vec3 halfway_direction = normalize(light_direction + view_direction);
694  float lambertian = dot(light_direction, normal_worldspace);
695  float specular = 0.0;
696  if (lambertian > 0.0) {
697    float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
698    specular = pow(specular_angle, material.shininess);
699  }
700  lambertian = max(lambertian, 0.0);
701  return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;
702}
703
704vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
705  vec3 lightColor = surfaceColor;
706
707  if (lighting.enabled == 0) {
708    return lightColor;
709  }
710
711  vec3 view_direction = normalize(cameraPosition - position_worldspace);
712  lightColor = material.ambient * surfaceColor * lighting.ambientColor;
713
714  for (int i = 0; i < lighting.pointLightCount; i++) {
715    PointLight pointLight = lighting_getPointLight(i);
716    vec3 light_position_worldspace = pointLight.position;
717    vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
718    float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace));
719    lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation);
720  }
721
722  int totalLights = min(MAX_LIGHTS, lighting.pointLightCount + lighting.directionalLightCount);
723  for (int i = lighting.pointLightCount; i < totalLights; i++) {
724    DirectionalLight directionalLight = lighting_getDirectionalLight(i);
725    lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
726  }
727  
728  return lightColor;
729}
730`,O4=`struct phongMaterialUniforms {
731  ambient: f32,
732  diffuse: f32,
733  shininess: f32,
734  specularColor: vec3<f32>,
735};
736
737@binding(2) @group(0) var<uniform> phongMaterial : phongMaterialUniforms;
738
739fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, view_direction: vec3<f32>, normal_worldspace: vec3<f32>, color: vec3<f32>) -> vec3<f32> {
740  let halfway_direction: vec3<f32> = normalize(light_direction + view_direction);
741  var lambertian: f32 = dot(light_direction, normal_worldspace);
742  var specular: f32 = 0.0;
743  if (lambertian > 0.0) {
744    let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
745    specular = pow(specular_angle, phongMaterial.shininess);
746  }
747  lambertian = max(lambertian, 0.0);
748  return (lambertian * phongMaterial.diffuse * surfaceColor + specular * phongMaterial.specularColor) * color;
749}
750
751fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> {
752  var lightColor: vec3<f32> = surfaceColor;
753
754  if (lighting.enabled == 0) {
755    return lightColor;
756  }
757
758  let view_direction: vec3<f32> = normalize(cameraPosition - position_worldspace);
759  lightColor = phongMaterial.ambient * surfaceColor * lighting.ambientColor;
760
761  if (lighting.lightType == 0) {
762    let pointLight: PointLight  = lighting_getPointLight(0);
763    let light_position_worldspace: vec3<f32> = pointLight.position;
764    let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace);
765    lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
766  } else if (lighting.lightType == 1) {
767    var directionalLight: DirectionalLight = lighting_getDirectionalLight(0);
768    lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
769  }
770  
771  return lightColor;
772  /*
773  for (int i = 0; i < MAX_LIGHTS; i++) {
774    if (i >= lighting.pointLightCount) {
775      break;
776    }
777    PointLight pointLight = lighting.pointLight[i];
778    vec3 light_position_worldspace = pointLight.position;
779    vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
780    lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
781  }
782
783  for (int i = 0; i < MAX_LIGHTS; i++) {
784    if (i >= lighting.directionalLightCount) {
785      break;
786    }
787    DirectionalLight directionalLight = lighting.directionalLight[i];
788    lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
789  }
790  */
791}
792
793fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32>{
794  var lightColor = vec3<f32>(0, 0, 0);
795  let surfaceColor = vec3<f32>(0, 0, 0);
796
797  if (lighting.enabled == 0) {
798    let view_direction = normalize(cameraPosition - position_worldspace);
799
800    switch (lighting.lightType) {
801      case 0, default: {
802        let pointLight: PointLight = lighting_getPointLight(0);
803        let light_position_worldspace: vec3<f32> = pointLight.position;
804        let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace);
805        lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
806      }
807      case 1: {
808        let directionalLight: DirectionalLight = lighting_getDirectionalLight(0);
809        lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
810      }
811    }
812  }
813  return lightColor;
814}
815`,uy={props:{},name:"gouraudMaterial",vs:D4.replace("phongMaterial","gouraudMaterial"),fs:F4.replace("phongMaterial","gouraudMaterial"),source:O4.replaceAll("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:1},dependencies:[mp],uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(r){const e={...r};return e.specularColor&&(e.specularColor=e.specularColor.map(t=>t/255)),{...uy.defaultUniforms,...e}}}
815,Tw={name:"phongMaterial",dependencies:[mp],source:O4,vs:F4,fs:D4,defines:{LIGHTING_FRAGMENT:1},uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(r){const e={...r};return e.specularColor&&(e.specularColor=e.specularColor.map(t=>t/255)),{...Tw.defaultUniforms,...e}}},r$=`out vec3 pbr_vPosition;
816out vec2 pbr_vUV;
817
818#ifdef HAS_NORMALS
819# ifdef HAS_TANGENTS
820out mat3 pbr_vTBN;
821# else
822out vec3 pbr_vNormal;
823# endif
824#endif
825
826void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)
827{
828  vec4 pos = pbrProjection.modelMatrix * position;
829  pbr_vPosition = vec3(pos.xyz) / pos.w;
830
831#ifdef HAS_NORMALS
832#ifdef HAS_TANGENTS
833  vec3 normalW = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0)));
834  vec3 tangentW = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));
835  vec3 bitangentW = cross(normalW, tangentW) * tangent.w;
836  pbr_vTBN = mat3(tangentW, bitangentW, normalW);
837#else // HAS_TANGENTS != 1
838  pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));
839#endif
840#endif
841
842#ifdef HAS_UV
843  pbr_vUV = uv;
844#else
845  pbr_vUV = vec2(0.,0.);
846#endif
847}
848`,n$=`precision highp float;
849
850uniform pbrMaterialUniforms {
851  // Material is unlit
852  bool unlit;
853
854  // Base color map
855  bool baseColorMapEnabled;
856  vec4 baseColorFactor;
857
858  bool normalMapEnabled;  
859  float normalScale; // #ifdef HAS_NORMALMAP
860
861  bool emissiveMapEnabled;
862  vec3 emissiveFactor; // #ifdef HAS_EMISSIVEMAP
863
864  vec2 metallicRoughnessValues;
865  bool metallicRoughnessMapEnabled;
866
867  bool occlusionMapEnabled;
868  float occlusionStrength; // #ifdef HAS_OCCLUSIONMAP
869  
870  bool alphaCutoffEnabled;
871  float alphaCutoff; // #ifdef ALPHA_CUTOFF
872  
873  // IBL
874  bool IBLenabled;
875  vec2 scaleIBLAmbient; // #ifdef USE_IBL
876  
877  // debugging flags used for shader output of intermediate PBR variables
878  // #ifdef PBR_DEBUG
879  vec4 scaleDiffBaseMR;
880  vec4 scaleFGDSpec;
881  // #endif
882} pbrMaterial;
883
884// Samplers
885#ifdef HAS_BASECOLORMAP
886uniform sampler2D pbr_baseColorSampler;
887#endif
888#ifdef HAS_NORMALMAP
889uniform sampler2D pbr_normalSampler;
890#endif
891#ifdef HAS_EMISSIVEMAP
892uniform sampler2D pbr_emissiveSampler;
893#endif
894#ifdef HAS_METALROUGHNESSMAP
895uniform sampler2D pbr_metallicRoughnessSampler;
896#endif
897#ifdef HAS_OCCLUSIONMAP
898uniform sampler2D pbr_occlusionSampler;
899#endif
900#ifdef USE_IBL
901uniform samplerCube pbr_diffuseEnvSampler;
902uniform samplerCube pbr_specularEnvSampler;
903uniform sampler2D pbr_brdfLUT;
904#endif
905
906// Inputs from vertex shader
907
908in vec3 pbr_vPosition;
909in vec2 pbr_vUV;
910
911#ifdef HAS_NORMALS
912#ifdef HAS_TANGENTS
913in mat3 pbr_vTBN;
914#else
915in vec3 pbr_vNormal;
916#endif
917#endif
918
919// Encapsulate the various inputs used by the various functions in the shading equation
920// We store values in this struct to simplify the integration of alternative implementations
921// of the shading terms, outlined in the Readme.MD Appendix.
922struct PBRInfo {
923  float NdotL;                  // cos angle between normal and light direction
924  float NdotV;                  // cos angle between normal and view direction
925  float NdotH;                  // cos angle between normal and half vector
926  float LdotH;                  // cos angle between light direction and half vector
927  float VdotH;                  // cos angle between view direction and half vector
928  float perceptualRoughness;    // roughness value, as authored by the model creator (input to shader)
929  float metalness;              // metallic value at the surface
930  vec3 reflectance0;            // full reflectance color (normal incidence angle)
931  vec3 reflectance90;           // reflectance color at grazing angle
932  float alphaRoughness;         // roughness mapped to a more linear change in the roughness (proposed by [2])
933  vec3 diffuseColor;            // color contribution from diffuse lighting
934  vec3 specularColor;           // color contribution from specular lighting
935  vec3 n;                       // normal at surface point
936  vec3 v;                       // vector from surface point to camera
937};
938
939const float M_PI = 3.141592653589793;
940const float c_MinRoughness = 0.04;
941
942vec4 SRGBtoLINEAR(vec4 srgbIn)
943{
944#ifdef MANUAL_SRGB
945#ifdef SRGB_FAST_APPROXIMATION
946  vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
947#else // SRGB_FAST_APPROXIMATION
948  vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
949  vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
950#endif //SRGB_FAST_APPROXIMATION
951  return vec4(linOut,srgbIn.w);;
952#else //MANUAL_SRGB
953  return srgbIn;
954#endif //MANUAL_SRGB
955}
956
957// Find the normal for this fragment, pulling either from a predefined normal map
958// or from the interpolated mesh normal and tangent attributes.
959vec3 getNormal()
960{
961  // Retrieve the tangent space matrix
962#ifndef HAS_TANGENTS
963  vec3 pos_dx = dFdx(pbr_vPosition);
964  vec3 pos_dy = dFdy(pbr_vPosition);
965  vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));
966  vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));
967  vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
968
969#ifdef HAS_NORMALS
970  vec3 ng = normalize(pbr_vNormal);
971#else
972  vec3 ng = cross(pos_dx, pos_dy);
973#endif
974
975  t = normalize(t - ng * dot(ng, t));
976  vec3 b = normalize(cross(ng, t));
977  mat3 tbn = mat3(t, b, ng);
978#else // HAS_TANGENTS
979  mat3 tbn = pbr_vTBN;
980#endif
981
982#ifdef HAS_NORMALMAP
983  vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;
984  n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));
985#else
986  // The tbn matrix is linearly interpolated, so we need to re-normalize
987  vec3 n = normalize(tbn[2].xyz);
988#endif
989
990  return n;
991}
992
993// Calculation of the lighting contribution from an optional Image Based Light source.
994// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
995// See our README.md on Environment Maps [3] for additional discussion.
996#ifdef USE_IBL
997vec3 getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection)
998{
999  float mipCount = 9.0; // resolution of 512x512
1000  float lod = (pbrInfo.perceptualRoughness * mipCount);
1001  // retrieve a scale and bias to F0. See [1], Figure 3
1002  vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT,
1003    vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;
1004  vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb;
1005
1006#ifdef USE_TEX_LOD
1007  vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb;
1008#else
1009  vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb;
1010#endif
1011
1012  vec3 diffuse = diffuseLight * pbrInfo.diffuseColor;
1013  vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);
1014
1015  // For presentation, this allows us to disable IBL terms
1016  diffuse *= pbrMaterial.scaleIBLAmbient.x;
1017  specular *= pbrMaterial.scaleIBLAmbient.y;
1018
1019  return diffuse + specular;
1020}
1021#endif
1022
1023// Basic Lambertian diffuse
1024// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
1025// See also [1], Equation 1
1026vec3 diffuse(PBRInfo pbrInfo)
1027{
1028  return pbrInfo.diffuseColor / M_PI;
1029}
1030
1031// The following equation models the Fresnel reflectance term of the spec equation (aka F())
1032// Implementation of fresnel from [4], Equation 15
1033vec3 specularReflection(PBRInfo pbrInfo)
1034{
1035  return pbrInfo.reflectance0 +
1036    (pbrInfo.reflectance90 - pbrInfo.reflectance0) *
1037    pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);
1038}
1039
1040// This calculates the specular geometric attenuation (aka G()),
1041// where rougher material will reflect less light back to the viewer.
1042// This implementation is based on [1] Equation 4, and we adopt their modifications to
1043// alphaRoughness as input as originally proposed in [2].
1044float geometricOcclusion(PBRInfo pbrInfo)
1045{
1046  float NdotL = pbrInfo.NdotL;
1047  float NdotV = pbrInfo.NdotV;
1048  float r = pbrInfo.alphaRoughness;
1049
1050  float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
1051  float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
1052  return attenuationL * attenuationV;
1053}
1054
1055// The following equation(s) model the distribution of microfacet normals across
1056// the area being drawn (aka D())
1057// Implementation from "Average Irregularity Representation of a Roughened Surface
1058// for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
1059// Follows the distribution function recommended in the SIGGRAPH 2013 course notes
1060// from EPIC Games [1], Equation 3.
1061float microfacetDistribution(PBRInfo pbrInfo)
1062{
1063  float roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;
1064  float f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;
1065  return roughnessSq / (M_PI * f * f);
1066}
1067
1068void PBRInfo_setAmbientLight(inout PBRInfo pbrInfo) {
1069  pbrInfo.NdotL = 1.0;
1070  pbrInfo.NdotH = 0.0;
1071  pbrInfo.LdotH = 0.0;
1072  pbrInfo.VdotH = 1.0;
1073}
1074
1075void PBRInfo_setDirectionalLight(inout PBRInfo pbrInfo, vec3 lightDirection) {
1076  vec3 n = pbrInfo.n;
1077  vec3 v = pbrInfo.v;
1078  vec3 l = normalize(lightDirection);             // Vector from surface point to light
1079  vec3 h = normalize(l+v);                        // Half vector between both l and v
1080
1081  pbrInfo.NdotL = clamp(dot(n, l), 0.001, 1.0);
1082  pbrInfo.NdotH = clamp(dot(n, h), 0.0, 1.0);
1083  pbrInfo.LdotH = clamp(dot(l, h), 0.0, 1.0);
1084  pbrInfo.VdotH = clamp(dot(v, h), 0.0, 1.0);
1085}
1086
1087void PBRInfo_setPointLight(inout PBRInfo pbrInfo, PointLight pointLight) {
1088  vec3 light_direction = normalize(pointLight.position - pbr_vPosition);
1089  PBRInfo_setDirectionalLight(pbrInfo, light_direction);
1090}
1091
1092vec3 calculateFinalColor(PBRInfo pbrInfo, vec3 lightColor) {
1093  // Calculate the shading terms for the microfacet specular shading model
1094  vec3 F = specularReflection(pbrInfo);
1095  float G = geometricOcclusion(pbrInfo);
1096  float D = microfacetDistribution(pbrInfo);
1097
1098  // Calculation of analytical lighting contribution
1099  vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInfo);
1100  vec3 specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);
1101  // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
1102  return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);
1103}
1104
1105vec4 pbr_filterColor(vec4 colorUnused)
1106{
1107  // The albedo may be defined from a base texture or a flat color
1108#ifdef HAS_BASECOLORMAP
1109  vec4 baseColor = SRGBtoLINEAR(texture(pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor;
1110#else
1111  vec4 baseColor = pbrMaterial.baseColorFactor;
1112#endif
1113
1114#ifdef ALPHA_CUTOFF
1115  if (baseColor.a < pbrMaterial.alphaCutoff) {
1116    discard;
1117  }
1118#endif
1119
1120  vec3 color = vec3(0, 0, 0);
1121
1122  if(pbrMaterial.unlit){
1123    color.rgb = baseColor.rgb;
1124  }
1125  else{
1126    // Metallic and Roughness material properties are packed together
1127    // In glTF, these factors can be specified by fixed scalar values
1128    // or from a metallic-roughness map
1129    float perceptualRoughness = pbrMaterial.metallicRoughnessValues.y;
1130    float metallic = pbrMaterial.metallicRoughnessValues.x;
1131#ifdef HAS_METALROUGHNESSMAP
1132    // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
1133    // This layout intentionally reserves the 'r' channel for (optional) occlusion map data
1134    vec4 mrSample = texture(pbr_metallicRoughnessSampler, pbr_vUV);
1135    perceptualRoughness = mrSample.g * perceptualRoughness;
1136    metallic = mrSample.b * metallic;
1137#endif
1138    perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0
1138);
1139    metallic = clamp(metallic, 0.0, 1.0);
1140    // Roughness is authored as perceptual roughness; as is convention,
1141    // convert to material roughness by squaring the perceptual roughness [2].
1142    float alphaRoughness = perceptualRoughness * perceptualRoughness;
1143
1144    vec3 f0 = vec3(0.04);
1145    vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
1146    diffuseColor *= 1.0 - metallic;
1147    vec3 specularColor = mix(f0, baseColor.rgb, metallic);
1148
1149    // Compute reflectance.
1150    float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
1151
1152    // For typical incident reflectance range (between 4% to 100%) set the grazing
1153    // reflectance to 100% for typical fresnel effect.
1154    // For very low reflectance range on highly diffuse objects (below 4%),
1155    // incrementally reduce grazing reflecance to 0%.
1156    float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
1157    vec3 specularEnvironmentR0 = specularColor.rgb;
1158    vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
1159
1160    vec3 n = getNormal();                          // normal at surface point
1161    vec3 v = normalize(pbrProjection.camera - pbr_vPosition);  // Vector from surface point to camera
1162
1163    float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
1164    vec3 reflection = -normalize(reflect(v, n));
1165
1166    PBRInfo pbrInfo = PBRInfo(
1167      0.0, // NdotL
1168      NdotV,
1169      0.0, // NdotH
1170      0.0, // LdotH
1171      0.0, // VdotH
1172      perceptualRoughness,
1173      metallic,
1174      specularEnvironmentR0,
1175      specularEnvironmentR90,
1176      alphaRoughness,
1177      diffuseColor,
1178      specularColor,
1179      n,
1180      v
1181    );
1182
1183
1184#ifdef USE_LIGHTS
1185    // Apply ambient light
1186    PBRInfo_setAmbientLight(pbrInfo);
1187    color += calculateFinalColor(pbrInfo, lighting.ambientColor);
1188
1189    // Apply directional light
1190    for(int i = 0; i < lighting.directionalLightCount; i++) {
1191      if (i < lighting.directionalLightCount) {
1192        PBRInfo_setDirectionalLight(pbrInfo, lighting_getDirectionalLight(i).direction);
1193        color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color);
1194      }
1195    }
1196
1197    // Apply point light
1198    for(int i = 0; i < lighting.pointLightCount; i++) {
1199      if (i < lighting.pointLightCount) {
1200        PBRInfo_setPointLight(pbrInfo, lighting_getPointLight(i));
1201        float attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition));
1202        color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);
1203      }
1204    }
1205#endif
1206
1207    // Calculate lighting contribution from image based lighting source (IBL)
1208#ifdef USE_IBL
1209    if (pbrMaterial.IBLenabled) {
1210      color += getIBLContribution(pbrInfo, n, reflection);
1211    }
1212#endif
1213
1214 // Apply optional PBR terms for additional (optional) shading
1215#ifdef HAS_OCCLUSIONMAP
1216    if (pbrMaterial.occlusionMapEnabled) {
1217      float ao = texture(pbr_occlusionSampler, pbr_vUV).r;
1218      color = mix(color, color * ao, pbrMaterial.occlusionStrength);
1219    }
1220#endif
1221
1222#ifdef HAS_EMISSIVEMAP
1223    if (pbrMaterial.emissiveMapEnabled) {
1224      vec3 emissive = SRGBtoLINEAR(texture(pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor;
1225      color += emissive;
1226    }
1227#endif
1228
1229    // This section uses mix to override final color for reference app visualization
1230    // of various parameters in the lighting equation.
1231#ifdef PBR_DEBUG
1232    // TODO: Figure out how to debug multiple lights
1233
1234    // color = mix(color, F, pbr_scaleFGDSpec.x);
1235    // color = mix(color, vec3(G), pbr_scaleFGDSpec.y);
1236    // color = mix(color, vec3(D), pbr_scaleFGDSpec.z);
1237    // color = mix(color, specContrib, pbr_scaleFGDSpec.w);
1238
1239    // color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x);
1240    color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y);
1241    color = mix(color, vec3(metallic), pbrMaterial.scaleDiffBaseMR.z);
1242    color = mix(color, vec3(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w);
1243#endif
1244
1245  }
1246
1247  return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
1248}
1249`,TS=`uniform pbrProjectionUniforms {
1250  mat4 modelViewProjectionMatrix;
1251  mat4 modelMatrix;
1252  mat4 normalMatrix;
1253  vec3 camera;
1254} pbrProjection;
1255`,i$={name:"pbrProjection",vs:TS,fs:TS,getUniforms:r=>r,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}},Ew={props:{},uniforms:{}
1255,name:"pbrMaterial",dependencies:[mp,i$],vs:r$,fs:n$,defines:{LIGHTING_FRAGMENT:1},getUniforms:r=>r,uniformTypes:{unlit:"i32",baseColorMapEnabled:"i32",baseColorFactor:"vec4<f32>",normalMapEnabled:"i32",normalScale:"f32",emissiveMapEnabled:"i32",emissiveFactor:"vec3<f32>",metallicRoughnessValues:"vec2<f32>",metallicRoughnessMapEnabled:"i32",occlusionMapEnabled:"i32",occlusionStrength:"f32",alphaCutoffEnabled:"i32",alphaCutoff:"f32",IBLenabled:"i32",scaleIBLAmbient:"vec2<f32>",scaleDiffBaseMR:"vec4<f32>",scaleFGDSpec:"vec4<f32>"}},ES=`uniform layerUniforms {
1256  uniform float opacity;
1257} layer;
1258`,s$={name:"layer",vs:ES,fs:ES,getUniforms:r=>({opacity:Math.pow(r.opacity,1/2.2)}),uniformTypes:{opacity:"f32"}},o$=`const SMOOTH_EDGE_RADIUS: f32 = 0.5;
1259
1260struct VertexGeometry {
1261  position: vec4<f32>,
1262  worldPosition: vec3<f32>,
1263  worldPositionAlt: vec3<f32>,
1264  normal: vec3<f32>,
1265  uv: vec2<f32>,
1266  pickingColor: vec3<f32>,
1267};
1268
1269var<private> geometry_: VertexGeometry = VertexGeometry(
1270  vec4<f32>(0.0, 0.0, 1.0, 0.0),
1271  vec3<f32>(0.0, 0.0, 0.0),
1272  vec3<f32>(0.0, 0.0, 0.0),
1273  vec3<f32>(0.0, 0.0, 0.0),
1274  vec2<f32>(0.0, 0.0),
1275  vec3<f32>(0.0, 0.0, 0.0)
1276);
1277
1278struct FragmentGeometry {
1279  uv: vec2<f32>,
1280};
1281
1282var<private> fragmentGeometry: FragmentGeometry;
1283
1284fn smoothedge(edge: f32, x: f32) -> f32 {
1285  return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
1286}
1287`,L4="#define SMOOTH_EDGE_RADIUS 0.5",a$=`${L4}
1288
1289struct VertexGeometry {
1290  vec4 position;
1291  vec3 worldPosition;
1292  vec3 worldPositionAlt;
1293  vec3 normal;
1294  vec2 uv;
1295  vec3 pickingColor;
1296} geometry = VertexGeometry(
1297  vec4(0.0, 0.0, 1.0, 0.0),
1298  vec3(0.0),
1299  vec3(0.0),
1300  vec3(0.0),
1301  vec2(0.0),
1302  vec3(0.0)
1303);
1304`,c$=`${L4}
1305
1306struct FragmentGeometry {
1307  vec2 uv;
1308} geometry;
1309
1310float smoothedge(float edge, float x) {
1311  return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
1312}
1313`,k4={name:"geometry",source:o$,vs:a$,fs:c$},l$=25;var As;(function(r){r[r.Start=1]="Start",r[r.Move=2]="Move",r[r.End=4]="End",r[r.Cancel=8]="Cancel"})(As||(As={}));var Cs;(function(r){r[r.None=0]="None",r[r.Left=1]="Left",r[r.Right=2]="Right",r[r.Up=4]="Up",r[r.Down=8]="Down",r[r.Horizontal=3]="Horizontal",r[r.Vertical=12]="Vertical",r[r.All=15]="All"})(Cs||(Cs={}));var yn;(function(r){r[r.Possible=1]="Possible",r[r.Began=2]="Began",r[r.Changed=4]="Changed",r[r.Ended=8]="Ended",r[r.Recognized=8]="Recognized",r[r.Cancelled=16]="Cancelled",r[r.Failed=32]="Failed"})(yn||(yn={}));const u$="compute",f$="auto",_2="manipulation",G0="none",y2="pan-x",v2="pan-y";function h$(r){if(r.includes(G0))return G0;const e=r.includes(y2),t=r.includes(v2);return e&&t?G0:e||t?e?y2:v2:r.includes(_2)?_2:f$}class d${constructor(e,t){this.actions="",this.manager=e,this.set(t)}set(e){e===u$&&(e=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=e,this.actions=e)}update(){this.set(this.manager.options.touchAction)}compute(){let e=[];for(const t of this.manager.recognizers)t.options.enable&&(e=e.concat(t.getTouchAction()));return h$(e.join(" "))}}function w_(r){return r.trim().split(/\s+/g)}function nb(r,e,t){if(r)for(const n of w_(e))r.addEventListener(n,t,!1)}function ib(r,e,t){if(r)for(const n of w_(e))r.removeEventListener(n,t,!1)}function BS(r){return(r.ownerDocument||r).defaultView}function p$(r,e){let t=r;for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function N4(r){const e=r.length;if(e===1)return{x:Math.round(r[0].clientX),y:Math.round(r[0].clientY)};let t=0,n=0,i=0;for(;i<e;)t+=r[i].clientX,n+=r[i].clientY,i++;return{x:Math.round(t/e),y:Math.round(n/e)}}function SS(r){const e=[];let t=0;for(;t<r.pointers.length;)e[t]={clientX:Math.round(r.pointers[t].clientX),clientY:Math.round(r.pointers[t].clientY)},t++;return{timeStamp:Date.now(),pointers:e,center:N4(e),deltaX:r.deltaX,deltaY:r.deltaY}}function U4(r,e){const t=e.x-r.x,n=e.y-r.y;return Math.sqrt(t*t+n*n)}function IS(r,e){const t=e.clientX-r.clientX,n=e.clientY-r.clientY;return Math.sqrt(t*t+n*n)}function A$(r,e){const t=e.x-r.x,n=e.y-r.y;return Math.atan2(n,t)*180/Math.PI}function MS(r,e){const t=e.clientX-r.clientX,n=e.clientY-r.clientY;return Math.atan2(n,t)*180/Math.PI}function z4(r,e){return r===e?Cs.None:Math.abs(r)>=Math.abs(e)?r<0?Cs.Left:Cs.Right:e<0?Cs.Up:Cs.Down}function g$(r,e){const t=e.center;let n=r.offsetDelta,i=r.prevDelta;const s=r.prevInput;return(e.eventType===As.Start||s?.eventType===As.End)&&(i=r.prevDelta={x:s?.deltaX||0,y:s?.deltaY||0},n=r.offsetDelta={x:t.x,y:t.y}),{deltaX:i.x+(t.x-n.x),deltaY:i.y+(t.y-n.y)}}function G4(r,e,t){return{x:e/r||0,y:t/r||0}}function m$(r,e){return IS(e[0],e[1])/IS(r[0],r[1])}function _$(r,e){return MS(e[1],e[0])-MS(r[1],r[0])}function y$(r,e){const t=r.lastInterval||e,n=e.timeStamp-t.timeStamp;let i,s,o,c;if(e.eventType!==As.Cancel&&(n>l$||t.velocity===void 0)){const f=e.deltaX-t.deltaX,A=e.deltaY-t.deltaY,v=G4(n,f,A);s=v.x,o=v.y,i=Math.abs(v.x)>Math.abs(v.y)?v.x:v.y,c=z4(f,A),r.lastInterval=e}else i=t.velocity,s=t.velocityX,o=t.velocityY,c=t.direction;e.velocity=i,e.velocityX=s,e.velocityY=o,e.direction=c}function v$(r,e){const{session:t}=r,{pointers:n}=e,{length:i}=n;t.firstInput||(t.firstInput=SS(e)),i>1&&!t.firstMultiple?t.firstMultiple=SS(e):i===1&&(t.firstMultiple=!1);const{firstInput:s,firstMultiple:o}=t,c=o?o.center:s.center,f=e.center=N4(n);e.timeStamp=Date.now(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=A$(c,f),e.distance=U4(c,f);const{deltaX:A,deltaY:v}=g$(t,e);e.deltaX=A,e.deltaY=v,e.offsetDirection=z4(e.deltaX,e.deltaY);const w=G4(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=w.x,e.overallVelocityY=w.y,e.overallVelocity=Math.abs(w.x)>Math.abs(w.y)?w.x:w.y,e.scale=o?m$(o.pointers,n):1,e.rotation=o?_$(o.pointers,n):0,e.maxPointers=t.prevInput?e.pointers.length>t.prevInput.maxPointers?e.pointers.length:t.prevInput.maxPointers:e.pointers.length;let S=r.element;return p$(e.srcEvent.target,S)&&(S=e.srcEvent.target),e.target=S,y$
1313(t,e),e}function b$(r,e,t){const n=t.pointers.length,i=t.changedPointers.length,s=e&As.Start&&n-i===0,o=e&(As.End|As.Cancel)&&n-i===0;t.isFirst=!!s,t.isFinal=!!o,s&&(r.session={}),t.eventType=e;const c=v$(r,t);r.emit("hammer.input",c),r.recognize(c),r.session.prevInput=c}let x$=class{constructor(e){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=t=>{this.manager.options.enable&&this.handler(t)},this.manager=e,this.element=e.element,this.target=e.options.inputTarget||e.element}callback(e,t){b$(this.manager,e,t)}init(){nb(this.element,this.evEl,this.domHandler),nb(this.target,this.evTarget,this.domHandler),nb(BS(this.element),this.evWin,this.domHandler)}destroy(){ib(this.element,this.evEl,this.domHandler),ib(this.target,this.evTarget,this.domHandler),ib(BS(this.element),this.evWin,this.domHandler)}};const w$={pointerdown:As.Start,pointermove:As.Move,pointerup:As.End,pointercancel:As.Cancel,pointerout:As.Cancel},C$="pointerdown",T$="pointermove pointerup pointercancel";class E$ extends x${constructor(e){super(e),this.evEl=C$,this.evWin=T$,this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){const{store:t}=this;let n=!1;const i=w$[e.type],s=e.pointerType,o=s==="touch";let c=t.findIndex(f=>f.pointerId===e.pointerId);i&As.Start&&(e.buttons||o)?c<0&&(t.push(e),c=t.length-1):i&(As.End|As.Cancel)&&(n=!0),!(c<0)&&(t[c]=e,this.callback(i,{pointers:t,changedPointers:[e],eventType:i,pointerType:s,srcEvent:e}),n&&t.splice(c,1))}}const B$=["","webkit","Moz","MS","ms","o"];function S$(r,e){const t=e[0].toUpperCase()+e.slice(1);for(const n of B$){const i=n?n+t:e;if(i in r)return i}}const I$=1,PS=2,RS={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}};let M$=class{constructor(e,t){this.options={...RS,...t,cssProps:{...RS.cssProps,...t.cssProps},inputTarget:t.inputTarget||e},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new E$(this),this.touchAction=new d$(this,this.options.touchAction),this.toggleCssProps(!0)}set(e){return Object.assign(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this}stop(e){this.session.stopped=e?PS:I$}recognize(e){const{session:t}=this;if(t.stopped)return;this.session.prevented&&e.srcEvent.preventDefault();let n;const{recognizers:i}=this;let{curRecognizer:s}=t;(!s||s&&s.state&yn.Recognized)&&(s=t.curRecognizer=null);let o=0;for(;o<i.length;)n=i[o],t.stopped!==PS&&(!s||n===s||n.canRecognizeWith(s))?n.recognize(e):n.reset(),!s&&n.state&(yn.Began|yn.Changed|yn.Ended)&&(s=t.curRecognizer=n),o++}get(e){const{recognizers:t}=this;for(let n=0;n<t.length;n++)if(t[n].options.event===e)return t[n];return null}add(e){if(Array.isArray(e)){for(const n of e)this.add(n);return this}const t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e}remove(e){if(Array.isArray(e)){for(const n of e)this.remove(n);return this}const t=typeof e=="string"?this.get(e):e;if(t){const{recognizers:n}=this,i=n.indexOf(t);i!==-1&&(n.splice(i,1),this.touchAction.update())}return this}on(e,t){if(!e||!t)return;const{handlers:n}=this;for(const i of w_(e))n[i]=n[i]||[],n[i].push(t)}off(e,t){if(!e)return;const{handlers:n}=this;for(const i of w_(e))t?n[i]&&n[i].splice(n[i].indexOf(t),1):delete n[i]}emit(e,t){const n=this.handlers[e]&&this.handlers[e].slice();if(!n||!n.length)return;const i=t;i.type=e,i.preventDefault=function(){t.srcEvent.preventDefault()};let s=0;for(;s<n.length;)n[s](i),s++}destroy(){this.toggleCssProps(!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}toggleCssProps(e){const{element:t}=this;if(t){for(const[n,i]of Object.entries(this.options.cssProps)){const s=S$(t.style,n);e?(this.oldCssProps[s]=t.style[s],t.style[s]=i):t.style[s]=this.oldCssProps[s]||""}e||(this.oldCssProps={})}}},P$=1;function R$(){return P$++}function FS(r){return r&yn.Cancelled?"cancel":r&yn.Ended?"end":r&yn.Changed?"move":r&yn.Began?"
1313start":""}class V4{constructor(e){this.options=e,this.id=R$(),this.state=yn.Possible,this.simultaneous={},this.requireFail=[]}set(e){return Object.assign(this.options,e),this.manager.touchAction.update(),this}recognizeWith(e){if(Array.isArray(e)){for(const i of e)this.recognizeWith(i);return this}let t;if(typeof e=="string"){if(t=this.manager.get(e),!t)throw new Error(`Cannot find recognizer ${e}`)}else t=e;const{simultaneous:n}=this;return n[t.id]||(n[t.id]=t,t.recognizeWith(this)),this}dropRecognizeWith(e){if(Array.isArray(e)){for(const n of e)this.dropRecognizeWith(n);return this}let t;return typeof e=="string"?t=this.manager.get(e):t=e,t&&delete this.simultaneous[t.id],this}requireFailure(e){if(Array.isArray(e)){for(const i of e)this.requireFailure(i);return this}let t;if(typeof e=="string"){if(t=this.manager.get(e),!t)throw new Error(`Cannot find recognizer ${e}`)}else t=e;const{requireFail:n}=this;return n.indexOf(t)===-1&&(n.push(t),t.requireFailure(this)),this}dropRequireFailure(e){if(Array.isArray(e)){for(const n of e)this.dropRequireFailure(n);return this}let t;if(typeof e=="string"?t=this.manager.get(e):t=e,t){const n=this.requireFail.indexOf(t);n>-1&&this.requireFail.splice(n,1)}return this}hasRequireFailures(){return!!this.requireFail.find(e=>e.options.enable)}canRecognizeWith(e){return!!this.simultaneous[e.id]}emit(e){if(!e)return;const{state:t}=this;t<yn.Ended&&this.manager.emit(this.options.event+FS(t),e),this.manager.emit(this.options.event,e),e.additionalEvent&&this.manager.emit(e.additionalEvent,e),t>=yn.Ended&&this.manager.emit(this.options.event+FS(t),e)}tryEmit(e){this.canEmit()?this.emit(e):this.state=yn.Failed}canEmit(){let e=0;for(;e<this.requireFail.length;){if(!(this.requireFail[e].state&(yn.Failed|yn.Possible)))return!1;e++}return!0}recognize(e){const t={...e};if(!this.options.enable){this.reset(),this.state=yn.Failed;return}this.state&(yn.Recognized|yn.Cancelled|yn.Failed)&&(this.state=yn.Possible),this.state=this.process(t),this.state&(yn.Began|yn.Changed|yn.Ended|yn.Cancelled)&&this.tryEmit(t)}getEventNames(){return[this.options.event]}reset(){}}class H4 extends V4{attrTest(e){const t=this.options.pointers;return t===0||e.pointers.length===t}process(e){const{state:t}=this,{eventType:n}=e,i=t&(yn.Began|yn.Changed),s=this.attrTest(e);return i&&(n&As.Cancel||!s)?t|yn.Cancelled:i||s?n&As.End?t|yn.Ended:t&yn.Began?t|yn.Changed:yn.Began:yn.Failed}}class DS extends V4{constructor(e={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...e}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[_2]}process(e){const{options:t}=this,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,s=e.deltaTime<t.time;if(this.reset(),e.eventType&As.Start&&this.count===0)return this.failTimeout();if(i&&s&&n){if(e.eventType!==As.End)return this.failTimeout();const o=this.pTime?e.timeStamp-this.pTime<t.interval:!0,c=!this.pCenter||U4(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!c||!o?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=yn.Recognized,this.tryEmit(this._input)},t.interval),yn.Began):yn.Recognized}return yn.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=yn.Failed},this.options.interval),yn.Failed}reset(){clearTimeout(this._timer)}emit(e){this.state===yn.Recognized&&(e.tapCount=this.count,this.manager.emit(this.options.event,e))}}const F$=["","start","move","end","cancel","up","down","left","right"];class OS extends H4{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:Cs.All,...e}),this.pX=null,this.pY=null}getTouchAction(){const{options:{direction:e}}=this,t=[];return e&Cs.Horizontal&&t.push(v2),e&Cs.Vertical&&t.push(y2),t}getEventNames(){return F$.map(e=>this.options.event+e)}directionTest(e){const{options:t}=this;let n=!0,{distance:i}=e,{direction:s}=e;const o=e.deltaX,c=e.deltaY;return s&t.direction||(t.direction&Cs.Horizontal?(s=o===0?Cs.None:o<0?Cs.Left:Cs.Right,n=o!==this.pX,i=Math.abs(e.deltaX)):(s=c===0?Cs.None:c<0?Cs.Up:Cs.Down,n=c!==this.pY,i=Math.abs(e.deltaY))),e.direction=s,n&&i>t.threshold&&!!(s&t.direction)}attrTest(e){return super.attrTest(e)&&(!!(this.state&yn.Began)||!(this.state&yn.Began)&&this.directionTest(e))}emit(e){this.pX=e.deltaX,this.pY=e.deltaY;
1313const t=Cs[e.direction].toLowerCase();t&&(e.additionalEvent=this.options.event+t),super.emit(e)}}const D$=["","start","move","end","cancel","in","out"];class O$ extends H4{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[G0]}getEventNames(){return D$.map(e=>this.options.event+e)}attrTest(e){return super.attrTest(e)&&(Math.abs(e.scale-1)>this.options.threshold||!!(this.state&yn.Began))}emit(e){if(e.scale!==1){const t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}super.emit(e)}}let fy=class{constructor(e,t,n){this.element=e,this.callback=t,this.options=n}};const L$=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",k$=L$.indexOf("firefox")!==-1,LS=4.000244140625,N$=40,U$=.25;let z$=class extends fy{constructor(e,t,n){super(e,t,{enable:!0,...n}),this.handleEvent=i=>{if(!this.options.enable)return;let s=i.deltaY;globalThis.WheelEvent&&(k$&&i.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(s/=globalThis.devicePixelRatio),i.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(s*=N$)),s!==0&&s%LS===0&&(s=Math.floor(s/LS)),i.shiftKey&&s&&(s=s*U$),this.callback({type:"wheel",center:{x:i.clientX,y:i.clientY},delta:-s,srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(e,t){e==="wheel"&&(this.options.enable=t)}};const kS=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"];let G$=class extends fy{constructor(e,t,n){super(e,t,{enable:!0,...n}),this.handleEvent=s=>{this.handleOverEvent(s),this.handleOutEvent(s),this.handleEnterEvent(s),this.handleLeaveEvent(s),this.handleMoveEvent(s)},this.pressed=!1;const{enable:i}=this.options;this.enableMoveEvent=i,this.enableLeaveEvent=i,this.enableEnterEvent=i,this.enableOutEvent=i,this.enableOverEvent=i,kS.forEach(s=>e.addEventListener(s,this.handleEvent))}destroy(){kS.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){switch(e){case"pointermove":this.enableMoveEvent=t;break;case"pointerover":this.enableOverEvent=t;break;case"pointerout":this.enableOutEvent=t;break;case"pointerenter":this.enableEnterEvent=t;break;case"pointerleave":this.enableLeaveEvent=t;break}}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit("pointerover",e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit("pointerout",e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit("pointerenter",e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit("pointerleave",e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.buttons===0&&(this.pressed=!1),this.pressed||this._emit("pointermove",e);break;case"mouseup":this.pressed=!1;break}}_emit(e,t){this.callback({type:e,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}};const NS=["keydown","keyup"];let V$=class extends fy{constructor(e,t,n){super(e,t,{enable:!0,tabIndex:0,...n}),this.handleEvent=i=>{const s=i.target||i.srcElement;s.tagName==="INPUT"&&s.type==="text"||s.tagName==="TEXTAREA"||(this.enableDownEvent&&i.type==="keydown"&&this.callback({type:"keydown",srcEvent:i,key:i.key,target:i.target}),this.enableUpEvent&&i.type==="keyup"&&this.callback({type:"keyup",srcEvent:i,key:i.key,target:i.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,e.tabIndex=this.options.tabIndex,e.style.outline="none",NS.forEach(i=>e.addEventListener(i,this.handleEvent))}destroy(){NS.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){e==="keydown"&&(this.enableDownEvent=t),e==="keyup"&&(this.enableUpEvent=t)}},H$=class extends fy{constructor(e,t,n){super(e,t,n),this.handleEvent=i=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:i.clientX,y:i.clientY},srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,t){e==="contextmenu"&&(this.options.enable=t)}};const US=1,b2=2,zS=4,j$={pointerdown:US,pointermove:b2,pointerup:zS,mousedown:US,mousemove:b2,mouseup:zS},$$=0,W$=1,J$=2,X$=1,K$=2,q$=4;function Y$(r){const e=j$[r.srcEvent.type];if(!e)return null;const{buttons:t,button:n}=r.srcEvent;let i=!1,s=!1,o=!1;return e===b2?(i=!!(t&X$),s=!!(t&q$),o=!!(t&K$)):(i=n===$$,s=n===W$,o=n===J$),{leftButton:i,middleButton:s,rightButton:o}}function Z$(r,e){const t=r.center;if(!t)return null;const n=e.getBoundingClientRect(),i=n.width/e.offsetWidth||1,s=n.height/e.offsetHeight||1,o={x:(t.x-n.left-e.clientLeft)/i,y:(t.y-n.top-e.clientTop)/s};return{center:t,offsetCenter:o}}const Q$={srcElement:"root",priority:0};let eW=class{constructor(e,t){this.handleEvent=n=>{if(this.isEmpty())return;const i=this._normalizeEvent(n);let s=n.srcEvent.target;for(;s&&s!==i.rootElement;){if(this._emit(i,s),i.handled)return;s=s.parentNode}this._emit(i,"root")},this.eventManager=e,this.recognizerName=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,t,n,i=!1,s=!1){const{handlers:o,handlersByElement:c}=this,f={...Q$,...n};let A=c.get(f.srcElement);A||(A=[],c.set(f.srcElement,A));const v={type:e,handler:t,srcElement:f.srcElement,priority:f.priority};i&&(v.once=!0),s&&(v.passive=!0),o.push(v),this._active=this._active||!v.passive;let w=A.length-1;for(;w>=0&&!(A[w].priority>=v.priority);)w--;A.splice(w+1,0,v)}remove(e,t){const{handlers:n,handlersByElement:i}=this;for(let s=n.length-1;s>=0;s--){const o=n[s];if(o.type===e&&o.handler===t){n.splice(s,1);const c=i.get(o.srcElement);c.splice(c.indexOf(o),1),c.length===0&&i.delete(o.srcElement)}}this._active=n.some(s=>!s.passive)}_emit(e,t){const n=this.handlersByElement.get(t);if(n){let i=!1;const s=()=>{e.handled=!0},o=()=>{e.handled=!0,i=!0},c=[];for(let f=0;f<n.length;f++){const{type:A,handler:v,once:w}=n[f];if(v({...e,type:A,stopPropagation:s,stopImmediatePropagation:o}),w&&c.push(n[f]),i)break}for(let f=0;f<c.length;f++){const{type:A,handler:v}=c[f];this.remove(A,v)}
1313}}_normalizeEvent(e){const t=this.eventManager.getElement();return{...e,...Y$(e),...Z$(e,t),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:t}}};function tW(r){if("recognizer"in r)return r;let e;const t=Array.isArray(r)?[...r]:[r];if(typeof t[0]=="function"){const n=t.shift(),i=t.shift()||{};e=new n(i)}else e=t.shift();return{recognizer:e,recognizeWith:typeof t[0]=="string"?[t[0]]:t[0],requireFailure:typeof t[1]=="string"?[t[1]]:t[1]}}let rW=class{constructor(e=null,t={}){if(this._onBasicInput=n=>{this.manager.emit(n.srcEvent.type,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...t},this.events=new Map,this.element=e,!!e){this.manager=new M$(e,this.options);for(const n of this.options.recognizers){const{recognizer:i,recognizeWith:s,requireFailure:o}=tW(n);this.manager.add(i),s&&i.recognizeWith(s),o&&i.requireFailure(o)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new z$(e,this._onOtherEvent,{enable:!1}),this.moveInput=new G$(e,this._onOtherEvent,{enable:!1}),this.keyInput=new V$(e,this._onOtherEvent,{enable:!1,tabIndex:t.tabIndex}),this.contextmenuInput=new H$(e,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}}getElement(){return this.element}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy())}on(e,t,n){this._addEventHandler(e,t,n,!1)}once(e,t,n){this._addEventHandler(e,t,n,!0)}watch(e,t,n){this._addEventHandler(e,t,n,!1,!0)}off(e,t){this._removeEventHandler(e,t)}_toggleRecognizer(e,t){const{manager:n}=this;if(!n)return;const i=n.get(e);i&&(i.set({enable:t}),n.touchAction.update()),this.wheelInput?.enableEventType(e,t),this.moveInput?.enableEventType(e,t),this.keyInput?.enableEventType(e,t),this.contextmenuInput?.enableEventType(e,t)}_addEventHandler(e,t,n,i,s){if(typeof e!="string"){n=t;for(const[A,v]of Object.entries(e))this._addEventHandler(A,v,n,i,s);return}const{manager:o,events:c}=this;if(!o)return;let f=c.get(e);if(!f){const A=this._getRecognizerName(e)||e;f=new eW(this,A),c.set(e,f),o&&o.on(e,f.handleEvent)}f.add(e,t,n,i,s),f.isEmpty()||this._toggleRecognizer(f.recognizerName,!0)}_removeEventHandler(e,t){if(typeof e!="string"){for(const[s,o]of Object.entries(e))this._removeEventHandler(s,o);return}const{events:n}=this,i=n.get(e);if(i&&(i.remove(e,t),i.isEmpty())){const{recognizerName:s}=i;let o=!1;for(const c of n.values())if(c.recognizerName===s&&!c.isEmpty()){o=!0;break}o||this._toggleRecognizer(s,!1)}}_getRecognizerName(e){return this.manager.recognizers.find(t=>t.getEventNames().includes(e))?.options.event}};const Qr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Qr,"IDENTITY",{get:()=>(Yr.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});const da={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},Po={common:0,meters:1,pixels:2},x2={click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},GS={multipan:[OS,{threshold:10,direction:Cs.Vertical,pointers:2}],pinch:[O$,{},null,["multipan"]],pan:[OS,{threshold:1},["pinch"],["multipan"]],dblclick:[DS,{event:"dblclick",taps:2}],click:[DS,{event:"click"},null,["dblclick"]]};function nW(r,e){if(r===e)return!0;if(Array.isArray(r)){const t=r.length;if(!e||e.length!==t)return!1;for(let n=0;n<t;n++)if(r[n]!==e[n])return!1;return!0}return!1}function kg(r){let e={},t;return n=>{for(const i in n)if(!nW(n[i],e[i])){t=r(n),e=n;break}return t}}const VS=[0,0,0,0],iW=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],j4=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],sW=[0,0,0],$4=[0,0,0],oW=kg(lW);function W4(r,e,t=$4){t.length<3&&(t=[t[0],t[1],0]);let n=t,i,s=!0;switch(e===Qr.LNGLAT_OFFSETS||e===Qr.METER_OFFSETS?i=t:i=r.isGeospatial?[Math.fround(r.longitude),Math.fround(r.latitude),0]:null,r.projectionMode){case da.WEB_MERCATOR:(e===Qr.LNGLAT||e===Qr.CARTESIAN)&&(i=[0,0,0],s=!1);break;case da.WEB_MERCATOR_AUTO_OFFSET:e===Qr.LNGLAT?n=i:e===Qr.CARTESIAN&&(n=[Math.fround(r.center[0]),Math.fround(r.center[1]),0],i=r.unprojectPosition(n),n[0]-=t[0],n[1]-=t[1],n[2]-=t[2]);break;case da.IDENTITY:n=r.position.map(Math.fround),n[2]=n[2]||0;break;case da.GLOBE:s=!1,i=null;break;default:s=!1}return{geospatialOrigin:i,shaderCoordinateOrigin:n,offsetMode:s}}function aW(r,e,t){const{viewMatrixUncentered:n,projectionMatrix:i}=r;let{viewMatrix:s,viewProjectionMatrix:o}=r,c=VS,f=VS,A=r.cameraPosition;const{geospatialOrigin:v,shaderCoordinateOrigin:w,offsetMode:S}=W4(r,e,t);return S&&(f=r.projectPosition(v||w),A=[A[0]-f[0],A[1]-f[1],A[2]-f[2]],f[3]=1,c=jp([],f,o),s=n||s,o=nh([],i,s),o=nh([],o,iW)),{viewMatrix:s,viewProjectionMatrix:o,projectionCenter:c,originCommon:f,cameraPosCommon:A,shaderCoordinateOrigin:w,geospatialOrigin:v}}function cW({viewport:r,devicePixelRatio:e=1,modelMatrix:t=null,coordinateSystem:n=Qr.DEFAULT,coordinateOrigin:i=$4,autoWrapLongitude:s=!1}){n===Qr.DEFAULT&&(n=r.isGeospatial?Qr.LNGLAT:Qr.CARTESIAN);const o=oW({viewport:r,devicePixelRatio:e,coordinateSystem:n,coordinateOrigin:i});return o.wrapLongitude=s,o.modelMatrix=t||j4,o}function lW({viewport:r,devicePixelRatio:e,coordinateSystem:t,coordinateOrigin:n}){const{projectionCenter:i,viewProjectionMatrix:s,originCommon:o,cameraPosCommon:c,shaderCoordinateOrigin:f,geospatialOrigin:A}=aW(r,t,n),v=r.getDistanceScales(),w=[r.width*e,r.height*e],S=jp([],[0,0,-r.focalDistance,1],r.projectionMatrix)[3]||1,F={coordinateSystem:t,projectionMode:r.projectionMode,coordinateOrigin:f,commonOrigin:o.slice(0,3),center:i,pseudoMeters:!!r._pseudoMeters,viewportSize:w,devicePixelRatio:e,focalDistance:S,commonUnitsPerMeter:v.unitsPerMeter,commonUnitsPerWorldUnit:v.unitsPerMeter,commonUnitsPerWorldUnit2:sW,scale:r.scale,wrapLongitude:!1,viewProjectionMatrix:s,modelMatrix:j4,cameraPosition:c};if(A){const N=r.getDistanceScales(A);switch(t){case Qr.METER_OFFSETS:F.commonUnitsPerWorldUnit=N.unitsPerMeter,F.commonUnitsPerWorldUnit2=N.unitsPerMeter2;break;case Qr.LNGLAT:case Qr.LNGLAT_OFFSETS:r._pseudoMeters||(F.commonUnitsPerMeter=N.unitsPerMeter),F.commonUnitsPerWorldUnit=N.unitsPerDegree,F.commonUnitsPerWorldUnit2=N.unitsPerDegree2;break;case Qr.CARTESIAN:F.commonUnitsPerWorldUnit=[1,1,N.unitsPerMeter[2]],F.
1313commonUnitsPerWorldUnit2=[0,0,N.unitsPerMeter2[2]];break}}return F}const uW=Object.keys(Qr).map(r=>`const COORDINATE_SYSTEM_${r}: i32 = ${Qr[r]};`).join(""),fW=Object.keys(da).map(r=>`const PROJECTION_MODE_${r}: i32 = ${da[r]};`).join(""),hW=Object.keys(Po).map(r=>`const UNIT_${r.toUpperCase()}: i32 = ${Po[r]};`).join(""),dW=`${uW}
1314${fW}
1315${hW}
1316
1317const TILE_SIZE: f32 = 512.0;
1318const PI: f32 = 3.1415926536;
1319const WORLD_SCALE: f32 = TILE_SIZE / (PI * 2.0);
1320const ZERO_64_LOW: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
1321const EARTH_RADIUS: f32 = 6370972.0; // meters
1322const GLOBE_RADIUS: f32 = 256.0;
1323
1324// -----------------------------------------------------------------------------
1325// Uniform block (converted from GLSL uniform block)
1326// -----------------------------------------------------------------------------
1327struct ProjectUniforms {
1328  wrapLongitude: i32,
1329  coordinateSystem: i32,
1330  commonUnitsPerMeter: vec3<f32>,
1331  projectionMode: i32,
1332  scale: f32,
1333  commonUnitsPerWorldUnit: vec3<f32>,
1334  commonUnitsPerWorldUnit2: vec3<f32>,
1335  center: vec4<f32>,
1336  modelMatrix: mat4x4<f32>,
1337  viewProjectionMatrix: mat4x4<f32>,
1338  viewportSize: vec2<f32>,
1339  devicePixelRatio: f32,
1340  focalDistance: f32,
1341  cameraPosition: vec3<f32>,
1342  coordinateOrigin: vec3<f32>,
1343  commonOrigin: vec3<f32>,
1344  pseudoMeters: i32,
1345};
1346
1347@group(0) @binding(0)
1348var<uniform> project: ProjectUniforms;
1349
1350// -----------------------------------------------------------------------------
1351// Geometry data
1352// (In your GLSL code, "geometry" was assumed to be available globally. In WGSL,
1353// you might supply this via vertex attributes or a uniform. Here we define a
1354// uniform struct for demonstration.)
1355// -----------------------------------------------------------------------------
1356
1357// Structure to carry additional geometry data used by deck.gl filters.
1358struct Geometry {
1359  worldPosition: vec3<f32>,
1360  worldPositionAlt: vec3<f32>,
1361  position: vec4<f32>,
1362  uv: vec2<f32>,
1363  pickingColor: vec3<f32>,
1364};
1365
1366// @group(0) @binding(1)
1367var<private> geometry: Geometry;
1368`,pW=`${dW}
1369
1370// -----------------------------------------------------------------------------
1371// Functions
1372// -----------------------------------------------------------------------------
1373
1374// Returns an adjustment factor for commonUnitsPerMeter
1375fn _project_size_at_latitude(lat: f32) -> f32 {
1376  let y = clamp(lat, -89.9, 89.9);
1377  return 1.0 / cos(radians(y));
1378}
1379
1380// Overloaded version: scales a value in meters at a given latitude.
1381fn _project_size_at_latitude_m(meters: f32, lat: f32) -> f32 {
1382  return meters * project.commonUnitsPerMeter.z * _project_size_at_latitude(lat);
1383}
1384
1385// Computes a non-linear scale factor based on geometry.
1386// (Note: This function relies on "geometry" being provided.)
1387fn project_size() -> f32 {
1388  if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&
1389      project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&
1390      project.pseudoMeters == 0) {
1391    if (geometry.position.w == 0.0) {
1392      return _project_size_at_latitude(geometry.worldPosition.y);
1393    }
1394    let y: f32 = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
1395    let y2 = y * y;
1396    let y4 = y2 * y2;
1397    let y6 = y4 * y2;
1398    return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
1399  }
1400  return 1.0;
1401}
1402
1403// Overloads to scale offsets (meters to world units)
1404fn project_size_float(meters: f32) -> f32 {
1405  return meters * project.commonUnitsPerMeter.z * project_size();
1406}
1407
1408fn project_size_vec2(meters: vec2<f32>) -> vec2<f32> {
1409  return meters * project.commonUnitsPerMeter.xy * project_size();
1410}
1411
1412fn project_size_vec3(meters: vec3<f32>) -> vec3<f32> {
1413  return meters * project.commonUnitsPerMeter * project_size();
1414}
1415
1416fn project_size_vec4(meters: vec4<f32>) -> vec4<f32> {
1417  return vec4<f32>(meters.xyz * project.commonUnitsPerMeter, meters.w);
1418}
1419
1420// Returns a rotation matrix aligning the z‑axis with the given up vector.
1421fn project_get_orientation_matrix(up: vec3<f32>) -> mat3x3<f32> {
1422  let uz = normalize(up);
1423  let ux = select(
1424    vec3<f32>(1.0, 0.0, 0.0),
1425    normalize(vec3<f32>(uz.y, -uz.x, 0.0)),
1426    abs(uz.z) == 1.0
1427  );
1428  let uy = cross(uz, ux);
1429  return mat3x3<f32>(ux, uy, uz);
1430}
1431
1432// Since WGSL does not support "out" parameters, we return a struct.
1433struct RotationResult {
1434  needsRotation: bool,
1435  transform: mat3x3<f32>,
1436};
1437
1438fn project_needs_rotation(commonPosition: vec3<f32>) -> RotationResult {
1439  if (project.projectionMode == PROJECTION_MODE_GLOBE) {
1440    return RotationResult(true, project_get_orientation_matrix(commonPosition));
1441  } else {
1442    return RotationResult(false, mat3x3<f32>());  // identity alternative if needed
1443  };
1444}
1445
1446// Projects a normal vector from the current coordinate system to world space.
1447fn project_normal(vector: vec3<f32>) -> vec3<f32> {
1448  let normal_modelspace = project.modelMatrix * vec4<f32>(vector, 0.0);
1449  var n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);
1450  let rotResult = project_needs_rotation(geometry.position.xyz);
1451  if (rotResult.needsRotation) {
1452    n = rotResult.transform * n;
1453  }
1454  return n;
1455}
1456
1457// Applies a scale offset based on y-offset (dy)
1458fn project_offset_(offset: vec4<f32>) -> vec4<f32> {
1459  let dy: f32 = offset.y;
1460  let commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;
1461  return vec4<f32>(offset.xyz * commonUnitsPerWorldUnit, offset.w);
1462}
1463
1464// Projects lng/lat coordinates to a unit tile [0,1]
1465fn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> {
1466  var x = lnglat.x;
1467  if (project.wrapLongitude != 0) {
1468    x = ((x + 180.0) % 360.0) - 180.0;
1469  }
1470  let y = clamp(lnglat.y, -89.9, 89.9);
1471  return vec2<f32>(
1472    radians(x) + PI,
1473    PI + log(tan(PI * 0.25 + radians(y) * 0.5))
1474  ) * WORLD_SCALE;
1475}
1476
1477// Projects lng/lat/z coordinates for a globe projection.
1478fn project_globe_(lnglatz: vec3<f32>) -> vec3<f32> {
1479  let lambda = radians(lnglatz.x);
1480  let phi = radians(lnglatz.y);
1481  let cosPhi = cos(phi);
1482  let D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;
1483  return vec3<f32>(
1484    sin(lambda) * cosPhi,
1485    -cos(lambda) * cosPhi,
1486    sin(phi)
1487  ) * D;
1488}
1489
1490// Projects positions (with an optional 64-bit low part) from the input
1491// coordinate system to the common space.
1492fn project_position_vec4_f64(position: vec4<f32>, position64Low: vec3<f32>) -> vec4<f32> {
1493  var position_world = project.modelMatrix * position;
1494
1495  // Work around for a Mac+NVIDIA bug:
1496  if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {
1497    if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
1498      return vec4<f32>(
1499        project_mercator_(position_world.xy),
1500        _project_size_at_latitude_m(position_world.z, position_world.y),
1501        position_world.w
1502      );
1503    }
1504    if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
1505      position_world = vec4f(position_world.xyz + project.coordinateOrigin, position_world.w);
1506    }
1507  }
1508  if (project.projectionMode == PROJECTION_MODE_GLOBE) {
1509    if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
1510      return vec4<f32>(
1511        project_globe_(position_world.xyz),
1512        position_world.w
1513      );
1514    }
1515  }
1516  if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
1517    if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
1518      if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {
1519        return vec4<f32>(
1520          project_mercator_(position_world.xy) - project.commonOrigin.xy,
1521          project_size_float(position_world.z),
1522          position_world.w
1523        );
1524      }
1525    }
1526  }
1527  if (project.projectionMode == PROJECTION_MODE_IDENTITY ||
1528      (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&
1529       (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
1530        project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
1531    position_world = vec4f(position_world.xyz - project.coordinateOrigin, position_world.w);
1532  }
1533
1534  return project_offset_(position_world) +
1535         project_offset_(project.modelMatrix * vec4<f32>(position64Low, 0.0));
1536}
1537
1538// Overloaded versions for different input types.
1539fn project_position_vec4_f32(position: vec4<f32>) -> vec4<f32> {
1540  return project_position_vec4_f64(position, ZERO_64_LOW);
1541}
1542
1543fn project_position_vec3_f64(position: vec3<f32>, position64Low: vec3<f32>) -> vec3<f32> {
1544  let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), position64Low);
1545  return projected_position.xyz;
1546}
1547
1548fn project_position_vec3_f32(position: vec3<f32>) -> vec3<f32> {
1549  let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), ZERO_64_LOW);
1550  return projected_position.xyz;
1551}
1552
1553fn project_position_vec2_f32(position: vec2<f32>) -> vec2<f32> {
1554  let projected_position = project_position_vec4_f64(vec4<f32>(position, 0.0, 1.0), ZERO_64_LOW);
1555  return projected_position.xy;
1556}
1557
1558// Transforms a common space position to clip space.
1559fn project_common_position_to_clipspace_with_projection(position: vec4<f32>, viewProjectionMatrix: mat4x4<f32>, center: vec4<f32>) -> vec4<f32> {
1560  return viewProjectionMatrix * position + center;
1561}
1562
1563// Uses the project viewProjectionMatrix and center.
1564fn project_common_position_to_clipspace(position: vec4<f32>) -> vec4<f32> {
1565  return project_common_position_to_clipspace_with_projection(position, project.viewProjectionMatrix, project.center);
1566}
1567
1568// Returns a clip space offset corresponding to a given number of screen pixels.
1569fn project_pixel_size_to_clipspace(pixels: vec2<f32>) -> vec2<f32> {
1570  let offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;
1571  return offset * project.focalDistance;
1572}
1573
1574fn project_meter_size_to_pixel(meters: f32) -> f32 {
1575  return project_size_float(meters) * project.scale;
1576}
1577
1578fn project_unit_size_to_pixel(size: f32, unit: i32) -> f32 {
1579  if (unit == UNIT_METERS) {
1580    return project_meter_size_to_pixel(size);
1581  } else if (unit == UNIT_COMMON) {
1582    return size * project.scale;
1583  }
1584  // UNIT_PIXELS: no scaling applied.
1585  return size;
1586}
1587
1588fn project_pixel_size_float(pixels: f32) -> f32 {
1589  return pixels / project.scale;
1590}
1591
1592fn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> {
1593  return pixels / project.scale;
1594}
1595`,AW=Object.keys(Qr).map(r=>`const int COORDINATE_SYSTEM_${r} = ${Qr[r]};`).join(""),gW=Object.keys(da).map(r=>`const int PROJECTION_MODE_${r} = ${da[r]};`).join(""),mW=Object.keys(Po).map(r=>`const int UNIT_${r.toUpperCase()} = ${Po[r]};`).join(""),_W=`${AW}
1596${gW}
1597${mW}
vendor: 5,730 bytes, lines 1598-1774
1598uniform projectUniforms {
1599bool wrapLongitude;
1600int coordinateSystem;
1601vec3 commonUnitsPerMeter;
1602int projectionMode;
1603float scale;
1604vec3 commonUnitsPerWorldUnit;
1605vec3 commonUnitsPerWorldUnit2;
1606vec4 center;
1607mat4 modelMatrix;
1608mat4 viewProjectionMatrix;
1609vec2 viewportSize;
1610float devicePixelRatio;
1611float focalDistance;
1612vec3 cameraPosition;
1613vec3 coordinateOrigin;
1614vec3 commonOrigin;
1615bool pseudoMeters;
1616} project;
1617const float TILE_SIZE = 512.0;
1618const float PI = 3.1415926536;
1619const float WORLD_SCALE = TILE_SIZE / (PI * 2.0);
1620const vec3 ZERO_64_LOW = vec3(0.0);
1621const float EARTH_RADIUS = 6370972.0;
1622const float GLOBE_RADIUS = 256.0;
1623float project_size_at_latitude(float lat) {
1624float y = clamp(lat, -89.9, 89.9);
1625return 1.0 / cos(radians(y));
1626}
1627float project_size() {
1628if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&
1629project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&
1630project.pseudoMeters == false) {
1631if (geometry.position.w == 0.0) {
1632return project_size_at_latitude(geometry.worldPosition.y);
1633}
1634float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
1635float y2 = y * y;
1636float y4 = y2 * y2;
1637float y6 = y4 * y2;
1638return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
1639}
1640return 1.0;
1641}
1642float project_size_at_latitude(float meters, float lat) {
1643return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat);
1644}
1645float project_size(float meters) {
1646return meters * project.commonUnitsPerMeter.z * project_size();
1647}
1648vec2 project_size(vec2 meters) {
1649return meters * project.commonUnitsPerMeter.xy * project_size();
1650}
1651vec3 project_size(vec3 meters) {
1652return meters * project.commonUnitsPerMeter * project_size();
1653}
1654vec4 project_size(vec4 meters) {
1655return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w);
1656}
1657mat3 project_get_orientation_matrix(vec3 up) {
1658vec3 uz = normalize(up);
1659vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));
1660vec3 uy = cross(uz, ux);
1661return mat3(ux, uy, uz);
1662}
1663bool project_needs_rotation(vec3 commonPosition, out mat3 transform) {
1664if (project.projectionMode == PROJECTION_MODE_GLOBE) {
1665transform = project_get_orientation_matrix(commonPosition);
1666return true;
1667}
1668return false;
1669}
1670vec3 project_normal(vec3 vector) {
1671vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0);
1672vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);
1673mat3 rotation;
1674if (project_needs_rotation(geometry.position.xyz, rotation)) {
1675n = rotation * n;
1676}
1677return n;
1678}
1679vec4 project_offset_(vec4 offset) {
1680float dy = offset.y;
1681vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;
1682return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);
1683}
1684vec2 project_mercator_(vec2 lnglat) {
1685float x = lnglat.x;
1686if (project.wrapLongitude) {
1687x = mod(x + 180., 360.0) - 180.;
1688}
1689float y = clamp(lnglat.y, -89.9, 89.9);
1690return vec2(
1691radians(x) + PI,
1692PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))
1693) * WORLD_SCALE;
1694}
1695vec3 project_globe_(vec3 lnglatz) {
1696float lambda = radians(lnglatz.x);
1697float phi = radians(lnglatz.y);
1698float cosPhi = cos(phi);
1699float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;
1700return vec3(
1701sin(lambda) * cosPhi,
1702-cos(lambda) * cosPhi,
1703sin(phi)
1704) * D;
1705}
1706vec4 project_position(vec4 position, vec3 position64Low) {
1707vec4 position_world = project.modelMatrix * position;
1708if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {
1709if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
1710return vec4(
1711project_mercator_(position_world.xy),
1712project_size_at_latitude(position_world.z, position_world.y),
1713position_world.w
1714);
1715}
1716if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
1717position_world.xyz += project.coordinateOrigin;
1718}
1719}
1720if (project.projectionMode == PROJECTION_MODE_GLOBE) {
1721if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
1722return vec4(
1723project_globe_(position_world.xyz),
1724position_world.w
1725);
1726}
1727}
1728if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
1729if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
1730if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {
1731return vec4(
1732project_mercator_(position_world.xy) - project.commonOrigin.xy,
1733project_size(position_world.z),
1734position_world.w
1735);
1736}
1737}
1738}
1739if (project.projectionMode == PROJECTION_MODE_IDENTITY ||
1740(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&
1741(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
1742project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
1743position_world.xyz -= project.coordinateOrigin;
1744}
1745return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0));
1746}
1747vec4 project_position(vec4 position) {
1748return project_position(position, ZERO_64_LOW);
1749}
1750vec3 project_position(vec3 position, vec3 position64Low) {
1751vec4 projected_position = project_position(vec4(position, 1.0), position64Low);
1752return projected_position.xyz;
1753}
1754vec3 project_position(vec3 position) {
1755vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);
1756return projected_position.xyz;
1757}
1758vec2 project_position(vec2 position) {
1759vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);
1760return projected_position.xy;
1761}
1762vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
1763return viewProjectionMatrix * position + center;
1764}
1765vec4 project_common_position_to_clipspace(vec4 position) {
1766return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center);
1767}
1768vec2 project_pixel_size_to_clipspace(vec2 pixels) {
1769vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;
1770return offset * project.focalDistance;
1771}
1772float project_size_to_pixel(float meters) {
1773return project_size(meters) * project.scale;
1774}
1775float project_size_to_pixel(float size, int unit) {
1776if (unit == UNIT_METERS) return project_size_to_pixel(size);
1777if (unit == UNIT_COMMON) return size * project.scale;
1778return size;
1779}
1780float project_pixel_size(float pixels) {
1781return pixels / project.scale;
1782}
1783vec2 project_pixel_size(vec2 pixels) {
1784return pixels / project.scale;
1785}
1786`,yW={};function vW(r=yW){return"viewport"in r?cW(r):{}}const hy={name:"project",dependencies:[Hj,k4],source:pW,vs:_W,getUniforms:vW,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"}},bW=`// Define a structure to hold both the clip-space position and the common position.
1787struct ProjectResult {
1788  clipPosition: vec4<f32>,
1789  commonPosition: vec4<f32>,
1790};
1791
1792// This function mimics the GLSL version with the 'out' parameter by returning both values.
1793fn project_position_to_clipspace_and_commonspace(
1794    position: vec3<f32>,
1795    position64Low: vec3<f32>,
1796    offset: vec3<f32>
1797) -> ProjectResult {
1798  // Compute the projected position.
1799  let projectedPosition: vec3<f32> = project_position_vec3_f64(position, position64Low);
1800
1801  // Start with the provided offset.
1802  var finalOffset: vec3<f32> = offset;
1803
1804  // Get whether a rotation is needed and the rotation matrix.
1805  let rotationResult = project_needs_rotation(projectedPosition);
1806
1807  // If rotation is needed, update the offset.
1808  if (rotationResult.needsRotation) {
1809    finalOffset = rotationResult.transform * offset;
1810  }
1811
1812  // Compute the common position.
1813  let commonPosition: vec4<f32> = vec4<f32>(projectedPosition + finalOffset, 1.0);
1814
1815  // Convert to clip-space.
1816  let clipPosition: vec4<f32> = project_common_position_to_clipspace(commonPosition);
1817
1818  return ProjectResult(clipPosition, commonPosition);
1819}
1820
1821// A convenience overload that returns only the clip-space position.
1822fn project_position_to_clipspace(
1823    position: vec3<f32>,
1824    position64Low: vec3<f32>,
1825    offset: vec3<f32>
1826) -> vec4<f32> {
1827  return project_position_to_clipspace_and_commonspace(position, position64Low, offset).clipPosition;
1828}
1829`,xW=`vec4 project_position_to_clipspace(
1830  vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition
1831) {
1832  vec3 projectedPosition = project_position(position, position64Low);
1833  mat3 rotation;
1834  if (project_needs_rotation(projectedPosition, rotation)) {
1835    // offset is specified as ENU
1836    // when in globe projection, rotate offset so that the ground alighs with the surface of the globe
1837    offset = rotation * offset;
1838  }
1839  commonPosition = vec4(projectedPosition + offset, 1.0);
1840  return project_common_position_to_clipspace(commonPosition);
1841}
1842
1843vec4 project_position_to_clipspace(
1844  vec3 position, vec3 position64Low, vec3 offset
1845) {
1846  vec4 commonPosition;
1847  return project_position_to_clipspace(position, position64Low, offset, commonPosition);
1848}
1849`,Ls={name:"project32",dependencies:[hy],source:bW,vs:xW};function wW(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function _p(r,e){const t=jp([],e,r);return Cw(t,t,1/t[3]),t}function HS(r,e){const t=r%e;return t<0?e+t:t}function w2(r,e,t){return r<e?e:r>t?t:r}function CW(r){return Math.log(r)*Math.LOG2E}const Bw=Math.log2||CW;function Ql(r,e){if(!r)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const yc=Math.PI,J4=yc/4,Ha=yc/180,C2=180/yc,Mp=512,C_=4003e4,ip=85.051129,TW=1.5;function EW(r){return Bw(r)}function eu(r){const[e,t]=r;Ql(Number.isFinite(e)),Ql(Number.isFinite(t)&&t>=-90&&t<=90,"invalid latitude");const n=e*Ha,i=t*Ha,s=Mp*(n+yc)/(2*yc),o=Mp*(yc+Math.log(Math.tan(J4+i*.5)))/(2*yc);return[s,o]}function hl(r){const[e,t]=r,n=e/Mp*(2*yc)-yc,i=2*(Math.atan(Math.exp(t/Mp*(2*yc)-yc))-J4);return[n*C2,i*C2]}function BW(r){const{latitude:e}=r;Ql(Number.isFinite(e));const t=Math.cos(e*Ha);return EW(C_*t)-9}
1849function sb(r){const e=Math.cos(r*Ha);return Mp/C_/e}function T2(r){const{latitude:e,longitude:t,highPrecision:n=!1}=r;Ql(Number.isFinite(e)&&Number.isFinite(t));const i=Mp,s=Math.cos(e*Ha),o=i/360,c=o/s,f=i/C_/s,A={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[o,c,f],degreesPerUnit:[1/o,1/c,1/f]};if(n){const v=Ha*Math.tan(e*Ha)/s,w=o*v/2,S=i/C_*v,F=S/c*f;A.unitsPerDegree2=[0,w,S],A.unitsPerMeter2=[F,0,F]}return A}function X4(r,e){const[t,n,i]=r,[s,o,c]=e,{unitsPerMeter:f,unitsPerMeter2:A}=T2({longitude:t,latitude:n,highPrecision:!0}),v=eu(r);v[0]+=s*(f[0]+A[0]*o),v[1]+=o*(f[1]+A[1]*o);const w=hl(v),S=(i||0)+(c||0);return Number.isFinite(i)||Number.isFinite(c)?[w[0],w[1],S]:w}function SW(r){const{height:e,pitch:t,bearing:n,altitude:i,scale:s,center:o}=r,c=wW();x_(c,c,[0,0,-i]),T4(c,c,-t*Ha),E4(c,c,n*Ha);const f=s/e;return ww(c,c,[f,f,f]),o&&x_(c,c,RH([],o)),c}function IW(r){const{width:e,height:t,altitude:n,pitch:i=0,offset:s,center:o,scale:c,nearZMultiplier:f=1,farZMultiplier:A=1}=r;let{fovy:v=xg(TW)}=r;n!==void 0&&(v=xg(n));const w=v*Ha,S=i*Ha,F=Sw(v);let N=F;o&&(N+=o[2]*c/Math.cos(S)/t);const U=w*(.5+(s?s[1]:0)/t),$=Math.sin(U)*N/Math.sin(w2(Math.PI/2-S-U,.01,Math.PI-.01)),G=Math.sin(S)*$+N,H=N*10,J=Math.min(G*A,H);return{fov:w,aspect:e/t,focalDistance:F,near:f,far:J}}function xg(r){return 2*Math.atan(.5/r)*C2}function Sw(r){return .5/Math.tan(.5*r*Ha)}function K4(r,e){const[t,n,i=0]=r;return Ql(Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)),_p(e,[t,n,i,1])}function Iw(r,e,t=0){const[n,i,s]=r;if(Ql(Number.isFinite(n)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(s))return _p(e,[n,i,s,1]);const o=_p(e,[n,i,0,1]),c=_p(e,[n,i,1,1]),f=o[2],A=c[2],v=f===A?0:((t||0)-f)/(A-f);return h4([],o,c,v)}function MW(r){const{width:e,height:t,bounds:n,minExtent:i=0,maxZoom:s=24,offset:o=[0,0]}=r,[[c,f],[A,v]]=n,w=PW(r.padding),S=eu([c,w2(v,-ip,ip)]),F=eu([A,w2(f,-ip,ip)]),N=[Math.max(Math.abs(F[0]-S[0]),i),Math.max(Math.abs(F[1]-S[1]),i)],U=[e-w.left-w.right-Math.abs(o[0])*2,t-w.top-w.bottom-Math.abs(o[1])*2];Ql(U[0]>0&&U[1]>0);const $=U[0]/N[0],G=U[1]/N[1],H=(w.right-w.left)/2/$,J=(w.top-w.bottom)/2/G,ue=[(F[0]+S[0])/2+H,(F[1]+S[1])/2+J],q=hl(ue),se=Math.min(s,Bw(Math.abs(Math.min($,G))));return Ql(Number.isFinite(se)),{longitude:q[0],latitude:q[1],zoom:se}}function PW(r=0){return typeof r=="number"?{top:r,bottom:r,left:r,right:r}:(Ql(Number.isFinite(r.top)&&Number.isFinite(r.bottom)&&Number.isFinite(r.left)&&Number.isFinite(r.right)),r)}const jS=Math.PI/180;function RW(r,e=0){const{width:t,height:n,unproject:i}=r,s={targetZ:e},o=i([0,n],s),c=i([t,n],s);let f,A;const v=r.fovy?.5*r.fovy*jS:Math.atan(.5/r.altitude),w=(90-r.pitch)*jS;return v>w-.01?(f=$S(r,0,e),A=$S(r,t,e)):(f=i([0,0],s),A=i([t,0],s)),[o,c,A,f]}function $S(r,e,t){const{pixelUnprojectionMatrix:n}=r,i=_p(n,[e,0,1,1]),s=_p(n,[e,r.height,1,1]),c=(t*r.distanceScales.unitsPerMeter[2]-i[2])/(s[2]-i[2]),f=h4([],i,s,c),A=hl(f);return A.push(t),A}const WS=512;function FW(r){const{width:e,height:t,pitch:n=0}=r;let{longitude:i,latitude:s,zoom:o,bearing:c=0}=r;(i<-180||i>180)&&(i=HS(i+180,360)-180),(c<-180||c>180)&&(c=HS(c+180,360)-180);const f=Bw(t/WS);if(o<=f)o=f,s=0;else{const A=t/2/Math.pow(2,o),v=hl([0,A])[1];if(s<v)s=v;else{const w=hl([0,WS-A])[1];s>w&&(s=w)}}return{width:e,height:t,longitude:i,latitude:s,zoom:o,pitch:n,bearing:c}}const q4=`
1850uniform shadowUniforms {
1851  bool drawShadowMap;
1852  bool useShadowMap;
1853  vec4 color;
1854  highp int lightId;
1855  float lightCount;
1856  mat4 viewProjectionMatrix0;
1857  mat4 viewProjectionMatrix1;
1858  vec4 projectCenter0;
1859  vec4 projectCenter1;
1860} shadow;
1861`,DW=`
1862const int max_lights = 2;
1863
1864out vec3 shadow_vPosition[max_lights];
1865
1866vec4 shadow_setVertexPosition(vec4 position_commonspace) {
1867  mat4 viewProjectionMatrices[max_lights];
1868  viewProjectionMatrices[0] = shadow.viewProjectionMatrix0;
1869  viewProjectionMatrices[1] = shadow.viewProjectionMatrix1;
1870  vec4 projectCenters[max_lights];
1871  projectCenters[0] = shadow.projectCenter0;
1872  projectCenters[1] = shadow.projectCenter1;
1873
1874  if (shadow.drawShadowMap) {
1875    return project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[shadow.lightId], projectCenters[shadow.lightId]);
1876  }
1877  if (shadow.useShadowMap) {
1878    for (int i = 0; i < max_lights; i++) {
1879      if(i < int(shadow.lightCount)) {
1880        vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[i], projectCenters[i]);
1881        shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;
1882      }
1883    }
1884  }
1885  return gl_Position;
1886}
1887`,OW=`
1888${q4}
1889${DW}
1890`,LW=`
1891const int max_lights = 2;
1892uniform sampler2D shadow_uShadowMap0;
1893uniform sampler2D shadow_uShadowMap1;
1894
1895in vec3 shadow_vPosition[max_lights];
1896
1897const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);
1898const vec4 bitUnpackShift = 1.0 / bitPackShift;
1899const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0,  0.0);
1900
1901float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {
1902  vec4 rgbaDepth = texture(shadowMap, position.xy);
1903
1904  float z = dot(rgbaDepth, bitUnpackShift);
1905  return smoothstep(0.001, 0.01, position.z - z);
1906}
1907
1908vec4 shadow_filterShadowColor(vec4 color) {
1909  if (shadow.drawShadowMap) {
1910    vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);
1911    rgbaDepth -= rgbaDepth.gbaa * bitMask;
1912    return rgbaDepth;
1913  }
1914  if (shadow.useShadowMap) {
1915    float shadowAlpha = 0.0;
1916    shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);
1917    if(shadow.lightCount > 1.0) {
1918      shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);
1919    }
1920    shadowAlpha *= shadow.color.a / shadow.lightCount;
1921    float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);
1922
1923    return vec4(
1924      mix(color.rgb, shadow.color.rgb, shadowAlpha / blendedAlpha),
1925      blendedAlpha
1926    );
1927  }
1928  return color;
1929}
1930`,kW=`
1931${q4}
1932${LW}
1933`,NW=kg(HW),UW=kg(jW),zW=[0,0,0,1],GW=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function VW(r,e){const[t,n,i]=r,s=Iw([t,n,i],e);return Number.isFinite(i)?s:[s[0],s[1],0]}function HW({viewport:r,center:e}){return new vn(r.viewProjectionMatrix).invert().transform(e)}function jW({viewport:r,shadowMatrices:e}){const t=[],n=r.pixelUnprojectionMatrix,i=r.isGeospatial?void 0:1,s=[[0,0,i],[r.width,0,i],[0,r.height,i],[r.width,r.height,i],[0,0,-1],[r.width,0,-1],[0,r.height,-1],[r.width,r.height,-1]].map(o=>VW(o,n));for(const o of e){const c=o.clone().translate(new dt(r.center).negate()),f=s.map(v
1933=>c.transform(v)),A=new vn().ortho({left:Math.min(...f.map(v=>v[0])),right:Math.max(...f.map(v=>v[0])),bottom:Math.min(...f.map(v=>v[1])),top:Math.max(...f.map(v=>v[1])),near:Math.min(...f.map(v=>-v[2])),far:Math.max(...f.map(v=>-v[2]))});t.push(A.multiplyRight(o))}return t}function $W(r){const{shadowEnabled:e=!0,project:t}=r;if(!e||!t||!r.shadowMatrices||!r.shadowMatrices.length)return{drawShadowMap:!1,useShadowMap:!1,shadow_uShadowMap0:r.dummyShadowMap,shadow_uShadowMap1:r.dummyShadowMap};const n=hy.getUniforms(t),i=NW({viewport:t.viewport,center:n.center}),s=[],o=UW({shadowMatrices:r.shadowMatrices,viewport:t.viewport}).slice();for(let f=0;f<r.shadowMatrices.length;f++){const A=o[f],v=A.clone().translate(new dt(t.viewport.center).negate());n.coordinateSystem===Qr.LNGLAT&&n.projectionMode===da.WEB_MERCATOR?(o[f]=v,s[f]=i):(o[f]=A.clone().multiplyRight(GW),s[f]=v.transform(i))}const c={drawShadowMap:!!r.drawToShadowMap,useShadowMap:r.shadowMaps?r.shadowMaps.length>0:!1,color:r.shadowColor||zW,lightId:r.shadowLightId||0,lightCount:r.shadowMatrices.length,shadow_uShadowMap0:r.dummyShadowMap,shadow_uShadowMap1:r.dummyShadowMap};for(let f=0;f<o.length;f++)c[`viewProjectionMatrix${f}`]=o[f],c[`projectCenter${f}`]=s[f];for(let f=0;f<2;f++)c[`shadow_uShadowMap${f}`]=r.shadowMaps&&r.shadowMaps[f]||r.dummyShadowMap;return c}const JS={name:"shadow",dependencies:[hy],vs:OW,fs:kW,inject:{"vs:DECKGL_FILTER_GL_POSITION":`
1934    position = shadow_setVertexPosition(geometry.position);
1935    `,"fs:DECKGL_FILTER_COLOR":`
1936    color = shadow_filterShadowColor(color);
1937    `},getUniforms:$W,uniformTypes:{drawShadowMap:"f32",useShadowMap:"f32",color:"vec4<f32>",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4<f32>",viewProjectionMatrix1:"mat4x4<f32>",projectCenter0:"vec4<f32>",projectCenter1:"vec4<f32>"}},_a={...wS,defaultUniforms:{...wS.defaultUniforms,useFloatColors:!1},inject:{"vs:DECKGL_FILTER_GL_POSITION":`
1938    // for picking depth values
1939    picking_setPickingAttribute(position.z / position.w);
1940  `,"vs:DECKGL_FILTER_COLOR":`
1941  picking_setPickingColor(geometry.pickingColor);
1942  `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:`
1943  // use highlight color if this fragment belongs to the selected object.
1944  color = picking_filterHighlightColor(color);
1945
1946  // use picking color if rendering to picking FBO.
1947  color = picking_filterPickingColor(color);
1948    `}}},WW=[k4],JW=["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)"],XW=[];function KW(r){const e=qf.getDefaultShaderAssembler();for(const n of WW)e.addDefaultModule(n);const t=r==="glsl"?JW:XW;for(const n of t)e.addShaderHook(n);return e}const qW=[255,255,255],YW=1;let ZW=0;class QW{constructor(e={}){this.type="ambient";const{color:t=qW}=e,{intensity:n=YW}=e;this.id=e.id||`ambient-${ZW++}`,this.color=t,this.intensity=n}}const eJ=[255,255,255],tJ=1,rJ=[0,0,-1];let nJ=0;class XS{constructor(e={}){this.type="directional";const{color:t=eJ}=e,{intensity:n=tJ}=e,{direction:i=rJ}=e,{_shadow:s=!1}=e;this.id=e.id||`directional-${nJ++}`,this.color=t,this.intensity=n,this.type="directional",this.direction=new dt(i).normalize().toArray(),this.shadow=s}getProjectedLight(e){return this}}class Y4{constructor(e,t={id:"pass"}){const{id:n}=t;this.id=n,this.device=e,this.props={...t}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}}class dy extends Y4{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){const[t,n]=this.device.canvasContext.getDrawingBufferSize(),i=e.clearCanvas??!0,s=e.clearColor??(i?[0,0,0,0]:!1),o=i?1:!1,c=i?0:!1,f=e.colorMask??15,A={viewport:[0,0,t,n]};e.colorMask&&(A.colorMask=f),e.scissorRect&&(A.scissorRect=e.scissorRect);const v=this.device.beginRenderPass({framebuffer:e.target,parameters:A,clearColor:s,clearDepth:o,clearStencil:c});try{return this._drawLayers(v,e)}finally{v.end(),this.device.submit()}}_drawLayers(e,t){const{target:n,shaderModuleProps:i,viewports:s,views:o,onViewportActive:c,clearStack:f=!0}=t;t.pass=t.pass||"unknown",f&&(this._lastRenderIndex=-1);const A=[];for(const v of s){const w=o&&o[v.id];c?.(v);const S=this._getDrawLayerParams(v,t),F=v.subViewports||[v];for(const N of F){const U=this._drawLayersInViewport(e,{target:n,shaderModuleProps:i,viewport:N,view:w,pass:t.pass,layers:t.layers},S);A.push(U)}}return A}_getDrawLayerParams(e,{layers:t,pass:n,isPicking:i=!1,layerFilter:s,cullRect:o,effects:c,shaderModuleProps:f},A=!1){const v=[],w=Z4(this._lastRenderIndex+1),S={layer:t[0],viewport:e,isPicking:i,renderPass:n,cullRect:o},F={};for(let N=0;N<t.length;N++){const U=t[N],$=this._shouldDrawLayer(U,S,s,F),G={shouldDrawLayer:$};$&&!A&&(G.shouldDrawLayer=!0,G.layerRenderIndex=w(U,$),G.shaderModuleProps=this._getShaderModuleProps(U,c,n,f),G.layerParameters={...U.context.deck?.props.parameters,...this.getLayerParameters(U,N,e)}),v[N]=G}return v}_drawLayersInViewport(e,{layers:t,shaderModuleProps:n,pass:i,target:s,viewport:o,view:c},f){const A=iJ(this.device,{shaderModuleProps:n,target:s,viewport:o});if(c&&c.props.clear){const w=c.props.clear===!0?{color:!0,depth:!0}:c.props.clear;this.device.beginRenderPass({framebuffer:s,parameters:{viewport:A,scissorRect:A},clearColor:w.color?[0,0,0,0]:!1,clearDepth:w.depth?1:!1}).end()}const v={totalCount:t.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:A});for(let w=0;w<t.length;w++){const S=t[w],F=f[w],{shouldDrawLayer:N}=F;if(N&&S.props.pickable&&v.pickableCount++,S.isComposite&&v.compositeCount++,S.isDrawable&&F.shouldDrawLayer){const{layerRenderIndex:U,shaderModuleProps:$,layerParameters:G}=F;v.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,U),$.project&&($.project.viewport=o),S.context.renderPass=e;try{S._drawLayer({renderPass:e,shaderModuleProps:$,uniforms:{layerIndex:U},parameters:G})}catch(H){S.raiseError(H,`drawing ${S} to ${i}`)}}}return v}shouldDrawLayer(e){return!0}getShaderModuleProps(e,t,n){return null}getLayerParameters(e,t,n){return e.props.parameters}_shouldDrawLayer(e,t,n,i){if(!(e.props.visible&&this.shouldDrawLayer(e)))return!1;t.layer=e;let o=e.parent;for(;o;){if(!o.props.visible||!o.filterSubLayer(t))return!1;t.layer=o,o=o.parent}if(n){const c=t.layer.id;if(c in i||(i[c]=n(t)),!i[c])return!1}return e.activateViewport(t.viewport),!0}_getShaderModuleProps(e,t,n,i){const s=this.device.canvasContext.cssToDeviceRatio(),o=e.internalState?.propsInTransition||e.props,c={layer:o,picking:{isActive:!1},project:{viewport:e.context.viewport,devicePixelRatio:s,modelMatrix:o.modelMatrix,coordinateSystem:o.coordinateSystem,coordinateOrigin:o.coordinateOrigin,autoWrapLongitude:e.wrapLongitude}};if(t)for(const f of t)KS(c,f.getShaderModuleProps?.(e,c));
1948return KS(c,this.getShaderModuleProps(e,t,c),i)}}function Z4(r=0,e={}){const t={},n=(i,s)=>{const o=i.props._offset,c=i.id,f=i.parent&&i.parent.id;let A;if(f&&!(f in e)&&n(i.parent,!1),f in t){const v=t[f]=t[f]||Z4(e[f],e);A=v(i,s),t[c]=v}else Number.isFinite(o)?(A=o+(e[f]||0),t[c]=null):A=r;return s&&A>=r&&(r=A+1),e[c]=A,A};return n}function iJ(r,{shaderModuleProps:e,target:t,viewport:n}){const i=e?.project?.devicePixelRatio??r.canvasContext.cssToDeviceRatio(),[,s]=r.canvasContext.getDrawingBufferSize(),o=t?t.height:s,c=n;return[c.x*i,o-(c.y+c.height)*i,c.width*i,c.height*i]}function KS(r,...e){for(const t of e)if(t)for(const n in t)r[n]?Object.assign(r[n],t[n]):r[n]=t[n];return r}class sJ extends dy{constructor(e,t){super(e,t);const n=e.createTexture({format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},mipmaps:!0}),i=e.createTexture({format:"depth16unorm",width:1,height:1,mipmaps:!1});this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[n],depthStencilAttachment:i})}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null)}getShadowMap(){return this.fbo.colorAttachments[0].texture}render(e){const t=this.fbo,n=this.device.canvasContext.cssToDeviceRatio(),i=e.viewports[0],s=i.width*n,o=i.height*n,c=[1,1,1,1];(s!==t.width||o!==t.height)&&t.resize({width:s,height:o}),super.render({...e,clearColor:c,target:t,pass:"shadow"})}getLayerParameters(e,t,n){return{...e.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}shouldDrawLayer(e){return e.props.shadowEnabled!==!1}getShaderModuleProps(e,t,n){return{shadow:{project:n.project,drawToShadowMap:!0}}}}const oJ={color:[255,255,255],intensity:1},qS=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],aJ=[0,0,0,200/255];class Q4{constructor(e={}){this.id="lighting-effect",this.shadowColor=aJ,this.shadow=!1,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;const{device:t,deck:n}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(t),n._addDefaultShaderModule(JS),this.dummyShadowMap=t.createTexture({width:1,height:1}))}setProps(e){this.ambientLight=void 0,this.directionalLights=[],this.pointLights=[];for(const t in e){const n=e[t];switch(n.type){case"ambient":this.ambientLight=n;break;case"directional":this.directionalLights.push(n);break;case"point":this.pointLights.push(n);break}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(t=>t.shadow),this.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:t,viewports:n,onViewportActive:i,views:s}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let o=0;o<this.shadowPasses.length;o++)this.shadowPasses[o].render({layers:e,layerFilter:t,viewports:n,onViewportActive:i,views:s,shaderModuleProps:{shadow:{shadowLightId:o,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}}})}}getShaderModuleProps(e,t){const n=this.shadow?{project:t.project,shadowMaps:this.shadowPasses.map(o=>o.getShadowMap()),dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{},i={enabled:!0,ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(o=>o.getProjectedLight({layer:e})),pointLights:this.pointLights.map(o=>o.getProjectedLight({layer:e}))},s=e.props.material;return{shadow:n,lighting:i,phongMaterial:s,gouraudMaterial:s}}cleanup(e){for(const t of this.shadowPasses)t.delete();this.shadowPasses.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(JS))}_calculateMatrices(){const e=[];for(const t of this.directionalLights){const n=new vn().lookAt({eye:new dt(t.direction).negate()});e.push(n)}return e}_createShadowPasses(e){for(let t=0;t<this.directionalLights.length;t++){const n=new sJ(e);this.shadowPasses[t]=n}}_applyDefaultLights(){const{ambientLight:e,pointLights:t,directionalLights:n}=this;!e&&t.length===0&&n.length===0&&(this.ambientLight=new QW(oJ),this.directionalLights.push(new XS(qS[0]),new XS(qS[1])))}}
vendor: 20,682 bytes, line 1948
1948class cJ{constructor(e={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(e)}setOptions(e){Object.assign(this.opts,e)}allocate(e,t,{size:n=1,type:i,padding:s=0,copy:o=!1,initialize:c=!1,maxCount:f}){const A=i||e&&e.constructor||Float32Array,v=t*n+s;if(ArrayBuffer.isView(e)){if(v<=e.length)return e;if(v*e.BYTES_PER_ELEMENT<=e.buffer.byteLength)return new A(e.buffer,0,v)}let w=1/0;f&&(w=f*n+s);const S=this._allocate(A,v,c,w);return e&&o?S.set(e):c||S.fill(0,0,4),this._release(e),S}release(e){this._release(e)}_allocate(e,t,n,i){let s=Math.max(Math.ceil(t*this.opts.overAlloc),1);s>i&&(s=i);const o=this._pool,c=e.BYTES_PER_ELEMENT*s,f=o.findIndex(A=>A.byteLength>=c);if(f>=0){const A=new e(o.splice(f,1)[0],0,s);return n&&A.fill(0),A}return new e(s)}_release(e){if(!ArrayBuffer.isView(e))return;const t=this._pool,{buffer:n}=e,{byteLength:i}=n,s=t.findIndex(o=>o.byteLength>=i);s<0?t.push(n):(s>0||t.length<this.opts.poolSize)&&t.splice(s,0,n),t.length>this.opts.poolSize&&t.shift()}}const Pp=new cJ;function $A(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function lJ(r){return[r[12],r[13],r[14]]}function uJ(r){return{left:Bd(r[3]+r[0],r[7]+r[4],r[11]+r[8],r[15]+r[12]),right:Bd(r[3]-r[0],r[7]-r[4],r[11]-r[8],r[15]-r[12]),bottom:Bd(r[3]+r[1],r[7]+r[5],r[11]+r[9],r[15]+r[13]),top:Bd(r[3]-r[1],r[7]-r[5],r[11]-r[9],r[15]-r[13]),near:Bd(r[3]+r[2],r[7]+r[6],r[11]+r[10],r[15]+r[14]),far:Bd(r[3]-r[2],r[7]-r[6],r[11]-r[10],r[15]-r[14])}}const YS=new dt;function Bd(r,e,t,n){YS.set(r,e,t);const i=YS.len();return{distance:n/i,normal:new dt(-r/i,-e/i,-t/i)}}function fJ(r){return r-Math.fround(r)}let RA;function ob(r,e){const{size:t=1,startIndex:n=0}=e,i=e.endIndex!==void 0?e.endIndex:r.length,s=(i-n)/t;RA=Pp.allocate(RA,s,{type:Float32Array,size:t*2});let o=n,c=0;for(;o<i;){for(let f=0;f<t;f++){const A=r[o++];RA[c+f]=A,RA[c+f+t]=fJ(A)}c+=t*2}return RA.subarray(0,s*t*2)}function hJ(r){let e=null,t=!1;for(const n of r)n&&(e?(t||(e=[[e[0][0],e[0][1]],[e[1][0],e[1][1]]],t=!0),e[0][0]=Math.min(e[0][0],n[0][0]),e[0][1]=Math.min(e[0][1],n[0][1]),e[1][0]=Math.max(e[1][0],n[1][0]),e[1][1]=Math.max(e[1][1],n[1][1])):e=n);return e}const dJ=Math.PI/180,pJ=$A(),ZS=[0,0,0],AJ={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function gJ({width:r,height:e,orthographic:t,fovyRadians:n,focalDistance:i,padding:s,near:o,far:c}){const f=r/e,A=t?new vn().orthographic({fovy:n,aspect:f,focalDistance:i,near:o,far:c}):new vn().perspective({fovy:n,aspect:f,near:o,far:c});if(s){const{left:v=0,right:w=0,top:S=0,bottom:F=0}=s,N=Kl((v+r-w)/2,0,r)-r/2,U=Kl((S+e-F)/2,0,e)-e/2;A[8]-=N*2/r,A[9]+=U*2/e}return A}class ru{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||AJ,this.focalDistance=e.focalDistance||1,this.position=e.position||ZS,this.modelMatrix=e.modelMatrix||null;const{longitude:t,latitude:n}=e;this.isGeospatial=Number.isFinite(n)&&Number.isFinite(t),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?da.WEB_MERCATOR:da.WEB_MERCATOR_AUTO_OFFSET:da.IDENTITY}equals(e){return e instanceof ru?this===e?!0:e.width===this.width&&e.height===this.height&&e.scale===this.scale&&ma(e.projectionMatrix,this.projectionMatrix)&&ma(e.viewMatrix,this.viewMatrix):!1}project(e,{topLeft:t=!0}={}){const n=this.projectPosition(e),i=K4(n,this.pixelProjectionMatrix),[s,o]=i,c=t?o:this.height-o;return e.length===2?[s,c]:[s,c,i[2]]}unproject(e,{topLeft:t=!0,targetZ:n}={}){const[i,s,o]=e,c=t?s:this.height-s,f=n&&n*this.distanceScales.unitsPerMeter[2],A=Iw([i,c,o],this.pixelUnprojectionMatrix,f),[v,w,S]=this.unprojectPosition(A);return Number.isFinite(o)?[v,w,S]:Number.isFinite(n)?[v,w,n]:[v,w]}projectPosition(e){const[t,n]=this.projectFlat(e),i=(e[2]||0)*this.distanceScales.unitsPerMeter[2];return[t,n,i]}unprojectPosition(e){const[t,n]=this.unprojectFlat(e),i=(e[2]||0)*this.distanceScales.metersPerUnit[2];return[t,n,i]}projectFlat(e){if(this.isGeospatial){const t=eu(e);return t[1]=Kl(t[1],-318,830),t}return e}unprojectFlat(e){return this.isGeospatial?hl(e):e}getBounds(e={}){const t={targetZ:e.z||0},n=this.unproject([0,0],t),i=this.unproject([this.width,0],t),s=this.unproject([0,this.height],t),o=this.unproject([this.width,this.height],t);return[Math.min(n[0],i[0],s[0],o[0]),Math.min(n[1],i[1],s[1],o[1]),Math.max(n[0],i[0],s[0],o[0]),Math.max(n[1],i[1],s[1],o[1])]}getDistanceScales(e){return e&&this.isGeospatial?T2({longitude:e[0],latitude:e[1],highPrecision:!0}):this.distanceScales}containsPixel({x:e,y:t,width:n=1,height:i=1}){return e<this.x+this.width&&this.x<e+n&&t<this.y+this.height&&this.y<t+i}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,uJ(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(e,t){return null}_initProps(e){const t=e.longitude,n=e.latitude;this.isGeospatial&&(Number.isFinite(e.zoom)||(this.zoom=BW({latitude:n})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||T2({latitude:n,longitude:t}));const i=Math.pow(2,this.zoom);this.scale=i;const{position:s,modelMatrix:o}=e;let c=ZS;if(s&&(c=o?new vn(o).transformAsVector(s,[]):s),this.isGeospatial){const f=this.projectPosition([t,n,0]);this.center=new dt(c).scale(this.distanceScales.unitsPerMeter).add(f)}else this.center=this.projectPosition(c)}_initMatrices(e){const{viewMatrix:t=pJ,projectionMatrix:n=null,orthographic:i=!1,fovyRadians:s,fovy:o=75,near:c=.1,far:f=1e3,padding:A=null,focalDistance:v=1}=e;this.viewMatrixUncentered=t,this.viewMatrix=new vn().multiplyRight(t).translate(new dt(this.center).negate()),this.projectionMatrix=n||gJ({width:this.width,height:this.height,orthographic:i,fovyRadians:s||o*dJ,focalDistance:v,padding:A,near:c,far:f});const w=$A();nh(w,w,this.projectionMatrix),nh(w,w,this.viewMatrix),this.viewProjectionMatrix=w,this.viewMatrixInverse=g2([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=lJ(this.viewMatrixInverse);const S=$A(),F=$A();ww(S,S,[this.width/2,-this.height/2,1]),x_(S,S,[1,-1,0]),nh(F,S,this.viewProjectionMatrix),this.pixelProjectionMatrix=F,this.pixelUnprojectionMatrix=g2($A(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||Yr.warn("Pixel project matrix not invertible")()}}ru.displayName="Viewport";let wg=class E2 extends ru{constructor(e={}){const{latitude:t=0,longitude:n=0,zoom:i=0,pitch:s=0,bearing:o=0,nearZMultiplier:c=.1,farZMultiplier:f=1.01,nearZ:A,farZ:v,orthographic:w=!1,projectionMatrix:S,repeat:F=!1,worldOffset:N=0,position:U,padding:$,legacyMeterSizes:G=!1}=e;let{width:H,height:J,altitude:ue=1.5}=e;const q=Math.pow(2,i);H=H||1,J=J||1;let se,Te=null;if(S)ue=S[5]/2,se=xg(ue);else{e.fovy?(se=e.fovy,ue=Sw(se)):se=xg(ue);let de;if($){const{top:me=0,bottom:pe=0}=$;de=[0,Kl((me+J-pe)/2,0,J)-J/2]}Te=IW({width:H,height:J,scale:q,center:U&&[0,0,U[2]*sb(t)],offset:de,pitch:s,fovy:se,nearZMultiplier:c,farZMultiplier:f}),Number.isFinite(A)&&(Te.near=A),Number.isFinite(v)&&(Te.far=v)}let Ue=SW({height:J,pitch:s,bearing:o,scale:q,altitude:ue});N&&(Ue=new vn().translate([512*N,0,0]).multiplyLeft(Ue)),super({...e,width:H,height:J,viewMatrix:Ue,longitude:n,latitude:t,zoom:i,...Te,fovy:se,focalDistance:ue}),this.latitude=t,this.longitude=n,this.zoom=i,this.pitch=s,this.bearing=o,this.altitude=ue,this.fovy=se,this.orthographic=w,this._subViewports=F?[]:null,this._pseudoMeters=G,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){const e=this.getBounds(),t=Math.floor((e[0]+180)/360),n=Math.ceil((e[2]-180)/360);for(let i=t;i<=n;i++){const s=i?new E2({...this,worldOffset:i}):this;this._subViewports.push(s)}}return this._subViewports}projectPosition(e){if(this._pseudoMeters)return super.projectPosition(e);const[t,n]=this.projectFlat(e),i=(e[2]||0)*sb(e[1]);return[t,n,i]}unprojectPosition(e){if(this._pseudoMeters)return super.unprojectPosition(e);const[t,n]=this.unprojectFlat(e),i=(e[2]||0)/sb(n);return[t,n,i]}addMetersToLngLat(e,t){return X4(e,t)}panByPosition(e,t){const n=Iw(t,this.pixelUnprojectionMatrix),i=this.projectFlat(e),s=gS([],i,TH([],n)),o=gS([],this.center,s),[c,f]=this.unprojectFlat(o);return{longitude:c,latitude:f}}getBounds(e={}){const t=RW(this,e.z||0);return[Math.min(t[0][0],t[1][0],t[2][0],t[3][0]),Math.min(t[0][1],t[1][1],t[2][1],t[3][1]),Math.max(t[0][0],t[1][0],t[2][0],t[3][0]),Math.max(t[0][1],t[1][1],t[2][1],t[3][1])]}fitBounds(e,t={}){const{width:n,height:i}=this,{longitude:s,latitude:o,zoom:c}=MW({width:n,height:i,bounds:e,...t});return new E2({width:n,height:i,longitude:s,latitude:o,zoom:c})}};wg.displayName="WebMercatorViewport";const QS=[0,0,0];function ab(r,e,t=!1){const n=e.projectPosition(r);if(t&&e instanceof wg){const[i,s,o=0]=r,c=e.getDistanceScales([i,s]);n[2]=o*c.unitsPerMeter[2]}return n}function mJ(r){const{viewport:e,modelMatrix:t,coordinateOrigin:n}=r;let{coordinateSystem:i,fromCoordinateSystem:s,fromCoordinateOrigin:o}=r;return i===Qr.DEFAULT&&(i=e.isGeospatial?Qr.LNGLAT:Qr.CARTESIAN),s===void 0&&(s=i),o===void 0&&(o=n),{viewport:e,coordinateSystem:i,coordinateOrigin:n,modelMatrix:t,fromCoordinateSystem:s,fromCoordinateOrigin:o}}function eL(r,{viewport:e,modelMatrix:t,coordinateSystem:n,coordinateOrigin:i,offsetMode:s}){let[o,c,f=0]=r;switch(t&&([o,c,f]=jp([],[o,c,f,1],t)),n){case Qr.LNGLAT:return ab([o,c,f],e,s);case Qr.LNGLAT_OFFSETS:return ab([o+i[0],c+i[1],f+(i[2]||0)],e,s);case Qr.METER_OFFSETS:return ab(X4(i,[o,c,f]),e,s);case Qr.CARTESIAN:default:return e.isGeospatial?[o+i[0],c+i[1],f+i[2]]:e.projectPosition([o,c,f])}}function _J(r,e){const{viewport:t,coordinateSystem:n,coordinateOrigin:i,modelMatrix:s,fromCoordinateSystem:o,fromCoordinateOrigin:c}=mJ(e),{autoOffset:f=!0}=e,{geospatialOrigin:A=QS,shaderCoordinateOrigin:v=QS,offsetMode:w=!1}=f?W4(t,n,i):{},S=eL(r,{viewport:t,modelMatrix:s,coordinateSystem:o,coordinateOrigin:c,offsetMode:w});if(w){const F=t.projectPosition(A||v);x4(S,S,F)}return S}let yJ=1,vJ=1;class tL{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(e){const{delay:t=0,duration:n=Number.POSITIVE_INFINITY,rate:i=1,repeat:s=1}=e,o=yJ++,c={time:0,delay:t,duration:n,rate:i,repeat:s};return this._setChannelTime(c,this.time),this.channels.set(o,c),o}removeChannel(e){this.channels.delete(e);for(const[t,n]of this.animations)n.channel===e&&this.detachAnimation(t)}isFinished(e){const t=this.channels.get(e);return t===void 0?!1:this.time>=t.delay+t.duration*t.repeat}getTime(e){if(e===void 0)return this.time;const t=this.channels.get(e);return t===void 0?-1:t.time}setTime(e){this.time=Math.max(0,e);const t=this.channels.values();for(const i of t)this._setChannelTime(i,this.time);const n=this.animations.values();for(const i of n){const{animation:s,channel:o}=i;s.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,t){const n=vJ++;return this.animations.set(n,{animation:e,channel:t}),e.setTime(this.getTime(t)),n}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,t){const n=t-e.delay,i=e.duration*e.repeat;n>=i?e.time=e.duration*e.rate:(e.time=Math.max(0,n)%e.duration,e.time*=e.rate)}}function bJ(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function xJ(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}function e3(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}let t3=class{constructor(e,t){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=t,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=e3(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(e3()-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)}},wJ=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e of Object.values(this.stats))e.reset();return this}forEach(e){for(const t of Object.values(this.stats))e(t)}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){const{name:t,type:n}=e;let i=this.stats[t];return i||(e instanceof t3?i=e:i=new t3(t,n),this.stats[t]=i),i}},CJ=0;const TJ={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:r=>console.error(r),stats:f2.stats.get(`animation-loop-${CJ++}`),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1};class EJ{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;_error=null;constructor(e){if(this.props={...TJ,...e},e=this.props,!e.device)throw new Error("No device provided");const{useDevicePixels:t=!0}=this.props;this.stats=e.stats||new wJ({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:t}),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()}setError(e){if(this.props.onError(e),this._error=Error(),this.device?.canvasContext?.canvas instanceof HTMLCanvasElement){const n=document.createElement("h1");n.innerHTML=e.message,n.style.position="absolute",n.style.top="20%",n.style.left="10px",n.style.color="black",n.style.backgroundColor="red",document.body.appendChild(n)}}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){const t=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(t),t}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost||this._error?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=bJ(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(xJ(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(){const e=this.device?.canvasContext?.canvas;if(!this.device||!e)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:e,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;const{width:e,height:t,aspect:n}=this._getSizeAndAspect();(e!==this.animationProps.width||t!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),n!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=t,this.animationProps.aspect=n,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){const e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";const t=document.createElement("div");t.style.position="absolute",t.style.left="10px",t.style.bottom="10px",t.style.width="300px",t.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(t);const n=this.props.onAddHTML(t);
1948n&&(t.innerHTML=n)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};const[e,t]=this.device?.canvasContext?.getPixelSize()||[1,1];let n=1;const i=this.device?.canvasContext?.canvas;return i&&i.clientHeight?n=i.clientWidth/i.clientHeight:e>0&&t>0&&(n=e/t),{width:e,height:t,aspect:n}}_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}}const cb={};function bh(r="id"){cb[r]=cb[r]||1;const e=cb[r]++;return`${r}-${e}`}class r3{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){if(this.id=e.id||bh("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&!(this.indices.usage&ji.INDEX))throw new Error("Index buffer must have INDEX usage")}destroy(){this.indices?.destroy();for(const e of Object.values(this.attributes))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices||null}_calculateVertexCount(e){return e.byteLength/12}}function BJ(r,e){if(e instanceof r3)return e;const t=SJ(r,e),{attributes:n,bufferLayout:i}=IJ(r,e);return new r3({topology:e.topology||"triangle-list",bufferLayout:i,vertexCount:e.vertexCount,indices:t,attributes:n})}function SJ(r,e){if(!e.indices)return;const t=e.indices.value;return r.createBuffer({usage:ji.INDEX,data:t})}function IJ(r,e){const t=[],n={};for(const[s,o]of Object.entries(e.attributes)){let c=s;switch(s){case"POSITION":c="positions";break;case"NORMAL":c="normals";break;case"TEXCOORD_0":c="texCoords";break;case"COLOR_0":c="colors";break}if(o){n[c]=r.createBuffer({data:o.value,id:`${s}-buffer`});const{value:f,size:A,normalized:v}=o;t.push({name:c,format:O7(f,A,v)})}}const i=e._calculateVertexCount(e.attributes,e.indices);return{attributes:n,bufferLayout:t,vertexCount:i}}class Mw{static defaultProps={...Sp.defaultProps};static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new Mw(e),e._lumaData.defaultPipelineFactory}device;destroyPolicy;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};constructor(e){this.device=e,this.destroyPolicy=e.props._factoryDestroyPolicy}createRenderPipeline(e){const t={...Sp.defaultProps,...e},n=this._hashRenderPipeline(t);if(!this._renderPipelineCache[n]){const i=this.device.createRenderPipeline({...t,id:t.id?`${t.id}-cached`:void 0});i.hash=n,this._renderPipelineCache[n]={pipeline:i,useCount:0}}return this._renderPipelineCache[n].useCount++,this._renderPipelineCache[n].pipeline}createComputePipeline(e){const t={...A_.defaultProps,...e},n=this._hashComputePipeline(t);if(!this._computePipelineCache[n]){const i=this.device.createComputePipeline({...t,id:t.id?`${t.id}-cached`:void 0});i.hash=n,this._computePipelineCache[n]={pipeline:i,useCount:0}}return this._computePipelineCache[n].useCount++,this._computePipelineCache[n].pipeline}release(e){const t=e.hash,n=e instanceof A_?this._computePipelineCache:this._renderPipelineCache;n[t].useCount--,n[t].useCount===0&&this.destroyPolicy==="unused"&&(n[t].pipeline.destroy(),delete n[t])}_hashComputePipeline(e){return`${this._getHash(e.shader.source)}`}_hashRenderPipeline(e){const t=e.vs?this._getHash(e.vs.source):0,n=e.fs?this._getHash(e.fs.source):0,i="-",s=this._getHash(JSON.stringify(e.bufferLayout));switch(this.device.type){case"webgl":return`${t}/${n}V${i}BL${s}`;default:const o=this._getHash(JSON.stringify(e.parameters));return`${t}/${n}V${i}T${e.topology}P${o}BL${s}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}}class Pw{static defaultProps={...cy.defaultProps};static getDefaultShaderFactory(e){return e._lumaData.defaultShaderFactory||=new Pw(e),e._lumaData.defaultShaderFactory}device;destroyPolicy;_cache={};constructor(e){this.device=e,this.destroyPolicy=e.props._factoryDestroyPolicy}createShader(e){const t=this._hashShader(e);let n=this._cache[t];if(!n){const i=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[t]=n={shader:i,useCount:0}}return n.useCount++,n.shader}release(e){const t=this._hashShader(e),n=this._cache[t];n&&(n.useCount--,n.useCount===0&&this.destroyPolicy==="unused"&&(delete this._cache[t],n.shader.destroy()))}_hashShader(e){return`${e.stage}:${e.source}`}}function MJ(r,e){const t={},n="Values";if(r.attributes.length===0&&!r.varyings?.length)return{"No attributes or varyings":{[n]:"N/A"}};for(const i of r.attributes)if(i){const s=`${i.location} ${i.name}: ${i.type}`;t[`in ${s}`]={[n]:i.stepMode||"vertex"}}for(const i of r.varyings||[]){const s=`${i.location} ${i.name}`;t[`out ${s}`]={[n]:JSON.stringify(i)}}return t}let Os=null,lb=null;function PJ(r,{id:e,minimap:t,opaque:n,top:i="0",left:s="0",rgbaScale:o=1}){Os||(Os=document.createElement("canvas"),Os.id=e,Os.title=e,Os.style.zIndex="100",Os.style.position="absolute",Os.style.top=i,Os.style.left=s,Os.style.border="blue 5px solid",Os.style.transform="scaleY(-1)",document.body.appendChild(Os),lb=Os.getContext("2d")),(Os.width!==r.width||Os.height!==r.height)&&(Os.width=r.width/2,Os.height=r.height/2,Os.style.width="400px",Os.style.height="400px");const c=r.device.readPixelsToArrayWebGL(r),f=lb?.createImageData(r.width,r.height);if(f){for(let v=0;v<c.length;v+=4)f.data[0+v+0]=c[v+0]*o,f.data[0+v+1]=c[v+1]*o,f.data[0+v+2]=c[v+2]*o,f.data[0+v+3]=n?255:c[v+3]*o;lb?.putImageData(f,0,0)}}function B2(r,e,t){if(r===e)return!0;
1948if(!t||!r||!e)return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!B2(r[n],e[n],t-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof r=="object"&&typeof e=="object"){const n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(const s of n)if(!e.hasOwnProperty(s)||!B2(r[s],e[s],t-1))return!1;return!0}return!1}function RJ(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function FJ(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":!1}function rL(r){return RJ(r)||FJ(r)}function DJ(r){return rL(r)||typeof r=="number"||typeof r=="boolean"}function nL(r){const e={bindings:{},uniforms:{}};return Object.keys(r).forEach(t=>{const n=r[t];DJ(n)?e.uniforms[t]=n:e.bindings[t]=n}),e}class OJ{options={disableWarnings:!1};modules;moduleUniforms;moduleBindings;constructor(e,t){Object.assign(this.options,t);const n=Zx(Object.values(e).filter(i=>i.dependencies));for(const i of n)e[i.name]=i;Zt.log(1,"Creating ShaderInputs with modules",Object.keys(e))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(const[i,s]of Object.entries(e))this._addModule(s),s.name&&i!==s.name&&!this.options.disableWarnings&&Zt.warn(`Module name: ${i} vs ${s.name}`)()}destroy(){}setProps(e){for(const t of Object.keys(e)){const n=t,i=e[n]||{},s=this.modules[n];if(!s){this.options.disableWarnings||Zt.warn(`Module ${t} not found`)();continue}const o=this.moduleUniforms[n],c=this.moduleBindings[n],f=s.getUniforms?.(i,o)||i,{uniforms:A,bindings:v}=nL(f);this.moduleUniforms[n]={...o,...A},this.moduleBindings[n]={...c,...v}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindingValues(){const e={};for(const t of Object.values(this.moduleBindings))Object.assign(e,t);return e}getDebugTable(){const e={};for(const[t,n]of Object.entries(this.moduleUniforms))for(const[i,s]of Object.entries(n))e[`${t}.${i}`]={type:this.modules[t].uniformTypes?.[i],value:String(s)};return e}_addModule(e){const t=e.name;this.moduleUniforms[t]=e.defaultUniforms||{},this.moduleBindings[t]={}}}let LJ="";async function kJ(r,e){const t=new Image;return t.crossOrigin="anonymous",t.src=r.startsWith("http")?r:LJ+r,await t.decode(),e?await createImageBitmap(t,e):await createImageBitmap(t)}class ub{device;id;texture;sampler;view;ready;isReady=!1;destroyed=!1;resolveReady=()=>{};rejectReady=()=>{};get[Symbol.toStringTag](){return"AsyncTexture"}toString(){return`AsyncTexture:"${this.id}"(${this.isReady?"ready":"loading"})`}constructor(e,t){this.device=e,this.id=t.id||bh("async-texture"),typeof t?.data=="string"&&t.dimension==="2d"&&(t={...t,data:kJ(t.data)}),this.ready=new Promise((n,i)=>{this.resolveReady=()=>{this.isReady=!0,n()},this.rejectReady=i}),this.initAsync(t)}async initAsync(e){const t=e.data;let n;try{n=await iL(t)}catch(s){this.rejectReady(s)}if(this.destroyed)return;const i={...e,data:n};this.texture=this.device.createTexture(i),this.sampler=this.texture.sampler,this.view=this.texture.view,this.isReady=!0,this.resolveReady()}destroy(){this.texture&&(this.texture.destroy(),this.texture=null),this.destroyed=!0}resize(e){if(!this.isReady)throw new Error("Cannot resize texture before it is ready");if(e.width===this.texture.width&&e.height===this.texture.height)return!1;if(this.texture){const t=this.texture;this.texture=t.clone(e),t.destroy()}return!0}}async function iL(r){if(r=await r,Array.isArray(r))return await Promise.all(r.map(iL));if(r&&typeof r=="object"&&r.constructor===Object){const e=r,t=await Promise.all(Object.values(e)),n=Object.keys(e),i={};for(let s=0;s<n.length;s++)i[n[s]]=t[s];return i}return r}const zf=2,NJ=1e4;class Di{static defaultProps={...Sp.defaultProps,source:void 0,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:qf.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0};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;get[Symbol.toStringTag](){return"Model"}toString(){return`Model(${this.id})`}constructor(e,t){this.props={...Di.defaultProps,...t},t=this.props,this.id=t.id||bh("model"),this.device=e,Object.assign(this.userData,t.userData);const n=Object.fromEntries(this.props.modules?.map(f=>[f.name,f])||[]),i=t.shaderInputs||new OJ(n,{disableWarnings:this.props.disableWarnings});this.setShaderInputs(i);const s=zJ(e),o=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){const{source:f,getUniforms:A}=this.props.shaderAssembler.assembleWGSLShader({platformInfo:s,...this.props,modules:o});this.source=f,this._getModuleUniforms=A,this.props.shaderLayout||=hH(this.source)}else{const{vs:f,fs:A,getUniforms:v}=this.props.shaderAssembler.assembleGLSLShaderPair({platformInfo:s,...this.props,modules:o});this.vs=f,this.fs=A,this._getModuleUniforms=v}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,t.geometry&&this.setGeometry(t.geometry),this.pipelineFactory=t.pipelineFactory||Mw.getDefaultPipelineFactory(this.device),this.shaderFactory=t.shaderFactory||Pw.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in t&&(this.isInstanced=t.isInstanced),t.instanceCount&&this.setInstanceCount(t.instanceCount),t.vertexCount&&this.setVertexCount(t.vertexCount),t.indexBuffer&&this.setIndexBuffer(t.indexBuffer),t.attributes&&this.setAttributes(t.attributes),t.constantAttributes&&this.setConstantAttributes(t.constantAttributes),t.bindings&&this.setBindings(t.bindings),t.uniforms&&this.setUniformsWebGL(t.uniforms),t.moduleSettings&&this.updateModuleSettingsWebGL(t.moduleSettings),t.transformFeedback&&(this.transformFeedback=t.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");const e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){const t=this._areBindingsLoading();if(t)return Zt.info(zf,`>>> DRAWING ABORTED ${this.id}: ${t} not loaded`)(),!1;try{e.pushDebugGroup(`${this}.predraw(${e})`),this.predraw()}finally{e.popDebugGroup()}let n;try{e.pushDebugGroup(`${this}.draw(${e})`),this._logDrawCallStart(),this.pipeline=this._updatePipeline();const i=this._getBindings();this.pipeline.setBindings(i,{disableWarnings:this.props.disableWarnings}),S2(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);const{indexBuffer:s}=this.vertexArray,o=s?s.byteLength/(s.indexType==="uint32"?4:2):void 0;n=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:o,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{e.popDebugGroup(),this._logDrawCallEnd()}return this._logFramebuffer(e),n?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",n}setGeometry(e){this._gpuGeometry?.destroy();const t=e&&BJ(this.device,e);
1948if(t){this.setTopology(t.topology||"triangle-list");const n=new Kv(this.bufferLayout);this.bufferLayout=n.mergeBufferLayouts(t.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(t)}this._gpuGeometry=t}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){const t=new Kv(this.bufferLayout);this.bufferLayout=this._gpuGeometry?t.mergeBufferLayouts(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){B2(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 D7(this.shaderInputs.modules);for(const[t,n]of Object.entries(this.shaderInputs.modules))if(UJ(n)){const i=this._uniformStore.getManagedUniformBuffer(this.device,t);this.bindings[`${t}Uniforms`]=i}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setBindings(this.shaderInputs.getBindingValues()),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,t){const n=t?.disableWarnings??this.props.disableWarnings;e.indices&&Zt.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)(),this.bufferLayout=L7(this.pipeline.shaderLayout,this.bufferLayout);const i=new Kv(this.bufferLayout);for(const[s,o]of Object.entries(e)){const c=i.getBufferLayout(s);if(!c){n||Zt.warn(`Model(${this.id}): Missing layout for buffer "${s}".`)();continue}const f=i.getAttributeNamesForBuffer(c);let A=!1;for(const v of f){const w=this._attributeInfos[v];if(w){const S=this.device.type==="webgpu"?i.getBufferIndex(w.bufferName):w.location;this.vertexArray.setBuffer(S,o),A=!0}}!A&&!n&&Zt.warn(`Model(${this.id}): Ignoring buffer "${o.id}" for unknown attribute "${s}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,t){for(const[n,i]of Object.entries(e)){const s=this._attributeInfos[n];s?this.vertexArray.setConstantWebGL(s.location,i):(t?.disableWarnings??this.props.disableWarnings)||Zt.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${n}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){this.setUniformsWebGL(e)}setUniformsWebGL(e){S2(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettingsWebGL(e){const{bindings:t,uniforms:n}=nL(this._getModuleUniforms(e));Object.assign(this.bindings,t),Object.assign(this.uniforms,n),this.setNeedsRedraw("moduleSettings")}_areBindingsLoading(){for(const e of Object.values(this.bindings))if(e instanceof ub&&!e.isReady)return e.id;return!1}_getBindings(){const e={};for(const[t,n]of Object.entries(this.bindings))n instanceof ub?n.isReady&&(e[t]=n.texture):e[t]=n;return e}_getBindingsUpdateTimestamp(){let e=0;for(const t of Object.values(this.bindings))t instanceof ay?e=Math.max(e,t.texture.updateTimestamp):t instanceof ji||t instanceof si?e=Math.max(e,t.updateTimestamp):t instanceof ub?e=t.texture?Math.max(e,t.texture.updateTimestamp):1/0:t instanceof _g||(e=Math.max(e,t.buffer.updateTimestamp));return e}_setGeometryAttributes(e){const t={...e.attributes};for(const[n]of Object.entries(t))!this.pipeline.shaderLayout.attributes.find(i=>i.name===n)&&n!=="positions"&&delete t[n];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(t,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,t=null;this.pipeline&&(Zt.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,t=this.pipeline.fs),this._pipelineNeedsUpdate=!1;const n=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debugShaders:this.props.debugShaders});let i=null;this.source?i=n:this.fs&&(i=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debugShaders:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,bindings:this._getBindings(),vs:n,fs:i}),this._attributeInfos=GO(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),t&&this.shaderFactory.release(t)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){const e=Zt.level>3?0:NJ;
1948Zt.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,Zt.group(zf,`>>> DRAWING MODEL ${this.id}`,{collapsed:Zt.level<=2})())}_logDrawCallEnd(){if(this._logOpen){const e=MJ(this.pipeline.shaderLayout,this.id);Zt.table(zf,e)();const t=this.shaderInputs.getDebugTable();for(const[i,s]of Object.entries(this.uniforms))t[i]={value:s};Zt.table(zf,t)();const n=this._getAttributeDebugTable();Zt.table(zf,this._attributeInfos)(),Zt.table(zf,n)(),Zt.groupEnd(zf)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){const t=this.device.props.debugFramebuffers;if(this._drawCount++,!t)return;const n=e.props.framebuffer;n&&PJ(n,{id:n.id,minimap:!0})}_getAttributeDebugTable(){const e={};for(const[t,n]of Object.entries(this._attributeInfos)){const i=this.vertexArray.attributes[n.location];e[n.location]={name:t,type:n.shaderType,values:i?this._getBufferOrConstantValues(i,n.bufferDataType):"null"}}if(this.vertexArray.indexBuffer){const{indexBuffer:t}=this.vertexArray,n=t.indexType==="uint32"?new Uint32Array(t.debugData):new Uint16Array(t.debugData);e.indices={name:"indices",type:t.indexType,values:n.toString()}}return e}_getBufferOrConstantValues(e,t){const n=jO(t);return(e instanceof ji?new n(e.debugData):e).toString()}}function UJ(r){return!!(r.uniformTypes&&!S2(r.uniformTypes))}function zJ(r){return{type:r.type,shaderLanguage:r.info.shadingLanguage,shaderLanguageVersion:r.info.shadingLanguageVersion,gpu:r.info.gpu,features:r.features}}function S2(r){for(const e in r)return!1;return!0}class fh{device;model;transformFeedback;static defaultProps={...Di.defaultProps,outputs:void 0,feedbackBuffers:void 0};static isSupported(e){return e?.info?.type==="webgl"}constructor(e,t=fh.defaultProps){if(!fh.isSupported(e))throw new Error("BufferTransform not yet implemented on WebGPU");this.device=e,this.model=new Di(this.device,{id:t.id||"buffer-transform-model",fs:t.fs||PO(),topology:t.topology||"point-list",varyings:t.outputs||t.varyings,...t}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:t.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){e?.inputBuffers&&this.model.setAttributes(e.inputBuffers),e?.outputBuffers&&this.transformFeedback.setBuffers(e.outputBuffers);const t=this.device.beginRenderPass(e);this.model.draw(t),t.end()}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){const t=this.getBuffer(e);if(!t)throw new Error("BufferTransform#getBuffer");if(t instanceof ji)return t.readAsync();const{buffer:n,byteOffset:i=0,byteLength:s=n.byteLength}=t;return n.readAsync(i,s)}}const GJ="transform_output";class n3{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(e,t){this.device=e,this.sampler=e.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new Di(this.device,{id:t.id||"texture-transform-model",fs:t.fs||PO({input:t.targetTextureVarying,inputChannels:t.targetTextureChannels,output:GJ}),vertexCount:t.vertexCount,...t}),this._initialize(t),Object.seal(this)}destroy(){this.model.destroy();for(const e of this.bindings)e.framebuffer?.destroy()}delete(){this.destroy()}run(e){const{framebuffer:t}=this.bindings[this.currentIndex],n=this.device.beginRenderPass({framebuffer:t,...e});this.model.draw(n),n.end()}getTargetTexture(){const{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:t,sourceTextures:n,targetTexture:i}){if(e||(e={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(e.sourceTextures,n),Object.assign(e.sourceBuffers,t),i){e.targetTexture=i;const{width:s,height:o}=i;e.framebuffer&&e.framebuffer.destroy(),e.framebuffer=this.device.createFramebuffer({
1948id:"transform-framebuffer",width:s,height:o,colorAttachments:[i]}),e.framebuffer.resize({width:s,height:o})}return e}_setSourceTextureParameters(){const e=this.currentIndex,{sourceTextures:t}=this.bindings[e];for(const n in t)t[n].sampler=this.sampler}}class Ys{id;topology;vertexCount;indices;attributes;userData={};constructor(e){const{attributes:t={},indices:n=null,vertexCount:i=null}=e;this.id=e.id||bh("geometry"),this.topology=e.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(const[s,o]of Object.entries(t)){const c=ArrayBuffer.isView(o)?{value:o}:o;if(!ArrayBuffer.isView(c.value))throw new Error(`${this._print(s)}: must be typed array or object with value as typed array`);if((s==="POSITION"||s==="positions")&&!c.size&&(c.size=3),s==="indices"){if(this.indices)throw new Error("Multiple indices detected");this.indices=c}else this.attributes[s]=c}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||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,t){return this}_calculateVertexCount(e,t){if(t)return t.value.length;let n=1/0;for(const i of Object.values(e)){const{value:s,size:o,constant:c}=i;!c&&s&&o!==void 0&&o>=1&&(n=Math.min(n,s.length/o))}return n}}const VJ=`struct VertexInputs {
1949  @location(0) clipSpacePosition: vec2<f32>,
1950  @location(1) texCoord: vec2<f32>,
1951  @location(2) coordinate: vec2<f32>  
1952}
1953
1954struct FragmentInputs {
1955  @builtin(position) Position : vec4<f32>,
1956  @location(0) position : vec2<f32>,
1957  @location(1) coordinate : vec2<f32>,
1958  @location(2) uv : vec2<f32>
1959};
1960
1961@vertex
1962fn vertexMain(inputs: VertexInputs) -> FragmentInputs {
1963  var outputs: FragmentInputs;
1964  outputs.Position = vec4(inputs.clipSpacePosition, 0., 1.);
1965  outputs.position = inputs.clipSpacePosition;
1966  outputs.coordinate = inputs.coordinate;
1967  outputs.uv = inputs.texCoord;
1968  return outputs;
1969}
1970`,HJ=`#version 300 es
1971in vec2 clipSpacePositions;
1972in vec2 texCoords;
1973in vec2 coordinates;
1974
1975out vec2 position;
1976out vec2 coordinate;
1977out vec2 uv;
1978
1979void main(void) {
1980  gl_Position = vec4(clipSpacePositions, 0., 1.);
1981  position = clipSpacePositions;
1982  coordinate = coordinates;
1983  uv = texCoords;
1984}
1985`,i3=[-1,-1,1,-1,-1,1,1,1];class jJ extends Di{constructor(e,t){const n=i3.map(i=>i===-1?0:i);t.source&&(t={...t,source:`${VJ}
1986${t.source}`}),super(e,{id:t.id||bh("clip-space"),...t,vs:HJ,vertexCount:4,geometry:new Ys({topology:"triangle-strip",vertexCount:4,attributes:{clipSpacePositions:{size:2,value:new Float32Array(i3)},texCoords:{size:2,value:new Float32Array(n)},coordinates:{size:2,value:new Float32Array(n)}}})})}}class T_{id;matrix=new vn;display=!0;position=new dt;rotation=new dt;scale=new dt(1,1,1);userData={};props={};constructor(e={}){const{id:t}=e;this.id=t||bh(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 this.position=e,this}setRotation(e){return this.rotation=e,this}setScale(e){return this.scale=e,this}setMatrix(e,t=!0){t?this.matrix.copy(e):this.matrix=e}setMatrixComponents(e){const{position:t,rotation:n,scale:i,update:s=!0}=e;return t&&this.setPosition(t),n&&this.setRotation(n),i&&this.setScale(i),s&&this.updateMatrix(),this}updateMatrix(){const e=this.position,t=this.rotation,n=this.scale;return this.matrix.identity(),this.matrix.translate(e),this.matrix.rotateXYZ(t),this.matrix.scale(n),this}update(e={}){const{position:t,rotation:n,scale:i}=e;return t&&this.setPosition(t),n&&this.setRotation(n),i&&this.setScale(i),this.updateMatrix(),this}getCoordinateUniforms(e,t){t=t||this.matrix;const n=new vn(e).multiplyRight(t),i=n.invert(),s=i.transpose();return{viewMatrix:e,modelMatrix:t,objectMatrix:t,worldMatrix:n,worldInverseMatrix:i,worldInverseTransposeMatrix:s}}_setScenegraphNodeProps(e){"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)}}class yp extends T_{children;constructor(e={}){e=Array.isArray(e)?{children:e}:e;const{children:t=[]}=e;Zt.assert(t.every(n=>n instanceof T_),"every child must an instance of ScenegraphNode"),super(e),this.children=t}getBounds(){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse((t,{worldMatrix:n})=>{const i=t.getBounds();if(!i)return;const[s,o]=i,c=new dt(s).add(o).divide([2,2,2]);n.transformAsPoint(c,c);const f=new dt(o).subtract(s).divide([2,2,2]);n.transformAsVector(f,f);for(let A=0;A<8;A++){const v=new dt(A&1?-1:1,A&2?-1:1,A&4?-1:1).multiply(f).add(c);for(let w=0;w<3;w++)e[0][w]=Math.min(e[0][w],v[w]),e[1][w]=Math.max(e[1][w],v[w])}}),Number.isFinite(e[0][0])?e:null}
1986destroy(){this.children.forEach(e=>e.destroy()),this.removeAll(),super.destroy()}add(...e){for(const t of e)Array.isArray(t)?this.add(...t):this.children.push(t);return this}remove(e){const t=this.children,n=t.indexOf(e);return n>-1&&t.splice(n,1),this}removeAll(){return this.children=[],this}traverse(e,{worldMatrix:t=new vn}={}){const n=new vn(t).multiplyRight(this.matrix);for(const i of this.children)i instanceof yp?i.traverse(e,{worldMatrix:n}):e(i,{worldMatrix:n})}}class I2 extends T_{model;bounds=null;managedResources;constructor(e){super(e),this.model=e.model,this.managedResources=e.managedResources||[],this.bounds=e.bounds||null,this.setProps(e)}destroy(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(e=>e.destroy()),this.managedResources=[]}getBounds(){return this.bounds}draw(e){return this.model.draw(e)}}class sL extends Ys{constructor(e={}){const{id:t=bh("cube-geometry"),indices:n=!0}=e;super(n?{...e,id:t,topology:"triangle-list",indices:{size:1,value:$J},attributes:{...ZJ,...e.attributes}}:{...e,id:t,topology:"triangle-list",indices:void 0,attributes:{...QJ,...e.attributes}})}}const $J=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]),WJ=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]),JJ=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]),XJ=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]),KJ=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]),qJ=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]),YJ=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]),ZJ={POSITION:{size:3,value:WJ},NORMAL:{size:3,value:JJ},TEXCOORD_0:{size:2,value:XJ}},QJ={POSITION:{size:3,value:KJ},TEXCOORD_0:{size:2,value:qJ},COLOR_0:{size:3,value:YJ}},eX=`uniform screenUniforms {
1987  vec2 texSize;
1988} screen;
1989`,tX={name:"screen",fs:eX,uniformTypes:{texSize:"vec2<f32>"}};class rX extends Y4{constructor(e,t){super(e,t);const{module:n,fs:i,id:s}=t,o={depthWriteEnabled:!1,depthCompare:"always"};this.model=new jJ(e,{id:s,fs:i,modules:[n,tX],parameters:o})}render(e){this._renderPass(this.device,e)}delete(){this.model.destroy(),this.model=null}_renderPass(e,t){const{clearCanvas:n,inputBuffer:i,outputBuffer:s}=t,o=[i.width,i.height],c={texSrc:i.colorAttachments[0],texSize:o};this.model.shaderInputs.setProps({screen:c,...t.moduleProps});const f=this.device.beginRenderPass({framebuffer:s,parameters:{viewport:[0,0,...o]},clearColor:n?[0,0,0,0]:!1,clearDepth:1,clearStencil:!1});this.model.draw(f),f.end()}}class nX{constructor(e,t){this.id=`${e.name}-pass`,this.props=t,xO(e),this.module=e}setup({device:e}){this.passes=iX(e,this.module,this.id)}setProps(e){this.props=e}preRender(){}postRender(e){const t=this.passes,{target:n}=e;let i=e.inputBuffer,s=e.swapBuffer;for(let o=0;o<t.length;o++){const c=o===t.length-1,f=n!==void 0&&c;f&&(s=n);const A=!f||!!e.clearCanvas,v={},w=this.module.passes[o].uniforms;v[this.module.name]={...this.props,...w},t[o].render({clearCanvas:A,inputBuffer:i,outputBuffer:s,moduleProps:v});const S=s;s=i,i=S}return i}cleanup(){if(this.passes){for(const e of this.passes)e.delete();this.passes=void 0}}}function iX(r,e,t){return e.passes.map((n,i)=>{const s=aX(e,n),o=`${t}-${i}`;return new rX(r,{id:o,module:e,fs:s})})}const oL=`#version 300 es
1990uniform sampler2D texSrc;
1991
1992in vec2 position;
1993in vec2 coordinate;
1994in vec2 uv;
1995
1996out vec4 fragColor;
1997`,sX=r=>`${oL}
1998void main() {
1999  fragColor = texture(texSrc, coordinate);
2000  fragColor = ${r}(fragColor, screen.texSize, coordinate);
2001}
2002`,oX=r=>`${oL}
2003void main() {
2004  fragColor = ${r}(texSrc, screen.texSize, coordinate);
2005}
2006`;function aX(r,e){if(e.filter){const t=typeof e.filter=="string"?e.filter:`${r.name}_filterColor_ext`;return sX(t)}if(e.sampler){const t=typeof e.sampler=="string"?e.sampler:`${r.name}
2006_sampleColor`;return oX(t)}return""}const cX={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant-alpha",blendAlphaDstFactor:"zero"};class aL extends dy{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:t,views:n,viewports:i,onViewportActive:s,pickingFBO:o,deviceRect:{x:c,y:f,width:A,height:v},cullRect:w,effects:S,pass:F="picking",pickZ:N,shaderModuleProps:U}){this.pickZ=N;const $=this._resetColorEncoder(N),G=[c,f,A,v],H=super.render({target:o,layers:e,layerFilter:t,views:n,viewports:i,onViewportActive:s,cullRect:w,effects:S?.filter(ue=>ue.useInPicking),pass:F,isPicking:!0,shaderModuleProps:U,clearColor:[0,0,0,0],colorMask:15,scissorRect:G});return this._colorEncoderState=null,{decodePickingColor:$&&uX.bind(null,$),stats:H}}shouldDrawLayer(e){const{pickable:t,operation:n}=e.props;return t&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getShaderModuleProps(e,t,n){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(e,t,n){const i={...e.props.parameters},{pickable:s,operation:o}=e.props;return!this._colorEncoderState||o.includes("terrain")?i.blend=!1:s&&o.includes("draw")&&(Object.assign(i,cX),i.blend=!0,i.blendColor=lX(this._colorEncoderState,e,n)),i}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function lX(r,e,t){const{byLayer:n,byAlpha:i}=r;let s,o=n.get(e);return o?(o.viewports.push(t),s=o.a):(s=n.size+1,s<=255?(o={a:s,layer:e,viewports:[t]},n.set(e,o),i[s]=o):(Yr.warn("Too many pickable layers, only picking the first 255")(),s=0)),[0,0,0,s/255]}function uX(r,e){const t=r.byAlpha[e[3]];return t&&{pickedLayer:t.layer,pickedViewports:t.viewports,pickedObjectIndex:t.layer.decodePickingColor(e)}}const Zd={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"},E_=Symbol.for("component"),Ku=Symbol.for("propTypes"),fb=Symbol.for("deprecatedProps"),vp=Symbol.for("asyncPropDefaults"),hh=Symbol.for("asyncPropOriginal"),ju=Symbol.for("asyncPropResolved");function py(r,e=()=>!0){return Array.isArray(r)?cL(r,e,[]):e(r)?[r]:[]}function cL(r,e,t){let n=-1;for(;++n<r.length;){const i=r[n];Array.isArray(i)?cL(i,e,t):e(i)&&t.push(i)}return t}function fX({target:r,source:e,start:t=0,count:n=1}){const i=e.length,s=n*i;let o=0;for(let c=t;o<i;o++)r[c++]=e[o];for(;o<s;)o<s-o?(r.copyWithin(t+o,t,t+o),o*=2):(r.copyWithin(t+o,t,t+s-o),o=s);return r}function s3(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}let o3=class{constructor(e,t){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=t,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=s3(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(s3()-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)}},lL=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e of Object.values(this.stats))e.reset();return this}forEach(e){for(const t of Object.values(this.stats))e(t)}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){const{name:t,type:n}=e;let i=this.stats[t];
vendor: 52,676 bytes, line 2006
2006return i||(e instanceof o3?i=e:i=new o3(t,n),this.stats[t]=i),i}};class hX{constructor(e,t,n){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=n,this.setData(t)}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,t){if(e===this._data&&!t)return;this._data=e;const n=++this._loadCount;let i=e;typeof e=="string"&&(i=s2(e)),i instanceof Promise?(this.isLoaded=!1,this._loader=i.then(s=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=s)}).catch(s=>{this._loadCount===n&&(this.isLoaded=!0,this._error=s||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(const s of this._subscribers)s.onChange(this.getData())}}class dX{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:t,forceUpdate:n=!1,persistent:i=!0}){let s=this._resources[e];s?s.setData(t,n):(s=new hX(e,t,this._context),this._resources[e]=s),s.persistent=i}remove(e){const t=this._resources[e];t&&(t.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){const t=this._consumers[e];if(t){for(const n in t){const i=t[n],s=this._resources[i.resourceId];s&&s.unsubscribe(i)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:t,consumerId:n,requestId:i="default"}){const{_resources:s,protocol:o}=this;e.startsWith(o)&&(e=e.replace(o,""),s[e]||this.add({resourceId:e,data:null,persistent:!1}));const c=s[e];if(this._track(n,i,c,t),c)return c.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(const e in this._resources)this._resources[e].delete()}_track(e,t,n,i){const s=this._consumers,o=s[e]=s[e]||{};let c=o[t];const f=c&&c.resourceId&&this._resources[c.resourceId];f&&(f.unsubscribe(c),this.prune()),n&&(c?(c.onChange=i,c.resourceId=n.id):c={onChange:i,resourceId:n.id},o[t]=c,n.subscribe(c))}_prune(){this._pruneRequest=null;for(const e of Object.keys(this._resources)){const t=this._resources[e];!t.persistent&&!t.inUse()&&(t.delete(),delete this._resources[e])}}}const pX="layerManager.setLayers",AX="layerManager.activateViewport";class gX{constructor(e,t){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=c=>{Ao(AX,this,c),c&&(this.context.viewport=c)};const{deck:n,stats:i,viewport:s,timeline:o}=t||{};this.layers=[],this.resourceManager=new dX({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:n,shaderAssembler:KW(e?.info?.shadingLanguage||"glsl"),defaultShaderModules:[s$],renderPass:void 0,stats:i||new lL({id:"deck.gl"}),viewport:s||new ru({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new tL,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(const n of this.layers){const i=n.getNeedsRedraw(e);t=t||i}return t}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(t=>e.find(n=>t.id.indexOf(n)===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,t){Ao(pX,this,t,e),this._lastRenderedLayers=e;const n=py(e,Boolean);for(const i of n)i.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){const e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){const{defaultShaderModules:t}=this.context;t.find(n=>n.name===e.name)||(t.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){const{defaultShaderModules:t}=this.context,n=t.findIndex(i=>i.name===e.name);n>=0&&(t.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(e,t,n){n.raiseError(t,`${e} of ${n}`)}_updateLayers(e,t){const n={};for(const o of e)n[o.id]?Yr.warn(`Multiple old layers with same id ${o.id}`)():n[o.id]=o;if(this._defaultShaderModulesChanged){for(const o of e)o.setNeedsUpdate(),o.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}const i=[];this._updateSublayersRecursively(t,n,i),this._finalizeOldLayers(n);let s=!1;for(const o of i)if(o.hasUniformTransition()){s=`Uniform transition in ${o}`;break}this._needsUpdate=s,this.layers=i}_updateSublayersRecursively(e,t,n){for(const i of e){i.context=this.context;const s=t[i.id];s===null&&Yr.warn(`Multiple new layers with same id ${i.id}`)(),t[i.id]=null;let o=null;try{this._debug&&s!==i&&i.validateProps(),s?(this._transferLayerState(s,i),this._updateLayer(i)):this._initializeLayer(i),n.push(i),o=i.isComposite?i.getSubLayers():null}catch(c){this._handleError("matching",c,i)}o&&this._updateSublayersRecursively(o,t,n)}}_finalizeOldLayers(e){for(const t in e){const n=e[t];n&&this._finalizeLayer(n)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Zd.INITIALIZED}catch(t){this._handleError("initialization",t,e)}}_transferLayerState(e,t){t._transferState(e),t.lifecycle=Zd.MATCHED,t!==e&&(e.lifecycle=Zd.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(t){this._handleError("update",t,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Zd.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Zd.FINALIZED}catch(t){this._handleError("finalization",t,e)}}}function rs(r,e,t){if(r===e)return!0;if(!t||!r||!e)return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!rs(r[n],e[n],t-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof r=="object"&&typeof e=="object"){const n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(const s of n)if(!e.hasOwnProperty(s)||!rs(r[s],e[s],t-1))return!1;return!0}return!1}class mX{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(const e in this.controllers){const t=this.controllers[e];t&&t.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){const t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(const e in this.controllers){const t=this.controllers[e];t&&t.updateTransition()}}getViewports(e){return e?this._viewports.filter(t=>t.containsPixel(e)):this._viewports}getViews(){const e={};return this.views.forEach(t=>{e[t.id]=t}),e}getView(e){return this.views.find(t=>t.id===e)}getViewState(e){const t=typeof e=="string"?this.getView(e):e,n=t&&this.viewState[t.getViewStateId()]||this.viewState;return t?t.filterViewState(n):n}getViewport(e){return this._viewportMap[e]}unproject(e,t){const n=this.getViewports(),i={x:e[0],y:e[1]};for(let s=n.length-1;s>=0;--s){const o=n[s];if(o.containsPixel(i)){const c=e.slice();return c[0]-=o.x,c[1]-=o.y,o.unproject(c,t)}}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,t){(e!==this.width||t!==this.height)&&(this.width=e,this.height=t,this.setNeedsUpdate("Size changed"))}_setViews(e){e=py(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!rs(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):Yr.warn("missing `viewState` or `initialViewState`")()}_createController(e,t){const n=t.type;return new n({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:s=>this.getView(e.id)?.makeViewport({viewState:s,width:this.width,height:this.height})})}_updateController(e,t,n,i){const s=e.controller;if(s&&n){const o={...t,...s,id:e.id,x:n.x,y:n.y,width:n.width,height:n.height};return(!i||i.constructor!==s.type)&&(i=this._createController(e,o)),i&&i.setProps(o),i}return null}_rebuildViewports(){const{views:e}=this,t=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let i=e.length;i--;){const s=e[i],o=this.getViewState(s),c=s.makeViewport({viewState:o,width:this.width,height:this.height});let f=t[s.id];const A=!!s.controller;A&&!f&&(n=!0),(n||!A)&&f&&(f.finalize(),f=null),this.controllers[s.id]=this._updateController(s,o,c,f),c&&this._viewports.unshift(c)}for(const i in t){const s=t[i];s&&!this.controllers[i]&&s.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,t){return e.length!==t.length?!0:e.some((n,i)=>!e[i].equals(t[i]))}}const _X=/([0-9]+\.?[0-9]*)(%|px)/;function Du(r){switch(typeof r){case"number":return{position:r,relative:!1};case"string":const e=_X.exec(r);if(e&&e.length>=3){const t=e[2]==="%",n=parseFloat(e[1]);return{position:t?n/100:n,relative:t}}default:throw new Error(`Could not parse position string ${r}`)}}function Ou(r,e){return r.relative?Math.round(r.position*e):r.position}class Rp{constructor(e){const{id:t,x:n=0,y:i=0,width:s="100%",height:o="100%",padding:c=null}=e;this.id=t||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=Du(n),this._y=Du(i),this._width=Du(s),this._height=Du(o),this._padding=c&&{left:Du(c.left||0),right:Du(c.right||0),top:Du(c.top||0),bottom:Du(c.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.constructor===e.constructor&&rs(this.props,e.props,2)}makeViewport({width:e,height:t,viewState:n}){n=this.filterViewState(n);const i=this.getDimensions({width:e,height:t});if(!i.height||!i.width)return null;const s=this.getViewportType(n);return new s({...n,...this.props,...i})}getViewStateId(){const{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;const t={...e};for(const n in this.props.viewState)n!=="id"&&(t[n]=this.props.viewState[n]);return t}return e}getDimensions({width:e,height:t}){const n={x:Ou(this._x,e),y:Ou(this._y,t),width:Ou(this._width,e),height:Ou(this._height,t)};return this._padding&&(n.padding={left:Ou(this._padding.left,e),top:Ou(this._padding.top,t),right:Ou(this._padding.right,e),bottom:Ou(this._padding.bottom,t)}),n}get controller(){const e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}}class Ay{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){const{_timeline:e,settings:t}=this;this._handle=e.addChannel({delay:e.getTime(),duration:t.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}const a3=()=>{},M2={BREAK:1,SNAP_TO_END:2,IGNORE:3},yX=r=>r,vX=M2.BREAK;let bX=class{constructor(e){this._onTransitionUpdate=t=>{const{time:n,settings:{interpolator:i,startProps:s,endProps:o,duration:c,easing:f}}=t,A=f(n/c),v=i.interpolateProps(s,o,A);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 Ay(e.timeline),this.onViewStateChange=e.onViewStateChange||a3,this.onStateChange=e.onStateChange||a3}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let t=!1;const n=this.props;if(this.props=e,!n||this._shouldIgnoreViewportChange(n,e))return!1;if(this._isTransitionEnabled(e)){let i=n;if(this.transition.inProgress){const{interruption:s,endProps:o}=this.transition.settings;i={...n,...s===M2.SNAP_TO_END?o:this.propsInTransition||n}}this._triggerTransition(i,e),t=!0}else this.transition.cancel();return t}updateTransition(){this.transition.update()}_isTransitionEnabled(e){const{transitionDuration:t,transitionInterpolator:n}=e;return(t>0||t==="auto")&&!!n}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,t){return this.transition.inProgress?this.transition.settings.interruption===M2.IGNORE||this._isUpdateDueToCurrentTransition(t):this._isTransitionEnabled(t)?t.transitionInterpolator.arePropsEqual(e,t):!0}_triggerTransition(e,t){const n=this.getControllerState(e),i=this.getControllerState(t).shortestPathFrom(n),s=t.transitionInterpolator,o=s.getDuration?s.getDuration(e,t):t.transitionDuration;if(o===0)return;const c=s.initializeProps(e,i);this.propsInTransition={};const f={duration:o,easing:t.transitionEasing||yX,interpolator:s,interruption:t.transitionInterruption||vX,startProps:c.start,endProps:c.end,onStart:t.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(t.onTransitionInterrupt),onEnd:this._onTransitionEnd(t.onTransitionEnd)};this.transition.start(f),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return t=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(t)}}};function qs(r,e){if(!r)throw new Error(e||"deck.gl: assertion failed.")}let xX=class{constructor(e){const{compare:t,extract:n,required:i}=e;this._propsToCompare=t,this._propsToExtract=n||t,this._requiredProps=i}arePropsEqual(e,t){for(const n of this._propsToCompare)if(!(n in e)||!(n in t)||!ma(e[n],t[n]))return!1;return!0}initializeProps(e,t){const n={},i={};for(const s of this._propsToExtract)(s in e||s in t)&&(n[s]=e[s],i[s]=t[s]);return this._checkRequiredProps(n),this._checkRequiredProps(i),{start:n,end:i}}getDuration(e,t){return t.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(t=>{const n=e[t];qs(Number.isFinite(n)||Array.isArray(n),`${t} is required for transition`)})}};const wX=["longitude","latitude","zoom","bearing","pitch"],CX=["longitude","latitude","zoom"];let uL=class extends xX{constructor(e={}){const t=Array.isArray(e)?e:e.transitionProps,n=Array.isArray(e)?{}:e;n.transitionProps=Array.isArray(t)?{compare:t,required:t}:t||{compare:wX,required:CX},super(n.transitionProps),this.opts=n}initializeProps(e,t){const n=super.initializeProps(e,t),{makeViewport:i,around:s}=this.opts;if(i&&s){const o=i(e),c=i(t),f=o.unproject(s);n.start.around=s,Object.assign(n.end,{around:c.project(f),aroundPosition:f,width:t.width,height:t.height})}return n}interpolateProps(e,t,n){const i={};for(const s of this._propsToExtract)i[s]=Cc(e[s]||0,t[s]||0,n);if(t.aroundPosition&&this.opts.makeViewport){const s=this.opts.makeViewport({...t,...i});Object.assign(i,s.panByPosition(t.aroundPosition,Cc(e.around,t.around,n)))}return i}};const Lu={transitionDuration:0},TX=300,Jm=r=>1-(1-r)*(1-r),Sd={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},Gf={};class EX{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 bX({...e,getControllerState:t=>new this.ControllerState(t),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(const e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;const t=this._eventStartBlocked;switch(e.type){case"panstart":return t?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return t?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"multipanstart":return t?!1:this._onMultiPanStart(e);case"multipanmove":return this._onMultiPan(e);case"multipanend":return this._onMultiPanEnd(e);case"dblclick":return this._onDoubleClick(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){const{x:t,y:n}=this.props,{offsetCenter:i}=e;return[i.x-t,i.y-n]}isPointInBounds(e,t){const{width:n,height:i}=this.props;if(t&&t.handled)return!1;const s=e[0]>=0&&e[0]<=n&&e[1]>=0&&e[1]<=i;return s&&t&&t.stopPropagation(),s}isFunctionKeyPressed(e){const{srcEvent:t}=e;return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){const t=setTimeout(()=>{this._eventStartBlocked===t&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=t}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);const{inertia:t}=e;this.inertia=Number.isFinite(t)?t:t===!0?TX:0;const{scrollZoom:n=!0,dragPan:i=!0,dragRotate:s=!0,doubleClickZoom:o=!0,touchZoom:c=!0,touchRotate:f=!1,keyboard:A=!0}=e,v=!!this.onViewStateChange;this.toggleEvents(Sd.WHEEL,v&&n),this.toggleEvents(Sd.PAN,v),this.toggleEvents(Sd.PINCH,v&&(c||f)),this.toggleEvents(Sd.MULTI_PAN,v&&f),this.toggleEvents(Sd.DOUBLE_CLICK,v&&o),this.toggleEvents(Sd.KEYBOARD,v&&A),this.scrollZoom=n,this.dragPan=i,this.dragRotate=s,this.doubleClickZoom=o,this.touchZoom=c,this.touchRotate=f,this.keyboard=A}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,t){this.eventManager&&e.forEach(n=>{this._events[n]!==t&&(this._events[n]=t,t?this.eventManager.on(n,this.handleEvent):this.eventManager.off(n,this.handleEvent))})}updateViewport(e,t=null,n={}){const i={...e.getViewportProps(),...t},s=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(n),s){const o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:i,interactionState:this._interactionState,oldViewState:o,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){const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(n=!n);const i=this.controllerState[n?"panStart":"rotateStart"]({pos:t});return this._panMove=n,this.updateViewport(i,Lu,{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;const t=this.getCenter(e),n=this.controllerState.pan({pos:t});return this.updateViewport(n,Lu,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){const{inertia:t}=this;if(this.dragPan&&t&&e.velocity){const n=this.getCenter(e),i=[n[0]+e.velocityX*t/2,n[1]+e.velocityY*t/2],s=this.controllerState.pan({pos:i}).panEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Jm},{isDragging:!1,isPanning:!0})}else{const n=this.controllerState.panEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;const t=this.getCenter(e),n=this.controllerState.rotate({pos:t});return this.updateViewport(n,Lu,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){const{inertia:t}=this;if(this.dragRotate&&t&&e.velocity){const n=this.getCenter(e),i=[n[0]+e.velocityX*t/2,n[1]+e.velocityY*t/2],s=this.controllerState.rotate({pos:i}).rotateEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Jm},{isDragging:!1,isRotating:!0})}else{const n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;e.srcEvent.preventDefault();const{speed:n=.01,smooth:i=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:s}=e;let o=2/(1+Math.exp(-Math.abs(s*n)));s<0&&o!==0&&(o=1/o);const c=this.controllerState.zoom({pos:t,scale:o});return this.updateViewport(c,{...this._getTransitionProps({around:t}),transitionDuration:i?250:1},{isZooming:!0,isPanning:!0}),!0}_onMultiPanStart(e){const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;const n=this.controllerState.rotateStart({pos:t});return this.updateViewport(n,Lu,{isDragging:!0}),!0}_onMultiPan(e){if(!this.touchRotate||!this.isDragging())return!1;const t=this.getCenter(e);t[0]-=e.deltaX;const n=this.controllerState.rotate({pos:t});return this.updateViewport(n,Lu,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(e){if(!this.isDragging())return!1;const{inertia:t}=this;if(this.touchRotate&&t&&e.velocityY){const n=this.getCenter(e),i=[n[0],n[1]+=e.velocityY*t/2],s=this.controllerState.rotate({pos:i});this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Jm},{isDragging:!1,isRotating:!0}),this.blockEvents(t)}else{const n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;const n=this.controllerState.zoomStart({pos:t}).rotateStart({pos:t});return Gf._startPinchRotation=e.rotation,Gf._lastPinchEvent=e,this.updateViewport(n,Lu,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let t=this.controllerState;if(this.touchZoom){const{scale:n}=e,i=this.getCenter(e);t=t.zoom({pos:i,scale:n})}if(this.touchRotate){const{rotation:n}=e;t=t.rotate({deltaAngleX:Gf._startPinchRotation-n})}return this.updateViewport(t,Lu,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Gf._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;const{inertia:t}=this,{_lastPinchEvent:n}=Gf;if(this.touchZoom&&t&&n&&e.scale!==n.scale){const i=this.getCenter(e);let s=this.controllerState.rotateEnd();const o=Math.log2(e.scale),c=(o-Math.log2(n.scale))/(e.deltaTime-n.deltaTime),f=Math.pow(2,o+c*t/2);s=s.zoom({pos:i,scale:f}).zoomEnd(),this.updateViewport(s,{...this._getTransitionProps({around:i}),transitionDuration:t,transitionEasing:Jm},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(t)}else{const i=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return Gf._startPinchRotation=null,Gf._lastPinchEvent=null,!0}_onDoubleClick(e){if(!this.doubleClickZoom)return!1;const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;const n=this.isFunctionKeyPressed(e),i=this.controllerState.zoom({pos:t,scale:n?.5:2});return this.updateViewport(i,this._getTransitionProps({around:t}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;const t=this.isFunctionKeyPressed(e),{zoomSpeed:n,moveSpeed:i,rotateSpeedX:s,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:c}=this;let f;const A={};switch(e.srcEvent.code){case"Minus":f=t?c.zoomOut(n).zoomOut(n):c.zoomOut(n),A.isZooming=!0;break;case"Equal":f=t?c.zoomIn(n).zoomIn(n):c.zoomIn(n),A.isZooming=!0;break;case"ArrowLeft":t?(f=c.rotateLeft(s),A.isRotating=!0):(f=c.moveLeft(i),A.isPanning=!0);break;case"ArrowRight":t?(f=c.rotateRight(s),A.isRotating=!0):(f=c.moveRight(i),A.isPanning=!0);break;case"ArrowUp":t?(f=c.rotateUp(o),A.isRotating=!0):(f=c.moveUp(i),A.isPanning=!0);break;case"ArrowDown":t?(f=c.rotateDown(o),A.isRotating=!0):(f=c.moveDown(i),A.isPanning=!0);break;default:return!1}return this.updateViewport(f,this._getTransitionProps(),A),!0}_getTransitionProps(e){const{transition:t}=this;return!t||!t.transitionInterpolator?Lu:e?{...t,transitionInterpolator:new uL({...e,...t.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:t}}class BX{constructor(e,t){this._viewportProps=this.applyConstraints(e),this._state=t}getViewportProps(){return this._viewportProps}getState(){return this._state}}const c3=5,SX=1.2;let IX=class extends BX{constructor(e){const{width:t,height:n,latitude:i,longitude:s,zoom:o,bearing:c=0,pitch:f=0,altitude:A=1.5,position:v=[0,0,0],maxZoom:w=20,minZoom:S=0,maxPitch:F=60,minPitch:N=0,startPanLngLat:U,startZoomLngLat:$,startRotatePos:G,startBearing:H,startPitch:J,startZoom:ue,normalize:q=!0}=e;qs(Number.isFinite(s)),qs(Number.isFinite(i)),qs(Number.isFinite(o)),super({width:t,height:n,latitude:i,longitude:s,zoom:o,bearing:c,pitch:f,altitude:A,maxZoom:w,minZoom:S,maxPitch:F,minPitch:N,normalize:q,position:v},{startPanLngLat:U,startZoomLngLat:$,startRotatePos:G,startBearing:H,startPitch:J,startZoom:ue}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:t}){const n=this.getState().startPanLngLat||this._unproject(t);if(!n)return this;const s=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(s)}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:t=0,deltaAngleY:n=0}){const{startRotatePos:i,startBearing:s,startPitch:o}=this.getState();if(!i||s===void 0||o===void 0)return this;let c;return e?c=this._getNewRotation(e,i,o,s):c={bearing:s+t,pitch:o+n},this._getUpdatedState(c)}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:t,scale:n}){let{startZoom:i,startZoomLngLat:s}=this.getState();if(s||(i=this.getViewportProps().zoom,s=this._unproject(t)||this._unproject(e)),!s)return this;const{maxZoom:o,minZoom:c}=this.getViewportProps();let f=i+Math.log2(n);f=Kl(f,c,o);const A=this.makeViewport({...this.getViewportProps(),zoom:f});return this._getUpdatedState({zoom:f,...A.panByPosition(s,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){const t=e.getViewportProps(),n={...this.getViewportProps()},{bearing:i,longitude:s}=n;return Math.abs(i-t.bearing)>180&&(n.bearing=i<0?i+360:i-360),Math.abs(s-t.longitude)>180&&(n.longitude=s<0?s+360:s-360),n}applyConstraints(e){const{maxZoom:t,minZoom:n,zoom:i}=e;e.zoom=Kl(i,n,t);const{maxPitch:s,minPitch:o,pitch:c}=e;e.pitch=Kl(c,o,s);const{normalize:f=!0}=e;return f&&Object.assign(e,FW(e)),e}_zoomFromCenter(e){const{width:t,height:n}=this.getViewportProps();return this.zoom({pos:[t/2,n/2],scale:e})}_panFromCenter(e){const{width:t,height:n}=this.getViewportProps();return this.pan({startPos:[t/2,n/2],pos:[t/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){const t=this.makeViewport(this.getViewportProps());return e&&t.unproject(e)}_getNewRotation(e,t,n,i){const s=e[0]-t[0],o=e[1]-t[1],c=e[1],f=t[1],{width:A,height:v}=this.getViewportProps(),w=s/A;let S=0;o>0?Math.abs(v-f)>c3&&(S=o/(f-v)*SX):o<0&&f>c3&&(S=1-c/f),S=Kl(S,-1,1);const{minPitch:F,maxPitch:N}=this.getViewportProps(),U=i+180*w;let $=n;return S>0?$=n+S*(N-n):S<0&&($=n-S*(F-n)),{pitch:$,bearing:U}}},MX=class extends EX{constructor(){super(...arguments),this.ControllerState=IX,this.transition={transitionDuration:300,transitionInterpolator:new uL({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];const t=this.props;super.setProps(e),(!t||t.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}};class fL extends Rp{constructor(e={}){super(e)}getViewportType(){return wg}get ControllerType(){return MX}}fL.displayName="MapView";const PX=new Q4;function RX(r,e){const t=r.order??1/0,n=e.order??1/0;return t-n}class FX{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){const t=this._defaultEffects;if(!t.find(n=>n.id===e.id)){const n=t.findIndex(i=>RX(i,e)>0);n<0?t.push(e):t.splice(n,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(rs(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){const t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}getEffects(){return this._resolvedEffects}_setEffects(e){const t={};for(const i of this.effects)t[i.id]=i;const n=[];for(const i of e){const s=t[i.id];let o=i;s&&s!==i?s.setProps?(s.setProps(i.props),o=s):s.cleanup(this._context):s||i.setup(this._context),n.push(o),delete t[i.id]}for(const i in t)t[i].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),e.some(i=>i instanceof Q4)||this._resolvedEffects.push(PX),this._needsRedraw="effects changed"}finalize(){for(const e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class DX extends dy{shouldDrawLayer(e){const{operation:t}=e.props;return t.includes("draw")||t.includes("terrain")}}const OX="deckRenderer.renderLayers";class LX{constructor(e){this.device=e,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new DX(e),this.pickLayersPass=new aL(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;const t=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};n.effects&&this._preRender(n.effects,n);const i=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);const s=t.render({...n,target:i});n.effects&&this._postRender(n.effects,n),this.renderCount++,Ao(OX,this,s,e)}needsRedraw(e={clearRedrawFlags:!1}){const t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}finalize(){const{renderBuffers:e}=this;for(const t of e)t.delete();e.length=0}_preRender(e,t){this.lastPostProcessEffect=null,t.preRenderStats=t.preRenderStats||{};for(const n of e)t.preRenderStats[n.id]=n.preRender(t),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){const{renderBuffers:e}=this,t=this.device.canvasContext.getDrawingBufferSize();e.length===0&&[0,1].map(n=>{const i=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"}});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${n}`,colorAttachments:[i]}))});for(const n of e)n.resize(t)}_postRender(e,t){const{renderBuffers:n}=this,i={...t,inputBuffer:n[0],swapBuffer:n[1]};for(const s of e)if(s.postRender){i.target=s.id===this.lastPostProcessEffect?t.target:void 0;const o=s.postRender(i);i.inputBuffer=o,i.swapBuffer=o===n[0]?n[1]:n[0]}}}const kX={pickedColor:null,pickedObjectIndex:-1};function NX({pickedColors:r,decodePickingColor:e,deviceX:t,deviceY:n,deviceRadius:i,deviceRect:s}){const{x:o,y:c,width:f,height:A}=s;let v=i*i,w=-1,S=0;for(let F=0;F<A;F++){const N=F+c-n,U=N*N;if(U>v)S+=4*f;else for(let $=0;$<f;$++){if(r[S+3]-1>=0){const H=$+o-t,J=H*H+U;J<=v&&(v=J,w=S)}S+=4}}if(w>=0){const F=r.slice(w,w+4),N=e(F);if(N){const U=Math.floor(w/4/f),$=w/4-U*f;return{...N,pickedColor:F,pickedX:o+$,pickedY:c+U}}Yr.error("Picked non-existent layer. Is picking buffer corrupt?")()}return kX}function UX({pickedColors:r,decodePickingColor:e}){const t=new Map;if(r){for(let n=0;n<r.length;n+=4)if(r[n+3]-1>=0){const s=r.slice(n,n+4),o=s.join(",");if(!t.has(o)){const c=e(s);c?t.set(o,{...c,color:s}):Yr.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(t.values())}function hL({pickInfo:r,viewports:e,pixelRatio:t,x:n,y:i,z:s}){let o=e[0];e.length>1&&(o=GX(r?.pickedViewports||e,{x:n,y:i}));let c;if(o){const f=[n-o.x,i-o.y];s!==void 0&&(f[2]=s),c=o.unproject(f)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:n,y:i,pixel:[n,i],coordinate:c,devicePixel:r&&"pickedX"in r?[r.pickedX,r.pickedY]:void 0,pixelRatio:t}}function zX(r){const{pickInfo:e,lastPickedInfo:t,mode:n,layers:i}=r,{pickedColor:s,pickedLayer:o,pickedObjectIndex:c}=e,f=o?[o]:[];if(n==="hover"){const w=t.index,S=t.layerId,F=o?o.props.id:null;if(F!==S||c!==w){if(F!==S){const N=i.find(U=>U.props.id===S);N&&f.unshift(N)}t.layerId=F,t.index=c,t.info=null}}const A=hL(r),v=new Map;return v.set(null,A),f.forEach(w=>{let S={...A};w===o&&(S.color=s,S.index=c,S.picked=!0),S=dL({layer:w,info:S,mode:n});const F=S.layer;w===o&&n==="hover"&&(t.info=S),v.set(F.id,S),n==="hover"&&F.updateAutoHighlight(S)}),v}function dL({layer:r,info:e,mode:t}){for(;r&&e;){const n=e.layer||null;e.sourceLayer=n,e.layer=r,e=r.getPickingInfo({info:e,mode:t,sourceLayer:n}),r=r.parent}return e}function GX(r,e){for(let t=r.length-1;t>=0;t--){const n=r[t];if(n.containsPixel(e))return n}return r[0]}class VX{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new aL(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:t,layers:n,viewports:i},s=this.lastPickedInfo.info){const o=s&&s.layer&&s.layer.id,c=s&&s.viewport&&s.viewport.id,f=o?n.find(S=>S.id===o):null,A=c&&i.find(S=>S.id===c)||i[0],v=A&&A.unproject([e-A.x,t-A.y]);return{...s,...{x:e,y:t,viewport:A,coordinate:v,layer:f}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){const t=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=t}const{canvas:e}=this.device.getDefaultCanvasContext();this.pickingFBO?.resize({width:e.width,height:e.height}),this.depthFBO?.resize({width:e.width,height:e.height})}_getPickable(e){if(this._pickable===!1)return null;const t=e.filter(n=>this.pickLayersPass.shouldDrawLayer(n)&&!n.isComposite);return t.length?t:null}_pickClosestObject({layers:e,views:t,viewports:n,x:i,y:s,radius:o=0,depth:c=1,mode:f="query",unproject3D:A,onViewportActive:v,effects:w}){const S=this.device.canvasContext.cssToDeviceRatio(),F=this._getPickable(e);if(!F||n.length===0)return{result:[],emptyInfo:hL({viewports:n,x:i,y:s,pixelRatio:S})};this._resizeBuffer();const N=this.device.canvasContext.cssToDevicePixels([i,s],!0),U=[N.x+Math.floor(N.width/2),N.y+Math.floor(N.height/2)],$=Math.round(o*S),{width:G,height:H}=this.pickingFBO,J=this._getPickingRect({deviceX:U[0],deviceY:U[1],deviceRadius:$,deviceWidth:G,deviceHeight:H}),ue={x:i-o,y:s-o,width:o*2+1,height:o*2+1};let q;const se=[],Te=new Set;for(let Ue=0;Ue<c;Ue++){let de;if(J){const pe=this._drawAndSample({layers:F,views:t,viewports:n,onViewportActive:v,deviceRect:J,cullRect:ue,effects:w,pass:`picking:${f}`});de=NX({...pe,deviceX:U[0],deviceY:U[1],deviceRadius:$,deviceRect:J})}else de={pickedColor:null,pickedObjectIndex:-1};let me;if(de.pickedLayer&&A&&this.depthFBO){const{pickedColors:pe}=this._drawAndSample({layers:[de.pickedLayer],views:t,viewports:n,onViewportActive:v,deviceRect:{x:de.pickedX,y:de.pickedY,width:1,height:1},cullRect:ue,effects:w,pass:`picking:${f}:z`},!0);pe[3]&&(me=pe[0])}de.pickedLayer&&Ue+1<c&&(Te.add(de.pickedLayer),de.pickedLayer.disablePickingIndex(de.pickedObjectIndex)),q=zX({pickInfo:de,lastPickedInfo:this.lastPickedInfo,mode:f,layers:F,viewports:n,x:i,y:s,z:me,pixelRatio:S});for(const pe of q.values())pe.layer&&se.push(pe);if(!de.pickedColor)break}for(const Ue of Te)Ue.restorePickingColors();return{result:se,emptyInfo:q.get(null)}}_pickVisibleObjects({layers:e,views:t,viewports:n,x:i,y:s,width:o=1,height:c=1,mode:f="query",maxObjects:A=null,onViewportActive:v,effects:w}){const S=this._getPickable(e);if(!S||n.length===0)return[];this._resizeBuffer();const F=this.device.canvasContext.cssToDeviceRatio(),N=this.device.canvasContext.cssToDevicePixels([i,s],!0),U=N.x,$=N.y+N.height,G=this.device.canvasContext.cssToDevicePixels([i+o,s+c],!0),H=G.x+G.width,J=G.y,ue={x:U,y:J,width:H-U,height:$-J},q=this._drawAndSample({layers:S,views:t,viewports:n,onViewportActive:v,deviceRect:ue,cullRect:{x:i,y:s,width:o,height:c},effects:w,pass:`picking:${f}`}),se=UX(q),Te=new Map,Ue=[],de=Number.isFinite(A);for(let me=0;me<se.length&&!(de&&Ue.length>=A);me++){const pe=se[me];let W={color:pe.pickedColor,layer:null,index:pe.pickedObjectIndex,picked:!0,x:i,y:s,pixelRatio:F};W=dL({layer:pe.pickedLayer,info:W,mode:f});const re=W.layer.id;Te.has(re)||Te.set(re,new Set);const Ee=Te.get(re),et=W.object??W.index;Ee.has(et)||(Ee.add(et),Ue.push(W))}return Ue}_drawAndSample({layers:e,views:t,viewports:n,onViewportActive:i,deviceRect:s,cullRect:o,effects:c,pass:f},A=!1){const v=A?this.depthFBO:this.pickingFBO,w={layers:e,layerFilter:this.layerFilter,views:t,viewports:n,onViewportActive:i,pickingFBO:v,deviceRect:s,cullRect:o,effects:c,pass:f,pickZ:A,preRenderStats:{},isPicking:!0};for(const H of c)H.useInPicking&&(w.preRenderStats[H.id]=H.preRender(w));const{decodePickingColor:S}=this.pickLayersPass.render(w),{x:F,y:N,width:U,height:$}=s,G=new(A?Float32Array:Uint8Array)(U*$*4);return this.device.readPixelsToArrayWebGL(v,{sourceX:F,sourceY:N,sourceWidth:U,sourceHeight:$,target:G}),{pickedColors:G,decodePickingColor:S}}_getPickingRect({deviceX:e,deviceY:t,deviceRadius:n,deviceWidth:i,deviceHeight:s}){const o=Math.max(0,e-n),c=Math.max(0,t-n),f=Math.min(i,e+n+1)-o,A=Math.min(s,t+n+1)-c;return f<=0||A<=0?null:{x:o,y:c,width:f,height:A}}}const HX={"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}},jX="top-left",l3="__root";class $X{constructor({deck:e,parentElement:t}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,this.parentElement=t}getWidgets(){return this.resolvedWidgets}setProps(e){e.widgets&&!rs(e.widgets,this.widgets,1)&&this._setWidgets(e.widgets)}finalize(){for(const e of this.getWidgets())this._remove(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(const e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(t=>t.id===e.id)||(this._add(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}_setWidgets(e){const t={};for(const n of this.resolvedWidgets)t[n.id]=n;this.resolvedWidgets.length=0;for(const n of this.defaultWidgets)t[n.id]=null,this.resolvedWidgets.push(n);for(let n of e){const i=t[n.id];i?i.viewId!==n.viewId||i.placement!==n.placement?(this._remove(i),this._add(n)):n!==i&&(i.setProps(n.props),n=i):this._add(n),t[n.id]=null,this.resolvedWidgets.push(n)}for(const n in t){const i=t[n];i&&this._remove(i)}this.widgets=e}_add(e){const{viewId:t=null,placement:n=jX}=e,i=e.onAdd({deck:this.deck,viewId:t});i&&this._getContainer(t,n).append(i),e._element=i}_remove(e){e.onRemove?.(),e._element&&e._element.remove(),e._element=void 0}_getContainer(e,t){const n=e||l3;let i=this.containers[n];i||(i=document.createElement("div"),i.style.pointerEvents="none",i.style.position="absolute",i.style.overflow="hidden",this.parentElement?.append(i),this.containers[n]=i);let s=i.querySelector(`.${t}`);return s||(s=document.createElement("div"),s.className=t,s.style.position="absolute",s.style.zIndex="2",Object.assign(s.style,HX[t]),i.append(s)),s}_updateContainers(){const e=this.deck.width,t=this.deck.height;for(const n in this.containers){const i=this.lastViewports[n]||null,s=n===l3||i,o=this.containers[n];s?(o.style.display="block",o.style.left=`${i?i.x:0}px`,o.style.top=`${i?i.y:0}px`,o.style.width=`${i?i.width:e}px`,o.style.height=`${i?i.height:t}px`):o.style.display="none"}}onRedraw({viewports:e,layers:t}){const n=e.reduce((i,s)=>(i[s.id]=s,i),{});for(const i of this.getWidgets()){const{viewId:s}=i;if(s){const o=n[s];o&&(i.onViewportChange&&i.onViewportChange(o),i.onRedraw?.({viewports:[o],layers:t}))}else{if(i.onViewportChange)for(const o of e)i.onViewportChange(o);i.onRedraw?.({viewports:e,layers:t})}}this.lastViewports=n,this._updateContainers()}onHover(e,t){for(const n of this.getWidgets()){const{viewId:i}=n;(!i||i===e.viewport?.id)&&n.onHover?.(e,t)}}onEvent(e,t){const n=x2[t.type];if(n)for(const i of this.getWidgets()){const{viewId:s}=i;(!s||s===e.viewport?.id)&&i[n]?.(e,t)}}}const WX={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class JX{constructor(){this.id="default-tooltip",this.placement="fill",this.props={},this.isVisible=!1}onAdd({deck:e}){const t=document.createElement("div");return t.className="deck-tooltip",Object.assign(t.style,WX),this.deck=e,this.element=t,t}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){const{deck:t}=this,n=t&&t.props.getTooltip;if(!n)return;const i=n(e);this.lastViewport=e.viewport,this.setTooltip(i,e.x,e.y)}setTooltip(e,t,n){const i=this.element;if(i){if(typeof e=="string")i.innerText=e;else if(e)e.text&&(i.innerText=e.text),e.html&&(i.innerHTML=e.html),e.className&&(i.className=e.className);else{this.isVisible=!1,i.style.display="none";return}this.isVisible=!0,i.style.display="block",i.style.transform=`translate(${t}px, ${n}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(i.style,e.style)}}}var sp;(function(r){r[r.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",r[r.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",r[r.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r[r.ZERO=0]="ZERO",r[r.ONE=1]="ONE",r[r.SRC_COLOR=768]="SRC_COLOR",r[r.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.DST_ALPHA=772]="DST_ALPHA",r[r.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",r[r.DST_COLOR=774]="DST_COLOR",r[r.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",r[r.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",r[r.CONSTANT_COLOR=32769]="CONSTANT_COLOR",r[r.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",r[r.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",r[r.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",r[r.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",r[r.BLEND_EQUATION=32777]="BLEND_EQUATION",r[r.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",r[r.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",r[r.BLEND_DST_RGB=32968]="BLEND_DST_RGB",r[r.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",r[r.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",r[r.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",r[r.BLEND_COLOR=32773]="BLEND_COLOR",r[r.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",r[r.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",r[r.LINE_WIDTH=2849]="LINE_WIDTH",r[r.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",r[r.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",r[r.CULL_FACE_MODE=2885]="CULL_FACE_MODE",r[r.FRONT_FACE=2886]="FRONT_FACE",r[r.DEPTH_RANGE=2928]="DEPTH_RANGE",r[r.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",r[r.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",r[r.DEPTH_FUNC=2932]="DEPTH_FUNC",r[r.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",r[r.STENCIL_FUNC=2962]="STENCIL_FUNC",r[r.STENCIL_FAIL=2964]="STENCIL_FAIL",r[r.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",r[r.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",r[r.STENCIL_REF=2967]="STENCIL_REF",r[r.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",r[r.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",r[r.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",r[r.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",r[r.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",r[r.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",r[r.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",r[r.VIEWPORT=2978]="VIEWPORT",r[r.SCISSOR_BOX=3088]="SCISSOR_BOX",r[r.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",r[r.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",r[r.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",r[r.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",r[r.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",r[r.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",r[r.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",r[r.RED_BITS=3410]="RED_BITS",r[r.GREEN_BITS=3411]="GREEN_BITS",r[r.BLUE_BITS=3412]="BLUE_BITS",r[r.ALPHA_BITS=3413]="ALPHA_BITS",r[r.DEPTH_BITS=3414]="DEPTH_BITS",r[r.STENCIL_BITS=3415]="STENCIL_BITS",r[r.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",r[r.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",r[r.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",r[r.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",r[r.SAMPLES=32937]="SAMPLES",r[r.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",r[r.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",r[r.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",r[r.VENDOR=7936]="VENDOR",r[r.RENDERER=7937]="RENDERER",r[r.VERSION=7938]="VERSION",r[r.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",r[r.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",r[r.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",r[r.STATIC_DRAW=35044]="STATIC_DRAW",r[r.STREAM_DRAW=35040]="STREAM_DRAW",r[r.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.BUFFER_SIZE=34660]="BUFFER_SIZE",r[r.BUFFER_USAGE=34661]="BUFFER_USAGE",r[r.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",r[r.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",r[r.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",r[r.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",r[r.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",r[r.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",r[r.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",r[r.CULL_FACE=2884]="CULL_FACE",r[r.FRONT=1028]="FRONT",r[r.BACK=1029]="BACK",r[r.FRONT_AND_BACK=1032]="FRONT_AND_BACK",r[r.BLEND=3042]="BLEND",r[r.DEPTH_TEST=2929]="DEPTH_TEST",r[r.DITHER=3024]="DITHER",r[r.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",r[r.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",r[r.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",r[r.SCISSOR_TEST=3089]="SCISSOR_TEST",r[r.STENCIL_TEST=2960]="STENCIL_TEST",r[r.NO_ERROR=0]="NO_ERROR",r[r.INVALID_ENUM=1280]="INVALID_ENUM",r[r.INVALID_VALUE=1281]="INVALID_VALUE",r[r.INVALID_OPERATION=1282]="INVALID_OPERATION",r[r.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",r[r.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",r[r.CW=2304]="CW",r[r.CCW=2305]="CCW",r[r.DONT_CARE=4352]="DONT_CARE",r[r.FASTEST=4353]="FASTEST",r[r.NICEST=4354]="NICEST",r[r.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",r[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.INT=5124]="INT",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.FLOAT=5126]="FLOAT",r[r.DOUBLE=5130]="DOUBLE",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.ALPHA=6406]="ALPHA",r[r.RGB=6407]="RGB",r[r.RGBA=6408]="RGBA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",r[r.VERTEX_SHADER=35633]="VERTEX_SHADER",r[r.COMPILE_STATUS=35713]="COMPILE_STATUS",r[r.DELETE_STATUS=35712]="DELETE_STATUS",r[r.LINK_STATUS=35714]="LINK_STATUS",r[r.VALIDATE_STATUS=35715]="VALIDATE_STATUS",r[r.ATTACHED_
2006SHADERS=35717]="ATTACHED_SHADERS",r[r.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",r[r.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",r[r.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",r[r.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",r[r.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",r[r.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",r[r.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",r[r.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",r[r.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",r[r.SHADER_TYPE=35663]="SHADER_TYPE",r[r.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",r[r.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",r[r.NEVER=512]="NEVER",r[r.LESS=513]="LESS",r[r.EQUAL=514]="EQUAL",r[r.LEQUAL=515]="LEQUAL",r[r.GREATER=516]="GREATER",r[r.NOTEQUAL=517]="NOTEQUAL",r[r.GEQUAL=518]="GEQUAL",r[r.ALWAYS=519]="ALWAYS",r[r.KEEP=7680]="KEEP",r[r.REPLACE=7681]="REPLACE",r[r.INCR=7682]="INCR",r[r.DECR=7683]="DECR",r[r.INVERT=5386]="INVERT",r[r.INCR_WRAP=34055]="INCR_WRAP",r[r.DECR_WRAP=34056]="DECR_WRAP",r[r.NEAREST=9728]="NEAREST",r[r.LINEAR=9729]="LINEAR",r[r.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",r[r.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",r[r.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",r[r.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE=5890]="TEXTURE",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r[r.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",r[r.TEXTURE0=33984]="TEXTURE0",r[r.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",r[r.REPEAT=10497]="REPEAT",r[r.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r[r.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",r[r.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",r[r.FLOAT_VEC2=35664]="FLOAT_VEC2",r[r.FLOAT_VEC3=35665]="FLOAT_VEC3",r[r.FLOAT_VEC4=35666]="FLOAT_VEC4",r[r.INT_VEC2=35667]="INT_VEC2",r[r.INT_VEC3=35668]="INT_VEC3",r[r.INT_VEC4=35669]="INT_VEC4",r[r.BOOL=35670]="BOOL",r[r.BOOL_VEC2=35671]="BOOL_VEC2",r[r.BOOL_VEC3=35672]="BOOL_VEC3",r[r.BOOL_VEC4=35673]="BOOL_VEC4",r[r.FLOAT_MAT2=35674]="FLOAT_MAT2",r[r.FLOAT_MAT3=35675]="FLOAT_MAT3",r[r.FLOAT_MAT4=35676]="FLOAT_MAT4",r[r.SAMPLER_2D=35678]="SAMPLER_2D",r[r.SAMPLER_CUBE=35680]="SAMPLER_CUBE",r[r.LOW_FLOAT=36336]="LOW_FLOAT",r[r.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",r[r.HIGH_FLOAT=36338]="HIGH_FLOAT",r[r.LOW_INT=36339]="LOW_INT",r[r.MEDIUM_INT=36340]="MEDIUM_INT",r[r.HIGH_INT=36341]="HIGH_INT",r[r.FRAMEBUFFER=36160]="FRAMEBUFFER",r[r.RENDERBUFFER=36161]="RENDERBUFFER",r[r.RGBA4=32854]="RGBA4",r[r.RGB5_A1=32855]="RGB5_A1",r[r.RGB565=36194]="RGB565",r[r.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",r[r.STENCIL_INDEX=6401]="STENCIL_INDEX",r[r.STENCIL_INDEX8=36168]="STENCIL_INDEX8",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r[r.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",r[r.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",r[r.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",r[r.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",r[r.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",r[r.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",r[r.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",r[r.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",r[r.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_OBJ
2006ECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",r[r.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",r[r.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",r[r.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",r[r.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",r[r.NONE=0]="NONE",r[r.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",r[r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",r[r.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",r[r.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",r[r.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",r[r.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",r[r.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",r[r.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",r[r.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",r[r.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",r[r.READ_BUFFER=3074]="READ_BUFFER",r[r.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",r[r.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",r[r.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",r[r.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",r[r.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",r[r.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",r[r.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",r[r.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",r[r.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",r[r.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",r[r.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",r[r.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",r[r.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",r[r.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",r[r.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",r[r.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",r[r.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",r[r.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",r[r.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",r[r.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",r[r.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",r[r.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",r[r.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",r[r.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",r[r.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",r[r.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",r[r.RED=6403]="RED",r[r.RGB8=32849]="RGB8",r[r.RGBA8=32856]="RGBA8",r[r.RGB10_A2=32857]="RGB10_A2",r[r.TEXTURE_3D=32879]="TEXTURE_3D",r[r.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",r[r.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",r[r.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",r[r.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",r[r.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",r[r.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",r[r.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",r[r.SRGB=35904]="SRGB",r[r.SRGB8=35905]="SRGB8",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",r[r.RGBA32F=34836]="RGBA32F",r[r.RGB32F=34837]="RGB32F",r[r.RGBA16F=34842]="RGBA16F",r[r.RGB16F=34843]="RGB16F",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",r[r.R11F_G11F_B10F=35898]="R11F_G11F_B10F",r[r.RGB9_E5=35901]="RGB9_E5",r[r.RGBA32UI=36208]="RGBA32UI",r[r.RGB32UI=36209]="RGB32UI",r[r.RGBA16UI=36214]="RGBA16UI",r[r.RGB16UI=36215]="RGB16UI",r[r.RGBA8UI=36220]="RGBA8UI",r[r.RGB8UI=36221]="RGB8UI",r[r.RGBA32I=36226]="RGBA32I",r[r.RGB32I=36227]="RGB32I",r[r.RGBA16I=36232]="RGBA16I",r[r.RGB16I=36233]="RGB16I",r[r.RGBA8I=36238]="RGBA8I",r[r.RGB8I=36239]="RGB8I",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.R8=33321]="R8",r[r.RG8=33323]="RG8",r[r.R16F=33325]="R16F",r[r.R32F=33326]="R32F",r[r.RG16F=33327]="RG16F",r[r.RG32F=33328]="RG32F",r[r.R8I=33329]="R8I",r[r.R8UI=33330]="R8UI",r[r.R16I=33331]="R16I",r[r.R16UI=33332]="R16UI",r[r.R32I=33333]="R32I",r[r.R32UI=33334]="R32UI",r[r.RG8I=33335]="RG8I",r[r.RG8UI=33336]="RG8UI",r[r.RG16I=33337]="RG16I",r[r.RG16UI=33338]="RG16UI",r[r.RG32I=33339]="RG32I",r[r.RG32UI=33340]="RG32UI",r[r.R8_SNORM=36756]="R8_SNORM",r[r.RG8_SNORM=36757]="RG8_SNORM",r[r.RGB8_SNORM=36758]="RGB8_SNORM",r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGB10_A2UI=36975]="RGB10_A2UI",r[r.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",r[r.TEXTURE_IMMUTABLE_
2006LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.HALF_FLOAT=5131]="HALF_FLOAT",r[r.RG=33319]="RG",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",r[r.CURRENT_QUERY=34917]="CURRENT_QUERY",r[r.QUERY_RESULT=34918]="QUERY_RESULT",r[r.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",r[r.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",r[r.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",r[r.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",r[r.DRAW_BUFFER0=34853]="DRAW_BUFFER0",r[r.DRAW_BUFFER1=34854]="DRAW_BUFFER1",r[r.DRAW_BUFFER2=34855]="DRAW_BUFFER2",r[r.DRAW_BUFFER3=34856]="DRAW_BUFFER3",r[r.DRAW_BUFFER4=34857]="DRAW_BUFFER4",r[r.DRAW_BUFFER5=34858]="DRAW_BUFFER5",r[r.DRAW_BUFFER6=34859]="DRAW_BUFFER6",r[r.DRAW_BUFFER7=34860]="DRAW_BUFFER7",r[r.DRAW_BUFFER8=34861]="DRAW_BUFFER8",r[r.DRAW_BUFFER9=34862]="DRAW_BUFFER9",r[r.DRAW_BUFFER10=34863]="DRAW_BUFFER10",r[r.DRAW_BUFFER11=34864]="DRAW_BUFFER11",r[r.DRAW_BUFFER12=34865]="DRAW_BUFFER12",r[r.DRAW_BUFFER13=34866]="DRAW_BUFFER13",r[r.DRAW_BUFFER14=34867]="DRAW_BUFFER14",r[r.DRAW_BUFFER15=34868]="DRAW_BUFFER15",r[r.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",r[r.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",r[r.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",r[r.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",r[r.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",r[r.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",r[r.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",r[r.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",r[r.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",r[r.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",r[r.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",r[r.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",r[r.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",r[r.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",r[r.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",r[r.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",r[r.SAMPLER_3D=35679]="SAMPLER_3D",r[r.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",r[r.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",r[r.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",r[r.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",r[r.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",r[r.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",r[r.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",r[r.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",r[r.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",r[r.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",r[r.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",r[r.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",r[r.MAX_SAMPLES=36183]="MAX_SAMPLES",r[r.SAMPLER_BINDING=35097]="SAMPLER_BINDING",r[r.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",r[r.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",r[r.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",r[r.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",r[r.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",r[r.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",r[r.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",r[r.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",r[r.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",r[r.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",r[r.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",r[r.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",r[r.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",r[r.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",r[r.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",r[r.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",r[r.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",r[r.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",r[r.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",r[r.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",r[r.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",r[r.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",r[r.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",r[r.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",r[r.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",r[r.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",r[r.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",r[r.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",r[r.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",r[r.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",r[r.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",r[r.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",r[r.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",r[r.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",r[r.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",r[r.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",r[r.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",r[r.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",r[r.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",r[r.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",r[r.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",r[r.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",r[r.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r[r.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",r[r.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",r[r.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",r[r.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",r[r.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",r[r.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",r[r.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",r[r.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",r[r.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",r[r.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",r[r.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",r[r.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",r[r.UNIFORM_TYPE=35383]="UNIFORM_TYPE",r[r.UNIFORM_SIZE=35384]="UNIFORM_SIZE",r[r.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",r[r.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",r[r.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",r[r.UNIFORM_MATRIX_STRI
2006DE=35389]="UNIFORM_MATRIX_STRIDE",r[r.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",r[r.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",r[r.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",r[r.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",r[r.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",r[r.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",r[r.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",r[r.OBJECT_TYPE=37138]="OBJECT_TYPE",r[r.SYNC_CONDITION=37139]="SYNC_CONDITION",r[r.SYNC_STATUS=37140]="SYNC_STATUS",r[r.SYNC_FLAGS=37141]="SYNC_FLAGS",r[r.SYNC_FENCE=37142]="SYNC_FENCE",r[r.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",r[r.UNSIGNALED=37144]="UNSIGNALED",r[r.SIGNALED=37145]="SIGNALED",r[r.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",r[r.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",r[r.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",r[r.WAIT_FAILED=37149]="WAIT_FAILED",r[r.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",r[r.COLOR=6144]="COLOR",r[r.DEPTH=6145]="DEPTH",r[r.STENCIL=6146]="STENCIL",r[r.MIN=32775]="MIN",r[r.MAX=32776]="MAX",r[r.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",r[r.STREAM_READ=35041]="STREAM_READ",r[r.STREAM_COPY=35042]="STREAM_COPY",r[r.STATIC_READ=35045]="STATIC_READ",r[r.STATIC_COPY=35046]="STATIC_COPY",r[r.DYNAMIC_READ=35049]="DYNAMIC_READ",r[r.DYNAMIC_COPY=35050]="DYNAMIC_COPY",r[r.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",r[r.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",r[r.INVALID_INDEX=4294967295]="INVALID_INDEX",r[r.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",r[r.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",r[r.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",r[r.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",r[r.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",r[r.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",r[r.R16_EXT=33322]="R16_EXT",r[r.RG16_EXT=33324]="RG16_EXT",r[r.RGB16_EXT=32852]="RGB16_EXT",r[r.RGBA16_EXT=32859]="RGBA16_EXT",r[r.R16_SNORM_EXT=36760]="R16_SNORM_EXT",r[r.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",r[r.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",r[r.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",r[r.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",r[r.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",r[r.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",r[r.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",r[r.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",r[r.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",r[r.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",r[r.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",r[r.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",r[r.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",r[r.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",r[r.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",r[r.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",r[r.LINE_WEBGL=6913]="LINE_WEBGL",r[r.FILL_WEBGL=6914]="FILL_WEBGL",r[r.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",r[r.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",r[r.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",r[r.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",r[r.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",r[r.CLIP_DISTANCE2_WEBGL=12290]="
2006CLIP_DISTANCE2_WEBGL",r[r.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",r[r.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",r[r.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",r[r.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",r[r.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",r[r.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",r[r.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",r[r.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",r[r.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",r[r.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",r[r.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",r[r.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",r[r.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",r[r.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",r[r.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",r[r.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",r[r.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",r[r.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(sp||(sp={}));const Rw={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},hs=(r,e,t)=>e?r.enable(t):r.disable(t),u3=(r,e,t)=>r.hint(t,e),aa=(r,e,t)=>r.pixelStorei(t,e),f3=(r,e,t)=>{const n=t===36006?36009:36008;return r.bindFramebuffer(n,e)},FA=(r,e,t)=>{const i={34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[t];r.bindBuffer(i,e)};function hb(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}const XX={3042:hs,32773:(r,e)=>r.blendColor(...e),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(r,e)=>r.clearColor(...e),3107:(r,e)=>r.colorMask(...e),2884:hs,2885:(r,e)=>r.cullFace(e),2929:hs,2931:(r,e)=>r.clearDepth(e),2932:(r,e)=>r.depthFunc(e),2928:(r,e)=>r.depthRange(...e),2930:(r,e)=>r.depthMask(e),3024:hs,35723:u3,35725:(r,e)=>r.useProgram(e),36007:(r,e)=>r.bindRenderbuffer(36161,e),36389:(r,e)=>r.bindTransformFeedback?.(36386,e),34229:(r,e)=>r.bindVertexArray(e),36006:f3,36010:f3,34964:FA,36662:FA,36663:FA,35053:FA,35055:FA,2886:(r,e)=>r.frontFace(e),33170:u3,2849:(r,e)=>r.lineWidth(e),32823:hs,32824:"polygonOffset",10752:"polygonOffset",35977:hs,32926:hs,32928:hs,32938:"sampleCoverage",32939:"sampleCoverage",3089:hs,3088:(r,e)=>r.scissor(...e),2960:hs,2961:(r,e)=>r.clearStencil(e),2968:(r,e)=>r.stencilMaskSeparate(1028,e),36005:(r,e)=>r.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:(r,e)=>r.viewport(...e),34383:hs,10754:hs,12288:hs,12289:hs,12290:hs,12291:hs,12292:hs,12293:hs,12294:hs,12295:hs,3333:aa,3317:aa,37440:aa,37441:aa,37443:aa,3330:aa,3332:
vendor: 4,666 bytes, line 2006
2006aa,3331:aa,3314:aa,32878:aa,3316:aa,3315:aa,32877:aa,framebuffer:(r,e)=>{const t=e&&"handle"in e?e.handle:e;return r.bindFramebuffer(36160,t)},blend:(r,e)=>e?r.enable(3042):r.disable(3042),blendColor:(r,e)=>r.blendColor(...e),blendEquation:(r,e)=>{const t=typeof e=="number"?[e,e]:e;r.blendEquationSeparate(...t)},blendFunc:(r,e)=>{const t=e?.length===2?[...e,...e]:e;r.blendFuncSeparate(...t)},clearColor:(r,e)=>r.clearColor(...e),clearDepth:(r,e)=>r.clearDepth(e),clearStencil:(r,e)=>r.clearStencil(e),colorMask:(r,e)=>r.colorMask(...e),cull:(r,e)=>e?r.enable(2884):r.disable(2884),cullFace:(r,e)=>r.cullFace(e),depthTest:(r,e)=>e?r.enable(2929):r.disable(2929),depthFunc:(r,e)=>r.depthFunc(e),depthMask:(r,e)=>r.depthMask(e),depthRange:(r,e)=>r.depthRange(...e),dither:(r,e)=>e?r.enable(3024):r.disable(3024),derivativeHint:(r,e)=>{r.hint(35723,e)},frontFace:(r,e)=>r.frontFace(e),mipmapHint:(r,e)=>r.hint(33170,e),lineWidth:(r,e)=>r.lineWidth(e),polygonOffsetFill:(r,e)=>e?r.enable(32823):r.disable(32823),polygonOffset:(r,e)=>r.polygonOffset(...e),sampleCoverage:(r,e)=>r.sampleCoverage(e[0],e[1]||!1),scissorTest:(r,e)=>e?r.enable(3089):r.disable(3089),scissor:(r,e)=>r.scissor(...e),stencilTest:(r,e)=>e?r.enable(2960):r.disable(2960),stencilMask:(r,e)=>{e=hb(e)?e:[e,e];const[t,n]=e;r.stencilMaskSeparate(1028,t),r.stencilMaskSeparate(1029,n)},stencilFunc:(r,e)=>{e=hb(e)&&e.length===3?[...e,...e]:e;const[t,n,i,s,o,c]=e;r.stencilFuncSeparate(1028,t,n,i),r.stencilFuncSeparate(1029,s,o,c)},stencilOp:(r,e)=>{e=hb(e)&&e.length===3?[...e,...e]:e;const[t,n,i,s,o,c]=e;r.stencilOpSeparate(1028,t,n,i),r.stencilOpSeparate(1029,s,o,c)},viewport:(r,e)=>r.viewport(...e)};function es(r,e,t){return e[r]!==void 0?e[r]:t[r]}const KX={blendEquation:(r,e,t)=>r.blendEquationSeparate(es(32777,e,t),es(34877,e,t)),blendFunc:(r,e,t)=>r.blendFuncSeparate(es(32969,e,t),es(32968,e,t),es(32971,e,t),es(32970,e,t)),polygonOffset:(r,e,t)=>r.polygonOffset(es(32824,e,t),es(10752,e,t)),sampleCoverage:(r,e,t)=>r.sampleCoverage(es(32938,e,t),es(32939,e,t)),stencilFuncFront:(r,e,t)=>r.stencilFuncSeparate(1028,es(2962,e,t),es(2967,e,t),es(2963,e,t)),stencilFuncBack:(r,e,t)=>r.stencilFuncSeparate(1029,es(34816,e,t),es(36003,e,t),es(36004,e,t)),stencilOpFront:(r,e,t)=>r.stencilOpSeparate(1028,es(2964,e,t),es(2965,e,t),es(2966,e,t)),stencilOpBack:(r,e,t)=>r.stencilOpSeparate(1029,es(34817,e,t),es(34818,e,t),es(34819,e,t))},h3={enable:(r,e)=>r({[e]:!0}),disable:(r,e)=>r({[e]:!1}),pixelStorei:(r,e,t)=>r({[e]:t}),hint:(r,e,t)=>r({[e]:t}),useProgram:(r,e)=>r({35725:e}),bindRenderbuffer:(r,e,t)=>r({36007:t}),bindTransformFeedback:(r,e,t)=>r({36389:t}),bindVertexArray:(r,e)=>r({34229:e}),bindFramebuffer:(r,e,t)=>{switch(e){case 36160:return r({36006:t,36010:t});case 36009:return r({36006:t});case 36008:return r({36010:t});default:return null}},bindBuffer:(r,e,t)=>{const n={34962:[34964],36662:[36662],36663:[36663],35051:[35053],35052:[35055]}[e];return n?r({[n]:t}):{valueChanged:!0}},blendColor:(r,e,t,n,i)=>r({32773:new Float32Array([e,t,n,i])}),blendEquation:(r,e)=>r({32777:e,34877:e}),blendEquationSeparate:(r,e,t)=>r({32777:e,34877:t}),blendFunc:(r,e,t)=>r({32969:e,32968:t,32971:e,32970:t}),blendFuncSeparate:(r,e,t,n,i)=>r({32969:e,32968:t,32971:n,32970:i}),clearColor:(r,e,t,n,i)=>r({3106:new Float32Array([e,t,n,i])}),clearDepth:(r,e)=>r({2931:e}),clearStencil:(r,e)=>r({2961:e}),colorMask:(r,e,t,n,i)=>r({3107:[e,t,n,i]}),cullFace:(r,e)=>r({2885:e}),depthFunc:(r,e)=>r({2932:e}),depthRange:(r,e,t)=>r({2928:new Float32Array([e,t])}),depthMask:(r,e)=>r({2930:e}),frontFace:(r,e)=>r({2886:e}),lineWidth:(r,e)=>r({2849:e}),polygonOffset:(r,e,t)=>r({32824:e,10752:t}),sampleCoverage:(r,e,t)=>r({32938:e,32939:t}),scissor:(r,e,t,n,i)=>r({3088:new Int32Array([e,t,n,i])}),stencilMask:(r,e)=>r({2968:e,36005:e}),stencilMaskSeparate:(r,e,t)=>r({[e===1028?2968:36005]:t}),stencilFunc:(r,e,t,n)=>r({2962:e,2967:t,2963:n,34816:e,36003:t,36004:n}),stencilFuncSeparate:(r,e,t,n,i)=>r({[e===1028?2962:34816]:t,[e===1028?2967:36003]:n,[e===1028?2963:36004]:i}),stencilOp:(r,e,t,n)=>r({2964:e,2965:t,2966:n,34817:e,34818:t,34819:n}),stencilOpSeparate:(r,e,t,n,i)=>r({[e===1028?2964:34817]:t,[e===1028?2965:34818]:n,[e===1028?2966:34819]:i}),viewport:(r,e,t,n,i)=>r({2978:[e,t,n,i]})},el=(r,e)=>r.isEnabled(e),d3={3042:el,2884:el,2929:el,3024:el,32823:el,32926:el,32928:el,3089:el,2960:el,35977:el},qX=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 $p(r,e){if(ZX(e))return;const t={};for(const i in e){const s=Number(i),o=XX[i];
2006o&&(typeof o=="string"?t[o]=!0:o(r,e[i],s))}const n=r.state&&r.state.cache;if(n)for(const i in t){const s=KX[i];s(r,e,n)}}function pL(r,e=Rw){if(typeof e=="number"){const i=e,s=d3[i];return s?s(r,i):r.getParameter(i)}const t=Array.isArray(e)?e:Object.keys(e),n={};for(const i of t){const s=d3[i];n[i]=s?s(r,Number(i)):r.getParameter(Number(i))}return n}function YX(r){$p(r,Rw)}function ZX(r){for(const e in r)return!1;return!0}function QX(r,e){if(r===e)return!0;const t=Array.isArray(r)||ArrayBuffer.isView(r),n=Array.isArray(e)||ArrayBuffer.isView(e);if(t&&n&&r.length===e.length){for(let i=0;i<r.length;++i)if(r[i]!==e[i])return!1;return!0}return!1}class ih{static get(e){return e.state}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(e,t){this.gl=e,this.log=t?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){const e=this.stateStack[this.stateStack.length-1];$p(this.gl,e),this.stateStack.pop()}trackState(e,t){if(this.cache=t.copyState?pL(e):Object.assign({},Rw),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,tK(e);for(const n in h3){const i=h3[n];eK(e,n,i)}p3(e,"getParameter"),p3(e,"isEnabled")}_updateCache(e){let t=!1,n;const i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(const s in e){const o=e[s],c=this.cache[s];QX(o,c)||(t=!0,n=c,i&&!(s in i)&&(i[s]=c),this.cache[s]=o)}return{valueChanged:t,oldValue:n}}}function p3(r,e){const t=r[e].bind(r);r[e]=function(i){if(i===void 0||qX.has(i))return t(i);const s=ih.get(r);return i in s.cache||(s.cache[i]=t(i)),s.enable?s.cache[i]:t(i)},Object.defineProperty(r[e],"name",{value:`${e}-from-cache`,configurable:!1})}function eK(r,e,t){if(!r[e])return;const n=r[e].bind(r);r[e]=function(...s){const o=ih.get(r),{valueChanged:c,oldValue:f}=t(o._updateCache,...s);return c&&n(...s),f},Object.defineProperty(r[e],"name",{value:`${e}-to-cache`,configurable:!1})}function tK(r){const e=r.useProgram.bind(r);r.useProgram=function(n){const i=ih.get(r);i.program!==n&&(e(n),i.program=n)}}function rK(r,e,t){let n="";const i={preserveDrawingBuffer:!0,...t};let s=null;if(s||=r.getContext("webgl2",i),i.failIfMajorPerformanceCaveat&&(n||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."),!s&&!t.failIfMajorPerformanceCaveat&&(i.failIfMajorPerformanceCaveat=!1,s=r.getContext("webgl2",i),s.luma||={},s.luma.softwareRenderer=!0),s||(s=r.getContext("webgl",{}),s&&(s=null,n||="Your browser only supports WebGL1")),!s)throw n||="Your browser does not support WebGL",new Error(`Failed to create WebGL context: ${n}`);const{onContextLost:o,onContextRestored:c}=e;return r.addEventListener("webglcontextlost",f=>o(f),!1),r.addEventListener("webglcontextrestored",f=>c(f),!1),s.luma||={},s}function Fp(r,e,t){return t[e]===void 0&&(t[e]=r.getExtension(e)||null),t[e]}function nK(r,e){const t=r.getParameter(7936),n=r.getParameter(7937);Fp(r,"WEBGL_debug_renderer_info",e);const i=e.WEBGL_debug_renderer_info,s=r.getParameter(i?i.UNMASKED_VENDOR_WEBGL:7936),o=r.getParameter(i?i.UNMASKED_RENDERER_WEBGL:7937),c=s||t,f=o||n,A=r.getParameter(7938),v=AL(c,f),w=iK(c,f),S=sK(c,f);return{type:"webgl",gpu:v,gpuType:S,gpuBackend:w,vendor:c,renderer:f,version:A,shadingLanguage:"glsl",shadingLanguageVersion:300}}function AL(r,e){return/NVIDIA/i.exec(r)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(r)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(r)||/Apple/i.exec(e)?"apple":/AMD/i.exec(r)||/AMD/i.exec(e)||/ATI/i.exec(r)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(r)||/SwiftShader/i.exec(e)?"software":"unknown"}function iK(r,e){return/Metal/i.exec(r)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(r)||/ANGLE/i.exec(e)?"opengl":"unknown"}function sK(r,e){if(/SwiftShader/i.exec(r)||/SwiftShader/i.exec(e))return"cpu";switch(AL(r,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function gL(r){switch(r){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(r))}const WA="WEBGL_compressed_texture_s3tc",JA="WEBGL_compressed_texture_s3tc_srgb",op="EXT_texture_compression_rgtc",ap="EXT_texture_compression_bptc",oK="WEBGL_compressed_texture_etc",aK="WEBGL_compressed_texture_astc",cK="WEBGL_compressed_texture_etc1",lK="WEBGL_compressed_texture_pvrtc",uK="WEBGL_compressed_texture_atc",A3="EXT_texture_norm16",g3="EXT_render_snorm",fK="EXT_color_buffer_float",Fw={"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":[g3],"norm16-renderable-webgl":[A3],"snorm16-renderable-webgl":[A3,g3],"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":[WA,JA,op,ap],"texture-compression-bc5-webgl":[op],"texture-compression-bc7-webgl":[ap],"texture-compression-etc2":[oK],"texture-compression-astc":[aK],"texture-compression-etc1-webgl":[cK],"texture-compression-pvrtc-webgl":[lK],"texture-compression-atc-webgl":[uK]};function hK(r){return r in Fw}function dK(r,e,t){return(Fw[e]||[]).every(i=>Fp(r,i,t))}const Dw={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0},"r16unorm-webgl":{gl:33322,rb:!0},"r16snorm-webgl":{gl:36760},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0},"rg16unorm-webgl":{gl:33324},"rg16snorm-webgl":{gl:36761},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326},rgb9e5ufloat:{gl:35901},rg11b10ufloat:{gl:35898,rb:!0}
2006,rgb10a2unorm:{gl:32857,rb:!0},"rgb10a2uint-webgl":{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852},"rgb16snorm-webgl":{gl:36762},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842},"rgba16unorm-webgl":{gl:32859,rb:!0},"rgba16snorm-webgl":{gl:36763},"rgb32float-webgl":{gl:34837,x:fK,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:WA},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:JA},"bc1-rgba-unorm":{gl:33777,x:WA},"bc1-rgba-unorm-srgb":{gl:35916,x:JA},"bc2-rgba-unorm":{gl:33778,x:WA},"bc2-rgba-unorm-srgb":{gl:35918,x:JA},"bc3-rgba-unorm":{gl:33779,x:WA},"bc3-rgba-unorm-srgb":{gl:35919,x:JA},"bc4-r-unorm":{gl:36283,x:op},"bc4-r-snorm":{gl:36284,x:op},"bc5-rg-unorm":{gl:36285,x:op},"bc5-rg-snorm":{gl:36286,x:op},"bc6h-rgb-ufloat":{gl:36495,x:ap},"bc6h-rgb-float":{gl:36494,x:ap},"bc7-rgba-unorm":{gl:36492,x:ap},"bc7-rgba-unorm-srgb":{gl:36493,x:ap},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37819},"astc-10x5-unorm-srgb":{gl:37851},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rbg2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}};function pK(r,e,t){let n=e.create;const i=Dw[e.format];return i?.gl===void 0&&(n=!1),i?.x&&(n=n&&!!Fp(r,i.x,t)),{format:e.format,create:n&&e.create,render:n&&e.render,filter:n&&e.filter,blend:n&&e.blend,store:n&&e.store}}function mL(r){const e=Dw[r],t=mK(r),n=ew(r);return{internalFormat:t,format:e?.dataFormat||gK(n.channels,n.integer,n.normalized,t),type:n.dataType?gL(n.dataType):e?.types?.[0]||5121,compressed:n.compressed||!1}}function AK(r){switch(ew(r).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${r}`)}}function gK(r,e,t,n){if(n===6408||n===6407)return n;switch(r){case"r":return e&&!t?36244:6403;case"rg":return e&&!t?33320:33319;case"rgb":return e&&!t?36248:6407;case"rgba":return e&&!t?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function mK(r){const t=Dw[r]?.gl;if(t===void 0)throw new Error(`Unsupported texture format ${r}`);return t}const m3={"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"};class _K extends QV{gl;extensions;testedFeatures=new Set;constructor(e,t,n){super([],n),this.gl=e,this.extensions=t,Fp(e,"EXT_color_buffer_float",t)}*[Symbol.iterator](){const e=this.getFeatures();for(const t of e)this.has(t)&&(yield t);return[]}has(e){return this.disabledFeatures?.[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),hK(e)&&dK(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){const e=this.getFeatures().filter(t=>t!=="polygon-mode-webgl");for(const t of e)this.has(t)}getFeatures(){return[...Object.keys(m3),...Object.keys(Fw)]}getWebGLFeature(e){const t=m3[e];return typeof t=="string"?!!Fp(this.gl,t,this.extensions):!!t}}class yK extends ZV{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]||0}}class sg extends ly{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(e,t){super(e,t);const n=t.handle===null;this.device=e,this.gl=e.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),n||(e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){const e=this.gl.bindFramebuffer(36160,this.handle);for(let t=0;t<this.colorAttachments.length;++t){const n=this.colorAttachments[t];if(n){const i=36064+t;this._attachTextureView(i,n)}}if(this.depthStencilAttachment){const t=AK(this.depthStencilAttachment.props.format);this._attachTextureView(t,this.depthStencilAttachment)}if(this.device.props.debug){const t=this.gl.checkFramebufferStatus(36160);if(t!==36053)throw new Error(`Framebuffer ${bK(t)}`)}this.gl.bindFramebuffer(36160,e)}_attachTextureView(e,t){const{gl:n}=this.device,{texture:i}=t,s=t.props.baseMipLevel,o=t.props.baseArrayLayer;switch(n.bindTexture(i.glTarget,i.handle),i.glTarget){case 35866:case 32879:n.framebufferTextureLayer(36160,e,i.handle,s,o);break;case 34067:const c=vK(o);n.framebufferTexture2D(36160,e,c,i.handle,s);break;case 3553:n.framebufferTexture2D(36160,e,3553,i.handle,s);break;default:throw new Error("Illegal texture type")}n.bindTexture(i.glTarget,null)}}function vK(r){return r<34069?r+34069:r}function bK(r){switch(r){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`${r}`}}
2006class xK extends tw{device;format="rgba8unorm";depthStencilFormat="depth24plus";presentationSize;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(e,t){super(t),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new sg(this.device,{handle:null}),this._framebuffer}update(){const 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){const t=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(t,e);return}}commit(){}}async function _L(r,e){const t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");const n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",r),new Promise((i,s)=>{n.onload=i,n.onerror=o=>s(new Error(`Unable to load script '${r}': ${o}`)),t.appendChild(n)})}const wK=1;let ca=null,_3=!1;const Ow={debugSpectorJS:Zt.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/[email protected]/dist/spector.bundle.js",gl:void 0};async function CK(r){if(!globalThis.SPECTOR)try{await _L(r.debugSpectorJSUrl||Ow.debugSpectorJSUrl)}catch(e){Zt.warn(String(e))}}function TK(r){if(r={...Ow,...r},!r.debugSpectorJS)return null;if(!ca&&globalThis.SPECTOR&&!globalThis.luma?.spector){Zt.probe(wK,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:e}=globalThis.SPECTOR;ca=new e,globalThis.luma&&(globalThis.luma.spector=ca)}if(!ca)return null;if(_3||(_3=!0,ca.spyCanvases(),ca?.onCaptureStarted.add(e=>Zt.info("Spector capture started:",e)()),ca?.onCapture.add(e=>{Zt.info("Spector capture complete:",e)(),ca?.getResultUI(),ca?.resultView.display(),ca?.resultView.addCapture(e)})),r.gl){const e=r.gl,t=e.device;ca?.startCapture(r.gl,500),e.device=t,new Promise(n=>setTimeout(n,2e3)).then(n=>{Zt.info("Spector capture stopped after 2 seconds")(),ca?.stopCapture()})}return ca}const EK="https://unpkg.com/[email protected]/index.js";function yL(r){return r.luma=r.luma||{},r.luma}async function BK(){Al()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await _L(EK))}function SK(r,e={}){return e.debugWebGL||e.traceWebGL?MK(r,e):IK(r)}function IK(r){const e=yL(r);return e.realContext?e.realContext:r}function MK(r,e){if(!globalThis.WebGLDebugUtils)return Zt.warn("webgl-debug not loaded")(),r;const t=yL(r);if(t.debugContext)return t.debugContext;globalThis.WebGLDebugUtils.init({...sp,...r});const n=globalThis.WebGLDebugUtils.makeDebugContext(r,PK.bind(null,e),RK.bind(null,e));for(const o in sp)!(o in n)&&typeof sp[o]=="number"&&(n[o]=sp[o]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(r)),Object.setPrototypeOf(i,n);const s=Object.create(i);return t.realContext=r,t.debugContext=s,s.debug=!0,s}function y3(r,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let t=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,e);return t=`${t.slice(0,100)}${t.length>100?"...":""}`,`gl.${r}(${t})`}function PK(r,e,t,n){n=Array.from(n).map(c=>c===void 0?"undefined":c);const i=globalThis.WebGLDebugUtils.glEnumToString(e),s=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,n),o=`${i} in gl.${t}(${s})`;Zt.error(o)();debugger}function RK(r,e,t){let n="";Zt.level>=1&&(n=y3(e,t),r.traceWebGL&&Zt.log(1,n)());for(const i of t)if(i===void 0){n=n||y3(e,t);debugger}}const db={};function FK(r="id"){db[r]=db[r]||1;const e=db[r]++;return`${r}-${e}`}class og extends ji{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,t={}){super(e,t),this.device=e,this.gl=this.device.gl;const n=typeof t=="object"?t.handle:void 0;this.handle=n||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=DK(this.props.usage),this.glUsage=OK(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,t.data?this._initWithData(t.data,t.byteOffset,t.byteLength):this._initWithByteLength(t.byteLength||0)}_initWithData(e,t=0,n=e.byteLength+t){const i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,t,e),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(e,t,n),this.trackAllocatedMemory(n)}_initWithByteLength(e){let t=e;e===0&&(t=new Float32Array(0));const n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,t,this.glUsage),this.gl.bindBuffer(n,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,t=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,t,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,t,e.byteLength)}
2006async readAsync(e=0,t){return this.readSyncWebGL(e,t)}readSyncWebGL(e=0,t){t=t??this.byteLength-e;const n=new Uint8Array(t),i=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,n,i,t),this.gl.bindBuffer(36662,null),this._setDebugData(n,e,t),n}}function DK(r){return r&ji.INDEX?34963:r&ji.VERTEX?34962:r&ji.UNIFORM?35345:34962}function OK(r){return r&ji.INDEX||r&ji.VERTEX?35044:r&ji.UNIFORM?35048:35044}function LK(r){const e=r.split(/\r?\n/),t=[];for(const n of e){if(n.length<=1)continue;const i=n.split(":");if(i.length===2){const[w,S]=i;t.push({message:S.trim(),type:v3(w),lineNum:0,linePos:0});continue}const[s,o,c,...f]=i;let A=parseInt(c,10);isNaN(A)&&(A=0);let v=parseInt(o,10);isNaN(v)&&(v=0),t.push({message:f.join(":").trim(),type:v3(s),lineNum:A,linePos:v})}return t}function v3(r){const e=["warning","error","info"],t=r.toLowerCase();return e.includes(t)?t:"info"}class kK extends cy{device;handle;constructor(e,t){switch(super(e,t),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)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>this.compilationStatus)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){const e=this.device.gl.getShaderInfoLog(this.handle);return e?LK(e):[]}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)||null}async _compile(e){e=e.startsWith("#version ")?e:`#version 300 es
2007${e}`;const{gl:t}=this.device;if(t.shaderSource(this.handle,e),t.compileShader(this.handle),!this.device.props.debug){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}Zt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Zt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){const e=async i=>await new Promise(s=>setTimeout(s,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}const{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}function NK(r,e,t,n){if(VK(e))return n(r);const i=r;i.pushState();try{return UK(r,e),$p(i.gl,t),n(r)}finally{i.popState()}}function UK(r,e){const t=r,{gl:n}=t;if(e.cullMode)switch(e.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(e.frontFace&&n.frontFace(sh("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&r.features.has("depth-clip-control")&&n.enable(34383),e.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&r.features.has("provoking-vertex-webgl")){const s=t.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,o=sh("provokingVertex",e.provokingVertex,{first:36429,last:36430});s?.provokingVertexWEBGL(o)}if((e.polygonMode||e.polygonOffsetLine)&&r.features.has("polygon-mode-webgl")){if(e.polygonMode){const s=t.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,o=sh("polygonMode",e.polygonMode,{fill:6914,line:6913});s?.polygonModeWEBGL(1028,o),s?.polygonModeWEBGL(1029,o)}e.polygonOffsetLine&&n.enable(10754)}if(r.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&n.enable(12288),e.clipDistance1&&n.enable(12289),e.clipDistance2&&n.enable(12290),e.clipDistance3&&n.enable(12291),e.clipDistance4&&n.enable(12292),e.clipDistance5&&n.enable(12293),e.clipDistance6&&n.enable(12294),e.clipDistance7&&n.enable(12295)),e.depthWriteEnabled!==void 0&&n.depthMask(GK("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(P2("depthCompare",e.depthCompare))),e.stencilWriteMask){const i=e.stencilWriteMask;
vendor: 4,540 bytes, line 2007
2007n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(e.stencilReadMask&&Zt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){const i=e.stencilReadMask||4294967295,s=P2("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,s,0,i),n.stencilFuncSeparate(1029,s,0,i)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){const i=pb("stencilPassOperation",e.stencilPassOperation),s=pb("stencilFailOperation",e.stencilFailOperation),o=pb("stencilDepthFailOperation",e.stencilDepthFailOperation);n.stencilOpSeparate(1028,s,o,i),n.stencilOpSeparate(1029,s,o,i)}switch(e.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break}if(e.blendColorOperation||e.blendAlphaOperation){const i=b3("blendColorOperation",e.blendColorOperation||"add"),s=b3("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(i,s);const o=Xm("blendColorSrcFactor",e.blendColorSrcFactor||"one"),c=Xm("blendColorDstFactor",e.blendColorDstFactor||"zero"),f=Xm("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),A=Xm("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(o,c,f,A)}}function P2(r,e){return sh(r,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function pb(r,e){return sh(r,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function b3(r,e){return sh(r,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function Xm(r,e){return sh(r,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 zK(r,e){return`Illegal parameter ${e} for ${r}`}function sh(r,e,t){if(!(e in t))throw new Error(zK(r,e));return t[e]}function GK(r,e){return e}function VK(r){let e=!0;for(const t in r){e=!1;break}return e}function vL(r){const e={};return r.addressModeU&&(e[10242]=Ab(r.addressModeU)),r.addressModeV&&(e[10243]=Ab(r.addressModeV)),r.addressModeW&&(e[32882]=Ab(r.addressModeW)),r.magFilter&&(e[10240]=R2(r.magFilter)),(r.minFilter||r.mipmapFilter)&&(e[10241]=HK(r.minFilter||"linear",r.mipmapFilter)),r.lodMinClamp!==void 0&&(e[33082]=r.lodMinClamp),r.lodMaxClamp!==void 0&&(e[33083]=r.lodMaxClamp),r.type==="comparison-sampler"&&(e[34892]=34894),r.compare&&(e[34893]=P2("compare",r.compare)),r.maxAnisotropy&&(e[34046]=r.maxAnisotropy),e}function Ab(r){switch(r){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function R2(r){switch(r){case"nearest":return 9728;case"linear":return 9729}}function HK(r,e="none"){if(!e)return R2(r);switch(e){case"none":return R2(r);case"nearest":return r==="nearest"?9984:9986;case"linear":return r==="nearest"?9985:9987}}class F2 extends _g{device;handle;parameters;constructor(e,t){super(e,t),this.device=e,this.parameters=vL(t),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(const[t,n]of Object.entries(e)){const i=Number(t);switch(i){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,i,n);break;default:this.device.gl.samplerParameteri(this.handle,i,n);break}}}}class cp extends ay{device;gl;handle;texture;constructor(e,t){super(e,{...si.defaultProps,...t}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=t.texture}}const jK="Failed to deduce GL constant from typed array";function $K(r){switch(ArrayBuffer.isView(r)?r.constructor:r){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(jK)}}function WK(r,e){const{clamped:t=!0}=e||{};switch(r){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return t?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;
2007default:throw new Error("Failed to deduce typed array type from GL constant")}}function bL(r){switch(r){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function JK(r){switch(r){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function B_(r,e,t){if(XK(e))return t(r);const{nocatch:n=!0}=e,i=ih.get(r);i.push(),$p(r,e);let s;if(n)s=t(r),i.pop();else try{s=t(r)}finally{i.pop()}return s}function XK(r){for(const e in r)return!1;return!0}function KK(r,e,t){const{dimension:n,width:i,height:s,depth:o=0}=t,{glInternalFormat:c}=t,f=t.glTarget;switch(n){case"2d-array":case"3d":r.texStorage3D(f,e,c,i,s,o);break;default:r.texStorage2D(f,e,c,i,s)}}function x3(r,e,t,n){const{width:i,height:s}=n,{dimension:o,depth:c=0,mipLevel:f=0}=n,{x:A=0,y:v=0,z:w=0}=n,{glFormat:S,glType:F}=n,N=xL(n.glTarget,o,c),U=n.flipY?{37440:!0}:{};B_(r,U,()=>{switch(o){case"2d-array":case"3d":r.bindTexture(N,e),r.texSubImage3D(N,f,A,v,w,i,s,c,S,F,t),r.bindTexture(N,null);break;case"2d":case"cube":r.bindTexture(N,e),r.texSubImage2D(N,f,A,v,i,s,S,F,t),r.bindTexture(N,null);break;default:throw new Error(o)}})}function w3(r,e,t){const{dimension:n,width:i,height:s,depth:o=0,mipLevel:c=0,byteOffset:f=0}=t,{x:A=0,y:v=0,z:w=0}=t,{glFormat:S,glType:F,compressed:N}=t,U=xL(t.glTarget,n,o);switch(n){case"2d-array":case"3d":N?r.compressedTexSubImage3D(U,c,A,v,w,i,s,o,S,e,f):r.texSubImage3D(U,c,A,v,w,i,s,o,S,F,e,f);break;case"2d":case"cube":N?r.compressedTexSubImage2D(U,c,A,v,i,s,S,e,f):r.texSubImage2D(U,c,A,v,i,s,S,F,e,f);break;default:throw new Error(n)}}function qK(r){switch(r){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866}throw new Error(r)}function xL(r,e,t){return e==="cube"?34069+t:r}function YK(r,e){const{sourceX:t=0,sourceY:n=0,sourceAttachment:i=0}=e||{};let{target:s=null,sourceWidth:o,sourceHeight:c,sourceDepth:f,sourceFormat:A,sourceType:v}=e||{};const{framebuffer:w,deleteFramebuffer:S}=wL(r),{gl:F,handle:N}=w;o||=w.width,c||=w.height;const U=w.colorAttachments[i]?.texture;if(!U)throw new Error(`Invalid framebuffer attachment ${i}`);f=U?.depth||1,A||=U?.glFormat||6408,v||=U?.glType||5121,s=eq(s,v,A,o,c),v=v||$K(s);const $=F.bindFramebuffer(36160,N);return F.readBuffer(36064+i),F.readPixels(t,n,o,c,A,v,s),F.readBuffer(36064),F.bindFramebuffer(36160,$||null),S&&w.destroy(),s}function ZK(r,e){const{target:t,sourceX:n=0,sourceY:i=0,sourceFormat:s=6408,targetByteOffset:o=0}=e||{};let{sourceWidth:c,sourceHeight:f,sourceType:A}=e||{};const{framebuffer:v,deleteFramebuffer:w}=wL(r);c=c||v.width,f=f||v.height;const S=v;A=A||5121;let F=t;if(!F){const U=bL(s),$=JK(A),G=o+c*f*U*$;F=S.device.createBuffer({byteLength:G})}const N=r.device.createCommandEncoder();return N.copyTextureToBuffer({sourceTexture:r,width:c,height:f,origin:[n,i],destinationBuffer:F,byteOffset:o}),N.destroy(),w&&v.destroy(),F}function wL(r){return r instanceof ly?{framebuffer:r,deleteFramebuffer:!1}:{framebuffer:QK(r),deleteFramebuffer:!0}}function QK(r,e){const{device:t,width:n,height:i,id:s}=r;return t.createFramebuffer({...e,id:`framebuffer-for-${s}`,width:n,height:i,colorAttachments:[r]})}function eq(r,e,t,n,i,s){if(r)return r;e||=5121;const o=WK(e,{clamped:!1}),c=bL(t);return new o(n*i*c)}class ag extends si{device;gl;handle;sampler=void 0;view=void 0;mipmaps;compressed;glTarget;glFormat;glType;glInternalFormat;textureUnit=0;constructor(e,t){super(e,t);const n={...this.props};n.data=t.data,this.device=e,this.gl=this.device.gl,this.glTarget=qK(this.props.dimension);const i=mL(this.props.format);this.glInternalFormat=i.internalFormat,this.glFormat=i.format,this.glType=i.type,this.compressed=i.compressed,this.mipmaps=!!this.props.mipmaps,this._initialize(n),Object.seal(this)}_initialize(e){this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:e.data});let{width:t,height:n}=e;if(!t||!n){const i=si.getTextureDataSize(e.data);t=i?.width||1,n=i?.height||1}if(this.width=t,this.height=n,this.depth=e.depth,this.setSampler(e.sampler),this.view=new cp(this.device,{...this.props,texture:this}),this.bind(),KK(this.gl,this.mipLevels,this),e.data)switch(e.dimension){case"1d":this.setTexture1DData(e.data);break;case"2d":this.setTexture2DData(e.data);break;case"3d":this.setTexture3DData(e.data);break;case"cube":this.setTextureCubeData(e.data);break;case"2d-array":this.setTextureArrayData(e.data);break;case"cube-array":this.setTextureCubeArrayData(e.data);break;default:throw new Error(e.dimension)}this.mipmaps&&this.generateMipmap()}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(e){return new cp(this.device,{...e,texture:this})}setSampler(e={}){let t;e instanceof F2?(this.sampler=e,t=e.props):(this.sampler=new F2(this.device,e),t=e);const n=vL(t);this._setSamplerParameters(n)}generateMipmap(e){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(Zt.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!e?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){Zt.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(e){const t=si.getExternalImageSize(e.image),n={...si.defaultCopyExternalImageOptions,...t,...e},{image:i,depth:s,mipLevel:o,x:c,y:f,z:A,flipY:v}=n;let{width:w,height:S}=n;const{dimension:F,glTarget:N,glFormat:U,glInternalFormat:$,glType:G}=this;if(w=Math.min(w,this.width-c),S=Math.min(S,this.height-f),e.sourceX||e.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");return x3(this.device.gl,this.handle,i,{dimension:F,mipLevel:o,x:c,y:f,z:A,width:w,height:S,depth:s,glFormat:U,glType:G,glTarget:N,flipY:v}),{width:n.width,height:n.height}}setTexture1DData(e){throw new Error("setTexture1DData not supported in WebGL.")}setTexture2DData(e,t=0){this.bind();const n=si.normalizeTextureData(e,this);n.length>1&&this.props.mipmaps!==!1&&Zt.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let i=0;i<n.length;i++){const s=n[i];this._setMipLevel(t,i,s)}this.unbind()}setTexture3DData(e){if(this.props.dimension!=="3d")throw new Error(this.id
2007);ArrayBuffer.isView(e)&&(this.bind(),w3(this.device.gl,e,this),this.unbind())}setTextureCubeData(e,t=0){if(this.props.dimension!=="cube")throw new Error(this.id);for(const n of si.CubeFaces)this.setTextureCubeFaceData(e[n],n)}setTextureArrayData(e){throw this.props.dimension!=="2d-array"?new Error(this.id):new Error("setTextureArrayData not implemented.")}setTextureCubeArrayData(e){throw new Error("setTextureCubeArrayData not supported in WebGL2.")}setTextureCubeFaceData(e,t,n=0){Array.isArray(e)&&e.length>1&&this.props.mipmaps!==!1&&Zt.warn(`${this.id} has mipmap and multiple LODs.`)();const i=si.CubeFaces.indexOf(t);this.setTexture2DData(e,i)}update(){throw new Error("Texture.update() not implemented. Use ExternalTexture")}setImageDataForFace(e){const{face:t,width:n,height:i,pixels:s,data:o,format:c=6408,type:f=5121}=e,{gl:A}=this,v=s||o;this.bind(),v instanceof Promise?v.then(w=>this.setImageDataForFace(Object.assign({},e,{face:t,data:w,pixels:w}))):this.width||this.height?A.texImage2D(t,0,c,n,i,0,c,f,v):A.texImage2D(t,0,c,c,f,v)}_getImageDataMap(e){for(let t=0;t<si.CubeFaces.length;++t){const n=si.CubeFaces[t];e[n]&&(e[34069+t]=e[n],delete e[n])}return e}_setSamplerParameters(e){Zt.log(1,`${this.id} sampler parameters`,this.device.getGLKeys(e))(),this.gl.bindTexture(this.glTarget,this.handle);for(const[t,n]of Object.entries(e)){const i=Number(t),s=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.glTarget,i,s);break;case 10241:this.gl.texParameteri(this.glTarget,i,s);break;case 10242:case 10243:this.gl.texParameteri(this.glTarget,i,s);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,i,s);break;default:this.gl.texParameteri(this.glTarget,i,s);break}}this.gl.bindTexture(this.glTarget,null)}_setMipLevel(e,t,n,i=this.glTarget){if(si.isExternalImage(n)){x3(this.device.gl,this.handle,n,{...this,depth:e,mipLevel:t,glTarget:i,flipY:this.props.flipY});return}if(si.isTextureLevelData(n)){w3(this.device.gl,n.data,{...this,depth:e,mipLevel:t,glTarget:i});return}throw new Error("Texture: invalid image data")}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e){const{gl:t}=this;return e!==void 0&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,this.handle),e}unbind(e){const{gl:t}=this;return e!==void 0&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,null),e}}const tq=[1,2,4,8];class rq extends Xf{device;glParameters;constructor(e,t){super(e,t),this.device=e;let n;if(!t?.parameters?.viewport)if(t?.framebuffer){const{width:s,height:o}=t.framebuffer;n=[0,0,s,o]}else{const[s,o]=e.getCanvasContext().getDrawingBufferSize();n=[0,0,s,o]}if(this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters}),this.props.framebuffer?.handle)if(this.props.framebuffer){const s=this.props.framebuffer.colorAttachments.map((o,c)=>36064+c);this.device.gl.drawBuffers(s)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){const t={...this.glParameters};t.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(t.depthMask=!this.props.depthReadOnly),t.stencilMask=this.props.stencilReadOnly?0:1,t[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(t.viewport=e.viewport.slice(0,4),t.depthRange=[e.viewport[4],e.viewport[5]]):t.viewport=e.viewport),e.scissorRect&&(t.scissorTest=!0,t.scissor=e.scissorRect),e.blendConstant&&(t.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(t.colorMask=tq.map(n=>!!(n&e.colorMask))),this.glParameters=t,$p(this.device.gl,t)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){const e={...this.glParameters};let t=0;this.props.clearColors&&this.props.clearColors.forEach((n,i)=>{n&&this.clearColorBuffer(i,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(t|=16384,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(t|=256,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(t|=1024,e.clearStencil=this.props.clearStencil),t!==0&&B_(this.device.gl,e,()=>{this.device.gl.clear(t)})}clearColorBuffer(e=0,t=[0,0,0,0]){B_(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,e,t);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,e,t);break;
vendor: 10,368 bytes, line 2007
2007case Float32Array:this.device.gl.clearBufferfv(6144,e,t);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}function nq(r){return iq.includes(r)}const iq=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],CL={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 TL(r){const e=CL[r];if(!e)throw new Error("uniform");const[t,n,,i]=e;return{format:i,components:n,glType:t}}function sq(r){const e=CL[r];if(!e)throw new Error("attribute");const[,t,,n,i]=e;return{attributeType:n,vertexFormat:i,components:t}}function oq(r,e){const t={attributes:[],bindings:[]};t.attributes=aq(r,e);const n=uq(r,e);for(const c of n){const f=c.uniforms.map(A=>({name:A.name,format:A.format,byteOffset:A.byteOffset,byteStride:A.byteStride,arrayLength:A.arrayLength}));t.bindings.push({type:"uniform",name:c.name,group:0,location:c.location,visibility:(c.vertex?1:0)&(c.fragment?2:0),minBindingSize:c.byteLength,uniforms:f})}const i=lq(r,e);let s=0;for(const c of i)if(nq(c.type)){const{viewDimension:f,sampleType:A}=hq(c.type);t.bindings.push({type:"texture",name:c.name,group:0,location:s,viewDimension:f,sampleType:A}),c.textureUnit=s,s+=1}i.length&&(t.uniforms=i);const o=cq(r,e);return o?.length&&(t.varyings=o),t}function aq(r,e){const t=[],n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i);if(!s)throw new Error("activeInfo");const{name:o,type:c}=s,f=r.getAttribLocation(e,o);if(f>=0){const{attributeType:A}=sq(c),v=/instance/i.test(o)?"instance":"vertex";t.push({name:o,location:f,stepMode:v,type:A})}}return t.sort((i,s)=>i.location-s.location),t}function cq(r,e){const t=[],n=r.getProgramParameter(e,35971);for(let i=0;i<n;i++){const s=r.getTransformFeedbackVarying(e,i);if(!s)throw new Error("activeInfo");const{name:o,type:c,size:f}=s,{glType:A,components:v}=TL(c),w={location:i,name:o,type:A,size:f*v};t.push(w)}return t.sort((i,s)=>i.location-s.location),t}function lq(r,e){const t=[],n=r.getProgramParameter(e,35718);for(let i=0;i<n;i++){const s=r.getActiveUniform(e,i);if(!s)throw new Error("activeInfo");const{name:o,size:c,type:f}=s,{name:A,isArray:v}=dq(o);let w=r.getUniformLocation(e,A);const S={location:w,name:A,size:c,type:f,isArray:v};if(t.push(S),S.size>1)for(let F=0;F<S.size;F++){const N=`${A}[${F}]`;w=r.getUniformLocation(e,N);const U={...S,name:N,location:w};t.push(U)}}return t}function uq(r,e){const t=(s,o)=>r.getActiveUniformBlockParameter(e,s,o),n=[],i=r.getProgramParameter(e,35382);for(let s=0;s<i;s++){const o={name:r.getActiveUniformBlockName(e,s)||"",location:t(s,35391),byteLength:t(s,35392),vertex:t(s,35396),fragment:t(s,35398),uniformCount:t(s,35394),uniforms:[]},c=t(s,35395)||[],f=r.getActiveUniforms(e,c,35383),A=r.getActiveUniforms(e,c,35384),v=r.getActiveUniforms(e,c,35387),w=r.getActiveUniforms(e,c,35388);for(let S=0;S<o.uniformCount;++S){const F=r.getActiveUniform(e,c[S]);if(!F)throw new Error("activeInfo");o.uniforms.push({name:F.name,format:TL(f[S]).format,type:f[S],arrayLength:A[S],byteOffset:v[S],byteStride:w[S]})}n.push(o)}return n.sort((s,o)=>s.location-o.location),n}const fq={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 hq(r){const e=fq[r];if(!e)throw new Error("sampler");const[t,n]=e;return{viewDimension:t,sampleType:n}}function dq(r){if(r[r.length-1]!=="]")return{name:r,length:1,isArray:!1};const t=/([^[]*)(\[[0-9]+\])?/.exec(r);if(!t||t.length<2)throw new Error(`Failed to parse GLSL uniform name ${r}`);return{name:t[1],length:t[2]?1:0,isArray:!!t[2]}}function pq(r,e,t,n){const i=r;let s=n;s===!0&&(s=1),s===!1&&(s=0);const o=typeof s=="number"?[s]:s;switch(t){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 n!="number")throw new Error("samplers must be set to integers");return r.uniform1i(e,n);case 5126:return r.uniform1fv(e,o);case 35664:return r.uniform2fv(e,o);case 35665:return r.uniform3fv(e,o);case 35666:return r.uniform4fv(e,o);case 5124:return r.uniform1iv(e,o);case 35667:return r.uniform2iv(e,o);case 35668:return r.uniform3iv(e,o);case 35669:return r.uniform4iv(e,o);case 35670:return r.uniform1iv(e,o);case 35671:return r.uniform2iv(e,o);case 35672:return r.uniform3iv(e,o);case 35673:return r.uniform4iv(e,o);case 5125:return i.uniform1uiv(e,o,1);case 36294:return i.uniform2uiv(e,o,2);case 36295:return i.uniform3uiv(e,o,3);case 36296:return i.uniform4uiv(e,o,4);case 35674:return r.uniformMatrix2fv(e,!1,o);case 35675:return r.uniformMatrix3fv(e,!1,o);case 35676:return r.uniformMatrix4fv(e,!1,o);case 35685:return i.uniformMatrix2x3fv(e,!1,o);case 35686:return i.uniformMatrix2x4fv(e,!1,o);case 35687:return i.uniformMatrix3x2fv(e,!1,o);case 35688:return i.uniformMatrix3x4fv(e,!1,o);case 35689:return i.uniformMatrix4x2fv(e,!1,o);case 35690:return i.uniformMatrix4x3fv(e,!1,o)}throw new Error("Illegal uniform")}function Aq(r){return rL(r)!==null||typeof r=="number"||typeof r=="boolean"}function gq(r){const e={bindings:{},uniforms:{}};return Object.keys(r).forEach(t=>{const n=r[t];Aq(n)?e.uniforms[t]=n:e.bindings[t]=n}),e}function mq(r){switch(r){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(r)}}function _q(r){switch(r){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(r)}}const C3=4;class yq extends Sp{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,t){super(e,t),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=t.vs,this.fs=t.fs;const{varyings:n,bufferMode:i=35981}=t;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,i)),this._linkShaders(),Zt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=oq(this.device.gl,this.handle),Zt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=vq(this.introspectedLayout,t.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,t){for(const[n,i]of Object.entries(e)){const s=this.shaderLayout.bindings.find(o=>o.name===n)||this.shaderLayout.bindings.find(o=>o.name===`${n}Uniforms`);if(!s){const o=this.shaderLayout.bindings.map(c=>`"${c.name}"`).join(", ");t?.disableWarnings||Zt.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${o}`,i)();continue}switch(i||Zt.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),s.type){case"uniform":if(!(i instanceof og)&&!(i.buffer instanceof og))throw new Error("buffer value");break;case"texture":if(!(i instanceof cp||i instanceof ag||i instanceof sg))throw new Error("texture value");break;case"sampler":Zt.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(s.type)}this.bindings[n]=i}}draw(e){const{renderPass:t,parameters:n=this.props.parameters,topology:i=this.props.topology,vertexArray:s,vertexCount:o,instanceCount:c,isInstanced:f=!1,firstVertex:A=0,transformFeedback:v}=e,w=mq(i),S=!!s.indexBuffer,F=s.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return Zt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return Zt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),s.bindBeforeRender(t),v&&v.begin(this.props.topology),this._applyBindings(),this._applyUniforms();const N=t;return NK(this.device,n,N.glParameters,()=>{S&&f?this.device.gl.drawElementsInstanced(w,o||0,F,A,c||0):S?this.device.gl.drawElements(w,o||0,F,A):f?this.device.gl.drawArraysInstanced(w,A,o||0,c||0):this.device.gl.drawArrays(w,A,o||0),v&&v.end()}),s.unbindAfterRender(t),!0}setUniformsWebGL(e){const{bindings:t}=gq(e);Object.keys(t).forEach(n=>{Zt.warn(`Unsupported value "${JSON.stringify(t[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){const{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),Zt.time(C3,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),Zt.timeEnd(C3,`linkProgram for ${this.id}`)(),Zt.level,!this.device.features.has("compilation-status-async-webgl")){const n=this._getLinkStatus();this._reportLinkStatus(n);return}Zt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Zt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();const t=this._getLinkStatus();this._reportLinkStatus(t)}async _reportLinkStatus(e){switch(e){case"success":return;default:switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`);
2007case"pending":this.vs.asyncCompilationStatus.then(()=>this.vs.debugShader());break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`);case"pending":this.fs.asyncCompilationStatus.then(()=>this.fs.debugShader());break}const t=this.device.gl.getProgramInfoLog(this.handle);throw new Error(`Error during ${e}: ${t}`)}}_getLinkStatus(){const{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(){const e=async i=>await new Promise(s=>setTimeout(s,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}const{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(const t of this.shaderLayout.bindings)!this.bindings[t.name]&&!this.bindings[t.name.replace(/Uniforms$/,"")]&&(Zt.warn(`Binding ${t.name} not found in ${this.id}`)(),e=!1);return e}_applyBindings(){if(this.linkStatus!=="success")return;const{gl:e}=this.device;e.useProgram(this.handle);let t=0,n=0;for(const i of this.shaderLayout.bindings){const s=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!s)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":const{name:o}=i,c=e.getUniformBlockIndex(this.handle,o);if(c===4294967295)throw new Error(`Invalid uniform block name ${o}`);e.uniformBlockBinding(this.handle,n,c),s instanceof og?e.bindBufferBase(35345,n,s.handle):e.bindBufferRange(35345,n,s.buffer.handle,s.offset||0,s.size||s.buffer.byteLength-s.offset),n+=1;break;case"texture":if(!(s instanceof cp||s instanceof ag||s instanceof sg))throw new Error("texture");let f;if(s instanceof cp)f=s.texture;else if(s instanceof ag)f=s;else if(s instanceof sg&&s.colorAttachments[0]instanceof cp)Zt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),f=s.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+t),e.bindTexture(f.glTarget,f.handle),t+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(const e of this.shaderLayout.uniforms||[]){const{name:t,location:n,type:i,textureUnit:s}=e,o=this.uniforms[t]??s;o!==void 0&&pq(this.device.gl,n,i,o)}}}function vq(r,e){const t={...r,attributes:r.attributes.map(n=>({...n}))};for(const n of e?.attributes||[]){const i=t.attributes.find(s=>s.name===n.name);i?(i.type=n.type||i.type,i.stepMode=n.stepMode||i.stepMode):Zt.warn(`shader layout attribute ${n.name} not present in shader`)}return t}class bq extends nw{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(const t of e)switch(t.name){case"copy-buffer-to-buffer":xq(this.device,t.options);break;case"copy-buffer-to-texture":wq(this.device,t.options);break;case"copy-texture-to-buffer":Cq(this.device,t.options);break;case"copy-texture-to-texture":Tq(this.device,t.options);break;default:throw new Error(t.name)}}}function xq(r,e){const t=e.sourceBuffer,n=e.destinationBuffer;r.gl.bindBuffer(36662,t.handle),r.gl.bindBuffer(36663,n.handle),r.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),r.gl.bindBuffer(36662,null),r.gl.bindBuffer(36663,null)}function wq(r,e){throw new Error("Not implemented")}function Cq(r,e){const{sourceTexture:t,mipLevel:n=0,aspect:i="all",width:s=e.sourceTexture.width,height:o=e.sourceTexture.height,depthOrArrayLayers:c=0,origin:f=[0,0],destinationBuffer:A,byteOffset:v=0,bytesPerRow:w,rowsPerImage:S}=e;if(i!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||c!==0||w||S)throw new Error("not implemented");const{framebuffer:F,destroyFramebuffer:N}=EL(t);let U;try{const $=A,G=s||F.width,H=o||F.height,J=mL(F.colorAttachments[0].texture.props.format),ue=J.format,q=J.type;r.gl.bindBuffer(35051,$.handle),U=r.gl.bindFramebuffer(36160,F.handle),r.gl.readPixels(f[0],f[1],G,H,ue,q,v)}finally{r.gl.bindBuffer(35051,null),U!==void 0&&r.gl.bindFramebuffer(36160,U),N&&F.destroy()}}function Tq(r,e){const{sourceTexture:t,destinationMipLevel:n=0,origin:i=[0,0],destinationOrigin:s=[0,0],destinationTexture:o}=e;let{width:c=e.destinationTexture.width,height:f=e.destinationTexture.height}=e;const{framebuffer:A,destroyFramebuffer:v}=EL(t),[w,S]=i,[F,N,U]=s,$=r.gl.bindFramebuffer(36160,A.handle);let G=null,H;if(o instanceof ag)G=o,c=Number.isFinite(c)?c:G.width,f=Number.isFinite(f)?f:G.height,G.bind(0),H=G.glTarget;else throw new Error("invalid destination");switch(H){case 3553:case 34067:r.gl.copyTexSubImage2D(H,n,F,N,w,S,c,f);break;case 35866:case 32879:r.gl.copyTexSubImage3D(H,n,F,N,U,w,S,c,f);break}G&&G.unbind(),r.gl.bindFramebuffer(36160,$),v&&A.destroy()}function EL(r){if(r instanceof si){const{width:e,height:t,id:n}=r;
vendor: 7,094 bytes, line 2007
2007return{framebuffer:r.device.createFramebuffer({id:`framebuffer-for-${n}`,width:e,height:t,colorAttachments:[r]}),destroyFramebuffer:!0}}return{framebuffer:r,destroyFramebuffer:!1}}class Eq extends rw{device;commandBuffer;constructor(e,t){super(e,t),this.device=e,this.commandBuffer=new bq(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,t,n){}}function Bq(r){const{target:e,source:t,start:n=0,count:i=1}=r,s=t.length,o=i*s;let c=0;for(let f=n;c<s;c++)e[f++]=t[c];for(;c<o;)c<o-c?(e.copyWithin(n+c,n,n+c),c*=2):(e.copyWithin(n+c,n,n+o-c),c=o);return r.target}class Lw extends iw{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return C5()==="Chrome"}constructor(e,t){super(e,t),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){const t=e;if(t&&t.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,t?t.handle:null),this.indexBuffer=t,this.device.gl.bindVertexArray(null)}setBuffer(e,t){const n=t;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");const{size:i,type:s,stride:o,offset:c,normalized:f,integer:A,divisor:v}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),A?this.device.gl.vertexAttribIPointer(e,i,s,o,c):this.device.gl.vertexAttribPointer(e,i,s,f,o,c),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,v||0),this.attributes[e]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,t){this._enable(e,!1),this.attributes[e]=t}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){const t=this.attributes[e];ArrayBuffer.isView(t)&&this.device.setConstantAttributeWebGL(e,t)}}_getAccessor(e){const t=this.attributeInfos[e];if(!t)throw new Error(`Unknown attribute location ${e}`);const n=gL(t.bufferDataType);return{size:t.bufferComponents,type:n,stride:t.byteStride,offset:t.byteOffset,normalized:t.normalized,integer:t.integer,divisor:t.stepMode==="instance"?1:0}}_enable(e,t=!0){const i=Lw.isConstantAttributeZeroSupported(this.device)||e!==0;(t||i)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),t?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,t){const n=Sq(t),i=n.byteLength*e,s=n.length*e;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let o=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),o=o||!Iq(n,this.bufferValue),o){const c=S7(t.constructor,s);Bq({target:c,source:n,start:0,count:s}),this.buffer.write(c),this.bufferValue=t}return this.buffer}}function Sq(r){return Array.isArray(r)?new Float32Array(r):r}function Iq(r,e){if(!r||!e||r.length!==e.length||r.constructor!==e.constructor)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}class Mq extends sw{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,t){super(e,t),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,t.buffers&&this.setBuffers(t.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(_q(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(const t in e)this.setBuffer(t,e[t])})}setBuffer(e,t){const n=this._getVaryingIndex(e),{buffer:i,byteLength:s,byteOffset:o}=this._getBufferRange(t);if(n<0){this.unusedBuffers[e]=i,Zt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[n]={buffer:i,byteLength:s,byteOffset:o},this.bindOnUse||this._bindBuffer(n,i,o,s)}getBuffer(e){if(T3(e))return this.buffers[e]||null;const t=this._getVaryingIndex(e);return t>=0?this.buffers[t]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let t;return this._bound?t=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,t=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),t}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof og)return{buffer:e,byteOffset:0,byteLength:e.byteLength};const{buffer:t,byteOffset:n=0,byteLength:i=e.buffer.byteLength}=e;return{buffer:t,byteOffset:n,byteLength:i}}_getVaryingIndex(e){if(T3(e))return Number(e);for(const t of this.layout.varyings)if(e===t.name)return t.location;return-1}_bindBuffers(){for(const e in this.buffers){const{buffer:t,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),t,i,n)}}_unbindBuffers(){for(const e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,t,n=0,i){const s=t&&t.handle;!s||i===void 0?this.gl.bindBufferBase(35982,e,s):this.gl.bindBufferRange(35982,e,s,n,i)}}function T3(r){return typeof r=="number"?Number.isInteger(r):/^\d+$/.test(r)}class Pq extends ow{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,t){if(super(e,t),this.device=e,t.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;const e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}
2007isTimerDisjoint(){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 t=0;return this._pollingPromise=new Promise((n,i)=>{const s=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):t++>e?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(s)};requestAnimationFrame(s)}),this._pollingPromise}}class lp extends Ju{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;constructor(e){super({...e,id:e.id||FK("webgl-device")});const t=Ju._getCanvasContextProps(e);if(!t)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let n=t.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new xK(this,t),this.lost=new Promise(v=>{this._resolveContextLost=v});const i={...e.webgl};t.alphaMode==="premultiplied"&&(i.premultipliedAlpha=!0),e.powerPreference!==void 0&&(i.powerPreference=e.powerPreference);const o=this.props._handle||rK(this.canvasContext.canvas,{onContextLost:v=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:v=>console.log("WebGL context restored")},i);if(!o)throw new Error("WebGL context creation failed");if(n=o.device,n){if(e._reuseDevices)return Zt.log(1,`Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`,n)(),n._reused=!0,n;throw new Error(`WebGL context already attached to device ${n.id}`)}this.handle=o,this.gl=o,this.spectorJS=TK({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=nK(this.gl,this._extensions),this.limits=new yK(this.gl),this.features=new _K(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),t.autoResize!==!1&&this.canvasContext.resize(),new ih(this.gl,{log:(...v)=>Zt.log(1,...v)()}).trackState(this.gl,{copyState:!1});const f=e.debugWebGL||e.debug,A=e.debugWebGL;f&&(this.gl=SK(this.gl,{debugWebGL:f,traceWebGL:A}),Zt.warn("WebGL debug mode activated. Performance reduced.")(),e.debugWebGL&&(Zt.level=Math.max(Zt.level,1)))}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){const t=this._normalizeBufferProps(e);return new og(this,t)}createTexture(e){return new ag(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new F2(this,e)}createShader(e){return new kK(this,e)}createFramebuffer(e){return new sg(this,e)}createVertexArray(e){return new Lw(this,e)}createTransformFeedback(e){return new Mq(this,e)}createQuerySet(e){return new Pq(this,e)}createRenderPipeline(e){return new yq(this,e)}beginRenderPass(e){return new rq(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 Eq(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,t){return YK(e,t)}readPixelsToBufferWebGL(e,t){return ZK(e,t)}setParametersWebGL(e){$p(this.gl,e)}getParametersWebGL(e){return pL(this.gl,e)}withParametersWebGL(e,t){return B_(this.gl,e,t)}resetWebGL(){Zt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),YX(this.gl)}_getDeviceSpecificTextureFormatCapabilities(e){return pK(this.gl,e,this._extensions)}loseDevice(){let e=!1;const n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(e=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){ih.get(this.gl).push()}popState(){ih.get(this.gl).pop()}setSpectorMetadata(e,t){e.__SPECTOR_Metadata=t}getGLKey(e,t){const n=Number(e);for(const i in this.gl)if(this.gl[i]===n)return`GL.${i}`;return t?.emptyIfUnknown?"":String(e)}getGLKeys(e){const t={emptyIfUnknown:!0};return Object.entries(e).reduce((n,[i,s])=>(n[`${i}:${this.getGLKey(i,t)}`]=`${s}:${this.getGLKey(s,t)}`,n),{})}_constants;setConstantAttributeWebGL(e,t){const n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);const i=this._constants[e];switch(i&&Oq(i,t)&&Zt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=t,t.constructor){case Float32Array:Rq(this,e,t);break;case Int32Array:Fq(this,e,t);break;case Uint32Array:Dq(this,e,t);break;default:throw new Error("constant")}}getExtension(e){return Fp(this.gl,e,this._extensions),this._extensions}}function Rq(r,e,t){switch(t.length){case 1:r.gl.vertexAttrib1fv(e,t);break;case 2:r.gl.vertexAttrib2fv(e,t);break;case 3:r.gl.vertexAttrib3fv(e,t);break;case 4:r.gl.vertexAttrib4fv(e,t);break}}function Fq(r,e,t){r.gl.vertexAttribI4iv(e,t)}function Dq(r,e,t){r.gl.vertexAttribI4uiv(e,t)}function Oq(r,e){if(!r||!e||r.length!==e.length||r.constructor!==e.constructor)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}const Lq={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},kq=r=>({drawBuffersWEBGL(e){return r.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),Nq=r=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return r.createVertexArray()},deleteVertexArrayOES(e){return r.deleteVertexArray(e)},isVertexArrayOES(e){return r.isVertexArray(e)},bindVertexArrayOES(e){return r.bindVertexArray(e)}}),Uq=r=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return r.drawArraysInstanced(...e)}
2007,drawElementsInstancedANGLE(...e){return r.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return r.vertexAttribDivisor(...e)}});function zq(r=!0){const e=HTMLCanvasElement.prototype;if(!r&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(t,n){if(t==="webgl"||t==="experimental-webgl"){const i=this.originalGetContext("webgl2",n);return i instanceof HTMLElement&&Gq(i),i}return this.originalGetContext(t,n)}}function Gq(r){r.getExtension("EXT_color_buffer_float");const e={...Lq,WEBGL_disjoint_timer_query:r.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:kq(r),OES_vertex_array_object:Nq(r),ANGLE_instanced_arrays:Uq(r)},t=r.getExtension;r.getExtension=function(i){const s=t.call(r,i);return s||(i in e?e[i]:null)};const n=r.getSupportedExtensions;r.getSupportedExtensions=function(){return(n.apply(r)||[])?.concat(Object.keys(e))}}const Km=1;class Vq extends i7{type="webgl";constructor(){super(),Ju.defaultProps={...Ju.defaultProps,...Ow},lp.adapter=this}isSupported(){return typeof WebGL2RenderingContext<"u"}enforceWebGL2(e){zq(e)}async attach(e){if(e instanceof lp)return e;if(e?.device instanceof Ju)return e.device;if(!Hq(e))throw new Error("Invalid WebGL2RenderingContext");return new lp({_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1}})}async create(e={}){Zt.groupCollapsed(Km,"WebGLDevice created")();const t=[];(e.debugWebGL||e.debug)&&t.push(BK()),e.debugSpectorJS&&t.push(CK(e));const n=await Promise.allSettled(t);for(const o of n)o.status==="rejected"&&Zt.error(`Failed to initialize debug libraries ${o.reason}`)();const i=new lp(e),s=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return Zt.probe(Km,s)(),Zt.table(Km,i.info)(),Zt.groupEnd(Km)(),i}}function Hq(r){return typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext?!0:!!(r&&Number.isFinite(r._version))}const E3=new Vq;function ku(){}const jq=({isDragging:r})=>r?"grabbing":"grab",BL={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:ku,onWebGLInitialized:ku,onResize:ku,onViewStateChange:ku,onInteractionStateChange:ku,onBeforeRender:ku,onAfterRender:ku,onLoad:ku,onError:r=>Yr.error(r.message,r.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:jq,getTooltip:null,debug:!1,drawPickingColors:!1};class kw{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 lL({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=n=>{const{_pickRequest:i}=this;if(n.type==="pointerleave")i.x=-1,i.y=-1,i.radius=0;else{if(n.leftButton||n.rightButton)return;{const s=n.offsetCenter;if(!s)return;i.x=s.x,i.y=s.y,i.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:i.x,y:i.y}),i.event=n},this._onEvent=n=>{const i=x2[n.type],s=n.offsetCenter;if(!i||!s||!this.layerManager)return;const o=this.layerManager.getLayers(),c=this.deckPicker.getLastPickedObject({x:s.x,y:s.y,layers:o,viewports:this.getViewports(s)},this._lastPointerDownInfo),{layer:f}=c,A=f&&(f[i]||f.props[i]),v=this.props[i];let w=!1;A&&(w=A.call(f,c,n)),w||(v?.(c,n),this.widgetManager.onEvent(c,n))},this._onPointerDown=n=>{if(this.device?.type==="webgpu")return;const i=n.offsetCenter,s=this._pick("pickObject","pickObject Time",{x:i.x,y:i.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=s.result[0]||s.emptyInfo},this.props={...BL,...e},e=this.props,e.viewState&&e.initialViewState&&Yr.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);let t=this.device;!t&&e.gl&&(e.gl instanceof WebGLRenderingContext&&Yr.error("WebGL1 context not supported.")(),t=E3.attach(e.gl)),t||(t=f2.createDevice({type:"best-available",_reuseDevices:!0,adapters:[E3],...e.deviceProps,createCanvasContext:{canvas:this._createCanvas(e),useDevicePixels:this.props.useDevicePixels,autoResize:!1}})),this.animationLoop=this._createAnimationLoop(t,e),this.setProps(e),e._typedArrayManagerProps&&Pp.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&&Yr.removed("onLayerHover","onHover")(),"onLayerClick"in e&&Yr.removed("onLayerClick","onClick")(),e.initialViewState&&!rs(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._setCanvasSize(this.props);const t=Object.create(this.props);Object.assign(t,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop?.setProps(t),this.layerManager&&(this.viewManager.setProps(t),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(t),this.effectManager.setProps(t),this.deckRenderer.setProps(t),this.deckPicker.setProps(t),this.widgetManager.setProps(t)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let t=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);const n=this.viewManager.needsRedraw(e),i=this.layerManager.needsRedraw(e),s=this.effectManager.needsRedraw(e),o=this.deckRenderer.needsRedraw(e);return t=t||n||i||s||o,t}redraw(e){if(!this.layerManager)return;let t=this.needsRedraw({clearRedrawFlags:!0});t=e||t,t&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(t):this._drawLayers(t))}get isInitialized(){return this.viewManager!==null}getViews(){return qs(this.viewManager),this.viewManager.views}getViewports(e){return qs(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){const t=this._pick("pickObject","pickObject Time",e).result;return t.length?t[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)}
vendor: 24,310 bytes, lines 2007-2009
2007_addResources(e,t=!1){for(const n in e)this.layerManager.resourceManager.add({resourceId:n,data:e[n],forceUpdate:t})}_removeResources(e){for(const t of e)this.layerManager.resourceManager.remove(t)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){this.layerManager?.removeDefaultShaderModule(e)}_pick(e,t,n){qs(this.deckPicker);const{stats:i}=this;i.get("Pick Count").incrementCount(),i.get(t).timeStart();const s=this.deckPicker[e]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n});return i.get(t).timeEnd(),s}_createCanvas(e){let t=e.canvas;return typeof t=="string"&&(t=document.getElementById(t),qs(t)),t||(t=document.createElement("canvas"),t.id=e.id||"deckgl-overlay",(e.parent||document.body).appendChild(t)),Object.assign(t.style,e.style),t}_setCanvasSize(e){if(!this.canvas)return;const{width:t,height:n}=e;if(t||t===0){const i=Number.isFinite(t)?`${t}px`:t;this.canvas.style.width=i}if(n||n===0){const i=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=i}}_updateCanvasSize(){const{canvas:e}=this;if(!e)return;const t=e.clientWidth??e.width,n=e.clientHeight??e.height;(t!==this.width||n!==this.height)&&(this.width=t,this.height=n,this.viewManager?.setProps({width:t,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:t,height:n}))}_createAnimationLoop(e,t){const{gl:n,onError:i,useDevicePixels:s}=t;return new EJ({device:e,useDevicePixels:s,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:o=>this._setDevice(o.device),onRender:this._onRenderFrame.bind(this),onError:i})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){const{views:e}=this.props,t=Array.isArray(e)?e:e?[e]:[new fL({id:"default-view"})];return t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){const{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){if(this.device?.type==="webgpu")return;const{_pickRequest:e}=this;if(e.event){const{result:t,emptyInfo:n}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=t.length>0;let i=n,s=!1;for(const o of t)i=o,s=o.layer?.onHover(o,e.event)||s;s||(this.props.onHover?.(i,e.event),this.widgetManager.onHover(i,e.event)),e.event=null}}_updateCursor(){const 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.type==="webgl"&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device.type==="webgl"&&this.props.onWebGLInitialized(this.device.gl);const t=new tL;t.play(),this.animationLoop.attachTimeline(t),this.eventManager=new rW(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(GS).map(i=>{const[s,o,c,f]=GS[i],A=this.props.eventRecognizerOptions?.[i],v={...o,...A,event:i};return{recognizer:new s(v),recognizeWith:c,requestFailure:f}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const i in x2)this.eventManager.on(i,this._onEvent);this.viewManager=new mX({timeline:t,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});const n=this.viewManager.getViewports()[0];this.layerManager=new gX(this.device,{deck:this,stats:this.stats,viewport:n,timeline:t}),this.effectManager=new FX({deck:this,device:this.device}),this.deckRenderer=new LX(this.device),this.deckPicker=new VX(this.device),this.widgetManager=new $X({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new JX),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,t){const{device:n,gl:i}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:i});const s={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(),...t};this.deckRenderer?.renderLayers(s),s.pass==="screen"&&this.widgetManager.onRedraw({viewports:s.viewports,layers:s.layers}),this.props.onAfterRender({device:n,gl:i})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),Yr.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this.device?.type!=="webgpu"&&this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){const t=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:t},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){const{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();const t=this.animationLoop.stats;e.get("GPU Time").addTime(t.get("GPU Time").lastTiming),e.get("CPU Time").addTime(t.get("CPU Time").lastTiming)}_getMetrics(){const{metrics:e,stats:t}=this;e.fps=t.get("frameRate").getHz(),e.setPropsTime=t.get("setProps Time").time,e.updateAttributesTime=t.get("Update Attributes").time,e.framesRedrawn=t.get("Redraw Count").count,e.pickTime=t.get("pickObject Time").time+t.get("pickMultipleObjects Time").time+t.get("pickObjects Time").time,e.pickCount=t.get("Pick Count").count,e.gpuTime=t.get("GPU Time").time,e.cpuTime=t.get("CPU Time").time,e.gpuTimePerFrame=t.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=t.get("CPU Time").getAverageTime();const n=f2.stats.get("Memory Usage");e.bufferMemory=n.get("Buffer Memory").count,e.textureMemory=n.get("Texture Memory").count,e.renderbufferMemory=n.get("Renderbuffer Memory").count,e.gpuMemory=n.get("GPU Memory").count}}kw.defaultProps=BL;kw.VERSION=eV;function $q(r){switch(r){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return jO(r)}}const Wq=HO;function qm(r,e,t){const n=t==="webgpu"&&e.type==="uint8"?"unorm8":e.type;return{attribute:r,format:e.size>1?`${n}x${e.size}`:e.type,byteOffset:e.offset||0}}function Yf(r){return r.stride||r.size*r.bytesPerElement}function Jq(r,e){return r.type===e.type&&r.size===e.size&&Yf(r)===Yf(e)&&(r.offset||0)===(e.offset||0)}function D2(r,e){e.offset&&Yr.removed("shaderAttribute.offset","vertexOffset, elementOffset")();const t=Yf(r),n=e.vertexOffset!==void 0?e.vertexOffset:r.vertexOffset||0,i=e.elementOffset||0,s=n*t+i*r.bytesPerElement+(r.offset||0);return{...e,offset:s,stride:t}}function Xq(r,e){const t=D2(r,e);return{high:t,low:{...t,offset:t.offset+r.size*4}}}class Kq{constructor(e,t,n){this._buffer=null,this.device=e,this.id=t.id||"",this.size=t.size||1;const i=t.logicalType||t.type,s=i==="float64";let{defaultValue:o}=t;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0);let c;s?c="float32":!i&&t.isIndexed?c="uint32":c=i||"float32";let f=$q(i||c);this.doublePrecision=s,s&&t.fp64===!1&&(f=Float32Array),this.value=null,this.settings={...t,defaultType:f,defaultValue:o,logicalType:i,type:c,normalized:c.includes("norm"),size:this.size,bytesPerElement:f.BYTES_PER_ELEMENT},this.state={...n,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(){const e=this.getAccessor();return e.vertexOffset?e.vertexOffset*Yf(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),Pp.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,t=null){const n={};if(this.state.constant){const i=this.value;if(t){const s=D2(this.getAccessor(),t),o=s.offset/i.BYTES_PER_ELEMENT,c=s.size||this.size;n[e]=i.subarray(o,o+c)}else n[e]=i}else n[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?n[`${e}64Low`]=n[e]:n[`${e}64Low`]=new Float32Array(this.size)),n}_getBufferLayout(e=this.id,t=null){const n=this.getAccessor(),i=[],s={name:this.id,byteStride:Yf(n),attributes:i};if(this.doublePrecision){const o=Xq(n,t||{});i.push(qm(e,{...n,...o.high},this.device.type),qm(`${e}64Low`,{...n,...o.low},this.device.type))}else if(t){const o=D2(n,t);i.push(qm(e,{...n,...o},this.device.type))}else i.push(qm(e,n,this.device.type));return s}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){const t=Array.from(this.value);e=[t,t]}else{const{value:t,numInstances:n,size:i}=this,s=n*i;if(t&&s&&t.length>=s){const o=new Array(i).fill(1/0),c=new Array(i).fill(-1/0);for(let f=0;f<s;)for(let A=0;A<i;A++){const v=t[f++];v<o[A]&&(o[A]=v),v>c[A]&&(c[A]=v)}e=[o,c]}}return this.state.bounds=e,e}setData(e){const{state:t}=this;let n;ArrayBuffer.isView(e)?n={value:e}:e instanceof ji?n={buffer:e}:n=e;const i={...this.settings,...n};if(ArrayBuffer.isView(n.value)){if(!n.type)if(this.doublePrecision&&n.value instanceof Float64Array)i.type="float32";else{const o=Wq(n.value);i.type=i.normalized?o.replace("int","norm"):o}i.bytesPerElement=n.value.BYTES_PER_ELEMENT,i.stride=Yf(i)}if(t.bounds=null,n.constant){let s=n.value;if(s=this._normalizeValue(s,[],0),this.settings.normalized&&(s=this.normalizeConstant(s)),!(!t.constant||!this._areValuesEqual(s,this.value)))return!1;t.externalBuffer=null,t.constant=!0,this.value=ArrayBuffer.isView(s)?s:new Float32Array(s)}else if(n.buffer){const s=n.buffer;t.externalBuffer=s,t.constant=!1,this.value=n.value||null}else if(n.value){this._checkExternalBuffer(n);let s=n.value;t.externalBuffer=null,t.constant=!1,this.value=s;let{buffer:o}=this;const c=Yf(i),f=(i.vertexOffset||0)*c;if(this.doublePrecision&&s instanceof Float64Array&&(s=ob(s,i)),this.settings.isIndexed){const v=this.settings.defaultType;s.constructor!==v&&(s=new v(s))}const A=s.byteLength+f+c*2;(!o||o.byteLength<A)&&(o=this._createBuffer(A)),o.write(s,f)}return this.setAccessor(i),!0}updateSubBuffer(e={}){this.state.bounds=null;const t=this.value,{startOffset:n=0,endOffset:i}=e;this.buffer.write(this.doublePrecision&&t instanceof Float64Array?ob(t,{size:this.size,startIndex:n,endIndex:i}):t.subarray(n,i),n*t.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,t=!1){const{state:n}=this,i=n.allocatedValue,s=Pp.allocate(i,e+1,{size:this.size,type:this.settings.defaultType,copy:t});this.value=s;const{byteOffset:o}=this;let{buffer:c}=this;return(!c||c.byteLength<s.byteLength+o)&&(c=this._createBuffer(s.byteLength+o),t&&i&&c.write(i instanceof Float64Array?ob(i,this):i,o)),n.allocatedValue=s,n.constant=!1,n.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){const{value:t}=e;if(!ArrayBuffer.isView(t))throw new Error(`Attribute ${this.id} value is not TypedArray`);const n=this.settings.defaultType;let i=!1;if(this.doublePrecision&&(i=t.BYTES_PER_ELEMENT<4),i)throw new Error(`Attribute ${this.id} does not support ${t.constructor.name}`);!(t instanceof n)&&this.settings.normalized&&!("normalized"in e)&&Yr.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(t=>(t+128)/255*2-1);case"snorm16":return new Float32Array(e).map(t=>(t+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(t=>t/255);case"unorm16":return new Float32Array(e).map(t=>t/65535);default:return e}}_normalizeValue(e,t,n){const{defaultValue:i,size:s}=this.settings;if(Number.isFinite(e))return t[n]=e,t;if(!e){let o=s;for(;--o>=0;)t[n+o]=i[o];return t}switch(s){case 4:t[n+3]=Number.isFinite(e[3])?e[3]:i[3];case 3:t[n+2]=Number.isFinite(e[2])?e[2]:i[2];case 2:t[n+1]=Number.isFinite(e[1])?e[1]:i[1];case 1:t[n+0]=Number.isFinite(e[0])?e[0]:i[0];break;default:let o=s;for(;--o>=0;)t[n+o]=Number.isFinite(e[o])?e[o]:i[o]}return t}_areValuesEqual(e,t){if(!e||!t)return!1;const{size:n}=this;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}_createBuffer(e){this._buffer&&this._buffer.destroy();const{isIndexed:t,type:n}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:(t?ji.INDEX:ji.VERTEX)|ji.COPY_DST,indexType:t?n:void 0,byteLength:e}),this._buffer}}const B3=[],S3=[];function gl(r,e=0,t=1/0){let n=B3;const i={index:-1,data:r,target:[]};return r?typeof r[Symbol.iterator]=="function"?n=r:r.length>0&&(S3.length=r.length,n=S3):n=B3,(e>0||Number.isFinite(t))&&(n=(Array.isArray(n)?n:Array.from(n)).slice(e,t),i.index=e-1),{iterable:n,objectInfo:i}}function SL(r){return r&&r[Symbol.asyncIterator]}function IL(r,e){const{size:t,stride:n,offset:i,startIndices:s,nested:o}=e,c=r.BYTES_PER_ELEMENT,f=n?n/c:t,A=i?i/c:0,v=Math.floor((r.length-A)/f);return(w,{index:S,target:F})=>{if(!s){const G=S*f+A;for(let H=0;H<t;H++)F[H]=r[G+H];return F}const N=s[S],U=s[S+1]||v;let $;if(o){$=new Array(U-N);for(let G=N;G<U;G++){const H=G*f+A;F=new Array(t);for(let J=0;J<t;J++)F[J]=r[H+J];$[G-N]=F}}else if(f===t)$=r.subarray(N*t+A,U*t+A);else{$=new r.constructor((U-N)*t);let G=0;for(let H=N;H<U;H++){const J=H*f+A;for(let ue=0;ue<t;ue++)$[G++]=r[J+ue]}}return $}}const qq=[],V0=[[0,1/0]];function Yq(r,e){if(r===V0||(e[0]<0&&(e[0]=0),e[0]>=e[1]))return r;const t=[],n=r.length;let i=0;for(let s=0;s<n;s++){const o=r[s];o[1]<e[0]?(t.push(o),i=s+1):o[0]>e[1]?t.push(o):e=[Math.min(o[0],e[0]),Math.max(o[1],e[1])]}return t.splice(i,0,e),t}const Zq={interpolation:{duration:0,easing:r=>r},spring:{stiffness:.05,damping:.5}};function ML(r,e){if(!r)return null;Number.isFinite(r)&&(r={type:"interpolation",duration:r});const t=r.type||"interpolation";return{...Zq[t],...e,...r,type:t}}class PL extends Kq{constructor(e,t){super(e,t,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:V0}),this.constant=!1,this.settings.update=t.update||(t.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}={}){const t=this.state.needsRedraw;return this.state.needsRedraw=t&&!e,t}layoutChanged(){return this.state.layoutChanged}setAccessor(e){var t;(t=this.state).layoutChanged||(t.layoutChanged=!Jq(e,this.getAccessor())),super.setAccessor(e)}getUpdateTriggers(){const{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return!!this.settings.transition}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;const{accessor:t}=this.settings,n=this.settings.transition,i=Array.isArray(t)?e[t.find(s=>e[s])]:e[t];return ML(i,n)}setNeedsUpdate(e=this.id,t){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),t){const{startRow:n=0,endRow:i=1/0}=t;this.state.updateRanges=Yq(this.state.updateRanges,[n,i])}else this.state.updateRanges=V0}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=qq}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){const{state:t,settings:n}=this;return n.noAlloc?!1:n.update?(super.allocate(e,t.updateRanges!==V0),!0):!1}updateBuffer({numInstances:e,data:t,props:n,context:i}){if(!this.needsUpdate())return!1;const{state:{updateRanges:s},settings:{update:o,noAlloc:c}}=this;let f=!0;if(o){for(const[A,v]of s)o.call(i,this,{data:t,startRow:A,endRow:v,props:n,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(const[A,v]of s){const w=Number.isFinite(A)?this.getVertexOffset(A):0,S=Number.isFinite(v)?this.getVertexOffset(v):c||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:w,endOffset:S})}this._checkAttributeArray()}else f=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),f}setConstantValue(e){return this.device.type==="webgpu"||e===void 0||typeof e=="function"?!1:(this.setData({constant:!0,value:e})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}setExternalBuffer(e){const{state:t}=this;return e?(this.clearNeedsUpdate(),t.lastExternalBuffer===e||(t.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e)),!0):(t.lastExternalBuffer=null,!1)}setBinaryValue(e,t=null){const{state:n,settings:i}=this;if(!e)return n.binaryValue=null,n.binaryAccessor=null,!1;if(i.noAlloc)return!1;if(n.binaryValue===e)return this.clearNeedsUpdate(),!0;if(n.binaryValue=e,this.setNeedsRedraw(),i.transform||t!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});const o=e;qs(ArrayBuffer.isView(o.value),`invalid ${i.accessor}`);const c=!!o.size&&o.size!==this.size;return n.binaryAccessor=IL(o.value,{size:o.size||this.size,stride:o.stride,offset:o.offset,startIndices:t,nested:c}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){const{startIndices:t}=this;return(t?e<t.length?t[e]:this.numInstances:e)*this.size}getValue(){const e=this.settings.shaderAttributes,t=super.getValue();if(!e)return t;for(const n in e)Object.assign(t,super.getValue(n,e[n]));return t}getBufferLayout(e){this.state.layoutChanged=!1;const t=this.settings.shaderAttributes,n=super._getBufferLayout(),{stepMode:i}=this.settings;if(i==="dynamic"?n.stepMode=e?e.isInstanced?"instance":"vertex":"instance":n.stepMode=i??"vertex",!t)return n;for(const s in t){const o=super._getBufferLayout(s,t[s]);n.attributes.push(...o.attributes)}return n}_autoUpdater(e,{data:t,startRow:n,endRow:i,props:s,numInstances:o}){if(e.constant&&this.context.device.type!=="webgpu")return;const{settings:c,state:f,value:A,size:v,startIndices:w}=e,{accessor:S,transform:F}=c;let N=f.binaryAccessor||(typeof S=="function"?S:s[S]);typeof N!="function"&&(N=()=>N),qs(typeof N=="function",`accessor "${S}" is not a function`);let U=e.getVertexOffset(n);const{iterable:$,objectInfo:G}=gl(t,n,i);for(const H of $){G.index++;let J=N(H,G);if(F&&(J=F.call(this,J)),w){const ue=(G.index<w.length-1?w[G.index+1]:o)-w[G.index];if(J&&Array.isArray(J[0])){let q=U;for(const se of J)e._normalizeValue(se,A,q),q+=v}else J&&J.length>v?A.set(J,U):(e._normalizeValue(J,G.target,0),fX({target:A,source:G.target,start:U,count:ue}));U+=ue*v}else e._normalizeValue(J,A,U),U+=v}}_validateAttributeUpdaters(){const{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){const{value:e}=this,t=Math.min(4,this.size);if(e&&e.length>=t){let n=!0;switch(t){case 4:n=n&&Number.isFinite(e[3]);case 3:n=n&&Number.isFinite(e[2]);case 2:n=n&&Number.isFinite(e[1]);case 1:n=n&&Number.isFinite(e[0]);break;default:n=!1}if(!n)throw new Error(`Illegal attribute generated for ${this.id}`)}}}function gb(r){const{source:e,target:t,start:n=0,size:i,getData:s}=r,o=r.end||t.length,c=e.length,f=o-n;if(c>f){t.set(e.subarray(0,f),n);return}if(t.set(e,n),!s)return;let A=c;for(;A<f;){const v=s(A,e);for(let w=0;w<i;w++)t[n+A]=v[w]||0,A++}}function Qq({source:r,target:e,size:t,getData:n,sourceStartIndices:i,targetStartIndices:s}){if(!i||!s)return gb({source:r,target:e,size:t,getData:n}),e;let o=0,c=0;const f=n&&((v,w)=>n(v+c,w)),A=Math.min(i.length,s.length);for(let v=1;v<A;v++){const w=i[v]*t,S=s[v]*t;gb({source:r.subarray(o,w),target:e,start:c,end:S,size:t,getData:f}),o=w,c=S}return c<e.length&&gb({source:[],target:e,start:c,size:t,getData:f}),e}function eY(r){const{device:e,settings:t,value:n}=r,i=new PL(e,t);return i.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:t.normalized}),i}function RL(r){switch(r){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 "${r}"`)}}function FL(r){switch(r){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function DL(r){r.push(r.shift())}function tY(r,e){const{doublePrecision:t,settings:n,value:i,size:s}=r,o=t&&i instanceof Float64Array?2:1;let c=0;const{shaderAttributes:f}=r.settings;if(f)for(const A of Object.values(f))c=Math.max(c,A.vertexOffset??0);return(n.noAlloc?i.length:(e+c)*s)*o}function OL({device:r,source:e,target:t}){return(!t||t.byteLength<e.byteLength)&&(t?.destroy(),t=r.createBuffer({byteLength:e.byteLength,usage:e.usage})),t}function LL({device:r,buffer:e,attribute:t,fromLength:n,toLength:i,fromStartIndices:s,getData:o=c=>c}){const c=t.doublePrecision&&t.value instanceof Float64Array?2:1,f=t.size*c,A=t.byteOffset,v=t.settings.bytesPerElement<4?A/t.settings.bytesPerElement*4:A,w=t.startIndices,S=s&&w,F=t.isConstant;if(!S&&e&&n>=i)return e;const N=t.value instanceof Float64Array?Float32Array:t.value.constructor,U=F?t.value:new N(t.getBuffer().readSyncWebGL(A,i*N.BYTES_PER_ELEMENT).buffer);if(t.settings.normalized&&!F){const J=o;o=(ue,q)=>t.normalizeConstant(J(ue,q))}const $=F?(J,ue)=>o(U,ue):(J,ue)=>o(U.subarray(J+A,J+A+f),ue),G=e?new Float32Array(e.readSyncWebGL(v,n*4).buffer):new Float32Array(0),H=new Float32Array(i);return Qq({source:G,target:H,sourceStartIndices:s,targetStartIndices:w,size:f,getData:$}),(!e||e.byteLength<H.byteLength+v)&&(e?.destroy(),e=r.createBuffer({byteLength:H.byteLength+v,usage:35050})),e.write(H,v),e}class kL{constructor({device:e,attribute:t,timeline:n}){this.buffers=[],this.currentLength=0,this.device=e,this.transition=new Ay(n),this.attribute=t,this.attributeInTransition=eY(t),this.currentStartIndices=t.startIndices}get inProgress(){return this.transition.inProgress}start(e,t,n=1/0){this.settings=e,this.currentStartIndices=this.attribute.startIndices,this.currentLength=tY(this.attribute,t),this.transition.start({...e,duration:n})}update(){const 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(const e of this.buffers)e.destroy();this.buffers.length=0}}class rY extends kL{constructor({device:e,attribute:t,timeline:n}){super({device:e,attribute:t,timeline:n}),this.type="interpolation",this.transform=oY(e,t)}start(e,t){const n=this.currentLength,i=this.currentStartIndices;if(super.start(e,t,e.duration),e.duration<=0){this.transition.cancel();return}const{buffers:s,attribute:o}=this;DL(s),s[0]=LL({device:this.device,buffer:s[0],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:i,getData:e.enter}),s[1]=OL({device:this.device,source:s[0],target:s[1]}),this.setBuffer(s[1]);const{transform:c}=this,f=c.model;let A=Math.floor(this.currentLength/o.size);NL(o)&&(A/=2),f.setVertexCount(A),o.isConstant?(f.setAttributes({aFrom:s[0]}),f.setConstantAttributes({aTo:o.value})):f.setAttributes({aFrom:s[0],aTo:o.getBuffer()}),c.transformFeedback.setBuffers({vCurrent:s[1]})}onUpdate(){const{duration:e,easing:t}=this.settings,{time:n}=this.transition;let i=n/e;t&&(i=t(i));const{model:s}=this.transform,o={time:i};s.shaderInputs.setProps({interpolation:o}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}}const nY=`uniform interpolationUniforms {
2008  float time;
2009} interpolation;
2010`,I3={name:"interpolation",vs:nY,uniformTypes:{time:"f32"}},iY=`#version 300 es
2011#define SHADER_NAME interpolation-transition-vertex-shader
2012
2013in ATTRIBUTE_TYPE aFrom;
2014in ATTRIBUTE_TYPE aTo;
2015out ATTRIBUTE_TYPE vCurrent;
2016
2017void main(void) {
2018  vCurrent = mix(aFrom, aTo, interpolation.time);
2019  gl_Position = vec4(0.0);
2020}
2021`,sY=`#version 300 es
2022#define SHADER_NAME interpolation-transition-vertex-shader
2023
2024in ATTRIBUTE_TYPE aFrom;
2025in ATTRIBUTE_TYPE aFrom64Low;
2026in ATTRIBUTE_TYPE aTo;
2027in ATTRIBUTE_TYPE aTo64Low;
2028out ATTRIBUTE_TYPE vCurrent;
2029out ATTRIBUTE_TYPE vCurrent64Low;
2030
2031vec2 mix_fp64(vec2 a, vec2 b, float x) {
2032  vec2 range = sub_fp64(b, a);
2033  return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));
2034}
2035
2036void main(void) {
2037  for (int i=0; i<ATTRIBUTE_SIZE; i++) {
2038    vec2 value = mix_fp64(vec2(aFrom[i], aFrom64Low[i]), vec2(aTo[i], aTo64Low[i]), interpolation.time);
2039    vCurrent[i] = value.x;
2040    vCurrent64Low[i] = value.y;
2041  }
2042  gl_Position = vec4(0.0);
2043}
2044`;function NL(r){return r.doublePrecision&&r.value instanceof Float64Array}function oY(r,e){const t=e.size,n=RL(t),i=FL(t),s=e.getBufferLayout();return NL(e)?new fh(r,{vs:sY,bufferLayout:[{name:"aFrom",byteStride:8*t,attributes:[{attribute:"aFrom",format:i,byteOffset:0},{attribute:"aFrom64Low",format:i,byteOffset:4*t}]},{name:"aTo",byteStride:8*t,attributes:[{attribute:"aTo",format:i,byteOffset:0},{attribute:"aTo64Low",format:i,byteOffset:4*t}]}],modules:[Wj,I3],defines:{ATTRIBUTE_TYPE:n,ATTRIBUTE_SIZE:t},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0}):new fh(r,{vs:iY,bufferLayout:[{name:"aFrom",format:i},{name:"aTo",format:s.attributes[0].format}],modules:[I3],defines:{ATTRIBUTE_TYPE:n},varyings:["vCurrent"],disableWarnings:!0})}class aY extends kL{constructor({device:e,attribute:t,timeline:n}){super({device:e,attribute:t,timeline:n}),this.type="spring",this.texture=dY(e),this.framebuffer=pY(e,this.texture),this.transform=hY(e,t)}start(e,t){const n=this.currentLength,i=this.currentStartIndices;super.start(e,t);const{buffers:s,attribute:o}=this;for(let f=0;f<2;f++)s[f]=LL({device:this.device,buffer:s[f],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:i,getData:e.enter});s[2]=OL({device:this.device,source:s[0],target:s[2]}),this.setBuffer(s[1]);const{model:c}=this.transform;c.setVertexCount(Math.floor(this.currentLength/o.size)),o.isConstant?c.setConstantAttributes({aTo:o.value}):c.setAttributes({aTo:o.getBuffer()})}onUpdate(){const{buffers:e,transform:t,framebuffer:n,transition:i}=this,s=this.settings;t.model.setAttributes({aPrev:e[0],aCur:e[1]}),t.transformFeedback.setBuffers({vNext:e[2]});const o={stiffness:s.stiffness,damping:s.damping};t.model.shaderInputs.setProps({spring:o}),t.run({framebuffer:n,discard:!1,parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]}),DL(e),this.setBuffer(e[1]),this.device.readPixelsToArrayWebGL(n)[0]>0||i.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}}const cY=`uniform springUniforms {
2045  float damping;
2046  float stiffness;
2047} spring;
2048`,lY={name:"spring",vs:cY,uniformTypes:{damping:"f32",stiffness:"f32"}},uY=`#version 300 es
2049#define SHADER_NAME spring-transition-vertex-shader
2050
2051#define EPSILON 0.00001
2052
2053in ATTRIBUTE_TYPE aPrev;
2054in ATTRIBUTE_TYPE aCur;
2055in ATTRIBUTE_TYPE aTo;
2056out ATTRIBUTE_TYPE vNext;
2057out float vIsTransitioningFlag;
2058
2059ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {
2060  ATTRIBUTE_TYPE velocity = cur - prev;
2061  ATTRIBUTE_TYPE delta = dest - cur;
2062  ATTRIBUTE_TYPE force = delta * spring.stiffness;
2063  ATTRIBUTE_TYPE resistance = velocity * spring.damping;
2064  return force - resistance + velocity + cur;
2065}
2066
2067void main(void) {
2068  bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;
2069  vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;
2070
2071  vNext = getNextValue(aCur, aPrev, aTo);
2072  gl_Position = vec4(0, 0, 0, 1);
2073  gl_PointSize = 100.0;
2074}
2075`,fY=`#version 300 es
2076#define SHADER_NAME spring-transition-is-transitioning-fragment-shader
2077
2078in float vIsTransitioningFlag;
2079
2080out vec4 fragColor;
2081
2082void main(void) {
2083  if (vIsTransitioningFlag == 0.0) {
2084    discard;
2085  }
2086  fragColor = vec4(1.0);
2087}`;function hY(r,e){const t=RL(e.size),n=FL(e.size);return new fh(r,{vs:uY,fs:fY,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[lY],defines:{ATTRIBUTE_TYPE:t},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function dY(r){return r.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}
vendor: 28,616 bytes, line 2087
2087function pY(r,e){return r.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}const AY={interpolation:rY,spring:aY};class gY{constructor(e,{id:t,timeline:n}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=t,this.device=e,this.timeline=n,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(const e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:t,numInstances:n}){this.numInstances=n||1;for(const i in e){const s=e[i],o=s.getTransitionSetting(t);o&&this._updateAttribute(i,s,o)}for(const i in this.transitions){const s=e[i];(!s||!s.getTransitionSetting(t))&&this._removeTransition(i)}}hasAttribute(e){const t=this.transitions[e];return t&&t.inProgress}getAttributes(){const e={};for(const t in this.transitions){const n=this.transitions[t];n.inProgress&&(e[t]=n.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(const t in this.transitions)this.transitions[t].update()&&(this.needsRedraw=!0);const e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,t,n){const i=this.transitions[e];let s=!i||i.type!==n.type;if(s){i&&this._removeTransition(e);const o=AY[n.type];o?this.transitions[e]=new o({attribute:t,timeline:this.timeline,device:this.device}):(Yr.error(`unsupported transition type '${n.type}'`)(),s=!1)}(s||t.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(n,this.numInstances))}}const M3="attributeManager.invalidate",mY="attributeManager.updateStart",_Y="attributeManager.updateEnd",yY="attribute.updateStart",vY="attribute.allocate",bY="attribute.updateEnd";class gy{constructor(e,{id:t="attribute-manager",stats:n,timeline:i}={}){this.mergeBoundsMemoized=kg(hJ),this.id=t,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new gY(e,{id:`${t}-transitions`,timeline:i}),Object.seal(this)}finalize(){for(const e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){const t=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,t&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(const t of e)this.attributes[t]!==void 0&&(this.attributes[t].delete(),delete this.attributes[t])}invalidate(e,t){const n=this._invalidateTrigger(e,t);Ao(M3,this,e,n)}invalidateAll(e){for(const t in this.attributes)this.attributes[t].setNeedsUpdate(t,e);Ao(M3,this,"all")}update({data:e,numInstances:t,startIndices:n=null,transitions:i,props:s={},buffers:o={},context:c={}}){let f=!1;Ao(mY,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(const A in this.attributes){const v=this.attributes[A],w=v.settings.accessor;v.startIndices=n,v.numInstances=t,s[A]&&Yr.removed(`props.${A}`,`data.attributes.${A}`)(),v.setExternalBuffer(o[A])||v.setBinaryValue(typeof w=="string"?o[w]:void 0,e.startIndices)||typeof w=="string"&&!o[w]&&v.setConstantValue(s[w])||v.needsUpdate()&&(f=!0,this._updateAttribute({attribute:v,numInstances:t,data:e,props:s,context:c})),this.needsRedraw=this.needsRedraw||v.needsRedraw()}f&&Ao(_Y,this,t),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:t,transitions:i})}updateTransition(){const{attributeTransitionManager:e}=this,t=e.run();return this.needsRedraw=this.needsRedraw||t,t}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){const t=e.map(n=>this.attributes[n]?.getBounds());return this.mergeBoundsMemoized(t)}getChangedAttributes(e={clearChangedFlags:!1}){const{attributes:t,attributeTransitionManager:n}=this,i={...n.getAttributes()};for(const s in t){const o=t[s];o.needsRedraw(e)&&!n.hasAttribute(s)&&(i[s]=o)}return i}getBufferLayouts(e){return Object.values(this.getAttributes()).map(t=>t.getBufferLayout(e))}_add(e,t){for(const n in e){const i=e[n],s={...i,id:n,size:i.isIndexed&&1||i.size||1,...t};this.attributes[n]=new PL(this.device,s)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){const e={};for(const t in this.attributes)this.attributes[t].getUpdateTriggers().forEach(i=>{e[i]||(e[i]=[]),e[i].push(t)});this.updateTriggers=e}_invalidateTrigger(e,t){const{attributes:n,updateTriggers:i}=this,s=i[e];return s&&s.forEach(o=>{const c=n[o];c&&c.setNeedsUpdate(c.id,t)}),s}_updateAttribute(e){const{attribute:t,numInstances:n}=e;if(Ao(yY,t),t.constant){t.setConstantValue(t.value);return}t.allocate(n)&&Ao(vY,t,n),t.updateBuffer(e)&&(this.needsRedraw=!0,Ao(bY,t,n))}}class xY extends Ay{get value(){return this._value}_onUpdate(){const{time:e,settings:{fromValue:t,toValue:n,duration:i,easing:s}}=this,o=s(e/i);this._value=Cc(t,n,o)}}const P3=1e-5;function R3(r,e,t,n,i){const s=e-r,c=(t-e)*i,f=-s*n;return c+f+s+e}function wY(r,e,t,n,i){if(Array.isArray(t)){const s=[];for(let o=0;o<t.length;o++)s[o]=R3(r[o],e[o],t[o],n,i);return s}return R3(r,e,t,n,i)}function F3(r,e){if(Array.isArray(r)){let t=0;for(let n=0;n<r.length;n++){const i=r[n]-e[n];t+=i*i}return Math.sqrt(t)}return Math.abs(r-e)}class CY extends Ay{get value(){return this._currValue}_onUpdate(){const{fromValue:e,toValue:t,damping:n,stiffness:i}=this.settings,{_prevValue:s=e,_currValue:o=e}=this;let c=wY(s,o,t,n,i);const f=F3(c,t),A=F3(c,o);f<P3&&A<P3&&(c=t,this.end()),this._prevValue=o,this._currValue=c}}const TY={interpolation:xY,spring:CY};class EY{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,t,n,i){const{transitions:s}=this;if(s.has(e)){const f=s.get(e),{value:A=f.settings.fromValue}=f;t=A,this.remove(e)}if(i=ML(i),!i)return;const o=TY[i.type];if(!o){Yr.error(`unsupported transition type '${i.type}'`)();return}const c=new o(this.timeline);c.start({...i,fromValue:t,toValue:n}),s.set(e,c)}remove(e){const{transitions:t}=this;t.has(e)&&(t.get(e).cancel(),t.delete(e))}update(){const e={};for(const[t,n]of this.transitions)n.update(),e[t]=n.value,n.inProgress||this.remove(t);return e}clear(){for(const e of this.transitions.keys())this.remove(e)}}function BY(r){const e=r[Ku];for(const t in e){const n=e[t],{validate:i}=n;if(i&&!i(r[t],n))throw new Error(`Invalid prop ${t}: ${r[t]}`)}}function SY(r,e){const t=Nw({newProps:r,oldProps:e,propTypes:r[Ku],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=MY(r,e);let i=!1;return n||(i=PY(r,e)),{dataChanged:n,propsChanged:t,updateTriggersChanged:i,extensionsChanged:RY(r,e),transitionsChanged:IY(r,e)}}function IY(r,e){if(!r.transitions)return!1;const t={},n=r[Ku];let i=!1;for(const s in r.transitions){const o=n[s],c=o&&o.type;(c==="number"||c==="color"||c==="array")&&O2(r[s],e[s],o)&&(t[s]=!0,i=!0)}return i?t:!1}function Nw({newProps:r,oldProps:e,ignoreProps:t={},propTypes:n={},triggerName:i="props"}){if(e===r)return!1;if(typeof r!="object"||r===null)return`${i} changed shallowly`;if(typeof e!="object"||e===null)return`${i} changed shallowly`;for(const s of Object.keys(r))if(!(s in t)){if(!(s in e))return`${i}.${s} added`;const o=O2(r[s],e[s],n[s]);if(o)return`${i}.${s} ${o}`}for(const s of Object.keys(e))if(!(s in t)){if(!(s in r))return`${i}.${s} dropped`;if(!Object.hasOwnProperty.call(r,s)){const o=O2(r[s],e[s],n[s]);if(o)return`${i}.${s} ${o}`}}return!1}function O2(r,e,t){let n=t&&t.equal;return n&&!n(r,e,t)||!n&&(n=r&&e&&r.equals,n&&!n.call(r,e))?"changed deeply":!n&&e!==r?"changed shallowly":null}function MY(r,e){if(e===null)return"oldProps is null, initial diff";let t=!1;const{dataComparator:n,_dataDiff:i}=r;return n?n(r.data,e.data)||(t="Data comparator detected a change"):r.data!==e.data&&(t="A new data container was supplied"),t&&i&&(t=i(r.data,e.data)||t),t}function PY(r,e){if(e===null)return{all:!0};if("all"in r.updateTriggers&&D3(r,e,"all"))return{all:!0};const t={};let n=!1;for(const i in r.updateTriggers)i!=="all"&&D3(r,e,i)&&(t[i]=!0,n=!0);return n?t:!1}function RY(r,e){if(e===null)return!0;const t=e.extensions,{extensions:n}=r;if(n===t)return!1;if(!t||!n||n.length!==t.length)return!0;for(let i=0;i<n.length;i++)if(!n[i].equals(t[i]))return!0;return!1}function D3(r,e,t){let n=r.updateTriggers[t];n=n??{};let i=e.updateTriggers[t];return i=i??{},Nw({oldProps:i,newProps:n,triggerName:t})}const FY="count(): argument not an object",DY="count(): argument not a container";function OY(r){if(!kY(r))throw new Error(FY);if(typeof r.count=="function")return r.count();if(Number.isFinite(r.size))return r.size;if(Number.isFinite(r.length))return r.length;if(LY(r))return Object.keys(r).length;throw new Error(DY)}function LY(r){return r!==null&&typeof r=="object"&&r.constructor===Object}function kY(r){return r!==null&&typeof r=="object"}function O3(r,e){if(!e)return r;const t={...r,...e};if("defines"in e&&(t.defines={...r.defines,...e.defines}),"modules"in e&&(t.modules=(r.modules||[]).concat(e.modules),e.modules.some(n=>n.name==="project64"))){const n=t.modules.findIndex(i=>i.name==="project32");n>=0&&t.modules.splice(n,1)}if("inject"in e)if(!r.inject)t.inject=e.inject;else{const n={...r.inject};for(const i in e.inject)n[i]=(n[i]||"")+e.inject[i];t.inject=n}return t}const NY={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},L2={};function UY(r,e,t,n){if(t instanceof si)return t;t.constructor&&t.constructor.name!=="Object"&&(t={data:t});let i=null;t.compressed&&(i={minFilter:"linear",mipmapFilter:t.data.length>1?"nearest":"linear"});const s=e.createTexture({...t,sampler:{...NY,...i,...n},mipmaps:!0});return L2[s.id]=r,s}function zY(r,e){!e||!(e instanceof si)||L2[e.id]===r&&(e.delete(),delete L2[e.id])}const GY={boolean:{validate(r,e){return!0},equal(r,e,t){return!!r==!!e}},number:{validate(r,e){return Number.isFinite(r)&&(!("max"in e)||r<=e.max)&&(!("min"in e)||r>=e.min)}},color:{validate(r,e){return e.optional&&!r||k2(r)&&(r.length===3||r.length===4)},equal(r,e,t){return rs(r,e,1)}},accessor:{validate(r,e){const t=S_(r);return t==="function"||t===S_(e.value)},equal(r,e,t){return typeof e=="function"?!0:rs(r,e,1)}},array:{validate(r,e){return e.optional&&!r||k2(r)},equal(r,e,t){const{compare:n}=t,i=Number.isInteger(n)?n:n?1:0;return n?rs(r,e,i):r===e}},object:{equal(r,e,t){if(t.ignore)return!0;const{compare:n}=t,i=Number.isInteger(n)?n:n?1:0;return n?rs(r,e,i):r===e}},function:{validate(r,e){return e.optional&&!r||typeof r=="function"},equal(r,e,t){return!t.compare&&t.ignore!==!1||r===e}},data:{transform:(r,e,t)=>{if(!r)return r;const{dataTransform:n}=t.props;return n?n(r):typeof r.shape=="string"&&r.shape.endsWith("-table")&&Array.isArray(r.data)?r.data:r}},image:{transform:(r,e,t)=>{const n=t.context;return!n||!n.device?null:UY(t.id,n.device,r,{...e.parameters,...t.props.textureParameters})},release:(r,e,t)=>{zY(t.id,r)}}};function VY(r){const e={},t={},n={};for(const[i,s]of Object.entries(r)){const o=s?.deprecatedFor;if(o)n[i]=Array.isArray(o)?o:[o];else{const c=HY(i,s);e[i]=c,t[i]=c.value}}return{propTypes:e,defaultProps:t,deprecatedProps:n}}function HY(r,e){switch(S_(e)){case"object":return DA(r,e);case"array":return DA(r,{type:"array",value:e,compare:!1});case"boolean":return DA(r,{type:"boolean",value:e});case"number":return DA(r,{type:"number",value:e});case"function":return DA(r,{type:"function",value:e,compare:!0});default:return{name:r,type:"unknown",value:e}}}function DA(r,e){return"type"in e?{name:r,...GY[e.type],...e}:"value"in e?{name:r,type:S_(e.value),...e}:{name:r,type:"object",value:e}}function k2(r){return Array.isArray(r)||ArrayBuffer.isView(r)}function S_(r){return k2(r)?"array":r===null?"null":typeof r}function jY(r,e){let t;for(let s=e.length-1;s>=0;s--){const o=e[s];"extensions"in o&&(t=o.extensions)}const n=N2(r.constructor,t),i=Object.create(n);i[E_]=r,i[hh]={},i[ju]={};for(let s=0;s<e.length;++s){const o=e[s];for(const c in o)i[c]=o[c]}return Object.freeze(i),i}const $Y="_mergedDefaultProps";function N2(r,e){if(!(r instanceof my.constructor))return{};let t=$Y;if(e)for(const i of e){const s=i.constructor;s&&(t+=`:${s.extensionName||s.name}`)}const n=UL(r,t);return n||(r[t]=WY(r,e||[]))}function WY(r,e){if(!r.prototype)return null;const n=Object.getPrototypeOf(r),i=N2(n),s=UL(r,"defaultProps")||{},o=VY(s),c=Object.assign(Object.create(null),i,o.defaultProps),f=Object.assign(Object.create(null),i?.[Ku],o.propTypes),A=Object.assign(Object.create(null),i?.[fb],o.deprecatedProps);for(const v of e){const w=N2(v.constructor);w&&(Object.assign(c,w),Object.assign(f,w[Ku]),Object.assign(A,w[fb]))}return JY(c,r),KY(c,f),XY(c,A),c[Ku]=f,c[fb]=A,e.length===0&&!Uw(r,"_propTypes")&&(r._propTypes=f),c}function JY(r,e){const t=YY(e);Object.defineProperties(r,{id:{writable:!0,value:t}})}function XY(r,e){for(const t in e)Object.defineProperty(r,t,{enumerable:!1,set(n){const i=`${this.id}: ${t}`;for(const s of e[t])Uw(this,s)||(this[s]=n);Yr.deprecated(i,e[t].join("/"))()}})}function KY(r,e){const t={},n={};for(const i in e){const s=e[i],{name:o,value:c}=s;s.async&&(t[o]=c,n[o]=qY(o))}r[vp]=t,r[hh]={},Object.defineProperties(r,n)}function qY(r){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||SL(e)?this[hh][r]=e:this[ju][r]=e},get(){if(this[ju]){if(r in this[ju])return this[ju][r]||this[vp][r];if(r in this[hh]){const e=this[E_]&&this[E_].internalState;if(e&&e.hasAsyncProp(r))return e.getAsyncProp(r)||this[vp][r]}}return this[vp][r]}}}function Uw(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function UL(r,e){return Uw(r,e)&&r[e]}function YY(r){const e=r.componentName;return e||Yr.warn(`${r.name}.componentName not specified`)(),e||r.name}let ZY=0;class my{constructor(...e){this.props=jY(this,e),this.id=this.props.id,this.count=ZY++}clone(e){const{props:t}=this,n={};for(const i in t[vp])i in t[ju]?n[i]=t[ju][i]:i in t[hh]&&(n[i]=t[hh][i]);return new this.constructor({...t,...n,...e})}}my.componentName="Component";my.defaultProps={};const QY=Object.freeze({});class eZ{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(const e in this.asyncProps){const t=this.asyncProps[e];t&&t.type&&t.type.release&&t.type.release(t.resolvedValue,t.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||QY}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){const t=this.asyncProps[e];return t&&t.resolvedValue}isAsyncPropLoading(e){if(e){const t=this.asyncProps[e];return!!(t&&t.pendingLoadCount>0&&t.pendingLoadCount!==t.resolvedLoadCount)}for(const t in this.asyncProps)if(this.isAsyncPropLoading(t))return!0;return!1}reloadAsyncProp(e,t){this._watchPromise(e,Promise.resolve(t))}setAsyncProps(e){this.component=e[E_]||this.component;const t=e[ju]||{},n=e[hh]||e,i=e[vp]||{};for(const s in t){const o=t[s];this._createAsyncPropData(s,i[s]),this._updateAsyncProp(s,o),t[s]=this.getAsyncProp(s)}for(const s in n){const o=n[s];this._createAsyncPropData(s,i[s]),this._updateAsyncProp(s,o)}}_fetch(e,t){return null}_onResolve(e,t){}_onError(e,t){}_updateAsyncProp(e,t){if(this._didAsyncInputValueChange(e,t)){if(typeof t=="string"&&(t=this._fetch(e,t)),t instanceof Promise){this._watchPromise(e,t);return}if(SL(t)){this._resolveAsyncIterable(e,t);return}this._setPropValue(e,t)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(const e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,t){const n=this.asyncProps[e];return t===n.resolvedValue||t===n.lastValue?!1:(n.lastValue=t,!0)}_setPropValue(e,t){this._freezeAsyncOldProps();const n=this.asyncProps[e];n&&(t=this._postProcessValue(n,t),n.resolvedValue=t,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(e,t,n){const i=this.asyncProps[e];i&&n>=i.resolvedLoadCount&&t!==void 0&&(this._freezeAsyncOldProps(),i.resolvedValue=t,i.resolvedLoadCount=n,this.onAsyncPropUpdated(e,t))}_watchPromise(e,t){const n=this.asyncProps[e];if(n){n.pendingLoadCount++;const i=n.pendingLoadCount;t.then(s=>{this.component&&(s=this._postProcessValue(n,s),this._setAsyncPropValue(e,s,i),this._onResolve(e,s))}).catch(s=>{this._onError(e,s)})}}async _resolveAsyncIterable(e,t){if(e!=="data"){this._setPropValue(e,t);return}const n=this.asyncProps[e];if(!n)return;n.pendingLoadCount++;const i=n.pendingLoadCount;let s=[],o=0;for await(const c of t){if(!this.component)return;const{dataTransform:f}=this.component.props;f?s=f(c,s):s=s.concat(c),Object.defineProperty(s,"__diff",{enumerable:!1,value:[{startRow:o,endRow:s.length}]}),o=s.length,this._setAsyncPropValue(e,s,i)}this._onResolve(e,s)}_postProcessValue(e,t){const n=e.type;return n&&this.component&&(n.release&&n.release(e.resolvedValue,n,this.component),n.transform)?n.transform(t,n,this.component):t}_createAsyncPropData(e,t){if(!this.asyncProps[e]){const i=this.component&&this.component.props[Ku];this.asyncProps[e]={type:i&&i[e],lastValue:null,resolvedValue:t,pendingLoadCount:0,resolvedLoadCount:0}}}}class tZ extends eZ{constructor({attributeManager:e,layer:t}){super(t),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,t){const n=this.layer,i=n?.props.fetch;return i?i(t,{propName:e,layer:n}):super._fetch(e,t)}_onResolve(e,t){const n=this.layer;if(n){const i=n.props.onDataLoad;e==="data"&&i&&i(t,{propName:e,layer:n})}}_onError(e,t){const n=this.layer;n&&n.raiseError(t,`loading ${e} of ${this.layer}`)}}const rZ="layer.changeFlag",nZ="layer.initialize",iZ="layer.update",sZ="layer.finalize",oZ="layer.matched",L3=2**24-1,aZ=Object.freeze([]),cZ=kg(({oldViewport:r,viewport:e})=>r.equals(e));let lc=new Uint8ClampedArray(0);const lZ={data:{type:"data",value:aZ,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:r=>r&&r.__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:(r,{propName:e,layer:t,loaders:n,loadOptions:i,signal:s})=>{const{resourceManager:o}=t.context;i=i||t.getLoadOptions(),n=n||t.props.loaders,s&&(i={...i,fetch:{...i?.fetch,signal:s}});let c=o.contains(r);return!c&&!i&&(o.add({resourceId:r,data:s2(r,n),persistent:!1}),c=!0),c?o.subscribe({resourceId:r,onChange:f=>t.internalState?.reloadAsyncProp(e,f),consumerId:t.id,requestId:e}):s2(r,n,i)}},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:Qr.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:r})=>[0,-r*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class Es extends my{constructor(){super(...arguments),this.internalState=null,this.lifecycle=Zd.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){qs(this.internalState);const t=this.internalState.viewport||this.context.viewport,n=eL(e,{viewport:t,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[i,s,o]=K4(n,t.pixelProjectionMatrix);return e.length===2?[i,s]:[i,s,o]}unproject(e){return qs(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,t){qs(this.internalState);const n=this.internalState.viewport||this.context.viewport;return _J(e,{viewport:n,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...t})}get isComposite(){return!1}get isDrawable(){return!0}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(){const e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(const t of this.getModels())t.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){const{coordinateSystem:e}=this.props;return e===Qr.DEFAULT||e===Qr.LNGLAT||e===Qr.CARTESIAN}onHover(e,t){return this.props.onHover&&this.props.onHover(e,t)||!1}onClick(e,t){return this.props.onClick&&this.props.onClick(e,t)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,t=[]){return t[0]=e+1&255,t[1]=e+1>>8&255,t[2]=e+1>>8>>8&255,t}decodePickingColor(e){qs(e instanceof Uint8Array);const[t,n,i]=e;return t+n*256+i*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:OY(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=O3(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(const t of this.props.extensions)e=O3(e,t.getShaders.call(this,t));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){const t=this.getAttributeManager(),{dataChanged:n}=e.changeFlags;if(n&&t)if(Array.isArray(n))for(const i of n)t.invalidateAll(i);else t.invalidateAll();if(t){const{props:i}=e,s=this.internalState.hasPickingBuffer,o=Number.isInteger(i.highlightedObjectIndex)||i.pickable||i.extensions.some(c=>c.getNeedsPickingBuffer.call(this,c));if(s!==o){this.internalState.hasPickingBuffer=o;const{pickingColors:c,instancePickingColors:f}=t.attributes,A=c||f;A&&(o&&A.constant&&(A.constant=!1,t.invalidate(A.id)),!A.value&&!o&&(A.constant=!0,A.value=[0,0,0]))}}}finalizeState(e){for(const n of this.getModels())n.destroy();const t=this.getAttributeManager();t&&t.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(const t of this.getModels())t.draw(e.renderPass)}getPickingInfo({info:e,mode:t,sourceLayer:n}){const{index:i}=e;return i>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[i]),e}raiseError(e,t){t&&(e=new Error(`${t}: ${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;const t=this.internalState.viewport;this.internalState.viewport=e,(!t||!cZ({oldViewport:t,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){const t=this.getAttributeManager();t&&(e==="all"?t.invalidateAll():t.invalidate(e))}updateAttributes(e){let t=!1;for(const n in e)e[n].layoutChanged()&&(t=!0);for(const n of this.getModels())this._setModelAttributes(n,e,t)}_updateAttributes(){const e=this.getAttributeManager();if(!e)return;const t=this.props,n=this.getNumInstances(),i=this.getStartIndices();e.update({data:t.data,numInstances:n,startIndices:i,props:t,transitions:t.transitions,buffers:t.data.attributes,context:this});const s=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(s)}_updateAttributeTransition(){const e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){const{uniformTransitions:e}=this.internalState;if(e.active){const t=e.update(),n=Object.create(this.props);for(const i in t)Object.defineProperty(n,i,{value:t[i]});return n}return this.props}calculateInstancePickingColors(e,{numInstances:t}){if(e.constant)return;const n=Math.floor(lc.length/4);if(this.internalState.usesPickingColorCache=!0,n<t){t>L3&&Yr.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),lc=Pp.allocate(lc,t,{size:4,copy:!0,maxCount:Math.max(t,L3)});const i=Math.floor(lc.length/4),s=[0,0,0];for(let o=n;o<i;o++)this.encodePickingColor(o,s),lc[o*4+0]=s[0],lc[o*4+1]=s[1],lc[o*4+2]=s[2],lc[o*4+3]=0}e.value=lc.subarray(0,t*4)}_setModelAttributes(e,t,n=!1){if(!Object.keys(t).length)return;if(n){const c=this.getAttributeManager();e.setBufferLayout(c.getBufferLayouts(e)),t=c.getAttributes()}const i=e.userData?.excludeAttributes||{},s={},o={};for(const c in t){if(i[c])continue;const f=t[c].getValue();for(const A in f){const v=f[A];v instanceof ji?t[c].settings.isIndexed?e.setIndexBuffer(v):s[A]=v:v&&(o[A]=v)}}e.setAttributes(s),e.setConstantAttributes(o)}disablePickingIndex(e){const t=this.props.data;if(!("attributes"in t)){this._disablePickingIndex(e);return}const{pickingColors:n,instancePickingColors:i}=this.getAttributeManager().attributes,s=n||i,o=s&&t.attributes&&t.attributes[s.id];if(o&&o.value){const c=o.value,f=this.encodePickingColor(e);for(let A=0;A<t.length;A++){const v=s.getVertexOffset(A);c[v]===f[0]&&c[v+1]===f[1]&&c[v+2]===f[2]&&this._disablePickingIndex(A)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){const{pickingColors:t,instancePickingColors:n}=this.getAttributeManager().attributes,i=t||n;if(!i)return;const s=i.getVertexOffset(e),o=i.getVertexOffset(e+1);i.buffer.write(new Uint8Array(o-s),s)}restorePickingColors(){const{pickingColors:e,instancePickingColors:t}=this.getAttributeManager().attributes,n=e||t;n&&(this.internalState.usesPickingColorCache&&n.value.buffer!==lc.buffer&&(n.value=lc.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){qs(!this.internalState),qs(Number.isFinite(this.props.coordinateSystem)),Ao(nZ,this);const e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new tZ({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(Yr.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new EY(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(const t of this.props.extensions)t.initializeState.call(this,this.context,t);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){Ao(oZ,this,this===e);const{state:t,internalState:n}=e;this!==e&&(this.internalState=n,this.state=t,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}
2087_update(){const e=this.needsUpdate();if(Ao(iZ,this,e),!e)return;const t=this.props,n=this.context,i=this.internalState,s=n.viewport,o=this._updateUniformTransition();i.propsInTransition=o,n.viewport=i.viewport||s,this.props=o;try{const c=this._getUpdateParams(),f=this.getModels();if(n.device)this.updateState(c);else try{this.updateState(c)}catch{}for(const v of this.props.extensions)v.updateState.call(this,c,v);this.setNeedsRedraw(),this._updateAttributes();const A=this.getModels()[0]!==f[0];this._postUpdate(c,A)}finally{n.viewport=s,this.props=t,this._clearChangeFlags(),i.needsUpdate=!1,i.resetOldProps()}}_finalize(){Ao(sZ,this),this.finalizeState(this.context);for(const e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:t=null,uniforms:n={},parameters:i={}}){this._updateAttributeTransition();const s=this.props,o=this.context;this.props=this.internalState.propsInTransition||s;try{t&&this.setShaderModuleProps(t);const{getPolygonOffset:c}=this.props,f=c&&c(n)||[0,0];o.device instanceof lp&&o.device.setParametersWebGL({polygonOffset:f});for(const A of this.getModels())A.device.type==="webgpu"?A.setParameters({...A.parameters,...i}):A.setParameters(i);if(o.device instanceof lp)o.device.withParametersWebGL(i,()=>{const A={renderPass:e,shaderModuleProps:t,uniforms:n,parameters:i,context:o};for(const v of this.props.extensions)v.draw.call(this,A,v);this.draw(A)});else{const A={renderPass:e,shaderModuleProps:t,uniforms:n,parameters:i,context:o};for(const v of this.props.extensions)v.draw.call(this,A,v);this.draw(A)}}finally{this.props=s}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;const{changeFlags:t}=this.internalState;for(const i in e)if(e[i]){let s=!1;switch(i){case"dataChanged":const o=e[i],c=t[i];o&&Array.isArray(c)&&(t.dataChanged=Array.isArray(o)?c.concat(o):o,s=!0);default:t[i]||(t[i]=e[i],s=!0)}s&&Ao(rZ,this,i,e)}const n=!!(t.dataChanged||t.updateTriggersChanged||t.propsChanged||t.extensionsChanged);t.propsOrDataChanged=n,t.somethingChanged=n||t.viewportChanged||t.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,t){const n=SY(e,t);if(n.updateTriggersChanged)for(const i in n.updateTriggersChanged)n.updateTriggersChanged[i]&&this.invalidateAttribute(i);if(n.transitionsChanged)for(const i in n.transitionsChanged)this.internalState.uniformTransitions.add(i,t[i],e[i],e.transitions?.[i]);return this.setChangeFlags(n)}validateProps(){BY(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){const t={highlightedObjectColor:e.picked?e.color:null},{highlightColor:n}=this.props;e.picked&&typeof n=="function"&&(t.highlightColor=n(e)),this.setShaderModuleProps({picking:t}),this.setNeedsRedraw()}_getAttributeManager(){const e=this.context;return new gy(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,t){const{props:n,oldProps:i}=e,s=this.state.model;s?.isInstanced&&s.setInstanceCount(this.getNumInstances());const{autoHighlight:o,highlightedObjectIndex:c,highlightColor:f}=n;if(t||i.autoHighlight!==o||i.highlightedObjectIndex!==c||i.highlightColor!==f){const A={};Array.isArray(f)&&(A.highlightColor=f),(t||i.autoHighlight!==o||c!==i.highlightedObjectIndex)&&(A.highlightedObjectColor=Number.isFinite(c)&&c>=0?this.encodePickingColor(c):null),this.setShaderModuleProps({picking:A})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let t=!1;t=t||this.internalState.needsRedraw&&this.id;const n=this.getAttributeManager(),i=n?n.getNeedsRedraw(e):!1;if(t=t||i,t)for(const s of this.props.extensions)s.onNeedsRedraw.call(this,s);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,t}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}Es.defaultProps=lZ;Es.layerName="Layer";const uZ="compositeLayer.renderLayers";
2087class Bs extends Es{get isComposite(){return!0}get isDrawable(){return!1}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}){const{object:t}=e;return t&&t.__source&&t.__source.parent&&t.__source.parent.id===this.id&&(e.object=t.__source.object,e.index=t.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,t){return t&&t.length}getSubLayerClass(e,t){const{_subLayerProps:n}=this.props;return n&&n[e]&&n[e].type||t}getSubLayerRow(e,t,n){return e.__source={parent:this,object:t,index:n},e}getSubLayerAccessor(e){if(typeof e=="function"){const t={index:-1,data:this.props.data,target:[]};return(n,i)=>n&&n.__source?(t.index=n.__source.index,e(n.__source.object,t)):e(n,i)}return e}getSubLayerProps(e={}){const{opacity:t,pickable:n,visible:i,parameters:s,getPolygonOffset:o,highlightedObjectIndex:c,autoHighlight:f,highlightColor:A,coordinateSystem:v,coordinateOrigin:w,wrapLongitude:S,positionFormat:F,modelMatrix:N,extensions:U,fetch:$,operation:G,_subLayerProps:H}=this.props,J={id:"",updateTriggers:{},opacity:t,pickable:n,visible:i,parameters:s,getPolygonOffset:o,highlightedObjectIndex:c,autoHighlight:f,highlightColor:A,coordinateSystem:v,coordinateOrigin:w,wrapLongitude:S,positionFormat:F,modelMatrix:N,extensions:U,fetch:$,operation:G},ue=H&&e.id&&H[e.id],q=ue&&ue.updateTriggers,se=e.id||"sublayer";if(ue){const Te=this.props[Ku],Ue=e.type?e.type._propTypes:{};for(const de in ue){const me=Ue[de]||Te[de];me&&me.type==="accessor"&&(ue[de]=this.getSubLayerAccessor(ue[de]))}}Object.assign(J,e,ue),J.id=`${this.props.id}-${se}`,J.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...q};for(const Te of U){const Ue=Te.getSubLayerProps.call(this,Te);Ue&&Object.assign(J,Ue,{updateTriggers:Object.assign(J.updateTriggers,Ue.updateTriggers)})}return J}_updateAutoHighlight(e){for(const t of this.getSubLayers())t.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,t){let n=this.internalState.subLayers;const i=!n||this.needsUpdate();if(i){const s=this.renderLayers();n=py(s,Boolean),this.internalState.subLayers=n}Ao(uZ,this,i,n);for(const s of n)s.parent=this}}Bs.layerName="CompositeLayer";const Ym=Math.PI/180,k3=180/Math.PI,H0=6370972,up=256;function fZ(){const r=up/H0,e=Math.PI/180*up;return{unitsPerMeter:[r,r,r],unitsPerMeter2:[0,0,0],metersPerUnit:[1/r,1/r,1/r],unitsPerDegree:[e,e,r],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/r]}}class hZ extends ru{constructor(e={}){const{longitude:t=0,zoom:n=0,nearZMultiplier:i=.5,farZMultiplier:s=1,resolution:o=10}=e;let{latitude:c=0,height:f,altitude:A=1.5,fovy:v}=e;c=Math.max(Math.min(c,ip),-ip),f=f||1,v?A=Sw(v):v=xg(A);const w=1/Math.PI/Math.cos(c*Math.PI/180),S=Math.pow(2,n)*w,F=e.nearZ??i,N=e.farZ??(A+up*2*S/f)*s,U=new vn().lookAt({eye:[0,-A,0],up:[0,0,1]});U.rotateX(c*Ym),U.rotateZ(-t*Ym),U.scale(S/f),super({...e,height:f,viewMatrix:U,longitude:t,latitude:c,zoom:n,distanceScales:fZ(),fovy:v,focalDistance:A,near:F,far:N}),this.scale=S,this.latitude=c,this.longitude=t,this.resolution=o}get projectionMode(){return da.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){const t={targetZ:e.z||0},n=this.unproject([0,this.height/2],t),i=this.unproject([this.width/2,0],t),s=this.unproject([this.width,this.height/2],t),o=this.unproject([this.width/2,this.height],t);return s[0]<this.longitude&&(s[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],s[0],i[0],o[0]),Math.min(n[1],s[1],i[1],o[1]),Math.max(n[0],s[0],i[0],o[0]),Math.max(n[1],s[1],i[1],o[1])]}unproject(e,{topLeft:t=!0,targetZ:n}={}){const[i,s,o]=e,c=t?s:this.height-s,{pixelUnprojectionMatrix:f}=this;let A;if(Number.isFinite(o))A=mb(f,[i,c,o,1]);else{const F=mb(f,[i,c,-1,1]),N=mb(f,[i,c,1,1]),U=((n||0)/H0+1)*up,$=Zv(x4([],F,N)),G=Zv(F),H=Zv(N),ue=4*((4*G*H-($-G-H)**2)/16)/$,q=Math.sqrt(G-ue),se=Math.sqrt(Math.max(0,U*U-ue)),Te=(q-se)/Math.sqrt($);A=DH([],F,N,Te)}const[v,w,S]=this.unprojectPosition(A);return Number.isFinite(o)?[v,w,S]:Number.isFinite(n)?[v,w,n]:[v,w]}projectPosition(e){const[t,n,i=0]=e,s=t*Ym,o=n*Ym,c=Math.cos(o),f=(i/H0+1)*up;return[Math.sin(s)*c*f,-Math.cos(s)*c*f,Math.sin(o)*f]}unprojectPosition(e){const[t,n,i]=e,s=w4(e),o=Math.asin(i/s),f=Math.atan2(t,-n)*k3,A=o*k3,v=(s/up-1)*H0;return[f,A,v]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,t){const n=this.unproject(t);return{longitude:e[0]-n[0]+this.longitude,latitude:e[1]-n[1]+this.latitude}}}function mb(r,e){const t=jp([],e,r);return Cw(t,t,1/t[3]),t}class _y{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&&rs(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){const{defaultProps:t}=e.constructor,n={updateTriggers:{}};for(const i in t)if(i in this.props){const s=t[i],o=this.props[i];n[i]=o,s&&s.type==="accessor"&&(n.updateTriggers[i]=this.props.updateTriggers[i],typeof o=="function"&&(n[i]=this.getSubLayerAccessor(
2087o)))}return n}initializeState(e,t){}updateState(e,t){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,t){}finalizeState(e,t){}}_y.defaultProps={};_y.extensionName="LayerExtension";class zL{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;const{attributes:t={}}=e;this.typedArrayManager=Pp,this.attributes={},this._attributeDefs=t,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);const{data:t,buffers:n={},getGeometry:i,geometryBuffer:s,positionFormat:o,dataChanged:c,normalize:f=!0}=this.opts;if(this.data=t,this.getGeometry=i,this.positionSize=s&&s.size||(o==="XY"?2:3),this.buffers=n,this.normalize=f,s&&(qs(t.startIndices),this.getGeometry=this.getGeometryFromBuffer(s),f||(n.vertexPositions=s)),this.geometryBuffer=n.vertexPositions,Array.isArray(c))for(const A of c)this._rebuildGeometry(A);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:t}){this._rebuildGeometry({startRow:e,endRow:t})}getGeometryFromBuffer(e){const t=e.value||e;return ArrayBuffer.isView(t)?IL(t,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,t){const{attributes:n,buffers:i,_attributeDefs:s,typedArrayManager:o}=this;for(const c in s)if(c in i)o.release(n[c]),n[c]=null;else{const f=s[c];f.copy=t,n[c]=o.allocate(n[c],e,f)}}_forEachGeometry(e,t,n){const{data:i,getGeometry:s}=this,{iterable:o,objectInfo:c}=gl(i,t,n);for(const f of o){c.index++;const A=s?s(f,c):null;e(A,c.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:t,vertexStarts:n,instanceCount:i}=this;const{data:s,geometryBuffer:o}=this,{startRow:c=0,endRow:f=1/0}=e||{},A={};if(e||(t=[0],n=[0]),this.normalize||!o)this._forEachGeometry((w,S)=>{const F=w&&this.normalizeGeometry(w);A[S]=F,n[S+1]=n[S]+(F?this.getGeometrySize(F):0)},c,f),i=n[n.length-1];else if(n=s.startIndices,i=n[s.length]||0,ArrayBuffer.isView(o))i=i||o.length/this.positionSize;else if(o instanceof ji){const w=this.positionSize*4;i=i||o.byteLength/w}else if(o.buffer){const w=o.stride||this.positionSize*4;i=i||o.buffer.byteLength/w}else if(o.value){const w=o.value,S=o.stride/w.BYTES_PER_ELEMENT||this.positionSize;i=i||w.length/S}this._allocate(i,!!e),this.indexStarts=t,this.vertexStarts=n,this.instanceCount=i;const v={};this._forEachGeometry((w,S)=>{const F=A[S]||w;v.vertexStart=n[S],v.indexStart=t[S];const N=S<n.length-1?n[S+1]:i;v.geometrySize=N-n[S],v.geometryIndex=S,this.updateGeometryAttributes(F,v)},c,f),this.vertexCount=t[t.length-1]}}const dZ=typeof window<"u"?It.useLayoutEffect:It.useEffect;function I_(r,e){for(;r;){if(r===e)return!0;r=Object.getPrototypeOf(r)}return!1}const pZ={position:"absolute",zIndex:-1};function VL(r,e){if(typeof r=="function")return r(e);if(Array.isArray(r))return r.map(t=>VL(t,e));if(yy(r)){if(AZ(r))return e.style=pZ,It.cloneElement(r,e);if(gZ(r))return It.cloneElement(r,e)}return r}function yy(r){return r&&typeof r=="object"&&"type"in r||!1}function AZ(r){return r.props?.mapStyle}function gZ(r){const e=r.type;return e&&e.deckGLViewProps}function U2(r){if(typeof r=="function")return It.createElement(Rp,{},r);if(Array.isArray(r))return r.map(U2);if(yy(r)){if(r.type===It.Fragment)return U2(r.props.children);if(I_(r.type,Rp))return r}return r}function mZ({children:r,layers:e=[],views:t=null}){const n=[],i=[],s={};return It.Children.forEach(U2(r),o=>{if(yy(o)){const c=o.type;if(I_(c,Es)){const f=_Z(c,o.props);i.push(f)}else n.push(o);if(I_(c,Rp)&&c!==Rp&&o.props.id){const f=new c(o.props);s[f.id]=f}}else o&&n.push(o)}),Object.keys(s).length>0&&(Array.isArray(t)?t.forEach(o=>{s[o.id]=o}):t&&(s[t.id]=t),t=Object.values(s)),e=i.length>0?[...i,...e]:e,{layers:e,children:n,views:t}}function _Z(r,e){const t={},n=r.defaultProps||{};for(const i in e)n[i]!==e[i]&&(t[i]=e[i]);return new r(t)}const yZ=It.createContext();function vZ({children:r,deck:e,ContextProvider:t=yZ.Provider}){const{viewManager:n}=e||{};if(!n||!n.views.length)return[];const i={},s=n.views[0].id;for(const o of r){let c=s,f=o;yy(o)&&I_(o.type,Rp)&&(c=o.props.id||s,f=o.props.children);const A=n.getViewport(c),v=n.getViewState(c);if(A){v.padding=A.padding;const{x:w,y:S,width:F,height:N}=A;f=VL(f,{x:w,y:S,width:F,height:N,viewport:A,viewState:v}),i[c]||(i[c]={viewport:A,children:[]}),i[c].children.push(f)}}return Object.keys(i).map(o=>{const{viewport:c,children:f}=i[o],{x:A,y:v,width:w,height:S}=c,F={position:"absolute",left:A,top:v,width:w,height:S},N=`view-${o}`,U=It.createElement("div",{key:N,id:N,style:F},...f),$={deck:e,viewport:c,container:e.canvas.offsetParent,eventManager:e.eventManager,onViewStateChange:H=>{H.viewId=o,e._onViewStateChange(H)},widgets:[]},G=`view-${o}-context`;return It.createElement(t,{key:G,value:$},U)})}const bZ={mixBlendMode:null};function xZ({width:r,height:e,style:t}){const n={position:"absolute",zIndex:0,left:0,top:0,width:r,height:e},i={left:0,top:0};if(t)for(const s in t)s in bZ?i[s]=t[s]:n[s]=t[s];return{containerStyle:n,canvasStyle:i}}function wZ(r){return{get deck(){return r.deck},pickObject:e=>r.deck.pickObject(e),pickMultipleObjects:e=>r.deck.pickMultipleObjects(e),pickObjects:e=>r.deck.pickObjects(e)}}function HL(r){r.redrawReason&&(r.deck._drawLayers(r.redrawReason),r.redrawReason=null)}function CZ(r,e,t){const n=new e({...t,_customRender:t.deviceProps?.adapters?.[0]?.type==="webgpu"?void 0:i=>{r.redrawReason=i;const s=n.getViewports();r.lastRenderedViewports!==s?r.forceUpdate():HL(r)}});return n}function TZ(r,e){const[t,n]=It.useState(0),s=It.useRef({control:null,version:t,forceUpdate:()=>n(q=>q+1)}).current,o=It.useRef(null),c=It.useRef(null),f=It.useMemo(()=>mZ(r),[r.layers,r.views,r.children]);let A=!0;const v=q=>A&&r.viewState?(s.viewStateUpdateRequested=q,null):(s.viewStateUpdateRequested=null,r.onViewStateChange?.(q)),w=q=>{A?s.interactionStateUpdateRequested=q:(s.interactionStateUpdateRequested=null,r.onInteractionStateChange?.(q))},S=It.useMemo(()=>{const q={widgets:[],...r,style:null,width:"100%",height:"100%",parent:o.current,canvas:c.current,layers:f.layers,views:f.views,onViewStateChange:v,onInteractionStateChange:w};return delete q._customRender,s.deck&&s.deck.setProps(q),q},[r]);It.useEffect(()=>{const q=r.Deck||kw;return s.deck=CZ(s,q,{...S,parent:o.current,canvas:c.current}),()=>s.deck?.finalize()},[]),dZ(()=>{HL(s);const{viewStateUpdateRequested:q,interactionStateUpdateRequested:se}=s;q&&v(q),se&&w(se)}),It.useImperativeHandle(e,()=>wZ(s),[]);const F=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:N,width:U="100%",height:$="
2087100%",id:G,style:H}=r,{containerStyle:J,canvasStyle:ue}=It.useMemo(()=>xZ({width:U,height:$,style:H}),[U,$,H]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===F||s.version!==t){s.lastRenderedViewports=F,s.version=t;const q=vZ({children:f.children,deck:s.deck,ContextProvider:N}),se=It.createElement("canvas",{key:"canvas",id:G||"deckgl-overlay",ref:c,style:ue});s.control=It.createElement("div",{id:`${G||"deckgl"}-wrapper`,ref:o,style:J},[se,q])}return A=!1,s.control}const EZ=It.forwardRef(TZ);function N3(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const jL=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),U3=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);U3&&parseFloat(U3[1]);const z3=globalThis,G3=globalThis.process||{};function BZ(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function zw(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||BZ()}const $L="4.0.7";function SZ(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}class IZ{constructor(e,t,n="sessionStorage"){this.storage=SZ(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function MZ(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function PZ(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var M_;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(M_||(M_={}));const RZ=10;function V3(r){return typeof r!="string"?r:(r=r.toUpperCase(),M_[r]||M_.WHITE)}function FZ(r,e,t){return!zw&&typeof r=="string"&&(e&&(r=`\x1B[${V3(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${V3(t)+RZ}m${r}\x1B[49m`)),r}function DZ(r,e=["constructor"]){const t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),i=r;for(const s of n){const o=i[s];typeof o=="function"&&(e.find(c=>s===c)||(i[s]=o.bind(r)))}}function Gw(r,e){if(!r)throw new Error("Assertion failed")}function Id(){let r;if(zw()&&z3.performance)r=z3?.performance?.now?.();else if("hrtime"in G3){const e=G3?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const Md={debug:zw()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},OZ={enabled:!0,level:0};function Pd(){}const H3={},j3={once:!0};class vy{constructor({id:e}={id:""}){this.VERSION=$L,this._startTs=Id(),this._deltaTs=Id(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new IZ(`__probe-${this.id}__`,OZ),this.timeStamp(`${this.id} started`),DZ(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((Id()-this._startTs).toPrecision(10))}getDelta(){return Number((Id()-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,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Md.warn,arguments,j3)}error(e){return this._getLogFunction(0,e,Md.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,Md.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Md.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Md.debug||Md.info,arguments,j3)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||Pd,n&&[n],{tag:kZ(t)}):Pd}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Pd)}group(e,t,n={collapsed:!1}){const i=$3({logLevel:e,message:t,opts:n}
vendor: 29,041 bytes, lines 2087-2092
2087),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Pd)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=WL(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=$3({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,Gw(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=Id();const o=s.tag||s.message;if(s.once&&o)if(!H3[o])H3[o]=Id();else return Pd;return t=LZ(this.id,s.message,s),n.bind(console,t,...s.args)}return Pd}}vy.VERSION=$L;function WL(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Gw(Number.isFinite(e)&&e>=0),e}function $3(r){const{logLevel:e,message:t}=r;r.logLevel=WL(e);const n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const i=typeof r.message;return Gw(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function LZ(r,e,t){if(typeof e=="string"){const n=t.time?PZ(MZ(t.total)):"";e=t.time?`${r}: ${n}  ${e}`:`${r}: ${e}`,e=FZ(e,t.color,t.background)}return e}function kZ(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}globalThis.probe={};const JL=new vy({id:"@probe.gl/log"}),_b="4.3.3",NZ=_b[0]>="0"&&_b[0]<="9"?`v${_b}`:"";function UZ(){const r=new vy({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=r,globalThis.loaders.version=NZ,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=r,r}const zZ=UZ();function GZ(r,e){return XL(r||{},e)}function XL(r,e,t=0){if(t>3)return e;const n={...r};for(const[i,s]of Object.entries(e))s&&typeof s=="object"&&!Array.isArray(s)?n[i]=XL(n[i]||{},e[i],t+1):n[i]=e[i];return n}const VZ="latest";function HZ(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const jZ=HZ();function Qu(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const oh=typeof process!="object"||String(process)!=="[object process]"||process.browser,$Z=typeof window<"u"&&typeof window.orientation<"u",W3=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);W3&&parseFloat(W3[1]);class WZ{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){Qu(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Qu(this.isRunning),this.isRunning=!1,this._reject(e)}}class yb{terminate(){}}const vb=new Map;function JZ(r){Qu(r.source&&!r.url||!r.source&&r.url);let e=vb.get(r.source||r.url);return e||(r.url&&(e=XZ(r.url),vb.set(r.url,e)),r.source&&(e=KL(r.source),vb.set(r.source,e))),Qu(e),e}function XZ(r){if(!r.startsWith("http"))return r;const e=KZ(r);return KL(e)}function KL(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function KZ(r){return`try {
2088  importScripts('${r}');
2089} catch (error) {
2090  console.error(error);
2091  throw error;
2092}`}function qL(r,e=!0,t){const n=t||new Set;if(r){if(J3(r))n.add(r);else if(J3(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(const i in r)qL(r[i],e,n)}}return t===void 0?Array.from(n):[]}function J3(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}const bb=()=>{};class z2{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&oh||typeof yb<"u"&&!oh}constructor(e){const{name:t,source:n,url:i}=e;Qu(n||i),this.name=t,this.source=n,this.url=i,this.onMessage=bb,this.onError=s=>console.log(s),this.worker=oh?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=bb,this.onError=bb,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,t){t=t||qL(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=JZ({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},e.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},e.onmessageerror=t=>console.error(t),e}_createNodeWorker(){let e;if(this.url){const n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new yb(n,{eval:!1})}else if(this.source)e=new yb(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",t=>{this.onMessage(t)}),e.on("error",t=>{this.onError(t)}),e.on("exit",t=>{}),e}}class qZ{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return z2.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,t=(i,s,o)=>i.done(o),n=(i,s)=>i.error(s)){const i=new Promise(s=>(this.jobQueue.push({name:e,onMessage:t,onError:n,onStart:s}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const n=new WZ(t.name,e);e.onMessage=i=>t.onMessage(n,i.type,i.payload),e.onError=i=>t.onError(n,i),t.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!oh||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++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new z2({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return $Z?this.maxMobileConcurrency:this.maxConcurrency}}const YZ={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class Vu{props;workerPools=new Map;static _workerFarm;static isSupported(){return z2.isSupported()}static getWorkerFarm(e={}){return Vu._workerFarm=Vu._workerFarm||new Vu({}),Vu._workerFarm.setProps(e),Vu._workerFarm}constructor(e){this.props={...YZ},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:n,url:i}=e;let s=this.workerPools.get(t);return s||(s=new qZ({name:t,source:n,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}function ZZ(r,e={}){const t=e[r.id]||{},n=oh?`${r.id}-worker.js`:`${r.id}-worker-node.js`;let i=t.workerUrl;if(!i&&r.id==="compression"&&(i=e.workerUrl),e._workerType==="test"&&(oh?i=`modules/${r.module}/dist/${n}`:i=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!i){let s=r.version;s==="latest"&&(s=VZ);const o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return Qu(i),i}function QZ(r,e=jZ){Qu(r,"no worker provided");const t=r.version;return!(!e||!t)}function eQ(r,e){return!Vu.isSupported()||!oh&&!e?._nodeWorkers?!1:r.worker&&e?.worker}async function tQ(r,e,t,n,i){const s=r.id,o=ZZ(r,t),f=Vu.getWorkerFarm(t).getWorkerPool({name:s,url:o});t=JSON.parse(JSON.stringify(t)),n=JSON.parse(JSON.stringify(n||{}));const A=await f.startJob("process-on-worker",rQ.bind(null,i));return A.postMessage("process",{input:e,options:t,context:n}),await(await A.result).result}async function rQ(r,e,t,n){switch(t){case"done":e.done(n);break;case"error":e.error(new Error(n.error));break;case"process":const{id:i,input:s,options:o}=n;try{const c=await r(s,o);e.postMessage("done",{id:i,result:c})}catch(c){const f=c instanceof Error?c.message:"unknown error";e.postMessage("error",{id:i,error:f})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function nQ(r,e,t){if(t=t||r.byteLength,r.byteLength<t||e.byteLength<t)return!1;const n=new Uint8Array(r),i=new Uint8Array(e);for(let s=0;s<n.length;++s)if(n[s]!==i[s])return!1;return!0}function iQ(...r){return sQ(r)}function sQ(r){const e=r.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),t=e.reduce((s,o)=>s+o.byteLength,0),n=new Uint8Array(t);let i=0;for(const s of e)n.set(s,i),i+=s.byteLength;return n.buffer}async function oQ(r){const e=[];for await(const t of r)e.push(t);return iQ(...e)}function X3(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}class K3{constructor(e,t){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=t,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=X3(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(X3()-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)}}class YL{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e of Object.values(this.stats))e.reset();return this}forEach(e){for(const t of Object.values(this.stats))e(t)}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){const{name:t,type:n}=e;let i=this.stats[t];return i||(e instanceof K3?i=e:i=new K3(t,n),this.stats[t]=i),i}}let aQ="";const q3={};function cQ(r){for(const e in q3)if(r.startsWith(e)){const t=q3[e];r=r.replace(e,t)}return!r.startsWith("http://")&&!r.startsWith("https://")&&(r=`${aQ}${r}`),r}function lQ(r){return r&&typeof r=="object"&&r.isBuffer}function ZL(r){if(lQ(r))return r;if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r))return r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);if(typeof r=="string"){const e=r;return new TextEncoder().encode(e).buffer}if(r&&typeof r=="object"&&r._toArrayBuffer)return r._toArrayBuffer();throw new Error("toArrayBuffer")}function QL(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(e+1):""}function uQ(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(0,e):""}const fQ=r=>typeof r=="boolean",cg=r=>typeof r=="function",Ng=r=>r!==null&&typeof r=="object",Y3=r=>Ng(r)&&r.constructor==={}.constructor,hQ=r=>!!r&&typeof r[Symbol.iterator]=="function",dQ=r=>r&&typeof r[Symbol.asyncIterator]=="function",xh=r=>typeof Response<"u"&&r instanceof Response||r&&r.arrayBuffer&&r.text&&r.json,wh=r=>typeof Blob<"u"&&r instanceof Blob,pQ=r=>r&&typeof r=="object"&&r.isBuffer,AQ=r=>typeof ReadableStream<"u"&&r instanceof ReadableStream||Ng(r)&&cg(r.tee)&&cg(r.cancel)&&cg(r.getReader),gQ=r=>Ng(r)&&cg(r.read)&&cg(r.pipe)&&fQ(r.readable),ek=r=>AQ(r)||gQ(r);class mQ extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response}const _Q=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,yQ=/^([-\w.]+\/[-\w.+]+)/;function Z3(r,e){return r.toLowerCase()===e.toLowerCase()}function vQ(r){const e=yQ.exec(r);return e?e[1]:r}function Q3(r){const e=_Q.exec(r);return e?e[1]:""}const tk=/\?.*/;function bQ(r){const e=r.match(tk);return e&&e[0]}function Vw(r){return r.replace(tk,"")}function xQ(r){if(r.length<50)return r;const e=r.slice(r.length-15);return`${r.substr(0,32)}...${e}`}function by(r){return xh(r)?r.url:wh(r)?r.name||"":typeof r=="string"?r:""}function Hw(r){if(xh(r)){const e=r,t=e.headers.get("content-type")||"",n=Vw(e.url);return vQ(t)||Q3(n)}return wh(r)?r.type||"":typeof r=="string"?Q3(r):""}function wQ(r){return xh(r)?r.headers["content-length"]||-1:wh(r)?r.size:typeof r=="string"?r.length:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:-1}async function rk(r){if(xh(r))return r;const e={},t=wQ(r);t>=0&&(e["content-length"]=String(t));const n=by(r),i=Hw(r);i&&(e["content-type"]=i);const s=await EQ(r);s&&(e["x-first-bytes"]=s),typeof r=="string"&&(r=new TextEncoder().encode(r));const o=new Response(r,{headers:e});return Object.defineProperty(o,"url",{value:n}),o}async function CQ(r){if(!r.ok)throw await TQ(r)}async function TQ(r){const e=xQ(r.url);let t=`Failed to fetch resource (${r.status}) ${r.statusText}: ${e}`;t=t.length>100?`${t.slice(0,100)}...`:t;const n={reason:r.statusText,url:r.url,response:r};try{const i=r.headers.get("Content-Type");n.reason=!r.bodyUsed&&i?.includes("application/json")?await r.json():await r.text()}catch{}return new mQ(t,n)}async function EQ(r){if(typeof r=="string")return`data:,${r.slice(0,5)}`;if(r instanceof Blob){const t=r.slice(0,5);return await new Promise(n=>{const i=new FileReader;i.onload=s=>n(s?.target?.result),i.readAsDataURL(t)})}if(r instanceof ArrayBuffer){const t=r.slice(0,5);return`data:base64,${BQ(t)}`}return null}function BQ(r){let e="";const t=new Uint8Array(r);for(let n=0;n<t.byteLength;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function SQ(r){return!IQ(r)&&!MQ(r)}function IQ(r){return r.startsWith("http:")||r.startsWith("https:")}function MQ(r){return r.startsWith("data:")}async function eI(r,e){if(typeof r=="string"){const t=cQ(r);return SQ(t)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(t,e):await fetch(t,e)}return await rk(r)}const tI=new vy({id:"loaders.gl"});class PQ{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}class RQ{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)}}const nk={fetch:null,mimeType:void 0,nothrow:!1,log:new RQ,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:jL,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},FQ={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 ik(){globalThis.loaders=globalThis.loaders||{};const{loaders:r}=globalThis;return r._state||(r._state={}),r._state}function sk(){const r=ik();return r.globalOptions=r.globalOptions||{...nk},r.globalOptions}function DQ(r,e,t,n){return t=t||[],t=Array.isArray(t)?t:[t],OQ(r,t),kQ(e,r,n)}function OQ(r,e){rI(r,null,nk,FQ,e);for(const t of e){const n=r&&r[t.id]||{},i=t.options&&t.options[t.id]||{},s=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};rI(n,t.id,i,s,e)}}function rI(r,e,t,n,i){const s=e||"Top level",o=e?`${e}.`:"";for(const c in r){const f=!e&&Ng(r[c]),A=c==="baseUri"&&!e,v=c==="workerUrl"&&e;if(!(c in t)&&!A&&!v){if(c in n)tI.warn(`${s} loader option '${o}${c}' no longer supported, use '${n[c]}'`)();else if(!f){const w=LQ(c,i);tI.warn(`${s} loader option '${o}${c}' not recognized. ${w}`)()}}}}function LQ(r,e){const t=r.toLowerCase();let n="";for(const i of e)for(const s in i.options){if(r===s)return`Did you mean '${i.id}.${s}'?`;const o=s.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(n=n||`Did you mean '${i.id}.${s}'?`)}return n}function kQ(r,e,t){const i={...r.options||{}};return NQ(i,t),i.log===null&&(i.log=new PQ),nI(i,sk()),nI(i,e),i}function nI(r,e){for(const t in e)if(t in e){const n=e[t];Y3(n)&&Y3(r[t])?r[t]={...r[t],...e[t]}:r[t]=e[t]}}function NQ(r,e){e&&!("baseUri"in r)&&(r.baseUri=e)}function jw(r){return r?(Array.isArray(r)&&(r=r[0]),Array.isArray(r?.extensions)):!1}function $w(r){N3(r,"null loader"),N3(jw(r),"invalid loader");let e;return Array.isArray(r)&&(e=r[1],r=r[0],r={...r,options:{...r.options,...e}}),(r?.parseTextSync||r?.parseText)&&(r.text=!0),r.text||(r.binary=!0),r}const ok=()=>{const r=ik();return r.loaderRegistry=r.loaderRegistry||[],r.loaderRegistry};function Ug(r){const e=ok();r=Array.isArray(r)?r:[r];for(const t of r){const n=$w(t);e.find(i=>n===i)||e.unshift(n)}}function UQ(){return ok()}const zQ=/\.([^.]+)$/;async function GQ(r,e=[],t,n){if(!ak(r))return null;let i=iI(r,e,{...t,nothrow:!0},n);if(i)return i;if(wh(r)&&(r=await r.slice(0,10).arrayBuffer(),i=iI(r,e,t,n)),!i&&!t?.nothrow)throw new Error(ck(r));return i}function iI(r,e=[],t,n){if(!ak(r))return null;if(e&&!Array.isArray(e))return $w(e);let i=[];e&&(i=i.concat(e)),t?.ignoreRegisteredLoaders||i.push(...UQ()),HQ(i);const s=VQ(r,i,t,n);if(!s&&!t?.nothrow)throw new Error(ck(r));return s}function VQ(r,e,t,n){const i=by(r),s=Hw(r),o=Vw(i)||n?.url;let c=null,f="";return t?.mimeType&&(c=xb(e,t?.mimeType),f=`match forced by supplied MIME type ${t?.mimeType}`),c=c||jQ(e,o),f=f||(c?`matched url ${o}`:""),c=c||xb(e,s),f=f||(c?`matched MIME type ${s}`:""),c=c||WQ(e,r),f=f||(c?`matched initial data ${lk(r)}`:""),t?.fallbackMimeType&&(c=c||xb(e,t?.fallbackMimeType),f=f||(c?`matched fallback MIME type ${s}`:"")),f&&zZ.log(1,`selectLoader selected ${c?.name}: ${f}.`),c}function ak(r){return!(r instanceof Response&&r.status===204)}function ck(r){const e=by(r),t=Hw(r);let n="No valid loader found (";n+=e?`${QL(e)}, `:"no url provided, ",n+=`MIME type: ${t?`"${t}"`:"not provided"}, `;const i=r?lk(r):"";return n+=i?` first bytes: "${i}"`:"first bytes: not available",n+=")",n}function HQ(r){for(const e of r)$w(e)}function jQ(r,e){const t=e&&zQ.exec(e),n=t&&t[1];return n?$Q(r,n):null}function $Q(r,e){e=e.toLowerCase();for(const t of r)for(const n of t.extensions)if(n.toLowerCase()===e)return t;return null}function xb(r,e){for(const t of r)if(t.mimeTypes?.some(n=>Z3(e,n))||Z3(e,`application/x.${t.id}`))return t;return null}function WQ(r,e){if(!e)return null;for(const t of r)if(typeof e=="string"){if(JQ(e,t))return t}else if(ArrayBuffer.isView(e)){if(sI(e.buffer,e.byteOffset,t))return t}else if(e instanceof ArrayBuffer&&sI(e,0,t))return t;return null}function JQ(r,e){return e.testText?e.testText(r):(Array.isArray(e.tests)?e.tests:[e.tests]).some(n=>r.startsWith(n))}function sI(r,e,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>XQ(r,e,t,i))}function XQ(r,e,t,n){if(n instanceof ArrayBuffer)return nQ(n,r,n.byteLength);switch(typeof n){case"function":return n(r);case"string":const i=G2(r,e,n.length);return n===i;default:return!1}}function lk(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?G2(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?G2(r,0,e):""}function G2(r,e,t){if(r.byteLength<e+t)return"";const n=new DataView(r);let i="";for(let s=0;s<t;s++)i+=String.fromCharCode(n.getUint8(e+s));return i}const KQ=256*1024;function*qQ(r,e){const t=e?.chunkSize||KQ;let n=0;const i=new TextEncoder;for(;n<r.length;){const s=Math.min(r.length-n,t),o=r.slice(n,n+s);n+=s,yield i.encode(o)}}const YQ=256*1024;function*ZQ(r,e={}){const{chunkSize:t=YQ}=e;let n=0;for(;n<r.byteLength;){const i=Math.min(r.byteLength-n,t),s=new ArrayBuffer(i),o=new Uint8Array(r,n,i);new Uint8Array(s).set(o),n+=i,yield s}}const QQ=1024*1024;async function*eee(r,e){const t=e?.chunkSize||QQ;let n=0;for(;n<r.size;){const i=n+t,s=await r.slice(n,i).arrayBuffer();n=i,yield s}}function oI(r,e){return jL?tee(r,e):ree(r)}async function*tee(r,e){const t=r.getReader();let n;try{for(;;){const i=n||t.read();e?._streamReadAhead&&(n=t.read());const{done:s,value:o}=await i;if(s)return;yield ZL(o)}}catch{t.releaseLock()}}async function*ree(r,e){for await(const t of r)yield ZL(t)}function nee(r,e){if(typeof r=="string")return qQ(r,e);if(r instanceof ArrayBuffer)return ZQ(r,e);if(wh(r))return eee(r,e);if(ek(r))return oI(r,e);if(xh(r))return oI(r.body,e);throw new Error("makeIterator")}const uk="Cannot convert supplied data type";function iee(r,e,t){if(e.text&&typeof r=="string")return r;if(pQ(r)&&(r=r.buffer),r instanceof ArrayBuffer){const n=r;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(r)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(r);let n=r.buffer;const i=r.byteLength||r.length;return(r.byteOffset!==0||i!==n.byteLength)&&(n=n.slice(r.byteOffset,r.byteOffset+i)),n}throw new Error(uk)}async function see(r,e,t){const n=r instanceof ArrayBuffer||ArrayBuffer.isView(r);if(typeof r=="string"||n)return iee(r,e);if(wh(r)&&(r=await rk(r)),xh(r)){const i=r;return await CQ(i),e.binary?await i.arrayBuffer():await i.text()}if(ek(r)&&(r=nee(r,t)),hQ(r)||dQ(r))return oQ(r);throw new Error(uk)}function fk(r,e){const t=sk(),n=r||t;return typeof n.fetch=="function"?n.fetch:Ng(n.fetch)?i=>eI(i,n.fetch):e?.fetch?e?.fetch:eI}function oee(r,e,t){if(t)return t;const n={fetch:fk(e,r),...r};if(n.url){const i=Vw(n.url);n.baseUrl=i,n.queryString=bQ(n.url),n.filename=QL(i),n.baseUrl=uQ(i)}return Array.isArray(n.loaders)||(n.loaders=null),n}function aee(r,e){if(r&&!Array.isArray(r))return r;let t;if(r&&(t=Array.isArray(r)?r:[r]),e&&e.loaders){const n=Array.isArray(e.loaders)?e.loaders:[e.loaders];t=t?[...t,...n]:n}return t&&t.length?t:void 0}async function P_(r,e,t,n){e&&!Array.isArray(e)&&!jw(e)&&(n=void 0,t=e,e=void 0),r=await r,t=t||{};const i=by(r),o=aee(e,n),c=await GQ(r,o,t);return c?(t=DQ(t,c,o,i),n=oee({url:i,_parse:P_,loaders:o},t,n||null),await cee(c,r,t,n)):null}async function cee(r,e,t,n){if(QZ(r),t=GZ(r.options,t),xh(e)){const s=e,{ok:o,redirected:c,status:f,statusText:A,type:v,url:w}=s,S=Object.fromEntries(s.headers.entries());n.response={headers:S,ok:o,redirected:c,status:f,statusText:A,type:v,url:w}}e=await see(e,r,t);const i=r;if(i.parseTextSync&&typeof e=="string")return i.parseTextSync(e,t,n);if(eQ(r,t))return await tQ(r,e,t,n,P_);if(i.parseText&&typeof e=="string")return await i.parseText(e,t,n);if(i.parse)return await i.parse(e,t,n);throw Qu(!i.parseSync),new Error(`${r.id} loader - no parser found and worker is disabled`)}async function Wp(r,e,t,n){let i,s;!Array.isArray(e)&&!jw(e)?(i=[],s=e):(i=e,s=t);const o=fk(s);let c=r;return typeof r=="string"&&(c=await o(r)),wh(r)&&(c=await o(r)),Array.isArray(i)?await P_(c,i,s):await P_(c,i,s)}const aI=100;class lee{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(e,t){if(this.options=t,this.schema=e,!Array.isArray(e)){this._headers=[];for(const n in e)this._headers[e[n].index]=e[n].name}}rowCount(){return this.length}addArrayRow(e,t){Number.isFinite(t)&&(this.cursor=t),this.shape="array-row-table",this.rows=this.rows||new Array(aI),this.rows[this.length]=e,this.length++}addObjectRow(e,t){Number.isFinite(t)&&(this.cursor=t),this.shape="object-row-table",this.rows=this.rows||new Array(aI),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 hk(r,e){if(!r)throw new Error("null row");const t={};if(e)for(let n=0;n<e.length;n++)t[e[n]]=r[n];else for(let n=0;n<r.length;n++){const i=`column-${n}`;t[i]=r[n]}return t}function dk(r,e){if(!r)throw new Error("null row");if(e){const t=new Array(e.length);for(let n=0;n<e.length;n++)t[n]=r[e[n]];return t}return Object.values(r)}function uee(r){const e=[];for(let t=0;t<r.length;t++){const n=`column-${t}`;e.push(n)}return e}function fee(r){return Object.keys(r)}const cI=100;class hee{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(e,t){if(this.options=t,this.schema=e,e){this._headers=[];for(const n in e)this._headers[e[n].index]=e[n].name}}rowCount(){return this.length}addArrayRow(e,t){switch(Number.isFinite(t)&&(this.cursor=t),this._headers||=uee(e),this.options.shape){case"object-row-table":const n=hk(e,this._headers);this.addObjectRow(n,t);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(cI),this.arrayRows[this.length]=e,this.length++;break}}addObjectRow(e,t){switch(Number.isFinite(t)&&(this.cursor=t),this._headers||=fee(e),this.options.shape){case"array-row-table":const n=dk(e,this._headers);this.addArrayRow(n,t);break;case"object-row-table":this.objectRows=this.objectRows||new Array(cI),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}}const dee=100;class pee{schema;length=0;allocated=0;columns={};constructor(e,t){this.schema=e,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(e){this._reallocateColumns();let t=0;for(const n in this.columns)this.columns[n][this.length]=e[t++];this.length++}addObjectRow(e){this._reallocateColumns();for(const t in e)this.columns[t][this.length]=e[t];this.length++}getBatch(){this._pruneColumns();const e=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(const n in this.schema){const i=this.schema[n];e[i.name]=this.columns[i.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:dee,this.columns={};for(const e in this.schema){const t=this.schema[e],n=t.type||Float32Array,i=this.columns[t.index];if(i&&ArrayBuffer.isView(i)){const s=new n(this.allocated);s.set(i),this.columns[t.index]=s}else i?(i.length=this.allocated,this.columns[t.index]=i):this.columns[t.index]=new n(this.allocated)}}}_pruneColumns(){for(const[e,t]of Object.entries(this.columns))this.columns[e]=t.slice(0,this.length)}}const Aee={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0
2092},gee="TableBatchBuilder";class R_{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;static ArrowBatch;constructor(e,t){this.schema=e,this.options={...Aee,...t}}limitReached(){return!!(this.options?.limit&&this.totalLength>=this.options.limit||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){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(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);const t=this.aggregator.getBatch();return t.count=this.batchCount,t.bytesUsed=this.bytesUsed,Object.assign(t,e),this.batchCount++,this.aggregator=null,t}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return hee;case"columnar-table":return pee;case"arrow-table":if(!R_.ArrowBatch)throw new Error(gee);return R_.ArrowBatch;default:return lee}}}class lI extends Array{enqueue(e){return this.push(e)}dequeue(){return this.shift()}}class mee{_values;_settlers;_closed;constructor(){this._values=new lI,this._settlers=new lI,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");const t=this._settlers.dequeue();e instanceof Error?t.reject(e):t.resolve({value:e})}else this._values.enqueue(e)}next(){if(this._values.length>0){const 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,t)=>{this._settlers.enqueue({resolve:e,reject:t})})}}const uI="\uFEFF";function _ee(r,e={},t=vee){e=e||{};var n=e.dynamicTyping||!1;vc(n)&&(e.dynamicTypingFunction=n,n={}),e.dynamicTyping=n,e.transform=vc(e.transform)?e.transform:!1;var i=new t(e);return i.stream(r)}function yee(r,e){var t=!1,n=!0,i=",",s=`\r
2093`,o='"',c=o+o,f=!1,A=null;w();var v=new RegExp(Cg(o),"g");if(typeof r=="string"&&(r=JSON.parse(r)),Array.isArray(r)){if(!r.length||Array.isArray(r[0]))return S(null,r,f);if(typeof r[0]=="object")return S(A||Object.keys(r[0]),r,f)}else if(typeof r=="object")return typeof r.data=="string"&&(r.data=JSON.parse(r.data)),Array.isArray(r.data)&&(r.fields||(r.fields=r.meta&&r.meta.fields),r.fields||(r.fields=Array.isArray(r.data[0])?r.fields:Object.keys(r.data[0])),!Array.isArray(r.data[0])&&typeof r.data[0]!="object"&&(r.data=[r.data])),S(r.fields||[],r.data||[],f);throw new Error("Unable to serialize unrecognized input");function w(){if(typeof e=="object"){if(typeof e.delimiter=="string"&&!ka.BAD_DELIMITERS.filter(function(U){return e.delimiter.indexOf(U)!==-1}).length&&(i=e.delimiter),(typeof e.quotes=="boolean"||Array.isArray(e.quotes))&&(t=e.quotes),(typeof e.skipEmptyLines=="boolean"||typeof e.skipEmptyLines=="string")&&(f=e.skipEmptyLines),typeof e.newline=="string"&&(s=e.newline),typeof e.quoteChar=="string"&&(o=e.quoteChar),typeof e.header=="boolean"&&(n=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");A=e.columns}e.escapeChar!==void 0&&(c=e.escapeChar+o)}}function S(U,$,G){var H="";typeof U=="string"&&(U=JSON.parse(U)),typeof $=="string"&&($=JSON.parse($));var J=Array.isArray(U)&&U.length>0,ue=!Array.isArray($[0]);if(J&&n){for(var q=0;q<U.length;q++)q>0&&(H+=i),H+=F(U[q],q);$.length>0&&(H+=s)}for(var se=0;se<$.length;se++){var Te=J?U.length:$[se].length,Ue=!1,de=J?Object.keys($[se]).length===0:$[se].length===0;if(G&&!J&&(Ue=G==="greedy"?$[se].join("").trim()==="":$[se].length===1&&$[se][0].length===0),G==="greedy"&&J){for(var me=[],pe=0;pe<Te;pe++){var W=ue?U[pe]:pe;me.push($[se][W])}Ue=me.join("").trim()===""}if(!Ue){for(var re=0;re<Te;re++){re>0&&!de&&(H+=i);var Ee=J&&ue?U[re]:re;H+=F($[se][Ee],re)}se<$.length-1&&(!G||Te>0&&!de)&&(H+=s)}}return H}function F(U,$){if(typeof U>"u"||U===null)return"";if(U.constructor===Date)return JSON.stringify(U).slice(1,25);U=U.toString().replace(v,c);var G=typeof t=="boolean"&&t||Array.isArray(t)&&t[$]||N(U,ka.BAD_DELIMITERS)||U.indexOf(i)>-1||U.charAt(0)===" "||U.charAt(U.length-1)===" ";return G?o+U+o:U}function N(U,$){for(var G=0;G<$.length;G++)if(U.indexOf($[G])>-1)return!0;return!1}}let pk=class{_handle;_config;_finished=!1;_completed=!1;_input=null;_baseIndex=0;_partialLine="";_rowCount=0;_start=0;
2093isFirstChunk=!0;_completeResults={data:[],errors:[],meta:{}};constructor(e){var t={...e};t.chunkSize=parseInt(t.chunkSize),!e.step&&!e.chunk&&(t.chunkSize=null),this._handle=new Ak(t),this._handle.streamer=this,this._config=t}parseChunk(e,t){if(this.isFirstChunk&&vc(this._config.beforeFirstChunk)){var n=this._config.beforeFirstChunk(e);n!==void 0&&(e=n)}this.isFirstChunk=!1;var i=this._partialLine+e;this._partialLine="";var s=this._handle.parse(i,this._baseIndex,!this._finished);if(!(this._handle.paused()||this._handle.aborted())){var o=s.meta.cursor;this._finished||(this._partialLine=i.substring(o-this._baseIndex),this._baseIndex=o),s&&s.data&&(this._rowCount+=s.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(vc(this._config.chunk)&&!t){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&&c&&vc(this._config.complete)&&(!s||!s.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),s}}_sendError(e){vc(this._config.error)&&this._config.error(e)}};class vee extends pk{remaining;constructor(e={}){super(e)}stream(e){return this.remaining=e,this._nextChunk()}_nextChunk(){if(!this._finished){var e=this._config.chunkSize,t=e?this.remaining.substr(0,e):this.remaining;return this.remaining=e?this.remaining.substr(e):"",this._finished=!this.remaining,this.parseChunk(t)}}}const bee=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,xee=/(\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))/;class Ak{_config;_stepCounter=0;_rowCounter=0;_input;_parser;_paused=!1;_aborted=!1;_delimiterError=!1;_fields=[];_results={data:[],errors:[],meta:{}};constructor(e){if(vc(e.step)){var t=e.step;e.step=n=>{if(this._results=n,this.needsHeaderRow())this.processResults();else{if(this.processResults(),!this._results.data||this._results.data.length===0)return;this._stepCounter+=n.data.length,e.preview&&this._stepCounter>e.preview?this._parser.abort():t(this._results,this)}}}this._config=e}parse(e,t,n){var i=this._config.quoteChar||'"';if(this._config.newline||(this._config.newline=wee(e,i)),this._delimiterError=!1,this._config.delimiter)vc(this._config.delimiter)&&(this._config.delimiter=this._config.delimiter(e),this._results.meta.delimiter=this._config.delimiter);else{var s=this.guessDelimiter(e,this._config.newline,this._config.skipEmptyLines,this._config.comments,this._config.delimitersToGuess);s.successful?this._config.delimiter=s.bestDelimiter:(this._delimiterError=!0,this._config.delimiter=ka.DefaultDelimiter),this._results.meta.delimiter=this._config.delimiter}var o=gk(this._config);return this._config.preview&&this._config.header&&o.preview++,this._input=e,this._parser=new V2(o),this._results=this._parser.parse(this._input,t,n),this.processResults(),this._paused?{meta:{paused:!0}}:this._results||{meta:{paused:!1}}}paused(){return this._paused}pause(){this._paused=!0,this._parser.abort(),this._input=this._input.substr(this._parser.getCharIndex())}resume(){this._paused=!1,this.streamer.parseChunk(this._input,!0)}aborted(){return this._aborted}abort(){this._aborted=!0,this._parser.abort(),this._results.meta.aborted=!0,vc(this._config.complete)&&this._config.complete(this._results),this._input=""}testEmptyLine(e){return this._config.skipEmptyLines==="greedy"?e.join("").trim()==="":e.length===1&&e[0].length===0}processResults(){if(this._results&&this._delimiterError&&(this.addError("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+ka.DefaultDelimiter+"'"),this._delimiterError=!1),this._config.skipEmptyLines)for(var e=0;e<this._results.data.length;e++)this.testEmptyLine(this._results.data[e])&&this._results.data.splice(e--,1);return this.needsHeaderRow()&&this.fillHeaderFields(),this.applyHeaderAndDynamicTypingAndTransformation()}needsHeaderRow(){return this._config.header&&this._fields.length===0}fillHeaderFields(){if(!this._results)return;const e=n=>{vc(this._config.transformHeader)&&(n=this._config.transformHeader(n)),this._fields.push(n)};if(Array.isArray(this._results.data[0])){for(var t=0;this.needsHeaderRow()&&t<this._results.data.length;t++)this._results.data[t].forEach(e);this._results.data.splice(0,1)}else this._results.data.forEach(e)}shouldApplyDynamicTyping(e){return this._config.dynamicTypingFunction&&this._config.dynamicTyping[e]===void 0&&(this._config.dynamicTyping[e]=this._config.dynamicTypingFunction(e)),(this._config.dynamicTyping[e]||this._config.dynamicTyping)===!0}parseDynamic(e,t){return this.shouldApplyDynamicTyping(e)?t==="true"||t==="TRUE"?!0:t==="false"||t==="FALSE"?!1:bee.test(t)?parseFloat(t):xee.test(t)?new Date(t):t===""?null:t:t}applyHeaderAndDynamicTypingAndTransformation(){if(!this._results||!this._results.data||!this._config.header&&!this._config.dynamicTyping&&!this._config.transform)return this._results;var e=1;return!this._results.data[0]||Array.isArray(this._results.data[0])?(this._results.data=this._results.data.map(this.processRow.bind(this)),e=this._results.data.length):this._results.data=this.processRow(this._results.data,0),this._config.header&&this._results.meta&&(this._results.meta.fields=this._fields),this._rowCounter+=e,this._results}processRow(e,t){var n=this._config.header?{}:[],i;for(i=0;i<e.length;i++){var s=i,o=e[i];this._config.header&&(s=i>=this._fields.length?"__parsed_extra":this._fields[i]),this._config.transform&&(o=this._config.transform(o,s)),o=this.parseDynamic(s,o),s==="__parsed_extra"?(n[s]=n[s]||[],n[s].push(o)):n[s]=o}return this._config.header&&(i>this._fields.length?this.addError("FieldMismatch","TooManyFields","Too many fields: expected "+this._fields.length+" fields but parsed "+i,this._rowCounter+t):i<this._fields.length&&this.addError("FieldMismatch","TooFewFields","Too few fields: expected "+this._fields.length+" fields but parsed "+i,this._rowCounter+t)),n}guessDelimiter(e,t,n,i,s){var o,c,f;s=s||[",","	","|",";",ka.RECORD_SEP,ka.UNIT_SEP];for(var A=0;A<s.length;A++){var v=s[A],w=0,S=0,F=0;f=void 0;for(var N=new V2({comments:i,delimiter:v,newline:t,preview:10}).parse(e),U=0;U<N.data.length;U++){if(n&&this.testEmptyLine(N.data[U])){F++;continue}var $=N.data[U].length;if(S+=$,typeof f>"u"){f=0;continue}else $>1&&(w+=Math.abs($-f),f=$)}N.data.length>0&&(S/=N.data.length-F),(typeof c>"u"||w>c)&&S>1.99&&(c=w,o=v)}return this._config.delimiter=o,{successful:!!o,bestDelimiter:o}}addError(e,t,n,i){this._results.errors.push({type:e,code:t,message:n,row:i})}}function wee(r,e){r=r.substr(0,1024*1024);var t=new RegExp(Cg(e)+"([^]*?)"+Cg(e),"gm");r=r.replace(t,"");var n=r.split("\r"),i=r.split(`
2094`),s=i.length>1&&i[0].length<n[0].length;if(n.length===1||s)return`
2095`;for(var o=0,c=0;c<n.length;c++)n[c][0]===`
2096`&&o++;return o>=n.length/2?`\r
2097`:"\r"}function Cg(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function V2(r){r=r||{};var e=r.delimiter,t=r.newline,n=r.comments,i=r.step,s=r.preview,o=r.fastMode,c;r.quoteChar===void 0?c='"':c=r.quoteChar;var f=c;if(r.escapeChar!==void 0&&(f=r.escapeChar),(typeof e!="string"||ka.BAD_DELIMITERS.indexOf(e)>-1)&&(e=","),n===e)throw new Error("Comment character same as delimiter");
2097n===!0?n="#":(typeof n!="string"||ka.BAD_DELIMITERS.indexOf(n)>-1)&&(n=!1),t!==`
2098`&&t!=="\r"&&t!==`\r
2099`&&(t=`
2100`);var A=0,v=!1;this.parse=function(w,S,F){if(typeof w!="string")throw new Error("Input must be a string");var N=w.length,U=e.length,$=t.length,G=n.length,H=vc(i);A=0;var J=[],ue=[],q=[],se=0;if(!w)return rt();if(o||o!==!1&&w.indexOf(c)===-1){for(var Te=w.split(t),Ue=0;Ue<Te.length;Ue++){const vt=Te[Ue];if(A+=vt.length,Ue!==Te.length-1)A+=t.length;else if(F)return rt();if(!(n&&vt.substr(0,G)===n)){if(H){if(J=[],Le(vt.split(e)),ut(),v)return rt()}else Le(vt.split(e));if(s&&Ue>=s)return J=J.slice(0,s),rt(!0)}}return rt()}for(var de=w.indexOf(e,A),me=w.indexOf(t,A),pe=new RegExp(Cg(f)+Cg(c),"g"),W;;){if(w[A]===c){for(W=A,A++;;){if(W=w.indexOf(c,W+1),W===-1)return F||ue.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:J.length,index:A}),Ze();if(W===N-1){var re=w.substring(A,W).replace(pe,c);return Ze(re)}if(c===f&&w[W+1]===f){W++;continue}if(!(c!==f&&W!==0&&w[W-1]===f)){var Ee=me===-1?de:Math.min(de,me),et=Ge(Ee);if(w[W+1+et]===e){if(q.push(w.substring(A,W).replace(pe,c)),A=W+1+et+U,de=w.indexOf(e,A),me=w.indexOf(t,A),H&&(ut(),v))return rt();if(s&&J.length>=s)return rt(!0);break}var _e=Ge(me);if(w.substr(W+1+_e,$)===t){if(q.push(w.substring(A,W).replace(pe,c)),tt(W+1+_e+$),de=w.indexOf(e,A),H&&(ut(),v))return rt();if(s&&J.length>=s)return rt(!0);break}ue.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:J.length,index:A}),W++}}if(H&&(ut(),v))return rt();if(s&&J.length>=s)return rt(!0);continue}if(n&&q.length===0&&w.substr(A,G)===n){if(me===-1)return rt();A=me+$,me=w.indexOf(t,A),de=w.indexOf(e,A);continue}if(de!==-1&&(de<me||me===-1)){q.push(w.substring(A,de)),A=de+U,de=w.indexOf(e,A);continue}if(me!==-1){if(q.push(w.substring(A,me)),tt(me+$),H&&(ut(),v))return rt();if(s&&J.length>=s)return rt(!0);continue}break}return Ze();function Le(vt){J.push(vt),se=A}function Ge(vt){var St=0;if(vt!==-1){var st=w.substring(W+1,vt);st&&st.trim()===""&&(St=st.length)}return St}function Ze(vt){return F||(typeof vt>"u"&&(vt=w.substr(A)),q.push(vt),A=N,Le(q),H&&ut()),rt()}function tt(vt){A=vt,Le(q),q=[],me=w.indexOf(t,A)}function rt(vt,St){var st=St||!1;return{data:st?J[0]:J,errors:ue,meta:{delimiter:e,linebreak:t,aborted:v,truncated:!!vt,cursor:se+(S||0)}}}function ut(){i(rt(void 0,!0)),J=[],ue=[]}},this.abort=function(){v=!0},this.getCharIndex=function(){return A}}function gk(r){if(typeof r!="object"||r===null)return r;var e=Array.isArray(r)?[]:{};for(var t in r)e[t]=gk(r[t]);return e}function vc(r){return typeof r=="function"}const ka={parse:_ee,unparse:yee,RECORD_SEP:"�",UNIT_SEP:"�",BYTE_ORDER_MARK:uI,BAD_DELIMITERS:["\r",`
2101`,'"',uI],WORKERS_SUPPORTED:!1,NODE_STREAM_INPUT:1,LocalChunkSize:1024*1024*10,RemoteChunkSize:1024*1024*5,DefaultDelimiter:",",Parser:V2,ParserHandle:Ak,ChunkStreamer:pk},{ChunkStreamer:Cee}=ka;class Tee extends Cee{textDecoder=new TextDecoder(this._config.encoding);constructor(e={}){super(e)}async stream(e){this._input=e;try{for await(const t of e)this.parseChunk(this.getStringChunk(t));this._finished=!0,this.parseChunk("")}catch(t){this._sendError(t)}}_nextChunk(){}getStringChunk(e){return typeof e=="string"?e:this.textDecoder.decode(e,{stream:!0})}}const Eee="4.3.3",Ww="object-row-table",Jw={dataType:null,batchType:null,id:"csv",module:"csv",name:"CSV",version:Eee,extensions:["csv","tsv","dsv"],mimeTypes:["text/csv","text/tab-separated-values","text/dsv"],category:"table",parse:async(r,e)=>fI(new TextDecoder().decode(r),e),parseText:(r,e)=>fI(r,e),parseInBatches:Bee,options:{csv:{shape:Ww,optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[",","	","|",";"]}}};async function fI(r,e){const t={...Jw.options.csv,...e?.csv},n=See(r),s=t.header==="auto"?mk(n):!!t.header,o={...t,header:s,download:!1,transformHeader:s?_k():void 0,error:w=>{throw new Error(w)}},c=ka.parse(r,o),f=c.data,A=c.meta.fields||yk(t.columnPrefix,n.length),v=t.shape||Ww;switch(v){case"object-row-table":return{shape:"object-row-table",data:f.map(w=>Array.isArray(w)?hk(w,A):w)};case"array-row-table":return{shape:"array-row-table",data:f.map(w=>Array.isArray(w)?w:dk(w,A))};default:throw new Error(v)}}function Bee(r,e){e={...e},e.batchSize==="auto"&&(e.batchSize=4e3);const t={...Jw.options.csv,...e?.csv},n=new mee;let i=!0,s=null,o=null,c=null;const f={...t,header:!1,download:!1,chunkSize:1024*1024*5,skipEmptyLines:!1,step(A){let v=A.data;if(t.skipEmptyLines&&v.flat().join("").trim()==="")return;const w=A.meta.cursor;if(i&&!s&&(t.header==="auto"?mk(v):!!t.header)){s=v.map(_k());return}i&&(i=!1,s||(s=yk(t.columnPrefix,v.length)),c=Iee(v,s)),t.optimizeMemoryUsage&&(v=JSON.parse(JSON.stringify(v)));const S=t.shape||Ww;o=o||new R_(c,{shape:S,...e});try{o.addRow(v);const F=o&&o.getFullBatch({bytesUsed:w});F&&n.enqueue(F)}
2101catch(F){n.enqueue(F)}},complete(A){try{const v=A.meta.cursor,w=o&&o.getFinalBatch({bytesUsed:v});w&&n.enqueue(w)}catch(v){n.enqueue(v)}n.close()}};return ka.parse(r,f,Tee),n}function mk(r){return r&&r.every(e=>typeof e=="string")}function See(r){return ka.parse(r,{dynamicTyping:!0,preview:1}).data[0]}function _k(){const r=new Set;return e=>{let t=e,n=1;for(;r.has(t);)t=`${e}.${n}`,n++;return r.add(t),t}}function yk(r,e=0){const t=[];for(let n=0;n<e;n++)t.push(`${r}${n+1}`);return t}function Iee(r,e){const t=e?{}:[];for(let n=0;n<r.length;n++){const i=e&&e[n]||n;switch(typeof r[n]){case"number":case"boolean":t[i]={name:String(i),index:n,type:Float32Array};break;case"string":default:t[i]={name:String(i),index:n,type:Array}}}return t}const Mee="4.3.3";async function vk(r,e,t,n){return n._parse(r,e,t,n)}function dh(r,e){if(!r)throw new Error("loader assertion failed.")}const bk=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),hI=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);hI&&parseFloat(hI[1]);function Pee(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function Ree(r){return globalThis.loaders?.modules?.[r]||null}function Fee(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const Dee=Fee();function Oee(r,e){if(!r)throw new Error("loaders.gl assertion failed.")}const zg=typeof process!="object"||String(process)!=="[object process]"||process.browser,Xw=typeof importScripts=="function",dI=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);dI&&parseFloat(dI[1]);const wb={};async function ah(r,e=null,t={},n=null){return e&&(r=Lee(r,e,t,n)),wb[r]=wb[r]||kee(r),await wb[r]}function Lee(r,e,t={},n=null){if(!t.useLocalLibraries&&r.startsWith("http"))return r;n=n||r;const i=t.modules||{};return i[n]?i[n]:zg?t.CDN?(Oee(t.CDN.startsWith("http")),`${t.CDN}/${e}@${Dee}/dist/libs/${n}`):Xw?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function kee(r){if(r.endsWith("wasm"))return await Uee(r);if(!zg)try{const{requireFromFile:t}=globalThis.loaders||{};return await t?.(r)}catch(t){return console.error(t),null}if(Xw)return importScripts(r);const e=await zee(r);return Nee(e,r)}function Nee(r,e){if(!zg){const{requireFromString:n}=globalThis.loaders||{};return n?.(r,e)}if(Xw)return eval.call(globalThis,r),null;const t=document.createElement("script");t.id=e;try{t.appendChild(document.createTextNode(r))}catch{t.text=r}return document.body.appendChild(t),null}async function Uee(r){const{readFileAsArrayBuffer:e}=globalThis.loaders||{};return zg||!e||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await e(r)}async function zee(r){const{readFileAsText:e}=globalThis.loaders||{};return zg||!e||r.startsWith("http")?await(await fetch(r)).text():await e(r)}function Gee(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?pI(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?pI(r,0,e):""}function pI(r,e,t){if(r.byteLength<=e+t)return"";const n=new DataView(r);let i="";for(let s=0;s<t;s++)i+=String.fromCharCode(n.getUint8(e+s));return i}function Vee(r){try{return JSON.parse(r)}catch{throw new Error(`Failed to parse JSON from data starting with "${Gee(r)}"`)}}function xk(r,e,t){const n=t!==void 0?new Uint8Array(r).subarray(e,e+t):new Uint8Array(r).subarray(e);return new Uint8Array(n).buffer}function Gg(r,e){return dh(r>=0),dh(e>0),r+(e-1)&-4}function Hee(r,e,t){let n;if(r instanceof ArrayBuffer)n=new Uint8Array(r);else{const i=r.byteOffset,s=r.byteLength;n=new Uint8Array(r.buffer||r.arrayBuffer,i,s)}return e.set(n,t),t+Gg(n.byteLength,4)}const jee=globalThis.loaders?.parseImageNode,H2=typeof Image<"u",j2=typeof ImageBitmap<"u",$ee=!!jee,$2=bk?!0:$ee;function Wee(r){switch(r){case"auto":return j2||H2||$2;case"imagebitmap":return j2;case"image":return H2;
vendor: 4,693 bytes, line 2101
2101case"data":return $2;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function Jee(){if(j2)return"imagebitmap";if(H2)return"image";if($2)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Xee(r){const e=Kee(r);if(!e)throw new Error("Not an image");return e}function wk(r){switch(Xee(r)){case"data":return r;case"image":case"imagebitmap":const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)throw new Error("getImageData");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height);default:throw new Error("getImageData")}}function Kee(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&r instanceof Image?"image":r&&typeof r=="object"&&r.data&&r.width&&r.height?"data":null}const qee=/^data:image\/svg\+xml/,Yee=/\.svg((\?|#).*)?$/;function Kw(r){return r&&(qee.test(r)||Yee.test(r))}function Zee(r,e){if(Kw(e)){let n=new TextDecoder().decode(r);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(s){throw new Error(s.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Ck(r,e)}function Ck(r,e){if(Kw(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}async function Tk(r,e,t){const n=Zee(r,t),i=self.URL||self.webkitURL,s=typeof n!="string"&&i.createObjectURL(n);try{return await Qee(s||n,e)}finally{s&&i.revokeObjectURL(s)}}async function Qee(r,e){const t=new Image;return t.src=r,e.image&&e.image.decode&&t.decode?(await t.decode(),t):await new Promise((n,i)=>{try{t.onload=()=>n(t),t.onerror=s=>{const o=s instanceof Error?s.message:"error";i(new Error(o))}}catch(s){i(s)}})}const ete={};let AI=!0;async function tte(r,e,t){let n;Kw(t)?n=await Tk(r,e,t):n=Ck(r,t);const i=e&&e.imagebitmap;return await rte(n,i)}async function rte(r,e=null){if((nte(e)||!AI)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),AI=!1}return await createImageBitmap(r)}function nte(r){for(const e in r||ete)return!1;return!0}function ite(r){return!cte(r,"ftyp",4)||(r[8]&96)===0?null:ste(r)}function ste(r){switch(ote(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ote(r,e,t){return String.fromCharCode(...r.slice(e,t))}function ate(r){return[...r].map(e=>e.charCodeAt(0))}function cte(r,e,t=0){const n=ate(e);for(let i=0;i<n.length;++i)if(n[i]!==r[i+t])return!1;return!0}const sl=!1,lg=!0;function qw(r){const e=Vg(r);return ute(e)||dte(e)||fte(e)||hte(e)||lte(e)}function lte(r){const e=new Uint8Array(r instanceof DataView?r.buffer:r),t=ite(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function ute(r){const e=Vg(r);return e.byteLength>=24&&e.getUint32(0,sl)===2303741511?{mimeType:"image/png",width:e.getUint32(16,sl),height:e.getUint32(20,sl)}:null}function fte(r){const e=Vg(r);return e.byteLength>=10&&e.getUint32(0,sl)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,lg),height:e.getUint16(8,lg)}:null}function hte(r){const e=Vg(r);return e.byteLength>=14&&e.getUint16(0,sl)===16973&&e.getUint32(2,lg)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,lg),height:e.getUint32(22,lg)}:null}function dte(r){const e=Vg(r);if(!(e.byteLength>=3&&e.getUint16(0,sl)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:n,sofMarkers:i}=pte();let s=2;for(;s+9<e.byteLength;){const o=e.getUint16(s,sl);if(i.has(o))return{mimeType:"image/jpeg",height:e.getUint16(s+5,sl),width:e.getUint16(s+7,sl)};if(!n.has(o))return null;s+=2,s+=e.getUint16(s,sl)}return null}function pte(){const r=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)r.add(t);return{tableMarkers:r,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Vg(r){if(r instanceof DataView)return r;if(ArrayBuffer.isView(r))return new DataView(r.buffer);if(r instanceof ArrayBuffer)return new DataView(r);throw new Error("toDataView")}async function Ate(r,e){const{mimeType:t}=qw(r)||{},n=globalThis.loaders?.parseImageNode;return dh(n),await n(r,t)}async function gte(r,e,t){e=e||{};const i=(e.image||{}).type||"auto",{url:s}=t||{},o=mte(i);let c;switch(o){case"imagebitmap":c=await tte(r,e,s);break;case"image":c=await Tk(r,e,s);break;case"data":c=await Ate(r);break;default:dh(!1)}return i==="data"&&(c=wk(c)),c}function mte(r){switch(r){case"auto":case"data":return Jee();default:return Wee(r),r}}const _te=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],yte=["image/png","image/jpeg","image/gif","
2101image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],vte={image:{type:"auto",decode:!0}},bte={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Mee,mimeTypes:yte,extensions:_te,parse:gte,tests:[r=>!!qw(new DataView(r))],options:vte},Cb={};function xte(r){if(Cb[r]===void 0){const e=bk?Cte(r):wte(r);Cb[r]=e}return Cb[r]}function wte(r){const e=["image/png","image/jpeg","image/gif"],t=globalThis.loaders?.imageFormatsNode||e;return!!globalThis.loaders?.parseImageNode&&t.includes(r)}function Cte(r){switch(r){case"image/avif":case"image/webp":return Tte(r);default:return!0}}function Tte(r){try{return document.createElement("canvas").toDataURL(r).indexOf(`data:${r}`)===0}catch{return!1}}function Na(r,e){if(!r)throw new Error(e||"assert failed: gltf")}const Ek={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Bk={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},gI=["SCALAR","VEC2","VEC3","VEC4"],Ete=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Bte=new Map(Ete),Ste={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ite={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Mte={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Sk(r){return gI[r-1]||gI[0]}function xy(r){const e=Bte.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function Ik(r,e){const t=Mte[r.componentType],n=Ste[r.type],i=Ite[r.componentType],s=r.count*n,o=r.count*n*i;Na(o>=0&&o<=e.byteLength);const c=Bk[r.componentType],f=Ek[r.type];return{ArrayType:t,length:s,byteLength:o,componentByteSize:c,numberOfComponentsInElement:f}}function Pte(r,e,t){const n=r.bufferViews[t];Na(n);const i=n.buffer,s=e[i];Na(s);const o=(n.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,o,n.byteLength)}function Rte(r,e,t){const n=typeof t=="number"?r.accessors?.[t]:t;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(t)}`);const i=r.bufferViews?.[n.bufferView||0];if(!i)throw new Error(`No gltf buffer view for accessor ${i}`);const{arrayBuffer:s,byteOffset:o}=e[i.buffer],c=(o||0)+(n.byteOffset||0)+(i.byteOffset||0),{ArrayType:f,length:A,componentByteSize:v,numberOfComponentsInElement:w}=Ik(n,i),S=v*w,F=i.byteStride||S;if(typeof i.byteStride>"u"||i.byteStride===S)return new f(s,c,A);const N=new f(A);for(let U=0;U<n.count;U++){const $=new f(s,c+U*F,w);N.set($,U*w)}return N}function Fte(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}let ks=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||Fte(),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){const t=this.getUsedExtensions().find(i=>i===e),n=this.getRequiredExtensions().find(i=>i===e);return typeof t=="string"||typeof n=="string"}getExtension(e){const t=this.getUsedExtensions().find(i=>i===e),n=this.json.extensions||{};return t?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}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,t){if(typeof t=="object")return t;const n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){e=this.getBufferView(e);const t=e.buffer,n=this.gltf.buffers[t];Na(n);const i=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,e.byteLength)}getTypedArrayForAccessor(e){const t=this.getAccessor(e);return Rte(this.gltf.json,this.gltf.buffers,t)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(i,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){const i=e.extensions||{};i[t]=n}removeObjectExtension(e,t){const n=e?.extensions||{};if(n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const i=this.json.extensionsRemoved;i.includes(t)||i.push(t)}delete n[t]}
vendor: 15,349 bytes, line 2101
2101addExtension(e,t={}){return Na(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return Na(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const t=this.json.extensionsRemoved;t.includes(e)||t.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){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];const i={mesh:t};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:n,material:i,mode:s=4}=e,c={primitives:[{attributes:this._addAttributes(t),mode:s}]};if(n){const f=this._addIndices(n);c.primitives[0].indices=f}return Number.isFinite(i)&&(c.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(c),this.json.meshes.length-1}addPointCloud(e){const n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,t){const n=qw(e),i=t||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:i};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e,t=0,n=this.byteLength){const i=e.byteLength;Na(Number.isFinite(i)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const s={buffer:t,byteOffset:n,byteLength:i};return this.byteLength+=Gg(i,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(s),this.json.bufferViews.length-1}addAccessor(e,t){const n={bufferView:e,type:Sk(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const n=this.addBufferView(e);let i={min:t.min,max:t.max};(!i.min||!i.max)&&(i=this._getAccessorMinMax(e,t.size));const s={size:t.size,componentType:xy(e),count:Math.round(e.length/t.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(s,t))}addTexture(e){const{imageIndex:t}=e,n={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(n),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(){const e=this.byteLength,t=new ArrayBuffer(e),n=new Uint8Array(t);let i=0;for(const s of this.sourceBuffers||[])i=Hee(s,n,i);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=e:this.json.buffers=[{byteLength:e}],this.gltf.binary=t,this.sourceBuffers=[t],this.gltf.buffers=[{arrayBuffer:t,byteOffset:0,byteLength:t.byteLength}]}_removeStringFromArray(e,t){let n=!0;for(;n;){const i=e.indexOf(t);i>-1?e.splice(i,1):n=!1}}_addAttributes(e={}){const t={};for(const n in e){const i=e[n],s=this._getGltfAttributeName(n),o=this.addBinaryBuffer(i.value,i);t[s]=o}return t}_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,t){const n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];const i=e.subarray(0,t);for(const s of i)n.min.push(s),n.max.push(s);for(let s=t;s<e.length;s+=t)for(let o=0;o<t;o++)n.min[0+o]=Math.min(n.min[0+o],e[s+o]),n.max[0+o]=Math.max(n.max[0+o],e[s+o]);return n}};function mI(r){return(r%1+1)%1}const Mk={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},Dte={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},Pk={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Yw(r,e){return Pk[e]*Mk[r]}function wy(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;const i=r.getTypedArrayForBufferView(e),s=Cy(i,"SCALAR",t,n+1);return s instanceof BigInt64Array||s instanceof BigUint64Array?null:s}function Cy(r,e,t,n=1){const i=Mk[e],s=Dte[t],o=Pk[t],c=n*i,f=c*o;let A=r.buffer,v=r.byteOffset;return v%o!==0&&(A=new Uint8Array(A).slice(v,v+f).buffer,v=0),new s(A,v,c)}function Zw(r,e,t){const n=`TEXCOORD_${e.texCoord||0}`,i=t.attributes[n],s=r.getTypedArrayForAccessor(i),o=r.gltf.json,c=e.index,f=o.textures?.[c]?.source;if(typeof f<"u"){const A=o.images?.[f]?.mimeType,v=r.gltf.images?.[f];if(v&&typeof v.width<"u"){const w=[];for(let S=0;S<s.length;S+=2){const F=Ote(v,A,s,S,e.channels);w.push(F)}return w}}return[]}function Rk(r,e,t,n,i){if(!t?.length)return;const s=[];for(const v of t){let w=n.findIndex(S=>S===v);w===-1&&(w=n.push(v)-1),s.push(w)}const o=new Uint32Array(s),c=r.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,f=r.addBufferView(o,c,0),A=r.addAccessor(f,{size:1,componentType:xy(o),count:o.length});i.attributes[e]=A}function Ote(r,e,t,n,i=[0]){const s={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=t[n],c=t[n+1];let f=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(f=4);const A=Lte(o,c,r,f);let v=0;for(const w of i){const S=typeof w=="number"?Object.values(s)[w]:s[w],F=A+S.offset,N=wk(r);if(N.data.length<=F)throw new Error(`${N.data.length} <= ${F}`);const U=N.data[F];v|=U<<S.shift}return v}function Lte(r,e,t,n=1){const i=t.width,s=mI(r)*(i-1),o=Math.round(s),c=t.height,f=mI(e)*(c-1),A=Math.round(f),v=t.components?t.components:n;return(A*i+o)*v}function Fk(r,e,t,n,i){const s=[];for(let o=0;o<e;o++){const c=t[o],f=t[o+1]-t[o];if(f+c>n)break;const A=c/i,v=f/i;s.push(r.slice(A,A+v))}return s}function Dk(r,e,t){const n=[];for(let i=0;i<e;i++){const s=i*t;n.push(r.slice(s,s+t))}return n}function Ok(r,e,t,n){if(t)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){const i=[],s=new TextDecoder("utf8");let o=0;for(let c=0;c<r;c++){const f=n[c+1]-n[c];if(f+o<=e.length){const A=e.subarray(o,f+o),v=s.decode(A);i.push(v),o+=f}}return i}return[]}const bp="EXT_mesh_features",kte=bp;async function Nte(r,e){const t=new ks(r);zte(t,e)}function Ute(r,e){const t=new ks(r);return Vte(t),t.createBinaryChunk(),t.gltf}function zte(r,e){const t=r.gltf.json;if(t.meshes)for(const n of t.meshes)for(const i of n.primitives)Gte(r,i,e)}function Gte(r,e,t){if(!t?.gltf?.loadBuffers)return;const i=e.extensions?.[bp]?.featureIds;if(i)for(const s of i){let o;if(typeof s.attribute<"u"){const c=`_FEATURE_ID_${s.attribute}`,f=e.attributes[c];o=r.getTypedArrayForAccessor(f)}else typeof s.texture<"u"&&t?.gltf?.loadImages?o=Zw(r,s.texture,e):o=[];s.data=o}}function Vte(r,e){const t=r.gltf.json.meshes;if(t)for(const n of t)for(const i of n.primitives)jte(r,i)}function Hte(r,e,t,n){e.extensions||(e.extensions={});let i=e.extensions[bp];i||(i={featureIds:[]},e.extensions[bp]=i);const{featureIds:s}=i,o={featureCount:t.length,propertyTable:n,data:t};s.push(o),r.addObjectExtension(e,bp,i)}function jte(r,e){const t=e.extensions?.[bp];if(!t)return;const n=t.featureIds;n.forEach((i,s)=>{if(i.data){const{accessorKey:o,index:c}=$te(e.attributes),f=new Uint32Array(i.data);n[s]={featureCount:f.length,propertyTable:i.propertyTable,attribute:c},r.gltf.buffers.push({arrayBuffer:f.buffer,byteOffset:f.byteOffset,byteLength:f.byteLength});const A=r.addBufferView(f),v=r.addAccessor(A,{size:1,componentType:xy(f),count:f.length});e.attributes[o]=v}})}function $te(r){const e="_FEATURE_ID_",t=Object.keys(r).filter(s=>s.indexOf(e)===0);let n=-1;for(const s of t){const o=Number(s.substring(e.length));o>n&&(n=o)}return n++,{accessorKey:`${e}${n}`,index:n}}const Wte=Object.freeze(Object.defineProperty({__proto__:null,createExtMeshFeatures:Hte,decode:Nte,encode:Ute,name:kte},Symbol.toStringTag,{value:"Module"})),Dp="EXT_structural_metadata",Jte=Dp;async function Xte(r,e){const t=new ks(r);qte(t,e)}function Kte(r,e){const t=new ks(r);return hre(t),t.createBinaryChunk(),t.gltf}function qte(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(Dp);t&&(e.gltf?.loadImages&&Yte(r,t),Zte(r,t))}function Yte(r,e){const t=e.propertyTextures,n=r.gltf.json;if(t&&n.meshes)for(const i of n.meshes)for(const s of i.primitives)ere(r,t,s,e)}function Zte(r,e){const t=e.schema;if(!t)return;const n=t.classes,i=e.propertyTables;if(n&&i)for(const s in n){const o=Qte(i,s);o&&rre(r,t,o)}}function Qte(r,e){for(const t of r)if(t.class===e)return t;return null}function ere(r,e,t,n){if(!e)return;const s=t.extensions?.[Dp]?.propertyTextures;if(s)for(const o of s){const c=e[o];tre(r,c,t,n)}}function tre(r,e,t,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);const i=e.class;for(const s in e.properties){const o=`${i}_${s}`,c=e.properties?.[s];if(!c)continue;c.data||(c.data=[]);const f=c.data,A=Zw(r,c,t);A!==null&&(Rk(r,o,A,f,t),c.data=f,n.dataAttributeNames.push(o))}}function rre(r,e,t){const n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],c=t.properties?.[s];if(c){const f=nre(r,e,o,i,c);c.data=f}}}function nre(r,e,t,n,i){let s=[];const o=i.values,c=r.getTypedArrayForBufferView(o),f=ire(r,t,i,n),A=sre(r,i,n);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{s=ore(t,n,c,f);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${t.type}`);case"STRING":{s=Ok(n,c,f,A);break}case"ENUM":{s=are(e,t,n,c,f);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return s}function ire(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?wy(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function sre(r,e,t){return typeof e.stringOffsets<"u"?wy(r,e.stringOffsets,e.stringOffsetType||"UINT32",t):null}function ore(r,e,t,n){const i=r.array,s=r.count,o=Yw(r.type,r.componentType),c=t.byteLength/o;let f;return r.componentType?f=Cy(t,r.type,r.componentType,c):f=t,i?n?Fk(f,e,n,t.length,o):s?Dk(f,e,s):[]:f}function are(r,e,t,n,i){const s=e.enumType;if(!s)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");const o=r.enums?.[s];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${s}`);const c=o.valueType||"UINT16",f=Yw(e.type,c),A=n.byteLength/f;let v=Cy(n,e.type,c,A);if(v||(v=n),e.array){if(i)return cre({valuesData:v,numberOfElements:t,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:f,enumEntry:o});const w=e.count;return w?lre(v,t,w,o):[]}return Qw(v,0,t,o)}function cre(r){const{valuesData:e,numberOfElements:t,arrayOffsets:n,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=r,c=[];for(let f=0;f<t;f++){const A=n[f],v=n[f+1]-n[f];if(v+A>i)break;const w=A/s,S=v/s,F=Qw(e,w,S,o);c.push(F)}return c}function lre(r,e,t,n){const i=[];for(let s=0;s<e;s++){const o=t*s,c=Qw(r,o,t,n);i.push(c)}return i}function Qw(r,e,t,n){const i=[];for(let s=0;s<t;s++)if(r instanceof BigInt64Array||r instanceof BigUint64Array)i.push("");else{const o=r[e+s],c=ure(n,o);c?i.push(c.name):i.push("")}return i}function ure(r,e){for(const t of r.values)if(t.value===e)return t;return null}const fre="schemaClassId";function hre(r,e){const t=r.getExtension(Dp);if(t&&t.propertyTables)for(const n of t.propertyTables){const i=n.class,s=t.schema?.classes?.[i];n.properties&&s&&dre(n,s,r)}}function dre(r,e,t){for(const n in r.properties){const i=r.properties[n].data;if(i){const s=e.properties[n];if(s){const o=mre(i,s,t);r.properties[n]=o}}}}function pre(r,e,t=fre){let n=r.getExtension(Dp);n||(n=r.addExtension(Dp)),n.schema=Are(e,t,n.schema);const i=gre(e,t,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(i)-1}function Are(r,e,t){const n=t??{id:"schema_id"},i={properties:{}};for(const s of r){const o={type:s.elementType,componentType:s.componentType};i.properties[s.name]=o}return n.classes={},n.classes[e]=i,n}function gre(r,e,t){const n={class:e,count:0};let i=0;const s=t.classes?.[e];for(const o of r){if(i===0&&(i=o.values.length),i!==o.values.length&&o.values.length)throw new Error("Illegal values in attributes");s?.properties[o.name]&&(n.properties||(n.properties={}),n.properties[o.name]={values:0,data:o.values})}return n.count=i,n}function mre(r,e,t){const n={values:0};if(e.type==="STRING"){const{stringData:i,stringOffsets:s}=vre(r);n.stringOffsets=Tb(s,t),n.values=Tb(i,t)}else if(e.type==="SCALAR"&&e.componentType){const i=yre(r,e.componentType);n.values=Tb(i,t)}return n}const _re={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function yre(r,e){const t=[];for(const i of r)t.push(Number(i));const n=_re[e];if(!n)throw new Error("Illegal component type");return new n(t)}function vre(r){const e=new TextEncoder,t=[];let n=0;for(const f of r){const A=e.encode(f);n+=A.length,t.push(A)}const i=new Uint8Array(n),s=[];let o=0;for(const f of t)i.set(f,o),s.push(o),o+=f.length;s.push(o);const c=new Uint32Array(s);return{stringData:i,stringOffsets:c}}function Tb(r,e){return e.gltf.buffers.push({arrayBuffer:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}),e.addBufferView(r)}const bre=Object.freeze(Object.defineProperty({__proto__:null,createExtStructuralMetadata:pre,decode:Xte,encode:Kte,name:Jte},Symbol.toStringTag,{value:"Module"})),Lk="EXT_feature_metadata",xre=Lk;async function wre(r,e){const t=new ks(r);Cre(t,e)}function Cre(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(Lk);t&&(e.gltf?.loadImages&&Tre(r,t),Ere(r,t))}function Tre(r,e){const t=e.schema;if(!t)return;const n=t.classes,{featureTextures:i}=e;if(n&&i)for(const s in n){const o=n[s],c=Sre(i,s);c&&Mre(r,c,o)}}function Ere(r,e){const t=e.schema;if(!t)return;const n=t.classes,i=e.featureTables;if(n&&i)for(const s in n){const o=Bre(i,s);o&&Ire(r,t,o)}}function Bre(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function Sre(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function Ire(r,e,t){if(!t.class)return;const n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with 
2101name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],c=t.properties?.[s];if(c){const f=Pre(r,e,o,i,c);c.data=f}}}function Mre(r,e,t){const n=e.class;for(const i in t.properties){const s=e?.properties?.[i];if(s){const o=Lre(r,s,n);s.data=o}}}function Pre(r,e,t,n,i){let s=[];const o=i.bufferView,c=r.getTypedArrayForBufferView(o),f=Rre(r,t,i,n),A=Fre(r,t,i,n);return t.type==="STRING"||t.componentType==="STRING"?s=Ok(n,c,f,A):Dre(t)&&(s=Ore(t,n,c,f)),s}function Rre(r,e,t,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof t.arrayOffsetBufferView<"u"?wy(r,t.arrayOffsetBufferView,t.offsetType||"UINT32",n):null}function Fre(r,e,t,n){return typeof t.stringOffsetBufferView<"u"?wy(r,t.stringOffsetBufferView,t.offsetType||"UINT32",n):null}function Dre(r){const e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(r.type)||typeof r.componentType<"u"&&e.includes(r.componentType)}function Ore(r,e,t,n){const i=r.type==="ARRAY",s=r.componentCount,o="SCALAR",c=r.componentType||r.type,f=Yw(o,c),A=t.byteLength/f,v=Cy(t,o,c,A);return i?n?Fk(v,e,n,t.length,f):s?Dk(v,e,s):[]:v}function Lre(r,e,t){const n=r.gltf.json;if(!n.meshes)return[];const i=[];for(const s of n.meshes)for(const o of s.primitives)kre(r,t,e,i,o);return i}function kre(r,e,t,n,i){const s={channels:t.channels,...t.texture},o=Zw(r,s,i);o&&Rk(r,e,o,n,i)}const Nre=Object.freeze(Object.defineProperty({__proto__:null,decode:wre,name:xre},Symbol.toStringTag,{value:"Module"})),Ure="4.3.3",zre="4.3.3",F_={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"};let _I;async function yI(r){Pee(r.modules);const e=Ree("basis");return e||(_I||=Gre(r),await _I)}async function Gre(r){let e=null,t=null;return[e,t]=await Promise.all([await ah(F_.TRANSCODER,"textures",r),await ah(F_.TRANSCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await Vre(e,t)}function Vre(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r(t).then(i=>{const{BasisFile:s,initializeBasis:o}=i;o(),n({BasisFile:s})})})}let Eb;async function vI(r){const e=r.modules||{};return e.basisEncoder?e.basisEncoder:(Eb=Eb||Hre(r),await Eb)}async function Hre(r){let e=null,t=null;return[e,t]=await Promise.all([await ah(F_.ENCODER,"textures",r),await ah(F_.ENCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await jre(e,t)}function jre(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r(t).then(i=>{const{BasisFile:s,KTX2File:o,initializeBasis:c,BasisEncoder:f}=i;c(),n({BasisFile:s,KTX2File:o,BasisEncoder:f})})})}const Rd={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_ASTC_4X4_KHR:37808},$re=["","WEBKIT_","MOZ_"],bI={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"};let Zm=null;function Wre(r){if(!Zm){r=r||Jre()||void 0,Zm=new Set;for(const e of $re)for(const t in bI)if(r&&r.getExtension(`${e}${t}`)){const n=bI[t];Zm.add(n)}}return Zm}function Jre(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}const la=[171,75,84,88,32,50,48,187,13,10,26,10];function Xre(r){const e=new Uint8Array(r);return!(e.byteLength<la.length||e[0]!==la[0]||e[1]!==la[1]||e[2]!==la[2]||e[3]!==la[3]||e[4]!==la[4]||e[5]!==la[5]||e[6]!==la[6]||e[7]!==la[7]||e[8]!==la[8]||e[9]!==la[9]||e[10]!==la[10]||e[11]!==la[11])}const Kre={etc1:{basisFormat:0,compressed:!0,format:Rd.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Rd.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Rd.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:Rd.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Rd.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Rd.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 qre(r,e){if(e.basis.containerFormat==="auto"){if(Xre(r)){const n=await vI(e);return xI(n.KTX2File,r,e)}const{BasisFile:t}=await yI(e);return Bb(t,r,e)}switch(e.basis.module){case"encoder":const t=await vI(e);switch(e.basis.containerFormat){case"ktx2":return xI(t.KTX2File,r,e);case"basis":default:return Bb(t.BasisFile,r,e)}case"transcoder":default:const{BasisFile:n}=await yI(e);return Bb(n,r,e)}}function Bb(r,e,t){const n=new r(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");const i=n.getNumImages(),s=[];for(let o=0;o<i;o++){const c=n.getNumLevels(o),f=[];for(let A=0;A<c;A++)f.push(Yre(n,o,A,t));s.push(f)}return s}finally{n.close(),n.delete()}}function Yre(r,e,t,n){const i=r.getImageWidth(e,t),s=r.getImageHeight(e,t),o=r.getHasAlpha(),{compressed:c,format:f,basisFormat:A}=kk(n,o),v=r.getImageTranscodedSizeInBytes(e,t,A),w=new Uint8Array(v);if(!r.transcodeImage(w,e,t,A,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:s,data:w,compressed:c,format:f,hasAlpha:o}}function xI(r,e,t){const n=new r(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");const i=n.getLevels(),s=[];for(let o=0;o<i;o++)s.push(Zre(n,o,t));return[s]}finally{n.close(),n.delete()}}function Zre(r,e,t){const{alphaFlag:n,height:i,width:s}=r.getImageLevelInfo(e,0,0),{compressed:o,format:c,basisFormat:f}=kk(t,n),A=r.getImageTranscodedSizeInBytes(e,0,0,f),v=new Uint8Array(A);if(!r.transcodeImage(v,e,0,0,f,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:s,height:i,data:v,compressed:o,levelSize:A,hasAlpha:n,format:c}}function kk(r,e){let t=r&&r.basis&&r.basis.format;return t==="auto"&&(t=Nk()),typeof t=="object"&&(t=e?t.alpha:t.noAlpha),t=t.toLowerCase(),Kre[t]}function Nk(){const r=Wre();return r.has("astc")?"astc-4x4":r.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}
vendor: 2,235 bytes, line 2101
2101:r.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:r.has("etc1")?"etc1":r.has("etc2")?"etc2":"rgb565"}const Qre={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:zre,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"}}},ene={...Qre,parse:qre},Op=!0,wI=1735152710,eC=12,D_=8,tne=1313821514,rne=5130562,nne=0,ine=0,sne=1;function one(r,e=0){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))}`}function ane(r,e=0,t={}){const n=new DataView(r),{magic:i=wI}=t,s=n.getUint32(e,!1);return s===i||s===wI}function cne(r,e,t=0,n={}){const i=new DataView(e),s=one(i,t+0),o=i.getUint32(t+4,Op),c=i.getUint32(t+8,Op);switch(Object.assign(r,{header:{byteOffset:t,byteLength:c,hasBinChunk:!1},type:s,version:o,json:{},binChunks:[]}),t+=eC,r.version){case 1:return lne(r,i,t);case 2:return une(r,i,t,n={});default:throw new Error(`Invalid GLB version ${r.version}. Only supports version 1 and 2.`)}}function lne(r,e,t){dh(r.header.byteLength>eC+D_);const n=e.getUint32(t+0,Op),i=e.getUint32(t+4,Op);return t+=D_,dh(i===nne),W2(r,e,t,n),t+=n,t+=J2(r,e,t,r.header.byteLength),t}function une(r,e,t,n){return dh(r.header.byteLength>eC+D_),fne(r,e,t,n),t+r.header.byteLength}function fne(r,e,t,n){for(;t+8<=r.header.byteLength;){const i=e.getUint32(t+0,Op),s=e.getUint32(t+4,Op);switch(t+=D_,s){case tne:W2(r,e,t,i);break;case rne:J2(r,e,t,i);break;case ine:n.strict||W2(r,e,t,i);break;case sne:n.strict||J2(r,e,t,i);break}t+=Gg(i,4)}return t}function W2(r,e,t,n){const i=new Uint8Array(e.buffer,t,n),o=new TextDecoder("utf8").decode(i);return r.json=JSON.parse(o),Gg(n,4)}function J2(r,e,t,n){return r.header.hasBinChunk=!0,r.binChunks.push({byteOffset:t,byteLength:n,arrayBuffer:e.buffer}),Gg(n,4)}function Uk(r,e){if(r.startsWith("data:")||r.startsWith("http:")||r.startsWith("https:"))return r;const n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${r}`);return n.substr(0,n.lastIndexOf("/")+1)+r}
2101const hne="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIA
2101LAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/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",dn
vendor: 10,663 bytes, line 2101
2101e="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",
vendor: 34,370 bytes, line 2101
2101pne=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]),Ane=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]),gne={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},mne={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function _ne(r,e,t,n,i,s="NONE"){const o=await yne();xne(o,o.exports[mne[i]],r,e,t,n,o.exports[gne[s||"NONE"]])}let Sb;async function yne(){return Sb||(Sb=vne()),Sb}async function vne(){let r=hne;WebAssembly.validate(pne)&&(r=dne,console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(bne(r),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function bne(r){const e=new Uint8Array(r.length);for(let n=0;n<r.length;++n){const i=r.charCodeAt(n);e[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let t=0;for(let n=0;n<r.length;++n)e[t++]=e[n]<60?Ane[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,t)}function xne(r,e,t,n,i,s,o){const c=r.exports.sbrk,f=n+3&-4,A=c(f*i),v=c(s.length),w=new Uint8Array(r.exports.memory.buffer);w.set(s,v);const S=e(A,n,i,v,s.length);if(S===0&&o&&o(A,f,i),t.set(w.subarray(A,A+n*i)),c(A-c(0)),S!==0)throw new Error(`Malformed buffer data: ${S}`)}const O_="EXT_meshopt_compression",wne=O_;async function Cne(r,e){const t=new ks(r);if(!e?.gltf?.decompressMeshes||!e.gltf?.loadBuffers)return;const n=[];for(const i of r.json.bufferViews||[])n.push(Tne(t,i));await Promise.all(n),t.removeExtension(O_)}async function Tne(r,e){const t=r.getObjectExtension(e,O_);if(t){const{byteOffset:n=0,byteLength:i=0,byteStride:s,count:o,mode:c,filter:f="NONE",buffer:A}=t,v=r.gltf.buffers[A],w=new Uint8Array(v.arrayBuffer,v.byteOffset+n,i),S=new Uint8Array(r.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await _ne(S,o,s,w,c,f),r.removeObjectExtension(e,O_)}}const Ene=Object.freeze(Object.defineProperty({__proto__:null,decode:Cne,name:wne},Symbol.toStringTag,{value:"Module"})),Qd="EXT_texture_webp",Bne=Qd;function Sne(r,e){const t=new ks(r);if(!xte("image/webp")){if(t.getRequiredExtensions().includes(Qd))throw new Error(`gltf: Required extension ${Qd} not supported by browser`);return}const{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,Qd);s&&(i.source=s.source),t.removeObjectExtension(i,Qd)}t.removeExtension(Qd)}const Ine=Object.freeze(Object.defineProperty({__proto__:null,name:Bne,preprocess:Sne},Symbol.toStringTag,{value:"Module"})),j0="KHR_texture_basisu",Mne=j0;function Pne(r,e){const t=new ks(r),{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,j0);s&&(i.source=s.source,t.removeObjectExtension(i,j0))}t.removeExtension(j0)}const Rne=Object.freeze(Object.defineProperty({__proto__:null,name:Mne,preprocess:Pne},Symbol.toStringTag,{value:"Module"})),Fne="4.3.3",Dne={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:Fne,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 One(r){switch(r.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 Lne(r){let e=1/0,t=1/0,n=1/0,i=-1/0,s=-1/0,o=-1/0;const c=r.POSITION?r.POSITION.value:[],f=c&&c.length;for(let A=0;A<f;A+=3){const v=c[A],w=c[A+1],S=c[A+2];e=v<e?v:e,t=w<t?w:t,n=S<n?S:n,i=v>i?v:i,s=w>s?w:s,o=S>o?S:o}return[[e,t,n],[i,s,o]]}function kne(r,e,t){const n=One(e.value),i=t||Nne(e);return{name:r,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:i}}function Nne(r){const e={};return"byteOffset"in r&&(e.byteOffset=r.byteOffset.toString(10)),"byteStride"in r&&(e.byteStride=r.byteStride.toString(10)),"normalized"in r&&(e.normalized=r.normalized.toString()),e}function Une(r,e,t){const n=zk(e.metadata),i=[],s=zne(e.attributes);for(const o in r){const c=r[o],f=CI(o,c,s[o]);i.push(f)}if(t){const o=CI("indices",t);i.push(o)}return{fields:i,metadata:n}}function zne(r){const e={};for(const t in r){const n=r[t];e[n.name||"undefined"]=n}return e}function CI(r,e,t){const n=t?zk(t.metadata):void 0;return kne(r,e,n)}function zk(r){Object.entries(r);const e={};for(const t in r)e[`${t}.string`]=JSON.stringify(r[t]);return e}const TI={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Gne={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Vne=4;let Hne=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,t={}){const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const i=this.decoder.GetEncodedGeometryType(n),s=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(i){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,s);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!s.ptr){const S=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(S)}const c=this._getDracoLoaderData(s,i,t),f=this._getMeshData(s,c,t),A=Lne(f.attributes),v=Une(f.attributes,c,f.indices);return{loader:"draco",loaderData:c,header:{vertexCount:s.num_points(),boundingBox:A},...f,schema:v}}finally{this.draco.destroy(n),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,t,n){const i=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:i,attributes:s}}_getDracoAttributes(e,t){const n={};for(let i=0;i<e.num_attributes();i++){const s=this.decoder.GetAttribute(e,i),o=this._getAttributeMetadata(e,i);n[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:i,metadata:o};const c=this._getQuantizationTransform(s,t);c&&(n[s.unique_id()].quantization_transform=c);const f=this._getOctahedronTransform(s,t);f&&(n[s.unique_id()].octahedron_transform=f)}return n}_getMeshData(e,t,n){const i=this._getMeshAttributes(t,e,n);if(!i.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:i,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:i,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:i}}_getMeshAttributes(e,t,n){const i={};for(const s of Object.values(e.attributes)){const o=this._deduceAttributeName(s,n);s.name=o;const c=this._getAttributeValues(t,s);if(c){const{value:f,size:A}=c;i[o]={value:f,size:A,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}}return i}_getTriangleListIndices(e){const n=e.num_faces()*3,i=n*Vne,s=this.draco._malloc(i);try{return this.decoder.GetTrianglesUInt32Array(e,i,s),new Uint32Array(this.draco.HEAPF32.buffer,s,n).slice()}finally{this.draco._free(s)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),Wne(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const n=Gne[t.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${t.data_type}`),null;const i=t.num_components,o=e.num_points()*i,c=o*n.BYTES_PER_ELEMENT,f=jne(this.draco,n);let A;const v=this.draco._malloc(c);try{const w=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,w,f,c,v),A=new n(this.draco.HEAPF32.buffer,v,o).slice()}finally{this.draco._free(v)}return{value:A,size:i}}_deduceAttributeName(e,t){const n=e.unique_id;for(const[o,c]of Object.entries(t.extraAttributes||{}))if(c===n)return o;const i=e.attribute_type;for(const o in TI)if(this.draco[o]===i)return TI[o];const s=t.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},n=this.metadataQuerier.NumEntries(e);for(let i=0;i<n;i++){const s=this.metadataQuerier.GetEntryName(e,i);t[s]=this._getDracoMetadataField(e,s)}return t}_getDracoMetadataField(e,t){const n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);const i=$ne(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:i}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:n=[]}=e,i=[...t,...n];for(const s of i)this.decoder.SkipAttributeTransform(this.draco[s])}_getQuantizationTransform(e,t){const{quantizedAttributes:n=[]}=t,i=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){const o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(c=>o.min_value(c))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:n=[]}=t,i=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){const o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function jne(r,e){switch(e){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32;default:return r.DT_INVALID}}function $ne(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function Wne(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}const Jne="1.5.6",Xne="1.4.1",Ib=`https://www.gstatic.com/draco/versioned/decoders/${Jne}`,Vo={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Mb={[Vo.DECODER]:`${Ib}/${Vo.DECODER}`,[Vo.DECODER_WASM]:`${Ib}/${Vo.DECODER_WASM}`,[Vo.FALLBACK_DECODER]:`${Ib}/${Vo.FALLBACK_DECODER}`,[Vo.ENCODER]:`https://raw.githubusercontent.com/google/draco/${Xne}/javascript/${Vo.ENCODER}`};let Pb;async function Kne(r){const e=r.modules||{};return e.draco3d?Pb||=e.draco3d.createDecoderModule({}).then(t=>({draco:t})):Pb||=qne(r),await Pb}async function qne(r){let e,t;switch(r.draco&&r.draco.decoderType){case"js":e=await ah(Mb[Vo.FALLBACK_DECODER],"draco",r,Vo.FALLBACK_DECODER);break;case"wasm":default:[e,t]=await Promise.all([await ah(Mb[Vo.DECODER],"draco",r,Vo.DECODER),await ah(Mb[Vo.DECODER_WASM],"draco",r,Vo.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await Yne(e,t)}function Yne(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r({...t,onModuleLoaded:i=>n({draco:i})})})}const Zne={...Dne,parse:Qne};async function Qne(r,e){const{draco:t}=await Kne(e),n=new Hne(t);try{return n.parseSync(r,e?.draco)}finally{n.destroy()}}function eie(r){const e={};for(const t in r){const n=r[t];if(t!=="indices"){const i=Gk(n);e[t]=i}}return e}function Gk(r){const{buffer:e,size:t,count:n}=tie(r);return{value:e,size:t,byteOffset:0,count:n,type:Sk(t),componentType:xy(e)}}function tie(r){let e=r,t=1,n=0;return r&&r.value&&(e=r.value,t=r.size||1),e&&(ArrayBuffer.isView(e)||(e=rie(e,Float32Array)),n=e.length/t),{buffer:e,size:t,count:n}}function rie(r,e,t=!1){return r?Array.isArray(r)?new e(r):t&&!(r instanceof e)?new e(r):r:null}const ef="KHR_draco_mesh_compression",nie=ef;function iie(r,e,t){const n=new ks(r);for(const i of Vk(n))n.getObjectExtension(i,ef)}async function sie(r,e,t){if(!e?.gltf?.decompressMeshes)return;const n=new ks(r),i=[];for(const s of Vk(n))n.getObjectExtension(s,ef)&&i.push(aie(n,s,e,t));await Promise.all(i),n.removeExtension(ef)}function oie(r,e={}){const t=new ks(r);for(const n of t.json.meshes||[])cie(n),t.addRequiredExtension(ef)}async function aie(r,e,t,n){const i=r.getObjectExtension(e,ef);if(!i)return;const s=r.getTypedArrayForBufferView(i.bufferView),o=xk(s.buffer,s.byteOffset),c={...t};delete c["3d-tiles"];const f=await vk(o,Zne,c,n),A=eie(f.attributes);for(const[v,w]of Object.entries(A))if(v in e.attributes){const S=e.attributes[v],F=r.getAccessor(S);F?.min&&F?.max&&(w.min=F.min,w.max=F.max)}e.attributes=A,f.indices&&(e.indices=Gk(f.indices)),r.removeObjectExtension(e,ef),lie(e)}function cie(r,e,t=4,n,i){if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const s=n.DracoWriter.encodeSync({attributes:r}),o=i?.parseSync?.({attributes:r}),c=n._addFauxAttributes(o.attributes),f=n.addBufferView(s);return{primitives:[{attributes:c,mode:t,extensions:{[ef]:{bufferView:f,attributes:c}}}]}}function lie(r){if(!r.attributes&&Object.keys(r.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Vk(r){for(const e of r.json.meshes||[])for(const t of e.primitives)yield t}const uie=Object.freeze(Object.defineProperty({__proto__:null,decode:sie,encode:oie,name:nie,preprocess:iie},Symbol.toStringTag,{value:"Module"})),Ty="KHR_texture_transform",fie=Ty,Qm=new dt,hie=new gi,die=new gi;async function pie(r,e){if(!new ks(r).hasExtension(Ty)||!e.gltf?.loadBuffers)return;const i=r.json.materials||[];for(let s=0;s<i.length;s++)Aie(s,r)}function Aie(r,e){const t=e.json.materials?.[r],n=[t?.pbrMetallicRoughness?.baseColorTexture,t?.emissiveTexture,t?.normalTexture,t?.occlusionTexture,t?.pbrMetallicRoughness?.metallicRoughnessTexture],i=[];for(const s of n)s&&s?.extensions?.[Ty]&&gie(e,r,s,i)}function gie(r,e,t,n){const i=mie(t,n);if(!i)return;const s=r.json.meshes||[];for(const o of s)for(const c of o.primitives){const f=c.material;Number.isFinite(f)&&e===f&&_ie(r,c,i)}}function mie(r,e){const t=r.extensions?.[Ty],{texCoord:n=0}=r,{texCoord:i=n}=t;if(!(e.findIndex(([o,c])=>o===n&&c===i)!==-1)){const o=bie(t);return n!==i&&(r.texCoord=i),e.push([n,i]),{originalTexCoord:n,texCoord:i,matrix:o}}return null}function _ie(r,e,t){const{originalTexCoord:n,texCoord:i,matrix:s}=t,o=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){const c=r.json.accessors?.[o];if(c&&c.bufferView){const f=r.json.bufferViews?.[c.bufferView];if(f){const{arrayBuffer:A,byteOffset:v}=r.buffers[f.buffer],w=(v||0)+(c.byteOffset||0)+(f.byteOffset||0),{ArrayType:S,length:F}=Ik(c,f),N=Bk[c.componentType],U=Ek[c.type],$=f.byteStride||N*U,G=new Float32Array(F);for(let H=0;H<c.count;H++){const J=new S(A,w+H*$,2);Qm.set(J[0],J[1],1),Qm.transformByMatrix3(s),G.set([Qm[0],Qm[1]],H*U)}n===i?yie(c,f,r.buffers,G):vie(i,c,e,r,G)}}}}function yie(r,e,t,n){r.componentType=5126,t.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),e.buffer=t.length-1,e.byteLength=n.buffer.byteLength,e.byteOffset=0,delete e.byteStride}function vie(r,e,t,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});const s=n.json.bufferViews;if(!s)return;s.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});const o=n.json.accessors;o&&(o.push({bufferView:s?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),t.attributes[`TEXCOORD_${r}`]=o.length-1)}function bie(r){const{offset:e=[0,0],rotation:t=0,scale:n=[1,1]}=r,i=new gi().set(1,0,0,0,1,0,e[0],e[1],1),s=hie.set(Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0,0,0,1),o=die.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}const xie=Object.freeze(Object.defineProperty({__proto__:null,decode:pie,name:fie},Symbol.toStringTag,{value:"Module"})),Zf="KHR_lights_punctual",wie=Zf;async function Cie(r){const e=new ks(r),{json:t}=e,n=e.getExtension(Zf);n&&(e.json.lights=n.lights,e.removeExtension(Zf));for(const i of t.nodes||[]){const s=e.getObjectExtension(i,Zf);s&&(i.light=s.light),e.removeObjectExtension(i,Zf)}}async function Tie(r){const e=new ks(r),{json:t}=e;if(t.lights){const n=e.addExtension(Zf);Na(!n.lights),n.lights=t.lights,delete t.lights}if(e.json.lights){for(const n of e.json.lights){const i=n.node;e.addObjectExtension(i,Zf,n)}delete e.json.lights}}const Eie=Object.freeze(Object.defineProperty({__proto__:null,decode:Cie,encode:Tie,name:wie},Symbol.toStringTag,{value:"Module"})),Tg="KHR_materials_unlit",Bie=Tg;async function Sie(r){const e=new ks(r),{json:t}=e;for(const n of t.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),e.removeObjectExtension(n,Tg);e.removeExtension(Tg)}function Iie(r){const e=new ks(r),{json:t}=e;if(e.materials)for(const n of t.materials||[])n.unlit&&(delete n.unlit,e.addObjectExtension(n,Tg,{}),e.addExtension(Tg))}const Mie=Object.freeze(Object.defineProperty({__proto__:null,decode:Sie,encode:Iie,name:Bie},Symbol.toStringTag,{value:"Module"})),XA="KHR_techniques_webgl",Pie=XA;async function Rie(r){const e=new ks(r),{json:t}=e,n=e.getExtension(XA);if(n){const i=Die(n,e);for(const s of t.materials||[]){const o=e.getObjectExtension(s,XA);o&&(s.technique=Object.assign({},o,i[o.technique]),s.technique.values=Oie(s.technique,e)),e.removeObjectExtension(s,XA)}e.removeExtension(XA)}}async function Fie(r,e){}function Die(r,e){const{programs:t=[],shaders:n=[],techniques:i=[]}=r,s=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=s.decode(e.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),t.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),i.forEach(o=>{o.program=t[o.program]}),i}function Oie(r,e){const t=Object.assign({},r.values);return Object.keys(r.uniforms||{}).forEach(n=>{r.uniforms[n].value&&!(n in t)&&(t[n]=r.uniforms[n].value)}),Object.keys(t).forEach(n=>{typeof t[n]=="object"&&t[n].index!==void 0&&(t[n].texture=e.getTexture(t[n].index))}),t}const Lie=Object.freeze(Object.defineProperty({__proto__:null,decode:Rie,encode:Fie,name:Pie},Symbol.toStringTag,{value:"Module"})),Hk=[bre,Wte,Ene,Ine,Rne,uie,Eie,Mie,Lie,xie,Nre];function kie(r,e={},t){const n=Hk.filter(i=>jk(i.name,e));for(const i of n)i.preprocess?.(r,e,t)}async function Nie(r,e={},t){const n=Hk.filter(i=>jk(i.name,e));for(const i of n)await i.decode?.(r,e,t)}function jk(r,e){const t=e?.gltf?.excludeExtensions||{};return!(r in t&&!t[r])}const Rb="KHR_binary_glTF";function Uie(r){const e=new ks(r),{json:t}=e;for(const n of t.images||[]){const i=e.getObjectExtension(n,Rb);i&&Object.assign(n,i),e.removeObjectExtension(n,Rb)}t.buffers&&t.buffers[0]&&delete t.buffers[0].uri,e.removeExtension(Rb)}const EI={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},zie={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};let Gie=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(e,t){this.json=e.json;const n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!t.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(n),this._convertTopLevelObjectsToArrays(n),Uie(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_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(const t in EI)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const n=e[t];if(!(!n||Array.isArray(n))){e[t]=[];for(const i in n){const s=n[i];s.id=s.id||i;const o=e[t].length;e[t].push(s),this.idToIndexMap[t][i]=o}}}_convertObjectIdsToArrayIndices(e){for(const t in EI)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:n,indices:i,material:s}=t;for(const o in n)n[o]=this._convertIdToIndex(n[o],"accessor");i&&(t.indices=this._convertIdToIndex(i,"accessor")),s&&(t.material=this._convertIdToIndex(s,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(t=>this._convertIdToIndex(t,"node"))),e.meshes&&(e.meshes=e.meshes.map(t=>this._convertIdToIndex(t,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(t=>this._convertIdToIndex(t,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn(`gltf v1: json doesn't contain attribute ${t}`),e[t]=[]);for(const n of e[t])for(const i in n){const s=n[i],o=this._convertIdToIndex(s,i);n[i]=o}}_convertIdToIndex(e,t){const n=zie[t];if(n in this.idToIndexMap){const i=this.idToIndexMap[n][e];if(!Number.isFinite(i))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return i}return e}_updateObjects(e){for(const t of this.json.buffers)delete t.type}_updateMaterial(e){for(const t of e.materials){t.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const n=t.values?.tex||t.values?.texture2d_0||t.values?.diffuseTex,i=e.textures.findIndex(s=>s.id===n);i!==-1&&(t.pbrMetallicRoughness.baseColorTexture={index:i})}}};function Vie(r,e={}){return new Gie().normalize(r,e)}async function Hie(r,e,t=0,n,i){return jie(r,e,t,n),Vie(r,{normalize:n?.gltf?.normalize}),kie(r,n,i),n?.gltf?.loadBuffers&&r.json.buffers&&await $ie(r,n,i),n?.gltf?.loadImages&&await Wie(r,n,i),await Nie(r,n,i),r}function jie(r,e,t,n){if(n.uri&&(r.baseUri=n.uri),e instanceof ArrayBuffer&&!ane(e,t,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")r.json=Vee(e);else if(e instanceof ArrayBuffer){const o={};t=cne(o,e,t,n.glb),Na(o.type==="glTF",`Invalid GLB magic string ${o.type}`),r._glb=o,r.json=o.json}else Na(!1,"GLTF: must be ArrayBuffer or string");const i=r.json.buffers||[];if(r.buffers=new Array(i.length).fill(null),r._glb&&r._glb.header.hasBinChunk){const{binChunks:o}=r._glb;r.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}const s=r.json.images||[];r.images=new Array(s.length).fill({})}async function $ie(r,e,t){const n=r.json.buffers||[];for(let i=0;i<n.length;++i){const s=n[i];if(s.uri){const{fetch:o}=t;Na(o);const c=Uk(s.uri,e),A=await(await t?.fetch?.(c))?.arrayBuffer?.();r.buffers[i]={arrayBuffer:A,byteOffset:0,byteLength:A.byteLength},delete s.uri}else r.buffers[i]===null&&(r.buffers[i]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}async function Wie(r,e,t){const n=Jie(r),i=r.json.images||[],s=[];for(const o of n)s.push(Xie(r,i[o],o,e,t));return await Promise.all(s)}function Jie(r){const e=new Set,t=r.json.textures||[];for(const n of t)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function Xie(r,e,t,n,i){let s;if(e.uri&&!e.hasOwnProperty("bufferView")){const c=Uk(e.uri,n),{fetch:f}=i;s=await(await f(c)).arrayBuffer(),e.bufferView={data:s}}if(Number.isFinite(e.bufferView)){const c=Pte(r.json,r.buffers,e.bufferView);s=xk(c.buffer,c.byteOffset,c.byteLength)}Na(s,"glTF image has no data");let o=await vk(s,[bte,ene],{...n,mimeType:e.mimeType,basis:n.basis||{format:Nk()}},i);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),r.images=r.images||[],r.images[t]=o}const X2={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:Ure,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:Kie,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function Kie(r,e={},t){e={...X2.options,...e},e.gltf={...X2.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await Hie({},r,n,e,t)}var fo=1e-6,Lp=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function qie(){var r=new Lp(4);return Lp!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Yie(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function Zie(r,e,t){var n=e[0],i=e[1],s=e[2],o=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*s+t[12]*o,r[1]=t[1]*n+t[5]*i+t[9]*s+t[13]*o,r[2]=t[2]*n+t[6]*i+t[10]*s+t[14]*o,r[3]=t[3]*n+t[7]*i+t[11]*s+t[15]*o,r}(function(){var r=qie();return function(e,t,n,i,s,o){var c,f;for(t||(t=4),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,c=n;c<f;c+=t)r[0]=e[c],r[1]=e[c+1],r[2]=e[c+2],r[3]=e[c+3],s(r,r,o),e[c]=r[0],e[c+1]=r[1],e[c+2]=r[2],e[c+3]=r[3];return e}})();function $0(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function xp(r,e){const t=Zie([],e,r);return Yie(t,t,1/t[3]),t}function BI(r,e){const t=r%e;return t<0?e+t:t}function Qie(r,e,t){return t*e+(1-t)*r}function K2(r,e,t){return r<e?e:r>t?t:r}function ese(r){return Math.log(r)*Math.LOG2E}const tC=Math.log2||ese;function tse(r,e){var t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],f=e[6],A=e[7],v=e[8],w=e[9],S=e[10],F=e[11],N=e[12],U=e[13],$=e[14],G=e[15],H=t*c-n*o,J=t*f-i*o,ue=t*A-s*o,q=n*f-i*c,se=n*A-s*c,Te=i*A-s*f,Ue=v*U-w*N,de=v*$-S*N,me=v*G-F*N,pe=w*$-S*U,W=w*G-F*U,re=S*G-F*$,Ee=H*re-J*W+ue*pe+q*me-se*de+Te*Ue;return Ee?(Ee=1/Ee,r[0]=(c*re-f*W+A*pe)*Ee,r[1]=(i*W-n*re-s*pe)*Ee,r[2]=(U*Te-$*se+G*q)*Ee,r[3]=(S*se-w*Te-F*q)*Ee,r[4]=(f*me-o*re-A*de)*Ee,r[5]=(t*re-i*me+s*de)*Ee,r[6]=($*ue-N*Te-G*J)*Ee,r[7]=(v*Te-S*ue+F*J)*Ee,r[8]=(o*W-c*me+A*Ue)*Ee,r[9]=(n*me-t*W-s*Ue)*Ee,r[10]=(N*se-U*ue+G*H)*Ee,r[11]=(w*ue-v*se-F*H)*Ee,r[12]=(c*de-o*pe-f*Ue)*Ee,r[13]=(t*pe-n*de+i*Ue)*Ee,r[14]=(U*J-N*q-$*H)*Ee,r[15]=(v*q-w*J+S*H)*Ee,r):null}function Fb(r,e,t){var n=e[0],i=e[1],s=e[2],o=e[3],c=e[4],f=e[5],A=e[6],v=e[7],w=e[8],S=e[9],F=e[10],N=e[11],U=e[12],$=e[13],G=e[14],H=e[15],J=t[0],ue=t[1],q=t[2],se=t[3];return r[0]=J*n+ue*c+q*w+se*U,r[1]=J*i+ue*f+q*S+se*$,r[2]=J*s+ue*A+q*F+se*G,r[3]=J*o+ue*v+q*N+se*H,J=t[4],ue=t[5],q=t[6],se=t[7],r[4]=J*n+ue*c+q*w+se*U,r[5]=J*i+ue*f+q*S+se*$,r[6]=J*s+ue*A+q*F+se*G,r[7]=J*o+ue*v+q*N+se*H,J=t[8],ue=t[9],q=t[10],se=t[11],r[8]=J*n+ue*c+q*w+se*U,r[9]=J*i+ue*f+q*S+se*$,r[10]=J*s+ue*A+q*F+se*G,r[11]=J*o+ue*v+q*N+se*H,J=t[12],ue=t[13],q=t[14],se=t[15],r[12]=J*n+ue*c+q*w+se*U,r[13]=J*i+ue*f+q*S+se*$,r[14]=J*s+ue*A+q*F+se*G,r[15]=J*o+ue*v+q*N+se*H,r}function q2(r,e,t){var n=t[0],i=t[1],s=t[2],o,c,f,A,v,w,S,F,N,U,$,G;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*s+e[12],r[13]=e[1]*n+e[5]*i+e[9]*s+e[13],r[14]=e[2]*n+e[6]*i+e[10]*s+e[14],r[15]=e[3]*n+e[7]*i+e[11]*s+e[15]):(o=e[0],c=e[1],f=e[2],A=e[3],v=e[4],w=e[5],S=e[6],F=e[7],N=e[8],U=e[9],$=e[10],G=e[11],r[0]=o,r[1]=c,r[2]=f,r[3]=A,r[4]=v,r[5]=w,r[6]=S,r[7]=F,r[8]=N,r[9]=U,r[10]=$,r[11]=G,r[12]=o*n+v*i+N*s+e[12],r[13]=c*n+w*i+U*s+e[13],r[14]=f*n+S*i+$*s+e[14],r[15]=A*n+F*i+G*s+e[15]),r}function $k(r,e,t){var n=t[0],i=t[1],s=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*i,r[6]=e[6]*i,r[7]=e[7]*i,r[8]=e[8]*s,r[9]=e[9]*s,r[10]=e[10]*s,r[11]=e[11]*s,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function rse(r,e,t){var n=Math.sin(t),i=Math.cos(t),s=e[4],o=e[5],c=e[6],f=e[7],A=e[8],v=e[9],w=e[10],S=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=s*i+A*n,r[5]=o*i+v*n,r[6]=c*i+w*n,r[7]=f*i+S*n,r[8]=A*i-s*n,r[9]=v*i-o*n,r[10]=w*i-c*n,r[11]=S*i-f*n,r}function nse(r,e,t){var n=Math.sin(t),i=Math.cos(t),s=e[0],o=e[1],c=e[2],f=e[3],A=e[4],v=e[5],w=e[6],S=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=s*i+A*n,r[1]=o*i+v*n,r[2]=c*i+w*n,r[3]=f*i+S*n,r[4]=A*i-s*n,r[5]=v*i-o*n,r[6]=w*i-c*n,r[7]=S*i-f*n,r}function ise(r,e,t,n,i){var s=1/Math.tan(e/2),o;return r[0]=s/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=s,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=(i+n)*o,r[14]=2*i*n*o):(r[10]=-1,r[14]=-2*n),r}var sse=ise;function SI(r,e){var t=r[0],n=r[1],i=r[2],s=r[3],o=r[4],c=r[5],f=r[6],A=r[7],v=r[8],w=r[9],S=r[10],F=r[11],N=r[12],U=r[13],$=r[14],G=r[15],H=e[0],J=e[1],ue=e[2],q=e[3],se=e[4],Te=e[5],Ue=e[6],de=e[7],me=e[8],pe=e[9],W=e[10],re=e[11],Ee=e[12],et=e[13],_e=e[14],Le=e[15];return Math.abs(t-H)<=fo*Math.max(1,Math.abs(t),Math.abs(H))&&Math.abs(n-J)<=fo*Math.max(1,Math.abs(n),Math.abs(J))&&Math.abs(i-ue)<=fo*Math.max(1,Math.abs(i),Math.abs(ue))&&Math.abs(s-q)<=fo*Math.max(1,Math.abs(s),Math.abs(q))&&Math.abs(o-se)<=fo*Math.max(1,Math.abs(o),Math.abs(se))&&Math.abs(c-Te)<=fo*Math.max(1,Math.abs(c),Math.abs(Te))&&Math.abs(f-Ue)<=fo*Math.max(1,Math.abs(f),Math.abs(Ue))&&Math.abs(A-de)<=fo*Math.max(1,Math.abs(A),Math.abs(de))&&Math.abs(v-me)<=fo*Math.max(1,Math.abs(v),Math.abs(me))&&Math.abs(w-pe)<=fo*Math.max(1,Math.abs(w),Math.abs(pe))&&Math.abs(S-W)<=fo*Math.max(1,Math.abs(S),Math.abs(W))&&Math.abs(F-re)<=fo*Math.max(1,Math.abs(F),Math.abs(re))&&Math.abs(N-Ee)<=fo*Math.max(1,Math.abs(N),Math.abs(Ee))&&Math.abs(U-et)<=fo*Math.max(1,Math.abs(U),Math.abs(et))&&Math.abs($-_e)<=fo*Math.max(1,Math.abs($),Math.abs(_e))&&Math.abs(G-Le)<=fo*Math.max(1,Math.abs(G),Math.abs(Le))}function ose(){var r=new Lp(2);return Lp!=Float32Array&&(r[0]=0,r[1]=0),r}function Y2(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function ase(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function cse(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function lse(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function use(r,e){return r[0]=-e[0],r[1]=-e[1],r}function Wk(r,e,t,n){var i=e[0],s=e[1];return r[0]=i+n*(t[0]-i),r[1]=s+n*(t[1]-s),r}var fse=ase;(function(){var r=ose();return function(e,t,n,i,s,o){var c,f;for(t||(t=2),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,c=n;c<f;c+=t)r[0]=e[c],r[1]=e[c+1],s(r,r,o),e[c]=r[0],e[c+1]=r[1];return e}})();function hse(){var r=new Lp(3);return Lp!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function dse(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function pse(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Ase(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}var gse=pse;(function(){var r=hse();return function(e,t,n,i,s,o){var c,f;for(t||(t=3),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,c=n;c<f;c+=t)r[0]=e[c],r[1]=e[c+1],r[2]=e[c+2],s(r,r,o),e[c]=r[0],e[c+1]=r[1],e[c+2]=r[2];return e}})();function tf(r,e){if(!r)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const bc=Math.PI,Jk=bc/4,ul=bc/180,Z2=180/bc,Eg=512,II=4003e4,e0=85.051129,Xk=1.5;function Q2(r){return Math.pow(2,r)}function mse(r){return tC(r)}function $u(r){const[e,t]=r;tf(Number.isFinite(e)),tf(Number.isFinite(t)&&t>=-90&&t<=90,"invalid latitude");const n=e*ul,i=t*ul,s=Eg*(n+bc)/(2*bc),o=Eg*(bc+Math.log(Math.tan(Jk+i*.5)))/(2*bc);return[s,o]}function qu(r){const[e,t]=r,n=e/Eg*(2*bc)-bc,i=2*(Math.atan(Math.exp(t/Eg*(2*bc)-bc))-Jk);return[n*Z2,i*Z2]}function _se(r){const{latitude:e,longitude:t,highPrecision:n=!1}=r;tf(Number.isFinite(e)&&Number.isFinite(t));const i=Eg,s=Math.cos(e*ul),o=i/360,c=o/s,f=i/II/s,A={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[o,c,f],degreesPerUnit:[1/o,1/c,1/f]};if(n){const v=ul*Math.tan(e*ul)/s,w=o*v/2,S=i/II*v,F=S/c*f;A.unitsPerDegree2=[0,w,S],A.unitsPerMeter2=[F,0,F]}return A}function yse(r){const{height:e,pitch:t,bearing:n,altitude:i,scale:s,center:o}=r,c=$0();q2(c,c,[0,0,-i]),rse(c,c,-t*ul),nse(c,c,n*ul);const f=s/e;return $k(c,c,[f,f,f]),o&&q2(c,c,Ase([],o)),c}function vse(r){const{width:e,height:t,altitude:n,pitch:i=0,offset:s,center:o,scale:c,nearZMultiplier:f=1,farZMultiplier:A=1}=r;let{fovy:v=L_(Xk)}=r;n!==void 0&&(v=L_(n));const w=v*ul,S=i*ul,F=Kk(v);let N=F;o&&(N+=o[2]*c/Math.cos(S)/t);const U=w*(.5+(s?s[1]:0)/t),$=Math.sin(U)*N/Math.sin(K2(Math.PI/2-S-U,.01,Math.PI-.01)),G=Math.sin(S)*$+N,H=N*10,J=Math.min(G*A,H);return{fov:w,aspect:e/t,focalDistance:F,near:f,far:J}}function bse(r){const{fov:e,aspect:t,near:n,far:i}=vse(r);return sse([],e,t,n,i)}function L_(r){return 2*Math.atan(.5/r)*Z2}function Kk(r){return .5/Math.tan(.5*r*ul)}function xse(r,e){const[t,n,i=0]=r;return tf(Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)),xp(e,[t,n,i,1])}function MI(r,e,t=0){const[n,i,s]=r;if(tf(Number.isFinite(n)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(s))return xp(e,[n,i,s,1]);const o=xp(e,[n,i,0,1]),c=xp(e,[n,i,1,1]),f=o[2],A=c[2],v=f===A?0:((t||0)-f)/(A-f);return Wk([],o,c,v)}function wse(r){const{width:e,height:t,bounds:n,minExtent:i=0,maxZoom:s=24,offset:o=[0,0]}
2101=r,[[c,f],[A,v]]=n,w=Cse(r.padding),S=$u([c,K2(v,-e0,e0)]),F=$u([A,K2(f,-e0,e0)]),N=[Math.max(Math.abs(F[0]-S[0]),i),Math.max(Math.abs(F[1]-S[1]),i)],U=[e-w.left-w.right-Math.abs(o[0])*2,t-w.top-w.bottom-Math.abs(o[1])*2];tf(U[0]>0&&U[1]>0);const $=U[0]/N[0],G=U[1]/N[1],H=(w.right-w.left)/2/$,J=(w.top-w.bottom)/2/G,ue=[(F[0]+S[0])/2+H,(F[1]+S[1])/2+J],q=qu(ue),se=Math.min(s,tC(Math.abs(Math.min($,G))));return tf(Number.isFinite(se)),{longitude:q[0],latitude:q[1],zoom:se}}function Cse(r=0){return typeof r=="number"?{top:r,bottom:r,left:r,right:r}:(tf(Number.isFinite(r.top)&&Number.isFinite(r.bottom)&&Number.isFinite(r.left)&&Number.isFinite(r.right)),r)}const PI=Math.PI/180;function Tse(r,e=0){const{width:t,height:n,unproject:i}=r,s={targetZ:e},o=i([0,n],s),c=i([t,n],s);let f,A;const v=r.fovy?.5*r.fovy*PI:Math.atan(.5/r.altitude),w=(90-r.pitch)*PI;return v>w-.01?(f=RI(r,0,e),A=RI(r,t,e)):(f=i([0,0],s),A=i([t,0],s)),[o,c,A,f]}function RI(r,e,t){const{pixelUnprojectionMatrix:n}=r,i=xp(n,[e,0,1,1]),s=xp(n,[e,r.height,1,1]),c=(t*r.distanceScales.unitsPerMeter[2]-i[2])/(s[2]-i[2]),f=Wk([],i,s,c),A=qu(f);return A.push(t),A}class fl{constructor(e={width:1,height:1}){Tr(this,"latitude",void 0),Tr(this,"longitude",void 0),Tr(this,"zoom",void 0),Tr(this,"pitch",void 0),Tr(this,"bearing",void 0),Tr(this,"altitude",void 0),Tr(this,"fovy",void 0),Tr(this,"meterOffset",void 0),Tr(this,"center",void 0),Tr(this,"width",void 0),Tr(this,"height",void 0),Tr(this,"scale",void 0),Tr(this,"distanceScales",void 0),Tr(this,"viewMatrix",void 0),Tr(this,"projectionMatrix",void 0),Tr(this,"viewProjectionMatrix",void 0),Tr(this,"pixelProjectionMatrix",void 0),Tr(this,"pixelUnprojectionMatrix",void 0),Tr(this,"equals",G=>G instanceof fl?G.width===this.width&&G.height===this.height&&SI(G.projectionMatrix,this.projectionMatrix)&&SI(G.viewMatrix,this.viewMatrix):!1),Tr(this,"project",(G,H={})=>{const{topLeft:J=!0}=H,ue=this.projectPosition(G),q=xse(ue,this.pixelProjectionMatrix),[se,Te]=q,Ue=J?Te:this.height-Te;return G.length===2?[se,Ue]:[se,Ue,q[2]]}),Tr(this,"unproject",(G,H={})=>{const{topLeft:J=!0,targetZ:ue=void 0}=H,[q,se,Te]=G,Ue=J?se:this.height-se,de=ue&&ue*this.distanceScales.unitsPerMeter[2],me=MI([q,Ue,Te],this.pixelUnprojectionMatrix,de),[pe,W,re]=this.unprojectPosition(me);return Number.isFinite(Te)?[pe,W,re]:Number.isFinite(ue)?[pe,W,ue]:[pe,W]}),Tr(this,"projectPosition",G=>{const[H,J]=$u(G),ue=(G[2]||0)*this.distanceScales.unitsPerMeter[2];return[H,J,ue]}),Tr(this,"unprojectPosition",G=>{const[H,J]=qu(G),ue=(G[2]||0)*this.distanceScales.metersPerUnit[2];return[H,J,ue]});let{width:t,height:n,altitude:i=null,fovy:s=null}=e;const{latitude:o=0,longitude:c=0,zoom:f=0,pitch:A=0,bearing:v=0,position:w=null,nearZMultiplier:S=.02,farZMultiplier:F=1.01}=e;t=t||1,n=n||1,s===null&&i===null?(i=Xk,s=L_(i)):s===null?s=L_(i):i===null&&(i=Kk(s));const N=Q2(f);i=Math.max(.75,i);const U=_se({longitude:c,latitude:o}),$=$u([c,o]);$.push(0),w&&dse($,$,gse([],w,U.unitsPerMeter)),this.projectionMatrix=bse({width:t,height:n,scale:N,center:$,pitch:A,fovy:s,nearZMultiplier:S,farZMultiplier:F}),this.viewMatrix=yse({height:n,scale:N,center:$,pitch:A,bearing:v,altitude:i}),this.width=t,this.height=n,this.scale=N,this.latitude=o,this.longitude=c,this.zoom=f,this.pitch=A,this.bearing=v,this.altitude=i,this.fovy=s,this.center=$,this.meterOffset=w||[0,0,0],this.distanceScales=U,this._initMatrices(),Object.freeze(this)}_initMatrices(){const{width:e,height:t,projectionMatrix:n,viewMatrix:i}=this,s=$0();Fb(s,s,n),Fb(s,s,i),this.viewProjectionMatrix=s;const o=$0();$k(o,o,[e/2,-t/2,1]),q2(o,o,[1,-1,0]),Fb(o,o,s);const c=tse($0(),o);if(!c)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=o,this.pixelUnprojectionMatrix=c}projectFlat(e){return $u(e)}unprojectFlat(e){return qu(e)}getMapCenterByLngLatPosition({lngLat:e,pos:t}){const n=MI(t,this.pixelUnprojectionMatrix),i=$u(e),s=Y2([],i,use([],n)),o=Y2([],this.center,s);return qu(o)}fitBounds(e,t={}){const{width:n,height:i}=this,{longitude:s,latitude:o,zoom:c}=wse(Object.assign({width:n,height:i,bounds:e},t));return new fl({width:n,height:i,longitude:s,latitude:o,zoom:c})}getBounds(e){const t=this.getBoundingRegion(e),n=Math.min(...t.map(c=>c[0])),i=Math.max(...t.map(c=>c[0])),s=Math.min(...t.map(c=>c[1])),o=Math.max(...t.map(c=>c[1]));return[[n,s],[i,o]]}getBoundingRegion(e={}){return Tse(this,e.z||0)}getLocationAtPoint({lngLat:e,pos:t}){return this.getMapCenterByLngLatPosition({lngLat:e,pos:t})}}const FI=512;function Ese(r){const{width:e,height:t,pitch:n=0}=r;let{longitude:i,latitude:s,zoom:o,bearing:c=0}=r;(i<-180||i>180)&&(i=BI(i+180,360)-180),(c<-180||c>180)&&(c=BI(c+180,360)-180);const f=tC(t/FI);if(o<=f)o=f,s=0;else{const A=t/2/Math.pow(2,o),v=qu([0,A])[1];if(s<v)s=v;else{const w=qu([0,FI-A])[1];s>w&&(s=w)}}return{width:e,height:t,longitude:i,latitude:s,zoom:o,pitch:n,bearing:c}}const qk=.01,Bse=["longitude","latitude","zoom"],Yk={curve:1.414,speed:1.2};function Sse(r,e,t,n){const{startZoom:i,startCenterXY:s,uDelta:o,w0:c,u1:f,S:A,rho:v,rho2:w,r0:S}=Zk(r,e,n);if(f<qk){const ue={};for(const q of Bse){const se=r[q],Te=e[q];ue[q]=Qie(se,Te,t)}return ue}const F=t*A,N=Math.cosh(S)/Math.cosh(S+v*F),U=c*((Math.cosh(S)*Math.tanh(S+v*F)-Math.sinh(S))/w)/f,$=1/N,G=i+mse($),H=cse([],o,U);Y2(H,H,s);const J=qu(H);return{longitude:J[0],latitude:J[1],zoom:G}}function Ise(r,e,t){const n={...Yk,...t},{screenSpeed:i,speed:s,maxDuration:o}=n,{S:c,rho:f}=Zk(r,e,n),A=1e3*c;let v;return Number.isFinite(i)?v=A/(i/f):v=A/s,Number.isFinite(o)&&v>o?0:v}function Zk(r,e,t){t=Object.assign({},Yk,t);const n=t.curve,i=r.zoom,s=[r.longitude,r.latitude],o=Q2(i),c=e.zoom,f=[e.longitude,e.latitude],A=Q2(c-i),v=$u(s),w=$u(f),S=fse([],w,v),F=Math.max(r.width,r.height),N=F/A,U=lse(S)*o,$=Math.max(U,qk),G=n*n,H=(N*N-F*F+G*G*$*$)/(2*F*G*$),J=(N*N-F*F-G*G*$*$)/(2*N*G*$),ue=Math.log(Math.sqrt(H*H+1)-H),q=Math.log(Math.sqrt(J*J+1)-J),se=(q-ue)/n;return{startZoom:i,startCenterXY:v,uDelta:S,w0:F,u1:U,S:se,rho:n,rho2:G,r0:ue,r1:q}}var Xl=typeof document<"u"?document:{};function DI(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function t0(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2101e%2?DI(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):DI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function OI(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=Mse(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(A){throw A},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2102In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,c;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,c=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw c}}}}function Mse(r,e){if(r){if(typeof r=="string")return LI(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return LI(r,e)}}function LI(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var Pse=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Db(r){if(!r)return null;if(typeof r=="string")return r;r.toJS&&(r=r.toJS());var e={},t=OI(r.layers),n;try{for(t.s();!(n=t.n()).done;){var i=n.value;e[i.id]=i}}catch(o){t.e(o)}finally{t.f()}var s=r.layers.map(function(o){var c=e[o.ref],f=null;if("interactive"in o&&(f=t0({},o),delete f.interactive),c){f=f||t0({},o),delete f.ref;var A=OI(Pse),v;try{for(A.s();!(v=A.n()).done;){var w=v.value;w in c&&(f[w]=c[w])}}catch(S){A.e(S)}finally{A.f()}}return f||o});return t0(t0({},r),{},{layers:s})}var kI={};function Rse(){}function Fse(r){r&&console.error(r.error)}var Qk={container:At.object,gl:At.object,mapboxApiAccessToken:At.string,mapboxApiUrl:At.string,attributionControl:At.bool,preserveDrawingBuffer:At.bool,reuseMaps:At.bool,transformRequest:At.func,mapOptions:At.object,mapStyle:At.oneOfType([At.string,At.object]),preventStyleDiffing:At.bool,visible:At.bool,asyncRender:At.bool,onLoad:At.func,onError:At.func,width:At.number,height:At.number,viewState:At.object,longitude:At.number,latitude:At.number,zoom:At.number,bearing:At.number,pitch:At.number,altitude:At.number},W0={container:Xl.body,mapboxApiAccessToken:Dse(),mapboxApiUrl:"https://api.mapbox.com",preserveDrawingBuffer:!1,attributionControl:!0,reuseMaps:!1,mapOptions:{},mapStyle:"mapbox://styles/mapbox/light-v8",preventStyleDiffing:!1,visible:!0,asyncRender:!1,onLoad:Rse,onError:Fse,width:0,height:0,longitude:0,latitude:0,zoom:0,bearing:0,pitch:0,altitude:1.5};function Dse(){var r=null;if(typeof window<"u"&&window.location){var e=window.location.search.match(/access_token=([^&\/]*)/);r=e&&e[1]}return!r&&typeof process<"u"&&(r=r||kI.MapboxAccessToken||kI.REACT_APP_MAPBOX_ACCESS_TOKEN),r||"no-token"}function NI(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"component";r.debug&&At.checkPropTypes(Qk,r,"prop",e)}var Ch=function(){function r(e){var t=this;if(af(this,r),Tr(this,"props",W0),Tr(this,"width",0),Tr(this,"height",0),Tr(this,"_fireLoadEvent",function(){t.props.onLoad({type:"load",target:t._map})}),Tr(this,"_handleError",function(n){t.props.onError(n)}),!e.mapboxgl)throw new Error("Mapbox not available");this.mapboxgl=e.mapboxgl,r.initialized||(r.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(e)}return of(r,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(t){return this._update(this.props,t),this}},{key:"redraw",value:function(){var t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(t){this._map=r.savedMap;var n=this._map.getContainer(),i=t.container;for(i.classList.add("mapboxgl-map");n.childNodes.length>0;)i.appendChild(n.childNodes[0]);this._map._container=i,r.savedMap=null,t.mapStyle&&this._map.setStyle(Db(t.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(t){if(t.reuseMaps&&r.savedMap)this._reuse(t);else{if(t.gl){var n=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=n,t.gl}}var i={container:t.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:Db(t.mapStyle),interactive:!1,trackResize:!1,attributionControl:t.attributionControl,preserveDrawingBuffer:t.preserveDrawingBuffer};t.transformRequest&&(i.transformRequest=t.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},i,t.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!r.savedMap?(r.savedMap=this._map,this._map.off("load",this._fireLoadEvent),this._map.off("error",this._handleError),this._map.off("styledata",this._fireLoadEvent)):this._map.remove(),this._map=null)}},{key:"_initialize",value:function(t){var n=this;t=Object.assign({},W0,t),NI(t,"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||W0.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=t.mapboxApiUrl,this._create(t);var i=t,s=i.container;Object.defineProperty(s,"offsetWidth",{configurable:!0,get:function(){return n.width}}),Object.defineProperty(s,"clientWidth",{configurable:!0,get:function(){return n.width}}),Object.defineProperty(s,"offsetHeight",{configurable:!0,get:function(){return n.height}}),Object.defineProperty(s,"clientHeight",{configurable:!0,get:function(){return n.height}});var o=this._map.getCanvas();o&&(o.style.outline="none"),this._updateMapViewport({},t),this._updateMapSize({},t),this.props=t}},{key:"_update",value:function(t,n){if(this._map){n=Object.assign({},this.props,n),NI(n,"Mapbox");var i=this._updateMapViewport(t,n),s=this._updateMapSize(t,n);this._updateMapStyle(t,n),!n.asyncRender&&(i||s)&&this.redraw(),this.props=n}}},{key:"_updateMapStyle",value:function(t,n){var i=t.mapStyle!==n.mapStyle;i&&this._map.setStyle(Db(n.mapStyle),{diff:!n.preventStyleDiffing})}},{key:"_updateMapSize",value:function(t,n){var i=t.width!==n.width||t.height!==n.height;return i&&(this.width=n.width,this.height=n.height,this._map.resize()),i}},{key:"_updateMapViewport",value:function(t,n){var i=this._getViewState(t),s=this._getViewState(n),o=s.latitude!==i.latitude||s.longitude!==i.longitude||s.zoom!==i.zoom||s.pitch!==i.pitch||s.bearing!==i.bearing||s.altitude!==i.altitude;return o&&(this._map.jumpTo(this._viewStateToMapboxProps(s)),s.altitude!==i.altitude&&(this._map.transform.altitude=s.altitude)),o}},{key:"_getViewState",value:function(t){var n=t.viewState||t,i=n.longitude,s=n.latitude,o=n.zoom,c=n.pitch,f=c===void 0?0:c,A=n.bearing,v=A===void 0?0:A,w=n.altitude,S=w===void 0?1.5:w;return{longitude:i,latitude:s,zoom:o,pitch:f,bearing:v,altitude:S}}},{key:"_checkStyleSheet",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"0.47.0";if(!(typeof Xl>"u"))try{var n=Xl.createElement("div");n.className="mapboxgl-map",n.style.display="none",Xl.body.appendChild(n);var i=window.getComputedStyle(n).position!=="static";if(!i){var s=Xl.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(t,"/mapbox-gl.css")),Xl.head.appendChild(s)}}catch{}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}}]),r}();Tr(Ch,"initialized",!1);Tr(Ch,"propTypes",Qk);Tr(Ch,"defaultProps",W0);Tr(Ch,"savedMap",null);var J0={exports:{}},Ose=J0.exports,UI;function Lse(){return UI||(UI=1,function(r,e){(function(t,n){r.exports=n()})(Ose,function(){var t,n,i;function s(o,c){if(!t)t=c;else if(!n)n=c;else{var f="var sharedChunk = {}; ("+t+")(sharedChunk); ("+n+")(sharedChunk);",A={};t(A),i=c(A),typeof window<"u"&&(i.workerUrl=window.URL.createObjectURL(new Blob([f],{type:"text/javascript"})))}}return s(["exports"],function(o){function c(a,u){return a(u={exports:{}},u.exports),u.exports}var f=A;function A(a,u,p,x){this.cx=3*a,this.bx=3*(p-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*u,this.by=3*(x-u)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=x,this.p2x=p,this.p2y=x}A.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},A.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},A.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},A.prototype.solveCurveX=function(a,u){var p,x,E,I,D;for(u===void 0&&(u=1e-6),E=a,D=0;D<8;D++){if(I=this.sampleCurveX(E)-a,Math.abs(I)<u)return E;var k=this.sampleCurveDerivativeX(E);
2102if(Math.abs(k)<1e-6)break;E-=I/k}if((E=a)<(p=0))return p;if(E>(x=1))return x;for(;p<x;){if(I=this.sampleCurveX(E),Math.abs(I-a)<u)return E;a>I?p=E:x=E,E=.5*(x-p)+p}return E},A.prototype.solve=function(a,u){return this.sampleCurveY(this.solveCurveX(a,u))};var v=w;function w(a,u){this.x=a,this.y=u}w.prototype={clone:function(){return new w(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,u){return this.clone()._rotateAround(a,u)},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 u=a.x-this.x,p=a.y-this.y;return u*u+p*p},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,u){return Math.atan2(this.x*u-this.y*a,this.x*a+this.y*u)},_matMult:function(a){var u=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=u,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 u=Math.cos(a),p=Math.sin(a),x=p*this.x+u*this.y;return this.x=u*this.x-p*this.y,this.y=x,this},_rotateAround:function(a,u){var p=Math.cos(a),x=Math.sin(a),E=u.y+x*(this.x-u.x)+p*(this.y-u.y);return this.x=u.x+p*(this.x-u.x)-x*(this.y-u.y),this.y=E,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},w.convert=function(a){return a instanceof w?a:Array.isArray(a)?new w(a[0],a[1]):a};var S=typeof self<"u"?self:{},F=Math.pow(2,53)-1;function N(a,u,p,x){var E=new f(a,u,p,x);return function(I){return E.solve(I)}}var U=N(.25,.1,.25,1);function $(a,u,p){return Math.min(p,Math.max(u,a))}function G(a,u,p){var x=p-u,E=((a-u)%x+x)%x+u;return E===u?p:E}function H(a){for(var u=[],p=arguments.length-1;p-- >0;)u[p]=arguments[p+1];for(var x=0,E=u;x<E.length;x+=1){var I=E[x];for(var D in I)a[D]=I[D]}return a}var J=1;function ue(){return J++}function q(){return function a(u){return u?(u^16*Math.random()>>u/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,a)}()}function se(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 Te(a,u){a.forEach(function(p){u[p]&&(u[p]=u[p].bind(u))})}function Ue(a,u){return a.indexOf(u,a.length-u.length)!==-1}function de(a,u,p){var x={};for(var E in a)x[E]=u.call(p||this,a[E],E,a);return x}function me(a,u,p){var x={};for(var E in a)u.call(p||this,a[E],E,a)&&(x[E]=a[E]);return x}function pe(a){return Array.isArray(a)?a.map(pe):typeof a=="object"&&a?de(a,pe):a}var W={};function re(a){W[a]||(typeof console<"u"&&console.warn(a),W[a]=!0)}function Ee(a,u,p){return(p.y-a.y)*(u.x-a.x)>(u.y-a.y)*(p.x-a.x)}function et(a){for(var u=0,p=0,x=a.length,E=x-1,I=void 0,D=void 0;p<x;E=p++)u+=((D=a[E]).x-(I=a[p]).x)*(I.y+D.y);return u}function _e(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Le(a){var u={};if(a.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(x,E,I,D){var k=I||D;return u[E]=!k||k.toLowerCase(),""}),u["max-age"]){var p=parseInt(u["max-age"],10);isNaN(p)?delete u["max-age"]:u["max-age"]=p}return u}var Ge=null;function Ze(a){if(Ge==null){var u=a.navigator?a.navigator.userAgent:null;Ge=!!a.safari||!(!u||!(/\b(iPad|iPhone|iPod)\b/.test(u)||u.match("Safari")&&!u.match("Chrome")))}return Ge}function tt(a){try{var u=S[a];return u.setItem("_mapbox_test_",1),u.removeItem("_mapbox_test_"),!0}catch{return!1}}var rt,ut,vt,St,st=S.performance&&S.performance.now?S.performance.now.bind(S.performance):Date.now.bind(Date),dr=S.requestAnimationFrame||S.mozRequestAnimationFrame||S.webkitRequestAnimationFrame||S.msRequestAnimationFrame,er=S.cancelAnimationFrame||S.moz
2102CancelAnimationFrame||S.webkitCancelAnimationFrame||S.msCancelAnimationFrame,Kt={now:st,frame:function(a){var u=dr(a);return{cancel:function(){return er(u)}}},getImageData:function(a,u){u===void 0&&(u=0);var p=S.document.createElement("canvas"),x=p.getContext("2d");if(!x)throw new Error("failed to create canvas 2d context");return p.width=a.width,p.height=a.height,x.drawImage(a,0,0,a.width,a.height),x.getImageData(-u,-u,a.width+2*u,a.height+2*u)},resolveURL:function(a){return rt||(rt=S.document.createElement("a")),rt.href=a,rt.href},hardwareConcurrency:S.navigator&&S.navigator.hardwareConcurrency||4,get devicePixelRatio(){return S.devicePixelRatio},get prefersReducedMotion(){return!!S.matchMedia&&(ut==null&&(ut=S.matchMedia("(prefers-reduced-motion: reduce)")),ut.matches)}},Nt={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},Ar={supported:!1,testSupport:function(a){!ln&&St&&(Pr?xr(a):vt=a)}},ln=!1,Pr=!1;function xr(a){var u=a.createTexture();a.bindTexture(a.TEXTURE_2D,u);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,St),a.isContextLost())return;Ar.supported=!0}
2102catch{}a.deleteTexture(u),ln=!0}S.document&&((St=S.document.createElement("img")).onload=function(){vt&&xr(vt),vt=null,Pr=!0},St.onerror=function(){ln=!0,vt=null},St.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var Vn="01",_r=function(a,u){this._transformRequestFn=a,this._customAccessToken=u,this._createSkuToken()};function yr(a){return a.indexOf("mapbox:")===0}_r.prototype._createSkuToken=function(){var a=function(){for(var u="",p=0;p<10;p++)u+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Vn,u].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=a.token,this._skuTokenExpiresAt=a.tokenExpiresAt},_r.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},_r.prototype.transformRequest=function(a,u){return this._transformRequestFn&&this._transformRequestFn(a,u)||{url:a}},_r.prototype.normalizeStyleURL=function(a,u){if(!yr(a))return a;var p=Yn(a);return p.path="/styles/v1"+p.path,this._makeAPIURL(p,this._customAccessToken||u)},_r.prototype.normalizeGlyphsURL=function(a,u){if(!yr(a))return a;var p=Yn(a);return p.path="/fonts/v1"+p.path,this._makeAPIURL(p,this._customAccessToken||u)},_r.prototype.normalizeSourceURL=function(a,u){if(!yr(a))return a;var p=Yn(a);return p.path="/v4/"+p.authority+".json",p.params.push("secure"),this._makeAPIURL(p,this._customAccessToken||u)},_r.prototype.normalizeSpriteURL=function(a,u,p,x){var E=Yn(a);return yr(a)?(E.path="/styles/v1"+E.path+"/sprite"+u+p,this._makeAPIURL(E,this._customAccessToken||x)):(E.path+=""+u+p,mn(E))},_r.prototype.normalizeTileURL=function(a,u){if(this._isSkuTokenExpired()&&this._createSkuToken(),a&&!yr(a))return a;var p=Yn(a);p.path=p.path.replace(/(\.(png|jpg)\d*)(?=$)/,(Kt.devicePixelRatio>=2||u===512?"@2x":"")+(Ar.supported?".webp":"$1")),p.path=p.path.replace(/^.+\/v4\//,"/"),p.path="/v4"+p.path;var x=this._customAccessToken||function(E){for(var I=0,D=E;I<D.length;I+=1){var k=D[I].match(/^access_token=(.*)$/);if(k)return k[1]}return null}(p.params)||Nt.ACCESS_TOKEN;return Nt.REQUIRE_ACCESS_TOKEN&&x&&this._skuToken&&p.params.push("sku="+this._skuToken),this._makeAPIURL(p,x)},_r.prototype.canonicalizeTileURL=function(a,u){var p=Yn(a);if(!p.path.match(/(^\/v4\/)/)||!p.path.match(/\.[\w]+$/))return a;var x="mapbox://tiles/";x+=p.path.replace("/v4/","");var E=p.params;return u&&(E=E.filter(function(I){return!I.match(/^access_token=/)})),E.length&&(x+="?"+E.join("&")),x},_r.prototype.canonicalizeTileset=function(a,u){for(var p=!!u&&yr(u),x=[],E=0,I=a.tiles||[];E<I.length;E+=1){var D=I[E];Dr(D)?x.push(this.canonicalizeTileURL(D,p)):x.push(D)}return x},_r.prototype._makeAPIURL=function(a,u){var p="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",x=Yn(Nt.API_URL);if(a.protocol=x.protocol,a.authority=x.authority,a.protocol==="http"){var E=a.params.indexOf("secure");E>=0&&a.params.splice(E,1)}if(x.path!=="/"&&(a.path=""+x.path+a.path),!Nt.REQUIRE_ACCESS_TOKEN)return mn(a);if(!(u=u||Nt.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+p);if(u[0]==="s")throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+p);return a.params=a.params.filter(function(I){return I.indexOf("access_token")===-1}),a.params.push("access_token="+u),mn(a)};var un=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function Dr(a){return un.test(a)}var ci=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Yn(a){var u=a.match(ci);if(!u)throw new Error("Unable to parse URL object");return{protocol:u[1],authority:u[2],path:u[3]||"/",params:u[4]?u[4].split("&"):[]}}function mn(a){var u=a.params.length?"?"+a.params.join("&"):"";return a.protocol+"://"+a.authority+a.path+u}function ti(a){if(!a)return null;var u=a.split(".");if(!u||u.length!==3)return null;try{return JSON.parse(decodeURIComponent(S.atob(u[1]).split("").map(function(p){return"%"+("00"+p.charCodeAt(0).toString(16)).slice(-2)}).join("")))}catch{return null}}var Hn=function(a){this.type=a,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};Hn.prototype.getStorageKey=function(a){var u,p=ti(Nt.ACCESS_TOKEN);return u=p&&p.u?S.btoa(encodeURIComponent(p.u).replace(/%([0-9A-F]{2})/g,function(x,E){return String.fromCharCode(+("0x"+E))})):Nt.ACCESS_TOKEN||"",a?"mapbox.eventData."+a+":"+u:"mapbox.eventData:"+u},Hn.prototype.fetchEventData=function(){var a=tt("localStorage"),u=this.getStorageKey(),p=this.getStorageKey("uuid");if(a)try{var x=S.localStorage.getItem(u);x&&(this.eventData=JSON.parse(x));var E=S.localStorage.getItem(p);E&&(this.anonId=E)}catch{re("Unable to read from LocalStorage")}},Hn.prototype.saveEventData=function(){var a=tt("localStorage"),u=this.getStorageKey(),p=this.getStorageKey("uuid");if(a)try{S.localStorage.setItem(p,this.anonId),Object.keys(this.eventData).length>=1&&S.localStorage.setItem(u,JSON.stringify(this.eventData))}catch{re("Unable to write to LocalStorage")}},Hn.prototype.processRequests=function(a){},Hn.prototype.postEvent=function(a,u,p,x){var E=this;if(Nt.EVENTS_URL){var I=Yn(Nt.EVENTS_URL);I.params.push("access_token="+(x||Nt.ACCESS_TOKEN||""));var D={event:this.type,created:new Date(a).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.13.3",skuId:Vn,userId:this.anonId},k=u?H(D,u):D,V={url:mn(I),headers:{"Content-Type":"text/plain"},body:JSON.stringify([k])};this.pendingRequest=lt(V,function(K){E.pendingRequest=null,p(K),E.saveEventData(),E.processRequests(x)})}},Hn.prototype.queueRequest=function(a,u){this.queue.push(a),this.processRequests(u)};var Bn,Zn,Vt=function(a){function u(){a.call(this,"map.load"),this.success={},this.skuToken=""}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.postMapLoadEvent=function(p,x,E,I){this.skuToken=E;var D=!(!I&&!Nt.ACCESS_TOKEN),k=Array.isArray(p)&&p.some(function(V){return yr(V)||Dr(V)});Nt.EVENTS_URL&&D&&k&&this.queueRequest({id:x,timestamp:Date.now()},I)},u.prototype.processRequests=function(p){var x=this;if(!this.pendingRequest&&this.queue.length!==0){var E=this.queue.shift(),I=E.id,D=E.timestamp;I&&this.success[I]||(this.anonId||this.fetchEventData(),se(this.anonId)||(this.anonId=q()),this.postEvent(D,{skuToken:this.skuToken},function(k){k||I&&(x.success[I]=!0)},p))}},u}(Hn),mr=new(function(a){function u(p){a.call(this,"appUserTurnstile"),this._customAccessToken=p}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.postTurnstileEvent=function(p,x){Nt.EVENTS_URL&&Nt.ACCESS_TOKEN&&Array.isArray(p)&&p.some(function(E){return yr(E)||Dr(E)})&&this.queueRequest(Date.now(),x)},u.prototype.processRequests=function(p){var x=this;if(!this.pendingRequest&&this.queue.length!==0){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var E=ti(Nt.ACCESS_TOKEN),I=E?E.u:Nt.ACCESS_TOKEN,D=I!==this.eventData.tokenU;se(this.anonId)||(this.anonId=q(),D=!0);var k=this.queue.shift();if(this.eventData.lastSuccess){var V=new Date(this.eventData.lastSuccess),K=new Date(k),Q=(k-this.eventData.lastSuccess)/864e5;D=D||Q>=1||Q<-1||V.getDate()!==K.getDate()}else D=!0;if(!D)return this.processRequests();this.postEvent(k,{"enabled.telemetry":!1},function(ie){ie||(x.eventData.lastSuccess=k,x.eventData.tokenU=I)},p)}},u}(Hn)),Rr=mr.postTurnstileEvent.bind(mr),nn=new Vt,_i=nn.postMapLoadEvent.bind(nn),Me=500,kt=50;function $t(){S.caches&&!Bn&&(Bn=S.caches.open("mapbox-tiles"))}function lr(a){var u=a.indexOf("?");return u<0?a:a.slice(0,u)}var Ye,Rt=1/0;function Ae(){return Ye==null&&(Ye=S.OffscreenCanvas&&new S.OffscreenCanvas(1,1).getContext("2d")&&typeof S.createImageBitmap=="function"),Ye}var Gt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Gt);var Tt=function(a){function u(p,x,E){x===401&&Dr(E)&&(p+=": you may have provided an invali
2102d Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),a.call(this,p),this.status=x,this.url=E,this.name=this.constructor.name,this.message=p}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},u}(Error),j=_e()?function(){return self.worker&&self.worker.referrer}:function(){return(S.location.protocol==="blob:"?S.parent:S).location.href},bt,Bt,Ce=function(a,u){if(!(/^file:/.test(p=a.url)||/^file:/.test(j())&&!/^\w+:/.test(p))){if(S.fetch&&S.Request&&S.AbortController&&S.Request.prototype.hasOwnProperty("signal"))return function(x,E){var I,D=new S.AbortController,k=new S.Request(x.url,{method:x.method||"GET",body:x.body,credentials:x.credentials,headers:x.headers,referrer:j(),signal:D.signal}),V=!1,K=!1,Q=(I=k.url).indexOf("sku=")>0&&Dr(I);x.type==="json"&&k.headers.set("Accept","application/json");var ie=function(ye,ke,Ne){if(!K){if(ye&&ye.message!=="SecurityError"&&re(ye),ke&&Ne)return fe(ke);var je=Date.now();S.fetch(k).then(function(Ve){if(Ve.ok){var qe=Q?Ve.clone():null;return fe(Ve,qe,je)}return E(new Tt(Ve.statusText,Ve.status,x.url))}).catch(function(Ve){Ve.code!==20&&E(new Error(Ve.message))})}},fe=function(ye,ke,Ne){(x.type==="arrayBuffer"?ye.arrayBuffer():x.type==="json"?ye.json():ye.text()).then(function(je){K||(ke&&Ne&&function(Ve,qe,ct){if($t(),Bn){var mt={status:qe.status,statusText:qe.statusText,headers:new S.Headers};qe.headers.forEach(function(Ft,jt){return mt.headers.set(jt,Ft)});var yt=Le(qe.headers.get("Cache-Control")||"");yt["no-store"]||(yt["max-age"]&&mt.headers.set("Expires",new Date(ct+1e3*yt["max-age"]).toUTCString()),new Date(mt.headers.get("Expires")).getTime()-ct<42e4||function(Ft,jt){if(Zn===void 0)try{new Response(new ReadableStream),Zn=!0}catch{Zn=!1}Zn?jt(Ft.body):Ft.blob().then(jt)}(qe,function(Ft){var jt=new S.Response(Ft,mt);$t(),Bn&&Bn.then(function(qt){return qt.put(lr(Ve.url),jt)}).catch(function(qt){return re(qt.message)})}))}}(k,ke,Ne),V=!0,E(null,je,ye.headers.get("Cache-Control"),ye.headers.get("Expires")))}).catch(function(je){K||E(new Error(je.message))})};return Q?function(ye,ke){if($t(),!Bn)return ke(null);var Ne=lr(ye.url);Bn.then(function(je){je.match(Ne).then(function(Ve){var qe=function(ct){if(!ct)return!1;var mt=new Date(ct.headers.get("Expires")||0),yt=Le(ct.headers.get("Cache-Control")||"");return mt>Date.now()&&!yt["no-cache"]}(Ve);je.delete(Ne),qe&&je.put(Ne,Ve.clone()),ke(null,Ve,qe)}).catch(ke)}).catch(ke)}(k,ie):ie(null,null),{cancel:function(){K=!0,V||D.abort()}}}(a,u);if(_e()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",a,u,void 0,!0)}var p;return function(x,E){var I=new S.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(){E(new Error(I.statusText))},I.onload=function(){if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){var k=I.response;if(x.type==="json")try{k=JSON.parse(I.response)}catch(V){return E(V)}E(null,k,I.getResponseHeader("Cache-Control"),I.getResponseHeader("Expires"))}else E(new Tt(I.statusText,I.status,x.url))},I.send(x.body),{cancel:function(){return I.abort()}}}(a,u)},Je=function(a,u){return Ce(H(a,{type:"arrayBuffer"}),u)},lt=function(a,u){return Ce(H(a,{method:"POST"}),u)},Y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";bt=[],Bt=0;var ne=function(a,u){if(Ar.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),Bt>=Nt.MAX_PARALLEL_IMAGE_REQUESTS){var p={requestParameters:a,callback:u,cancelled:!1,cancel:function(){this.cancelled=!0}};return bt.push(p),p}Bt++;var x=!1,E=function(){if(!x)for(x=!0,Bt--;bt.length&&Bt<Nt.MAX_PARALLEL_IMAGE_REQUESTS;){var D=bt.shift();D.cancelled||(D.cancel=ne(D.requestParameters,D.callback).cancel)}},I=Je(a,function(D,k,V,K){E(),D?u(D):k&&(Ae()?function(Q,ie){var fe=new S.Blob([new Uint8Array(Q)],{type:"image/png"});S.createImageBitmap(fe).then(function(ye){ie(null,ye)}).catch(function(ye){ie(new Error("Could not load image because of "+ye.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))})}(k,u):function(Q,ie,fe,ye){var ke=new S.Image,Ne=S.URL;ke.onload=function(){ie(null,ke),Ne.revokeObjectURL(ke.src),ke.onload=null,S.requestAnimationFrame(function(){ke.src=Y})}
2102,ke.onerror=function(){return ie(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 je=new S.Blob([new Uint8Array(Q)],{type:"image/png"});ke.cacheControl=fe,ke.expires=ye,ke.src=Q.byteLength?Ne.createObjectURL(je):Y}(k,u,V,K))});return{cancel:function(){I.cancel(),E()}}};function le(a,u,p){p[a]&&p[a].indexOf(u)!==-1||(p[a]=p[a]||[],p[a].push(u))}function ve(a,u,p){if(p&&p[a]){var x=p[a].indexOf(u);x!==-1&&p[a].splice(x,1)}}var Oe=function(a,u){u===void 0&&(u={}),H(this,u),this.type=a},he=function(a){function u(p,x){x===void 0&&(x={}),a.call(this,"error",H({error:p},x))}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u}(Oe),be=function(){};be.prototype.on=function(a,u){return this._listeners=this._listeners||{},le(a,u,this._listeners),this},be.prototype.off=function(a,u){return ve(a,u,this._listeners),ve(a,u,this._oneTimeListeners),this},be.prototype.once=function(a,u){return this._oneTimeListeners=this._oneTimeListeners||{},le(a,u,this._oneTimeListeners),this},be.prototype.fire=function(a,u){typeof a=="string"&&(a=new Oe(a,u||{}));var p=a.type;if(this.listens(p)){a.target=this;for(var x=0,E=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];x<E.length;x+=1)E[x].call(this,a);for(var I=0,D=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];I<D.length;I+=1){var k=D[I];ve(p,k,this._oneTimeListeners),k.call(this,a)}var V=this._eventedParent;V&&(H(a,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),V.fire(a))}else a instanceof he&&console.error(a.error);return this},be.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)},be.prototype.setEventedParent=function(a,u){return this._eventedParent=a,this._eventedParentData=u,this};var ae
vendor: 19,005 bytes, line 2102
2102={$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"}
vendor: 9,823 bytes, line 2102
2102,"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"}}}
2102,Be=function(a,u,p,x){this.message=(a?a+": ":"")+p,x&&(this.identifier=x),u!=null&&u.__line__&&(this.line=u.__line__)};function g(a){var u=a.value;return u?[new Be(a.key,u,"constants have been deprecated as of v8")]:[]}function ce(a){for(var u=[],p=arguments.length-1;p-- >0;)u[p]=arguments[p+1];for(var x=0,E=u;x<E.length;x+=1){var I=E[x];for(var D in I)a[D]=I[D]}return a}function xt(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function Ke(a){if(Array.isArray(a))return a.map(Ke);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){var u={};for(var p in a)u[p]=Ke(a[p]);return u}return xt(a)}var Et=function(a){function u(p,x){a.call(this,x),this.message=x,this.key=p}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u}(Error),Pt=function(a,u){u===void 0&&(u=[]),this.parent=a,this.bindings={};for(var p=0,x=u;p<x.length;p+=1){var E=x[p];this.bindings[E[0]]=E[1]}};Pt.prototype.concat=function(a){return new Pt(this,a)}
2102,Pt.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.")},Pt.prototype.has=function(a){return!!this.bindings[a]||!!this.parent&&this.parent.has(a)};var Ot={kind:"null"},ht={kind:"number"},Lt={kind:"string"},Mt={kind:"boolean"},Ht={kind:"color"},Ur={kind:"object"},Qt={kind:"value"},en={kind:"collator"},cn={kind:"formatted"},Wr={kind:"resolvedImage"};function Jr(a,u){return{kind:"array",itemType:a,N:u}}function Vr(a){if(a.kind==="array"){var u=Vr(a.itemType);return typeof a.N=="number"?"array<"+u+", "+a.N+">":a.itemType.kind==="value"?"array":"array<"+u+">"}return a.kind}var yi=[Ot,ht,Lt,Mt,Ht,cn,Ur,Jr(Qt),Wr];function Xr(a,u){if(u.kind==="error")return null;if(a.kind==="array"){if(u.kind==="array"&&(u.N===0&&u.itemType.kind==="value"||!Xr(a.itemType,u.itemType))&&(typeof a.N!="number"||a.N===u.N))return null}else{if(a.kind===u.kind)return null;if(a.kind==="value"){for(var p=0,x=yi;p<x.length;p+=1)if(!Xr(x[p],u))return null}}return"Expected "+Vr(a)+" but found "+Vr(u)+" instead."}function pr(a,u){return u.some(function(p){return p.kind===a.kind})}function Ie(a,u){return u.some(function(p){return p==="null"?a===null:p==="array"?Array.isArray(a):p==="object"?a&&!Array.isArray(a)&&typeof a=="object":p===typeof a})}var Xt=c(function(a,u){var p={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(k){return(k=Math.round(k))<0?0:k>255?255:k}function E(k){return x(k[k.length-1]==="%"?parseFloat(k)/100*255:parseInt(k))}function I(k){return(V=k[k.length-1]==="%"?parseFloat(k)/100:parseFloat(k))<0?0:V>1?1:V;var V}function D(k,V,K){return K<0?K+=1:K>
21021&&(K-=1),6*K<1?k+(V-k)*K*6:2*K<1?V:3*K<2?k+(V-k)*(2/3-K)*6:k}try{u.parseCSSColor=function(k){var V,K=k.replace(/ /g,"").toLowerCase();if(K in p)return p[K].slice();if(K[0]==="#")return K.length===4?(V=parseInt(K.substr(1),16))>=0&&V<=4095?[(3840&V)>>4|(3840&V)>>8,240&V|(240&V)>>4,15&V|(15&V)<<4,1]:null:K.length===7&&(V=parseInt(K.substr(1),16))>=0&&V<=16777215?[(16711680&V)>>16,(65280&V)>>8,255&V,1]:null;var Q=K.indexOf("("),ie=K.indexOf(")");if(Q!==-1&&ie+1===K.length){var fe=K.substr(0,Q),ye=K.substr(Q+1,ie-(Q+1)).split(","),ke=1;switch(fe){case"rgba":if(ye.length!==4)return null;ke=I(ye.pop());case"rgb":return ye.length!==3?null:[E(ye[0]),E(ye[1]),E(ye[2]),ke];case"hsla":if(ye.length!==4)return null;ke=I(ye.pop());case"hsl":if(ye.length!==3)return null;var Ne=(parseFloat(ye[0])%360+360)%360/360,je=I(ye[1]),Ve=I(ye[2]),qe=Ve<=.5?Ve*(je+1):Ve+je-Ve*je,ct=2*Ve-qe;return[x(255*D(ct,qe,Ne+1/3)),x(255*D(ct,qe,Ne)),x(255*D(ct,qe,Ne-1/3)),ke];default:return null}}return null}}catch{}}).parseCSSColor,tn=function(a,u,p,x){x===void 0&&(x=1),this.r=a,this.g=u,this.b=p,this.a=x};tn.parse=function(a){if(a){if(a instanceof tn)return a;if(typeof a=="string"){var u=Xt(a);if(u)return new tn(u[0]/255*u[3],u[1]/255*u[3],u[2]/255*u[3],u[3])}}},tn.prototype.toString=function(){var a=this.toArray(),u=a[1],p=a[2],x=a[3];return"rgba("+Math.round(a[0])+","+Math.round(u)+","+Math.round(p)+","+x+")"},tn.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]},tn.black=new tn(0,0,0,1),tn.white=new tn(1,1,1,1),tn.transparent=new tn(0,0,0,0),tn.red=new tn(1,0,0,1);var $i=function(a,u,p){this.sensitivity=a?u?"variant":"case":u?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};$i.prototype.compare=function(a,u){return this.collator.compare(a,u)},$i.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ya=function(a,u,p,x,E){this.text=a,this.image=u,this.scale=p,this.fontStack=x,this.textColor=E},li=function(a){this.sections=a};li.fromString=function(a){return new li([new ya(a,null,null,null,null)])},li.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})},li.factory=function(a){return a instanceof li?a:li.fromString(a)},li.prototype.toString=function(){return this.sections.length===0?"":this.sections.map(function(a){return a.text}).join("")},li.prototype.serialize=function(){for(var a=["format"],u=0,p=this.sections;u<p.length;u+=1){var x=p[u];if(x.image)a.push(["image",x.image.name]);else{a.push(x.text);var E={};x.fontStack&&(E["text-font"]=["literal",x.fontStack.split(",")]),x.scale&&(E["font-scale"]=x.scale),x.textColor&&(E["text-color"]=["rgba"].concat(x.textColor.toArray())),a.push(E)}}return a};var jn=function(a){this.name=a.name,this.available=a.available};function Se(a,u,p,x){return typeof a=="number"&&a>=0&&a<=255&&typeof u=="number"&&u>=0&&u<=255&&typeof p=="number"&&p>=0&&p<=255?x===void 0||typeof x=="number"&&x>=0&&x<=1?null:"Invalid rgba value ["+[a,u,p,x].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+(typeof x=="number"?[a,u,p,x]:[a,u,p]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function $o(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof tn||a instanceof $i||a instanceof li||a instanceof jn)return!0;if(Array.isArray(a)){for(var u=0,p=a;u<p.length;u+=1)if(!$o(p[u]))return!1;return!0}if(typeof a=="object"){for(var x in a)if(!$o(a[x]))return!1;return!0}return!1}function $n(a){if(a===null)return Ot;if(typeof a=="string")return Lt;if(typeof a=="boolean")return Mt;if(typeof a=="number")return ht;if(a instanceof tn)return Ht;if(a instanceof $i)return en;if(a instanceof li)return cn;if(a instanceof jn)return Wr;if(Array.isArray(a)){for(var u,p=a.length,x=0,E=a;x<E.length;x+=1){var I=$n(E[x]);if(u){if(u===I)continue;u=Qt;break}u=I}return Jr(u||Qt,p)}return Ur}function Wo(a){var u=typeof a;return a===null?"":u==="string"||u==="number"||u==="boolean"?String(a):a instanceof tn||a instanceof li||a instanceof jn?a.toString():JSON.stringify(a)}jn.prototype.toString=function(){return this.name},jn.fromString=function(a){return a?new jn({name:a,available:!1}):null},jn.prototype.serialize=function(){return["image",this.name]};var Oi=function(a,u){this.type=a,this.value=u};Oi.parse=function(a,u){if(a.length!==2)return u.error("'literal' expression requires exactly one argument, but found "+(a.length-1)+" instead.");if(!$o(a[1]))return u.error("invalid value");var p=a[1],x=$n(p),E=u.expectedType;return x.kind!=="array"||x.N!==0||!E||E.kind!=="array"||typeof E.N=="number"&&E.N!==0||(x=E),new Oi(x,p)},Oi.prototype.evaluate=function(){return this.value},Oi.prototype.eachChild=function(){},Oi.prototype.outputDefined=function(){return!0},Oi.prototype.serialize=function(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof tn?["rgba"].concat(this.value.toArray()):this.value instanceof li?this.value.serialize():this.value};var ui=function(a){this.name="ExpressionEvaluationError",this.message=a};ui.prototype.toJSON=function(){return this.message};var Ii={string:Lt,number:ht,boolean:Mt,object:Ur},Rn=function(a,u){this.type=a,this.args=u};Rn.parse=function(a,u){if(a.length<2)return u.error("Expected at least one argument.");var p,x=1,E=a[0];if(E==="array"){var I,D;if(a.length>2){var k=a[1];if(typeof k!="string"||!(k in Ii)||k==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);I=Ii[k],x++}else I=Qt;if(a.length>3){if(a[2]!==null&&(typeof a[2]!="number"||a[2]<0||a[2]!==Math.floor(a[2])))return u.error('The length argument to "array" must be a positive integer literal',2);D=a[2],x++}p=Jr(I,D)}else p=Ii[E];for(var V=[];x<a.length;x++){var K=u.parse(a[x],x,Qt);if(!K)return null;V.push(K)}return new Rn(p,V)},Rn.prototype.evaluate=function(a){for(var u=0;u<this.args.length;u++){var p=this.args[u].evaluate(a);
2102if(!Xr(this.type,$n(p)))return p;if(u===this.args.length-1)throw new ui("Expected value to be of type "+Vr(this.type)+", but found "+Vr($n(p))+" instead.")}return null},Rn.prototype.eachChild=function(a){this.args.forEach(a)},Rn.prototype.outputDefined=function(){return this.args.every(function(a){return a.outputDefined()})},Rn.prototype.serialize=function(){var a=this.type,u=[a.kind];if(a.kind==="array"){var p=a.itemType;if(p.kind==="string"||p.kind==="number"||p.kind==="boolean"){u.push(p.kind);var x=a.N;(typeof x=="number"||this.args.length>1)&&u.push(x)}}return u.concat(this.args.map(function(E){return E.serialize()}))};var ms=function(a){this.type=cn,this.sections=a};ms.parse=function(a,u){if(a.length<2)return u.error("Expected at least one argument.");var p=a[1];if(!Array.isArray(p)&&typeof p=="object")return u.error("First argument must be an image or text section.");for(var x=[],E=!1,I=1;I<=a.length-1;++I){var D=a[I];if(E&&typeof D=="object"&&!Array.isArray(D)){E=!1;var k=null;if(D["font-scale"]&&!(k=u.parse(D["font-scale"],1,ht)))return null;var V=null;if(D["text-font"]&&!(V=u.parse(D["text-font"],1,Jr(Lt))))return null;var K=null;if(D["text-color"]&&!(K=u.parse(D["text-color"],1,Ht)))return null;var Q=x[x.length-1];Q.scale=k,Q.font=V,Q.textColor=K}else{var ie=u.parse(a[I],1,Qt);if(!ie)return null;var fe=ie.type.kind;if(fe!=="string"&&fe!=="value"&&fe!=="null"&&fe!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");E=!0,x.push({content:ie,scale:null,font:null,textColor:null})}}return new ms(x)},ms.prototype.evaluate=function(a){return new li(this.sections.map(function(u){var p=u.content.evaluate(a);return $n(p)===Wr?new ya("",p,null,null,null):new ya(Wo(p),null,u.scale?u.scale.evaluate(a):null,u.font?u.font.evaluate(a).join(","):null,u.textColor?u.textColor.evaluate(a):null)}))},ms.prototype.eachChild=function(a){for(var u=0,p=this.sections;u<p.length;u+=1){var x=p[u];a(x.content),x.scale&&a(x.scale),x.font&&a(x.font),x.textColor&&a(x.textColor)}},ms.prototype.outputDefined=function(){return!1},ms.prototype.serialize=function(){for(var a=["format"],u=0,p=this.sections;u<p.length;u+=1){var x=p[u];a.push(x.content.serialize());var E={};x.scale&&(E["font-scale"]=x.scale.serialize()),x.font&&(E["text-font"]=x.font.serialize()),x.textColor&&(E["text-color"]=x.textColor.serialize()),a.push(E)}return a};var Wi=function(a){this.type=Wr,this.input=a};Wi.parse=function(a,u){if(a.length!==2)return u.error("Expected two arguments.");var p=u.parse(a[1],1,Lt);return p?new Wi(p):u.error("No image name provided.")},Wi.prototype.evaluate=function(a){var u=this.input.evaluate(a),p=jn.fromString(u);return p&&a.availableImages&&(p.available=a.availableImages.indexOf(u)>-1),p},Wi.prototype.eachChild=function(a){a(this.input)},Wi.prototype.outputDefined=function(){return!1},Wi.prototype.serialize=function(){return["image",this.input.serialize()]};var Ns={"to-boolean":Mt,"to-color":Ht,"to-number":ht,"to-string":Lt},Sn=function(a,u){this.type=a,this.args=u};Sn.parse=function(a,u){if(a.length<2)return u.error("Expected at least one argument.");var p=a[0];if((p==="to-boolean"||p==="to-string")&&a.length!==2)return u.error("Expected one argument.");for(var x=Ns[p],E=[],I=1;I<a.length;I++){var D=u.parse(a[I],I,Qt);if(!D)return null;E.push(D)}return new Sn(x,E)},Sn.prototype.evaluate=function(a){if(this.type.kind==="boolean")return!!this.args[0].evaluate(a);if(this.type.kind==="color"){for(var u,p,x=0,E=this.args;x<E.length;x+=1){if(p=null,(u=E[x].evaluate(a))instanceof tn)return u;if(typeof u=="string"){var I=a.parseColor(u);if(I)return I}else if(Array.isArray(u)&&!(p=u.length<3||u.length>4?"Invalid rbga value "+JSON.stringify(u)+": expected an array containing either three or four numeric values.":Se(u[0],u[1],u[2],u[3])))return new tn(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new ui(p||"Could not parse color from value '"+(typeof u=="string"?u:String(JSON.stringify(u)))+"'")}if(this.type.kind==="number"){for(var D=null,k=0,V=this.args;k<V.length;k+=1){if((D=V[k].evaluate(a))===null)return 0;var K=Number(D);if(!isNaN(K))return K}throw new ui("Could not convert "+JSON.stringify(D)+" to number.")}return this.type.kind==="formatted"?li.fromString(Wo(this.args[0].evaluate(a))):this.type.kind==="resolvedImage"?jn.fromString(Wo(this.args[0].evaluate(a))):Wo(this.args[0].evaluate(a))}
2102,Sn.prototype.eachChild=function(a){this.args.forEach(a)},Sn.prototype.outputDefined=function(){return this.args.every(function(a){return a.outputDefined()})},Sn.prototype.serialize=function(){if(this.type.kind==="formatted")return new ms([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Wi(this.args[0]).serialize();var a=["to-"+this.type.kind];return this.eachChild(function(u){a.push(u.serialize())}),a};var yl=["Unknown","Point","LineString","Polygon"],xe=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};xe.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},xe.prototype.geometryType=function(){return this.feature?typeof this.feature.type=="number"?yl[this.feature.type]:this.feature.type:null},xe.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},xe.prototype.canonicalID=function(){return this.canonical},xe.prototype.properties=function(){return this.feature&&this.feature.properties||{}},xe.prototype.parseColor=function(a){var u=this._parseColorCache[a];return u||(u=this._parseColorCache[a]=tn.parse(a)),u};var Pe=function(a,u,p,x){this.name=a,this.type=u,this._evaluate=p,this.args=x};Pe.prototype.evaluate=function(a){return this._evaluate(a,this.args)},Pe.prototype.eachChild=function(a){this.args.forEach(a)},Pe.prototype.outputDefined=function(){return!1},Pe.prototype.serialize=function(){return[this.name].concat(this.args.map(function(a){return a.serialize()}))},Pe.parse=function(a,u){var p,x=a[0],E=Pe.definitions[x];if(!E)return u.error('Unknown expression "'+x+'". If you wanted a literal array, use ["literal", [...]].',0);for(var I=Array.isArray(E)?E[0]:E.type,D=Array.isArray(E)?[[E[1],E[2]]]:E.overloads,k=D.filter(function(Br){var ir=Br[0];return!Array.isArray(ir)||ir.length===a.length-1}),V=null,K=0,Q=k;K<Q.length;K+=1){var ie=Q[K],fe=ie[0],ye=ie[1];V=new vi(u.registry,u.path,null,u.scope);for(var ke=[],Ne=!1,je=1;je<a.length;je++){var Ve=a[je],qe=Array.isArray(fe)?fe[je-1]:fe.type,ct=V.parse(Ve,1+ke.length,qe);if(!ct){Ne=!0;break}ke.push(ct)}if(!Ne)if(Array.isArray(fe)&&fe.length!==ke.length)V.error("Expected "+fe.length+" arguments, but found "+ke.length+" instead.");else{for(var mt=0;mt<ke.length;mt++){var yt=Array.isArray(fe)?fe[mt]:fe.type,Ft=ke[mt];V.concat(mt+1).checkSubtype(yt,Ft.type)}if(V.errors.length===0)return new Pe(x,I,ye,ke)}}if(k.length===1)(p=u.errors).push.apply(p,V.errors);else{for(var jt=(k.length?k:D).map(function(Br){var ir;return ir=Br[0],Array.isArray(ir)?"("+ir.map(Vr).join(", ")+")":"("+Vr(ir.type)+"...)"}).join(" | "),qt=[],br=1;br<a.length;br++){var nr=u.parse(a[br],1+qt.length);if(!nr)return null;qt.push(Vr(nr.type))}u.error("Expected arguments of type "+jt+", but found ("+qt.join(", ")+") instead.")}return null},Pe.register=function(a,u){for(var p in Pe.definitions=u,u)a[p]=Pe};var $e=function(a,u,p){this.type=en,this.locale=p,this.caseSensitive=a,this.diacriticSensitive=u};function gt(a,u){a[0]=Math.min(a[0],u[0]),a[1]=Math.min(a[1],u[1]),a[2]=Math.max(a[2],u[0]),a[3]=Math.max(a[3],u[1])}function Wt(a,u){return!(a[0]<=u[0]||a[2]>=u[2]||a[1]<=u[1]||a[3]>=u[3])}function vr(a,u){var p=(180+a[0])/360,x=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,E=Math.pow(2,u.z);return[Math.round(p*E*8192),Math.round(x*E*8192)]}function Ir(a,u,p){return u[1]>a[1]!=p[1]>a[1]&&a[0]<(p[0]-u[0])*(a[1]-u[1])/(p[1]-u[1])+u[0]}function fi(a,u){for(var p,x,E,I,D,k,V,K=!1,Q=0,ie=u.length;Q<ie;Q++)for(var fe=u[Q],ye=0,ke=fe.length;ye<ke-1;ye++){if((I=(p=a)[0]-(x=fe[ye])[0])*(V=p[1]-(E=fe[ye+1])[1])-(k=p[0]-E[0])*(D=p[1]-x[1])==0&&I*k<=0&&D*V<=0)return!1;Ir(a,fe[ye],fe[ye+1])&&(K=!K)}return K}function Li(a,u){for(var p=0;p<u.length;p++)if(fi(a,u[p]))return!0;return!1}function Ji(a,u,p,x){var E=x[0]-p[0],I=x[1]-p[1],D=(a[0]-p[0])*I-E*(a[1]-p[1]),k=(u[0]-p[0])*I-E*(u[1]-p[1]);return D>0&&k<0||D<0&&k>0}function Qs(a,u,p){for(var x=0,E=p;x<E.length;x+=1)for(var I=E[x],D=0;D<I.length-1;++D)if((ie=[(Q=I[D+1])[0]-(K=I[D])[0],Q[1]-K[1]])[0]*(fe=[(V=u)[0]-(k=a)[0],V[1]-k[1]])[
21021]-ie[1]*fe[0]!=0&&Ji(k,V,K,Q)&&Ji(K,Q,k,V))return!0;var k,V,K,Q,ie,fe;return!1}function Ph(a,u){for(var p=0;p<a.length;++p)if(!fi(a[p],u))return!1;for(var x=0;x<a.length-1;++x)if(Qs(a[x],a[x+1],u))return!1;return!0}function Af(a,u){for(var p=0;p<u.length;p++)if(Ph(a,u[p]))return!0;return!1}function va(a,u,p){for(var x=[],E=0;E<a.length;E++){for(var I=[],D=0;D<a[E].length;D++){var k=vr(a[E][D],p);gt(u,k),I.push(k)}x.push(I)}return x}function vl(a,u,p){for(var x=[],E=0;E<a.length;E++){var I=va(a[E],u,p);x.push(I)}return x}function bl(a,u,p,x){if(a[0]<p[0]||a[0]>p[2]){var E=.5*x,I=a[0]-p[0]>E?-x:p[0]-a[0]>E?x:0;I===0&&(I=a[0]-p[2]>E?-x:p[2]-a[0]>E?x:0),a[0]+=I}gt(u,a)}function Rh(a,u,p,x){for(var E=8192*Math.pow(2,x.z),I=[8192*x.x,8192*x.y],D=[],k=0,V=a;k<V.length;k+=1)for(var K=0,Q=V[k];K<Q.length;K+=1){var ie=Q[K],fe=[ie.x+I[0],ie.y+I[1]];bl(fe,u,p,E),D.push(fe)}return D}function xl(a,u,p,x){for(var E,I=8192*Math.pow(2,x.z),D=[8192*x.x,8192*x.y],k=[],V=0,K=a;V<K.length;V+=1){for(var Q=[],ie=0,fe=K[V];ie<fe.length;ie+=1){var ye=fe[ie],ke=[ye.x+D[0],ye.y+D[1]];gt(u,ke),Q.push(ke)}k.push(Q)}if(u[2]-u[0]<=I/2){(E=u)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(var Ne=0,je=k;Ne<je.length;Ne+=1)for(var Ve=0,qe=je[Ne];Ve<qe.length;Ve+=1)bl(qe[Ve],u,p,I)}return k}$e.parse=function(a,u){if(a.length!==2)return u.error("Expected one argument.");var p=a[1];if(typeof p!="object"||Array.isArray(p))return u.error("Collator options argument must be an object.");var x=u.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Mt);if(!x)return null;var E=u.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Mt);if(!E)return null;var I=null;return p.locale&&!(I=u.parse(p.locale,1,Lt))?null:new $e(x,E,I)},$e.prototype.evaluate=function(a){return new $i(this.caseSensitive.evaluate(a),this.diacriticSensitive.evaluate(a),this.locale?this.locale.evaluate(a):null)},$e.prototype.eachChild=function(a){a(this.caseSensitive),a(this.diacriticSensitive),this.locale&&a(this.locale)},$e.prototype.outputDefined=function(){return!1},$e.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 Us=function(a,u){this.type=Mt,this.geojson=a,this.geometries=u};function Jo(a){if(a instanceof Pe&&(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 Us)return!1;var u=!0;return a.eachChild(function(p){u&&!Jo(p)&&(u=!1)}),u}function ba(a){if(a instanceof Pe&&a.name==="feature-state")return!1;var u=!0;return a.eachChild(function(p){u&&!ba(p)&&(u=!1)}),u}function Wa(a,u){if(a instanceof Pe&&u.indexOf(a.name)>=0)return!1;var p=!0;return a.eachChild(function(x){p&&!Wa(x,u)&&(p=!1)}),p}Us.parse=function(a,u){if(a.length!==2)return u.error("'within' expression requires exactly one argument, but found "+(a.length-1)+" instead.");if($o(a[1])){var p=a[1];if(p.type==="FeatureCollection")for(var x=0;x<p.features.length;++x){var E=p.features[x].geometry.type;if(E==="Polygon"||E==="MultiPolygon")return new Us(p,p.features[x].geometry)}else if(p.type==="Feature"){var I=p.geometry.type;if(I==="Polygon"||I==="MultiPolygon")return new Us(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Us(p,p)}return u.error("'within' expression requires valid geojson object that contains polygon geometry type.")},Us.prototype.evaluate=function(a){if(a.geometry()!=null&&a.canonicalID()!=null){if(a.geometryType()==="Point")return function(u,p){var x=[1/0,1/0,-1/0,-1/0],E=[1/0,1/0,-1/0,-1/0],I=u.canonicalID();if(p.type==="Polygon"){var D=va(p.coordinates,E,I),k=Rh(u.geometry(),x,E,I);if(!Wt(x,E))return!1;for(var V=0,K=k;V<K.length;V+=1)if(!fi(K[V],D))return!1}if(p.type==="MultiPolygon"){var Q=vl(p.coordinates,E,I),ie=Rh(u.geometry(),x,E,I);if(!Wt(x,E))return!1;for(var fe=0,ye=ie;fe<ye.length;fe+=1)if(!Li(ye[fe],Q))return!1}return!0}(a,this.geometries);if(a.geometryType()==="LineString")return function(u,p){var x=[1/0,1/0,-1/0,-1/0],E=[1/0,1/0,-1/0,-1/0],I=u.canonicalID();if(p.type==="Polygon"){var D=va(p.coordinates,E,I),k=xl(u.geometry(),x,E,I);if(!Wt(x,E))return!1;for(var V=0,K=k;V<K.length;V+=1)if(!Ph(K[V],D))return!1}if(p.type==="MultiPolygon"){var Q=vl(p.coordinates,E,I),ie=xl(u.geometry(),x,E,I);if(!Wt(x,E))return!1;for(var fe=0,ye=ie;fe<ye.length;fe+=1)if(!Af(ye[fe],Q))return!1}return!0}(a,this.geometries)}return!1},Us.prototype.eachChild=function(){},Us.prototype.outputDefined=function(){return!0},Us.prototype.serialize=function(){return["within",this.geojson]};var xa=function(a,u){this.type=u.type,this.name=a,this.boundExpression=u};
2102xa.parse=function(a,u){if(a.length!==2||typeof a[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");var p=a[1];return u.scope.has(p)?new xa(p,u.scope.get(p)):u.error('Unknown variable "'+p+'". Make sure "'+p+'" has been bound in an enclosing "let" expression before using it.',1)},xa.prototype.evaluate=function(a){return this.boundExpression.evaluate(a)},xa.prototype.eachChild=function(){},xa.prototype.outputDefined=function(){return!1},xa.prototype.serialize=function(){return["var",this.name]};var vi=function(a,u,p,x,E){u===void 0&&(u=[]),x===void 0&&(x=new Pt),E===void 0&&(E=[]),this.registry=a,this.path=u,this.key=u.map(function(I){return"["+I+"]"}).join(""),this.scope=x,this.errors=E,this.expectedType=p};function Ro(a,u){for(var p,x=a.length-1,E=0,I=x,D=0;E<=I;)if((p=a[D=Math.floor((E+I)/2)])<=u){if(D===x||u<a[D+1])return D;E=D+1}else{if(!(p>u))throw new ui("Input is not a number.");I=D-1}return 0}vi.prototype.parse=function(a,u,p,x,E){return E===void 0&&(E={}),u?this.concat(u,p,x)._parse(a,E):this._parse(a,E)},vi.prototype._parse=function(a,u){function p(K,Q,ie){return ie==="assert"?new Rn(Q,[K]):ie==="coerce"?new Sn(Q,[K]):K}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 E=this.registry[x];if(E){var I=E.parse(a,this);if(!I)return null;if(this.expectedType){var D=this.expectedType,k=I.type;if(D.kind!=="string"&&D.kind!=="number"&&D.kind!=="boolean"&&D.kind!=="object"&&D.kind!=="array"||k.kind!=="value")if(D.kind!=="color"&&D.kind!=="formatted"&&D.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string"){if(this.checkSubtype(D,k))return null}else I=p(I,D,u.typeAnnotation||"coerce");else I=p(I,D,u.typeAnnotation||"assert")}if(!(I instanceof Oi)&&I.type.kind!=="resolvedImage"&&function K(Q){if(Q instanceof xa)return K(Q.boundExpression);if(Q instanceof Pe&&Q.name==="error"||Q instanceof $e||Q instanceof Us)return!1;var ie=Q instanceof Sn||Q instanceof Rn,fe=!0;return Q.eachChild(function(ye){fe=ie?fe&&K(ye):fe&&ye instanceof Oi}),!!fe&&Jo(Q)&&Wa(Q,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(I)){var V=new xe;try{I=new Oi(I.type,I.evaluate(V))}catch(K){return this.error(K.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.")},vi.prototype.concat=function(a,u,p){var x=typeof a=="number"?this.path.concat(a):this.path,E=p?this.scope.concat(p):this.scope;return new vi(this.registry,x,u||null,E,this.errors)},vi.prototype.error=function(a){for(var u=[],p=arguments.length-1;p-- >0;)u[p]=arguments[p+1];var x=""+this.key+u.map(function(E){return"["+E+"]"}).join("");this.errors.push(new Et(x,a))},vi.prototype.checkSubtype=function(a,u){var p=Xr(a,u);return p&&this.error(p),p};var zn=function(a,u,p){this.type=a,this.input=u,this.labels=[],this.outputs=[];for(var x=0,E=p;x<E.length;x+=1){var I=E[x],D=I[1];this.labels.push(I[0]),this.outputs.push(D)}};function hi(a,u,p){return a*(1-p)+u*p}zn.parse=function(a,u){if(a.length-1<4)return u.error("Expected at least 4 arguments, but found only "+(a.length-1)+".");if((a.length-1)%2!=0)return u.error("Expected an even number of arguments.");var p=u.parse(a[1],1,ht);if(!p)return null;var x=[],E=null;u.expectedType&&u.expectedType.kind!=="value"&&(E=u.expectedType);for(var I=1;I<a.length;I+=2){var D=I===1?-1/0:a[I],k=a[I+1],V=I,K=I+1;if(typeof D!="number")return u.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
2102omputed expressions) for the input values.',V);if(x.length&&x[x.length-1][0]>=D)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',V);var Q=u.parse(k,K,E);if(!Q)return null;E=E||Q.type,x.push([D,Q])}return new zn(E,p,x)},zn.prototype.evaluate=function(a){var u=this.labels,p=this.outputs;if(u.length===1)return p[0].evaluate(a);var x=this.input.evaluate(a);if(x<=u[0])return p[0].evaluate(a);var E=u.length;return x>=u[E-1]?p[E-1].evaluate(a):p[Ro(u,x)].evaluate(a)},zn.prototype.eachChild=function(a){a(this.input);for(var u=0,p=this.outputs;u<p.length;u+=1)a(p[u])},zn.prototype.outputDefined=function(){return this.outputs.every(function(a){return a.outputDefined()})},zn.prototype.serialize=function(){for(var a=["step",this.input.serialize()],u=0;u<this.labels.length;u++)u>0&&a.push(this.labels[u]),a.push(this.outputs[u].serialize());return a};var Ja=Object.freeze({__proto__:null,number:hi,color:function(a,u,p){return new tn(hi(a.r,u.r,p),hi(a.g,u.g,p),hi(a.b,u.b,p),hi(a.a,u.a,p))},array:function(a,u,p){return a.map(function(x,E){return hi(x,u[E],p)})}}),wl=6/29*3*(6/29),Qp=Math.PI/180,eA=180/Math.PI;function gf(a){return a>.008856451679035631?Math.pow(a,1/3):a/wl+4/29}function au(a){return a>6/29?a*a*a:wl*(a-4/29)}function Pc(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function Xo(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function mf(a){var u=Xo(a.r),p=Xo(a.g),x=Xo(a.b),E=gf((.4124564*u+.3575761*p+.1804375*x)/.95047),I=gf((.2126729*u+.7151522*p+.072175*x)/1);return{l:116*I-16,a:500*(E-I),b:200*(I-gf((.0193339*u+.119192*p+.9503041*x)/1.08883)),alpha:a.a}}function _f(a){var u=(a.l+16)/116,p=isNaN(a.a)?u:u+a.a/500,x=isNaN(a.b)?u:u-a.b/200;return u=1*au(u),p=.95047*au(p),x=1.08883*au(x),new tn(Pc(3.2404542*p-1.5371385*u-.4985314*x),Pc(-.969266*p+1.8760108*u+.041556*x),Pc(.0556434*p-.2040259*u+1.0572252*x),a.alpha)}function cu(a,u,p){var x=u-a;return a+p*(x>180||x<-180?x-360*Math.round(x/360):x)}var xo={forward:mf,reverse:_f,interpolate:function(a,u,p){return{l:hi(a.l,u.l,p),a:hi(a.a,u.a,p),b:hi(a.b,u.b,p),alpha:hi(a.alpha,u.alpha,p)}}},eo={forward:function(a){var u=mf(a),p=u.l,x=u.a,E=u.b,I=Math.atan2(E,x)*eA;return{h:I<0?I+360:I,c:Math.sqrt(x*x+E*E),l:p,alpha:a.a}},reverse:function(a){var u=a.h*Qp,p=a.c;return _f({l:a.l,a:Math.cos(u)*p,b:Math.sin(u)*p,alpha:a.alpha})},interpolate:function(a,u,p){return{h:cu(a.h,u.h,p),c:hi(a.c,u.c,p),l:hi(a.l,u.l,p),alpha:hi(a.alpha,u.alpha,p)}}},yf=Object.freeze({__proto__:null,lab:xo,hcl:eo}),zi=function(a,u,p,x,E){this.type=a,this.operator=u,this.interpolation=p,this.input=x,this.labels=[],this.outputs=[];for(var I=0,D=E;I<D.length;I+=1){var k=D[I],V=k[1];this.labels.push(k[0]),this.outputs.push(V)}};function Cl(a,u,p,x){var E=x-p,I=a-p;return E===0?0:u===1?I/E:(Math.pow(u,I)-1)/(Math.pow(u,E)-1)}zi.interpolationFactor=function(a,u,p,x){var E=0;if(a.name==="exponential")E=Cl(u,a.base,p,x);else if(a.name==="linear")E=Cl(u,1,p,x);else if(a.name==="cubic-bezier"){var I=a.controlPoints;E=new f(I[0],I[1],I[2],I[3]).solve(Cl(u,1,p,x))}return E},zi.parse=function(a,u){var p=a[0],x=a[1],E=a[2],I=a.slice(3);if(!Array.isArray(x)||x.length===0)return u.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 u.error("Exponential interpolation requires a numeric base.",1,1);x={name:"exponential",base:D}}else{if(x[0]!=="cubic-bezier")return u.error("Unknown interpolation type "+String(x[0]),1,0);var k=x.slice(1);if(k.length!==4||k.some(function(je){return typeof je!="number"||je<0||je>1}))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);x={name:"cubic-bezier",controlPoints:k}}if(a.length-1<4)return u.error("Expected at least 4 arguments, but found only "+(a.length-1)+".");if((a.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(!(E=u.parse(E,2,ht)))return null;var V=[],K=null;p==="interpolate-hcl"||p==="interpolate-lab"?K=Ht:u.expectedType&&u.expectedType.kind!=="value"&&(K=u.expectedType);for(var Q=0;Q<I.length;Q+=2){var ie=I[Q],fe=I[Q+1],ye=Q+3,ke=Q+4;if(typeof ie!="number")return u.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
2102omputed expressions) for the input values.',ye);if(V.length&&V[V.length-1][0]>=ie)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',ye);var Ne=u.parse(fe,ke,K);if(!Ne)return null;K=K||Ne.type,V.push([ie,Ne])}return K.kind==="number"||K.kind==="color"||K.kind==="array"&&K.itemType.kind==="number"&&typeof K.N=="number"?new zi(K,p,x,E,V):u.error("Type "+Vr(K)+" is not interpolatable.")},zi.prototype.evaluate=function(a){var u=this.labels,p=this.outputs;if(u.length===1)return p[0].evaluate(a);var x=this.input.evaluate(a);if(x<=u[0])return p[0].evaluate(a);var E=u.length;if(x>=u[E-1])return p[E-1].evaluate(a);var I=Ro(u,x),D=zi.interpolationFactor(this.interpolation,x,u[I],u[I+1]),k=p[I].evaluate(a),V=p[I+1].evaluate(a);return this.operator==="interpolate"?Ja[this.type.kind.toLowerCase()](k,V,D):this.operator==="interpolate-hcl"?eo.reverse(eo.interpolate(eo.forward(k),eo.forward(V),D)):xo.reverse(xo.interpolate(xo.forward(k),xo.forward(V),D))},zi.prototype.eachChild=function(a){a(this.input);for(var u=0,p=this.outputs;u<p.length;u+=1)a(p[u])},zi.prototype.outputDefined=function(){return this.outputs.every(function(a){return a.outputDefined()})},zi.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 u=[this.operator,a,this.input.serialize()],p=0;p<this.labels.length;p++)u.push(this.labels[p],this.outputs[p].serialize());return u};var wa=function(a,u){this.type=a,this.args=u};wa.parse=function(a,u){if(a.length<2)return u.error("Expectected at least one argument.");var p=null,x=u.expectedType;x&&x.kind!=="value"&&(p=x);for(var E=[],I=0,D=a.slice(1);I<D.length;I+=1){var k=u.parse(D[I],1+E.length,p,void 0,{typeAnnotation:"omit"});if(!k)return null;p=p||k.type,E.push(k)}var V=x&&E.some(function(K){return Xr(x,K.type)});return new wa(V?Qt:p,E)},wa.prototype.evaluate=function(a){for(var u,p=null,x=0,E=0,I=this.args;E<I.length&&(x++,(p=I[E].evaluate(a))&&p instanceof jn&&!p.available&&(u||(u=p.name),p=null,x===this.args.length&&(p=u)),p===null);E+=1);return p},wa.prototype.eachChild=function(a){this.args.forEach(a)},wa.prototype.outputDefined=function(){return this.args.every(function(a){return a.outputDefined()})},wa.prototype.serialize=function(){var a=["coalesce"];return this.eachChild(function(u){a.push(u.serialize())}),a};var Ca=function(a,u){this.type=u.type,this.bindings=[].concat(a),this.result=u};Ca.prototype.evaluate=function(a){return this.result.evaluate(a)},Ca.prototype.eachChild=function(a){for(var u=0,p=this.bindings;u<p.length;u+=1)a(p[u][1]);a(this.result)},Ca.parse=function(a,u){if(a.length<4)return u.error("Expected at least 3 arguments, but found "+(a.length-1)+" instead.");for(var p=[],x=1;x<a.length-1;x+=2){var E=a[x];if(typeof E!="string")return u.error("Expected string, but found "+typeof E+" instead.",x);if(/[^a-zA-Z0-9_]/.test(E))return u.error("Variable names must contain only alphanumeric characters or '_'.",x);var I=u.parse(a[x+1],x+1);if(!I)return null;p.push([E,I])}var D=u.parse(a[a.length-1],a.length-1,u.expectedType,p);return D?new Ca(p,D):null},Ca.prototype.outputDefined=function(){return this.result.outputDefined()},Ca.prototype.serialize=function(){for(var a=["let"],u=0,p=this.bindings;u<p.length;u+=1){var x=p[u];a.push(x[0],x[1].serialize())}return a.push(this.result.serialize()),a};var Ta=function(a,u,p){this.type=a,this.index=u,this.input=p};Ta.parse=function(a,u){if(a.length!==3)return u.error("Expected 2 arguments, but found "+(a.length-1)+" instead.");var p=u.parse(a[1],1,ht),x=u.parse(a[2],2,Jr(u.expectedType||Qt));return p&&x?new Ta(x.type.itemType,p,x):null},Ta.prototype.evaluate=function(a){var u=this.index.evaluate(a),p=this.input.evaluate(a);if(u<0)throw new ui("Array index out of bounds: "+u+" < 0.");if(u>=p.length)throw new ui("Array index out of bounds: "+u+" > "+(p.length-1)+".");if(u!==Math.floor(u))throw new ui("Array index must be an integer, but found "+u+" instead.");return p[u]},Ta.prototype.eachChild=function(a){a(this.index),a(this.input)},Ta.prototype.outputDefined=function(){return!1},Ta.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Xa=function(a,u){this.type=Mt,this.needle=a,this.haystack=u};Xa.parse=function(a,u){if(a.length!==3)return u.error("Expected 2 arguments, but found "+(a.length-1)+" instead.");var p=u.parse(a[1],1,Qt),x=u.parse(a[2],2,Qt);return p&&x?pr(p.type,[Mt,Lt,ht,Ot,Qt])?new Xa(p,x):u.error("Expected first argument to be of type boolean, string, number or null, but found "+Vr(p.type)+" instead"):null},Xa.prototype.evaluate=function(a){var u=this.needle.evaluate(a),p=this.haystack.evaluate(a);if(!p)return!1;if(!Ie(u,["boolean","string","number","null"]))throw new ui("Expected first argument to be of type boolean, string, number or null, but found "+Vr($n(u))+" instead.");if(!Ie(p,["string","array"]))throw new ui("Expected second argument to be of type array or string, but found "+Vr($n(p))+" instead.");return p.indexOf(u)>=0},Xa.prototype.eachChild=function(a){a(this.needle),a(this.haystack)},Xa.prototype.outputDefined=function(){return!0},Xa.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var Ea=function(a,u,p){this.type=ht,this.needle=a,this.haystack=u,this.fromIndex=p};Ea.parse=function(a,u){if(a.length<=2||a.length>=5)return u.error("Expected 3 or 4 arguments, but found "+(a.length-1)+" instead.");var p=u.parse(a[1],1,Qt),x=u.parse(a[2],2,Qt);if(!p||!x)return null;if(!pr(p.type,[Mt,Lt,ht,Ot,Qt]))return u.error("Expected first argument to be of type boolean, string, number or null, but found "+Vr(p.type)+" instead");if(a.length===4){var E=u.parse(a[3],3,ht);return E?new Ea(p,x,E):null}return new Ea(p,x)},Ea.prototype.evaluate=function(a){var u=this.needle.evaluate(a),p=this.haystack.evaluate(a);if(!Ie(u,["boolean","string","number","null"]))throw new ui("Expected first argument to be of type boolean, string, number or null, but found "+Vr($n(u))+" instead.");if(!Ie(p,["string","array"]))throw new ui("Expected second argument to be of type array or string, but found "+Vr($n(p))+" instead.");if(this.fromIndex){var x=this.fromIndex.evaluate(a);return p.indexOf(u,x)}return p.indexOf(u)},Ea.prototype.eachChild=function(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)},Ea.prototype.outputDefined=function(){return!1},Ea.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 Ka=function(a,u,p,x,E,I){this.inputType=a,this.type=u,this.input=p,this.cases=x,this.outputs=E,this.otherwise=I};Ka.parse=function(a,u){if(a.length<5)return u.error("Expected at least 4 arguments, but found only "+(a.length-1)+".");if(a.length%2!=1)return u.error("Expected an even number of arguments.");var p,x;u.expectedType&&u.expectedType.kind!=="value"&&(x=u.expectedType);for(var E={},I=[],D=2;D<a.length-1;D+=2){var k=a[D],V=a[D+1];Array.isArray(k)||(k=[k]);var K=u.concat(D);if(k.length===0)return K.error("Expected at least one branch label.");for(var Q=0,ie=k;Q<ie.length;Q+=1){var fe=ie[Q];if(typeof fe!="number"&&typeof fe!="string")return K.error("Branch labels must be numbers or strings.");if(typeof fe=="number"&&Math.abs(fe)>Number.MAX_SAFE_INTEGER)return K.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if(typeof fe=="number"&&Math.floor(fe)!==fe)return K.error("Numeric branch labels must be integer values.");if(p){if(K.checkSubtype(p,$n(fe)))return null}else p=$n(fe);if(E[String(fe)]!==void 0)return K.error("Branch labels must be unique.");E[String(fe)]=I.length}var ye=u.parse(V,D,x);if(!ye)return null;x=x||ye.type,I.push(ye)}var ke=u.parse(a[1],1,Qt);if(!ke)return null;var Ne=u.parse(a[a.length-1],a.length-1,x);return Ne?ke.type.kind!=="value"&&u.concat(1).checkSubtype(p,ke.type)?null:new Ka(p,x,ke,E,I,Ne):null},Ka.prototype.evaluate=function(a){var u=this.input.evaluate(a);return($n(u)===this.inputType&&this.outputs[this.cases[u]]||this.otherwise).evaluate(a)},Ka.prototype.eachChild=function(a){a(this.input),this.outputs.forEac
2102h(a),a(this.otherwise)},Ka.prototype.outputDefined=function(){return this.outputs.every(function(a){return a.outputDefined()})&&this.otherwise.outputDefined()},Ka.prototype.serialize=function(){for(var a=this,u=["match",this.input.serialize()],p=[],x={},E=0,I=Object.keys(this.cases).sort();E<I.length;E+=1){var D=I[E];(ie=x[this.cases[D]])===void 0?(x[this.cases[D]]=p.length,p.push([this.cases[D],[D]])):p[ie][1].push(D)}for(var k=function(ye){return a.inputType.kind==="number"?Number(ye):ye},V=0,K=p;V<K.length;V+=1){var Q=K[V],ie=Q[0],fe=Q[1];u.push(fe.length===1?k(fe[0]):fe.map(k)),u.push(this.outputs[outputIndex$1].serialize())}return u.push(this.otherwise.serialize()),u};var qa=function(a,u,p){this.type=a,this.branches=u,this.otherwise=p};qa.parse=function(a,u){if(a.length<4)return u.error("Expected at least 3 arguments, but found only "+(a.length-1)+".");if(a.length%2!=0)return u.error("Expected an odd number of arguments.");var p;u.expectedType&&u.expectedType.kind!=="value"&&(p=u.expectedType);for(var x=[],E=1;E<a.length-1;E+=2){var I=u.parse(a[E],E,Mt);if(!I)return null;var D=u.parse(a[E+1],E+1,p);if(!D)return null;x.push([I,D]),p=p||D.type}var k=u.parse(a[a.length-1],a.length-1,p);return k?new qa(p,x,k):null},qa.prototype.evaluate=function(a){for(var u=0,p=this.branches;u<p.length;u+=1){var x=p[u],E=x[1];if(x[0].evaluate(a))return E.evaluate(a)}return this.otherwise.evaluate(a)},qa.prototype.eachChild=function(a){for(var u=0,p=this.branches;u<p.length;u+=1){var x=p[u],E=x[1];a(x[0]),a(E)}a(this.otherwise)},qa.prototype.outputDefined=function(){return this.branches.every(function(a){return a[1].outputDefined()})&&this.otherwise.outputDefined()},qa.prototype.serialize=function(){var a=["case"];return this.eachChild(function(u){a.push(u.serialize())}),a};var Ba=function(a,u,p,x){this.type=a,this.input=u,this.beginIndex=p,this.endIndex=x};function Fh(a,u){return a==="=="||a==="!="?u.kind==="boolean"||u.kind==="string"||u.kind==="number"||u.kind==="null"||u.kind==="value":u.kind==="string"||u.kind==="number"||u.kind==="value"}function Dh(a,u,p,x){return x.compare(u,p)===0}function In(a,u,p){var x=a!=="=="&&a!=="!=";return function(){function E(I,D,k){this.type=Mt,this.lhs=I,this.rhs=D,this.collator=k,this.hasUntypedArgument=I.type.kind==="value"||D.type.kind==="value"}return E.parse=function(I,D){if(I.length!==3&&I.length!==4)return D.error("Expected two or three arguments.");var k=I[0],V=D.parse(I[1],1,Qt);if(!V)return null;if(!Fh(k,V.type))return D.concat(1).error('"'+k+`" comparisons are not supported for type '`+Vr(V.t
2102ype)+"'.");var K=D.parse(I[2],2,Qt);if(!K)return null;if(!Fh(k,K.type))return D.concat(2).error('"'+k+`" comparisons are not supported for type '`+Vr(K.type)+"'.");if(V.type.kind!==K.type.kind&&V.type.kind!=="value"&&K.type.kind!=="value")return D.error("Cannot compare types '"+Vr(V.type)+"' and '"+Vr(K.type)+"'.");x&&(V.type.kind==="value"&&K.type.kind!=="value"?V=new Rn(K.type,[V]):V.type.kind!=="value"&&K.type.kind==="value"&&(K=new Rn(V.type,[K])));var Q=null;if(I.length===4){if(V.type.kind!=="string"&&K.type.kind!=="string"&&V.type.kind!=="value"&&K.type.kind!=="value")return D.error("Cannot use collator to compare non-string types.");if(!(Q=D.parse(I[3],3,en)))return null}return new E(V,K,Q)},E.prototype.evaluate=function(I){var D=this.lhs.evaluate(I),k=this.rhs.evaluate(I);if(x&&this.hasUntypedArgument){var V=$n(D),K=$n(k);if(V.kind!==K.kind||V.kind!=="string"&&V.kind!=="number")throw new ui('Expected arguments for "'+a+'" to be (string, string) or (number, number), but found ('+V.kind+", "+K.kind+") instead.")}if(this.collator&&!x&&this.hasUntypedArgument){var Q=$n(D),ie=$n(k);if(Q.kind!=="string"||ie.kind!=="string")return u(I,D,k)}return this.collator?p(I,D,k,this.collator.evaluate(I)):u(I,D,k)},E.prototype.eachChild=function(I){I(this.lhs),I(this.rhs),this.collator&&I(this.collator)},E.prototype.outputDefined=function(){return!0},E.prototype.serialize=function(){var I=[a];return this.eachChild(function(D){I.push(D.serialize())}),I},E}()}Ba.parse=function(a,u){if(a.length<=2||a.length>=5)return u.error("Expected 3 or 4 arguments, but found "+(a.length-1)+" instead.");var p=u.parse(a[1],1,Qt),x=u.parse(a[2],2,ht);if(!p||!x)return null;if(!pr(p.type,[Jr(Qt),Lt,Qt]))return u.error("Expected first argument to be of type array or string, but found "+Vr(p.type)+" instead");if(a.length===4){var E=u.parse(a[3],3,ht);return E?new Ba(p.type,p,x,E):null}return new Ba(p.type,p,x)},Ba.prototype.evaluate=function(a){var u=this.input.evaluate(a),p=this.beginIndex.evaluate(a);if(!Ie(u,["string","array"]))throw new ui("Expected first argument to be of type array or string, but found "+Vr($n(u))+" instead.");if(this.endIndex){var x=this.endIndex.evaluate(a);return u.slice(p,x)}return u.slice(p)},Ba.prototype.eachChild=function(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)},Ba.prototype.outputDefined=function(){return!1},Ba.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 lu=In("==",function(a,u,p){return u===p},Dh),uu=In("!=",function(a,u,p){return u!==p},function(a,u,p,x){return!Dh(0,u,p,x)}),Oh=In("<",function(a,u,p){return u<p},function(a,u,p,x){return x.compare(u,p)<0}),Lh=In(">",function(a,u,p){return u>p},function(a,u,p,x){return x.compare(u,p)>0}),Rc=In("<=",function(a,u,p){return u<=p},function(a,u,p,x){return x.compare(u,p)<=0}),kh=In(">=",function(a,u,p){return u>=p},function(a,u,p,x){return x.compare(u,p)>=0}),Ko=function(a,u,p,x,E){this.type=Lt,this.number=a,this.locale=u,this.currency=p,this.minFractionDigits=x,this.maxFractionDigits=E};Ko.parse=function(a,u){if(a.length!==3)return u.error("Expected two arguments.");var p=u.parse(a[1],1,ht);if(!p)return null;var x=a[2];if(typeof x!="object"||Array.isArray(x))return u.error("NumberFormat options argument must be an object.");var E=null;if(x.locale&&!(E=u.parse(x.locale,1,Lt)))return null;var I=null;if(x.currency&&!(I=u.parse(x.currency,1,Lt)))return null;var D=null;if(x["min-fraction-digits"]&&!(D=u.parse(x["min-fraction-digits"],1,ht)))return null;var k=null;return x["max-fraction-digits"]&&!(k=u.parse(x["max-fraction-digits"],1,ht))?null:new Ko(p,E,I,D,k)},Ko.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))},Ko.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)},Ko.prototype.outputDefined=function(){return!1},Ko.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 qo=function(a){this.type=ht,this.input=a};qo.parse=function(a,u){if(a.length!==2)return u.error("Expected 1 argument, but found "+(a.length-1)+" instead.");var p=u.parse(a[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?u.error("Expected argument of type string or array, but found "+Vr(p.type)+" instead."):new qo(p
2102):null},qo.prototype.evaluate=function(a){var u=this.input.evaluate(a);if(typeof u=="string"||Array.isArray(u))return u.length;throw new ui("Expected value to be of type string or array, but found "+Vr($n(u))+" instead.")},qo.prototype.eachChild=function(a){a(this.input)},qo.prototype.outputDefined=function(){return!1},qo.prototype.serialize=function(){var a=["length"];return this.eachChild(function(u){a.push(u.serialize())}),a};var to={"==":lu,"!=":uu,">":Lh,"<":Oh,">=":kh,"<=":Rc,array:Rn,at:Ta,boolean:Rn,case:qa,coalesce:wa,collator:$e,format:ms,image:Wi,in:Xa,"index-of":Ea,interpolate:zi,"interpolate-hcl":zi,"interpolate-lab":zi,length:qo,let:Ca,literal:Oi,match:Ka,number:Rn,"number-format":Ko,object:Rn,slice:Ba,step:zn,string:Rn,"to-boolean":Sn,"to-color":Sn,"to-number":Sn,"to-string":Sn,var:xa,within:Us};function Nh(a,u){var p=u[0],x=u[1],E=u[2],I=u[3];p=p.evaluate(a),x=x.evaluate(a),E=E.evaluate(a);var D=I?I.evaluate(a):1,k=Se(p,x,E,D);if(k)throw new ui(k);return new tn(p/255*D,x/255*D,E/255*D,D)}function fu(a,u){return a in u}function hu(a,u){var p=u[a];return p===void 0?null:p}function Ya(a){return{type:a}}function vf(a){return{result:"success",value:a}}function Yo(a){return{result:"error",value:a}}function Zo(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function Tl(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function Fn(a){return!!a.expression&&a.expression.interpolated}function On(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function du(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function tA(a){return a}function Fc(a,u,p){return a!==void 0?a:u!==void 0?u:p!==void 0?p:void 0}function Uh(a,u,p,x,E){return Fc(typeof p===E?x[p]:void 0,a.default,u.default)}function rA(a,u,p){if(On(p)!=="number")return Fc(a.default,u.default);var x=a.stops.length;if(x===1||p<=a.stops[0][0])return a.stops[0][1];if(p>=a.stops[x-1][0])return a.stops[x-1][1];var E=Ro(a.stops.map(function(I){return I[0]}),p);return a.stops[E][1]}function zh(a,u,p){var x=a.base!==void 0?a.base:1;if(On(p)!=="number")return Fc(a.default,u.default);var E=a.stops.length;if(E===1||p<=a.stops[0][0])return a.stops[0][1];if(p>=a.stops[E-1][0])return a.stops[E-1][1];var I=Ro(a.stops.map(function(ie){return ie[0]}),p),D=function(ie,fe,ye,ke){var Ne=ke-ye,je=ie-ye;return Ne===0?0:fe===1?je/Ne:(Math.pow(fe,je)-1)/(Math.pow(fe,Ne)-1)}(p,x,a.stops[I][0],a.stops[I+1][0]),k=a.stops[I][1],V=a.stops[I+1][1],K=Ja[u.type]||tA;if(a.colorSpace&&a.colorSpace!=="rgb"){var Q=yf[a.colorSpace];K=function(ie,fe){return Q.reverse(Q.interpolate(Q.forward(ie),Q.forward(fe),D))}}return typeof k.evaluate=="function"?{evaluate:function(){for(var ie=[],fe=arguments.length;fe--;)ie[fe]=arguments[fe];var ye=k.evaluate.apply(void 0,ie),ke=V.evaluate.apply(void 0,ie);if(ye!==void 0&&ke!==void 0)return K(ye,ke,D)}}:K(k,V,D)}function ns(a,u,p){return u.type==="color"?p=tn.parse(p):u.type==="formatted"?p=li.fromString(p.toString()):u.type==="resolvedImage"?p=jn.fromString(p.toString()):On(p)===u.type||u.type==="enum"&&u.values[p]||(p=void 0),Fc(p,a.default,u.default)}Pe.register(to,{error:[{kind:"error"},[Lt],function(a,u){throw new ui(u[0].evaluate(a))}],typeof:[Lt,[Qt],function(a,u){return Vr($n(u[0].evaluate(a)))}],"to-rgba":[Jr(ht,4),[Ht],function(a,u){return u[0].evaluate(a).toArray()}],rgb:[Ht,[ht,ht,ht],Nh],rgba:[Ht,[ht,ht,ht,ht],Nh],has:{type:Mt,overloads:[[[Lt],function(a,u){return fu(u[0].evaluate(a),a.properties())}],[[Lt,Ur],function(a,u){var p=u[1];return fu(u[0].evaluate(a),p.evaluate(a))}]]},get:{type:Qt,overloads:[[[Lt],function(a,u){return hu(u[0].evaluate(a),a.properties())}],[[Lt,Ur],function(a,u){var p=u[1];return hu(u[0].evaluate(a),p.evaluate(a))}]]},"feature-state":[Qt,[Lt],function(a,u){return hu(u[0].evaluate(a),a.featureState||{})}],properties:[Ur,[],function(a){return a.properties()}],"geometry-type":[Lt,[],function(a){return a.geometryType()}],id:[Qt,[],function(a){return a.id()}],zoom:[ht,[],function(a){return a.globals.zoom}],"heatmap-density":[ht,[],function(a){return a.globals.heatmapDensity||0}],"line-progress":[ht,[],function(a){return a.globals.lineProgress||0}],accumulated:[Qt,[],function(a){return a.globals.accumulated===void 0?null:a.globals.accumulated}],"+":[ht,Ya(ht),function(a,u){for(var p=0,x=0,E=u;x<E.length;x+=1)p+=E[x].evaluate(a);return p}],"*":[ht,Ya(ht),function(a,u){for(var p=1,x=0,E=u;x<E.length;x+=1)p*=E[x].evaluate(a);return p}],"-":{type:ht,overloads:[[[ht,ht],function(a,u){var p=u[1];return u[0].evaluate(a)-p.evaluate(a)}],[[ht],function(a,u){return-u[0].evaluate(a)}]]},"/":[ht,[ht,ht],function(a,u){var p=u[1];return u[0].evaluate(a)/p.evaluate(a)}],"%":[ht,[ht,ht],function(a,u){var p=u[1];return u[0].evaluate(a)%p.evaluate(a)}],ln2:[ht,[],function(){return Math.LN2}],pi:[ht,[],function(){return Math.PI}],e:[ht,[],function(){return Math.E}],"^":[ht,[ht,ht],function(a,u){var p=u[1];return Math.pow(u[0].evaluate(a),p.evaluate(a))}],sqrt:[ht,[ht],function(a,u){return Math.sqrt(u[0].evaluate(a))}],log10:[ht,[ht],function(a,u){return Math.log(u[0].evaluate(a))/Math.LN10}],ln:[ht,[ht],function(a,u){return Math.log(u[0].evaluate(a))}],log2:[ht,[ht],function(a,u){return Math.log(u[0].evaluate(a))/Math.LN2}],sin:[ht,[ht],function(a,u){return Math.sin(u[0].evaluate(a))}],cos:[ht,[ht],function(a,u){return Math.cos(u[0].evaluate(a))}],tan:[ht,[ht],function(a,u){return Math.tan(u[0].evaluate(a))}],asin:[ht,[ht],function(a,u){return Math.asin(u[0].evaluate(a))}],acos:[ht,[ht],function(a,u){return Math.acos(u[0].evaluate(a))}],atan:[ht,[ht],function(a,u){return Math.atan(u[0].evaluate(a))}],min:[ht,Ya(ht),function(a,u){return Math.min.apply(Math,u.map(function(p){return p.evaluate(a)}))}],max:[ht,Ya(ht),function(a,u){return Math.max.apply(Math,u.map(function(p){return p.evaluate(a)}))}],abs:[ht,[ht],function(a,u){return Math.abs(u[0].evaluate(a))}],round:[ht,[ht],function(a,u){var p=u[0].evaluate(a);return p<0?-Math.round(-p):Math.round(p)}],floor:[ht,[ht],function(a,u){return Math.floor(u[0].evaluate(a))}],ceil:[ht,[ht],function(a,u){return Math.ceil(u[0].evaluate(a))}],"filter-==":[Mt,[Lt,Qt],function(a,u){var p=u[0],x=u[1];return a.properties()[p.value]===x.value}],"filter-id-==":[Mt,[Qt],function(a,u){var p=u[0];return a.id()===p.value}],"filter-type-==":[Mt,[Lt],function(a,u){var p=u[0];return a.geometryType()===p.value}],"filter-<":[Mt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],E=a.properties()[p.value],I=x.value;return typeof E==typeof I&&E<I}],"filter-id-<":[Mt,[Qt],function(a,u){var p=u[0],x=a.id(),E=p.value;return typeof x==typeof E&&x<E}],"filter->":[Mt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],E=a.properties()[p.value],I=x.value;return typeof E==typeof I&&E>I}],"filter-id->":[Mt,[Qt],function(a,u){var p=u[0],x=a.id(),E=p.value;return typeof x==typeof E&&x>E}],"filter-<=":[Mt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],E=a.properties()[p.value],I=x.value;return typeof E==typeof I&&E<=I}],"filter-id-<=":[Mt,[Qt],function(a,u){var p=u[0],x=a.id(),E=p.value;return typeof x==typeof E&&x<=E}],"filter->=":[Mt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],E=a.properties()[p.value],I=x.value;return typeof E==typeof I&&E>=I}],"filter-id->=":[Mt,[Qt],function(a,u){var p=u[0],x=a.id(),E=p.value;return typeof x==typeof E&&x>=E}],"filter-has":[Mt,[Qt],function(a,u){return u[0].value in a.properties()}],"filter-has-id":[Mt,[],function(a){return a.id()!==null&&a.id()!==void 0}],"filter-type-in":[Mt,[Jr(Lt)],function(a,u){return u[0].value.indexOf(a.geometryType())>=0}],"filter-id-in":[Mt,[Jr(Qt)],function(a,u){return u[0].value.indexOf(a.id())>=0}],"filter-in-small":[Mt,[Lt,Jr(Qt)],function(a,u){var p=u[0];return u[1].value.indexOf(a.properties()[p.value])>=0}],"filter-in-large":[Mt,[Lt,Jr(Qt)],function(a,u){var p=u[0],x=u[1];return function(E,I,D,k){for(;D<=k;){var V=D+k>>1;if(I[V]===E)return!0;I[V]>E?k=V-1:D=V+1}return!1}(a.properties()[p.value],x.value,0,x.value.length-1)}],all:{type:Mt,overloads:[[[Mt,Mt],function(a,u){var p=u[1];return u[0].evaluate(a)&&p.evaluate(a)}],[Ya(Mt),function(a,u){for(var p=0,x=u;p<x.length;p+=1)if(!x[p].evaluate(a))return!1;return!0}]]},any:{type:Mt,overloads:[[[Mt,Mt],function(a,u){var p=u[1];return u[0].evaluate(a)||p.evaluate(a)}],[Ya(Mt),function(a,u){for(var p=0,x=u;p<x.length;p+=1)if(x[p].evaluate(a))return!0;return!1}]]},"!":[Mt,[Mt],function(a,u){return!u[0].evaluate(a)}],"is-supported-script":[Mt,[Lt],function(a,u){var p=a.globals&&a.globals.isSupportedScript;
2102return!p||p(u[0].evaluate(a))}],upcase:[Lt,[Lt],function(a,u){return u[0].evaluate(a).toUpperCase()}],downcase:[Lt,[Lt],function(a,u){return u[0].evaluate(a).toLowerCase()}],concat:[Lt,Ya(Qt),function(a,u){return u.map(function(p){return Wo(p.evaluate(a))}).join("")}],"resolved-locale":[Lt,[en],function(a,u){return u[0].evaluate(a).resolvedLocale()}]});var Sa=function(a,u){this.expression=a,this._warningHistory={},this._evaluator=new xe,this._defaultValue=u?function(p){return p.type==="color"&&du(p.default)?new tn(0,0,0,0):p.type==="color"?tn.parse(p.default)||null:p.default===void 0?null:p.default}(u):null,this._enumValues=u&&u.type==="enum"?u.values:null};function wo(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in to}function pu(a,u){var p=new vi(to,[],u?function(E){var I={color:Ht,string:Lt,number:ht,enum:Lt,boolean:Mt,formatted:cn,resolvedImage:Wr};return E.type==="array"?Jr(I[E.value]||Qt,E.length):I[E.type]}(u):void 0),x=p.parse(a,void 0,void 0,void 0,u&&u.type==="string"?{typeAnnotation:"coerce"}:void 0);return x?vf(new Sa(x,u)):Yo(p.errors)}Sa.prototype.evaluateWithoutErrorHandling=function(a,u,p,x,E,I){return this._evaluator.globals=a,this._evaluator.feature=u,this._evaluator.featureState=p,this._evaluator.canonical=x,this._evaluator.availableImages=E||null,this._evaluator.formattedSection=I,this.expression.evaluate(this._evaluator)},Sa.prototype.evaluate=function(a,u,p,x,E,I){this._evaluator.globals=a,this._evaluator.feature=u||null,this._evaluator.featureState=p||null,this._evaluator.canonical=x,this._evaluator.availableImages=E||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 ui("Expected value to be one of "+Object.keys(this._enumValues).map(function(k){return JSON.stringify(k)}).join(", ")+", but found "+JSON.stringify(D)+" instead.");return D}catch(k){return this._warningHistory[k.message]||(this._warningHistory[k.message]=!0,typeof console<"u"&&console.warn(k.message)),this._defaultValue}};var Za=function(a,u){this.kind=a,this._styleExpression=u,this.isStateDependent=a!=="constant"&&!ba(u.expression)};Za.prototype.evaluateWithoutErrorHandling=function(a,u,p,x,E,I){return this._styleExpression.evaluateWithoutErrorHandling(a,u,p,x,E,I)},Za.prototype.evaluate=function(a,u,p,x,E,I){return this._styleExpression.evaluate(a,u,p,x,E,I)};var Dc=function(a,u,p,x){this.kind=a,this.zoomStops=p,this._styleExpression=u,this.isStateDependent=a!=="camera"&&!ba(u.expression),this.interpolationType=x};function zs(a,u){if((a=pu(a,u)).result==="error")return a;var p=a.value.expression,x=Jo(p);if(!x&&!Zo(u))return Yo([new Et("","data expressions not supported")]);var E=Wa(p,["zoom"]);if(!E&&!Tl(u))return Yo([new Et("","zoom expressions not supported")]);var I=function D(k){var V=null;if(k instanceof Ca)V=D(k.result);else if(k instanceof wa)for(var K=0,Q=k.args;K<Q.length&&!(V=D(Q[K]));K+=1);else(k instanceof zn||k instanceof zi)&&k.input instanceof Pe&&k.input.name==="zoom"&&(V=k);return V instanceof Et||k.eachChild(function(ie){var fe=D(ie);fe instanceof Et?V=fe:!V&&fe?V=new Et("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):V&&fe&&V!==fe&&(V=new Et("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),V}(p);return I||E?I instanceof Et?Yo([I]):I instanceof zi&&!Fn(u)?Yo([new Et("",'"interpolate" expressions cannot be used with this property')]):vf(I?new Dc(x?"camera":"composite",a.value,I.labels,I instanceof zi?I.interpolation:void 0):new Za(x?"constant":"source",a.value)):Yo([new Et("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Dc.prototype.evaluateWithoutErrorHandling=function(a,u,p,x,E,I){return this._styleExpression.evaluateWithoutErrorHandling(a,u,p,x,E,I)},Dc.prototype.evaluate=function(a,u,p,x,E,I){return this._styleExpression.evaluate(a,u,p,x,E,I)},Dc.prototype.interpolationFactor=function(a,u,p){return this.interpolationType?zi.interpolationFactor(this.interpolationType,a,u,p):0};var Qa=function(a,u){this._parameters=a,this._specification=u,ce(this,function p(x,E){var I,D,k,V=E.type==="color",K=x.stops&&typeof x.stops[0][0]=="object",Q=K||!(K||x.property!==void 0),ie=x.type||(Fn(E)?"exponential":"interval");if(V&&((x=ce({},x)).stops&&(x.stops=x.stops.map(function(nr){return[nr[0],tn.parse(nr[1])]})),x.default=tn.parse(x.default?x.default:E.default)),x.colorSpace&&x.colorSpace!=="rgb"&&!yf[x.colorSpace])throw new Error("Unknown color space: "+x.colorSpace);if(ie==="exponential")I=zh;else if(ie==="interval")I=rA;else if(ie==="categorical"){I=Uh,D=Object.create(null);for(var fe=0,ye=x.stops;fe<ye.length;fe+=1){var ke=ye[fe];D[ke[0]]=ke[1]}k=typeof x.stops[0][0]}else{if(ie!=="identity")throw new Error('Unknown function type "'+ie+'"');I=ns}if(K){for(var Ne={},je=[],Ve=0;Ve<x.stops.length;Ve++){var qe=x.stops[Ve],ct=qe[0].zoom;Ne[ct]===void 0&&(Ne[ct]={zoom:ct,type:x.type,property:x.property,default:x.default,stops:[]},je.push(ct)),Ne[ct].stops.push([qe[0].value,qe[1]])}for(var mt=[],yt=0,Ft=je;yt<Ft.length;yt+=1){var jt=Ft[yt];mt.push([Ne[jt].zoom,p(Ne[jt],E)])}var qt={name:"linear"};return{kind:"composite",interpolationType:qt,interpolationFactor:zi.interpolationFactor.bind(void 0,qt),zoomStops:mt.map(function(nr){return nr[0]}),evaluate:function(nr,Br){var ir=nr.zoom;return zh({stops:mt,base:x.base},E,ir).evaluate(ir,Br)}}}if(Q){var br=ie==="exponential"?{name:"exponential",base:x.base!==void 0?x.base:1}:null;return{kind:"camera",interpolationType:br,interpolationFactor:zi.interpolationFactor.bind(void 0,br),zoomStops:x.stops.map(function(nr){return nr[0]}),evaluate:function(nr){return I(x,E,nr.zoom,D,k)}}}return{kind:"source",evaluate:function(nr,Br){var ir=Br&&Br.properties?Br.properties[x.property]:void 0;return ir===void 0?Fc(x.default,E.default):I(x,E,ir,D,k)}}}(this._parameters,this._specification))};function Gs(a){var u=a.key,p=a.value,x=a.valueSpec||{},E=a.objectElementValidators||{},I=a.style,D=a.styleSpec,k=[],V=On(p);if(V!=="object")return[new Be(u,p,"object expected, "+V+" found")];for(var K in p){var Q=K.split(".")[0],ie=x[Q]||x["*"],fe=void 0;if(E[Q])fe=E[Q];else if(x[Q])fe=fn;else if(E["*"])fe=E["*"];else{if(!x["*"]){k.push(new Be(u,p[K],'unknown property "'+K+'"'));continue}fe=fn}k=k.concat(fe({key:(u&&u+".")+K,value:p[K],valueSpec:ie,style:I,styleSpec:D,object:p,objectKey:K},p))}for(var ye in x)E[ye]||x[ye].required&&x[ye].default===void 0&&p[ye]===void 0&&k.push(new Be(u,p,'missing required property "'+ye+'"'));return k}function ec(a){var u=a.value,p=a.valueSpec,x=a.style,E=a.styleSpec,I=a.key,D=a.arrayElementValidator||fn;if(On(u)!=="array")return[new Be(I,u,"array expected, "+On(u)+" found")];if(p.length&&u.length!==p.length)return[new Be(I,u,"array length "+p.length+" expected, length "+u.length+" found")];if(p["min-length"]&&u.length<p["min-length"])return[new Be(I,u,"array length at least "+p["min-length"]+" expected, length "+u.length+" found")];var k={type:p.value,values:p.values};E.$version<7&&(k.function=p.function),On(p.value)==="object"&&(k=p.value);for(var V=[],K=0;K<u.length;K++)V=V.concat(D({array:u,arrayIndex:K,value:u[K],valueSpec:k,style:x,styleSpec:E,key:I+"["+K+"]"}));return V}function Oc(a){var u=a.key,p=a.value,x=a.valueSpec,E=On(p);return E==="number"&&p!=p&&(E="NaN"),E!=="number"?[new Be(u,p,"number expected, "+E+" found")]:"minimum"in x&&p<x.minimum?[new Be(u,p,p+" is less than the minimum value "+
vendor: 5,129 bytes, line 2102
2102x.minimum)]:"maximum"in x&&p>x.maximum?[new Be(u,p,p+" is greater than the maximum value "+x.maximum)]:[]}function Lc(a){var u,p,x,E=a.valueSpec,I=xt(a.value.type),D={},k=I!=="categorical"&&a.value.property===void 0,V=!k,K=On(a.value.stops)==="array"&&On(a.value.stops[0])==="array"&&On(a.value.stops[0][0])==="object",Q=Gs({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(ye){if(I==="identity")return[new Be(ye.key,ye.value,'identity function may not have a "stops" property')];var ke=[],Ne=ye.value;return ke=ke.concat(ec({key:ye.key,value:Ne,valueSpec:ye.valueSpec,style:ye.style,styleSpec:ye.styleSpec,arrayElementValidator:ie})),On(Ne)==="array"&&Ne.length===0&&ke.push(new Be(ye.key,Ne,"array must have at least one stop")),ke},default:function(ye){return fn({key:ye.key,value:ye.value,valueSpec:E,style:ye.style,styleSpec:ye.styleSpec})}}});return I==="identity"&&k&&Q.push(new Be(a.key,a.value,'missing required property "property"')),I==="identity"||a.value.stops||Q.push(new Be(a.key,a.value,'missing required property "stops"')),I==="exponential"&&a.valueSpec.expression&&!Fn(a.valueSpec)&&Q.push(new Be(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(V&&!Zo(a.valueSpec)?Q.push(new Be(a.key,a.value,"property functions not supported")):k&&!Tl(a.valueSpec)&&Q.push(new Be(a.key,a.value,"zoom functions not supported"))),I!=="categorical"&&!K||a.value.property!==void 0||Q.push(new Be(a.key,a.value,'"property" property is required')),Q;function ie(ye){var ke=[],Ne=ye.value,je=ye.key;if(On(Ne)!=="array")return[new Be(je,Ne,"array expected, "+On(Ne)+" found")];if(Ne.length!==2)return[new Be(je,Ne,"array length 2 expected, length "+Ne.length+" found")];if(K){if(On(Ne[0])!=="object")return[new Be(je,Ne,"object expected, "+On(Ne[0])+" found")];if(Ne[0].zoom===void 0)return[new Be(je,Ne,"object stop key must have zoom")];if(Ne[0].value===void 0)return[new Be(je,Ne,"object stop key must have value")];if(x&&x>xt(Ne[0].zoom))return[new Be(je,Ne[0].zoom,"stop zoom values must appear in ascending order")];xt(Ne[0].zoom)!==x&&(x=xt(Ne[0].zoom),p=void 0,D={}),ke=ke.concat(Gs({key:je+"[0]",value:Ne[0],valueSpec:{zoom:{}},style:ye.style,styleSpec:ye.styleSpec,objectElementValidators:{zoom:Oc,value:fe}}))}else ke=ke.concat(fe({key:je+"[0]",value:Ne[0],style:ye.style,styleSpec:ye.styleSpec},Ne));return wo(Ke(Ne[1]))?ke.concat([new Be(je+"[1]",Ne[1],"expressions are not allowed in function stops.")]):ke.concat(fn({key:je+"[1]",value:Ne[1],valueSpec:E,style:ye.style,styleSpec:ye.styleSpec}))}function fe(ye,ke){var Ne=On(ye.value),je=xt(ye.value),Ve=ye.value!==null?ye.value:ke;if(u){if(Ne!==u)return[new Be(ye.key,Ve,Ne+" stop domain type must match previous stop domain type "+u)]}else u=Ne;if(Ne!=="number"&&Ne!=="string"&&Ne!=="boolean")return[new Be(ye.key,Ve,"stop domain value must be a number, string, or boolean")];if(Ne!=="number"&&I!=="categorical"){var qe="number expected, "+Ne+" found";return Zo(E)&&I===void 0&&(qe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Be(ye.key,Ve,qe)]}return I!=="categorical"||Ne!=="number"||isFinite(je)&&Math.floor(je)===je?I!=="categorical"&&Ne==="number"&&p!==void 0&&je<p?[new Be(ye.key,Ve,"stop domain values must appear in ascending order")]:(p=je,I==="categorical"&&je in D?[new Be(ye.key,Ve,"stop domain values must be unique")]:(D[je]=!0,[])):[new Be(ye.key,Ve,"integer expected, found "+je)]}}function tc(a){var u=(a.expressionContext==="property"?zs:pu)(Ke(a.value),a.valueSpec);if(u.result==="error")return u.value.map(function(x){return new Be(""+a.key+x.key,a.value,x.message)});var p=u.value.expression||u.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!p.outputDefined())return[new Be(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"&&!ba(p))return[new Be(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!ba(p))return[new Be(a.key,a.value,'"feature-state" data expressions are not supported with filters.')];if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!Wa(p,["zoom","feature-state"]))return[new Be(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!Jo(p))return[new Be(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function kc(a){var u=a.key,p=a.value,x=a.valueSpec,E=[];return Array.isArray(x.values)?x.values.indexOf(xt(p))===-1&&E.push(new Be(u,p,"expected one of ["+x.values.join(", ")+"], "+JSON.stringify(p)+" found")):Object.keys(x.values).indexOf(xt(p))===-1&&E.push(new Be(u,p,"expected one of ["+Object.keys(x.values).join(", ")+"], "+JSON.stringify(p)+" found")),E}function Au(a){if(a===!0||a===!1)return!0;
2102if(!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 u=0,p=a.slice(1);u<p.length;u+=1){var x=p[u];if(!Au(x)&&typeof x!="boolean")return!1}return!0;default:return!0}}Qa.deserialize=function(a){return new Qa(a._parameters,a._specification)},Qa.serialize=function(a){return{_parameters:a._parameters,_specification:a._specification}};var El={type:"boolean",default:!1};function gu(a){if(a==null)return{filter:function(){return!0},needGeometry:!1};Au(a)||(a=Bl(a));var u=pu(a,El);if(u.result==="error")throw new Error(u.value.map(function(p){return p.key+": "+p.message}).join(", "));return{filter:function(p,x,E){return u.value.evaluate(p,x,{},E)},needGeometry:function p(x){if(!Array.isArray(x))return!1;if(x[0]==="within")return!0;for(var E=1;E<x.length;E++)if(p(x[E]))return!0;return!1}(a)}}function nA(a,u){return a<u?-1:a>u?1:0}function Bl(a){if(!a)return!0;var u,p=a[0];return a.length<=1?p!=="any":p==="=="?mu(a[1],a[2],"=="):p==="!="?_u(mu(a[1],a[2],"==")):p==="<"||p===">"||p==="<="||p===">="?mu(a[1],a[2],p):p==="any"?(u=a.slice(1),["any"].concat(u.map(Bl))):p==="all"?["all"].concat(a.slice(1).map(Bl)):p==="none"?["all"].concat(a.slice(1).map(Bl).map(_u)):p==="in"?Nc(a[1],a.slice(2)):p==="!in"?_u(Nc(a[1],a.slice(2))):p==="has"?rc(a[1]):p==="!has"?_u(rc(a[1])):p!=="within"||a}function mu(a,u,p){switch(a){case"$type":return["filter-type-"+p,u];case"$id":return["filter-id-"+p,u];default:return["filter-"+p,a,u]}}function Nc(a,u){if(u.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",u]];case"$id":return["filter-id-in",["literal",u]];default:return u.length>200&&!u.some(function(p){return typeof p!=typeof u[0]})?["filter-in-large",a,["literal",u.sort(nA)]]:["filter-in-small",a,["literal",u]]}}function rc(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function _u(a){return["!",a]}function nc(a){return Au(Ke(a.value))?tc(ce({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function u(p){var x=p.value,E=p.key;if(On(x)!=="array")return[new Be(E,x,"array expected, "+On(x)+" found")];var I,D=p.styleSpec,k=[];if(x.length<1)return[new Be(E,x,"filter array must have at least 1 element")];switch(k=k.concat(kc({key:E+"[0]",value:x[0],valueSpec:D.filter_operator,style:p.style,styleSpec:p.styleSpec})),xt(x[0])){case"<":case"<=":case">":case">=":x.length>=2&&xt(x[1])==="$type"&&k.push(new Be(E,x,'"$type" cannot be use with operator "'+x[0]+'"'));case"==":case"!=":x.length!==3&&k.push(new Be(E,x,'filter array for operator "'+x[0]+'" must have 3 elements'));case"in":case"!in":x.length>=2&&(I=On(x[1]))!=="string"&&k.push(new Be(E+"[1]",x[1],"string expected, "+I+" found"));for(var V=2;V<x.length;V++)I=On(x[V]),xt(x[1])==="$type"?k=k.concat(kc({key:E+"["+V+"]",value:x[V],valueSpec:D.geometry_type,style:p.style,styleSpec:p.styleSpec})):I!=="string"&&I!=="number"&&I!=="boolean"&&k.push(new Be(E+"["+V+"]",x[V],"string, number, or boolean expected, "+I+" found"));break;case"any":case"all":case"none":for(var K=1;K<x.length;K++)k=k.concat(u({key:E+"["+K+"]",value:x[K],style:p.style,styleSpec:p.styleSpec}));break;case"has":case"!has":I=On(x[1]),x.length!==2?k.push(new Be(E,x,'filter array for "'+x[0]+'" operator must have 2 elements')):I!=="string"&&k.push(new Be(E+"[1]",x[1],"string expected, "+I+" found"));break;case"within":I=On(x[1]),x.length!==2?k.push(new Be(E,x,'filter array for "'+x[0]+'" operator must have 2 elements')):I!=="object"&&k.push(new Be(E+"[1]",x[1],"object expected, "+I+" found"))}return k}(a)}function bf(a,u){var p=a.key,x=a.style,E=a.styleSpec,I=a.value,D=a.objectKey,k=E[u+"_"+a.layerType];if(!k)return[];var V=D.match(/^(.*)-transition$/);if(u==="paint"&&V&&k[V[1]]&&k[V[1]].transition)return fn({key:p,value:I,valueSpec:E.transition,style:x,styleSpec:E});var K,Q=a.valueSpec||k[D];if(!Q)return[new Be(p,I,'unknown property "'+D+'"')];
2102if(On(I)==="string"&&Zo(Q)&&!Q.tokens&&(K=/^{([^}]+)}$/.exec(I)))return[new Be(p,I,'"'+D+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(K[1])+" }`.")];var ie=[];return a.layerType==="symbol"&&(D==="text-field"&&x&&!x.glyphs&&ie.push(new Be(p,I,'use of "text-field" requires a style "glyphs" property')),D==="text-font"&&du(Ke(I))&&xt(I.type)==="identity"&&ie.push(new Be(p,I,'"text-font" does not support identity functions'))),ie.concat(fn({key:a.key,value:I,valueSpec:Q,style:x,styleSpec:E,expressionContext:"property",propertyType:u,propertyKey:D}))}function xf(a){return bf(a,"paint")}function Sl(a){return bf(a,"layout")}function Gh(a){var u=[],p=a.value,x=a.key,E=a.style,I=a.styleSpec;p.type||p.ref||u.push(new Be(x,p,'either "type" or "ref" is required'));var D,k=xt(p.type),V=xt(p.ref);if(p.id)for(var K=xt(p.id),Q=0;Q<a.arrayIndex;Q++){var ie=E.layers[Q];xt(ie.id)===K&&u.push(new Be(x,p.id,'duplicate layer id "'+p.id+'", previously used at line '+ie.id.__line__))}if("ref"in p)["type","source","source-layer","filter","layout"].forEach(function(ke){ke in p&&u.push(new Be(x,p[ke],'"'+ke+'" is prohibited for ref layers'))}),E.layers.forEach(function(ke){xt(ke.id)===V&&(D=ke)}),D?D.ref?u.push(new Be(x,p.ref,"ref cannot reference another ref layer")):k=xt(D.type):u.push(new Be(x,p.ref,'ref layer "'+V+'" not found'));else if(k!=="background")if(p.source){var fe=E.sources&&E.sources[p.source],ye=fe&&xt(fe.type);fe?ye==="vector"&&k==="raster"?u.push(new Be(x,p.source,'layer "'+p.id+'" requires a raster source')):ye==="raster"&&k!=="raster"?u.push(new Be(x,p.source,'layer "'+p.id+'" requires a vector source')):ye!=="vector"||p["source-layer"]?ye==="raster-dem"&&k!=="hillshade"?u.push(new Be(x,p.source,"raster-dem source can only be used with layer type 'hillshade'.")):k!=="line"||!p.paint||!p.paint["line-gradient"]||ye==="geojson"&&fe.lineMetrics||u.push(new Be(x,p,'layer "'+p.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):u.push(new Be(x,p,'layer "'+p.id+'" must specify a "source-layer"')):u.push(new Be(x,p.source,'source "'+p.source+'" not found'))}else u.push(new Be(x,p,'missing required property "source"'));return u=u.concat(Gs({key:x,value:p,valueSpec:I.layer,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return fn({key:x+".type",value:p.type,valueSpec:I.layer.type,style:a.style,styleSpec:a.styleSpec,object:p,objectKey:"type"})},filter:nc,layout:function(ke){return Gs({layer:p,key:ke.key,value:ke.value,style:ke.style,styleSpec:ke.styleSpec,objectElementValidators:{"*":function(Ne){return Sl(ce({layerType:k},Ne))}}})},paint:function(ke){return Gs({layer:p,key:ke.key,value:ke.value,style:ke.style,styleSpec:ke.styleSpec,objectElementValidators:{"*":function(Ne){return xf(ce({layerType:k},Ne))}}})}}}))}function ic(a){var u=a.value,p=a.key,x=On(u);return x!=="string"?[new Be(p,u,"string expected, "+x+" found")]:[]}var Wn={promoteId:function(a){var u=a.key,p=a.value;if(On(p)==="string")return ic({key:u,value:p});var x=[];for(var E in p)x.push.apply(x,ic({key:u+"."+E,value:p[E]}));return x}};function yu(a){var u=a.value,p=a.key,x=a.styleSpec,E=a.style;if(!u.type)return[new Be(p,u,'"type" is required')];var I,D=xt(u.type);switch(D){case"vector":case"raster":case"raster-dem":return Gs({key:p,value:u,valueSpec:x["source_"+D.replace("-","_")],style:a.style,styleSpec:x,objectElementValidators:Wn});case"geojson":if(I=Gs({key:p,value:u,valueSpec:x.source_geojson,style:E,styleSpec:x,objectElementValidators:Wn}),u.cluster)for(var k in u.clusterProperties){var V=u.clusterProperties[k],K=V[0],Q=typeof K=="string"?[K,["accumulated"],["get",k]]:K;I.push.apply(I,tc({key:p+"."+k+".map",value:V[1],expressionContext:"cluster-map"})),I.push.apply(I,tc({key:p+"."+k+".reduce",value:Q,expressionContext:"cluster-reduce"}))}return I;case"video":return Gs({key:p,value:u,valueSpec:x.source_video,style:E,styleSpec:x});case"image":return Gs({key:p,value:u,valueSpec:x.source_image,style:E,styleSpec:x});case"canvas":return[new Be(p,null,"Please use runtime APIs to add canvas sources, rather than 
2102including them in stylesheets.","source.canvas")];default:return kc({key:p+".type",value:u.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Qo(a){var u=a.value,p=a.styleSpec,x=p.light,E=a.style,I=[],D=On(u);if(u===void 0)return I;if(D!=="object")return I.concat([new Be("light",u,"object expected, "+D+" found")]);for(var k in u){var V=k.match(/^(.*)-transition$/);I=I.concat(V&&x[V[1]]&&x[V[1]].transition?fn({key:k,value:u[k],valueSpec:p.transition,style:E,styleSpec:p}):x[k]?fn({key:k,value:u[k],valueSpec:x[k],style:E,styleSpec:p}):[new Be(k,u[k],'unknown property "'+k+'"')])}return I}var ea={"*":function(){return[]},array:ec,boolean:function(a){var u=a.value,p=a.key,x=On(u);return x!=="boolean"?[new Be(p,u,"boolean expected, "+x+" found")]:[]},number:Oc,color:function(a){var u=a.key,p=a.value,x=On(p);return x!=="string"?[new Be(u,p,"color expected, "+x+" found")]:Xt(p)===null?[new Be(u,p,'color expected, "'+p+'" found')]:[]},constants:g,enum:kc,filter:nc,function:Lc,layer:Gh,object:Gs,source:yu,light:Qo,string:ic,formatted:function(a){return ic(a).length===0?[]:tc(a)},resolvedImage:function(a){return ic(a).length===0?[]:tc(a)}};function fn(a){var u=a.value,p=a.valueSpec,x=a.styleSpec;return p.expression&&du(xt(u))?Lc(a):p.expression&&wo(Ke(u))?tc(a):p.type&&ea[p.type]?ea[p.type](a):Gs(ce({},a,{valueSpec:p.type?x[p.type]:p}))}function Ln(a){var u=a.value,p=a.key,x=ic(a);return x.length||(u.indexOf("{fontstack}")===-1&&x.push(new Be(p,u,'"glyphs" url must include a "{fontstack}" token')),u.indexOf("{range}")===-1&&x.push(new Be(p,u,'"glyphs" url must include a "{range}" token'))),x}function Vs(a,u){u===void 0&&(u=ae);var p=[];return p=p.concat(fn({key:"",value:a,valueSpec:u.$root,styleSpec:u,style:a,objectElementValidators:{glyphs:Ln,"*":function(){return[]}}})),a.constants&&(p=p.concat(g({key:"constants",value:a.constants}))),Il(p)}function Il(a){return[].concat(a).sort(function(u,p){return u.line-p.line})}function Uc(a){return function(){for(var u=[],p=arguments.length;p--;)u[p]=arguments[p];return Il(a.apply(this,u))}}Vs.source=Uc(yu),Vs.light=Uc(Qo),Vs.layer=Uc(Gh),Vs.filter=Uc(nc),Vs.paintProperty=Uc(xf),Vs.layoutProperty=Uc(Sl);var Ml=Vs,iA=Ml.light,sA=Ml.paintProperty,zc=Ml.layoutProperty;function Pl(a,u){var p=!1;if(u&&u.length)for(var x=0,E=u;x<E.length;x+=1)a.fire(new he(new Error(E[x].message))),p=!0;return p}var Fo=kn;function kn(a,u,p){var x=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;var E=new Int32Array(this.arrayBuffer);a=E[0],this.d=(u=E[1])+2*(p=E[2]);for(var I=0;I<this.d*this.d;I++){var D=E[3+I],k=E[3+I+1];x.push(D===k?null:E.subarray(D,k))}var V=E[3+x.length+1];this.keys=E.subarray(E[3+x.length],V),this.bboxes=E.subarray(V),this.insert=this._insertReadonly}else{this.d=u+2*p;for(var K=0;K<this.d*this.d;K++)x.push([]);this.keys=[],this.bboxes=[]}this.n=u,this.extent=a,this.padding=p,this.scale=u/a,this.uid=0;var Q=p/u*a;this.min=-Q,this.max=a+Q}kn.prototype.insert=function(a,u,p,x,E){this._forEachCell(u,p,x,E,this._insertCell,this.uid++),this.keys.push(a),this.bboxes.push(u),this.bboxes.push(p),this.bboxes.push(x),this.bboxes.push(E)},kn.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},kn.prototype._insertCell=function(a,u,p,x,E,I){this.cells[E].push(I)},kn.prototype.query=function(a,u,p,x,E){var I=this.min,D=this.max;if(a<=I&&u<=I&&D<=p&&D<=x&&!E)return Array.prototype.slice.call(this.keys);var k=[];return this._forEachCell(a,u,p,x,this._queryCell,k,{},E),k},kn.prototype._queryCell=function(a,u,p,x,E,I,D,k){var V=this.cells[E];if(V!==null)for(var K=this.keys,Q=this.bboxes,ie=0;ie<V.length;ie++){var fe=V[ie];if(D[fe]===void 0){var ye=4*fe;(k?k(Q[ye+0],Q[ye+1],Q[ye+2],Q[ye+3]):a<=Q[ye+2]&&u<=Q[ye+3]&&p>=Q[ye+0]&&x>=Q[ye+1])?(D[fe]=!0,I.push(K[fe])):D[fe]=!1}}},kn.prototype._forEachCell=function(a,u,p,x,E,I,D,k){for(var V=this._convertToCellCoord(a),K=this._convertToCellCoord(u),Q=this._convertToCellCoord(p),ie=this._convertToCellCoord(x),fe=V;fe<=Q;fe++)for(var ye=K;ye<=ie;ye++){var ke=this.d*ye+fe;if((!k||k(this._convertFromCellCoord(fe),this._convertFromCellCoord(ye),this._convertFromCellCoord(fe+1),this._convertFromCellCoord(ye+1)))&&E.call(this,a,u,p,x,ke,I,D,k))return}},kn.prototype._convertFromCellCoord=function(a){return(a-this.padding)/this.scale},kn.prototype._convertToCellCoord=function(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))},kn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var a=this.cells,u=3+this.cells.length+1+1,p=0,x=0;x<this.cells.length;x++)p+=this.cells[x].length;var E=new Int32Array(u+p+this.keys.length+this.bboxes.length);E[0]=this.extent,E[1]=this.n,E[2]=this.padding;
2102for(var I=u,D=0;D<a.length;D++){var k=a[D];E[3+D]=I,E.set(k,I),I+=k.length}return E[3+a.length]=I,E.set(this.keys,I),E[3+a.length+1]=I+=this.keys.length,E.set(this.bboxes,I),I+=this.bboxes.length,E.buffer};var Gc=S.ImageData,Vh=S.ImageBitmap,Ci={};function or(a,u,p){p===void 0&&(p={}),Object.defineProperty(u,"_classRegistryKey",{value:a,writeable:!1}),Ci[a]={klass:u,omit:p.omit||[],shallow:p.shallow||[]}}for(var Ss in or("Object",Object),Fo.serialize=function(a,u){var p=a.toArrayBuffer();return u&&u.push(p),{buffer:p}},Fo.deserialize=function(a){return new Fo(a.buffer)},or("Grid",Fo),or("Color",tn),or("Error",Error),or("ResolvedImage",jn),or("StylePropertyFunction",Qa),or("StyleExpression",Sa,{omit:["_evaluator"]}),or("ZoomDependentExpression",Dc),or("ZoomConstantExpression",Za),or("CompoundExpression",Pe,{omit:["_evaluate"]}),to)to[Ss]._classRegistryKey||or("Expression_"+Ss,to[Ss]);function vu(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}function Hs(a){return Vh&&a instanceof Vh}function ro(a,u){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(vu(a)||Hs(a))return u&&u.push(a),a;if(ArrayBuffer.isView(a)){var p=a;return u&&u.push(p.buffer),p}if(a instanceof Gc)return u&&u.push(a.data.buffer),a;if(Array.isArray(a)){for(var x=[],E=0,I=a;E<I.length;E+=1)x.push(ro(I[E],u));return x}if(typeof a=="object"){var D=a.constructor,k=D._classRegistryKey;if(!k)throw new Error("can't serialize object of unregistered class");var V=D.serialize?D.serialize(a,u):{};if(!D.serialize){for(var K in a)if(a.hasOwnProperty(K)&&!(Ci[k].omit.indexOf(K)>=0)){var Q=a[K];V[K]=Ci[k].shallow.indexOf(K)>=0?Q:ro(Q,u)}a instanceof Error&&(V.message=a.message)}if(V.$name)throw new Error("$name property is reserved for worker serialization logic.");return k!=="Object"&&(V.$name=k),V}throw new Error("can't serialize object of type "+typeof a)}function _s(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||vu(a)||Hs(a)||ArrayBuffer.isView(a)||a instanceof Gc)return a;if(Array.isArray(a))return a.map(_s);if(typeof a=="object"){var u=a.$name||"Object",p=Ci[u].klass;if(!p)throw new Error("can't deserialize unregistered class "+u);if(p.deserialize)return p.deserialize(a);for(var x=Object.create(p.prototype),E=0,I=Object.keys(a);E<I.length;E+=1){var D=I[E];if(D!=="$name"){var k=a[D];x[D]=Ci[u].shallow.indexOf(D)>=0?k:_s(k)}}return x}throw new Error("can't deserialize object of type "+typeof a)}var wf=function(){this.first=!0};wf.prototype.update=function(a,u){var p=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=u):this.lastFloorZoom<p&&(this.lastIntegerZoom=p,this.lastIntegerZoomTime=u),a!==this.lastZoom&&(this.lastZoom=a,this.lastFloorZoom=p,!0))};var Yt={"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}
2102,"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 Cf(a){for(var u=0,p=a;u<p.length;u+=1)if(bu(p[u].charCodeAt(0)))return!0;return!1}function bu(a){return!(a!==746&&a!==747&&(a<4352||!(Yt["Bopomofo Extended"](a)||Yt.Bopomofo(a)||Yt["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||Yt["CJK Compatibility Ideographs"](a)||Yt["CJK Compatibility"](a)||Yt["CJK Radicals Supplement"](a)||Yt["CJK Strokes"](a)||!(!Yt["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||Yt["CJK Unified Ideographs Extension A"](a)||Yt["CJK Unified Ideographs"](a)||Yt["Enclosed CJK Letters and Months"](a)||Yt["Hangul Compatibility Jamo"](a)||Yt["Hangul Jamo Extended-A"](a)||Yt["Hangul Jamo Extended-B"](a)||Yt["Hangul Jamo"](a)||Yt["Hangul Syllables"](a)||Yt.Hiragana(a)||Yt["Ideographic Description Characters"](a)||Yt.Kanbun(a)||Yt["Kangxi Radicals"](a)||Yt["Katakana Phonetic Extensions"](a)||Yt.Katakana(a)&&a!==12540||!(!Yt["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)||!(!Yt["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||Yt["Unified Canadian Aboriginal Syllabics"](a)||Yt["Unified Canadian Aboriginal Syllabics Extended"](a)||Yt["Vertical Forms"](a)||Yt["Yijing Hexagram Symbols"](a)||Yt["Yi Syllables"](a)||Yt["Yi Radicals"](a))))}function Tf(a){return!(bu(a)||function(u){return!!(Yt["Latin-1 Supplement"](u)&&(u===167||u===169||u===174||u===177||u===188||u===189||u===190||u===215||u===247)||Yt["General Punctuation"](u)&&(u===8214||u===8224||u===8225||u===8240||u===8241||u===8251||u===8252||u===8258||u===8263||u===8264||u===8265||u===8273)||Yt["Letterlike Symbols"](u)||Yt["Number Forms"](u)||Yt["Miscellaneous Technical"](u)&&(u>=8960&&u<=8967||u>=8972&&u<=8991||u>=8996&&u<=9e3||u===9003||u>=9085&&u<=9114||u>=9150&&u<=9165||u===9167||u>=9169&&u<=9179||u>=9186&&u<=9215)||Yt["Control Pictures"](u)&&u!==9251||Yt["Optical Character Recognition"](u)||Yt["Enclosed Alphanumerics"](u)||Yt["Geometric Shapes"](u)||Yt["Miscellaneous Symbols"](u)&&!(u>=9754&&u<=9759)||Yt["Miscellaneous Symbols and Arrows"](u)&&(u>=11026&&u<=11055||u>=11088&&u<=11097||u>=11192&&u<=11243)||Yt["CJK Symbols and Punctuation"](u)||Yt.Katakana(u)||Yt["Private Use Area"](u)||Yt["CJK Compatibility Forms"](u)||Yt["Small Form Variants"](u)||Yt["Halfwidth and Fullwidth Forms"](u)||u===8734||u===8756||u===8757||u>=9984&&u<=10087||u>=10102&&u<=10131||u===65532||u===65533)}(a))}function no(a){return a>=1424&&a<=2303||Yt["Arabic Presentation Forms-A"](a)||Yt["Arabic Presentation Forms-B"](a)}function Is(a,u){return!(!u&&no(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||Yt.Khmer(a))}function xu(a){for(var u=0,p=a;u<p.length;u+=1)if(no(p[u].charCodeAt(0)))return!0;return!1}var wu=null,Ms="unavailable",ta=null,Ef=function(a){a&&typeof a=="str
2102ing"&&a.indexOf("NetworkError")>-1&&(Ms="error"),wu&&wu(a)};function Vc(){Ti.fire(new Oe("pluginStateChange",{pluginStatus:Ms,pluginURL:ta}))}var Ti=new be,Bf=function(){return Ms},Co=function(){if(Ms!=="deferred"||!ta)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ms="loading",Vc(),ta&&Je({url:ta},function(a){a?Ef(a):(Ms="loaded",Vc())})},is={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Ms==="loaded"||is.applyArabicShaping!=null},isLoading:function(){return Ms==="loading"},setState:function(a){Ms=a.pluginStatus,ta=a.pluginURL},isParsed:function(){return is.applyArabicShaping!=null&&is.processBidirectionalText!=null&&is.processStyledBidirectionalText!=null},getPluginURL:function(){return ta}},Hr=function(a,u){this.zoom=a,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.zoomHistory=u.zoomHistory,this.transition=u.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new wf,this.transition={})};Hr.prototype.isSupportedScript=function(a){return function(u,p){for(var x=0,E=u;x<E.length;x+=1)if(!Is(E[x].charCodeAt(0),p))return!1;return!0}(a,is.isLoaded())},Hr.prototype.crossFadingFactor=function(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},Hr.prototype.getCrossfadeParameters=function(){var a=this.zoom,u=a-Math.floor(a),p=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:u+(1-u)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*u}};var Do=function(a,u){this.property=a,this.value=u,this.expression=function(p,x){if(du(p))return new Qa(p,x);if(wo(p)){var E=zs(p,x);if(E.result==="error")throw new Error(E.value.map(function(D){return D.key+": "+D.message}).join(", "));return E.value}var I=p;return typeof p=="string"&&x.type==="color"&&(I=tn.parse(p)),{kind:"constant",evaluate:function(){return I}}}(u===void 0?a.specification.default:u,a.specification)};Do.prototype.isDataDriven=function(){return this.expression.kind==="source"||this.expression.kind==="composite"},Do.prototype.possiblyEvaluate=function(a,u,p){return this.property.possiblyEvaluate(this,a,u,p)};var io=function(a){this.property=a,this.value=new Do(a,void 0)};io.prototype.transitioned=function(a,u){return new Ia(this.property,this.value,u,H({},a.transition,this.transition),a.now)},io.prototype.untransitioned=function(){return new Ia(this.property,this.value,null,{},0)};var Xi=function(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)};Xi.prototype.getValue=function(a){return pe(this._values[a].value.value)},Xi.prototype.setValue=function(a,u){this._values.hasOwnProperty(a)||(this._values[a]=new io(this._values[a].property)),this._values[a].value=new Do(this._values[a].property,u===null?void 0:pe(u))},Xi.prototype.getTransition=function(a){return pe(this._values[a].transition)},Xi.prototype.setTransition=function(a,u){this._values.hasOwnProperty(a)||(this._values[a]=new io(this._values[a].property)),this._values[a].transition=pe(u)||void 0},Xi.prototype.serialize=function(){for(var a={},u=0,p=Object.keys(this._values);u<p.length;u+=1){var x=p[u],E=this.getValue(x);E!==void 0&&(a[x]=E);var I=this.getTransition(x);I!==void 0&&(a[x+"-transition"]=I)}return a},Xi.prototype.transitioned=function(a,u){for(var p=new ra(this._properties),x=0,E=Object.keys(this._values);x<E.length;x+=1){var I=E[x];p._values[I]=this._values[I].transitioned(a,u._values[I])}return p},Xi.prototype.untransitioned=function(){for(var a=new ra(this._properties),u=0,p=Object.keys(this._values);u<p.length;u+=1){var x=p[u];a._values[x]=this._values[x].untransitioned()}return a};var Ia=function(a,u,p,x,E){this.property=a,this.value=u,this.begin=E+x.delay||0,this.end=this.begin+x.duration||0,a.specification.transition&&(x.delay||x.duration)&&(this.prior=p)};Ia.prototype.possiblyEvaluate=function(a,u,p){var x=a.now||0,E=this.value.possiblyEvaluate(a,u,p),I=this.prior;if(I){if(x>this.end)return this.prior=null,E;if(this.value.isDataDriven())return this.prior=null,E;if(x<this.begin)return I.possiblyEvaluate(a,u,p);var D=(x-this.begin)/(this.end-this.begin);return this.property.interpolate(I.possiblyEvaluate(a,u,p),E,function(k){if(k<=0)return 0;if(k>=1)return 1;var V=k*k,K=V*k;return 4*(k<.5?K:3*(k-V)+K-.75)}(D))}return E};var ra=function(a){this._properties=a,this._values=Object.create(a.defaultTransitioningPropertyValues)};ra.prototype.possiblyEvaluate=function(a,u,p){for(var x=new Rl(this._properties),E=0,I=Object.keys(this._values);E<I.length;E+=1){var D=I[E];x._values[D]=this._values[D].possiblyEvaluate(a,u,p)}return x},ra.prototype.hasTransition=function(){for(var a=0,u=Object.keys(this._values);a<u.length;a+=1)if(this._values[u[a]].prior)return!0;return!1};var so=function(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)};so.prototype.getValue=function(a){return pe(this._values[a].value)},so.prototype.setValue=function(a,u){this._values[a]=new Do(this._values[a].property,u===null?void 0:pe(u))},so.prototype.serialize=function(){for(var a={},u=0,p=Object.keys(this._values);u<p.length;u+=1){var x=p[u],E=this.getValue(x);E!==void 0&&(a[x]=E)}return a},so.prototype.possiblyEvaluate=function(a,u,p){for(var x=new Rl(this._properties),E=0,I=Object.keys(this._values);E<I.length;E+=1){var D=I[E];x._values[D]=this._values[D].possiblyEvaluate(a,u,p)}return x};var ss=function(a,u,p){this.property=a,this.value=u,this.parameters=p};ss.prototype.isConstant=function(){return this.value.kind==="constant"},ss.prototype.constantOr=function(a){return this.value.kind==="constant"?this.value.value:a},ss.prototype.evaluate=function(a,u,p,x){return this.property.evaluate(this.value,this.parameters,a,u,p,x)};var Rl=function(a){this._properties=a,this._values=Object.create(a.defaultPossiblyEvaluatedValues)};Rl.prototype.get=function(a){return this._values[a]};var wr=function(a){this.specification=a};wr.prototype.possiblyEvaluate=function(a,u){return a.expression.evaluate(u)},wr.prototype.interpolate=function(a,u,p){var x=Ja[this.specification.type];return x?x(a,u,p):a};var ur=function(a,u){this.specification=a,this.overrides=u};ur.prototype.possiblyEvaluate=function(a,u,p,x){return new ss(this,a.expression.kind==="constant"||a.expression.kind==="camera"?{kind:"constant",value:a.expression.evaluate(u,null,{},p,x)}:a.expression,u)},ur.prototype.interpolate=function(a,u,p){if(a.value.kind!=="constant"||u.value.kind!=="constant")return a;
2102if(a.value.value===void 0||u.value.value===void 0)return new ss(this,{kind:"constant",value:void 0},a.parameters);var x=Ja[this.specification.type];return x?new ss(this,{kind:"constant",value:x(a.value.value,u.value.value,p)},a.parameters):a},ur.prototype.evaluate=function(a,u,p,x,E,I){return a.kind==="constant"?a.value:a.evaluate(u,p,x,E,I)};var Cu=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.possiblyEvaluate=function(p,x,E,I){if(p.value===void 0)return new ss(this,{kind:"constant",value:void 0},x);if(p.expression.kind==="constant"){var D=p.expression.evaluate(x,null,{},E,I),k=p.property.specification.type==="resolvedImage"&&typeof D!="string"?D.name:D,V=this._calculate(k,k,k,x);return new ss(this,{kind:"constant",value:V},x)}if(p.expression.kind==="camera"){var K=this._calculate(p.expression.evaluate({zoom:x.zoom-1}),p.expression.evaluate({zoom:x.zoom}),p.expression.evaluate({zoom:x.zoom+1}),x);return new ss(this,{kind:"constant",value:K},x)}return new ss(this,p.expression,x)},u.prototype.evaluate=function(p,x,E,I,D,k){if(p.kind==="source"){var V=p.evaluate(x,E,I,D,k);return this._calculate(V,V,V,x)}return p.kind==="composite"?this._calculate(p.evaluate({zoom:Math.floor(x.zoom)-1},E,I),p.evaluate({zoom:Math.floor(x.zoom)},E,I),p.evaluate({zoom:Math.floor(x.zoom)+1},E,I),x):p.value},u.prototype._calculate=function(p,x,E,I){return I.zoom>I.zoomHistory.lastIntegerZoom?{from:p,to:x}:{from:E,to:x}},u.prototype.interpolate=function(p){return p},u}(ur),fs=function(a){this.specification=a};fs.prototype.possiblyEvaluate=function(a,u,p,x){if(a.value!==void 0){if(a.expression.kind==="constant"){var E=a.expression.evaluate(u,null,{},p,x);return this._calculate(E,E,E,u)}return this._calculate(a.expression.evaluate(new Hr(Math.floor(u.zoom-1),u)),a.expression.evaluate(new Hr(Math.floor(u.zoom),u)),a.expression.evaluate(new Hr(Math.floor(u.zoom+1),u)),u)}},fs.prototype._calculate=function(a,u,p,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:u}:{from:p,to:u}},fs.prototype.interpolate=function(a){return a};var Ki=function(a){this.specification=a};Ki.prototype.possiblyEvaluate=function(a,u,p,x){return!!a.expression.evaluate(u,null,{},p,x)},Ki.prototype.interpolate=function(){return!1};var Jn=function(a){for(var u in this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],a){var p=a[u];p.specification.overridable&&this.overridableProperties.push(u);var x=this.defaultPropertyValues[u]=new Do(p,void 0),E=this.defaultTransitionablePropertyValues[u]=new io(p);this.defaultTransitioningPropertyValues[u]=E.untransitioned(),this.defaultPossiblyEvaluatedValues[u]=x.possiblyEvaluate({})}};or("DataDrivenProperty",ur),or("DataConstantProperty",wr),or("CrossFadedDataDrivenProperty",Cu),or("CrossFadedProperty",fs),or("ColorRampProperty",Ki);var zr=function(a){function u(p,x){if(a.call(this),this.id=p.id,this.type=p.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},p.type!=="custom"&&(this.metadata=(p=p).metadata,this.minzoom=p.minzoom,this.maxzoom=p.maxzoom,p.type!=="background"&&(this.source=p.source,this.sourceLayer=p["source-layer"],this.filter=p.filter),x.layout&&(this._unevaluatedLayout=new so(x.layout)),x.paint)){for(var E in this._transitionablePaint=new Xi(x.paint),p.paint)this.setPaintProperty(E,p.paint[E],{validate:!1});for(var I in p.layout)this.setLayoutProperty(I,p.layout[I],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Rl(x.paint)}}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},u.prototype.getLayoutProperty=function(p){return p==="visibility"?this.visibility:this._unevaluatedLayout.getValue(p)},u.prototype.setLayoutProperty=function(p,x,E){E===void 0&&(E={}),x!=null&&this._validate(zc,"layers."+this.id+".layout."+p,p,x,E)||(p!=="visibility"?this._unevaluatedLayout.setValue(p,x):this.visibility=x)},u.prototype.getPaintProperty=function(p){return Ue(p,"-transition")?this._transitionablePaint.getTransition(p.slice(0,-11)):this._transitionablePaint.getValue(p)},u.prototype.setPaintProperty=function(p,x,E){if(E===void 0&&(E={}
2102),x!=null&&this._validate(sA,"layers."+this.id+".paint."+p,p,x,E))return!1;if(Ue(p,"-transition"))return this._transitionablePaint.setTransition(p.slice(0,-11),x||void 0),!1;var I=this._transitionablePaint._values[p],D=I.property.specification["property-type"]==="cross-faded-data-driven",k=I.value.isDataDriven(),V=I.value;this._transitionablePaint.setValue(p,x),this._handleSpecialPaintPropertyUpdate(p);var K=this._transitionablePaint._values[p].value;return K.isDataDriven()||k||D||this._handleOverridablePaintPropertyUpdate(p,V,K)},u.prototype._handleSpecialPaintPropertyUpdate=function(p){},u.prototype._handleOverridablePaintPropertyUpdate=function(p,x,E){return!1},u.prototype.isHidden=function(p){return!!(this.minzoom&&p<this.minzoom)||!!(this.maxzoom&&p>=this.maxzoom)||this.visibility==="none"},u.prototype.updateTransitions=function(p){this._transitioningPaint=this._transitionablePaint.transitioned(p,this._transitioningPaint)},u.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},u.prototype.recalculate=function(p,x){p.getCrossfadeParameters&&(this._crossfadeParameters=p.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(p,void 0,x)),this.paint=this._transitioningPaint.possiblyEvaluate(p,void 0,x)}
2102,u.prototype.serialize=function(){var p={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&&(p.layout=p.layout||{},p.layout.visibility=this.visibility),me(p,function(x,E){return!(x===void 0||E==="layout"&&!Object.keys(x).length||E==="paint"&&!Object.keys(x).length)})},u.prototype._validate=function(p,x,E,I,D){return D===void 0&&(D={}),(!D||D.validate!==!1)&&Pl(this,p.call(Ml,{key:x,layerType:this.type,objectKey:E,value:I,styleSpec:ae,style:{glyphs:!0,sprite:!0}}))},u.prototype.is3D=function(){return!1},u.prototype.isTileClipped=function(){return!1},u.prototype.hasOffscreenPass=function(){return!1},u.prototype.resize=function(){},u.prototype.isStateDependent=function(){for(var p in this.paint._values){var x=this.paint.get(p);if(x instanceof ss&&Zo(x.property.specification)&&(x.value.kind==="source"||x.value.kind==="composite")&&x.value.isStateDependent)return!0}return!1},u}(be),oo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},An=function(a,u){this._structArray=a,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Kr=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function ki(a,u){u===void 0&&(u=1);var p=0,x=0;return{members:a.map(function(E){var I=oo[E.type].BYTES_PER_ELEMENT,D=p=Tu(p,Math.max(u,I)),k=E.components||1;return x=Math.max(x,I),p+=I*k,{name:E.name,type:E.type,components:k,offset:D}}),size:Tu(p,Math.max(x,u)),alignment:u}}function Tu(a,u){return Math.ceil(a/u)*u}Kr.serialize=function(a,u){return a._trim(),u&&(a.isTransferred=!0,u.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}},Kr.deserialize=function(a){var u=Object.create(this.prototype);return u.arrayBuffer=a.arrayBuffer,u.length=a.length,u.capacity=a.arrayBuffer.byteLength/u.bytesPerElement,u._refreshViews(),u},Kr.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Kr.prototype.clear=function(){this.length=0},Kr.prototype.resize=function(a){this.reserve(a),this.length=a},Kr.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 u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}},Kr.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var js=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x){var E=this.length;return this.resize(E+1),this.emplace(E,p,x)},u.prototype.emplace=function(p,x,E){var I=2*p;return this.int16[I+0]=x,this.int16[I+1]=E,p},u}(Kr);js.prototype.bytesPerElement=4,or("StructArrayLayout2i4",js);var Sf=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I){var D=this.length;return this.resize(D+1),this.emplace(D,p,x,E,I)},u.prototype.emplace=function(p,x,E,I,D){var k=4*p;return this.int16[k+0]=x,this.int16[k+1]=E,this.int16[k+2]=I,this.int16[k+3]=D,p},u}(Kr);Sf.prototype.bytesPerElement=8,or("StructArrayLayout4i8",Sf);var di=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I,D,k){var V=this.length;return this.resize(V+1),this.emplace(V,p,x,E,I,D,k)},u.prototype.emplace=function(p,x,E,I,D,k,V){var K=6*p;return this.int16[K+0]=x,this.int16[K+1]=E,this.int16[K+2]=I,this.int16[K+3]=D,this.int16[K+4]=k,this.int16[K+5]=V,p},u}(Kr);di.prototype.bytesPerElement=12,or("StructArrayLayout2i4i12",di);var os=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I,D,k){var V=this.length;return this.resize(V+1),this.emplace(V,p,x,E,I,D,k)},u.prototype.emplace=function(p,x,E,I,D,k,V){var K=4*p,Q=8*p;return this.int16[K+0]=x,this.int16[K+1]=E,this.uint8[Q+4]=I,this.uint8[Q+5]=D,this.uint8[Q+6]=k,this.uint8[Q+7]=V,p},u}(Kr);os.prototype.bytesPerElement=8,or("StructArrayLayout2i4ub8",os);var To=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x){var E=this.length;return this.resize(E+1),this.emplace(E,p,x)},u.prototype.emplace=function(p,x,E){var I=2*p;return this.float32[I+0]=x,this.float32[I+1]=E,p},u}(Kr);To.prototype.bytesPerElement=8,or("StructArrayLayout2f8",To);var Eo=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I,D,k,V,K,Q,ie){var fe=this.length;return this.resize(fe+1),this.emplace(fe,p,x,E,I,D,k,V,K,Q,ie)},u.prototype.emplace=function(p,x,E,I,D,k,V,K,Q,ie,fe){var ye=10*p;return this.uint16[ye+0]=x,this.uint16[ye+1]=E,this.uint16[ye+2]=I,this.uint16[ye+3]=D,this.uint16[ye+4]=k,this.uint16[ye+5]=V,this.uint16[ye+6]=K,this.uint16[ye+7]=Q,this.uint16[ye+8]=ie,this.uint16[ye+9]=fe,p},u}(Kr);Eo.prototype.bytesPerElement=20,or("StructArrayLayout10ui20",Eo);var Jt=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I,D,k,V,K,Q,ie,fe,ye){var ke=this.length;return this.resize(ke+1),this.emplace(ke,p,x,E,I,D,k,V,K,Q,ie,fe,ye)},u.prototype.emplace=function(p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke){var Ne=12*p;return this.int16[Ne+0]=x,this.int16[Ne+1]=E,this.int16[Ne+2]=I,this.int16[Ne+3]=D,this.uint16[Ne+4]=k,this.uint16[Ne+5]=V,this.uint16[Ne+6]=K,this.uint16[Ne+7]=Q,this.int16[Ne+8]=ie,this.int16[Ne+9]=fe,this.int16[Ne+10]=ye,this.int16[Ne+11]=ke,p},u}(Kr);Jt.prototype.bytesPerElement=24,or("StructArrayLayout4i4ui4i24",Jt);var tr=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E){var I=this.length;return this.resize(I+1),this.emplace(I,p,x,E)},u.prototype.emplace=function(p,x,E,I){var D=3*p;return this.float32[D+0]=x,this.float32[D+1]=E,this.float32[D+2]=I,p},u}(Kr);tr.prototype.bytesPerElement=12,or("StructArrayLayout3f12",tr);var Hc=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p){var x=this.length;return this.resize(x+1),this.emplace(x,p)},u.prototype.emplace=function(p,x){return this.uint32[1*p+0]=x,p},u}(Kr);Hc.prototype.bytesPerElement=4,or("StructArrayLayout1ul4",Hc);var Fl=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.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)},u.prototype.emplaceBack=function(p,x,E,I,D,k,V,K,Q){var ie=this.length;return this.resize(ie+1),this.emplace(ie,p,x,E,I,D,k,V,K,Q)},u.prototype.emplace=function(p,x,E,I,D,k,V,K,Q,ie){var fe=10*p,ye=5*p;return this.int16[fe+0]=x,this.int16[fe+1]=E,this.int16[fe+2]=I,this.int16[fe+3]=D,this.int16[fe+4]=k,this.int16[fe+5]=V,this.uint32[ye+3]=K,this.uint16[fe+8]=Q,this.uint16[fe+9]=ie,p},u}(Kr);Fl.prototype.bytesPerElement=20,or("StructArrayLayout6i1ul2ui20",Fl);var na=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I,D,k){var V=this.length;return this.resize(V+1),this.emplace(V,p,x,E,I,D,k)},u.prototype.emplace=function(p,x,E,I,D,k,V){var K=6*p;return this.int16[K+0]=x,this.int16[K+1]=E,this.int16[K+2]=I,this.int16[K+3]=D,this.int16[K+4]=k,this.int16[K+5]=V,p},u}(Kr);na.prototype.bytesPerElement=12,or("StructArrayLayout2i2i2i12",na);var Oo=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I,D){var k=this.length;return this.resize(k+1),this.emplace(k,p,x,E,I,D)},u.prototype.emplace=function(p,x,E,I,D,k){var V=4*p,K=8*p;return this.float32[V+0]=x,this.float32[V+1]=E,this.float32[V+2]=I,this.int16[K+6]=D,this.int16[K+7]=k,p},u}(Kr);Oo.prototype.bytesPerElement=16,or("StructArrayLayout2f1f2i16",Oo);var ia=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I){var D=this.length;return this.resize(D+1),this.emplace(D,p,x,E,I)},u.prototype.emplace=function(p,x,E,I,D){var k=12*p,V=3*p;return this.uint8[k+0]=x,this.uint8[k+1]=E,this.float32[V+1]=I,this.float32[V+2]=D,p},u}(Kr);ia.prototype.bytesPerElement=12,or("StructArrayLayout2ub2f12",ia);var sa=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E){var I=this.length;return this.resize(I+1),this.emplace(I,p,x,E)},u.prototype.emplace=function(p,x,E,I){var D=3*p;return this.uint16[D+0]=x,this.uint16[D+1]=E,this.uint16[D+2]=I,p},u}(Kr);sa.prototype.bytesPerElement=6,or("StructArrayLayout3ui6",sa);var ys=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.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)},u.prototype.emplaceBack=function(p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne,je,Ve,qe){var ct=this.length;return this.resize(ct+1),this.emplace(ct,p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne,je,Ve,qe)},u.prototype.emplace=function(p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne,je,Ve,qe,ct){var mt=24*p,yt=12*p,Ft=48*p;return this.int16[mt+0]=x,this.int16[mt+1]=E,this.uint16[mt+2]=I,this.uint16[mt+3]=D,this.uint32[yt+2]=k,this.uint32[yt+3]=V,this.uint32[yt+4]=K,this.uint16[mt+10]=Q,this.uint16[mt+11]=ie,this.uint16[mt+12]=fe,this.float32[yt+7]=ye,this.float32[yt+8]=ke,this.uint8[Ft+36]=Ne,this.uint8[Ft+37]=je,this.uint8[Ft+38]=Ve,this.uint32[yt+10]=qe,this.int16[mt+22]=ct,p},u}(Kr);ys.prototype.bytesPerElement=48,or("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ys);var y=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.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)},u.prototype.emplaceBack=function(p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne,je,Ve,qe,ct,mt,yt,Ft,jt,qt,br,nr,Br,ir,sn){var Lr=this.length;return this.resize(Lr+1),this.emplace(Lr,p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne,je,Ve,qe,ct,mt,yt,Ft,jt,qt,br,nr,Br,ir,sn)},u.prototype.emplace=function(p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne,je,Ve,qe,ct,mt,yt,Ft,jt,qt,br,nr,Br,ir,sn,Lr){var hr=34*p,hn=17*p;return this.int16[hr+0]=x,this.int16[hr+1]=E,this.int16[hr+2]=I,this.int16[hr+3]=D,this.int16[hr+4]=k,this.int16[hr+5]=V,this.int16[hr+6]=K,this.int16[hr+7]=Q,this.uint16[hr+8]=ie,this.uint16[hr+9]=fe,this.uint16[hr+10]=ye,this.uint16[hr+11]=ke,this.uint16[hr+12]=Ne,this.uint16[hr+13]=je,this.uint16[hr+14]=Ve,this.uint16[hr+15]=qe,this.uint16[hr+16]=ct,this.uint16[hr+1
vendor: 18,971 bytes, line 2102
21027]=mt,this.uint16[hr+18]=yt,this.uint16[hr+19]=Ft,this.uint16[hr+20]=jt,this.uint16[hr+21]=qt,this.uint16[hr+22]=br,this.uint32[hn+12]=nr,this.float32[hn+13]=Br,this.float32[hn+14]=ir,this.float32[hn+15]=sn,this.float32[hn+16]=Lr,p},u}(Kr);y.prototype.bytesPerElement=68,or("StructArrayLayout8i15ui1ul4f68",y);var _=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p){var x=this.length;return this.resize(x+1),this.emplace(x,p)},u.prototype.emplace=function(p,x){return this.float32[1*p+0]=x,p},u}(Kr);_.prototype.bytesPerElement=4,or("StructArrayLayout1f4",_);var b=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E){var I=this.length;return this.resize(I+1),this.emplace(I,p,x,E)},u.prototype.emplace=function(p,x,E,I){var D=3*p;return this.int16[D+0]=x,this.int16[D+1]=E,this.int16[D+2]=I,p},u}(Kr);b.prototype.bytesPerElement=6,or("StructArrayLayout3i6",b);var C=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E){var I=this.length;return this.resize(I+1),this.emplace(I,p,x,E)},u.prototype.emplace=function(p,x,E,I){var D=4*p;return this.uint32[2*p+0]=x,this.uint16[D+2]=E,this.uint16[D+3]=I,p},u}(Kr);C.prototype.bytesPerElement=8,or("StructArrayLayout1ul2ui8",C);var B=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x){var E=this.length;return this.resize(E+1),this.emplace(E,p,x)},u.prototype.emplace=function(p,x,E){var I=2*p;return this.uint16[I+0]=x,this.uint16[I+1]=E,p},u}(Kr);B.prototype.bytesPerElement=4,or("StructArrayLayout2ui4",B);var M=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p){var x=this.length;return this.resize(x+1),this.emplace(x,p)},u.prototype.emplace=function(p,x){return this.uint16[1*p+0]=x,p},u}(Kr);M.prototype.bytesPerElement=2,or("StructArrayLayout1ui2",M);var O=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,E,I){var D=this.length;return this.resize(D+1),this.emplace(D,p,x,E,I)},u.prototype.emplace=function(p,x,E,I,D){var k=4*p;return this.float32[k+0]=x,this.float32[k+1]=E,this.float32[k+2]=I,this.float32[k+3]=D,p},u}(Kr);O.prototype.bytesPerElement=16,or("StructArrayLayout4f16",O);var l=function(a){function u(){a.apply(this,arguments)}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var p={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 p.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},p.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},p.x1.get=function(){return this._structArray.int16[this._pos2+2]},p.y1.get=function(){return this._structArray.int16[this._pos2+3]},p.x2.get=function(){return this._structArray.int16[this._pos2+4]},p.y2.get=function(){return this._structArray.int16[this._pos2+5]},p.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},p.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},p.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},p.anchorPoint.get=function(){return new v(this.anchorPointX,this.anchorPointY)},Object.defineProperties(u.prototype,p),u}(An);l.prototype.size=20;var d=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.get=function(p){return new l(this,p)},u}(Fl);or("CollisionBoxArray",d);var h=function(a){function u(){a.apply(this,arguments)}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var p={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 p.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},p.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},p.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},p.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},p.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},p.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},p.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},p.segment.get=function(){return this._structArray.uint16[this._pos2+10]},p.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},p.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},p.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},p.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},p.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},p.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},p.placedOrientation.set=function(x){this._structArray.uint8[this._pos1+37]=x},p.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},p.hidden.set=function(x){this._structArray.uint8[this._pos1+38]=x},p.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},p.crossTileID.set=function(x){this._structArray.uint32[this._pos4+10]=x},p.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(u.prototype,p),u}(An);h.prototype.size=48;var m=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.get=function(p){return new h(this,p)},u}(ys);or("PlacedSymbolArray",m);var T=function(a){function u(){a.apply(this,arguments)}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var p={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 p.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},p.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},p.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},p.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},p.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},p.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},p.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},p.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},p.key.get=function(){return this._structArray.uint16[this._pos2+8]},p.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},p.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},p.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},p.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},p.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},p.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},p.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},p.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},p.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},p.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},p.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},p.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},p.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},p.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},p.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},p.crossTileID.set=function(x){this._structArray.uint32[this._pos4+12]=x},p.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},p.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},p.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},p.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(u.prototype,p),u}(An);T.prototype.size=68;var P=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.get=function(p){return new T(this,p)},u}(y);or("SymbolInstanceArray",P);var R=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getoffsetX=function(p){return this.float32[1*p+0]},u}(_);or("GlyphOffsetArray",R);var L=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getx=function(p){return this.int16[3*p+0]},u.prototype.gety=function(p){return this.int16[3*p+1]},u.prototype.gettileUnitDistanceFromAnchor=function(p){return this.int16[3*p+2]},u}(b);or("SymbolLineVertexArray",L);var z=function(a){function u(){a.apply(this,arguments)}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var p={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return p.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},p.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},p.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(u.prototype,p),u}(An);z.prototype.size=8;var X=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.get=function(p){return new z(this,p)},u}(C);or("FeatureIndexArray",X);var ee=ki([{name:"a_pos",components:2,type:"Int16"}],4).members,Z=function(a){a===void 0&&(a=[]),this.segments=a};function te(a,u){return 256*(a=$(Math.floor(a),0,255))+$(Math.floor(u),0,255)}Z.prototype.prepareSegment=function(a,u,p,x){var E=this.segments[this.segments.length-1];return a>Z.MAX_VERTEX_ARRAY_LENGTH&&re("Max vertices per segment is "+Z.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+a),(!E||E.vertexLength+a>Z.MAX_VERTEX_ARRAY_LENGTH||E.sortKey!==x)&&(E={vertexOffset:u.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},x!==void 0&&(E.sortKey=x),this.segments.push(E)),E},Z.prototype.get=function(){return this.segments},Z.prototype.destroy=function(){for(var a=0,u=this.segments;a<u.length;a+=1){var p=u[a];for(var x in p.vaos)p.vaos[x].destroy()}},Z.simpleSegment=function(a,u,p,x){return new Z([{vertexOffset:a,primitiveOffset:u,vertexLength:p,primitiveLength:x,vaos:{},sortKey:0}])},Z.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,or("SegmentVector",Z);var oe=ki([{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"}]),we=c(function(a){a.exports=function(u,p){var x,E,I,D,k,V,K,Q;for(E=u.length-(x=3&u.length),I=p,k=3432918353,V=461845907,Q=0;Q<E;)K=255&u.charCodeAt(Q)|(255&u.charCodeAt(++Q))<<8|(255&u.charCodeAt(++Q))<<16|(255&u.charCodeAt(++Q))<<24,++Q,I=27492+(65535&(D=5*(65535&(I=(I^=K=(65535&(K=(K=(65535&K)*k+(((K>>>16)*k&65535)<<16)&4294967295)<<15|K>>>17))*V+(((K>>>16)*V&65535)<<16)&4294967295)<<13|I>>>19))+((5*(I>>>16)&65535)<<16)&4294967295))+((58964+(D>>>16)&65535)<<16);switch(K=0,x){case 3:K^=(255&u.charCodeAt(Q+2))<<16;case 2:K^=(255&u.charCodeAt(Q+1))<<8;case 1:I^=K=(65535&(K=(K=(65535&(K^=255&u.charCodeAt(Q)))*k+(((K>>>16)*k&65535)<<16)&4294967295)<<15|K>>>17))*V+(((K>>>16)*V&65535)<<16)&4294967295}return I^=u.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}}),Fe=c(function(a){a.exports=function(u,p){for(var x,E=u.length,I=p^E,D=0;E>=4;)x=1540483477*(65535&(x=255&u.charCodeAt(D)|(255&u.charCodeAt(++D))<<8|(255&u.charCodeAt(++D))<<16|(255&u.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)),E-=4,++D;switch(E){case 3:I^=(255&u.charCodeAt(D+2))<<16;case 2:I^=(255&u.charCodeAt(D+1))<<8;case 1:I=1540483477*(65535&(I^=255&u.charCodeAt(D)))+((1540483477*(I>>>16)&65535)<<16)}return I=1540483477*(65535&(I^=I>>>13))+((1540483477*(I>>>16)&65535)<<16),(I^=I>>>15)>>>0}}),ge=we,Re=Fe;ge.murmur3=we,ge.murmur2=Re;var He=function(){this.ids=[],this.positions=[],this.indexed=!1};He.prototype.add=function(a,u,p,x){this.ids.push(nt(a)),this.positions.push(u,p,x)},He.prototype.getPositions=function(a){for(var u=nt(a),p=0,x=this.ids.length-1;p<x;){var E=p+x>>1;this.ids[E]>=u?x=E:p=E+1}for(var I=[];this.ids[p]===u;)I.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return I},He.serialize=function(a,u){var p=new Float64Array(a.ids),x=new Uint32Array(a.positions);return function E(I,D,k,V){for(;k<V;){for(var K=I[k+V>>1],Q=k-1,ie=V+1;;){do Q++;while(I[Q]<K);do ie--;while(I[ie]>K);if(Q>=ie)break;Xe(I,Q,ie),Xe(D,3*Q,3*ie),Xe(D,3*Q+1,3*ie+1),Xe(D,3*Q+2,3*ie+2)}ie-k<V-ie?(E(I,D,k,ie),k=ie+1):(E(I,D,ie+1,V),V=ie)}}(p,x,0,p.length-1),u&&u.push(p.buffer,x.buffer),{ids:p,positions:x}},He.deserialize=function(a){var u=new He;return u.ids=a.ids,u.positions=a.positions,u.indexed=!0,u};var We=Math.pow(2,53)-1;function nt(a){var u=+a;return!isNaN(u)&&u<=We?u:ge(String(a))}function Xe(a,u,p){var x=a[u];a[u]=a[p],a[p]=x}or("FeaturePositionMap",He);var Qe=function(a,u){this.gl=a.gl,this.location=u},pt=function(a){function u(p,x){a.call(this,p,x),this.current=0}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(p){this.current!==p&&(this.current=p,this.gl.uniform1i(this.location,p))},u}(Qe),Dt=function(a){function u(p,x){a.call(this,p,x),this.current=0}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(p){this.current!==p&&(this.current=p,this.gl.uniform1f(this.location,p))},u}(Qe),Ct=function(a){function u(p,x){a.call(this,p,x),this.current=[0,0]}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(p){p[0]===this.current[0]&&p[1]===this.current[1]||(this.current=p,this.gl.uniform2f(this.location,p[0],p[1]))},u}(Qe),zt=function(a){function u(p,x){a.call(this,p,x),this.current=[0,0,0]}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(p){p[0]===this.current[0]&&p[1]===this.current[1]&&p[2]===this.current[2]||(this.current=p,this.gl.uniform3f(this.location,p[0],p[1],p[2]))},u}(Qe),sr=function(a){function u(p,x){a.call(this,p,x),this.current=[0,0,0,0]}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(p){p[0]===this.current[0]&&p[1]===this.current[1]&&p[2]===this.current[2]&&p[3]===this.current[3]||(this.current=p,this.gl.uniform4f(this.location,p[0],p[1],p[2],p[3]))},u}(Qe),Er=function(a){function u(p,x){a.call(this,p,x),this.current=tn.transparent}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(p){p.r===this.current.r&&p.g===this.current.g&&p.b===this.current.b&&p.a===this.current.a||(this.current=p,this.gl.uniform4f(this.location,p.r,p.g,p.b,p.a))},u}(Qe),Mr=new Float32Array(16),xn=function(a){function u(p,x){a.call(this,p,x),this.current=Mr}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(p){if(p[12]!==this.current[12]||p[0]!==this.current[0])return this.current=p,void this.gl.uniformMatrix4fv(this.location,!1,p);for(var x=1;x<16;x++)if(p[x]!==this.current[x]){this.current=p,this.gl.uniformMatrix4fv(this.location,!1,p);break}},u}(Qe);
2102function ar(a){return[te(255*a.r,255*a.g),te(255*a.b,255*a.a)]}var $r=function(a,u,p){this.value=a,this.uniformNames=u.map(function(x){return"u_"+x}),this.type=p};$r.prototype.setUniform=function(a,u,p){a.set(p.constantOr(this.value))},$r.prototype.getBinding=function(a,u,p){return this.type==="color"?new Er(a,u):new Dt(a,u)};var rn=function(a,u){this.uniformNames=u.map(function(p){return"u_"+p}),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};rn.prototype.setConstantPatternPositions=function(a,u){this.pixelRatioFrom=u.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=u.tlbr,this.patternTo=a.tlbr},rn.prototype.setUniform=function(a,u,p,x){var E=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;E&&a.set(E)},rn.prototype.getBinding=function(a,u,p){return p.substr(0,9)==="u_pattern"?new sr(a,u):new Dt(a,u)};var jr=function(a,u,p,x){this.expression=a,this.type=p,this.maxValue=0,this.paintVertexAttributes=u.map(function(E){return{name:"a_"+E,type:"Float32",components:p==="color"?2:1,offset:0}}),this.paintVertexArray=new x};jr.prototype.populatePaintArray=function(a,u,p,x,E){var I=this.paintVertexArray.length,D=this.expression.evaluate(new Hr(0),u,{},x,[],E);this.paintVertexArray.resize(a),this._setPaintValue(I,a,D)},jr.prototype.updatePaintArray=function(a,u,p,x){var E=this.expression.evaluate({zoom:0},p,x);this._setPaintValue(a,u,E)},jr.prototype._setPaintValue=function(a,u,p){if(this.type==="color")for(var x=ar(p),E=a;E<u;E++)this.paintVertexArray.emplace(E,x[0],x[1]);else{for(var I=a;I<u;I++)this.paintVertexArray.emplace(I,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}},jr.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))},jr.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var Gr=function(a,u,p,x,E,I){this.expression=a,this.uniformNames=u.map(function(D){return"u_"+D+"_t"}),this.type=p,this.useIntegerZoom=x,this.zoom=E,this.maxValue=0,this.paintVertexAttributes=u.map(function(D){return{name:"a_"+D,type:"Float32",components:p==="color"?4:2,offset:0}}),this.paintVertexArray=new I};Gr.prototype.populatePaintArray=function(a,u,p,x,E){var I=this.expression.evaluate(new Hr(this.zoom),u,{},x,[],E),D=this.expression.evaluate(new Hr(this.zoom+1),u,{},x,[],E),k=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(k,a,I,D)},Gr.prototype.updatePaintArray=function(a,u,p,x){var E=this.expression.evaluate({zoom:this.zoom},p,x),I=this.expression.evaluate({zoom:this.zoom+1},p,x);this._setPaintValue(a,u,E,I)},Gr.prototype._setPaintValue=function(a,u,p,x){if(this.type==="color")for(var E=ar(p),I=ar(x),D=a;D<u;D++)this.paintVertexArray.emplace(D,E[0],E[1],I[0],I[1]);else{for(var k=a;k<u;k++)this.paintVertexArray.emplace(k,p,x);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(x))}},Gr.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))},Gr.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},Gr.prototype.setUniform=function(a,u){var p=this.useIntegerZoom?Math.floor(u.zoom):u.zoom,x=$(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);a.set(x)},Gr.prototype.getBinding=function(a,u,p){return new Dt(a,u)};var Zr=function(a,u,p,x,E,I){this.expression=a,this.type=u,this.useIntegerZoom=p,this.zoom=x,this.layerId=I,this.zoomInPaintVertexArray=new E,this.zoomOutPaintVertexArray=new E};Zr.prototype.populatePaintArray=function(a,u,p){var x=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(a),this.zoomOutPaintVertexArray.resize(a),this._setPaintValues(x,a,u.patterns&&u.patterns[this.layerId],p)},Zr.prototype.updatePaintArray=function(a,u,p,x,E){this._setPaintValues(a,u,p.patterns&&p.patterns[this.layerId],E)},Zr.prototype._setPaintValues=function(a,u,p,x){if(x&&p){var E=x[p.min],I=x[p.mid],D=x[p.max];if(E&&I&&D)for(var k=a;k<u;k++)this.zoomInPaintVertexArray.emplace(k,I.tl[0],I.tl[1],I.br[0],I.br[1],E.tl[0],E.tl[1],E.br[0],E.br[1],I.pixelRatio,E.pixelRatio),this.zoomOutPaintVertexArray.emplace(k,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)}},Zr.prototype.upload=function(a){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=a.createVertexBuffer(this.zoomInPaintVertexArray,oe.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=a.createVertexBuffer(this.zoomOutPaintVertexArray,oe.members,this.expression.isStateDependent))},Zr.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var kr=function(a,u,p){this.binders={},this._buffers=[];var x=[];for(var E in a.paint._values)if(p(E)){var I=a.paint.get(E);if(I instanceof ss&&Zo(I.property.specification)){var D=qi(E,a.type),k=I.value,V=I.property.specification.type,K=I.property.useIntegerZoom,Q=I.property.specification["property-type"],ie=Q==="cross-faded"||Q==="cross-faded-data-driven";if(k.kind==="constant")this.binders[E]=ie?new rn(k.value,D):new $r(k.value,D,V),x.push("/u_"+E);else if(k.kind==="source"||ie){var fe=Ei(E,V,"source");this.binders[E]=ie?new Zr(k,V,K,u,fe,a.id):new jr(k,D,V,fe),x.push("/a_"+E)}else{var ye=Ei(E,V,"composite");this.binders[E]=new Gr(k,D,V,K,u,ye),x.push("/z_"+E)}}}this.cacheKey=x.sort().join("")};kr.prototype.getMaxValue=function(a){var u=this.binders[a];return u instanceof jr||u instanceof Gr?u.maxValue:0},kr.prototype.populatePaintArrays=function(a,u,p,x,E){for(var I in this.binders){var D=this.binders[I];(D instanceof jr||D instanceof Gr||D instanceof Zr)&&D.populatePaintArray(a,u,p,x,E)}},kr.prototype.setConstantPatternPositions=function(a,u){for(var p in this.binders){var x=this.binders[p];x instanceof rn&&x.setConstantPatternPositions(a,u)}},kr.prototype.updatePaintArrays=function(a,u,p,x,E){var I=!1;for(var D in a)for(var k=0,V=u.getPositions(D);k<V.length;k+=1){var K=V[k],Q=p.feature(K.index);for(var ie in this.binders){var fe=this.binders[ie];if((fe instanceof jr||fe instanceof Gr||fe instanceof Zr)&&fe.expression.isStateDependent===!0){var ye=x.paint.get(ie);fe.expression=ye.value,fe.updatePaintArray(K.start,K.end,Q,a[D],E),I=!0}
vendor: 7,212 bytes, line 2102
2102}}return I},kr.prototype.defines=function(){var a=[];for(var u in this.binders){var p=this.binders[u];(p instanceof $r||p instanceof rn)&&a.push.apply(a,p.uniformNames.map(function(x){return"#define HAS_UNIFORM_"+x}))}return a},kr.prototype.getBinderAttributes=function(){var a=[];for(var u in this.binders){var p=this.binders[u];if(p instanceof jr||p instanceof Gr)for(var x=0;x<p.paintVertexAttributes.length;x++)a.push(p.paintVertexAttributes[x].name);else if(p instanceof Zr)for(var E=0;E<oe.members.length;E++)a.push(oe.members[E].name)}return a},kr.prototype.getBinderUniforms=function(){var a=[];for(var u in this.binders){var p=this.binders[u];if(p instanceof $r||p instanceof rn||p instanceof Gr)for(var x=0,E=p.uniformNames;x<E.length;x+=1)a.push(E[x])}return a},kr.prototype.getPaintVertexBuffers=function(){return this._buffers},kr.prototype.getUniforms=function(a,u){var p=[];for(var x in this.binders){var E=this.binders[x];if(E instanceof $r||E instanceof rn||E instanceof Gr)for(var I=0,D=E.uniformNames;I<D.length;I+=1){var k=D[I];if(u[k]){var V=E.getBinding(a,u[k],k);p.push({name:k,property:x,binding:V})}}}return p},kr.prototype.setUniforms=function(a,u,p,x){for(var E=0,I=u;E<I.length;E+=1){var D=I[E],k=D.name,V=D.property;this.binders[V].setUniform(D.binding,x,p.get(V),k)}},kr.prototype.updatePaintBuffers=function(a){for(var u in this._buffers=[],this.binders){var p=this.binders[u];if(a&&p instanceof Zr){var x=a.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;x&&this._buffers.push(x)}else(p instanceof jr||p instanceof Gr)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}},kr.prototype.upload=function(a){for(var u in this.binders){var p=this.binders[u];(p instanceof jr||p instanceof Gr||p instanceof Zr)&&p.upload(a)}this.updatePaintBuffers()},kr.prototype.destroy=function(){for(var a in this.binders){var u=this.binders[a];(u instanceof jr||u instanceof Gr||u instanceof Zr)&&u.destroy()}};var Or=function(a,u,p){p===void 0&&(p=function(){return!0}),this.programConfigurations={};for(var x=0,E=a;x<E.length;x+=1){var I=E[x];this.programConfigurations[I.id]=new kr(I,u,p)}this.needsUpload=!1,this._featureMap=new He,this._bufferOffset=0};function qi(a,u){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(u+"-","").replace(/-/g,"_")]}function Ei(a,u,p){var x={color:{source:To,composite:O},number:{source:_,composite:To}},E=function(I){return{"line-pattern":{source:Eo,composite:Eo},"fill-pattern":{source:Eo,composite:Eo},"fill-extrusion-pattern":{source:Eo,composite:Eo}}[I]}(a);return E&&E[p]||x[u][p]}Or.prototype.populatePaintArrays=function(a,u,p,x,E,I){for(var D in this.programConfigurations)this.programConfigurations[D].populatePaintArrays(a,u,x,E,I);u.id!==void 0&&this._featureMap.add(u.id,p,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0},Or.prototype.updatePaintArrays=function(a,u,p,x){for(var E=0,I=p;E<I.length;E+=1){var D=I[E];this.needsUpload=this.programConfigurations[D.id].updatePaintArrays(a,this._featureMap,u,D,x)||this.needsUpload}},Or.prototype.get=function(a){return this.programConfigurations[a]},Or.prototype.upload=function(a){if(this.needsUpload){for(var u in this.programConfigurations)this.programConfigurations[u].upload(a);this.needsUpload=!1}},Or.prototype.destroy=function(){for(var a in this.programConfigurations)this.programConfigurations[a].destroy()},or("ConstantBinder",$r),or("CrossFadedConstantBinder",rn),or("SourceExpressionBinder",jr),or("CrossFadedCompositeBinder",Zr),or("CompositeExpressionBinder",Gr),or("ProgramConfiguration",kr,{omit:["_buffers"]}),or("ProgramConfigurationSet",Or);var vs=Math.pow(2,14)-1,as=-vs-1;function bi(a){for(var u=8192/a.extent,p=a.loadGeometry(),x=0;x<p.length;x++)for(var E=p[x],I=0;I<E.length;I++){var D=E[I],k=Math.round(D.x*u),V=Math.round(D.y*u);D.x=$(k,as,vs),D.y=$(V,as,vs),(k<D.x||k>D.x+1||V<D.y||V>D.y+1)&&re("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return p}function Mi(a,u){return{type:a.type,id:a.id,properties:a.properties,geometry:u?bi(a):[]}}function ao(a,u,p,x,E){a.emplaceBack(2*u+(x+1)/2,2*p+(E+1)/2)}var Ps=function(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(u){return u.id}),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new js,this.indexArray=new sa,this.segments=new Z,this.programConfigurations=new Or(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(function(u){return u.isStateDependent()}).map(function(u){return u.id})};function jc(a,u){for(var p=0;p<a.length;p++)if(Ma(u,a[p]))return!0;for(var x=0;x<u.length;x++)if(Ma(a,u[x]))return!0;return!!If(a,u)}function $s(a,u,p){return!!Ma(a,u)||!!$c(u,a,p)}function oa(a,u){if(a.length===1)return Mf(u,a[0]);for(var p=0;p<u.length;p++)for(var x=u[p],E=0;E<x.length;E++)if(Ma(a,x[E]))return!0;for(var I=0;I<a.length;I++)if(Mf(u,a[I]))return!0;for(var D=0;D<u.length;D++)if(If(a,u[D]))return!0;return!1}function Lo(a,u,p){if(a.length>1){if(If(a,u))return!0;for(var x=0;x<u.length;x++)if($c(u[x],a,p))return!0}for(var E=0;E<a.length;E++)if($c(a[E],u,p))return!0;return!1}function If(a,u){if(a.length===0||u.length===0)return!1;for(var p=0;p<a.length-1;p++)for(var x=a[p],E=a[p+1],I=0;I<u.length-1;I++)if(Eu(x,E,u[I],u[I+1]))return!0;return!1}function Eu(a,u,p,x){return Ee(a,p,x)!==Ee(u,p,x)&&Ee(a,u,p)!==Ee(a,u,x)}function $c(a,u,p){var x=p*p;if(u.length===1)return a.distSqr(u[0])<x;for(var E=1;E<u.length;E++)if(Bu(a,u[E-1],u[E])<x)return!0;return!1}function Bu(a,u,p){var x=u.distSqr(p);if(x===0)return a.distSqr(u);var E=((a.x-u.x)*(p.x-u.x)+(a.y-u.y)*(p.y-u.y))/x;return a.distSqr(E<0?u:E>1?p:p.sub(u)._mult(E)._add(u))}function Mf(a,u){for(var p,x,E,I=!1,D=0;D<a.length;D++)for(var k=0,V=(p=a[D]).length-1;k<p.length;V=k++)(x=p[k]).y>u.y!=(E=p[V]).y>u.y&&u.x<(E.x-x.x)*(u.y-x.y)/(E.y-x.y)+x.x&&(I=!I);return I}function Ma(a,u){for(var p=!1,x=0,E=a.length-1;x<a.length;E=x++){var I=a[x],D=a[E];I.y>u.y!=D.y>u.y&&u.x<(D.x-I.x)*(u.y-I.y)/(D.y-I.y)+I.x&&(p=!p)}return p}function Pf(a,u,p){var x=p[0],E=p[2];if(a.x<x.x&&u.x<x.x||a.x>E.x&&u.x>E.x||a.y<x.y&&u.y<x.y||a.y>E.y&&u.y>E.y)return!1;var I=Ee(a,u,p[0]);return I!==Ee(a,u,p[1])||I!==Ee(a,u,p[2])||I!==Ee(a,u,p[3])}function Pa(a,u,p){var x=u.paint.get(a).value;return x.kind==="constant"?x.value:p.programConfigurations.get(u.id).getMaxValue(a)}function Yi(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function sc(a,u,p,x,E){if(!u[0]&&!u[1])return a;var I=v.convert(u)._mult(E);p==="viewport"&&I._rotate(-x);for(var D=[],k=0;k<a.length;k++)D.push(a[k].sub(I));return D}Ps.prototype.populate=function(a,u,p){var x=this.layers[0],E=[],I=null;
2102x.type==="circle"&&(I=x.layout.get("circle-sort-key"));for(var D=0,k=a;D<k.length;D+=1){var V=k[D],K=V.feature,Q=V.id,ie=V.index,fe=V.sourceLayerIndex,ye=this.layers[0]._featureFilter.needGeometry,ke=Mi(K,ye);if(this.layers[0]._featureFilter.filter(new Hr(this.zoom),ke,p)){var Ne=I?I.evaluate(ke,{},p):void 0,je={id:Q,properties:K.properties,type:K.type,sourceLayerIndex:fe,index:ie,geometry:ye?ke.geometry:bi(K),patterns:{},sortKey:Ne};E.push(je)}}I&&E.sort(function(qt,br){return qt.sortKey-br.sortKey});for(var Ve=0,qe=E;Ve<qe.length;Ve+=1){var ct=qe[Ve],mt=ct.geometry,yt=ct.index,Ft=ct.sourceLayerIndex,jt=a[yt].feature;this.addFeature(ct,mt,yt,p),u.featureIndex.insert(jt,mt,yt,Ft,this.index)}},Ps.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},Ps.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},Ps.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ps.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},Ps.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ps.prototype.addFeature=function(a,u,p,x){for(var E=0,I=u;E<I.length;E+=1)for(var D=0,k=I[E];D<k.length;D+=1){var V=k[D],K=V.x,Q=V.y;if(!(K<0||K>=8192||Q<0||Q>=8192)){var ie=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),fe=ie.vertexLength;ao(this.layoutVertexArray,K,Q,-1,-1),ao(this.layoutVertexArray,K,Q,1,-1),ao(this.layoutVertexArray,K,Q,1,1),ao(this.layoutVertexArray,K,Q,-1,1),this.indexArray.emplaceBack(fe,fe+1,fe+2),this.indexArray.emplaceBack(fe,fe+3,fe+2),ie.vertexLength+=4,ie.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,p,{},x)},or("CircleBucket",Ps,{omit:["layers"]});var Wc=new Jn({"circle-sort-key":new ur(ae.layout_circle["circle-sort-key"])}),Dl={paint:new Jn({"circle-radius":new ur(ae.paint_circle["circle-radius"]),"circle-color":new ur(ae.paint_circle["circle-color"]),"circle-blur":new ur(ae.paint_circle["circle-blur"]),"circle-opacity":new ur(ae.paint_circle["circle-opacity"]),"circle-translate":new wr(ae.paint_circle["circle-translate"]),"circle-translate-anchor":new wr(ae.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new wr(ae.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new wr(ae.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ur(ae.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ur(ae.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ur(ae.paint_circle["circle-stroke-opacity"])}),layout:Wc},En=typeof Float32Array<"u"?Float32Array:Array;function Bo(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 Ws(a,u,p){var x=u[0],E=u[1],I=u[2],D=u[3],k=u[4],V=u[5],K=u[6],Q=u[7],ie=u[8],fe=u[9],ye=u[10],ke=u[11],Ne=u[12],je=u[13],Ve=u[14],qe=u[15],ct=p[0],mt=p[1],yt=p[2],Ft=p[3];return a[0]=ct*x+mt*k+yt*ie+Ft*Ne,a[1]=ct*E+mt*V+yt*fe+Ft*je,a[2]=ct*I+mt*K+yt*ye+Ft*Ve,a[3]=ct*D+mt*Q+yt*ke+Ft*qe,a[4]=(ct=p[4])*x+(mt=p[5])*k+(yt=p[6])*ie+(Ft=p[7])*Ne,a[5]=ct*E+mt*V+yt*fe+Ft*je,a[6]=ct*I+mt*K+yt*ye+Ft*Ve,a[7]=ct*D+mt*Q+yt*ke+Ft*qe,a[8]=(ct=p[8])*x+(mt=p[9])*k+(yt=p[10])*ie+(Ft=p[11])*Ne,a[9]=ct*E+mt*V+yt*fe+Ft*je,a[10]=ct*I+mt*K+yt*ye+Ft*Ve,a[11]=ct*D+mt*Q+yt*ke+Ft*qe,a[12]=(ct=p[12])*x+(mt=p[13])*k+(yt=p[14])*ie+(Ft=p[15])*Ne,a[13]=ct*E+mt*V+yt*fe+Ft*je,a[14]=ct*I+mt*K+yt*ye+Ft*Ve,a[15]=ct*D+mt*Q+yt*ke+Ft*qe,a}Math.hypot||(Math.hypot=function(){for(var a=arguments,u=0,p=arguments.length;p--;)u+=a[p]*a[p];return Math.sqrt(u)});var Ol,ov=Ws;function Hh(a,u,p){var x=u[0],E=u[1],I=u[2],D=u[3];return a[0]=p[0]*x+p[4]*E+p[8]*I+p[12]*D,a[1]=p[1]*x+p[5]*E+p[9]*I+p[13]*D,a[2]=p[2]*x+p[6]*E+p[10]*I+p[14]*D,a[3]=p[3]*x+p[7]*E+p[11]*I+p[15]*D,a}Ol=new En(3),En!=Float32Array&&(Ol[0]=0,Ol[1]=0,Ol[2]=0),function(){var a=new En(4);En!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0)}();var av=(function(){var a=new En(2);En!=Float32Array&&(a[0]=0,a[1]=0)}(),function(a){function u(p){a.call(this,p,Dl)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.createBucket=function(p){return new Ps(p)},u.prototype.queryRadius=function(p){var x=p;return Pa("circle-radius",this,x)+Pa("circle-stroke-width",this,x)+Yi(this.paint.get("circle-translate"))},u.prototype.queryIntersectsFeature=function(p,x,E,I,D,k,V,K){for(var Q=sc(p,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),k.angle,V),ie=this.paint.get("circle-radius").evaluate(x,E)+this.paint.get("circle-stroke-width").evaluate(x,E),fe=this.paint.get("circle-pitch-alignment")==="map",ye=fe?Q:function(jt,qt){return jt.map(function(br){return Rf(br,qt)})}(Q,K),ke=fe?ie*V:ie,Ne=0,je=I;Ne<je.length;Ne+=1)for(var Ve=0,qe=je[Ne];Ve<qe.length;Ve+=1){var ct=qe[Ve],mt=fe?ct:Rf(ct,K),yt=ke,Ft=Hh([],[ct.x,ct.y,0,1],K);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?yt*=Ft[3]/k.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(yt*=k.cameraToCenterDistance/Ft[3]),$s(ye,mt,yt))return!0}return!1},u}(zr));function Rf(a,u){var p=Hh([],[a.x,a.y,0,1],u);return new v(p[0]/p[3],p[1]/p[3])}var rm=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u}(Ps);
vendor: 10,306 bytes, line 2102
2102function Su(a,u,p,x){var E=u.width,I=u.height;if(x){if(x instanceof Uint8ClampedArray)x=new Uint8Array(x.buffer);else if(x.length!==E*I*p)throw new RangeError("mismatched image size")}else x=new Uint8Array(E*I*p);return a.width=E,a.height=I,a.data=x,a}function jh(a,u,p){var x=u.width,E=u.height;if(x!==a.width||E!==a.height){var I=Su({},{width:x,height:E},p);cv(a,I,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,x),height:Math.min(a.height,E)},p),a.width=x,a.height=E,a.data=I.data}}function cv(a,u,p,x,E,I){if(E.width===0||E.height===0)return u;if(E.width>a.width||E.height>a.height||p.x>a.width-E.width||p.y>a.height-E.height)throw new RangeError("out of range source coordinates for image copy");if(E.width>u.width||E.height>u.height||x.x>u.width-E.width||x.y>u.height-E.height)throw new RangeError("out of range destination coordinates for image copy");for(var D=a.data,k=u.data,V=0;V<E.height;V++)for(var K=((p.y+V)*a.width+p.x)*I,Q=((x.y+V)*u.width+x.x)*I,ie=0;ie<E.width*I;ie++)k[Q+ie]=D[K+ie];return u}or("HeatmapBucket",rm,{omit:["layers"]});var Ff=function(a,u){Su(this,a,1,u)};Ff.prototype.resize=function(a){jh(this,a,1)},Ff.prototype.clone=function(){return new Ff({width:this.width,height:this.height},new Uint8Array(this.data))},Ff.copy=function(a,u,p,x,E){cv(a,u,p,x,E,1)};var co=function(a,u){Su(this,a,4,u)};co.prototype.resize=function(a){jh(this,a,4)},co.prototype.replace=function(a,u){u?this.data.set(a):this.data=a instanceof Uint8ClampedArray?new Uint8Array(a.buffer):a},co.prototype.clone=function(){return new co({width:this.width,height:this.height},new Uint8Array(this.data))},co.copy=function(a,u,p,x,E){cv(a,u,p,x,E,4)},or("AlphaImage",Ff),or("RGBAImage",co);var MU={paint:new Jn({"heatmap-radius":new ur(ae.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ur(ae.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new wr(ae.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ki(ae.paint_heatmap["heatmap-color"]),"heatmap-opacity":new wr(ae.paint_heatmap["heatmap-opacity"])})};function KT(a){var u={},p=a.resolution||256,x=a.clips?a.clips.length:1,E=a.image||new co({width:p,height:x}),I=function(ke,Ne,je){u[a.evaluationKey]=je;var Ve=a.expression.evaluate(u);E.data[ke+Ne+0]=Math.floor(255*Ve.r/Ve.a),E.data[ke+Ne+1]=Math.floor(255*Ve.g/Ve.a),E.data[ke+Ne+2]=Math.floor(255*Ve.b/Ve.a),E.data[ke+Ne+3]=Math.floor(255*Ve.a)};if(a.clips)for(var D=0,k=0;D<x;++D,k+=4*p)for(var V=0,K=0;V<p;V++,K+=4){var Q=V/(p-1),ie=a.clips[D];I(k,K,ie.start*(1-Q)+ie.end*Q)}else for(var fe=0,ye=0;fe<p;fe++,ye+=4)I(0,ye,fe/(p-1));return E}var PU=function(a){function u(p){a.call(this,p,MU),this._updateColorRamp()}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.createBucket=function(p){return new rm(p)},u.prototype._handleSpecialPaintPropertyUpdate=function(p){p==="heatmap-color"&&this._updateColorRamp()},u.prototype._updateColorRamp=function(){this.colorRamp=KT({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null},u.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},u.prototype.queryRadius=function(){return 0},u.prototype.queryIntersectsFeature=function(){return!1},u.prototype.hasOffscreenPass=function(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"},u}(zr),RU={paint:new Jn({"hillshade-illumination-direction":new wr(ae.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new wr(ae.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new wr(ae.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new wr(ae.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new wr(ae.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new wr(ae.paint_hillshade["hillshade-accent-color"])})},FU=function(a){function u(p){a.call(this,p,RU)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.hasOffscreenPass=function(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"},u}(zr),DU=ki([{name:"a_pos",components:2,type:"Int16"}],4).members,lv=nm,OU=nm;function nm(a,u,p){p=p||2;var x,E,I,D,k,V,K,Q=u&&u.length,ie=Q?u[0]*p:a.length,fe=qT(a,0,ie,p,!0),ye=[];if(!fe||fe.next===fe.prev)return ye;if(Q&&(fe=function(Ne,je,Ve,qe){var ct,mt,yt,Ft=[];for(ct=0,mt=je.length;ct<mt;ct++)(yt=qT(Ne,je[ct]*qe,ct<mt-1?je[ct+1]*qe:Ne.length,qe,!1))===yt.next&&(yt.steiner=!0),Ft.push(HU(yt));for(Ft.sort(zU),ct=0;ct<Ft.length;ct++)GU(Ft[ct],Ve),Ve=Iu(Ve,Ve.next);return Ve}(a,u,fe,p)),a.length>80*p){x=I=a[0],E=D=a[1];for(var ke=p;ke<ie;ke+=p)(k=a[ke])<x&&(x=k),(V=a[ke+1])<E&&(E=V),k>I&&(I=k),V>D&&(D=V);K=(K=Math.max(I-x,D-E))!==0?1/K:0}return oA(fe,ye,p,x,E,K),ye}function qT(a,u,p,x,E){var I,D;if(E===hv(a,u,p,x)>0)for(I=u;I<p;I+=x)D=QT(I,a[I],a[I+1],D);else for(I=p-x;I>=u;I-=x)D=QT(I,a[I],a[I+1],D);return D&&im(D,D.next)&&(cA(D),D=D.next),D}function Iu(a,u){if(!a)return a;u||(u=a);var p,x=a;do if(p=!1,x.steiner||!im(x,x.next)&&Gi(x.prev,x,x.next)!==0)x=x.next;else{if(cA(x),(x=u=x.prev)===x.next)break;p=!0}while(p||x!==u);return u}function oA(a,u,p,x,E,I,D){if(a){!D&&I&&function(Q,ie,fe,ye){var ke=Q;do ke.z===null&&(ke.z=uv(ke.x,ke.y,ie,fe,ye)),ke.prevZ=ke.prev,ke.nextZ=ke.next,ke=ke.next;while(ke!==Q);ke.prevZ.nextZ=null,ke.prevZ=null,function(Ne){var je,Ve,qe,ct,mt,yt,Ft,jt,qt=1;do{for(Ve=Ne,Ne=null,mt=null,yt=0;Ve;){for(yt++,qe=Ve,Ft=0,je=0;je<qt&&(Ft++,qe=qe.nextZ);je++);for(jt=qt;Ft>0||jt>0&&qe;)Ft!==0&&(jt===0||!qe||Ve.z<=qe.z)?(ct=Ve,Ve=Ve.nextZ,Ft--):(ct=qe,qe=qe.nextZ,jt--),mt?mt.nextZ=ct:Ne=ct,ct.prevZ=mt,mt=ct;Ve=qe}mt.nextZ=null,qt*=2}while(yt>1)}(ke)}(a,x,E,I);for(var k,V,K=a;a.prev!==a.next;)if(k=a.prev,V=a.next,I?kU(a,x,E,I):LU(a))u.push(k.i/p),u.push(a.i/p),u.push(V.i/p),cA(a),a=V.next,K=V.next;else if((a=V)===K){D?D===1?oA(a=NU(Iu(a),u,p),u,p,x,E,I,2):D===2&&UU(a,u,p,x,E,I):oA(Iu(a),u,p,x,E,I,1);break}}}function LU(a){var u=a.prev,p=a,x=a.next;if(Gi(u,p,x)>=0)return!1;for(var E=a.next.next;E!==a.prev;){if($h(u.x,u.y,p.x,p.y,x.x,x.y,E.x,E.y)&&Gi(E.prev,E,E.next)>=0)return!1;E=E.next}return!0}function kU(a,u,p,x){var E=a.prev,I=a,D=a.next;if(Gi(E,I,D)>=0)return!1;for(var k=E.x>I.x?E.x>D.x?E.x:D.x:I.x>D.x?I.x:D.x,V=E.y>I.y?E.y>D.y?E.y:D.y:I.y>D.y?I.y:D.y,K=uv(E.x<I.x?E.x<D.x?E.x:D.x:I.x<D.x?I.x:D.x,E.y<I.y?E.y<D.y?E.y:D.y:I.y<D.y?I.y:D.y,u,p,x),Q=uv(k,V,u,p,x),ie=a.prevZ,fe=a.nextZ;ie&&ie.z>=K&&fe&&fe.z<=Q;){if(ie!==a.prev&&ie!==a.next&&$h(E.x,E.y,I.x,I.y,D.x,D.y,ie.x,ie.y)&&Gi(ie.prev,ie,ie.next)>=0||(ie=ie.prevZ,fe!==a.prev&&fe!==a.next&&$h(E.x,E.y,I.x,I.y,D.x,D.y,fe.x,fe.y)&&Gi(fe.prev,fe,fe.next)>=0))return!1;fe=fe.nextZ}for(;ie&&ie.z>=K;){if(ie!==a.prev&&ie!==a.next&&$h(E.x,E.y,I.x,I.y,D.x,D.y,ie.x,ie.y)&&Gi(ie.prev,ie,ie.next)>=0)return!1;ie=ie.prevZ}for(;fe&&fe.z<=Q;){if(fe!==a.prev&&fe!==a.next&&$h(E.x,E.y,I.x,I.y,D.x,D.y,fe.x,fe.y)&&Gi(fe.prev,fe,fe.next)>=0)return!1;fe=fe.nextZ}return!0}function NU(a,u,p){var x=a;do{var E=x.prev,I=x.next.next;!im(E,I)&&YT(E,x,x.next,I)&&aA(E,I)&&aA(I,E)&&(u.push(E.i/p),u.push(x.i/p),u.push(I.i/p),cA(x),cA(x.next),x=a=I),x=x.next}while(x!==a);return Iu(x)}function UU(a,u,p,x,E,I){var D=a;do{for(var k=D.next.next;k!==D.prev;){if(D.i!==k.i&&jU(D,k)){var V=ZT(D,k);return D=Iu(D,D.next),V=Iu(V,V.next),oA(D,u,p,x,E,I),void oA(V,u,p,x,E,I)}k=k.next}D=D.next}while(D!==a)}function zU(a,u){return a.x-u.x}function GU(a,u){if(u=function(x,E){var I,D=E,k=x.x,V=x.y,K=-1/0;do{if(V<=D.y&&V>=D.next.y&&D.next.y!==D.y){var Q=D.x+(V-D.y)*(D.next.x-D.x)/(D.next.y-D.y);if(Q<=k&&Q>K){if(K=Q,Q===k){if(V===D.y)return D;if(V===D.next.y)return D.next}I=D.x<D.next.x?D:D.next}}D=D.next}while(D!==E);if(!I)return null;if(k===K)return I;var ie,fe=I,ye=I.x,ke=I.y,Ne=1/0;D=I;do k>=D.x&&D.x>=ye&&k!==D.x&&$h(V<ke?k:K,V,ye,ke,V<ke?K:k,V,D.x,D.y)&&(ie=Math.abs(V-D.y)/(k-D.x),aA(D,x)&&(ie<Ne||ie===Ne&&(D.x>I.x||D.x===I.x&&VU(I,D)))&&(I=D,Ne=ie)),D=D.next;while(D!==fe);return I}(a,u)){var p=ZT(u,a);Iu(u,u.next),Iu(p,p.next)}}function VU(a,u){return Gi(a.prev,a,u.prev)<0&&Gi(u.next,a,a.next)<0}function uv(a,u,p,x,E){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=32767*(a-p)*E)|a<<8))|a<<4))|a<<2))|a<<1))|(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=32767*(u-x)*E)|u<<8))|u<<4))|u<<2))|u<<1))<<1}function HU(a){var u=a,p=a;do(u.x<p.x||u.x===p.x&&u.y<p.y)&&(p=u),u=u.next;while(u!==a);return p}function $h(a,u,p,x,E,I,D,k){return(E-D)*(u-k)-(a-D)*(I-k)>=0&&(a-D)*(x-k)-(p-D)*(u-k)>=0&&(p-D)*(I-k)-(E-D)*(x-k)>=0}function jU(a,u){return a.next.i!==u.i&&a.prev.i!==u.i&&!function(p,x){var E=p;do{if(E.i!==p.i&&E.next.i!==p.i&&E.i!==x.i&&E.next.i!==x.i&&YT(E,E.next,p,x))return!0;E=E.next}while(E!==p);return!1}(a,u)&&(aA(a,u)&&aA(u,a)&&function(p,x){var E=p,I=!1,D=(p.x+x.x)/2,k=(p.y+x.y)/2;do E.y>k!=E.next.y>k&&E.next.y!==E.y&&D<(E.next.x-E.x)*(k-E.y)/(E.next.y-E.y)+E.x&&(I=!I),E=E.next;while(E!==p);return I}(a,u)&&(Gi(a.prev,a,u.prev)||Gi(a,u.prev,u))||im(a,u)&&Gi(a.prev,a,a.next)>0&&Gi(u.prev,u,u.next)>0)}function Gi(a,u,p){return(u.y-a.y)*(p.x-u.x)-(u.x-a.x)*(p.y-u.y)}function im(a,u){return a.x===u.x&&a.y===u.y}function YT(a,u,p,x){var E=om(Gi(a,u,p)),I=om(Gi(a,u,x)),D=om(Gi(p,x,a)),k=om(Gi(p,x,u));return E!==I&&D!==k||!(E!==0||!sm(a,p,u))||!(I!==0||!sm(a,x,u))||!(D!==0||!sm(p,a,x))||!(k!==0||!sm(p,u,x))}function sm(a,u,p){return u.x<=Math.max(a.x,p.x)&&u.x>=Math.min(a.x,p.x)&&u.y<=Math.max(a.y,p.y)&&u.y>=Math.min(a.y,p.y)}function om(a){return a>0?1:a<0?-1:0}function aA(a,u){return Gi(a.prev,a,a.next)<0?Gi(a,u,a.next)>=0&&Gi(a,a.prev,u)>=0:Gi(a,u,a.prev)<0||Gi(a,a.next,u)<0}function ZT(a,u){var p=new fv(a.i,a.x,a.y),x=new fv(u.i,u.x,u.y),E=a.next,I=u.prev;return a.next=u,u.prev=a,p.next=E,E.prev=p,x.next=p,p.prev=x,I.next=x,x.prev=I,x}function QT(a,u,p,x){var E=new fv(a,u,p);return x?(E.next=x.next,E.prev=x,x.next.prev=E,x.next=E):(E.prev=E,E.next=E),E}function cA(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 fv(a,u,p){this.i=a,this.x=u,this.y=p,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function hv(a,u,p,x){for(var E=0,I=u,D=p-x;I<p;
2102I+=x)E+=(a[D]-a[I])*(a[I+1]+a[D+1]),D=I;return E}function $U(a,u,p,x,E){(function I(D,k,V,K,Q){for(;K>V;){if(K-V>600){var ie=K-V+1,fe=k-V+1,ye=Math.log(ie),ke=.5*Math.exp(2*ye/3),Ne=.5*Math.sqrt(ye*ke*(ie-ke)/ie)*(fe-ie/2<0?-1:1);I(D,k,Math.max(V,Math.floor(k-fe*ke/ie+Ne)),Math.min(K,Math.floor(k+(ie-fe)*ke/ie+Ne)),Q)}var je=D[k],Ve=V,qe=K;for(lA(D,V,k),Q(D[K],je)>0&&lA(D,V,K);Ve<qe;){for(lA(D,Ve,qe),Ve++,qe--;Q(D[Ve],je)<0;)Ve++;for(;Q(D[qe],je)>0;)qe--}Q(D[V],je)===0?lA(D,V,qe):lA(D,++qe,K),qe<=k&&(V=qe+1),k<=qe&&(K=qe-1)}})(a,u,p,x||a.length-1,E||WU)}function lA(a,u,p){var x=a[u];a[u]=a[p],a[p]=x}function WU(a,u){return a<u?-1:a>u?1:0}function dv(a,u){var p=a.length;if(p<=1)return[a];for(var x,E,I=[],D=0;D<p;D++){var k=et(a[D]);k!==0&&(a[D].area=Math.abs(k),E===void 0&&(E=k<0),E===k<0?(x&&I.push(x),x=[a[D]]):x.push(a[D]))}if(x&&I.push(x),u>1)for(var V=0;V<I.length;V++)I[V].length<=u||($U(I[V],u,1,I[V].length-1,JU),I[V]=I[V].slice(0,u));return I}function JU(a,u){return u.area-a.area}function pv(a,u,p){for(var x=p.patternDependencies,E=!1,I=0,D=u;I<D.length;I+=1){var k=D[I].paint.get(a+"-pattern");k.isConstant()||(E=!0);var V=k.constantOr(null);V&&(E=!0,x[V.to]=!0,x[V.from]=!0)}return E}function Av(a,u,p,x,E){for(var I=E.patternDependencies,D=0,k=u;D<k.length;D+=1){var V=k[D],K=V.paint.get(a+"-pattern").value;if(K.kind!=="constant"){var Q=K.evaluate({zoom:x-1},p,{},E.availableImages),ie=K.evaluate({zoom:x},p,{},E.availableImages),fe=K.evaluate({zoom:x+1},p,{},E.availableImages);ie=ie&&ie.name?ie.name:ie,fe=fe&&fe.name?fe.name:fe,I[Q=Q&&Q.name?Q.name:Q]=!0,I[ie]=!0,I[fe]=!0,p.patterns[V.id]={min:Q,mid:ie,max:fe}}}return p}nm.deviation=function(a,u,p,x){var E=u&&u.length,I=Math.abs(hv(a,0,E?u[0]*p:a.length,p));if(E)for(var D=0,k=u.length;D<k;D++)I-=Math.abs(hv(a,u[D]*p,D<k-1?u[D+1]*p:a.length,p));var V=0;for(D=0;D<x.length;D+=3){var K=x[D]*p,Q=x[D+1]*p,ie=x[D+2]*p;V+=Math.abs((a[K]-a[ie])*(a[Q+1]-a[K+1])-(a[K]-a[Q])*(a[ie+1]-a[K+1]))}return I===0&&V===0?0:Math.abs((V-I)/I)},nm.flatten=function(a){for(var u=a[0][0].length,p={vertices:[],holes:[],dimensions:u},x=0,E=0;E<a.length;E++){for(var I=0;I<a[E].length;I++)for(var D=0;D<u;D++)p.vertices.push(a[E][I][D]);E>0&&p.holes.push(x+=a[E-1].length)}return p},lv.default=OU;var oc=function(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(u){return u.id}),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new js,this.indexArray=new sa,this.indexArray2=new B,this.programConfigurations=new Or(a.layers,a.zoom),this.segments=new Z,this.segments2=new Z,this.stateDependentLayerIds=this.layers.filter(function(u){return u.isStateDependent()}).map(function(u){return u.id})};oc.prototype.populate=function(a,u,p){this.hasPattern=pv("fill",this.layers,u);for(var x=this.layers[0].layout.get("fill-sort-key"),E=[],I=0,D=a;I<D.length;I+=1){var k=D[I],V=k.feature,K=k.id,Q=k.index,ie=k.sourceLayerIndex,fe=this.layers[0]._featureFilter.needGeometry,ye=Mi(V,fe);if(this.layers[0]._featureFilter.filter(new Hr(this.zoom),ye,p)){var ke=x?x.evaluate(ye,{},p,u.availableImages):void 0,Ne={id:K,properties:V.properties,type:V.type,sourceLayerIndex:ie,index:Q,geometry:fe?ye.geometry:bi(V),patterns:{},sortKey:ke};E.push(Ne)}}x&&E.sort(function(jt,qt){return jt.sortKey-qt.sortKey});for(var je=0,Ve=E;je<Ve.length;je+=1){var qe=Ve[je],ct=qe.geometry,mt=qe.index,yt=qe.sourceLayerIndex;if(this.hasPattern){var Ft=Av("fill",this.layers,qe,this.zoom,u);this.patternFeatures.push(Ft)}else this.addFeature(qe,ct,mt,p,{});u.featureIndex.insert(a[mt].feature,ct,mt,yt,this.index)}},oc.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},oc.prototype.addFeatures=function(a,u,p){for(var x=0,E=this.patternFeatures;x<E.length;x+=1){var I=E[x];this.addFeature(I,I.geometry,I.index,u,p)}},oc.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},oc.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},oc.prototype.upload=function(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,DU),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),this.uploaded=!0},oc.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},oc.prototype.addFeature=function(a,u,p,x,E){for(var I=0,D=dv(u,500);I<D.length;I+=1){for(var k=D[I],V=0,K=0,Q=k;K<Q.length;K+=1)V+=Q[K].length;for(var ie=this.segments.prepareSegment(V,this.layoutVertexArray,this.indexArray),fe=ie.vertexLength,ye=[],ke=[],Ne=0,je=k;Ne<je.length;Ne+=1){var Ve=je[Ne];if(Ve.length!==0){Ve!==k[0]&&ke.push(ye.length/2);var qe=this.segments2.prepareSegment(Ve.length,this.layoutVertexArray,this.indexArray2),ct=qe.vertexLength;this.layoutVertexArray.emplaceBack(Ve[0].x,Ve[0].y),this.indexArray2.emplaceBack(ct+Ve.length-1,ct),ye.push(Ve[0].x),ye.pu
2102sh(Ve[0].y);for(var mt=1;mt<Ve.length;mt++)this.layoutVertexArray.emplaceBack(Ve[mt].x,Ve[mt].y),this.indexArray2.emplaceBack(ct+mt-1,ct+mt),ye.push(Ve[mt].x),ye.push(Ve[mt].y);qe.vertexLength+=Ve.length,qe.primitiveLength+=Ve.length}}for(var yt=lv(ye,ke),Ft=0;Ft<yt.length;Ft+=3)this.indexArray.emplaceBack(fe+yt[Ft],fe+yt[Ft+1],fe+yt[Ft+2]);ie.vertexLength+=V,ie.primitiveLength+=yt.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,p,E,x)},or("FillBucket",oc,{omit:["layers","patternFeatures"]});var XU=new Jn({"fill-sort-key":new ur(ae.layout_fill["fill-sort-key"])}),KU={paint:new Jn({"fill-antialias":new wr(ae.paint_fill["fill-antialias"]),"fill-opacity":new ur(ae.paint_fill["fill-opacity"]),"fill-color":new ur(ae.paint_fill["fill-color"]),"fill-outline-color":new ur(ae.paint_fill["fill-outline-color"]),"fill-translate":new wr(ae.paint_fill["fill-translate"]),"fill-translate-anchor":new wr(ae.paint_fill["fill-translate-anchor"]),"fill-pattern":new Cu(ae.paint_fill["fill-pattern"])}),layout:XU},qU=function(a){function u(p){a.call(this,p,KU)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.recalculate=function(p,x){a.prototype.recalculate.call(this,p,x);var E=this.paint._values["fill-outline-color"];E.value.kind==="constant"&&E.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},u.prototype.createBucket=function(p){return new oc(p)},u.prototype.queryRadius=function(){return Yi(this.paint.get("fill-translate"))},u.prototype.queryIntersectsFeature=function(p,x,E,I,D,k,V){return oa(sc(p,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),k.angle,V),I)},u.prototype.isTileClipped=function(){return!0},u}(zr),YU=ki([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,eE=Wh;function Wh(a,u,p,x,E){this.properties={},this.extent=p,this.type=0,this._pbf=a,this._geometry=-1,this._keys=x,this._values=E,a.readFields(ZU,this,u)}function ZU(a,u,p){a==1?u.id=p.readVarint():a==2?function(x,E){for(var I=x.readVarint()+x.pos;x.pos<I;){var D=E._keys[x.readVarint()],k=E._values[x.readVarint()];E.properties[D]=k}}(p,u):a==3?u.type=p.readVarint():a==4&&(u._geometry=p.pos)}function QU(a){for(var u,p,x=0,E=0,I=a.length,D=I-1;E<I;
vendor: 9,321 bytes, line 2102
2102D=E++)x+=((p=a[D]).x-(u=a[E]).x)*(u.y+p.y);return x}Wh.types=["Unknown","Point","LineString","Polygon"],Wh.prototype.loadGeometry=function(){var a=this._pbf;a.pos=this._geometry;for(var u,p=a.readVarint()+a.pos,x=1,E=0,I=0,D=0,k=[];a.pos<p;){if(E<=0){var V=a.readVarint();x=7&V,E=V>>3}if(E--,x===1||x===2)I+=a.readSVarint(),D+=a.readSVarint(),x===1&&(u&&k.push(u),u=[]),u.push(new v(I,D));else{if(x!==7)throw new Error("unknown command "+x);u&&u.push(u[0].clone())}}return u&&k.push(u),k},Wh.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var u=a.readVarint()+a.pos,p=1,x=0,E=0,I=0,D=1/0,k=-1/0,V=1/0,K=-1/0;a.pos<u;){if(x<=0){var Q=a.readVarint();p=7&Q,x=Q>>3}if(x--,p===1||p===2)(E+=a.readSVarint())<D&&(D=E),E>k&&(k=E),(I+=a.readSVarint())<V&&(V=I),I>K&&(K=I);else if(p!==7)throw new Error("unknown command "+p)}return[D,V,k,K]},Wh.prototype.toGeoJSON=function(a,u,p){var x,E,I=this.extent*Math.pow(2,p),D=this.extent*a,k=this.extent*u,V=this.loadGeometry(),K=Wh.types[this.type];function Q(ye){for(var ke=0;ke<ye.length;ke++){var Ne=ye[ke];ye[ke]=[360*(Ne.x+D)/I-180,360/Math.PI*Math.atan(Math.exp((180-360*(Ne.y+k)/I)*Math.PI/180))-90]}}switch(this.type){case 1:var ie=[];for(x=0;x<V.length;x++)ie[x]=V[x][0];Q(V=ie);break;case 2:for(x=0;x<V.length;x++)Q(V[x]);break;case 3:for(V=function(ye){var ke=ye.length;if(ke<=1)return[ye];for(var Ne,je,Ve=[],qe=0;qe<ke;qe++){var ct=QU(ye[qe]);ct!==0&&(je===void 0&&(je=ct<0),je===ct<0?(Ne&&Ve.push(Ne),Ne=[ye[qe]]):Ne.push(ye[qe]))}return Ne&&Ve.push(Ne),Ve}(V),x=0;x<V.length;x++)for(E=0;E<V[x].length;E++)Q(V[x][E])}V.length===1?V=V[0]:K="Multi"+K;var fe={type:"Feature",geometry:{type:K,coordinates:V},properties:this.properties};return"id"in this&&(fe.id=this.id),fe};var tE=rE;function rE(a,u){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(e9,this,u),this.length=this._features.length}function e9(a,u,p){a===15?u.version=p.readVarint():a===1?u.name=p.readString():a===5?u.extent=p.readVarint():a===2?u._features.push(p.pos):a===3?u._keys.push(p.readString()):a===4&&u._values.push(function(x){for(var E=null,I=x.readVarint()+x.pos;x.pos<I;){var D=x.readVarint()>>3;E=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 E}(p))}function t9(a,u,p){if(a===3){var x=new tE(p,p.readVarint()+p.pos);x.length&&(u[x.name]=x)}}rE.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 u=this._pbf.readVarint()+this._pbf.pos;return new eE(this._pbf,u,this.extent,this._keys,this._values)};var Jh={VectorTile:function(a,u){this.layers=a.readFields(t9,{},u)},VectorTileFeature:eE,VectorTileLayer:tE},r9=Jh.VectorTileFeature.types,gv=Math.pow(2,13);function uA(a,u,p,x,E,I,D,k){a.emplaceBack(u,p,2*Math.floor(x*gv)+D,E*gv*2,I*gv*2,Math.round(k))}var ac=function(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(u){return u.id}),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new di,this.indexArray=new sa,this.programConfigurations=new Or(a.layers,a.zoom),this.segments=new Z,this.stateDependentLayerIds=this.layers.filter(function(u){return u.isStateDependent()}).map(function(u){return u.id})};function n9(a,u){return a.x===u.x&&(a.x<0||a.x>8192)||a.y===u.y&&(a.y<0||a.y>8192)}ac.prototype.populate=function(a,u,p){this.features=[],this.hasPattern=pv("fill-extrusion",this.layers,u);for(var x=0,E=a;x<E.length;x+=1){var I=E[x],D=I.feature,k=I.id,V=I.index,K=I.sourceLayerIndex,Q=this.layers[0]._featureFilter.needGeometry,ie=Mi(D,Q);if(this.layers[0]._featureFilter.filter(new Hr(this.zoom),ie,p)){var fe={id:k,sourceLayerIndex:K,index:V,geometry:Q?ie.geometry:bi(D),properties:D.properties,type:D.type,patterns:{}};this.hasPattern?this.features.push(Av("fill-extrusion",this.layers,fe,this.zoom,u)):this.addFeature(fe,fe.geometry,V,p,{}),u.featureIndex.insert(D,fe.geometry,V,K,this.index,!0)}}},ac.prototype.addFeatures=function(a,u,p){for(var x=0,E=this.features;x<E.length;x+=1){var I=E[x];this.addFeature(I,I.geometry,I.index,u,p)}},ac.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},ac.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},ac.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},ac.prototype.upload=function(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,YU),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0},ac.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},ac.prototype.addFeature=function(a,u,p,x,E){for(var I=0,D=dv(u,500);I<D.length;I+=1){for(var k=D[I],V=0,K=0,Q=k;K<Q.length;K+=1)V+=Q[K].length;for(var ie=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),fe=0,ye=k;fe<ye.length;fe+=1){var ke=ye[fe];if(ke.length!==0&&!((hn=ke).every(function(qr){return qr.x<0})||hn.every(function(qr){return qr.x>8192})||hn.every(function(qr){return qr.y<0})||hn.every(function(qr){return qr.y>8192})))for(var Ne=0,je=0;je<ke.length;je++){var Ve=ke[je];if(je>=1){var qe=ke[je-1];if(!n9(Ve,qe)){ie.vertexLength+4>Z.MAX_VERTEX_ARRAY_LENGTH&&(ie=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var ct=Ve.sub(qe)._perp()._unit(),mt=qe.dist(Ve);Ne+mt>32768&&(Ne=0),uA(this.layoutVertexArray,Ve.x,Ve.y,ct.x,ct.y,0,0,Ne),uA(this.layoutVertexArray,Ve.x,Ve.y,ct.x,ct.y,0,1,Ne),uA(this.layoutVertexArray,qe.x,qe.y,ct.x,ct.y,0,0,Ne+=mt),uA(this.layoutVertexArray,qe.x,qe.y,ct.x,ct.y,0,1,Ne);var yt=ie.vertexLength;this.indexArray.emplaceBack(yt,yt+2,yt+1),this.indexArray.emplaceBack(yt+1,yt+2,yt+3),ie.vertexLength+=4,ie.primitiveLength+=2}}}}if(ie.vertexLength+V>Z.MAX_VERTEX_ARRAY_LENGTH&&(ie=this.segments.prepareSegment(V,this.layoutVertexArray,this.indexArray)),r9[a.type]==="Polygon"){for(var Ft=[],jt=[],qt=ie.vertexLength,br=0,nr=k;br<nr.length;br+=1){var Br=nr[br];if(Br.length!==0){Br!==k[0]&&jt.push(Ft.length/2);for(var ir=0;ir<Br.length;ir++){var sn=Br[ir];uA(this.layoutVertexArray,sn.x,sn.y,0,0,1,1,0),Ft.push(sn.x),Ft.push(sn.y)}}}for(var Lr=lv(Ft,jt),hr=0;hr<Lr.length;hr+=3)this.indexArray.emplaceBack(qt+Lr[hr],qt+Lr[hr+2],qt+Lr[hr+1]);ie.primitiveLength+=Lr.length/3,ie.vertexLength+=V}}var hn;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,p,E,x)},or("FillExtrusionBucket",ac,{omit:["layers","features"]});var i9={paint:new Jn({"fill-extrusion-opacity":new wr(ae["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ur(ae["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new wr(ae["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new wr(ae["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Cu(ae["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ur(ae["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ur(ae["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new wr(ae["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},s9=function(a){function u(p){a.call(this,p,i9)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.createBucket=function(p){return new ac(p)},u.prototype.queryRadius=function(){return Yi(this.paint.get("fill-extrusion-translate"))},u.prototype.is3D=function(){return!0},u.prototype.queryIntersectsFeature=function(p,x,E,I,D,k,V,K){var Q=sc(p,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),k.angle,V),ie=this.paint.get("fill-extrusion-height").evaluate(x,E),fe=this.paint.get("fill-extrusion-base").evaluate(x,E),ye=function(Ne,je,Ve,qe){for(var ct=[],mt=0,yt=Ne;mt<yt.length;mt+=1){var Ft=yt[mt],jt=[Ft.x,Ft.y,0,1];Hh(jt,jt,je),ct.push(new v(jt[0]/jt[3],jt[1]/jt[3]))}return ct}(Q,K),ke=function(Ne,je,Ve,qe){for(var ct=[],mt=[],yt=qe[8]*je,Ft=qe[9]*je,jt=qe[10]*je,qt=qe[11]*je,br=qe[8]*Ve,nr=qe[9]*Ve,Br=qe[10]*Ve,ir=qe[11]*Ve,sn=0,Lr=Ne;sn<Lr.length;sn+=1){for(var hr=[],hn=[],qr=0,bn=Lr[sn];qr<bn.length;qr+=1){var Sr=bn[qr],Cn=Sr.x,ni=Sr.y,Bi=qe[0]*Cn+qe[4]*ni+qe[12],xi=qe[1]*Cn+qe[5]*ni+qe[13],ii=qe[2]*Cn+qe[6]*ni+qe[14],Si=qe[3]*Cn+qe[7]*ni+qe[15],Zi=ii+jt,Qi=Si+qt,Fs=Bi+br,ls=xi+nr,Ds=ii+Br,Pi=Si+ir,us=new v((Bi+yt)/Qi,(xi+Ft)/Qi);us.z=Zi/Qi,hr.push(us);var gn=new v(Fs/Pi,ls/Pi);gn.z=Ds/Pi,hn.push(gn)}ct.push(hr),mt.push(hn)}return[ct,mt]}(I,fe,ie,K);return function(Ne,je,Ve){var qe=1/0;oa(Ve,je)&&(qe=nE(Ve,je[0]));for(var ct=0;ct<je.length;ct++)for(var mt=je[ct],yt=Ne[ct],Ft=0;Ft<mt.length-1;Ft++){var jt=mt[Ft],qt=[jt,mt[Ft+1],yt[Ft+1],yt[Ft],jt];jc(Ve,qt)&&(qe=Math.min(qe,nE(Ve,qt)))}return qe!==1/0&&qe}(ke[0],ke[1],ye)},u}(zr);function fA(a,u){return a.x*u.x+a.y*u.y}function nE(a,u){if(a.length===1){for(var p,x=0,E=u[x++];!p||E.equals(p);
2102)if(!(p=u[x++]))return 1/0;for(;x<u.length;x++){var I=u[x],D=a[0],k=p.sub(E),V=I.sub(E),K=D.sub(E),Q=fA(k,k),ie=fA(k,V),fe=fA(V,V),ye=fA(K,k),ke=fA(K,V),Ne=Q*fe-ie*ie,je=(fe*ye-ie*ke)/Ne,Ve=(Q*ke-ie*ye)/Ne,qe=E.z*(1-je-Ve)+p.z*je+I.z*Ve;if(isFinite(qe))return qe}return 1/0}for(var ct=1/0,mt=0,yt=u;mt<yt.length;mt+=1)ct=Math.min(ct,yt[mt].z);return ct}var o9=ki([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,a9=ki([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,c9=Jh.VectorTileFeature.types,l9=Math.cos(Math.PI/180*37.5),iE=Math.pow(2,14)/.5,Js=function(a){var u=this;this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(p){return p.id}),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(function(p){u.gradients[p.id]={}}),this.layoutVertexArray=new os,this.layoutVertexArray2=new To,this.indexArray=new sa,this.programConfigurations=new Or(a.layers,a.zoom),this.segments=new Z,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(function(p){return p.isStateDependent()}).map(function(p){return p.id})};Js.prototype.populate=function(a,u,p){this.hasPattern=pv("line",this.layers,u);for(var x=this.layers[0].layout.get("line-sort-key"),E=[],I=0,D=a;I<D.length;I+=1){var k=D[I],V=k.feature,K=k.id,Q=k.index,ie=k.sourceLayerIndex,fe=this.layers[0]._featureFilter.needGeometry,ye=Mi(V,fe);if(this.layers[0]._featureFilter.filter(new Hr(this.zoom),ye,p)){var ke=x?x.evaluate(ye,{},p):void 0,Ne={id:K,properties:V.properties,type:V.type,sourceLayerIndex:ie,index:Q,geometry:fe?ye.geometry:bi(V),patterns:{},sortKey:ke};E.push(Ne)}}x&&E.sort(function(jt,qt){return jt.sortKey-qt.sortKey});for(var je=0,Ve=E;je<Ve.length;je+=1){var qe=Ve[je],ct=qe.geometry,mt=qe.index,yt=qe.sourceLayerIndex;if(this.hasPattern){var Ft=Av("line",this.layers,qe,this.zoom,u);this.patternFeatures.push(Ft)}else this.addFeature(qe,ct,mt,p,{});u.featureIndex.insert(a[mt].feature,ct,mt,yt,this.index)}},Js.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},Js.prototype.addFeatures=function(a,u,p){for(var x=0,E=this.patternFeatures;x<E.length;x+=1){var I=E[x];this.addFeature(I,I.geometry,I.index,u,p)}},Js.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},Js.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Js.prototype.upload=function(a){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,a9)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,o9),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0},Js.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Js.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}},Js.prototype.addFeature=function(a,u,p,x,E){var I=this.layers[0].layout,D=I.get("line-join").evaluate(a,{}),k=I.get("line-cap"),V=I.get("line-miter-limit"),K=I.get("line-round-limit");this.lineClips=this.lineFeatureClips(a);for(var Q=0,ie=u;Q<ie.length;Q+=1)this.addLine(ie[Q],a,D,k,V,K);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,p,E,x)},Js.prototype.addLine=function(a,u,p,x,E,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 k=c9[u.type]==="Polygon",V=a.length;V>=2&&a[V-1].equals(a[V-2]);)V--;for(var K=0;K<V-1&&a[K].equals(a[K+1]);)K++;if(!(V<(k?3:2))){p==="bevel"&&(E=1.05);var Q,ie=this.overscaling<=16?122880/(512*this.overscaling):0,fe=this.segments.prepareSegment(10*V,this.layoutVertexArray,this.indexArray),ye=void 0,ke=void 0,Ne=void 0,je=void 0;this.e1=this.e2=-1,k&&(je=a[K].sub(Q=a[V-2])._unit()._perp());for(var Ve=K;Ve<V;Ve++)if(!(ke=Ve===V-1?k?a[K+1]:void 0:a[Ve+1])||!a[Ve].equals(ke)){je&&(Ne=je),Q&&(ye=Q),Q=a[Ve],je=ke?ke.sub(Q)._unit()._perp():Ne;var qe=(Ne=Ne||je).add(je);qe.x===0&&qe.y===0||qe._unit();var ct=Ne.x*je.x+Ne.y*je.y,mt=qe.x*je.x+qe.y*je.y,yt=mt!==0?1/mt:1/0,Ft=2*Math.sqrt(2-2*mt),jt=mt<l9&&ye&&ke,qt=Ne.x*je.y-Ne.y*je.x>0;if(jt&&Ve>K){var br=Q.dist(ye);if(br>2*ie){var nr=Q.sub(Q.sub(ye)._mult(ie/br)._round());this.updateDistance(ye,nr),this.addCurrentVertex(nr,Ne,0,0,fe),ye=nr}}var Br=ye&&ke,ir=Br?p:k?"butt":x;if(Br&&ir==="round"&&(yt<I?ir="miter":yt<=2&&(ir="fakeround")),ir==="miter"&&yt>E&&(ir="bevel"),ir==="bevel"&&(yt>2&&(ir="flipbevel"),yt<E&&(ir="miter")),ye&&this.updateDistance(ye,Q),ir==="miter")qe._mult(yt),this.addCurrentVertex(Q,qe,0,0,fe);else if(ir==="flipbevel"){if(yt>100)qe=je.mult(-1);else{var sn=yt*Ne.add(je).mag()/Ne.sub(je).mag();qe._perp()._mult(sn*(qt?-1:1))}this.addCurrentVertex(Q,qe,0,0,fe),this.addCurrentVertex(Q,qe.mult(-1),0,0,fe)}else if(ir==="bevel"||ir==="fakeround"){var Lr=-Math.sqrt(yt*yt-1),hr=qt?Lr:0,hn=qt?0:Lr;if(ye&&this.addCurrentVertex(Q,Ne,hr,hn,fe),ir==="fakeround")for(var qr=Math.round(180*Ft/Math.PI/20),bn=1;bn<qr;bn++){var Sr=bn/qr;if(Sr!==.5){var Cn=Sr-.5;Sr+=Sr*Cn*(Sr-1)*((1.0904+ct*(ct*(3.55645-1.43519*ct)-3.2452))*Cn*Cn+(.848013+ct*(.215638*ct-1.06021)))}var ni=je.sub(Ne)._mult(Sr)._add(Ne)._unit()._mult(qt?-1:1);this.addHalfVertex(Q,ni.x,ni.y,!1,qt,0,fe)}ke&&this.addCurrentVertex(Q,je,-hr,-hn,fe)}else if(ir==="butt")this.addCurrentVertex(Q,qe,0,0,fe);else if(ir==="square"){var Bi=ye?1:-1;this.addCurrentVertex(Q,qe,Bi,Bi,fe)}else ir==="round"&&(ye&&(this.addCurrentVertex(Q,Ne,0,0,fe),this.addCurrentVertex(Q,Ne,1,1,fe,!0)),ke&&(this.addCurrentVertex(Q,je,-1,-1,fe,!0),this.addCurrentVertex(Q,je,0,0,fe)));if(jt&&Ve<V-1){var xi=Q.dist(ke);if(xi>2*ie){var ii=Q.add(ke.sub(Q)._mult(ie/xi)._round());this.updateDistance(Q,ii),this.addCurrentVertex(ii,je,0,0,fe),Q=ii}}}}},Js.prototype.addCurrentVertex=function(a,u,p,x,E,I){I===void 0&&(I=!1);var D=u.y*x-u.x,k=-u.y-u.x*x;this.addHalfVertex(a,u.x+u.y*p,u.y-u.x*p,I,!1,p,E),this.addHalfVertex(a,D,k,I,!0,-
vendor: 10,508 bytes, line 2102
2102x,E),this.distance>iE/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(a,u,p,x,E,I))},Js.prototype.addHalfVertex=function(a,u,p,x,E,I,D){var k=.5*(this.lineClips?this.scaledDistance*(iE-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((a.x<<1)+(x?1:0),(a.y<<1)+(E?1:0),Math.round(63*u)+128,Math.round(63*p)+128,1+(I===0?0:I<0?-1:1)|(63&k)<<2,k>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var V=D.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,V),D.primitiveLength++),E?this.e2=V:this.e1=V},Js.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Js.prototype.updateDistance=function(a,u){this.distance+=a.dist(u),this.updateScaledDistance()},or("LineBucket",Js,{omit:["layers","patternFeatures"]});var u9=new Jn({"line-cap":new wr(ae.layout_line["line-cap"]),"line-join":new ur(ae.layout_line["line-join"]),"line-miter-limit":new wr(ae.layout_line["line-miter-limit"]),"line-round-limit":new wr(ae.layout_line["line-round-limit"]),"line-sort-key":new ur(ae.layout_line["line-sort-key"])}),sE={paint:new Jn({"line-opacity":new ur(ae.paint_line["line-opacity"]),"line-color":new ur(ae.paint_line["line-color"]),"line-translate":new wr(ae.paint_line["line-translate"]),"line-translate-anchor":new wr(ae.paint_line["line-translate-anchor"]),"line-width":new ur(ae.paint_line["line-width"]),"line-gap-width":new ur(ae.paint_line["line-gap-width"]),"line-offset":new ur(ae.paint_line["line-offset"]),"line-blur":new ur(ae.paint_line["line-blur"]),"line-dasharray":new fs(ae.paint_line["line-dasharray"]),"line-pattern":new Cu(ae.paint_line["line-pattern"]),"line-gradient":new Ki(ae.paint_line["line-gradient"])}),layout:u9},oE=new(function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.possiblyEvaluate=function(p,x){return x=new Hr(Math.floor(x.zoom),{now:x.now,fadeDuration:x.fadeDuration,zoomHistory:x.zoomHistory,transition:x.transition}),a.prototype.possiblyEvaluate.call(this,p,x)},u.prototype.evaluate=function(p,x,E,I){return x=H({},x,{zoom:Math.floor(x.zoom)}),a.prototype.evaluate.call(this,p,x,E,I)},u}(ur))(sE.paint.properties["line-width"].specification);oE.useIntegerZoom=!0;var f9=function(a){function u(p){a.call(this,p,sE),this.gradientVersion=0}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._handleSpecialPaintPropertyUpdate=function(p){p==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof zn,this.gradientVersion=(this.gradientVersion+1)%F)},u.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},u.prototype.recalculate=function(p,x){a.prototype.recalculate.call(this,p,x),this.paint._values["line-floorwidth"]=oE.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,p)},u.prototype.createBucket=function(p){return new Js(p)},u.prototype.queryRadius=function(p){var x=p,E=aE(Pa("line-width",this,x),Pa("line-gap-width",this,x)),I=Pa("line-offset",this,x);return E/2+Math.abs(I)+Yi(this.paint.get("line-translate"))},u.prototype.queryIntersectsFeature=function(p,x,E,I,D,k,V){var K=sc(p,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,V),Q=V/2*aE(this.paint.get("line-width").evaluate(x,E),this.paint.get("line-gap-width").evaluate(x,E)),ie=this.paint.get("line-offset").evaluate(x,E);return ie&&(I=function(fe,ye){for(var ke=[],Ne=new v(0,0),je=0;je<fe.length;je++){for(var Ve=fe[je],qe=[],ct=0;ct<Ve.length;ct++){var mt=Ve[ct],yt=Ve[ct+1],Ft=ct===0?Ne:mt.sub(Ve[ct-1])._unit()._perp(),jt=ct===Ve.length-1?Ne:yt.sub(mt)._unit()._perp(),qt=Ft._add(jt)._unit();qt._mult(1/(qt.x*jt.x+qt.y*jt.y)),qe.push(qt._mult(ye)._add(mt))}ke.push(qe)}return ke}(I,ie*V)),function(fe,ye,ke){for(var Ne=0;Ne<ye.length;Ne++){var je=ye[Ne];if(fe.length>=3){for(var Ve=0;Ve<je.length;Ve++)if(Ma(fe,je[Ve]))return!0}if(Lo(fe,je,ke))return!0}return!1}(K,I,Q)},u.prototype.isTileClipped=function(){return!0},u}(zr);function aE(a,u){return u>0?u+2*a:a}var h9=ki([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),d9=ki([{name:"a_projected_pos",components:3,type:"Float32"}],4),p9=(ki([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ki([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),cE=(ki([{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"}]),ki([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),A9=ki([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function g9(a,u,p){return a.sections.forEach(function(x){x.text=function(E,I,D){var k=I.layout.get("text-transform").evaluate(D,{});return k==="uppercase"?E=E.toLocaleUpperCase():k==="lowercase"&&(E=E.toLocaleLowerCase()),is.applyArabicShaping&&(E=is.applyArabicShaping(E)),E}(x.text,u,p)}),a}ki([{name:"triangle",components:3,type:"Uint16"}]),ki([{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"}]),ki([{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"}]),ki([{type:"Float32",name:"offsetX"}]),ki([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var hA={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},lE=function(a,u,p,x,E){var I,D,k=8*E-x-1,V=(1<<k)-1,K=V>>1,Q=-7,ie=E-1,fe=-1,ye=a[u+ie];for(ie+=fe,I=ye&(1<<-Q)-1,ye>>=-Q,Q+=k;Q>0;I=256*I+a[u+ie],ie+=fe,Q-=8);for(D=I&(1<<-Q)-1,I>>=-Q,Q+=x;Q>0;D=256*D+a[u+ie],ie+=fe,Q-=8);if(I===0)I=1-K;else{if(I===V)return D?NaN:1/0*(ye?-1:1);D+=Math.pow(2,x),I-=K}return(ye?-1:1)*D*Math.pow(2,I-x)},uE=function(a,u,p,x,E,I){var D,k,V,K=8*I-E-1,Q=(1<<K)-1,ie=Q>>1,fe=E===23?Math.pow(2,-24)-Math.pow(2,-77):0,ye=0,ke=1,Ne=u<0||u===0&&1/u<0?1:0;for(u=Math.abs(u),isNaN(u)||u===1/0?(k=isNaN(u)?1:0,D=Q):(D=Math.floor(Math.log(u)/Math.LN2),u*(V=Math.pow(2,-D))<1&&(D--,V*=2),(u+=D+ie>=1?fe/V:fe*Math.pow(2,1-ie))*V>=2&&(D++,V/=2),D+ie>=Q?(k=0,D=Q):D+ie>=1?(k=(u*V-1)*Math.pow(2,E),D+=ie):(k=u*Math.pow(2,ie-1)*Math.pow(2,E),D=0));E>=8;a[p+ye]=255&k,ye+=ke,k/=256,E-=8);for(D=D<<E|k,K+=E;K>0;a[p+ye]=255&D,ye+=ke,D/=256,K-=8);a[p+ye-ke]|=128*Ne},am=Xn;function Xn(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}Xn.Varint=0,Xn.Fixed64=1,Xn.Bytes=2,Xn.Fixed32=5;var fE=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Ll(a){return a.type===Xn.Bytes?a.readVarint()+a.pos:a.pos+1}function Xh(a,u,p){return p?4294967296*u+(a>>>0):4294967296*(u>>>0)+(a>>>0)}function hE(a,u,p){var x=u<=16383?1:u<=2097151?2:u<=268435455?3:Math.floor(Math.log(u)/(7*Math.LN2));p.realloc(x);for(var E=p.pos-1;E>=a;E--)p.buf[E+x]=p.buf[E]}function m9(a,u){for(var p=0;p<a.length;p++)u.writeVarint(a[p])}function _9(a,u){for(var p=0;p<a.length;p++)u.writeSVarint(a[p])}function y9(a,u){for(var p=0;p<a.length;p++)u.writeFloat(a[p])}function v9(a,u){for(var p=0;p<a.length;p++)u.writeDouble(a[p])}function b9(a,u){for(var p=0;p<a.length;p++)u.writeBoolean(a[p])}function x9(a,u){for(var p=0;p<a.length;p++)u.writeFixed32(a[p])}function w9(a,u){for(var p=0;p<a.length;p++)u.writeSFixed32(a[p])}function C9(a,u){for(var p=0;p<a.length;
2102p++)u.writeFixed64(a[p])}function T9(a,u){for(var p=0;p<a.length;p++)u.writeSFixed64(a[p])}function cm(a,u){return(a[u]|a[u+1]<<8|a[u+2]<<16)+16777216*a[u+3]}function Kh(a,u,p){a[p]=u,a[p+1]=u>>>8,a[p+2]=u>>>16,a[p+3]=u>>>24}function dE(a,u){return(a[u]|a[u+1]<<8|a[u+2]<<16)+(a[u+3]<<24)}function E9(a,u,p){a===1&&p.readMessage(B9,u)}function B9(a,u,p){if(a===3){var x=p.readMessage(S9,{}),E=x.width,I=x.height,D=x.left,k=x.top,V=x.advance;u.push({id:x.id,bitmap:new Ff({width:E+6,height:I+6},x.bitmap),metrics:{width:E,height:I,left:D,top:k,advance:V}})}}function S9(a,u,p){a===1?u.id=p.readVarint():a===2?u.bitmap=p.readBytes():a===3?u.width=p.readVarint():a===4?u.height=p.readVarint():a===5?u.left=p.readSVarint():a===6?u.top=p.readSVarint():a===7&&(u.advance=p.readVarint())}function pE(a){for(var u=0,p=0,x=0,E=a;x<E.length;x+=1){var I=E[x];u+=I.w*I.h,p=Math.max(p,I.w)}a.sort(function(Ne,je){return je.h-Ne.h});for(var D=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(u/.95)),p),h:1/0}],k=0,V=0,K=0,Q=a;K<Q.length;K+=1)for(var ie=Q[K],fe=D.length-1;fe>=0;fe--){var ye=D[fe];if(!(ie.w>ye.w||ie.h>ye.h)){if(ie.x=ye.x,ie.y=ye.y,V=Math.max(V,ie.y+ie.h),k=Math.max(k,ie.x+ie.w),ie.w===ye.w&&ie.h===ye.h){var ke=D.pop();fe<D.length&&(D[fe]=ke)}else ie.h===ye.h?(ye.x+=ie.w,ye.w-=ie.w):ie.w===ye.w?(ye.y+=ie.h,ye.h-=ie.h):(D.push({x:ye.x+ie.w,y:ye.y,w:ye.w-ie.w,h:ie.h}),ye.y+=ie.h,ye.h-=ie.h);break}}return{w:k,h:V,fill:u/(k*V)||0}}Xn.prototype={destroy:function(){this.buf=null},readFields:function(a,u,p){for(p=p||this.length;this.pos<p;){var x=this.readVarint(),E=x>>3,I=this.pos;this.type=7&x,a(E,u,this),this.pos===I&&this.skip(x)}return u},readMessage:function(a,u){return this.readFields(a,u,this.readVarint()+this.pos)},readFixed32:function(){var a=cm(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=dE(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=cm(this.buf,this.pos)+4294967296*cm(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=cm(this.buf,this.pos)+4294967296*dE(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=lE(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=lE(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(a){var u,p,x=this.buf;return u=127&(p=x[this.pos++]),p<128?u:(u|=(127&(p=x[this.pos++]))<<7,p<128?u:(u|=(127&(p=x[this.pos++]))<<14,p<128?u:(u|=(127&(p=x[this.pos++]))<<21,p<128?u:function(E,I,D){var k,V,K=D.buf;if(k=(112&(V=K[D.pos++]))>>4,V<128||(k|=(127&(V=K[D.pos++]))<<3,V<128)||(k|=(127&(V=K[D.pos++]))<<10,V<128)||(k|=(127&(V=K[D.pos++]))<<17,V<128)||(k|=(127&(V=K[D.pos++]))<<24,V<128)||(k|=(1&(V=K[D.pos++]))<<31,V<128))return Xh(E,k,I);throw new Error("Expected varint not more than 10 bytes")}(u|=(15&(p=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!!this.readVarint()},readString:function(){var a=this.readVarint()+this.pos,u=this.pos;return this.pos=a,a-u>=12&&fE?function(p,x,E){return fE.decode(p.subarray(x,E))}(this.buf,u,a):function(p,x,E){for(var I="",D=x;D<E;){var k,V,K,Q=p[D],ie=null,fe=Q>239?4:Q>223?3:Q>191?2:1;if(D+fe>E)break;fe===1?Q<128&&(ie=Q):fe===2?(192&(k=p[D+1]))==128&&(ie=(31&Q)<<6|63&k)<=127&&(ie=null):fe===3?(V=p[D+2],(192&(k=p[D+1]))==128&&(192&V)==128&&((ie=(15&Q)<<12|(63&k)<<6|63&V)<=2047||ie>=55296&&ie<=57343)&&(ie=null)):fe===4&&(V=p[D+2],K=p[D+3],(192&(k=p[D+1]))==128&&(192&V)==128&&(192&K)==128&&((ie=(15&Q)<<18|(63&k)<<12|(63&V)<<6|63&K)<=65535||ie>=1114112)&&(ie=null)),ie===null?(ie=65533,fe=1):ie>65535&&(ie-=65536,I+=String.fromCharCode(ie>>>10&1023|55296),ie=56320|1023&ie),I+=String.fromCharCode(ie),D+=fe}return I}(this.buf,u,a)},readBytes:function(){var a=this.readVarint()+this.pos,u=this.buf.subarray(this.pos,a);return this.pos=a,u},readPackedVarint:function(a,u){if(this.type!==Xn.Bytes)return a.push(this.readVarint(u));var p=Ll(this);for(a=a||[];this.pos<p;)a.push(this.readVarint(u));return a}
vendor: 13,023 bytes, line 2102
2102,readPackedSVarint:function(a){if(this.type!==Xn.Bytes)return a.push(this.readSVarint());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readSVarint());return a},readPackedBoolean:function(a){if(this.type!==Xn.Bytes)return a.push(this.readBoolean());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readBoolean());return a},readPackedFloat:function(a){if(this.type!==Xn.Bytes)return a.push(this.readFloat());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readFloat());return a},readPackedDouble:function(a){if(this.type!==Xn.Bytes)return a.push(this.readDouble());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readDouble());return a},readPackedFixed32:function(a){if(this.type!==Xn.Bytes)return a.push(this.readFixed32());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readFixed32());return a},readPackedSFixed32:function(a){if(this.type!==Xn.Bytes)return a.push(this.readSFixed32());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readSFixed32());return a},readPackedFixed64:function(a){if(this.type!==Xn.Bytes)return a.push(this.readFixed64());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readFixed64());return a},readPackedSFixed64:function(a){if(this.type!==Xn.Bytes)return a.push(this.readSFixed64());var u=Ll(this);for(a=a||[];this.pos<u;)a.push(this.readSFixed64());return a},skip:function(a){var u=7&a;if(u===Xn.Varint)for(;this.buf[this.pos++]>127;);else if(u===Xn.Bytes)this.pos=this.readVarint()+this.pos;else if(u===Xn.Fixed32)this.pos+=4;else{if(u!==Xn.Fixed64)throw new Error("Unimplemented type: "+u);this.pos+=8}},writeTag:function(a,u){this.writeVarint(a<<3|u)},realloc:function(a){for(var u=this.length||16;u<this.pos+a;)u*=2;if(u!==this.length){var p=new Uint8Array(u);p.set(this.buf),this.buf=p,this.length=u}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(a){this.realloc(4),Kh(this.buf,a,this.pos),this.pos+=4},writeSFixed32:function(a){this.realloc(4),Kh(this.buf,a,this.pos),this.pos+=4},writeFixed64:function(a){this.realloc(8),Kh(this.buf,-1&a,this.pos),Kh(this.buf,Math.floor(a*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(a){this.realloc(8),Kh(this.buf,-1&a,this.pos),Kh(this.buf,Math.floor(a*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(a){(a=+a||0)>268435455||a<0?function(u,p){var x,E;if(u>=0?(x=u%4294967296|0,E=u/4294967296|0):(E=~(-u/4294967296),4294967295^(x=~(-u%4294967296))?x=x+1|0:(x=0,E=E+1|0)),u>=18446744073709552e3||u<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");p.realloc(10),function(I,D,k){k.buf[k.pos++]=127&I|128,I>>>=7,k.buf[k.pos++]=127&I|128,I>>>=7,k.buf[k.pos++]=127&I|128,I>>>=7,k.buf[k.pos++]=127&I|128,k.buf[k.pos]=127&(I>>>=7)}(x,0,p),function(I,D){var k=(7&I)<<4;D.buf[D.pos++]|=k|((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)))))}(E,p)}(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(!!a)},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var u=this.pos;this.pos=function(x,E,I){for(var D,k,V=0;V<E.length;V++){if((D=E.charCodeAt(V))>55295&&D<57344){if(!k){D>56319||V+1===E.length?(x[I++]=239,x[I++]=191,x[I++]=189):k=D;continue}if(D<56320){x[I++]=239,x[I++]=191,x[I++]=189,k=D;continue}D=k-55296<<10|D-56320|65536,k=null}else k&&(x[I++]=239,x[I++]=191,x[I++]=189,k=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 p=this.pos-u;p>=128&&hE(u,p,this),this.pos=u-1,this.writeVarint(p),this.pos+=p},writeFloat:function(a){this.realloc(4),uE(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),uE(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(a){var u=a.length;this.writeVarint(u),this.realloc(u);for(var p=0;p<u;p++)this.buf[this.pos++]=a[p]},writeRawMessage:function(a,u){this.pos++;var p=this.pos;a(u,this);var x=this.pos-p;x>=128&&hE(p,x,this),this.pos=p-1,this.writeVarint(x),this.pos+=x},writeMessage:function(a,u,p){this.writeTag(a,Xn.Bytes),this.writeRawMessage(u,p)},writePackedVarint:function(a,u){u.length&&this.writeMessage(a,m9,u)},writePackedSVarint:function(a,u){u.length&&this.writeMessage(a,_9,u)},writePackedBoolean:function(a,u){u.length&&this.writeMessage(a,b9,u)},writePackedFloat:function(a,u){u.length&&this.writeMessage(a,y9,u)},writePackedDouble:function(a,u){u.length&&this.writeMessage(a,v9,u)},writePackedFixed32:function(a,u){u.length&&this.writeMessage(a,x9,u)},writePackedSFixed32:function(a,u){u.length&&this.writeMessage(a,w9,u)},writePackedFixed64:function(a,u){u.length&&this.writeMessage(a,C9,u)},writePackedSFixed64:function(a,u){u.length&&this.writeMessage(a,T9,u)},writeBytesField:function(a,u){this.writeTag(a,Xn.Bytes),this.writeBytes(u)},writeFixed32Field:function(a,u){this.writeTag(a,Xn.Fixed32),this.writeFixed32(u)},writeSFixed32Field:function(a,u){this.writeTag(a,Xn.Fixed32),this.writeSFixed32(u)},writeFixed64Field:function(a,u){this.writeTag(a,Xn.Fixed64),this.writeFixed64(u)},writeSFixed64Field:function(a,u){this.writeTag(a,Xn.Fixed64),this.writeSFixed64(u)},writeVarintField:function(a,u){this.writeTag(a,Xn.Varint),this.writeVarint(u)},writeSVarintField:function(a,u){this.writeTag(a,Xn.Varint),this.writeSVarint(u)},writeStringField:function(a,u){this.writeTag(a,Xn.Bytes),this.writeString(u)},writeFloatField:function(a,u){this.writeTag(a,Xn.Fixed32),this.writeFloat(u)},writeDoubleField:function(a,u){this.writeTag(a,Xn.Fixed64),this.writeDouble(u)},writeBooleanField:function(a,u){this.writeVarintField(a,!!u)}};var lm=function(a,u){var p=u.pixelRatio,x=u.version,E=u.stretchX,I=u.stretchY,D=u.content;this.paddedRect=a,this.pixelRatio=p,this.stretchX=E,this.stretchY=I,this.content=D,this.version=x},dA={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};dA.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},dA.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},dA.tlbr.get=function(){return this.tl.concat(this.br)},dA.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(lm.prototype,dA);var pA=function(a,u){var p={},x={};this.haveRenderCallbacks=[];var E=[];this.addImages(a,p,E),this.addImages(u,x,E);var I=pE(E),D=new co({width:I.w||1,height:I.h||1});for(var k in a){var V=a[k],K=p[k].paddedRect;co.copy(V.data,D,{x:0,y:0},{x:K.x+1,y:K.y+1},V.data)}for(var Q in u){var ie=u[Q],fe=x[Q].paddedRect,ye=fe.x+1,ke=fe.y+1,Ne=ie.data.width,je=ie.data.height;co.copy(ie.data,D,{x:0,y:0},{x:ye,y:ke},ie.data),co.copy(ie.data,D,{x:0,y:je-1},{x:ye,y:ke-1},{width:Ne,height:1}),co.copy(ie.data,D,{x:0,y:0},{x:ye,y:ke+je},{width:Ne,height:1}),co.copy(ie.data,D,{x:Ne-1,y:0},{x:ye-1,y:ke},{width:1,height:je}),co.copy(ie.data,D,{x:0,y:0},{x:ye+Ne,y:ke},{width:1,height:je})}this.image=D,this.iconPositions=p,this.patternPositions=x};pA.prototype.addImages=function(a,u,p){for(var x in a){var E=a[x],I={x:0,y:0,w:E.data.width+2,h:E.data.height+2};p.push(I),u[x]=new lm(I,E),E.hasRenderCallback&&this.haveRenderCallbacks.push(x)}},pA.prototype.patchUpdatedImages=function(a,u){for(var p in a.dispatchRenderCallbacks(this.haveRenderCallbacks),a.updatedImages)this.patchUpdatedImage(this.iconPositions[p],a.getImage(p),u),this.patchUpdatedImage(this.patternPositions[p],a.getImage(p),u)},pA.prototype.patchUpdatedImage=function(a,u,p){if(a&&u&&a.version!==u.version){a.version=u.version;var x=a.tl;p.update(u.data,void 0,{x:x[0],y:x[1]})}},or("ImagePosition",lm),or("ImageAtlas",pA);var ko={horizontal:1,vertical:2,horizontalOnly:3},qh=function(){this.scale=1,this.fontStack="",this.imageName=null};qh.forText=function(a,u){var p=new qh;return p.scale=a||1,p.fontStack=u,p},qh.forImage=function(a){var u=new qh;return u.imageName=a,u};var Rs=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function um(a,u,p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne){var je,Ve=Rs.fromFeature(a,E);ie===ko.vertical&&Ve.verticalizePunctuation();var qe=is.processBidirectionalText,ct=is.processStyledBidirectionalText;if(qe&&Ve.sections.length===1){je=[];for(var mt=0,yt=qe(Ve.toString(),mv(Ve,K,I,u,x,ye,ke));mt<yt.length;mt+=1){var Ft=yt[mt],jt=new Rs;jt.text=Ft,jt.sections=Ve.sections;for(var qt=0;qt<Ft.length;qt++)jt.sectionIndex.push(0);je.push(jt)}}else if(ct){je=[];for(var br=0,nr=ct(Ve.text,Ve.sectionIndex,mv(Ve,K,I,u,x,ye,ke));br<nr.length;br+=1){var Br=nr[br],ir=new Rs;ir.text=Br[0],ir.sectionIndex=Br[1],ir.sections=Ve.sections,je.push(ir)}}else je=function(hr,hn){for(var qr=[],bn=hr.text,Sr=0,Cn=0,ni=hn;Cn<ni.length;Cn+=1){var Bi=ni[Cn];qr.push(hr.substring(Sr,Bi)),Sr=Bi}return Sr<bn.length&&qr.push(hr.substring(Sr,bn.length)),qr}(Ve,mv(Ve,K,I,u,x,ye,ke));var sn=[],Lr={positionedLines:sn,text:Ve.toString(),top:Q[1],bottom:Q[1],left:Q[0],right:Q[0],writingMode:ie,iconsInText:!1,verticalizable:!1};return function(hr,hn,qr,bn,Sr,Cn,ni,Bi,xi,ii,Si,Zi){for(var Qi=0,Fs=-17,ls=0,Ds=0,Pi=Bi==="right"?1:Bi==="left"?0:.5,us=0,gn=0,Nn=Sr;gn<Nn.length;gn+=1){var Mn=Nn[gn];Mn.trim();var wn=Mn.getMaxScale(),Xs=24*(wn-1),bs={positionedGlyphs:[],lineOffset:0};hr.positionedLines[us]=bs;var Qn=bs.positionedGlyphs,Ni=0;if(Mn.length()){for(var xs=0;xs<Mn.length();xs++){var Tn=Mn.getSection(xs),Jc=Mn.getSectionIndex(xs),No=Mn.getCharCode(xs),Xc=0,Ri=null,Kc=null,Ra=null,id=24,kf=!(xi===ko.horizontal||!Si&&!bu(No)||Si&&(fm[No]||(zl=No,Yt.Arabic(zl)||Yt["Arabic Supplement"](zl)||Yt["Arabic Extended-A"](zl)||Yt["Arabic Presentation Forms-A"](zl)||Yt["Arabic Presentation Forms-B"](zl))));if(Tn.imageName){var sd=bn[Tn.imageName];if(!sd)continue;Ra=Tn.imageName,hr.iconsInText=hr.iconsInText||!0,Kc=sd.paddedRect;var Ul=sd.displaySize;Tn.scale=24*Tn.scale/Zi,Xc=Xs+(24-Ul[1]*Tn.scale),id=(Ri={width:Ul[0],height:Ul[1],left:1,top:-3,advance:kf?Ul[1]:Ul[0]}).advance;var od=kf?Ul[0]*Tn.scale-24*wn:Ul[1]*Tn.scale-24*wn;od>0&&od>Ni&&(Ni=od)}else{var vm=qr[Tn.fontStack],ad=vm&&vm[No];if(ad&&ad.rect)Kc=ad.rect,Ri=ad.metrics;else{var mA=hn[Tn.fontStack],bm=mA&&mA[No];if(!bm)continue;Ri=bm.metrics}Xc=24*(wn-Tn.scale)}kf?(hr.verticalizable=!0,Qn.push({glyph:No,imageName:Ra,x:Qi,y:Fs+Xc,vertical:kf,scale:Tn.scale,fontStack:Tn.fontStack,sectionIndex:Jc,metrics:Ri,rect:Kc}),Qi+=id*Tn.scale+ii):(Qn.push({glyph:No,imageName:Ra,x:Qi,y:Fs+Xc,vertical:kf,scale:Tn.scale,fontStack:Tn.fontStack,sectionIndex:Jc,metrics:Ri,rect:Kc}),Qi+=Ri.advance*Tn.scale+ii)}Qn.length!==0&&(ls=Math.max(Qi-ii,ls),M9(Qn,0,Qn.length-1,Pi,Ni)),Qi=0;var xm=Cn*wn+Ni;bs.lineOffset=Math.max(Ni,Xs),Fs+=xm,Ds=Math.max(xm,Ds),++us}else Fs+=Cn,++us}var zl,_A=Fs- -17,cd=_v(ni),Pu=cd.horizontalAlign,ld=cd.verticalAlign;(function(wm,Cm,yA,vA,Tm,bA,xA,wA,Em){var ud,Bm=(Cm-yA)*Tm;ud=bA!==xA?-wA*vA- -17:(-vA*Em+.5)*xA;for(var fd=0,CA=wm;fd<CA.length;fd+=1)for(var Nf=0,TA=CA[fd].positionedGlyphs;Nf<TA.length;Nf+=1){var hd=TA[Nf];hd.x+=Bm,hd.y+=ud}})(hr.positionedLines,Pi,Pu,ld,ls,Ds,Cn,_A,Sr.length),hr.top+=-ld*_A,hr.bottom=hr.top+_A,hr.left+=-Pu*ls,hr.right=hr.left+ls}(Lr,u,p,x,je,D,k,V,ie,K,fe,Ne),!function(hr){for(var hn=0,qr=hr;hn<qr.length;hn+=1)if(qr[hn].positionedGlyphs.length!==0)return!1;return!0}(sn)&&Lr}Rs.fromFeature=function(a,u){for(var p=new Rs,x=0;x<a.sections.length;x++){var E=a.sections[x];E.image?p.addImageSection(E):p.addTextSection(E,u)}return p},Rs.prototype.length=function(){return this.text.length},Rs.prototype.getSection=function(a){return this.sections[this.sectionIndex[a]]},Rs.prototype.getSectionIndex=function(a){return this.sectionIndex[a]},Rs.prototype.getCharCode=function(a){return this.text.charCodeAt(a)},Rs.prototype.verticalizePunctuation=function(){this.text=function(a){for(var u="",p=0;p<a.length;p++){var x=a.charCodeAt(p+1)||null,E=a.charCodeAt(p-1)||null;u+=x&&Tf(x)&&!hA[a[p+1]]||E&&Tf(E)&&!hA[a[p-1]]||!hA[a[p]]?a[p]:hA[a[p]]}return u}(this.text)},Rs.prototype.trim=function(){for(var a=0,u=0;u<this.text.length&&fm[this.text.charCodeAt(u)];u++)a++;for(var p=this.text.length,x=this.text.length-1;x>=0&&x>=a&&fm[this.text.charCodeAt(x)];x--)p--;this.text=this.text.substring(a,p),this.sectionIndex=this.sectionIndex.slice(a,p)},Rs.prototype.substring=function(a,u){var p=new Rs;return p.text=this.text.substring(a,u),p.sectionIndex=this.sectionIndex.slice(a,u),p.sections=this.sections,p},Rs.prototype.toString=function(){return this.text},Rs.prototype.getMaxScale=function(){var a=this;return this.sectionIndex.reduce(function(u,p){return Math.max(u,a.sections[p].scale)}
2102,0)},Rs.prototype.addTextSection=function(a,u){this.text+=a.text,this.sections.push(qh.forText(a.scale,a.fontStack||u));for(var p=this.sections.length-1,x=0;x<a.text.length;++x)this.sectionIndex.push(p)},Rs.prototype.addImageSection=function(a){var u=a.image?a.image.name:"";if(u.length!==0){var p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push(qh.forImage(u)),this.sectionIndex.push(this.sections.length-1)):re("Reached maximum number of images 6401")}else re("Can't add FormattedSection with an empty image.")},Rs.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var fm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},So={};function AE(a,u,p,x,E,I){if(u.imageName){var D=x[u.imageName];return D?D.displaySize[0]*u.scale*24/I+E:0}var k=p[u.fontStack],V=k&&k[a];return V?V.metrics.advance*u.scale+E:0}function gE(a,u,p,x){var E=Math.pow(a-u,2);return x?a<u?E/2:2*E:E+Math.abs(p)*p}function I9(a,u,p){var x=0;return a===10&&(x-=1e4),p&&(x+=150),a!==40&&a!==65288||(x+=50),u!==41&&u!==65289||(x+=50),x}function mE(a,u,p,x,E,I){for(var D=null,k=gE(u,p,E,I),V=0,K=x;V<K.length;V+=1){var Q=K[V],ie=gE(u-Q.x,p,E,I)+Q.badness;ie<=k&&(D=Q,k=ie)}return{index:a,x:u,priorBreak:D,badness:k}}function mv(a,u,p,x,E,I,D){if(I!=="point")return[];if(!a)return[];for(var k,V=[],K=function(je,Ve,qe,ct,mt,yt){for(var Ft=0,jt=0;jt<je.length();jt++){var qt=je.getSection(jt);Ft+=AE(je.getCharCode(jt),qt,ct,mt,Ve,yt)}return Ft/Math.max(1,Math.ceil(Ft/qe))}(a,u,p,x,E,D),Q=a.text.indexOf("​")>=0,ie=0,fe=0;fe<a.length();fe++){var ye=a.getSection(fe),ke=a.getCharCode(fe);if(fm[ke]||(ie+=AE(ke,ye,x,E,u,D)),fe<a.length()-1){var Ne=!((k=ke)<11904||!(Yt["Bopomofo Extended"](k)||Yt.Bopomofo(k)||Yt["CJK Compatibility Forms"](k)||Yt["CJK Compatibility Ideographs"](k)||Yt["CJK Compatibility"](k)||Yt["CJK Radicals Supplement"](k)||Yt["CJK Strokes"](k)||Yt["CJK Symbols and Punctuation"](k)||Yt["CJK Unified Ideographs Extension A"](k)||Yt["CJK Unified Ideographs"](k)||Yt["Enclosed CJK Letters and Months"](k)||Yt["Halfwidth and Fullwidth Forms"](k)||Yt.Hiragana(k)||Yt["Ideographic Description Characters"](k)||Yt["Kangxi Radicals"](k)||Yt["Katakana Phonetic Extensions"](k)||Yt.Katakana(k)||Yt["Vertical Forms"](k)||Yt["Yi Radicals"](k)||Yt["Yi Syllables"](k)));(So[ke]||Ne||ye.imageName)&&V.push(mE(fe+1,ie,K,V,I9(ke,a.getCharCode(fe+1),Ne&&Q),!1))}}return function je(Ve){return Ve?je(Ve.priorBreak).concat(Ve.index):[]}(mE(a.length(),ie,K,V,0,!0))}function _v(a){var u=.5,p=.5;switch(a){case"right":case"top-right":case"bottom-right":u=1;break;case"left":case"top-left":case"bottom-left":u=0}switch(a){case"bottom":case"bottom-right":case"bottom-left":p=1;break;case"top":case"top-right":case"top-left":p=0}return{horizontalAlign:u,verticalAlign:p}}function M9(a,u,p,x,E){if(x||E)for(var I=a[p],D=(a[p].x+I.metrics.advance*I.scale)*x,k=u;k<=p;k++)a[k].x-=D,a[k].y+=E}function _E(a,u,p,x,E,I){var D,k=a.image;if(k.content){var V=k.content,K=k.pixelRatio||1;D=[V[0]/K,V[1]/K,k.displaySize[0]-V[2]/K,k.displaySize[1]-V[3]/K]}var Q,ie,fe,ye,ke=u.left*I,Ne=u.right*I;p==="width"||p==="both"?(ye=E[0]+ke-x[3],ie=E[0]+Ne+x[1]):ie=(ye=E[0]+(ke+Ne-k.displaySize[0])/2)+k.displaySize[0];var je=u.top*I,Ve=u.bottom*I;return p==="height"||p==="both"?(Q=E[1]+je-x[0],fe=E[1]+Ve+x[2]):fe=(Q=E[1]+(je+Ve-k.displaySize[1])/2)+k.displaySize[1],{image:k,top:Q,right:ie,bottom:fe,left:ye,collisionPadding:D}}So[10]=!0,So[32]=!0,So[38]=!0,So[40]=!0,So[41]=!0,So[43]=!0,So[45]=!0,So[47]=!0,So[173]=!0,So[183]=!0,So[8203]=!0,So[8208]=!0,So[8211]=!0,So[8231]=!0;var Yh=function(a){function u(p,x,E,I){a.call(this,p,x),this.angle=E,I!==void 0&&(this.segment=I)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.clone=function(){return new u(this.x,this.y,this.angle,this.segment)},u}(v);function yv(a,u){var p=u.expression;if(p.kind==="constant")return{kind:"constant",layoutSize:p.evaluate(new Hr(a+1))};if(p.kind==="source")return{kind:"source"};for(var x=p.zoomStops,E=p.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 k=x[I],V=x[D];return p.kind==="composite"?{kind:"composite",minZoom:k,maxZoom:V,interpolationType:E}:{kind:"camera",minZoom:k,maxZoom:V,minSize:p.evaluate(new Hr(k)),maxSize:p.evaluate(new Hr(V)),interpolationType:E}}function yE(a,u,p){var x=u.uSize,E=p.lowerSize;return a.kind==="source"?E/128:a.kind==="composite"?hi(E/128,p.upperSize/128,u.uSizeT):x}function vE(a,u){var p=0,x=0;if(a.kind==="constant")x=a.layoutSize;else if(a.kind!=="source"){var E=a.interpolationType,I=E?$(zi.interpolationFactor(E,u,a.minZoom,a.maxZoom),0,1):0;a.kind==="camera"?x=hi(a.minSize,a.maxSize,I):p=I}return{uSizeT:p,uSize:x}}or("Anchor",Yh);var P9=Object.freeze({__proto__:null,getSizeData:yv,evaluateSizeForFeature:yE,evaluateSizeForZoom:vE,SIZE_PACK_FACTOR:128});function bE(a,u,p,x,E){if(u.segment===void 0)return!0;for(var I=u,D=u.segment+1,k=0;k>-p/2;){if(--D<0)return!1;k-=a[D].dist(I),I=a[D]}k+=a[D].dist(a[D+1]),D++;for(var V=[],K=0;k<p/2;){var Q=a[D],ie=a[D+1];if(!ie)return!1;var fe=a[D-1].angleTo(Q)-Q.angleTo(ie);for(fe=Math.abs((fe+3*Math.PI)%(2*Math.PI)-Math.PI),V.push({distance:k,angleDelta:fe}),K+=fe;k-V[0].distance>x;)K-=V.shift().angleDelta;if(K>E)return!1;D++,k+=Q.dist(ie)}return!0}function xE(a){for(var u=0,p=0;p<a.length-1;p++)u+=a[p].dist(a[p+1]);return u}function wE(a,u,p){return a?.6*u*p:0}function CE(a,u){return Math.max(a?a.right-a.left:0,u?u.right-u.left:0)}function R9(a,u,p,x,E,I){for(var D=wE(p,E,I),k=CE(p,x)*I,V=0,K=xE(a)/2,Q=0;Q<a.length-1;Q++){var ie=a[Q],fe=a[Q+1],ye=ie.dist(fe);if(V+ye>K){var ke=(K-V)/ye,Ne=hi(ie.x,fe.x,ke),je=hi(ie.y,fe.y,ke),Ve=new Yh(Ne,je,fe.angleTo(ie),Q);return Ve._round(),!D||bE(a,Ve,k,D,u)?Ve:void 0}V+=ye}}function F9(a,u,p,x,E,I,D,k,V){var K=wE(x,I,D),Q=CE(x,E),ie=Q*D,fe=a[0].x===0||a[0].x===V||a[0].y===0||a[0].y===V;return u-ie<u/4&&(u=ie+u/4),function ye(ke,Ne,je,Ve,qe,ct,mt,yt,Ft){for(var jt=ct/2,qt=xE(ke),br=0,nr=Ne-je,Br=[],ir=0;ir<ke.length-1;ir++){for(var sn=ke[ir],Lr=ke[ir+1],hr=sn.dist(Lr),hn=Lr.angleTo(sn);nr+je<br+hr;){var qr=((nr+=je)-br)/hr,bn=hi(sn.x,Lr.x,qr),Sr=hi(sn.y,Lr.y,qr);if(bn>=0&&bn<Ft&&Sr>=0&&Sr<Ft&&nr-jt>
vendor: 9,264 bytes, line 2102
2102=0&&nr+jt<=qt){var Cn=new Yh(bn,Sr,hn,ir);Cn._round(),Ve&&!bE(ke,Cn,ct,Ve,qe)||Br.push(Cn)}}br+=hr}return yt||Br.length||mt||(Br=ye(ke,br/2,je,Ve,qe,ct,mt,!0,Ft)),Br}(a,fe?u/2*k%u:(Q/2+2*I)*D*k%u,u,K,p,ie,fe,!1,V)}function TE(a,u,p,x,E){for(var I=[],D=0;D<a.length;D++)for(var k=a[D],V=void 0,K=0;K<k.length-1;K++){var Q=k[K],ie=k[K+1];Q.x<u&&ie.x<u||(Q.x<u?Q=new v(u,Q.y+(u-Q.x)/(ie.x-Q.x)*(ie.y-Q.y))._round():ie.x<u&&(ie=new v(u,Q.y+(u-Q.x)/(ie.x-Q.x)*(ie.y-Q.y))._round()),Q.y<p&&ie.y<p||(Q.y<p?Q=new v(Q.x+(p-Q.y)/(ie.y-Q.y)*(ie.x-Q.x),p)._round():ie.y<p&&(ie=new v(Q.x+(p-Q.y)/(ie.y-Q.y)*(ie.x-Q.x),p)._round()),Q.x>=x&&ie.x>=x||(Q.x>=x?Q=new v(x,Q.y+(x-Q.x)/(ie.x-Q.x)*(ie.y-Q.y))._round():ie.x>=x&&(ie=new v(x,Q.y+(x-Q.x)/(ie.x-Q.x)*(ie.y-Q.y))._round()),Q.y>=E&&ie.y>=E||(Q.y>=E?Q=new v(Q.x+(E-Q.y)/(ie.y-Q.y)*(ie.x-Q.x),E)._round():ie.y>=E&&(ie=new v(Q.x+(E-Q.y)/(ie.y-Q.y)*(ie.x-Q.x),E)._round()),V&&Q.equals(V[V.length-1])||I.push(V=[Q]),V.push(ie)))))}return I}function EE(a,u,p,x){var E=[],I=a.image,D=I.pixelRatio,k=I.paddedRect.w-2,V=I.paddedRect.h-2,K=a.right-a.left,Q=a.bottom-a.top,ie=I.stretchX||[[0,k]],fe=I.stretchY||[[0,V]],ye=function(bn,Sr){return bn+Sr[1]-Sr[0]},ke=ie.reduce(ye,0),Ne=fe.reduce(ye,0),je=k-ke,Ve=V-Ne,qe=0,ct=ke,mt=0,yt=Ne,Ft=0,jt=je,qt=0,br=Ve;if(I.content&&x){var nr=I.content;qe=hm(ie,0,nr[0]),mt=hm(fe,0,nr[1]),ct=hm(ie,nr[0],nr[2]),yt=hm(fe,nr[1],nr[3]),Ft=nr[0]-qe,qt=nr[1]-mt,jt=nr[2]-nr[0]-ct,br=nr[3]-nr[1]-yt}var Br=function(bn,Sr,Cn,ni){var Bi=dm(bn.stretch-qe,ct,K,a.left),xi=pm(bn.fixed-Ft,jt,bn.stretch,ke),ii=dm(Sr.stretch-mt,yt,Q,a.top),Si=pm(Sr.fixed-qt,br,Sr.stretch,Ne),Zi=dm(Cn.stretch-qe,ct,K,a.left),Qi=pm(Cn.fixed-Ft,jt,Cn.stretch,ke),Fs=dm(ni.stretch-mt,yt,Q,a.top),ls=pm(ni.fixed-qt,br,ni.stretch,Ne),Ds=new v(Bi,ii),Pi=new v(Zi,ii),us=new v(Zi,Fs),gn=new v(Bi,Fs),Nn=new v(xi/D,Si/D),Mn=new v(Qi/D,ls/D),wn=u*Math.PI/180;if(wn){var Xs=Math.sin(wn),bs=Math.cos(wn),Qn=[bs,-Xs,Xs,bs];Ds._matMult(Qn),Pi._matMult(Qn),gn._matMult(Qn),us._matMult(Qn)}var Ni=bn.stretch+bn.fixed,xs=Sr.stretch+Sr.fixed;return{tl:Ds,tr:Pi,bl:gn,br:us,tex:{x:I.paddedRect.x+1+Ni,y:I.paddedRect.y+1+xs,w:Cn.stretch+Cn.fixed-Ni,h:ni.stretch+ni.fixed-xs},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Nn,pixelOffsetBR:Mn,minFontScaleX:jt/D/K,minFontScaleY:br/D/Q,isSDF:p}};if(x&&(I.stretchX||I.stretchY))for(var ir=BE(ie,je,ke),sn=BE(fe,Ve,Ne),Lr=0;Lr<ir.length-1;Lr++)for(var hr=ir[Lr],hn=ir[Lr+1],qr=0;qr<sn.length-1;qr++)E.push(Br(hr,sn[qr],hn,sn[qr+1]));else E.push(Br({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:k+1},{fixed:0,stretch:V+1}));return E}function hm(a,u,p){for(var x=0,E=0,I=a;E<I.length;E+=1){var D=I[E];x+=Math.max(u,Math.min(p,D[1]))-Math.max(u,Math.min(p,D[0]))}return x}function BE(a,u,p){for(var x=[{fixed:-1,stretch:0}],E=0,I=a;E<I.length;E+=1){var D=I[E],k=D[0],V=D[1],K=x[x.length-1];x.push({fixed:k-K.stretch,stretch:K.stretch}),x.push({fixed:k-K.stretch,stretch:K.stretch+(V-k)})}return x.push({fixed:u+1,stretch:p}),x}function dm(a,u,p,x){return a/u*p+x}function pm(a,u,p,x){return a-u*p/x}var Am=function(a,u,p,x,E,I,D,k,V,K){if(this.boxStartIndex=a.length,V){var Q=I.top,ie=I.bottom,fe=I.collisionPadding;fe&&(Q-=fe[1],ie+=fe[3]);var ye=ie-Q;ye>0&&(ye=Math.max(10,ye),this.circleDiameter=ye)}else{var ke=I.top*D-k,Ne=I.bottom*D+k,je=I.left*D-k,Ve=I.right*D+k,qe=I.collisionPadding;if(qe&&(je-=qe[0]*D,ke-=qe[1]*D,Ve+=qe[2]*D,Ne+=qe[3]*D),K){var ct=new v(je,ke),mt=new v(Ve,ke),yt=new v(je,Ne),Ft=new v(Ve,Ne),jt=K*Math.PI/180;ct._rotate(jt),mt._rotate(jt),yt._rotate(jt),Ft._rotate(jt),je=Math.min(ct.x,mt.x,yt.x,Ft.x),Ve=Math.max(ct.x,mt.x,yt.x,Ft.x),ke=Math.min(ct.y,mt.y,yt.y,Ft.y),Ne=Math.max(ct.y,mt.y,yt.y,Ft.y)}a.emplaceBack(u.x,u.y,je,ke,Ve,Ne,p,x,E)}this.boxEndIndex=a.length},Zh=function(a,u){if(a===void 0&&(a=[]),u===void 0&&(u=D9),this.data=a,this.length=this.data.length,this.compare=u,this.length>0)for(var p=(this.length>>1)-1;p>=0;p--)this._down(p)};function D9(a,u){return a<u?-1:a>u?1:0}function O9(a,u,p){p===void 0&&(p=!1);for(var x=1/0,E=1/0,I=-1/0,D=-1/0,k=a[0],V=0;V<k.length;V++){var K=k[V];(!V||K.x<x)&&(x=K.x),(!V||K.y<E)&&(E=K.y),(!V||K.x>I)&&(I=K.x),(!V||K.y>D)&&(D=K.y)}var Q=Math.min(I-x,D-E),ie=Q/2,fe=new Zh([],L9);if(Q===0)return new v(x,E);for(var ye=x;ye<I;ye+=Q)for(var ke=E;ke<D;ke+=Q)fe.push(new Qh(ye+ie,ke+ie,ie,a));for(var Ne=function(qe){for(var ct=0,mt=0,yt=0,Ft=qe[0],jt=0,qt=Ft.length,br=qt-1;jt<qt;br=jt++){var nr=Ft[jt],Br=Ft[br],ir=nr.x*Br.y-Br.x*nr.y;mt+=(nr.x+Br.x)*ir,yt+=(nr.y+Br.y)*ir,ct+=3*ir}return new Qh(mt/ct,yt/ct,0,qe)}(a),je=fe.length;fe.length;){var Ve=fe.pop();(Ve.d>Ne.d||!Ne.d)&&(Ne=Ve,p&&console.log("found best %d after %d probes",Math.round(1e4*Ve.d)/1e4,je)),Ve.max-Ne.d<=u||(fe.push(new Qh(Ve.p.x-(ie=Ve.h/2),Ve.p.y-ie,ie,a)),fe.push(new Qh(Ve.p.x+ie,Ve.p.y-ie,ie,a)),fe.push(new Qh(Ve.p.x-ie,Ve.p.y+ie,ie,a)),fe.push(new Qh(Ve.p.x+ie,Ve.p.y+ie,ie,a)),je+=4)}return p&&(console.log("num probes: "+je),console.log("best distance: "+Ne.d)),Ne.p}function L9(a,u){return u.max-a.max}function Qh(a,u,p,x){this.p=new v(a,u),this.h=p,this.d=function(E,I){for(var D=!1,k=1/0,V=0;V<I.length;V++)for(var K=I[V],Q=0,ie=K.length,fe=ie-1;Q<ie;fe=Q++){var ye=K[Q],ke=K[fe];ye.y>E.y!=ke.y>E.y&&E.x<(ke.x-ye.x)*(E.y-ye.y)/(ke.y-ye.y)+ye.x&&(D=!D),k=Math.min(k,Bu(E,ye,ke))}return(D?1:-1)*Math.sqrt(k)}(this.p,x),this.max=this.d+this.h*Math.SQRT2}Zh.prototype.push=function(a){this.data.push(a),this.length++,this._up(this.length-1)},Zh.prototype.pop=function(){if(this.length!==0){var a=this.data[0],u=this.data.pop();return this.length--,this.length>0&&(this.data[0]=u,this._down(0)),a}},Zh.prototype.peek=function(){return this.data[0]},Zh.prototype._up=function(a){for(var u=this.data,p=this.compare,x=u[a];a>0;){var E=a-1>>1,I=u[E];if(p(x,I)>=0)break;u[a]=I,a=E}u[a]=x},Zh.prototype._down=function(a){for(var u=this.data,p=this.compare,x=this.length>>1,E=u[a];a<x;){var I=1+(a<<1),D=u[I],k=I+1;if(k<this.length&&p(u[k],D)<0&&(I=k,D=u[k]),p(D,E)>=0)break;u[a]=D,a=I}u[a]=E};var vv=Number.POSITIVE_INFINITY;function SE(a,u){return u[1]!==vv?function(p,x,E){var I=0,D=0;switch(x=Math.abs(x),E=Math.abs(E),p){case"top-right":case"top-left":case"top":D=E-7;break;case"bottom-right":case"bottom-left":case"bottom":D=7-E}switch(p){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,u[0],u[1]):function(p,x){var E=0,I=0;x<0&&(x=0);var D=x/Math.sqrt(2);switch(p){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(p){case"top-right":case"bottom-right":E=-D;break;case"top-left":case"bottom-left":E=D;break;case"left":E=x;break;case"right":E=-x}return[E,I]}(a,u[0])}function bv(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 IE(a,u,p,x,E,I,D,k,V,K,Q,ie,fe,ye,ke){var Ne=function(mt,yt,Ft,jt,qt,br,nr,Br){for(var ir=jt.layout.get("text-rotate").evaluate(br,{})*Math.PI/180,sn=[],Lr=0,hr=yt.positionedLines;Lr<hr.length;Lr+=1)for(var hn=hr[Lr],qr=0,bn=hn.positionedGlyphs;qr<bn.length;qr+=1){var Sr=bn[qr];if(Sr.rect){var Cn=Sr.rect||{},ni=4,Bi=!0,xi=1,ii=0,Si=(qt||Br)&&Sr.vertical,Zi=Sr.metrics.advance*Sr.scale/2;if(Br&&yt.verticalizable&&(ii=hn.lineOffset/2-(Sr.imageName?-(24-Sr.metrics.width*Sr.scale)/2:24*(Sr.scale-1))),Sr.imageName){var Qi=nr[Sr.imageName];Bi=Qi.sdf,ni=1/(xi=Qi.pixelRatio)}var Fs=qt?[Sr.x+Zi,Sr.y]:[0,0],ls=qt?[0,0]:[Sr.x+Zi+Ft[0],Sr.y+Ft[1]-ii],Ds=[0,0];Si&&(Ds=ls,ls=[0,0]);var Pi=(Sr.metrics.left-ni)*Sr.scale-Zi+ls[0],us=(-Sr.metrics.top-ni)*Sr.scale+ls[1],gn=Pi+Cn.w*Sr.scale/xi,Nn=us+Cn.h*Sr.scale/xi,Mn=new v(Pi,us),wn=new v(gn,us),Xs=new v(Pi,Nn),bs=new v(gn,Nn);if(Si){var Qn=new v(-Zi,Zi- -17),Ni=-Math.PI/2,xs=12-Zi,Tn=new v(22-xs,-(Sr.imageName?xs:0)),Jc=new(Function.prototype.bind.apply(v,[null].concat(Ds)));Mn._rotateAround(Ni,Qn)._add(Tn)._add(Jc),wn._rotateAround(Ni,Qn)._add(Tn)._add(Jc),Xs._rotateAround(Ni,Qn)._add(Tn)._add(Jc),bs._rotateAround(Ni,Qn)._add(Tn)._add(Jc)}if(ir){var No=Math.sin(ir),Xc=Math.cos(ir),Ri=[Xc,-No,No,Xc];Mn._matMult(Ri),wn._matMult(Ri),Xs._matMult(Ri),bs._matMult(Ri)}var Kc=new v(0,0),Ra=new v(0,0);sn.push({tl:Mn,tr:wn,bl:Xs,br:bs,tex:Cn,writingMode:yt.writingMode,glyphOffset:Fs,sectionIndex:Sr.sectionIndex,isSDF:Bi,pixelOffsetTL:Kc,pixelOffsetBR:Ra,minFontScaleX:0,minFontScaleY:0})}}return sn}(0,p,k,E,I,D,x,a.allowVerticalPlacement),je=a.textSizeData,Ve=null;je.kind==="source"?(Ve=[128*E.layout.get("text-size").evaluate(D,{})])[0]>32640&&re(a.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):je.kind==="composite"&&((Ve=[128*ye.compositeTextSizes[0].evaluate(D,{},ke),128*ye.compositeTextSizes[1].evaluate(D,{},ke)])[0]>32640||Ve[1]>32640)&&re(a.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),a.addSymbols(a.text,Ne,Ve,k,I,D,K,u,V.lineStartIndex,V.lineLength,fe,ke);for(var qe=0,ct=Q;qe<ct.length;qe+=1)ie[ct[qe]]=a.text.placedSymbolArray.length-1;return 4*Ne.length}function ME(a){for(var u in a)return a[u];return null}function k9(a,u,p,x){var E=a.compareText;if(u in E){for(var I=E[u],D=I.length-1;D>=0;
2102D--)if(x.dist(I[D])<p)return!0}else E[u]=[];return E[u].push(x),!1}var N9=Jh.VectorTileFeature.types,U9=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function gm(a,u,p,x,E,I,D,k,V,K,Q,ie,fe){var ye=k?Math.min(32640,Math.round(k[0])):0,ke=k?Math.min(32640,Math.round(k[1])):0;a.emplaceBack(u,p,Math.round(32*x),Math.round(32*E),I,D,(ye<<1)+(V?1:0),ke,16*K,16*Q,256*ie,256*fe)}function xv(a,u,p){a.emplaceBack(u.x,u.y,p),a.emplaceBack(u.x,u.y,p),a.emplaceBack(u.x,u.y,p),a.emplaceBack(u.x,u.y,p)}function z9(a){for(var u=0,p=a.sections;u<p.length;u+=1)if(xu(p[u].text))return!0;return!1}var ed=function(a){this.layoutVertexArray=new Jt,this.indexArray=new sa,this.programConfigurations=a,this.segments=new Z,this.dynamicLayoutVertexArray=new tr,this.opacityVertexArray=new Hc,this.placedSymbolArray=new m};ed.prototype.isEmpty=function(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0},ed.prototype.upload=function(a,u,p,x){this.isEmpty()||(p&&(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,h9.members),this.indexBuffer=a.createIndexBuffer(this.indexArray,u),this.dynamicLayoutVertexBuffer=a.createVertexBuffer(this.dynamicLayoutVertexArray,d9.members,!0),this.opacityVertexBuffer=a.createVertexBuffer(this.opacityVertexArray,U9,!0),this.opacityVertexBuffer.itemSize=1),(p||x)&&this.programConfigurations.upload(a))},ed.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},or("SymbolBuffers",ed);var AA=function(a,u,p){this.layoutVertexArray=new a,this.layoutAttributes=u,this.indexArray=new p,this.segments=new Z,this.collisionVertexArray=new ia};AA.prototype.upload=function(a){this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=a.createVertexBuffer(this.collisionVertexArray,p9.members,!0)},AA.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},or("CollisionBuffers",AA);var Dn=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=Bo([]),this.placementViewportMatrix=Bo([]);var u=this.layers[0]._unevaluatedLayout._values;this.textSizeData=yv(this.zoom,u["text-size"]),this.iconSizeData=yv(this.zoom,u["icon-size"]);var p=this.layers[0].layout,x=p.get("symbol-sort-key"),E=p.get("symbol-z-order");this.canOverlap=p.get("text-allow-overlap")||p.get("icon-allow-overlap")||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=E!=="viewport-y"&&x.constantOr(1)!==void 0,this.sortFeaturesByY=(E==="viewport-y"||E==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(function(I){return ko[I]})),this.stateDependentLayerIds=this.layers.filter(function(I){return I.isStateDependent()}).map(function(I){return I.id}),this.sourceID=a.sourceID};Dn.prototype.createArrays=function(){this.text=new ed(new Or(this.layers,this.zoom,function(a){return/^text/.test(a)})),this.icon=new ed(new Or(this.layers,this.zoom,function(a){return/^icon/.test(a)})),this.glyphOffsetArray=new R,this.lineVertexArray=new L,this.symbolInstances=new P},Dn.prototype.calculateGlyphDependencies=function(a,u,p,x,E){for(var I=0;I<a.length;I++)if(u[a.charCodeAt(I)]=!0,(p||x)&&E){var D=hA[a.charAt(I)];D&&(u[D.charCodeAt(0)]=!0)}},Dn.prototype.populate=function(a,u,p){var x=this.layers[0],E=x.layout,I=E.get("text-font"),D=E.get("text-field"),k=E.get("icon-image"),V=(D.value.kind!=="constant"||D.value.value instanceof li&&!D.value.value.isEmpty()||D.value.value.toString().length>0)&&(I.value.kind!=="constant"||I.value.value.length>0),K=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,Q=E.get("symbol-sort-key");if(this.features=[],V||K){for(var ie=u.iconDependencies,fe=u.glyphDependencies,ye=u.availableImages,ke=new Hr(this.zoom),Ne=0,je=a;Ne<je.length;Ne+=1){var Ve=je[Ne],qe=Ve.feature,ct=Ve.id,mt=Ve.index,yt=Ve.sourceLayerIndex,Ft=x._featureFilter.needGeometry,jt=Mi(qe,Ft);if(x._featureFilter.filter(ke,jt,p)){Ft||(jt.geometry=bi(qe));var qt=void 0;if(V){var br=x.getValueAndResolveTokens("text-field",jt,p,ye),nr=li.factory(br);z9(nr)&&(this.hasRTLText=!0),(!this.hasRTLText||Bf()==="unavailable"||this.hasRTLText&&is.isParsed())&&(qt=g9(nr,x,jt))}var Br=void 0;if(K){var ir=x.getValueAndResolveTokens("icon-image",jt,p,ye);Br=ir instanceof jn?ir:jn.fromString(ir)}if(qt||Br){var sn=this.sortFeaturesByKey?Q.evaluate(jt,{},p):void 0;if(this.features.push({id:ct,text:qt,icon:Br,index:mt,sourceLayerIndex:yt,geometry:jt.geometry,properties:qe.properties,type:N9[qe.type],sortKey:sn}
2102),Br&&(ie[Br.name]=!0),qt){var Lr=I.evaluate(jt,{},p).join(","),hr=E.get("text-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ko.vertical)>=0;for(var hn=0,qr=qt.sections;hn<qr.length;hn+=1){var bn=qr[hn];if(bn.image)ie[bn.image.name]=!0;else{var Sr=Cf(qt.toString()),Cn=bn.fontStack||Lr,ni=fe[Cn]=fe[Cn]||{};this.calculateGlyphDependencies(bn.text,ni,hr,this.allowVerticalPlacement,Sr)}}}}}}E.get("symbol-placement")==="line"&&(this.features=function(Bi){var xi={},ii={},Si=[],Zi=0;function Qi(Qn){Si.push(Bi[Qn]),Zi++}function Fs(Qn,Ni,xs){var Tn=ii[Qn];return delete ii[Qn],ii[Ni]=Tn,Si[Tn].geometry[0].pop(),Si[Tn].geometry[0]=Si[Tn].geometry[0].concat(xs[0]),Tn}function ls(Qn,Ni,xs){var Tn=xi[Ni];return delete xi[Ni],xi[Qn]=Tn,Si[Tn].geometry[0].shift(),Si[Tn].geometry[0]=xs[0].concat(Si[Tn].geometry[0]),Tn}function Ds(Qn,Ni,xs){var Tn=xs?Ni[0][Ni[0].length-1]:Ni[0][0];return Qn+":"+Tn.x+":"+Tn.y}for(var Pi=0;Pi<Bi.length;Pi++){var us=Bi[Pi],gn=us.geometry,Nn=us.text?us.text.toString():null;if(Nn){var Mn=Ds(Nn,gn),wn=Ds(Nn,gn,!0);if(Mn in ii&&wn in xi&&ii[Mn]!==xi[wn]){var Xs=ls(Mn,wn,gn),bs=Fs(Mn,wn,Si[Xs].geometry);delete xi[Mn],delete ii[wn],ii[Ds(Nn,Si[bs].geometry,!0)]=bs,Si[Xs].geometry=null}
vendor: 12,205 bytes, line 2102
2102else Mn in ii?Fs(Mn,wn,gn):wn in xi?ls(Mn,wn,gn):(Qi(Pi),xi[Mn]=Zi-1,ii[wn]=Zi-1)}else Qi(Pi)}return Si.filter(function(Qn){return Qn.geometry})}(this.features)),this.sortFeaturesByKey&&this.features.sort(function(Bi,xi){return Bi.sortKey-xi.sortKey})}},Dn.prototype.update=function(a,u,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,u,this.layers,p),this.icon.programConfigurations.updatePaintArrays(a,u,this.layers,p))},Dn.prototype.isEmpty=function(){return this.symbolInstances.length===0&&!this.hasRTLText},Dn.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},Dn.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},Dn.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},Dn.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},Dn.prototype.addToLineVertexArray=function(a,u){var p=this.lineVertexArray.length;if(a.segment!==void 0){for(var x=a.dist(u[a.segment+1]),E=a.dist(u[a.segment]),I={},D=a.segment+1;D<u.length;D++)I[D]={x:u[D].x,y:u[D].y,tileUnitDistanceFromAnchor:x},D<u.length-1&&(x+=u[D+1].dist(u[D]));for(var k=a.segment||0;k>=0;k--)I[k]={x:u[k].x,y:u[k].y,tileUnitDistanceFromAnchor:E},k>0&&(E+=u[k-1].dist(u[k]));for(var V=0;V<u.length;V++){var K=I[V];this.lineVertexArray.emplaceBack(K.x,K.y,K.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}},Dn.prototype.addSymbols=function(a,u,p,x,E,I,D,k,V,K,Q,ie){for(var fe=a.indexArray,ye=a.layoutVertexArray,ke=a.segments.prepareSegment(4*u.length,ye,fe,this.canOverlap?I.sortKey:void 0),Ne=this.glyphOffsetArray.length,je=ke.vertexLength,Ve=this.allowVerticalPlacement&&D===ko.vertical?Math.PI/2:0,qe=I.text&&I.text.sections,ct=0;ct<u.length;ct++){var mt=u[ct],yt=mt.tl,Ft=mt.tr,jt=mt.bl,qt=mt.br,br=mt.tex,nr=mt.pixelOffsetTL,Br=mt.pixelOffsetBR,ir=mt.minFontScaleX,sn=mt.minFontScaleY,Lr=mt.glyphOffset,hr=mt.isSDF,hn=mt.sectionIndex,qr=ke.vertexLength,bn=Lr[1];gm(ye,k.x,k.y,yt.x,bn+yt.y,br.x,br.y,p,hr,nr.x,nr.y,ir,sn),gm(ye,k.x,k.y,Ft.x,bn+Ft.y,br.x+br.w,br.y,p,hr,Br.x,nr.y,ir,sn),gm(ye,k.x,k.y,jt.x,bn+jt.y,br.x,br.y+br.h,p,hr,nr.x,Br.y,ir,sn),gm(ye,k.x,k.y,qt.x,bn+qt.y,br.x+br.w,br.y+br.h,p,hr,Br.x,Br.y,ir,sn),xv(a.dynamicLayoutVertexArray,k,Ve),fe.emplaceBack(qr,qr+1,qr+2),fe.emplaceBack(qr+1,qr+2,qr+3),ke.vertexLength+=4,ke.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Lr[0]),ct!==u.length-1&&hn===u[ct+1].sectionIndex||a.programConfigurations.populatePaintArrays(ye.length,I,I.index,{},ie,qe&&qe[hn])}a.placedSymbolArray.emplaceBack(k.x,k.y,Ne,this.glyphOffsetArray.length-Ne,je,V,K,k.segment,p?p[0]:0,p?p[1]:0,x[0],x[1],D,0,!1,0,Q)},Dn.prototype._addCollisionDebugVertex=function(a,u,p,x,E,I){return u.emplaceBack(0,0),a.emplaceBack(p.x,p.y,x,E,Math.round(I.x),Math.round(I.y))},Dn.prototype.addCollisionDebugVertices=function(a,u,p,x,E,I,D){var k=E.segments.prepareSegment(4,E.layoutVertexArray,E.indexArray),V=k.vertexLength,K=E.layoutVertexArray,Q=E.collisionVertexArray,ie=D.anchorX,fe=D.anchorY;this._addCollisionDebugVertex(K,Q,I,ie,fe,new v(a,u)),this._addCollisionDebugVertex(K,Q,I,ie,fe,new v(p,u)),this._addCollisionDebugVertex(K,Q,I,ie,fe,new v(p,x)),this._addCollisionDebugVertex(K,Q,I,ie,fe,new v(a,x)),k.vertexLength+=4;var ye=E.indexArray;ye.emplaceBack(V,V+1),ye.emplaceBack(V+1,V+2),ye.emplaceBack(V+2,V+3),ye.emplaceBack(V+3,V),k.primitiveLength+=4},Dn.prototype.addDebugCollisionBoxes=function(a,u,p,x){for(var E=a;E<u;E++){var I=this.collisionBoxArray.get(E);this.addCollisionDebugVertices(I.x1,I.y1,I.x2,I.y2,x?this.textCollisionBox:this.iconCollisionBox,I.anchorPoint,p)}},Dn.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new AA(na,cE.members,B),this.iconCollisionBox=new AA(na,cE.members,B);for(var a=0;a<this.symbolInstances.length;a++){var u=this.symbolInstances.get(a);this.addDebugCollisionBoxes(u.textBoxStartIndex,u.textBoxEndIndex,u,!0),this.addDebugCollisionBoxes(u.verticalTextBoxStartIndex,u.verticalTextBoxEndIndex,u,!0),this.addDebugCollisionBoxes(u.iconBoxStartIndex,u.iconBoxEndIndex,u,!1),this.addDebugCollisionBoxes(u.verticalIconBoxStartIndex,u.verticalIconBoxEndIndex,u,!1)}},Dn.prototype._deserializeCollisionBoxesForSymbol=function(a,u,p,x,E,I,D,k,V){for(var K={},Q=u;Q<p;Q++){var ie=a.get(Q);K.textBox={x1:ie.x1,y1:ie.y1,x2:ie.x2,y2:ie.y2,anchorPointX:ie.anchorPointX,anchorPointY:ie.anchorPointY},K.textFeatureIndex=ie.featureIndex;break}for(var fe=x;fe<E;fe++){var ye=a.get(fe);K.verticalTextBox={x1:ye.x1,y1:ye.y1,x2:ye.x2,y2:ye.y2,anchorPointX:ye.anchorPointX,anchorPointY:ye.anchorPointY},K.verticalTextFeatureIndex=ye.featureIndex;break}for(var ke=I;ke<D;ke++){var Ne=a.get(ke);K.iconBox={x1:Ne.x1,y1:Ne.y1,x2:Ne.x2,y2:Ne.y2,anchorPointX:Ne.anchorPointX,anchorPointY:Ne.anchorPointY},K.iconFeatureIndex=Ne.featureIndex;break}for(var je=k;je<V;je++){var Ve=a.get(je);K.verticalIconBox={x1:Ve.x1,y1:Ve.y1,x2:Ve.x2,y2:Ve.y2,anchorPointX:Ve.anchorPointX,anchorPointY:Ve.anchorPointY},K.verticalIconFeatureIndex=Ve.featureIndex;break}return K},Dn.prototype.deserializeCollisionBoxes=function(a){this.collisionArrays=[];for(var u=0;u<this.symbolInstances.length;u++){var p=this.symbolInstances.get(u);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(a,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex))}},Dn.prototype.hasTextData=function(){return this.text.segments.get().length>0},Dn.prototype.hasIconData=function(){return this.icon.segments.get().length>0},Dn.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},Dn.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},Dn.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},Dn.prototype.addIndicesForPlacedSymbol=function(a,u){for(var p=a.placedSymbolArray.get(u),x=p.vertexStartIndex+4*p.numGlyphs,E=p.vertexStartIndex;E<x;E+=4)a.indexArray.emplaceBack(E,E+1,E+2),a.indexArray.emplaceBack(E+1,E+2,E+3)},Dn.prototype.getSortedSymbolIndexes=function(a){if(this.sortedAngle===a&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;for(var u=Math.sin(a),p=Math.cos(a),x=[],E=[],I=[],D=0;D<this.symbolInstances.length;++D){I.push(D);var k=this.symbolInstances.get(D);x.push(0|Math.round(u*k.anchorX+p*k.anchorY)),E.push(k.featureIndex)}return I.sort(function(V,K){return x[V]-x[K]||E[K]-E[V]}),I},Dn.prototype.addToSortKeyRanges=function(a,u){var p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===u?p.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:a,symbolInstanceEnd:a+1})},Dn.prototype.sortFeatures=function(a){var u=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 p=0,x=this.symbolInstanceIndexes;p<x.length;p+=1){var E=this.symbolInstances.get(x[p]);this.featureSortOrder.push(E.featureIndex),[E.rightJustifiedTextSymbolIndex,E.centerJustifiedTextSymbolIndex,E.leftJustifiedTextSymbolIndex].forEach(function(I,D,k){I>=0&&k.indexOf(I)===D&&u.addIndicesForPlacedSymbol(u.text,I)}),E.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,E.verticalPlacedTextSymbolIndex),E.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,E.placedIconSymbolIndex),E.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,E.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},or("SymbolBucket",Dn,{omit:["layers","collisionBoxArray","features","compareText"]}),Dn.MAX_GLYPHS=65535,Dn.addDynamicAttributes=xv;var G9=new Jn({"symbol-placement":new wr(ae.layout_symbol["symbol-placement"]),"symbol-spacing":new wr(ae.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new wr(ae.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ur(ae.layout_symbol["symbol-sort-key"]),"symbol-z-order":new wr(ae.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new wr(ae.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new wr(ae.layout_symbol["icon-ignore-placement"]),"icon-optional":new wr(ae.layout_symbol["icon-optional"]),"icon-rotation-alignment":new wr(ae.layout_symbol["icon-rotation-alignment"]),"icon-size":new ur(ae.layout_symbol["icon-size"]),"icon-text-fit":new wr(ae.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new wr(ae.layout_symbol["icon-text-fit-padding"]),"icon-image":new ur(ae.layout_symbol["icon-image"]),"icon-rotate":new ur(ae.layout_symbol["icon-rotate"]),"icon-padding":new wr(ae.layout_symbol["icon-padding"]),"icon-keep-upright":new wr(ae.layout_symbol["icon-keep-upright"]),"icon-offset":new ur(ae.layout_symbol["icon-offset"]),"icon-anchor":new ur(ae.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new wr(ae.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new wr(ae.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new wr(ae.layout_symbol["text-rotation-alignment"]),"text-field":new ur(ae.layout_symbol["text-field"]),"text-font":new ur(ae.layout_symbol["text-font"]),"text-size":new ur(ae.layout_symbol["text-size"]),"text-max-width":new ur(ae.layout_symbol["text-max-width"]),"text-line-height":new wr(ae.layout_symbol["text-line-height"]),"text-letter-spacing":new ur(ae.layout_symbol["text-letter-spacing"]),"text-justify":new ur(ae.layout_symbol["text-justify"]),"text-radial-offset":new ur(ae.layout_symbol["text-radial-offset"]),"text-variable-anchor":new wr(ae.layout_symbol["text-variable-anchor"]),"text-anchor":new ur(ae.layout_symbol["text-anchor"]),"text-max-angle":new wr(ae.layout_symbol["text-max-angle"]),"text-writing-mode":new wr(ae.layout_symbol["text-writing-mode"]),"text-rotate":new ur(ae.layout_symbol["text-rotate"]),"text-padding":new wr(ae.layout_symbol["text-padding"]),"text-keep-upright":new wr(ae.layout_symbol["text-keep-upright"]),"text-transform":new ur(ae.layout_symbol["text-transform"]),"text-offset":new ur(ae.layout_symbol["text-offset"]),"text-allow-overlap":new wr(ae.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new wr(ae.layout_symbol["text-ignore-placement"]),"text-optional":new wr(ae.layout_symbol["text-optional"])}),wv={paint:new Jn({"icon-opacity":new ur(ae.paint_symbol["icon-opacity"]),"icon-color":new ur(ae.paint_symbol["icon-color"]),"icon-halo-color":new ur(ae.paint_symbol["icon-halo-color"]),"icon-halo-width":new ur(ae.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ur(ae.paint_symbol["icon-halo-blur"]),"icon-translate":new wr(ae.paint_symbol["icon-translate"]),"icon-translate-anchor":new wr(ae.paint_symbol["icon-translate-anchor"]),"text-opacity":new ur(ae.paint_symbol["text-opacity"]),"text-color":new ur(ae.paint_symbol["text-color"],{runtimeType:Ht,getOverride:function(a){return a.textColor},hasOverride:function(a){return!!a.textColor}}),"text-halo-color":new ur(ae.paint_symbol["text-halo-color"]),"text-halo-width":new ur(ae.paint_symbol["text-halo-width"]),"text-halo-blur":new ur(ae.paint_symbol["text-halo-blur"]),"text-translate":new wr(ae.paint_symbol["text-translate"]),"text-translate-anchor":new wr(ae.paint_symbol["text-translate-anchor"])}),layout:G9},td=function(a){this.type=a.property.overrides?a.property.overrides.runtimeType:Ot,this.defaultValue=a};
2102td.prototype.evaluate=function(a){if(a.formattedSection){var u=this.defaultValue.property.overrides;if(u&&u.hasOverride(a.formattedSection))return u.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default},td.prototype.eachChild=function(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)},td.prototype.outputDefined=function(){return!1},td.prototype.serialize=function(){return null},or("FormatSectionOverride",td,{omit:["defaultValue"]});var V9=function(a){function u(p){a.call(this,p,wv)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.recalculate=function(p,x){if(a.prototype.recalculate.call(this,p,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 E=this.layout.get("text-writing-mode");if(E){for(var I=[],D=0,k=E;D<k.length;D+=1){var V=k[D];I.indexOf(V)<0&&I.push(V)}this.layout._values["text-writing-mode"]=I}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},u.prototype.getValueAndResolveTokens=function(p,x,E,I){var D=this.layout.get(p).evaluate(x,{},E,I),k=this._unevaluatedLayout._values[p];return k.isDataDriven()||wo(k.value)||!D?D:function(V,K){return K.replace(/{([^{}]+)}/g,function(Q,ie){return ie in V?String(V[ie]):""})}(x.properties,D)},u.prototype.createBucket=function(p){return new Dn(p)},u.prototype.queryRadius=function(){return 0},u.prototype.queryIntersectsFeature=function(){return!1},u.prototype._setPaintOverrides=function(){for(var p=0,x=wv.paint.overridableProperties;p<x.length;p+=1){var E=x[p];if(u.hasPaintOverride(this.layout,E)){var I,D=this.paint.get(E),k=new td(D),V=new Sa(k,D.property.specification);I=D.value.kind==="constant"||D.value.kind==="source"?new Za("source",V):new Dc("composite",V,D.value.zoomStops,D.value._interpolationType),this.paint._values[E]=new ss(D.property,I,D.parameters)}}},u.prototype._handleOverridablePaintPropertyUpdate=function(p,x,E){return!(!this.layout||x.isDataDriven()||E.isDataDriven())&&u.hasPaintOverride(this.layout,p)},u.hasPaintOverride=function(p,x){var E=p.get("text-field"),I=wv.paint.properties[x],D=!1,k=function(Q){for(var ie=0,fe=Q;ie<fe.length;ie+=1)if(I.overrides&&I.overrides.hasOverride(fe[ie]))return void(D=!0)};if(E.value.kind==="constant"&&E.value.value instanceof li)k(E.value.value.sections);else if(E.value.kind==="source"){var V=function(Q){D||(Q instanceof Oi&&$n(Q.value)===cn?k(Q.value.sections):Q instanceof ms?k(Q.sections):Q.eachChild(V))},K=E.value;K._styleExpression&&V(K._styleExpression.expression)}return D},u}(zr),H9={paint:new Jn({"background-color":new wr(ae.paint_background["background-color"]),"background-pattern":new fs(ae.paint_background["background-pattern"]),"background-opacity":new wr(ae.paint_background["background-opacity"])})},j9=function(a){function u(p){a.call(this,p,H9)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u}(zr),$9={paint:new Jn({"raster-opacity":new wr(ae.paint_raster["raster-opacity"]),"raster-hue-rotate":new wr(ae.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new wr(ae.paint_raster["raster-brightness-min"]),"raster-brightness-max":new wr(ae.paint_raster["raster-brightness-max"]),"raster-saturation":new wr(ae.paint_raster["raster-saturation"]),"raster-contrast":new wr(ae.paint_raster["raster-contrast"]),"raster-resampling":new wr(ae.paint_raster["raster-resampling"]),"raster-fade-duration":new wr(ae.paint_raster["raster-fade-duration"])})},W9=function(a){function u(p){a.call(this,p,$9)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u}(zr),J9=function(a){function u(p){a.call(this,p,{}),this.implementation=p}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.is3D=function(){return this.implementation.renderingMode==="3d"},u.prototype.hasOffscreenPass=function(){return this.implementation.prerender!==void 0},u.prototype.recalculate=function(){},u.prototype.updateTransitions=function(){},u.prototype.hasTransition=function(){},u.prototype.serialize=function(){},u.prototype.onAdd=function(p){this.implementation.onAdd&&this.implementation.onAdd(p,p.painter.context.gl)},u.prototype.onRemove=function(p){this.implementation.onRemove&&this.implementation.onRemove(p,p.painter.context.gl)},u}(zr),X9={circle:av,heatmap:PU,hillshade:FU,fill:qU,"fill-extrusion":s9,line:f9,symbol:V9,background:j9,raster:W9},PE=S.HTMLImageElement,RE=S.HTMLCanvasElement,FE=S.HTMLVideoElement,DE=S.ImageData,mm=S.ImageBitmap,Df=function(a,u,p,x){this.context=a,this.format=p,this.texture=a.gl.createTexture(),this.update(u,x)};Df.prototype.update=function(a,u,p){var x=a.width,E=a.height,I=!(this.size&&this.size[0]===x&&this.size[1]===E||p),D=this.context,k=D.gl;if(this.useMipmap=!!(u&&u.useMipmap),k.bindTexture(k.TEXTURE_2D,this.texture),D.pixelStoreUnpackFlipY.set(!1),D.pixelStoreUnpack.set(1),D.pixelStoreUnpackPremultiplyAlpha.set(this.format===k.RGBA&&(!u||u.premultiply!==!1)),I)this.size=[x,E],a instanceof PE||a instanceof RE||a instanceof FE||a instanceof DE||mm&&a instanceof mm?
vendor: 9,622 bytes, line 2102
2102k.texImage2D(k.TEXTURE_2D,0,this.format,this.format,k.UNSIGNED_BYTE,a):k.texImage2D(k.TEXTURE_2D,0,this.format,x,E,0,this.format,k.UNSIGNED_BYTE,a.data);else{var V=p||{x:0,y:0},K=V.x,Q=V.y;a instanceof PE||a instanceof RE||a instanceof FE||a instanceof DE||mm&&a instanceof mm?k.texSubImage2D(k.TEXTURE_2D,0,K,Q,k.RGBA,k.UNSIGNED_BYTE,a):k.texSubImage2D(k.TEXTURE_2D,0,K,Q,x,E,k.RGBA,k.UNSIGNED_BYTE,a.data)}this.useMipmap&&this.isSizePowerOfTwo()&&k.generateMipmap(k.TEXTURE_2D)},Df.prototype.bind=function(a,u,p){var x=this.context.gl;x.bindTexture(x.TEXTURE_2D,this.texture),p!==x.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=x.LINEAR),a!==this.filter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,a),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,p||a),this.filter=a),u!==this.wrap&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,u),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,u),this.wrap=u)},Df.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Df.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Cv=function(a){var u=this;this._callback=a,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){u._triggered=!1,u._callback()})};Cv.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))},Cv.prototype.remove=function(){delete this._channel,this._callback=function(){}};var rd=function(a,u,p){this.target=a,this.parent=u,this.mapId=p,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Te(["receive","process"],this),this.invoker=new Cv(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=_e()?a:S};function OE(a,u,p){var x=2*Math.PI*6378137/256/Math.pow(2,p);return[a*x-2*Math.PI*6378137/2,u*x-2*Math.PI*6378137/2]}rd.prototype.send=function(a,u,p,x,E){var I=this;E===void 0&&(E=!1);var D=Math.round(1e18*Math.random()).toString(36).substring(0,10);p&&(this.callbacks[D]=p);var k=Ze(this.globalScope)?void 0:[];return this.target.postMessage({id:D,type:a,hasCallback:!!p,targetMapId:x,mustQueue:E,sourceMapId:this.mapId,data:ro(u,k)},k),{cancel:function(){p&&delete I.callbacks[D],I.target.postMessage({id:D,type:"<cancel>",targetMapId:x,sourceMapId:I.mapId})}}},rd.prototype.receive=function(a){var u=a.data,p=u.id;if(p&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type==="<cancel>"){delete this.tasks[p];var x=this.cancelCallbacks[p];delete this.cancelCallbacks[p],x&&x()}else _e()||u.mustQueue?(this.tasks[p]=u,this.taskQueue.push(p),this.invoker.trigger()):this.processTask(p,u)},rd.prototype.process=function(){if(this.taskQueue.length){var a=this.taskQueue.shift(),u=this.tasks[a];delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),u&&this.processTask(a,u)}},rd.prototype.processTask=function(a,u){var p=this;if(u.type==="<response>"){var x=this.callbacks[a];delete this.callbacks[a],x&&(u.error?x(_s(u.error)):x(null,_s(u.data)))}else{var E=!1,I=Ze(this.globalScope)?void 0:[],D=u.hasCallback?function(Q,ie){E=!0,delete p.cancelCallbacks[a],p.target.postMessage({id:a,type:"<response>",sourceMapId:p.mapId,error:Q?ro(Q):null,data:ro(ie,I)},I)}:function(Q){E=!0},k=null,V=_s(u.data);if(this.parent[u.type])k=this.parent[u.type](u.sourceMapId,V,D);else if(this.parent.getWorkerSource){var K=u.type.split(".");k=this.parent.getWorkerSource(u.sourceMapId,K[0],V.source)[K[1]](V,D)}else D(new Error("Could not find function "+u.type));!E&&k&&k.cancel&&(this.cancelCallbacks[a]=k.cancel)}},rd.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Vi=function(a,u){a&&(u?this.setSouthWest(a).setNorthEast(u):a.length===4?this.setSouthWest([a[0],a[1]]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1]))};Vi.prototype.setNorthEast=function(a){return this._ne=a instanceof ri?new ri(a.lng,a.lat):ri.convert(a),this},Vi.prototype.setSouthWest=function(a){return this._sw=a instanceof ri?new ri(a.lng,a.lat):ri.convert(a),this},Vi.prototype.extend=function(a){var u,p,x=this._sw,E=this._ne;if(a instanceof ri)u=a,p=a;else{if(!(a instanceof Vi))return Array.isArray(a)?a.length===4||a.every(Array.isArray)?this.extend(Vi.convert(a)):this.extend(ri.convert(a)):this;if(p=a._ne,!(u=a._sw)||!p)return this}return x||E?(x.lng=Math.min(u.lng,x.lng),x.lat=Math.min(u.lat,x.lat),E.lng=Math.max(p.lng,E.lng),E.lat=Math.max(p.lat,E.lat)):(this._sw=new ri(u.lng,u.lat),this._ne=new ri(p.lng,p.lat)),this},Vi.prototype.getCenter=function(){return new ri((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Vi.prototype.getSouthWest=function(){return this._sw},Vi.prototype.getNorthEast=function(){return this._ne},Vi.prototype.getNorthWest=function(){return new ri(this.getWest(),this.getNorth())},Vi.prototype.getSouthEast=function(){return new ri(this.getEast(),this.getSouth())},Vi.prototype.getWest=function(){return this._sw.lng},Vi.prototype.getSouth=function(){return this._sw.lat},Vi.prototype.getEast=function(){return this._ne.lng},Vi.prototype.getNorth=function(){return this._ne.lat},Vi.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Vi.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Vi.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Vi.prototype.contains=function(a){var u=ri.convert(a),p=u.lng,x=u.lat,E=this._sw.lng<=p&&p<=this._ne.lng;return this._sw.lng>this._ne.lng&&(E=this._sw.lng>=p&&p>=this._ne.lng),this._sw.lat<=x&&x<=this._ne.lat&&E},Vi.convert=function(a){return!a||a instanceof Vi?a:new Vi(a)};var ri=function(a,u){if(isNaN(a)||isNaN(u))throw new Error("Invalid LngLat object: ("+a+", "+u+")");if(this.lng=+a,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};ri.prototype.wrap=function(){return new ri(G(this.lng,-180,180),this.lat)},ri.prototype.toArray=function(){return[this.lng,this.lat]},ri.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},ri.prototype.distanceTo=function(a){var u=Math.PI/180,p=this.lat*u,x=a.lat*u,E=Math.sin(p)*Math.sin(x)+Math.cos(p)*Math.cos(x)*Math.cos((a.lng-this.lng)*u);return 63710088e-1*Math.acos(Math.min(E,1))},ri.prototype.toBounds=function(a){a===void 0&&(a=0);var u=360*a/40075017,p=u/Math.cos(Math.PI/180*this.lat);return new Vi(new ri(this.lng-p,this.lat-u),new ri(this.lng+p,this.lat+u))},ri.convert=function(a){if(a instanceof ri)return a;if(Array.isArray(a)&&(a.length===2||a.length===3))return new ri(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&typeof a=="object"&&a!==null)return new ri(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 LE=2*Math.PI*63710088e-1;function kE(a){return LE*Math.cos(a*Math.PI/180)}function NE(a){return(180+a)/360}function UE(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function zE(a,u){return a/kE(u)}function Tv(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}var Of=function(a,u,p){p===void 0&&(p=0),this.x=+a,this.y=+u,this.z=+p};Of.fromLngLat=function(a,u){u===void 0&&(u=0);var p=ri.convert(a);return new Of(NE(p.lng),UE(p.lat),zE(u,p.lat))},Of.prototype.toLngLat=function(){return new ri(360*this.x-180,Tv(this.y))},Of.prototype.toAltitude=function(){return this.z*kE(Tv(this.y))},Of.prototype.meterInMercatorCoordinateUnits=function(){return 1/LE*(a=Tv(this.y),1/Math.cos(a*Math.PI/180));var a};var Lf=function(a,u,p){this.z=a,this.x=u,this.y=p,this.key=gA(0,a,a,u,p)};Lf.prototype.equals=function(a){return this.z===a.z&&this.x===a.x&&this.y===a.y},Lf.prototype.url=function(a,u){var p,x,E,I,D,k=(x=this.y,E=this.z,I=OE(256*(p=this.x),256*(x=Math.pow(2,E)-x-1),E),D=OE(256*(p+1),256*(x+1),E),I[0]+","+I[1]+","+D[0]+","+D[1]),V=function(K,Q,ie){for(var fe,ye="",ke=K;ke>0;ke--)ye+=(Q&(fe=1<<ke-1)?1:0)+(ie&fe?2:0);return ye}(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(u==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",V).replace("{bbox-epsg-3857}",k)},Lf.prototype.getTilePoint=function(a){var u=Math.pow(2,this.z);return new v(8192*(a.x*u-this.x),8192*(a.y*u-this.y))},Lf.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var GE=function(a,u){this.wrap=a,this.canonical=u,this.key=gA(a,u.z,u.z,u.x,u.y)},Hi=function(a,u,p,x,E){this.overscaledZ=a,this.wrap=u,this.canonical=new Lf(p,+x,+E),this.key=gA(u,a,p,x,E)};function gA(a,u,p,x,E){(a*=2)<0&&(a=-1*a-1);var I=1<<p;return(I*I*a+I*E+x).toString(36)+p.toString(36)+u.toString(36)}Hi.prototype.equals=function(a){return this.overscaledZ===a.overscaledZ&&this.wrap===a.wrap&&this.canonical.equals(a.canonical)},Hi.prototype.scaledTo=function(a){var u=this.canonical.z-a;return a>this.canonical.z?new Hi(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hi(a,this.wrap,a,this.canonical.x>>u,this.canonical.y>>u)},Hi.prototype.calculateScaledKey=function(a,u){var p=this.canonical.z-a;return a>this.canonical.z?gA(this.wrap*+u,a,this.canonical.z,this.canonical.x,this.canonical.y):gA(this.wrap*+u,a,a,this.canonical.x>>p,this.canonical.y>>p)}
vendor: 4,144 bytes, line 2102
2102,Hi.prototype.isChildOf=function(a){if(a.wrap!==this.wrap)return!1;var u=this.canonical.z-a.canonical.z;return a.overscaledZ===0||a.overscaledZ<this.overscaledZ&&a.canonical.x===this.canonical.x>>u&&a.canonical.y===this.canonical.y>>u},Hi.prototype.children=function(a){if(this.overscaledZ>=a)return[new Hi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var u=this.canonical.z+1,p=2*this.canonical.x,x=2*this.canonical.y;return[new Hi(u,this.wrap,u,p,x),new Hi(u,this.wrap,u,p+1,x),new Hi(u,this.wrap,u,p,x+1),new Hi(u,this.wrap,u,p+1,x+1)]},Hi.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))},Hi.prototype.wrapped=function(){return new Hi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},Hi.prototype.unwrapTo=function(a){return new Hi(this.overscaledZ,a,this.canonical.z,this.canonical.x,this.canonical.y)},Hi.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},Hi.prototype.toUnwrapped=function(){return new GE(this.wrap,this.canonical)},Hi.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},Hi.prototype.getTilePoint=function(a){return this.canonical.getTilePoint(new Of(a.x-this.wrap,a.y))},or("CanonicalTileID",Lf),or("OverscaledTileID",Hi,{omit:["posMatrix"]});var kl=function(a,u,p){if(this.uid=a,u.height!==u.width)throw new RangeError("DEM tiles must be square");if(p&&p!=="mapbox"&&p!=="terrarium")return re('"'+p+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=u.height;var x=this.dim=u.height-2;this.data=new Uint32Array(u.data.buffer),this.encoding=p||"mapbox";for(var E=0;E<x;E++)this.data[this._idx(-1,E)]=this.data[this._idx(0,E)],this.data[this._idx(x,E)]=this.data[this._idx(x-1,E)],this.data[this._idx(E,-1)]=this.data[this._idx(E,0)],this.data[this._idx(E,x)]=this.data[this._idx(E,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)]};kl.prototype.get=function(a,u){var p=new Uint8Array(this.data.buffer),x=4*this._idx(a,u);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(p[x],p[x+1],p[x+2])},kl.prototype.getUnpackVector=function(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},kl.prototype._idx=function(a,u){if(a<-1||a>=this.dim+1||u<-1||u>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(u+1)*this.stride+(a+1)},kl.prototype._unpackMapbox=function(a,u,p){return(256*a*256+256*u+p)/10-1e4},kl.prototype._unpackTerrarium=function(a,u,p){return 256*a+u+p/256-32768},kl.prototype.getPixels=function(){return new co({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},kl.prototype.backfillBorder=function(a,u,p){if(this.dim!==a.dim)throw new Error("dem dimension mismatch");var x=u*this.dim,E=u*this.dim+this.dim,I=p*this.dim,D=p*this.dim+this.dim;switch(u){case-1:x=E-1;break;case 1:E=x+1}switch(p){case-1:I=D-1;break;case 1:D=I+1}for(var k=-u*this.dim,V=-p*this.dim,K=I;K<D;K++)for(var Q=x;Q<E;Q++)this.data[this._idx(Q,K)]=a.data[this._idx(Q+k,K+V)]},or("DEMData",kl);var _m=function(a){this._stringToNumber={},this._numberToString=[];for(var u=0;u<a.length;u++){var p=a[u];this._stringToNumber[p]=u,this._numberToString[u]=p}};_m.prototype.encode=function(a){return this._stringToNumber[a]},_m.prototype.decode=function(a){return this._numberToString[a]};var ym=function(a,u,p,x,E){this.type="Feature",this._vectorTileFeature=a,a._z=u,a._x=p,a._y=x,this.properties=a.properties,this.id=E},Ev={geometry:{configurable:!0}};Ev.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}
2102,Ev.geometry.set=function(a){this._geometry=a},ym.prototype.toJSON=function(){var a={geometry:this.geometry};for(var u in this)u!=="_geometry"&&u!=="_vectorTileFeature"&&(a[u]=this[u]);return a},Object.defineProperties(ym.prototype,Ev);var nd=function(){this.state={},this.stateChanges={},this.deletedStates={}};nd.prototype.updateState=function(a,u,p){var x=String(u);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][x]=this.stateChanges[a][x]||{},H(this.stateChanges[a][x],p),this.deletedStates[a]===null)for(var E in this.deletedStates[a]={},this.state[a])E!==x&&(this.deletedStates[a][E]=null);else if(this.deletedStates[a]&&this.deletedStates[a][x]===null)for(var I in this.deletedStates[a][x]={},this.state[a][x])p[I]||(this.deletedStates[a][x][I]=null);else for(var D in p)this.deletedStates[a]&&this.deletedStates[a][x]&&this.deletedStates[a][x][D]===null&&delete this.deletedStates[a][x][D]},nd.prototype.removeFeatureState=function(a,u,p){if(this.deletedStates[a]!==null){var x=String(u);if(this.deletedStates[a]=this.deletedStates[a]||{},p&&u!==void 0)this.deletedStates[a][x]!==null&&(this.deletedStates[a][x]=this.deletedStates[a][x]||{},this.deletedStates[a][x][p]=null);else if(u!==void 0)if(this.stateChanges[a]&&this.stateChanges[a][x])for(p in this.deletedStates[a][x]={},this.stateChanges[a][x])this.deletedStates[a][x][p]=null;else this.deletedStates[a][x]=null;else this.deletedStates[a]=null}},nd.prototype.getState=function(a,u){var p=String(u),x=H({},(this.state[a]||{})[p],(this.stateChanges[a]||{})[p]);if(this.deletedStates[a]===null)return{};if(this.deletedStates[a]){var E=this.deletedStates[a][u];if(E===null)return{};for(var I in E)delete x[I]}return x},nd.prototype.initializeTileState=function(a,u){a.setFeatureState(this.state,u)},nd.prototype.coalesceChanges=function(a,u){var p={};for(var x in this.stateChanges){this.state[x]=this.state[x]||{};var E={};for(var I in this.stateChanges[x])this.state[x][I]||(this.state[x][I]={}),H(this.state[x][I],this.stateChanges[x][I]),E[I]=this.state[x][I];p[x]=E}for(var D in this.deletedStates){this.state[D]=this.state[D]||{};var k={};if(this.deletedStates[D]===null)for(var V in this.state[D])k[V]={},this.state[D][V]={};else for(var K in this.deletedStates[D]){if(this.deletedStates[D][K]===null)this.state[D][K]={};else for(var Q=0,ie=Object.keys(this.deletedStates[D][K]);Q<ie.length;Q+=1)delete this.state[D][K][ie[Q]];k[K]=this.state[D][K]}p[D]=p[D]||{},H(p[D],k)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(var fe in a)a[fe].setFeatureState(p,u)};var Nl=function(a,u){this.tileID=a,this.x=a.canonical.x,this.y=a.canonical.y,this.z=a.canonical.z,this.grid=new Fo(8192,16,0),this.grid3D=new Fo(8192,16,0),this.featureIndexArray=new X,this.promoteId=u};function VE(a,u,p,x,E){return de(a,function(I,D){var k=u instanceof Rl?u.get(D):null;return k&&k.evaluate?k.evaluate(p,x,E):k})}function HE(a){for(var u=1/0,p=1/0,x=-1/0,E=-1/0,I=0,D=a;I<D.length;I+=1){var k=D[I];u=Math.min(u,k.x),p=Math.min(p,k.y),x=Math.max(x,k.x),E=Math.max(E,k.y)}return{minX:u,minY:p,maxX:x,maxY:E}}function K9(a,u){return u-a}Nl.prototype.insert=function(a,u,p,x,E,I){var D=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,x,E);for(var k=I?this.grid3D:this.grid,V=0;V<u.length;V++){for(var K=u[V],Q=[1/0,1/0,-1/0,-1/0],ie=0;ie<K.length;ie++){var fe=K[ie];Q[0]=Math.min(Q[0],fe.x),Q[1]=Math.min(Q[1],fe.y),Q[2]=Math.max(Q[2],fe.x),Q[3]=Math.max(Q[3],fe.y)}Q[0]<8192&&Q[1]<8192&&Q[2]>=0&&Q[3]>=0&&k.insert(D,Q[0],Q[1],Q[2],Q[3])}},Nl.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Jh.VectorTile(new am(this.rawTileData)).layers,this.sourceLayerCoder=new _m(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Nl.prototype.query=function(a,u,p,x){var E=this;this.loadVTLayers();for(var I=a.params||{},D=8192/a.tileSize/a.scale,k=gu(I.filter),V=a.queryGeometry,K=a.queryPadding*D,Q=HE(V),ie=this.grid.query(Q.minX-K,Q.minY-K,Q.maxX+K,Q.maxY+K),fe=HE(a.cameraQueryGeometry),ye=this.grid3D.query(fe.minX-K,fe.minY-K,fe.maxX+K,fe.maxY+K,function(mt,yt,Ft,jt){return function(qt,br,nr,Br,ir){for(var sn=0,Lr=qt;sn<Lr.length;sn+=1){var hr=Lr[sn];if(br<=hr.x&&nr<=hr.y&&Br>=hr.x&&ir>=hr.y)return!0}var hn=[new v(br,nr),new v(br,ir),new v(Br,ir),new v(Br,nr)];if(qt.length>2){for(var qr=0,bn=hn;qr<bn.length;qr+=1)if(Ma(qt,bn[qr]))return!0}for(var Sr=0;Sr<qt.length-1;Sr++)if(Pf(qt[Sr],qt[Sr+1],hn))return!0;return!1}
2102(a.cameraQueryGeometry,mt-K,yt-K,Ft+K,jt+K)}),ke=0,Ne=ye;ke<Ne.length;ke+=1)ie.push(Ne[ke]);ie.sort(K9);for(var je,Ve={},qe=function(mt){var yt=ie[mt];if(yt!==je){je=yt;var Ft=E.featureIndexArray.get(yt),jt=null;E.loadMatchingFeature(Ve,Ft.bucketIndex,Ft.sourceLayerIndex,Ft.featureIndex,k,I.layers,I.availableImages,u,p,x,function(qt,br,nr){return jt||(jt=bi(qt)),br.queryIntersectsFeature(V,qt,nr,jt,E.z,a.transform,D,a.pixelPosMatrix)})}},ct=0;ct<ie.length;ct++)qe(ct);return Ve},Nl.prototype.loadMatchingFeature=function(a,u,p,x,E,I,D,k,V,K,Q){var ie=this.bucketLayerIDs[u];if(!I||function(qt,br){for(var nr=0;nr<qt.length;nr++)if(br.indexOf(qt[nr])>=0)return!0;return!1}(I,ie)){var fe=this.sourceLayerCoder.decode(p),ye=this.vtLayers[fe].feature(x);if(E.needGeometry){var ke=Mi(ye,!0);if(!E.filter(new Hr(this.tileID.overscaledZ),ke,this.tileID.canonical))return}else if(!E.filter(new Hr(this.tileID.overscaledZ),ye))return;for(var Ne=this.getId(ye,fe),je=0;je<ie.length;je++){var Ve=ie[je];if(!(I&&I.indexOf(Ve)<0)){var qe=k[Ve];if(qe){var ct={};Ne!==void 0&&K&&(ct=K.getState(qe.sourceLayer||"_geojsonTileLayer",Ne));var mt=H({},V[Ve]);mt.paint=VE(mt.paint,qe.paint,ye,ct,D),mt.layout=VE(mt.layout,qe.layout,ye,ct,D);var yt=!Q||Q(ye,qe,ct);if(yt){var Ft=new ym(ye,this.z,this.x,this.y,Ne);Ft.layer=mt;var jt=a[Ve];jt===void 0&&(jt=a[Ve]=[]),jt.push({featureIndex:x,feature:Ft,intersectionZ:yt})}}}}}},Nl.prototype.lookupSymbolFeatures=function(a,u,p,x,E,I,D,k){var V={};this.loadVTLayers();for(var K=gu(E),Q=0,ie=a;Q<ie.length;Q+=1)this.loadMatchingFeature(V,p,x,ie[Q],K,I,D,k,u);return V},Nl.prototype.hasLayer=function(a){for(var u=0,p=this.bucketLayerIDs;u<p.length;u+=1)for(var x=0,E=p[u];x<E.length;x+=1)if(a===E[x])return!0;return!1},Nl.prototype.getId=function(a,u){var p=a.id;return this.promoteId&&typeof(p=a.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[u]])=="boolean"&&(p=Number(p)),p},or("FeatureIndex",Nl,{omit:["rawTileData","sourceLayerCoder"]});var cs=function(a,u){this.tileID=a,this.uid=ue(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};cs.prototype.registerFadeDuration=function(a){var u=a+this.timeAdded;u<Kt.now()||this.fadeEndTime&&u<this.fadeEndTime||(this.fadeEndTime=u)},cs.prototype.wasRequested=function(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"},cs.prototype.loadVectorData=function(a,u,p){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(K,Q){var ie={};if(!Q)return ie;for(var fe=function(){var Ne=ke[ye],je=Ne.layerIds.map(function(ct){return Q.getLayer(ct)}).filter(Boolean);if(je.length!==0){Ne.layers=je,Ne.stateDependentLayerIds&&(Ne.stateDependentLayers=Ne.stateDependentLayerIds.map(function(ct){return je.filter(function(mt){return mt.id===ct})[0]}));for(var Ve=0,qe=je;Ve<qe.length;Ve+=1)ie[qe[Ve].id]=Ne}},ye=0,ke=K;ye<ke.length;ye+=1)fe();return ie}(a.buckets,u.style),this.hasSymbolBuckets=!1,this.buckets){var E=this.buckets[x];if(E instanceof Dn){if(this.hasSymbolBuckets=!0,!p)break;E.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var I in this.buckets){var D=this.buckets[I];if(D instanceof Dn&&D.hasRTLText){this.hasRTLText=!0,is.isLoading()||is.isLoaded()||Bf()!=="deferred"||Co();break}}for(var k in this.queryPadding=0,this.buckets){var V=this.buckets[k];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(k).queryRadius(V))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage)}else this.collisionBoxArray=new d},cs.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"},cs.prototype.getBucket=function(a){return this.buckets[a.id]},cs.prototype.upload=function(a){for(var u in this.buckets){var p=this.buckets[u];p.uploadPending()&&p.upload(a)}var x=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Df(a,this.imageAtlas.image,x.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Df(a,this.glyphAtlasImage,x.ALPHA),this.glyphAtlasImage=null)},cs.prototype.prepare=function(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)},cs.prototype.queryRenderedFeatures=function(a,u,p,x,E,I,D,k,V,K){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:x,cameraQueryGeometry:E,scale:I,tileSize:this.tileSize,pixelPosMatrix:K,transform:k,params:D,queryPadding:this.queryPadding*V},a,u,p):{}},cs.prototype.querySourceFeatures=function(a,u){var p=this.latestFeatureIndex;if(p&&p.rawTileData){var x=p.loadVTLayers(),E=u?u.sourceLayer:"",I=x._geojsonTileLayer||x[E];if(I)for(var D=gu(u&&u.filter),k=this.tileID.canonical,V=k.z,K=k.x,Q=k.y,ie={z:V,x:K,y:Q},fe=0;fe<I.length;fe++){var ye=I.feature(fe);if(D.needGeometry){var ke=Mi(ye,!0);
2102if(!D.filter(new Hr(this.tileID.overscaledZ),ke,this.tileID.canonical))continue}else if(!D.filter(new Hr(this.tileID.overscaledZ),ye))continue;var Ne=p.getId(ye,E),je=new ym(ye,V,K,Q,Ne);je.tile=ie,a.push(je)}}},cs.prototype.hasData=function(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"},cs.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},cs.prototype.setExpiryData=function(a){var u=this.expirationTime;if(a.cacheControl){var p=Le(a.cacheControl);p["max-age"]&&(this.expirationTime=Date.now()+1e3*p["max-age"])}else a.expires&&(this.expirationTime=new Date(a.expires).getTime());if(this.expirationTime){var x=Date.now(),E=!1;if(this.expirationTime>x)E=!1;else if(u)if(this.expirationTime<u)E=!0;else{var I=this.expirationTime-u;I?this.expirationTime=x+Math.max(I,3e4):E=!0}else E=!0;E?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},cs.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)},cs.prototype.setFeatureState=function(a,u){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&Object.keys(a).length!==0){var p=this.latestFeatureIndex.loadVTLayers();for(var x in this.buckets)if(u.style.hasLayer(x)){var E=this.buckets[x],I=E.layers[0].sourceLayer||"_geojsonTileLayer",D=p[I],k=a[I];if(D&&k&&Object.keys(k).length!==0){E.update(k,D,this.imageAtlas&&this.imageAtlas.patternPositions||{});var V=u&&u.style&&u.style.getLayer(x);V&&(this.queryPadding=Math.max(this.queryPadding,V.queryRadius(E)))}}}},cs.prototype.holdingForFade=function(){return this.symbolFadeHoldUntil!==void 0},cs.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Kt.now()},cs.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},cs.prototype.setHoldDuration=function(a){this.symbolFadeHoldUntil=Kt.now()+a},cs.prototype.setDependencies=function(a,u){for(var p={},x=0,E=u;x<E.length;x+=1)p[E[x]]=!0;this.dependencies[a]=p},cs.prototype.hasDependency=function(a,u){for(var p=0,x=a;p<x.length;p+=1){var E=this.dependencies[x[p]];if(E){for(var I=0,D=u;I<D.length;I+=1)if(E[D[I]])return!0}}return!1};var Mu=S.performance,jE=function(a){this._marks={start:[a.url,"start"].join("#"),end:[a.url,"end"].join("#"),measure:a.url.toString()},Mu.mark(this._marks.start)};jE.prototype.finish=function(){Mu.mark(this._marks.end);var a=Mu.getEntriesByName(this._marks.measure);return a.length===0&&(Mu.measure(this._marks.measure,this._marks.start,this._marks.end),a=Mu.getEntriesByName(this._marks.measure),Mu.clearMarks(this._marks.start),Mu.clearMarks(this._marks.end),Mu.clearMeasures(this._marks.measure)),a},o.Actor=rd,o.AlphaImage=Ff,o.CanonicalTileID=Lf,o.CollisionBoxArray=d,o.Color=tn,o.DEMData=kl,o.DataConstantProperty=wr,o.DictionaryCoder=_m,o.EXTENT=8192,o.ErrorEvent=he,o.EvaluationParameters=Hr,o.Event=Oe,o.Evented=be,o.FeatureIndex=Nl,o.FillBucket=oc,o.FillExtrusionBucket=ac,o.ImageAtlas=pA,o.ImagePosition=lm,o.LineBucket=Js,o.LngLat=ri,o.LngLatBounds=Vi,o.MercatorCoordinate=Of,o.ONE_EM=24,o.OverscaledTileID=Hi,o.Point=v,o.Point$1=v,o.Properties=Jn,o.Protobuf=am,o.RGBAImage=co,o.RequestManager=_r,o.RequestPerformance=jE,o.ResourceType=Gt,o.SegmentVector=Z,o.SourceFeatureState=nd,o.StructArrayLayout1ui2=M,o.StructArrayLayout2f1f2i16=Oo,o.StructArrayLayout2i4=js,o.StructArrayLayout3ui6=sa,o.StructArrayLayout4i8=Sf,o.SymbolBucket=Dn,o.Texture=Df,o.Tile=cs,o.Transitionable=Xi,o.Uniform1f=Dt,o.Uniform1i=pt,o.Uniform2f=Ct,o.Uniform3f=zt,o.Uniform4f=sr,o.UniformColor=Er,o.UniformMatrix4f=xn,o.UnwrappedTileID=GE,o.ValidationError=Be,o.WritingMode=ko,o.ZoomHistory=wf,o.add=function(a,u,p){return a[0]=u[0]+p[0],a[1]=u[1]+p[1],a[2]=u[2]+p[2],a},o.addDynamicAttributes=xv,o.asyncAll=function(a,u,p){if(!a.length)return p(null,[]);var x=a.length,E=new Array(a.length),I=null;a.forEach(function(D,k){u(D,function(V,K){V&&(I=V),E[k]=K,--x==0&&p(I,E)})})},o.bezier=N,o.bindAll=Te,o.browser=Kt,o.cacheEntryPossiblyAdded=function(a){++Rt>kt&&(a.getActor().send("enforceCacheSizeLimit",Me),Rt=0)},o.clamp=$,o.clearTileCache=function(a){var u=S.caches.delete("mapbox-tiles");a&&u.catch(a).then(function(){return a()})},o.clipLine=TE,o.clone=function(a){var u=new En(16);return u[0]=a[0],u[1]=a[1],u[2]=a[2],u[3]=a[3],u[4]=a[4],u[5]=a[5],u[6]=a[6],u[7]=a[7],u[8]=a[8],u[9]=a[9],u[10]=a[10],u[11]=a[11],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15],u},o.clone$1=pe,o.clone$2=function(a){var u=new En(3);return u[0]=a[0],u[1]=a[1],u[2]=a[2],u},o.collisionCircleLayout=A9,o.config=Nt,o.create=function(){var a=new En(16);return En!=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},o.create$1=function(){var a=new En(9);return En!=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},o.create$2=function(){var a=new En(4);return En!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a},o.createCommonjsModule=c,o.createExpression=pu,o.createLayout=ki,o.createStyleLayer=function(a){return a.type==="custom"?new J9(a):new X9[a.type](a)},o.cross=function(a,u,p){var x=u[0],E=u[1],I=u[2],D=p[0],k=p[1],V=p[2];
2102return a[0]=E*V-I*k,a[1]=I*D-x*V,a[2]=x*k-E*D,a},o.deepEqual=function a(u,p){if(Array.isArray(u)){if(!Array.isArray(p)||u.length!==p.length)return!1;for(var x=0;x<u.length;x++)if(!a(u[x],p[x]))return!1;return!0}if(typeof u=="object"&&u!==null&&p!==null){if(typeof p!="object"||Object.keys(u).length!==Object.keys(p).length)return!1;for(var E in u)if(!a(u[E],p[E]))return!1;return!0}return u===p},o.dot=function(a,u){return a[0]*u[0]+a[1]*u[1]+a[2]*u[2]},o.dot$1=function(a,u){return a[0]*u[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3]},o.ease=U,o.emitValidationErrors=Pl,o.endsWith=Ue,o.enforceCacheSizeLimit=function(a){$t(),Bn&&Bn.then(function(u){u.keys().then(function(p){for(var x=0;x<p.length-a;x++)u.delete(p[x])})})},o.evaluateSizeForFeature=yE,o.evaluateSizeForZoom=vE,o.evaluateVariableOffset=SE,o.evented=Ti,o.extend=H,o.featureFilter=gu,o.filterObject=me,o.fromRotation=function(a,u){var p=Math.sin(u),x=Math.cos(u);return a[0]=x,a[1]=p,a[2]=0,a[3]=-p,a[4]=x,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},o.getAnchorAlignment=_v,o.getAnchorJustification=bv,o.getArrayBuffer=Je,o.getImage=ne,o.getJSON=function(a,u){return Ce(H(a,{type:"json"}),u)},o.getRTLTextPluginStatus=Bf,o.getReferrer=j,o.getVideo=function(a,u){var p,x,E=S.document.createElement("video");E.muted=!0,E.onloadstart=function(){u(null,E)};for(var I=0;I<a.length;I++){var D=S.document.createElement("source");p=a[I],x=void 0,(x=S.document.createElement("a")).href=p,(x.protocol!==S.document.location.protocol||x.host!==S.document.location.host)&&(E.crossOrigin="Anonymous"),D.src=a[I],E.appendChild(D)}return{cancel:function(){}}},o.identity=Bo,o.invert=function(a,u){var p=u[0],x=u[1],E=u[2],I=u[3],D=u[4],k=u[5],V=u[6],K=u[7],Q=u[8],ie=u[9],fe=u[10],ye=u[11],ke=u[12],Ne=u[13],je=u[14],Ve=u[15],qe=p*k-x*D,ct=p*V-E*D,mt=p*K-I*D,yt=x*V-E*k,Ft=x*K-I*k,jt=E*K-I*V,qt=Q*Ne-ie*ke,br=Q*je-fe*ke,nr=Q*Ve-ye*ke,Br=ie*je-fe*Ne,ir=ie*Ve-ye*Ne,sn=fe*Ve-ye*je,Lr=qe*sn-ct*ir+mt*Br+yt*nr-Ft*br+jt*qt;return Lr?(a[0]=(k*sn-V*ir+K*Br)*(Lr=1/Lr),a[1]=(E*ir-x*sn-I*Br)*Lr,a[2]=(Ne*jt-je*Ft+Ve*yt)*Lr,a[3]=(fe*Ft-ie*jt-ye*yt)*Lr,a[4]=(V*nr-D*sn-K*br)*Lr,a[5]=(p*sn-E*nr+I*br)*Lr,a[6]=(je*mt-ke*jt-Ve*ct)*Lr,a[7]=(Q*jt-fe*mt+ye*ct)*Lr,a[8]=(D*ir-k*nr+K*qt)*Lr,a[9]=(x*nr-p*ir-I*qt)*Lr,a[10]=(ke*Ft-Ne*mt+Ve*qe)*Lr,a[11]=(ie*mt-Q*Ft-ye*qe)*Lr,a[12]=(k*br-D*Br-V*qt)*Lr,a[13]=(p*Br-x*br+E*qt)*Lr,a[14]=(Ne*ct-ke*yt-je*qe)*Lr,a[15]=(Q*yt-ie*ct+fe*qe)*Lr,a):null},o.isChar=Yt,o.isMapboxURL=yr,o.keysDifference=function(a,u){var p=[];for(var x in a)x in u||p.push(x);return p},o.makeRequest=Ce,o.mapObject=de,o.mercatorXfromLng=NE,o.mercatorYfromLat=UE,o.mercatorZfromAltitude=zE,o.mul=ov,o.multiply=Ws,o.mvt=Jh,o.nextPowerOfTwo=function(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},o.normalize=function(a,u){var p=u[0],x=u[1],E=u[2],I=p*p+x*x+E*E;return I>0&&(I=1/Math.sqrt(I)),a[0]=u[0]*I,a[1]=u[1]*I,a[2]=u[2]*I,a},o.number=hi,o.offscreenCanvasSupported=Ae,o.ortho=function(a,u,p,x,E,I,D){var k=1/(u-p),V=1/(x-E),K=1/(I-D);return a[0]=-2*k,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*V,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*K,a[11]=0,a[12]=(u+p)*k,a[13]=(E+x)*V,a[14]=(D+I)*K,a[15]=1,a},o.parseGlyphPBF=function(a){return new am(a).readFields(E9,[])},o.pbf=am,o.performSymbolLayout=function(a,u,p,x,E,I,D){a.createArrays(),a.tilePixelRatio=8192/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;var k=a.layers[0].layout,V=a.layers[0]._unevaluatedLayout._values,K={};if(a.textSizeData.kind==="composite"){var Q=a.textSizeData,ie=Q.maxZoom;K.compositeTextSizes=[V["text-size"].possiblyEvaluate(new Hr(Q.minZoom),D),V["text-size"].possiblyEvaluate(new Hr(ie),D)]}if(a.iconSizeData.kind==="composite"){var fe=a.iconSizeData,ye=fe.maxZoom;K.compositeIconSizes=[V["icon-size"].possiblyEvaluate(new Hr(fe.minZoom),D),V["icon-size"].possiblyEvaluate(new Hr(ye),D)]}K.layoutTextSize=V["text-size"].possiblyEvaluate(new Hr(a.zoom+1),D),K.layoutIconSize=V["icon-size"].possiblyEvaluate(new Hr(a.zoom+1),D),K.textMaxSize=V["text-size"].possiblyEvaluate(new Hr(18));for(var ke=24*k.get("text-line-height"),Ne=k.get("text-rotation-alignment")==="map"&&k.get("symbol-placement")!=="point",je=k.get("text-keep-upright"),Ve=k.get("text-size"),qe=function(){var yt=mt[ct],Ft=k.get("text-font").evaluate(yt,{},D).join(","),jt=Ve.evaluate(yt,{},D),qt=K.layoutTextSize.evaluate(yt,{},D),br=K.layoutIconSize.evaluate(yt,{},D),nr={horizontal:{},vertical:void 0},Br=yt.text,ir=[0,0];if(Br){var sn=Br.toString(),Lr=24*k.get("text-letter-spacing").evaluate(yt,{},D),hr=function(gn){for(var Nn=0,Mn=gn;Nn<Mn.length;
2102Nn+=1)if(wn=Mn[Nn].charCodeAt(0),Yt.Arabic(wn)||Yt["Arabic Supplement"](wn)||Yt["Arabic Extended-A"](wn)||Yt["Arabic Presentation Forms-A"](wn)||Yt["Arabic Presentation Forms-B"](wn))return!1;var wn;return!0}(sn)?Lr:0,hn=k.get("text-anchor").evaluate(yt,{},D),qr=k.get("text-variable-anchor");if(!qr){var bn=k.get("text-radial-offset").evaluate(yt,{},D);ir=bn?SE(hn,[24*bn,vv]):k.get("text-offset").evaluate(yt,{},D).map(function(gn){return 24*gn})}var Sr=Ne?"center":k.get("text-justify").evaluate(yt,{},D),Cn=k.get("symbol-placement"),ni=Cn==="point"?24*k.get("text-max-width").evaluate(yt,{},D):0,Bi=function(){a.allowVerticalPlacement&&Cf(sn)&&(nr.vertical=um(Br,u,p,E,Ft,ni,ke,hn,"left",hr,ir,ko.vertical,!0,Cn,qt,jt))};if(!Ne&&qr){for(var xi=Sr==="auto"?qr.map(function(gn){return bv(gn)}):[Sr],ii=!1,Si=0;Si<xi.length;Si++){var Zi=xi[Si];if(!nr.horizontal[Zi])if(ii)nr.horizontal[Zi]=nr.horizontal[0];else{var Qi=um(Br,u,p,E,Ft,ni,ke,"center",Zi,hr,ir,ko.horizontal,!1,Cn,qt,jt);Qi&&(nr.horizontal[Zi]=Qi,ii=Qi.positionedLines.length===1)}}Bi()}else{Sr==="auto"&&(Sr=bv(hn));var Fs=um(Br,u,p,E,Ft,ni,ke,hn,Sr,hr,ir,ko.horizontal,!1,Cn,qt,jt);Fs&&(nr.horizontal[Sr]=Fs),Bi(),Cf(sn)&&Ne&&je&&(nr.vertical=um(Br,u,p,E,Ft,ni,ke,hn,Sr,hr,ir,ko.vertical,!1,Cn,qt,jt))}}var ls=void 0,Ds=!1;if(yt.icon&&yt.icon.name){var Pi=x[yt.icon.name];Pi&&(ls=function(gn,Nn,Mn){var wn=_v(Mn),Xs=Nn[0]-gn.displaySize[0]*wn.horizontalAlign,bs=Nn[1]-gn.displaySize[1]*wn.verticalAlign;return{image:gn,top:bs,bottom:bs+gn.displaySize[1],left:Xs,right:Xs+gn.displaySize[0]}}(E[yt.icon.name],k.get("icon-offset").evaluate(yt,{},D),k.get("icon-anchor").evaluate(yt,{},D)),Ds=Pi.sdf,a.sdfIcons===void 0?a.sdfIcons=Pi.sdf:a.sdfIcons!==Pi.sdf&&re("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Pi.pixelRatio!==a.pixelRatio||k.get("icon-rotate").constantOr(1)!==0)&&(a.iconsNeedLinear=!0))}var us=ME(nr.horizontal)||nr.vertical;a.iconsInText=!!us&&us.iconsInText,(us||ls)&&function(gn,Nn,Mn,wn,Xs,bs,Qn,Ni,xs,Tn,Jc){var No=bs.textMaxSize.evaluate(Nn,{});No===void 0&&(No=Qn);var Xc,Ri=gn.layers[0].layout,Kc=Ri.get("icon-offset").evaluate(Nn,{},Jc),Ra=ME(Mn.horizontal),id=Qn/24,kf=gn.tilePixelRatio*id,sd=gn.tilePixelRatio*No/24,Ul=gn.tilePixelRatio*Ni,od=gn.tilePixelRatio*Ri.get("symbol-spacing"),vm=Ri.get("text-padding")*gn.tilePixelRatio,ad=Ri.get("icon-padding")*gn.tilePixelRatio,mA=Ri.get("text-max-angle")/180*Math.PI,bm=Ri.get("text-rotation-alignment")==="map"&&Ri.get("symbol-placement")!=="point",xm=Ri.get("icon-rotation-alignment")==="map"&&Ri.get("symbol-placement")!=="point",zl=Ri.get("symbol-placement"),_A=od/2,cd=Ri.get("icon-text-fit");wn&&cd!=="none"&&(gn.allowVerticalPlacement&&Mn.vertical&&(Xc=_E(wn,Mn.vertical,cd,Ri.get("icon-text-fit-padding"),Kc,id)),Ra&&(wn=_E(wn,Ra,cd,Ri.get("icon-text-fit-padding"),Kc,id)));var Pu=function(q9,EA){EA.x<0||EA.x>=8192||EA.y<0||EA.y>=8192||function(Fi,cc,Y9,Ru,Mv,JE,Sm,qc,Im,BA,Mm,Pm,Pv,XE,SA,KE,qE,YE,ZE,QE,Uo,Rm,eB,Yc,Z9){var tB,Uf,dd,pd,Ad,gd=Fi.addToLineVertexArray(cc,Y9),rB=0,nB=0,iB=0,sB=0,Rv=-1,Fv=-1,Gl={},oB=ge(""),Dv=0,Ov=0;if(qc._unevaluatedLayout.getValue("text-radial-offset")===void 0?(Dv=(tB=qc.layout.get("text-offset").evaluate(Uo,{},Yc).map(function(MA){return 24*MA}))[0],Ov=tB[1]):(Dv=24*qc.layout.get("text-radial-offset").evaluate(Uo,{},Yc),Ov=vv),Fi.allowVerticalPlacement&&Ru.vertical){var aB=qc.layout.get("text-rotate").evaluate(Uo,{},Yc)+90;pd=new Am(Im,cc,BA,Mm,Pm,Ru.vertical,Pv,XE,SA,aB),Sm&&(Ad=new Am(Im,cc,BA,Mm,Pm,Sm,qE,YE,SA,aB))}if(Mv){var Lv=qc.layout.get("icon-rotate").evaluate(Uo,{}),cB=qc.layout.get("icon-text-fit")!=="none",lB=EE(Mv,Lv,eB,cB),kv=Sm?EE(Sm,Lv,eB,cB):void 0;dd=new Am(Im,cc,BA,Mm,Pm,Mv,qE,YE,!1,Lv),rB=4*lB.length;var uB=Fi.iconSizeData,IA=null;uB.kind==="source"?(IA=[128*qc.layout.get("icon-size").evaluate(Uo,{})])[0]>32640&&re(Fi.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):uB.kind==="composite"&&((IA=[128*Rm.compositeIconSizes[0].evaluate(Uo,{},Yc),128*Rm.compositeIconSizes[1].evaluate(Uo,{},Yc)])[0]>32640||IA[1]>32640)&&re(Fi.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),Fi.addSymbols(Fi.icon,lB,IA,QE,ZE,Uo,!1,cc,gd.lineStartIndex,gd.lineLength,-1,Yc),Rv=Fi.icon.placedSymbolArray.length-1,kv&&(nB=4*kv.length,Fi.addSymbols(Fi.icon,kv,IA,QE,ZE,Uo,ko.vertical,cc,gd.lineStartIndex,gd.lineLength,-1,Yc),Fv=Fi.icon.placedSymbolArray.length-1)}for(var fB in Ru.horizontal){var Fm=Ru.horizontal[fB];if(!Uf){oB=ge(Fm.text);var Q9=qc.layout.get("text-rotate").evaluate(Uo,{},Yc);Uf=new Am(Im,cc,BA,Mm,Pm,Fm,Pv,XE,SA,Q9)}var hB=Fm.positionedLines.length===1;if(iB+=IE(Fi,cc,Fm,JE,qc,SA,Uo,KE,gd,Ru.vertical?ko.horizontal:ko.horizontalOnly,hB?Object.keys(Ru.horizontal):[fB],Gl,Rv,Rm,Yc),hB)break}Ru.vertical&&(sB+=IE(Fi,cc,Ru.vertical,JE,qc,SA,Uo,KE,gd,ko.vertical,["vertical"],Gl,Fv,Rm,Yc));var e5=Uf?Uf.boxStartIndex:Fi.collisionBoxArray.length,t5=Uf?Uf.boxEndIndex:Fi.collisionBoxArray.length,r5=pd?pd.boxStartIndex:Fi.collisionBoxArray.length,n5=pd?pd.boxEndIndex:Fi.collisionBoxArray.length,i5=dd?dd.boxStartIndex:Fi.collisionBoxArray.length,s5=dd?dd.boxEndIndex:Fi.collisionBoxArray.length,o5=Ad?Ad.boxStartIndex:Fi.collisionBoxArray.length,a5=Ad?Ad.boxEndIndex:Fi.collisionBoxArray.length,Zc=-1,Dm=function(MA,pB){return MA&&MA.circleDiameter?Math.max(MA.cir
2102cleDiameter,pB):pB};Zc=Dm(Uf,Zc),Zc=Dm(pd,Zc),Zc=Dm(dd,Zc);var dB=(Zc=Dm(Ad,Zc))>-1?1:0;dB&&(Zc*=Z9/24),Fi.glyphOffsetArray.length>=Dn.MAX_GLYPHS&&re("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Uo.sortKey!==void 0&&Fi.addToSortKeyRanges(Fi.symbolInstances.length,Uo.sortKey),Fi.symbolInstances.emplaceBack(cc.x,cc.y,Gl.right>=0?Gl.right:-1,Gl.center>=0?Gl.center:-1,Gl.left>=0?Gl.left:-1,Gl.vertical||-1,Rv,Fv,oB,e5,t5,r5,n5,i5,s5,o5,a5,BA,iB,sB,rB,nB,dB,0,Pv,Dv,Ov,Zc)}(gn,EA,q9,Mn,wn,Xs,Xc,gn.layers[0],gn.collisionBoxArray,Nn.index,Nn.sourceLayerIndex,gn.index,kf,vm,bm,xs,Ul,ad,xm,Kc,Nn,bs,Tn,Jc,Qn)};if(zl==="line")for(var ld=0,wm=TE(Nn.geometry,0,0,8192,8192);ld<wm.length;ld+=1)for(var Cm=wm[ld],yA=0,vA=F9(Cm,od,mA,Mn.vertical||Ra,wn,24,sd,gn.overscaling,8192);yA<vA.length;yA+=1){var Tm=vA[yA];Ra&&k9(gn,Ra.text,_A,Tm)||Pu(Cm,Tm)}else if(zl==="line-center")for(var bA=0,xA=Nn.geometry;bA<xA.length;bA+=1){var wA=xA[bA];if(wA.length>1){var Em=R9(wA,mA,Mn.vertical||Ra,wn,24,sd);Em&&Pu(wA,Em)}}else if(Nn.type==="Polygon")for(var ud=0,Bm=dv(Nn.geometry,0);ud<Bm.length;ud+=1){var fd=Bm[ud],CA=O9(fd,16);Pu(fd[0],new Yh(CA.x,CA.y,0))}else if(Nn.type==="LineString")for(var Nf=0,TA=Nn.geometry;Nf<TA.length;Nf+=1){var hd=TA[Nf];Pu(hd,new Yh(hd[0].x,hd[0].y,0))}else if(Nn.type==="Point")for(var Bv=0,$E=Nn.geometry;Bv<$E.length;Bv+=1)for(var Sv=0,WE=$E[Bv];Sv<WE.length;Sv+=1){var Iv=WE[Sv];Pu([Iv],new Yh(Iv.x,Iv.y,0))}}(a,yt,nr,ls,x,K,qt,br,ir,Ds,D)},ct=0,mt=a.features;ct<mt.length;ct+=1)qe();I&&a.generateCollisionDebugBuffers()},o.perspective=function(a,u,p,x,E){var I,D=1/Math.tan(u/2);return a[0]=D/p,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,E!=null&&E!==1/0?(a[10]=(E+x)*(I=1/(x-E)),a[14]=2*E*x*I):(a[10]=-1,a[14]=-2*x),a},o.pick=function(a,u){for(var p={},x=0;x<u.length;x++){var E=u[x];E in a&&(p[E]=a[E])}return p},o.plugin=is,o.polygonIntersectsPolygon=jc,o.postMapLoadEvent=_i,o.postTurnstileEvent=Rr,o.potpack=pE,o.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.register=or,o.registerForPluginStateChange=function(a){return a({pluginStatus:Ms,pluginURL:ta}),Ti.on("pluginStateChange",a),a},o.renderColorRamp=KT,o.rotate=function(a,u,p){var x=u[0],E=u[1],I=u[2],D=u[3],k=Math.sin(p),V=Math.cos(p);return a[0]=x*V+I*k,a[1]=E*V+D*k,a[2]=x*-k+I*V,a[3]=E*-k+D*V,a},o.rotateX=function(a,u,p){var x=Math.sin(p),E=Math.cos(p),I=u[4],D=u[5],k=u[6],V=u[7],K=u[8],Q=u[9],ie=u[10],fe=u[11];return u!==a&&(a[0]=u[0],a[1]=u[1],a[2]=u[2],a[3]=u[3],a[12]=u[12],a[13]=u[13],a[14]=u[14],a[15]=u[15]),a[4]=I*E+K*x,a[5]=D*E+Q*x,a[6]=k*E+ie*x,a[7]=V*E+fe*x,a[8]=K*E-I*x,a[9]=Q*E-D*x,a[10]=ie*E-k*x,a[11]=fe*E-V*x,a},o.rotateZ=function(a,u,p){var x=Math.sin(p),E=Math.cos(p),I=u[0],D=u[1],k=u[2],V=u[3],K=u[4],Q=u[5],ie=u[6],fe=u[7];return u!==a&&(a[8]=u[8],a[9]=u[9],a[10]=u[10],a[11]=u[11],a[12]=u[12],a[13]=u[13],a[14]=u[14],a[15]=u[15]),a[0]=I*E+K*x,a[1]=D*E+Q*x,a[2]=k*E+ie*x,a[3]=V*E+fe*x,a[4]=K*E-I*x,a[5]=Q*E-D*x,a[6]=ie*E-k*x,a[7]=fe*E-V*x,a},o.scale=function(a,u,p){var x=p[0],E=p[1],I=p[2];return a[0]=u[0]*x,a[1]=u[1]*x,a[2]=u[2]*x,a[3]=u[3]*x,a[4]=u[4]*E,a[5]=u[5]*E,a[6]=u[6]*E,a[7]=u[7]*E,a[8]=u[8]*I,a[9]=u[9]*I,a[10]=u[10]*I,a[11]=u[11]*I,a[12]=u[12],a[13]=u[13],a[14]=u[14],a[15]=u[15],a},o.scale$1=function(a,u,p){return a[0]=u[0]*p,a[1]=u[1]*p,a[2]=u[2]*p,a[3]=u[3]*p,a},o.scale$2=function(a,u,p){return a[0]=u[0]*p,a[1]=u[1]*p,a[2]=u[2]*p,a},o.setCacheLimits=function(a,u){Me=a,kt=u},o.setRTLTextPlugin=function(a,u,p){if(p===void 0&&(p=!1),Ms==="deferred"||Ms==="loading"||Ms==="loaded")throw new Error("setRTLTextPlugin cannot be called multiple times.");ta=Kt.resolveURL(a),Ms="deferred",wu=u,Vc(),p||Co()},o.sphericalToCartesian=function(a){var u=a[0],p=a[1],x=a[2];return p+=90,p*=Math.PI/180,x*=Math.PI/180,{x:u*Math.cos(p)*Math.sin(x),y:u*Math.sin(p)*Math.sin(x),z:u*Math.cos(x)}},o.sqrLen=function(a){var u=a[0],p=a[1];return u*u+p*p},o.styleSpec=ae,o.sub=function(a,u,p){return a[0]=u[0]-p[0],a[1]=u[1]-p[1],a[2]=u[2]-p[2],a},o.symbolSize=P9,o.transformMat3=function(a,u,p){var x=u[0],E=u[1],I=u[2];return a[0]=x*p[0]+E*p[3]+I*p[6],a[1]=x*p[1]+E*p[4]+I*p[7],a[2]=x*p[2]+E*p[5]+I*p[8],a},o.transformMat4=Hh,o.translate=function(a,u,p){var x,E,I,D,k,V,K,Q,ie,fe,ye,ke,Ne=p[0],je=p[1],Ve=p[2];return u===a?(a[12]=u[0]*Ne+u[4]*je+u[8]*Ve+u[12],a[13]=u[1]*Ne+u[5]*je+u[9]*Ve+u[13],a[14]=u[2]*Ne+u[6]*je+u[10]*Ve+u[14],a[15]=u[3]*Ne+u[7]*je+u[11]*Ve+u[15]):(E=u[1],I=u[2],D=u[3],k=u[4],V=u[5],K=u[6],Q=u[7],ie=u[8],fe=u[9],ye=u[10],ke=u[11],a[0]=x=u[0],a[1]=E,a[2]=I,a[3]=D,a[4]=k,a[5]=V,a[6]=K,a[7]=Q,a[8]=ie,a[9]=fe,a[10]=ye,a[11]=ke,a[12]=x*Ne+k*je+ie*Ve+u[12],a[13]=E*Ne+V*je+fe*Ve+u[13],a[14]=I*Ne+K*je+ye*Ve+u[14],a[15]=D*Ne+Q*je+ke*Ve+u[15]),a},o.triggerPluginCompletionEvent=Ef,o.uniqueId=ue,o.validateCustomStyleLayer=function(a){var u=[],p=a.id;return p===void 0&&u.push({message:"layers."+p+': missing required property "id"'}),a.render===void 0&&u.push({message:"layers."+p+': missing required method "render"'}),a.renderingMode&&a.renderingMode!=="2d"&&a.renderingMode!=="3d"&&u.push({message:"layers."+p+': property "renderingMode" must be either "2d" or "3d"'}),u},o.validateLight=iA,o.validateStyle=Ml,o.values=function(a){var u=[];for(var p in a)u.push(a[p]);return u},o.vectorTile=Jh,o.version="1.13.3",o.warnOnce=re,o.webpSupported=Ar,o.window=S,o.wrap=G}),s(["./shared"],function(o){function c(Y){var ne=typeof Y;if(ne==="number"||ne==="boolean"||ne==="string"||Y==null)return JSON.stringify(Y);
vendor: 1,564 bytes, line 2102
2102if(Array.isArray(Y)){for(var le="[",ve=0,Oe=Y;ve<Oe.length;ve+=1)le+=c(Oe[ve])+",";return le+"]"}for(var he=Object.keys(Y).sort(),be="{",ae=0;ae<he.length;ae++)be+=JSON.stringify(he[ae])+":"+c(Y[he[ae]])+",";return be+"}"}function f(Y){for(var ne="",le=0,ve=o.refProperties;le<ve.length;le+=1)ne+="/"+c(Y[ve[le]]);return ne}var A=function(Y){this.keyCache={},Y&&this.replace(Y)};A.prototype.replace=function(Y){this._layerConfigs={},this._layers={},this.update(Y,[])},A.prototype.update=function(Y,ne){for(var le=this,ve=0,Oe=Y;ve<Oe.length;ve+=1){var he=Oe[ve];this._layerConfigs[he.id]=he;var be=this._layers[he.id]=o.createStyleLayer(he);be._featureFilter=o.featureFilter(be.filter),this.keyCache[he.id]&&delete this.keyCache[he.id]}for(var ae=0,Be=ne;ae<Be.length;ae+=1){var g=Be[ae];delete this.keyCache[g],delete this._layerConfigs[g],delete this._layers[g]}this.familiesBySource={};for(var ce=0,xt=function(Mt,Ht){for(var Ur={},Qt=0;Qt<Mt.length;Qt++){var en=Ht&&Ht[Mt[Qt].id]||f(Mt[Qt]);Ht&&(Ht[Mt[Qt].id]=en);var cn=Ur[en];cn||(cn=Ur[en]=[]),cn.push(Mt[Qt])}var Wr=[];for(var Jr in Ur)Wr.push(Ur[Jr]);return Wr}(o.values(this._layerConfigs),this.keyCache);ce<xt.length;ce+=1){var Ke=xt[ce].map(function(Mt){return le._layers[Mt.id]}),Et=Ke[0];if(Et.visibility!=="none"){var Pt=Et.source||"",Ot=this.familiesBySource[Pt];Ot||(Ot=this.familiesBySource[Pt]={});var ht=Et.sourceLayer||"_geojsonTileLayer",Lt=Ot[ht];Lt||(Lt=Ot[ht]=[]),Lt.push(Ke)}}};var v=function(Y){var ne={},le=[];for(var ve in Y){var Oe=Y[ve],he=ne[ve]={};for(var be in Oe){var ae=Oe[+be];
2102if(ae&&ae.bitmap.width!==0&&ae.bitmap.height!==0){var Be={x:0,y:0,w:ae.bitmap.width+2,h:ae.bitmap.height+2};le.push(Be),he[be]={rect:Be,metrics:ae.metrics}}}}var g=o.potpack(le),ce=new o.AlphaImage({width:g.w||1,height:g.h||1});for(var xt in Y){var Ke=Y[xt];for(var Et in Ke){var Pt=Ke[+Et];if(Pt&&Pt.bitmap.width!==0&&Pt.bitmap.height!==0){var Ot=ne[xt][Et].rect;o.AlphaImage.copy(Pt.bitmap,ce,{x:0,y:0},{x:Ot.x+1,y:Ot.y+1},Pt.bitmap)}}}this.image=ce,this.positions=ne};o.register("GlyphAtlas",v);var w=function(Y){this.tileID=new o.OverscaledTileID(Y.tileID.overscaledZ,Y.tileID.wrap,Y.tileID.canonical.z,Y.tileID.canonical.x,Y.tileID.canonical.y),this.uid=Y.uid,this.zoom=Y.zoom,this.pixelRatio=Y.pixelRatio,this.tileSize=Y.tileSize,this.source=Y.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Y.showCollisionBoxes,this.collectResourceTiming=!!Y.collectResourceTiming,this.returnDependencies=!!Y.returnDependencies,this.promoteId=Y.promoteId};function S(Y,ne,le){for(var ve=new o.EvaluationParameters(ne),Oe=0,he=Y;Oe<he.length;Oe+=1)he[Oe].recalculate(ve,le)}function F(Y,ne){var le=o.getArrayBuffer(Y.request,function(ve,Oe,he,be){ve?ne(ve):Oe&&ne(null,{vectorTile:new o.vectorTile.VectorTile(new o.pbf(Oe)),rawData:Oe,cacheControl:he,expires:be})});return function(){le.cancel(),ne()}}w.prototype.parse=function(Y,ne,le,ve,Oe){var he=this;this.status="parsing",this.data=Y,this.collisionBoxArray=new o.CollisionBoxArray;var be=new o.DictionaryCoder(Object.keys(Y.layers).sort()),ae=new o.FeatureIndex(this.tileID,this.promoteId);ae.bucketLayerIDs=[];var Be,g,ce,xt,Ke={},Et={featureIndex:ae,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:le},Pt=ne.familiesBySource[this.source];for(var Ot in Pt){var ht=Y.layers[Ot];if(ht){ht.version===1&&o.warnOnce('Vector tile source "'+this.source+'" layer "'+Ot+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var Lt=be.encode(Ot),Mt=[],Ht=0;Ht<ht.length;Ht++){var Ur=ht.feature(Ht),Qt=ae.getId(Ur,Ot);Mt.push({feature:Ur,id:Qt,index:Ht,sourceLayerIndex:Lt})}for(var en=0,cn=Pt[Ot];en<cn.length;en+=1){var Wr=cn[en],Jr=Wr[0];Jr.minzoom&&this.zoom<Math.floor(Jr.minzoom)||Jr.maxzoom&&this.zoom>=Jr.maxzoom||Jr.visibility!=="none"&&(S(Wr,this.zoom,le),(Ke[Jr.id]=Jr.createBucket({index:ae.bucketLayerIDs.length,layers:Wr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Lt,sourceID:this.source})).populate(Mt,Et,this.tileID.canonical),ae.bucketLayerIDs.push(Wr.map(function(Ie){return Ie.id})))}}}var Vr=o.mapObject(Et.glyphDependencies,function(Ie){return Object.keys(Ie).map(Number)});Object.keys(Vr).length?ve.send("getGlyphs",{uid:this.uid,stacks:Vr},function(Ie,Xt){Be||(Be=Ie,g=Xt,pr.call(he))}):g={};var yi=Object.keys(Et.iconDependencies);yi.length?ve.send("getImages",{icons:yi,source:this.source,tileID:this.tileID,type:"icons"},function(Ie,Xt){Be||(Be=Ie,ce=Xt,pr.call(he))}):ce={};var Xr=Object.keys(Et.patternDependencies);function pr(){if(Be)return Oe(Be);if(g&&ce&&xt){var Ie=new v(g),Xt=new o.ImageAtlas(ce,xt);for(var tn in Ke){var $i=Ke[tn];$i instanceof o.SymbolBucket?(S($i.layers,this.zoom,le),o.performSymbolLayout($i,g,Ie.positions,ce,Xt.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):$i.hasPattern&&($i instanceof o.LineBucket||$i instanceof o.FillBucket||$i instanceof o.FillExtrusionBucket)&&(S($i.layers,this.zoom,le),$i.addFeatures(Et,this.tileID.canonical,Xt.patternPositions))}this.status="done",Oe(null,{buckets:o.values(Ke).filter(function(ya){return!ya.isEmpty()}),featureIndex:ae,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ie.image,imageAtlas:Xt,glyphMap:this.returnDependencies?g:null,iconMap:this.returnDependencies?ce:null,glyphPositions:this.returnDependencies?Ie.positions:null})}}Xr.length?ve.send("getImages",{icons:Xr,source:this.source,tileID:this.tileID,type:"patterns"},function(Ie,Xt){Be||(Be=Ie,xt=Xt,pr.call(he))}):xt={},pr.call(this)};var N=function(Y,ne,le,ve){this.actor=Y,this.layerIndex=ne,this.availableImages=le,this.loadVectorData=ve||F,this.loading={},this.loaded={}};N.prototype.loadTile=function(Y,ne){var le=this,ve=Y.uid;this.loading||(this.loading={});var Oe=!!(Y&&Y.request&&Y.request.collectResourceTiming)&&new o.RequestPerformance(Y.request),he=this.loading[ve]=new w(Y);he.abort=this.loadVectorData(Y,function(be,ae){if(delete le.loading[ve],be||!ae)return he.status="done",le.loaded[ve]=he,ne(be);var Be=ae.rawData,g={};ae.expires&&(g.expires=ae.expires),ae.cacheControl&&(g.cacheControl=ae.cac
vendor: 4,283 bytes, line 2102
2102heControl);var ce={};if(Oe){var xt=Oe.finish();xt&&(ce.resourceTiming=JSON.parse(JSON.stringify(xt)))}he.vectorTile=ae.vectorTile,he.parse(ae.vectorTile,le.layerIndex,le.availableImages,le.actor,function(Ke,Et){if(Ke||!Et)return ne(Ke);ne(null,o.extend({rawTileData:Be.slice(0)},Et,g,ce))}),le.loaded=le.loaded||{},le.loaded[ve]=he})},N.prototype.reloadTile=function(Y,ne){var le=this,ve=this.loaded,Oe=Y.uid,he=this;if(ve&&ve[Oe]){var be=ve[Oe];be.showCollisionBoxes=Y.showCollisionBoxes;var ae=function(Be,g){var ce=be.reloadCallback;ce&&(delete be.reloadCallback,be.parse(be.vectorTile,he.layerIndex,le.availableImages,he.actor,ce)),ne(Be,g)};be.status==="parsing"?be.reloadCallback=ae:be.status==="done"&&(be.vectorTile?be.parse(be.vectorTile,this.layerIndex,this.availableImages,this.actor,ae):ae())}},N.prototype.abortTile=function(Y,ne){var le=this.loading,ve=Y.uid;le&&le[ve]&&le[ve].abort&&(le[ve].abort(),delete le[ve]),ne()},N.prototype.removeTile=function(Y,ne){var le=this.loaded,ve=Y.uid;le&&le[ve]&&delete le[ve],ne()};var U=o.window.ImageBitmap,$=function(){this.loaded={}};function G(Y,ne){if(Y.length!==0){H(Y[0],ne);for(var le=1;le<Y.length;le++)H(Y[le],!ne)}}function H(Y,ne){for(var le=0,ve=0,Oe=0,he=Y.length,be=he-1;Oe<he;be=Oe++){var ae=(Y[Oe][0]-Y[be][0])*(Y[be][1]+Y[Oe][1]),Be=le+ae;ve+=Math.abs(le)>=Math.abs(ae)?le-Be+ae:ae-Be+le,le=Be}le+ve>=0!=!!ne&&Y.reverse()}$.prototype.loadTile=function(Y,ne){var le=Y.uid,ve=Y.encoding,Oe=Y.rawImageData,he=U&&Oe instanceof U?this.getImageData(Oe):Oe,be=new o.DEMData(le,he,ve);this.loaded=this.loaded||{},this.loaded[le]=be,ne(null,be)},$.prototype.getImageData=function(Y){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Y.width,Y.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=Y.width,this.offscreenCanvas.height=Y.height,this.offscreenCanvasContext.drawImage(Y,0,0,Y.width,Y.height);var ne=this.offscreenCanvasContext.getImageData(-1,-1,Y.width+2,Y.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new o.RGBAImage({width:ne.width,height:ne.height},ne.data)},$.prototype.removeTile=function(Y){var ne=this.loaded,le=Y.uid;ne&&ne[le]&&delete ne[le]};var J=o.vectorTile.VectorTileFeature.prototype.toGeoJSON,ue=function(Y){this._feature=Y,this.extent=o.EXTENT,this.type=Y.type,this.properties=Y.tags,"id"in Y&&!isNaN(Y.id)&&(this.id=parseInt(Y.id,10))};ue.prototype.loadGeometry=function(){if(this._feature.type===1){for(var Y=[],ne=0,le=this._feature.geometry;ne<le.length;ne+=1){var ve=le[ne];Y.push([new o.Point$1(ve[0],ve[1])])}return Y}for(var Oe=[],he=0,be=this._feature.geometry;he<be.length;he+=1){for(var ae=[],Be=0,g=be[he];Be<g.length;Be+=1){var ce=g[Be];ae.push(new o.Point$1(ce[0],ce[1]))}Oe.push(ae)}return Oe},ue.prototype.toGeoJSON=function(Y,ne,le){return J.call(this,Y,ne,le)};var q=function(Y){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.EXTENT,this.length=Y.length,this._features=Y};q.prototype.feature=function(Y){return new ue(this._features[Y])};var se=o.vectorTile.VectorTileFeature,Te=Ue;function Ue(Y,ne){this.options=ne||{},this.features=Y,this.length=Y.length}function de(Y,ne){this.id=typeof Y.id=="number"?Y.id:void 0,this.type=Y.type,this.rawGeometry=Y.type===1?[Y.geometry]:Y.geometry,this.properties=Y.tags,this.extent=ne||4096}Ue.prototype.feature=function(Y){return new de(this.features[Y],this.options.extent)},de.prototype.loadGeometry=function(){var Y=this.rawGeometry;this.geometry=[];for(var ne=0;ne<Y.length;ne++){for(var le=Y[ne],ve=[],Oe=0;Oe<le.length;Oe++)ve.push(new o.Point$1(le[Oe][0],le[Oe][1]));this.geometry.push(ve)}return this.geometry},de.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Y=this.geometry,ne=1/0,le=-1/0,ve=1/0,Oe=-1/0,he=0;he<Y.length;he++)for(var be=Y[he],ae=0;ae<be.length;ae++){var Be=be[ae];ne=Math.min(ne,Be.x),le=Math.max(le,Be.x),ve=Math.min(ve,Be.y),Oe=Math.max(Oe,Be.y)}return[ne,ve,le,Oe]},de.prototype.toGeoJSON=se.prototype.toGeoJSON;var me=W,pe=Te;function W(Y){var ne=new o.pbf;return function(le,ve){for(var Oe in le.layers)ve.writeMessage(3,re,le.layers[Oe])}(Y,ne),ne.finish()}function re(Y,ne){var le;
2102ne.writeVarintField(15,Y.version||1),ne.writeStringField(1,Y.name||""),ne.writeVarintField(5,Y.extent||4096);var ve={keys:[],values:[],keycache:{},valuecache:{}};for(le=0;le<Y.length;le++)ve.feature=Y.feature(le),ne.writeMessage(2,Ee,ve);var Oe=ve.keys;for(le=0;le<Oe.length;le++)ne.writeStringField(3,Oe[le]);var he=ve.values;for(le=0;le<he.length;le++)ne.writeMessage(4,Ze,he[le])}function Ee(Y,ne){var le=Y.feature;le.id!==void 0&&ne.writeVarintField(1,le.id),ne.writeMessage(2,et,Y),ne.writeVarintField(3,le.type),ne.writeMessage(4,Ge,le)}function et(Y,ne){var le=Y.feature,ve=Y.keys,Oe=Y.values,he=Y.keycache,be=Y.valuecache;for(var ae in le.properties){var Be=he[ae];Be===void 0&&(ve.push(ae),he[ae]=Be=ve.length-1),ne.writeVarint(Be);var g=le.properties[ae],ce=typeof g;ce!=="string"&&ce!=="boolean"&&ce!=="number"&&(g=JSON.stringify(g));var xt=ce+":"+g,Ke=be[xt];Ke===void 0&&(Oe.push(g),be[xt]=Ke=Oe.length-1),ne.writeVarint(Ke)}}function _e(Y,ne){return(ne<<3)+(7&Y)}function Le(Y){return Y<<1^Y>>31}function Ge(Y,ne){for(var le=Y.loadGeometry(),ve=Y.type,Oe=0,he=0,be=le.length,ae=0;ae<be;ae++){var Be=le[ae],g=1;ve===1&&(g=Be.length),ne.writeVarint(_e(1,g));for(var ce=ve===3?Be.length-1:Be.length,xt=0;xt<ce;xt++){xt===1&&ve!==1&&ne.writeVarint(_e(2,ce-1));var Ke=Be[xt].x-Oe,Et=Be[xt].y-he;ne.writeVarint(Le(Ke)),ne.writeVarint(Le(Et)),Oe+=Ke,he+=Et}ve===3&&ne.writeVarint(_e(7,1))}}function Ze(Y,ne){var le=typeof Y;le==="string"?ne.writeStringField(1,Y):le==="boolean"?ne.writeBooleanField(7,Y):le==="number"&&(Y%1!=0?ne.writeDoubleField(3,Y):Y<0?ne.writeSVarintField(6,Y):ne.writeVarintField(5,Y))}function tt(Y,ne,le,ve){rt(Y,le,ve),rt(ne,2*le,2*ve),rt(ne,2*le+1,2*ve+1)}function rt(Y,ne,le){var ve=Y[ne];Y[ne]=Y[le],Y[le]=ve}function ut(Y,ne,le,ve){var Oe=Y-le,he=ne-ve;return Oe*Oe+he*he}me.fromVectorTileJs=W,me.fromGeojsonVt=function(Y,ne){ne=ne||{};var le={};for(var ve in Y)le[ve]=new Te(Y[ve].features,ne),le[ve].name=ve,le[ve].version=ne.version,le[ve].extent=ne.extent;return W({layers:le})},me.GeoJSONWrapper=pe;var vt=function(Y){return Y[0]},St=function(Y){return Y[1]},st=function(Y,ne,le,ve,Oe){ne===void 0&&(ne=vt),le===void 0&&(le=St),ve===void 0&&(ve=64),Oe===void 0&&(Oe=Float64Array),this.nodeSize=ve,this.points=Y;for(var he=Y.length<65536?Uint16Array:Uint32Array,be=this.ids=new he(Y.length),ae=this.coords=new Oe(2*Y.length),Be=0;Be<Y.length;Be++)be[Be]=Be,ae[2*Be]=ne(Y[Be]),ae[2*Be+1]=le(Y[Be]);(function g(ce,xt,Ke,Et,Pt,Ot){if(!(Pt-Et<=Ke)){var ht=Et+Pt>>1;(function Lt(Mt,Ht,Ur,Qt,en,cn){for(;en>Qt;){if(en-Qt>600){var Wr=en-Qt+1,Jr=Ur-Qt+1,Vr=Math.log(Wr),yi=.5*Math.exp(2*Vr/3),Xr=.5*Math.sqrt(Vr*yi*(Wr-yi)/Wr)*(Jr-Wr/2<0?-1:1);Lt(Mt,Ht,Ur,Math.max(Qt,Math.floor(Ur-Jr*yi/Wr+Xr)),Math.min(en,Math.floor(Ur+(Wr-Jr)*yi/Wr+Xr)),cn)}var pr=Ht[2*Ur+cn],Ie=Qt,Xt=en;for(tt(Mt,Ht,Qt,Ur),Ht[2*en+cn]>pr&&tt(Mt,Ht,Qt,en);Ie<Xt;){for(tt(Mt,Ht,Ie,Xt),Ie++,Xt--;Ht[2*Ie+cn]<pr;)Ie++;for(;Ht[2*Xt+cn]>pr;)Xt--}Ht[2*Qt+cn]===pr?tt(Mt,Ht,Qt,Xt):tt(Mt,Ht,++Xt,en),Xt<=Ur&&(Qt=Xt+1),Ur<=Xt&&(en=Xt-1)}})(ce,xt,ht,Et,Pt,Ot%2),g(ce,xt,Ke,Et,ht-1,Ot+1),g(ce,xt,Ke,ht+1,Pt,Ot+1)}})(be,ae,ve,0,be.length-1,0)};st.prototype.range=function(Y,ne,le,ve){return function(Oe,he,be,ae,Be,g,ce){for(var xt,Ke,Et=[0,Oe.length-1,0],Pt=[];Et.length;){var Ot=Et.pop(),ht=Et.pop(),Lt=Et.pop();if(ht-Lt<=ce)for(var Mt=Lt;Mt<=ht;Mt++)Ke=he[2*Mt+1],(xt=he[2*Mt])>=be&&xt<=Be&&Ke>=ae&&Ke<=g&&Pt.push(Oe[Mt]);else{var Ht=Math.floor((Lt+ht)/2);Ke=he[2*Ht+1],(xt=he[2*Ht])>=be&&xt<=Be&&Ke>=ae&&Ke<=g&&Pt.push(Oe[Ht]);var Ur=(Ot+1)%2;(Ot===0?be<=xt:ae<=Ke)&&(Et.push(Lt),Et.push(Ht-1),Et.push(Ur)),(Ot===0?Be>=xt:g>=Ke)&&(Et.push(Ht+1),Et.push(ht),Et.push(Ur))}}return Pt}(this.ids,this.coords,Y,ne,le,ve,this.nodeSize)},st.prototype.within=function(Y,ne,le){return function(ve,Oe,he,be,ae,Be){for(var g=[0,ve.length-1,0],ce=[],xt=ae*ae;g.length;){var Ke=g.pop(),Et=g.pop(),Pt=g.pop();if(Et-Pt<=Be)for(var Ot=Pt;Ot<=Et;Ot++)ut(Oe[2*Ot],Oe[2*Ot+1],he,be)<=xt&&ce.push(ve[Ot]);else{var ht=Math.floor((Pt+Et)/2),Lt=Oe[2*ht],Mt=Oe[2*ht+1];ut(Lt,Mt,he,be)<=xt&&ce.push(ve[ht]);var Ht=(Ke+1)%2;(Ke===0?he-ae<=Lt:be-ae<=Mt)&&(g.push(Pt),g.push(ht-1),g.push(Ht)),(Ke===0?he+ae>=Lt:be+ae>=Mt)&&(g.push(ht+1),g.push(Et),g.push(Ht))}}return ce}(this.ids,this.coords,Y,ne,le,this.nodeSize)};var dr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(Y){return Y}},er=function(Y){this.options=Vn(Object.create(dr),Y),this.trees=new Array(this.options.maxZoom+1)};function Kt(Y,ne,le,ve,Oe){return{x:Y,y:ne,zoom:1/0,id:le,parentId:-1,numPoints:ve,properties:Oe}}function Nt(Y,ne){var le=Y.geometry.coordinates,ve=le[1];return{x:Pr(le[0]),y:xr(ve),zoom:1/0,index:ne,parentId:-1}}function Ar(Y){return{type:"Feature",id:Y.id,properties:ln(Y),geometry:{type:"Point",coordinates:[(ve=Y.x,360*(ve-.5)),(ne=Y.y,le=(180-360*ne)*Math.PI/180,360*Math.atan(Math.exp(le))/Math.PI-90)]}};var ne,le,ve}function ln(Y){var ne=Y.numPoints,le=ne>=1e4?Math.round(ne/1e3)+"k":ne>=1e3?Math.round(ne/100)/10+"k":ne;return Vn(Vn({},Y.properties),{cluster:!0,cluster_id:Y.id,point_count:ne,point_count_abbreviated:le})}function Pr(Y){return Y/360+.5}function xr(Y){var ne=Math.sin(Y*Math.PI/180),le=.5-.25*Math.log((1+ne)/(1-ne))/Math.PI;return le<0?0:le>1?1:le}function Vn(Y,ne){for(var le in ne)Y[le]=ne[le];return Y}function _r(Y){return Y.x}function yr(Y){return Y.y}function un(Y,ne,le,ve,Oe,he){var be=Oe-le,ae=he-ve;if(be!==0||ae!==0){var Be=((Y-le)*be+(ne-ve)*ae)/(be*be+ae*ae);Be>1?(le=Oe,ve=he):Be>0&&(le+=be*Be,ve+=ae*Be)}return(be=Y-le)*be+(ae=ne-ve)*ae}function Dr(Y,ne,le,ve){var Oe={id:Y===void 0?null:Y,type:ne,geometry:le,tags:ve,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(he){var be=he.geometry,ae=he.type;if(ae==="Point"||ae==="MultiPoint"||ae==="LineString")ci(he,be);else if(ae==="Polygon"||ae==="MultiLineString")for(var Be=0;Be<be.length;Be++)ci(he,be[Be]);else if(ae==="MultiPolygon")for(Be=0;Be<be.length;Be++)for(var g=0;g<be[Be].length;g++)ci(he,be[Be][g])}(Oe),Oe}function ci(Y,ne){for(var le=0;le<ne.length;le+=3)Y.minX=Math.min(Y.minX,ne[le]),Y.minY=Math.min(Y.minY,ne[le+1]),Y.maxX=Math.max(Y.maxX,ne[le]),Y.maxY=Math.max(Y.maxY,ne[le+1])}function Yn(Y,ne,le,ve){if(ne.geometry){var Oe=ne.geometry.coordinates,he=ne.geometry.type,be=Math.pow(le.tolerance/((1<<le.maxZoom)*le.extent),2),ae=[],Be=ne.id;if(le.promoteId?Be=ne.properties[le.promoteId]:le.generateId&&(Be=ve||0),he==="Point")mn(Oe,ae);else if(he==="MultiPoint")for(var g=0;g<Oe.length;g++)mn(Oe[g],ae);else if(he==="LineString")ti(Oe,ae,be,!1);else if(he==="MultiLineString"){if(le.lineMetrics){for(g=0;g<Oe.length;g++)ti(Oe[g],ae=[],be,!1),Y.push(Dr(Be,"LineString",ae,ne.properties));return}Hn(Oe,ae,be,!1)}else if(he==="Polygon")Hn(Oe,ae,be,!0);else{if(he!=="MultiPolygon"){if(he==="GeometryCollection"){for(g=0;g<ne.geometry.geometries.length;g++)Yn(Y,{id:Be,geometry:ne.geometry.geometries[g],properties:ne.properties},le,ve);return}throw new Error("Input data is not a valid GeoJSON object.")}for(g=0;g<Oe.length;g++){var ce=[];Hn(Oe[g],ce,be,!0),ae.push(ce)}}Y.push(Dr(Be,he,ae,ne.properties))}}function mn(Y,ne){ne.push(Bn(Y[0])),ne.push(Zn(Y[1])),ne.push(0)}function ti(Y,ne,le,ve){for(var Oe,he,be=0,ae=0;ae<Y.length;ae++){var Be=Bn(Y[ae][0]),g=Zn(Y[ae][1]);
vendor: 2,443 bytes, line 2102
2102ne.push(Be),ne.push(g),ne.push(0),ae>0&&(be+=ve?(Oe*g-Be*he)/2:Math.sqrt(Math.pow(Be-Oe,2)+Math.pow(g-he,2))),Oe=Be,he=g}var ce=ne.length-3;ne[2]=1,function xt(Ke,Et,Pt,Ot){for(var ht,Lt=Ot,Mt=Pt-Et>>1,Ht=Pt-Et,Ur=Ke[Et],Qt=Ke[Et+1],en=Ke[Pt],cn=Ke[Pt+1],Wr=Et+3;Wr<Pt;Wr+=3){var Jr=un(Ke[Wr],Ke[Wr+1],Ur,Qt,en,cn);if(Jr>Lt)ht=Wr,Lt=Jr;else if(Jr===Lt){var Vr=Math.abs(Wr-Mt);Vr<Ht&&(ht=Wr,Ht=Vr)}}Lt>Ot&&(ht-Et>3&&xt(Ke,Et,ht,Ot),Ke[ht+2]=Lt,Pt-ht>3&&xt(Ke,ht,Pt,Ot))}(ne,0,ce,le),ne[ce+2]=1,ne.size=Math.abs(be),ne.start=0,ne.end=ne.size}function Hn(Y,ne,le,ve){for(var Oe=0;Oe<Y.length;Oe++){var he=[];ti(Y[Oe],he,le,ve),ne.push(he)}}function Bn(Y){return Y/360+.5}function Zn(Y){var ne=Math.sin(Y*Math.PI/180),le=.5-.25*Math.log((1+ne)/(1-ne))/Math.PI;return le<0?0:le>1?1:le}function Vt(Y,ne,le,ve,Oe,he,be,ae){if(ve/=ne,he>=(le/=ne)&&be<ve)return Y;if(be<le||he>=ve)return null;for(var Be=[],g=0;g<Y.length;g++){var ce=Y[g],xt=ce.geometry,Ke=ce.type,Et=Oe===0?ce.minX:ce.minY,Pt=Oe===0?ce.maxX:ce.maxY;if(Et>=le&&Pt<ve)Be.push(ce);else if(!(Pt<le||Et>=ve)){var Ot=[];if(Ke==="Point"||Ke==="MultiPoint")mr(xt,Ot,le,ve,Oe);else if(Ke==="LineString")Rr(xt,Ot,le,ve,Oe,!1,ae.lineMetrics);else if(Ke==="MultiLineString")_i(xt,Ot,le,ve,Oe,!1);else if(Ke==="Polygon")_i(xt,Ot,le,ve,Oe,!0);else if(Ke==="MultiPolygon")for(var ht=0;ht<xt.length;ht++){var Lt=[];_i(xt[ht],Lt,le,ve,Oe,!0),Lt.length&&Ot.push(Lt)}if(Ot.length){if(ae.lineMetrics&&Ke==="LineString"){for(ht=0;ht<Ot.length;ht++)Be.push(Dr(ce.id,Ke,Ot[ht],ce.tags));continue}Ke!=="LineString"&&Ke!=="MultiLineString"||(Ot.length===1?(Ke="LineString",Ot=Ot[0]):Ke="MultiLineString"),Ke!=="Point"&&Ke!=="MultiPoint"||(Ke=Ot.length===3?"Point":"MultiPoint"),Be.push(Dr(ce.id,Ke,Ot,ce.tags))}}}return Be.length?Be:null}function mr(Y,ne,le,ve,Oe){for(var he=0;he<Y.length;he+=3){var be=Y[he+Oe];be>=le&&be<=ve&&(ne.push(Y[he]),ne.push(Y[he+1]),ne.push(Y[he+2]))}}function Rr(Y,ne,le,ve,Oe,he,be){for(var ae,Be,g=nn(Y),ce=Oe===0?kt:$t,xt=Y.start,Ke=0;Ke<Y.length-3;Ke+=3){var Et=Y[Ke],Pt=Y[Ke+1],Ot=Y[Ke+2],ht=Y[Ke+3],Lt=Y[Ke+4],Mt=Oe===0?Et:Pt,Ht=Oe===0?ht:Lt,Ur=!1;be&&(ae=Math.sqrt(Math.pow(Et-ht,2)+Math.pow(Pt-Lt,2))),Mt<le?Ht>le&&(Be=ce(g,Et,Pt,ht,Lt,le),be&&(g.start=xt+ae*Be)):Mt>ve?Ht<ve&&(Be=ce(g,Et,Pt,ht,Lt,ve),be&&(g.start=xt+ae*Be)):Me(g,Et,Pt,Ot),Ht<le&&Mt>=le&&(Be=ce(g,Et,Pt,ht,Lt,le),Ur=!0),Ht>ve&&Mt<=ve&&(Be=ce(g,Et,Pt,ht,Lt,ve),Ur=!0),!he&&Ur&&(be&&(g.end=xt+ae*Be),ne.pu
2102sh(g),g=nn(Y)),be&&(xt+=ae)}var Qt=Y.length-3;Et=Y[Qt],Pt=Y[Qt+1],Ot=Y[Qt+2],(Mt=Oe===0?Et:Pt)>=le&&Mt<=ve&&Me(g,Et,Pt,Ot),Qt=g.length-3,he&&Qt>=3&&(g[Qt]!==g[0]||g[Qt+1]!==g[1])&&Me(g,g[0],g[1],g[2]),g.length&&ne.push(g)}function nn(Y){var ne=[];return ne.size=Y.size,ne.start=Y.start,ne.end=Y.end,ne}function _i(Y,ne,le,ve,Oe,he){for(var be=0;be<Y.length;be++)Rr(Y[be],ne,le,ve,Oe,he,!1)}function Me(Y,ne,le,ve){Y.push(ne),Y.push(le),Y.push(ve)}function kt(Y,ne,le,ve,Oe,he){var be=(he-ne)/(ve-ne);return Y.push(he),Y.push(le+(Oe-le)*be),Y.push(1),be}function $t(Y,ne,le,ve,Oe,he){var be=(he-le)/(Oe-le);return Y.push(ne+(ve-ne)*be),Y.push(he),Y.push(1),be}function lr(Y,ne){for(var le=[],ve=0;ve<Y.length;ve++){var Oe,he=Y[ve],be=he.type;if(be==="Point"||be==="MultiPoint"||be==="LineString")Oe=Ye(he.geometry,ne);else if(be==="MultiLineString"||be==="Polygon"){Oe=[];for(var ae=0;ae<he.geometry.length;ae++)Oe.push(Ye(he.geometry[ae],ne))}else if(be==="MultiPolygon")for(Oe=[],ae=0;ae<he.geometry.length;ae++){for(var Be=[],g=0;g<he.geometry[ae].length;g++)Be.push(Ye(he.geometry[ae][g],ne));Oe.push(Be)}le.push(Dr(he.id,be,Oe,he.tags))}return le}function Ye(Y,ne){var le=[];le.size=Y.size,Y.start!==void 0&&(le.start=Y.start,le.end=Y.end);for(var ve=0;ve<Y.length;ve+=3)le.push(Y[ve]+ne,Y[ve+1],Y[ve+2]);return le}function Rt(Y,ne){if(Y.transformed)return Y;var le,ve,Oe,he=1<<Y.z,be=Y.x,ae=Y.y;for(le=0;le<Y.features.length;le++){var Be=Y.features[le],g=Be.geometry,ce=Be.type;if(Be.geometry=[],ce===1)for(ve=0;ve<g.length;ve+=2)Be.geometry.push(Ae(g[ve],g[ve+1],ne,he,be,ae));else for(ve=0;ve<g.length;ve++){var xt=[];for(Oe=0;Oe<g[ve].length;Oe+=2)xt.push(Ae(g[ve][Oe],g[ve][Oe+1],ne,he,be,ae));Be.geometry.push(xt)}}return Y.transformed=!0,Y}function Ae(Y,ne,le,ve,Oe,he){return[Math.round(le*(Y*ve-Oe)),Math.round(le*(ne*ve-he))]}function Gt(Y,ne,le,ve,Oe){for(var he=ne===Oe.maxZoom?0:Oe.tolerance/((1<<ne)*Oe.extent),be={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:le,y:ve,z:ne,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},ae=0;ae<Y.length;ae++){be.numFeatures++,Tt(be,Y[ae],he,Oe);var Be=Y[ae].minX,g=Y[ae].minY,ce=Y[ae].maxX,xt=Y[ae].maxY;Be<be.minX&&(be.minX=Be),g<be.minY&&(be.minY=g),ce>be.maxX&&(be.maxX=ce),xt>be.maxY&&(be.maxY=xt)}return be}function Tt(Y,ne,le,ve){var Oe=ne.geometry,he=ne.type,be=[];if(he==="Point"||he==="MultiPoint")for(var ae=0;ae<Oe.length;ae+=3)be.push(Oe[ae]),be.push(Oe[ae+1]),Y.numPoints++,Y.numSimplified++;else if(he==="LineString")j(be,Oe,Y,le,!1,!1);else if(he==="MultiLineString"||he==="Polygon")for(ae=0;ae<Oe.length;ae++)j(be,Oe[ae],Y,le,he==="Polygon",ae===0);else if(he==="MultiPolygon")for(var Be=0;Be<Oe.length;Be++){var g=Oe[Be];for(ae=0;ae<g.length;ae++)j(be,g[ae],Y,le,!0,ae===0)}if(be.length){var ce=ne.tags||null;if(he==="LineString"&&ve.lineMetrics){for(var xt in ce={},ne.tags)ce[xt]=ne.tags[xt];ce.mapbox_clip_start=Oe.start/Oe.size,ce.mapbox_clip_end=Oe.end/Oe.size}var Ke={geometry:be,type:he==="Polygon"||he==="MultiPolygon"?3:he==="LineString"||he==="MultiLineString"?2:1,tags:ce};ne.id!==null&&(Ke.id=ne.id),Y.features.push(Ke)}}function j(Y,ne,le,ve,Oe,he){var be=ve*ve;if(ve>0&&ne.size<(Oe?be:ve))le.numPoints+=ne.length/3;else{for(var ae=[],Be=0;Be<ne.length;Be+=3)(ve===0||ne[Be+2]>be)&&(le.numSimplified++,ae.push(ne[Be]),ae.push(ne[Be+1])),le.numPoints++;Oe&&function(g,ce){for(var xt=0,Ke=0,Et=g.length,Pt=Et-2;Ke<Et;Pt=Ke,Ke+=2)xt+=(g[Ke]-g[Pt])*(g[Ke+1]+g[Pt+1]);if(xt>0===ce)for(Ke=0,Et=g.length;Ke<Et/2;Ke+=2){var Ot=g[Ke],ht=g[Ke+1];g[Ke]=g[Et-2-Ke],g[Ke+1]=g[Et-1-Ke],g[Et-2-Ke]=Ot,g[Et-1-Ke]=ht}}(ae,he),Y.push(ae)}}function bt(Y,ne){var le=(ne=this.options=function(Oe,he){for(var be in he)Oe[be]=he[be];return Oe}(Object.create(this.options),ne)).debug;if(le&&console.time("preprocess data"),ne.maxZoom<0||ne.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(ne.promoteId&&ne.generateId)throw new Error("promoteId and generateId cannot be used together.");var ve=function(Oe,he){var be=[];if(Oe.type==="FeatureCollection")for(var ae=0;ae<Oe.features.length;ae++)Yn(be,Oe.features[ae],he,ae);else Yn(be,Oe.type==="Feature"?Oe:{geometry:Oe},he);return be}(Y,ne);this.tiles={},this.tileCoords=[],le&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",ne.indexMaxZoom,ne.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(ve=function(Oe,he){var be=he.buffer/he.extent,ae=Oe,Be=Vt(Oe,1,-1-be,be,0,-1,2,he),g=Vt(Oe,1,1-be,2+be,0,-1,2,he);return(Be||g)&&(ae=Vt(Oe,1,-be,1+be,0,-1,2,he)||[],Be&&(ae=lr(Be,1).concat(ae)),g&&(ae=ae.concat(lr(g,-1)))),ae}(ve,ne)).length&&this.splitTile(ve,0,0,0),le&&(ve.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 Bt(Y,ne,le){return 32*((1<<Y)*le+ne)+Y}function Ce(Y,ne){var le=Y.tileID.canonical;if(!this._geoJSONIndex)return ne(null,null);var ve=this._geoJSONIndex.getTile(le.z,le.x,le.y);if(!ve)return ne(null,null);var Oe=new q(ve.features),he=me(Oe);he.byteOffset===0&&he.byteLength===he.buffer.byteLength||(he=new Uint8Array(he)),ne(null,{vectorTile:Oe,rawData:he.buffer})}er.prototype.load=function(Y){var ne=this.options,le=ne.log,ve=ne.minZoom,Oe=ne.maxZoom,he=ne.nodeSize;le&&console.time("total time");var be="prepare "+Y.length+" points";le&&console.time(be),this.points=Y;for(var ae=[],Be=0;Be<Y.length;Be++)Y[Be].geometry&&ae.push(Nt(Y[Be],Be));this.trees[Oe+1]=new st(ae,_r,yr,he,Float32Array),le&&console.timeEnd(be);for(var g=Oe;g>=ve;g--){var ce=+Date.now();ae=this._cluster(ae,g),this.trees[g]=new st(ae,_r,yr,he,Float32Array),le&&console.log("z%d: %d clusters in %dms",g,ae.length,+Date.now()-ce)}return le&&console.timeEnd("total time"),this},er.prototype.getClusters=function(Y,ne){var le=((Y[0]+180)%360+360)%360-180,ve=Math.max(-90,Math.min(90,Y[1])
vendor: 5,804 bytes, line 2102
2102),Oe=Y[2]===180?180:((Y[2]+180)%360+360)%360-180,he=Math.max(-90,Math.min(90,Y[3]));if(Y[2]-Y[0]>=360)le=-180,Oe=180;else if(le>Oe){var be=this.getClusters([le,ve,180,he],ne),ae=this.getClusters([-180,ve,Oe,he],ne);return be.concat(ae)}for(var Be=this.trees[this._limitZoom(ne)],g=[],ce=0,xt=Be.range(Pr(le),xr(he),Pr(Oe),xr(ve));ce<xt.length;ce+=1){var Ke=Be.points[xt[ce]];g.push(Ke.numPoints?Ar(Ke):this.points[Ke.index])}return g},er.prototype.getChildren=function(Y){var ne=this._getOriginId(Y),le=this._getOriginZoom(Y),ve="No cluster with the specified id.",Oe=this.trees[le];if(!Oe)throw new Error(ve);var he=Oe.points[ne];if(!he)throw new Error(ve);for(var be=this.options.radius/(this.options.extent*Math.pow(2,le-1)),ae=[],Be=0,g=Oe.within(he.x,he.y,be);Be<g.length;Be+=1){var ce=Oe.points[g[Be]];ce.parentId===Y&&ae.push(ce.numPoints?Ar(ce):this.points[ce.index])}if(ae.length===0)throw new Error(ve);return ae},er.prototype.getLeaves=function(Y,ne,le){var ve=[];return this._appendLeaves(ve,Y,ne=ne||10,le=le||0,0),ve},er.prototype.getTile=function(Y,ne,le){var ve=this.trees[this._limitZoom(Y)],Oe=Math.pow(2,Y),he=this.options,be=he.radius/he.extent,ae=(le-be)/Oe,Be=(le+1+be)/Oe,g={features:[]};return this._addTileFeatures(ve.range((ne-be)/Oe,ae,(ne+1+be)/Oe,Be),ve.points,ne,le,Oe,g),ne===0&&this._addTileFeatures(ve.range(1-be/Oe,ae,1,Be),ve.points,Oe,le,Oe,g),ne===Oe-1&&this._addTileFeatures(ve.range(0,ae,be/Oe,Be),ve.points,-1,le,Oe,g),g.features.length?g:null},er.prototype.getClusterExpansionZoom=function(Y){for(var ne=this._getOriginZoom(Y)-1;ne<=this.options.maxZoom;){var le=this.getChildren(Y);if(ne++,le.length!==1)break;Y=le[0].properties.cluster_id}return ne},er.prototype._appendLeaves=function(Y,ne,le,ve,Oe){for(var he=0,be=this.getChildren(ne);he<be.length;he+=1){var ae=be[he],Be=ae.properties;if(Be&&Be.cluster?Oe+Be.point_count<=ve?Oe+=Be.point_count:Oe=this._appendLeaves(Y,Be.cluster_id,le,ve,Oe):Oe<ve?Oe++:Y.push(ae),Y.length===le)break}return Oe},er.prototype._addTileFeatures=function(Y,ne,le,ve,Oe,he){for(var be=0,ae=Y;be<ae.length;be+=1){var Be=ne[ae[be]],g=Be.numPoints,ce={type:1,geometry:[[Math.round(this.options.extent*(Be.x*Oe-le)),Math.round(this.options.extent*(Be.y*Oe-ve))]],tags:g?ln(Be):this.points[Be.index].properties},xt=void 0;g?xt=Be.id:this.options.generateId?xt=Be.index:this.points[Be.index].id&&(xt=this.points[Be.index].id),xt!==void 0&&(ce.id=xt),he.features.push(ce)}},er.prototype._limitZoom=function(Y){return Math.max(this.options.minZoom,Math.min(+Y,this.options.maxZoom+1))},er.prototype._cluster=function(Y,ne){for(var le=[],ve=this.options,Oe=ve.reduce,he=ve.minPoints,be=ve.radius/(ve.extent*Math.pow(2,ne)),ae=0;ae<Y.length;ae++){var Be=Y[ae];if(!(Be.zoom<=ne)){Be.zoom=ne;for(var g=this.trees[ne+1],ce=g.within(Be.x,Be.y,be),xt=Be.numPoints||1,Ke=xt,Et=0,Pt=ce;Et<Pt.length;Et+=1){var Ot=g.points[Pt[Et]];Ot.zoom>ne&&(Ke+=Ot.numPoints||1)}if(Ke>=he){for(var ht=Be.x*xt,Lt=Be.y*xt,Mt=Oe&&xt>1?this._map(Be,!0):null,Ht=(ae<<5)+(ne+1)+this.points.length,Ur=0,Qt=ce;Ur<Qt.length;Ur+=1){var en=g.points[Qt[Ur]];if(!(en.zoom<=ne)){en.zoom=ne;var cn=en.numPoints||1;ht+=en.x*cn,Lt+=en.y*cn,en.parentId=Ht,Oe&&(Mt||(Mt=this._map(Be,!0)),Oe(Mt,this._map(en)))}}Be.parentId=Ht,le.push(Kt(ht/Ke,Lt/Ke,Ht,Ke,Mt))}else if(le.push(Be),Ke>1)for(var Wr=0,Jr=ce;Wr<Jr.length;Wr+=1){var Vr=g.points[Jr[Wr]];Vr.zoom<=ne||(Vr.zoom=ne,le.push(Vr))}}}return le},er.prototype._getOriginId=function(Y){return Y-this.points.length>>5},er.prototype._getOriginZoom=function(Y){return(Y-this.points.length)%32},er.prototype._map=function(Y,ne){if(Y.numPoints)return ne?Vn({},Y.properties):Y.properties;var le=this.points[Y.index].properties,ve=this.options.map(le);return ne&&ve===le?Vn({},ve):ve},bt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},bt.prototype.splitTile=function(Y,ne,le,ve,Oe,he,be){for(var ae=[Y,ne,le,ve],Be=this.options,g=Be.debug;ae.length;){ve=ae.pop(),le=ae.pop(),ne=ae.pop(),Y=ae.pop();var ce=1<<ne,xt=Bt(ne,le,ve),Ke=this.tiles[xt];if(!Ke&&(g>1&&console.time("creation"),Ke=this.tiles[xt]=Gt(Y,ne,le,ve,Be),this.tileCoords.push({z:ne,x:le,y:ve}),g)){g>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ne,le,ve,Ke.numFeatures,Ke.numPoints,Ke.numSimplified),console.timeEnd("creation"));var Et="z"+ne;this.stats[Et]=(this.stats[Et]||0)+1,this.total++}if(Ke.source=Y,Oe){if(ne===Be.maxZoom||ne===Oe)continue;var Pt=1<<Oe-ne;if(le!==Math.floor(he/Pt)||ve!==Math.floor(be/Pt))continue}else if(ne===Be.indexMaxZoom||Ke.numPoints<=Be.indexMaxPoints)continue;if(Ke.source=null,Y.length!==0){g>1&&console.time("clipping");var Ot,ht,Lt,Mt,Ht,Ur,Qt=.5*Be.buffer/Be.extent,en=.5-Qt,cn=.5+Qt,Wr=1+Qt;Ot=ht=Lt=Mt=null,Ht=Vt(Y,ce,le-Qt,le+cn,0,Ke.minX,Ke.maxX,Be),Ur=Vt(Y,ce,le+en,le+Wr,0,Ke.minX,Ke.maxX,Be),Y=null,Ht&&(Ot=Vt(Ht,ce,ve-Qt,ve+cn,1,Ke.minY,Ke.maxY,Be),ht=Vt(Ht,ce,ve+en,ve+Wr,1,Ke.minY,Ke.maxY,Be),Ht=null),Ur&&(Lt=Vt(Ur,ce,ve-Qt,ve+cn,1,Ke.minY,Ke.maxY,Be),Mt=Vt(Ur,ce,ve+en,ve+Wr,1,Ke.minY,Ke.maxY,Be),Ur=null),g>1&&console.timeEnd("clipping"),ae.push(Ot||[],ne+1,2*le,2*ve),ae.push(ht||[],ne+1,2*le,2*ve+1),ae.push(Lt||[],ne+1,2*le+1,2*ve),ae.push(Mt||[],ne+1,2*le+1,2*ve+1)}}},bt.prototype.getTile=function(Y,ne,le){var ve=this.options,Oe=ve.extent,he=ve.debug;if(Y<0||Y>24)return null;var be=1<<Y,ae=Bt(Y,ne=(ne%be+be)%be,le);if(this.tiles[ae])return Rt(this.tiles[ae],Oe);he>1&&console.log("drilling down to z%d-%d-%d",Y,ne,le);for(var Be,g=Y,ce=ne,xt=le;!Be&&g>0;)g--,ce=Math.floor(ce/2),xt=Math.floor(xt/2),Be=this.tiles[Bt(g,ce,xt)];return Be&&Be.source?(he>1&&console.log("found parent tile z%d-%d-%d",g,ce,xt),he>1&&console.time("drilling down"),this.splitTile(Be.source,g,ce,xt,Y,
2102ne,le),he>1&&console.timeEnd("drilling down"),this.tiles[ae]?Rt(this.tiles[ae],Oe):null):null};var Je=function(Y){function ne(le,ve,Oe,he){Y.call(this,le,ve,Oe,Ce),he&&(this.loadGeoJSON=he)}return Y&&(ne.__proto__=Y),(ne.prototype=Object.create(Y&&Y.prototype)).constructor=ne,ne.prototype.loadData=function(le,ve){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=ve,this._pendingLoadDataParams=le,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},ne.prototype._loadData=function(){var le=this;if(this._pendingCallback&&this._pendingLoadDataParams){var ve=this._pendingCallback,Oe=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var he=!!(Oe&&Oe.request&&Oe.request.collectResourceTiming)&&new o.RequestPerformance(Oe.request);this.loadGeoJSON(Oe,function(be,ae){if(be||!ae)return ve(be);if(typeof ae!="object")return ve(new Error("Input data given to '"+Oe.source+"' is not a valid GeoJSON object."));(function Ke(Et,Pt){var Ot,ht=Et&&Et.type;if(ht==="FeatureCollection")for(Ot=0;Ot<Et.features.length;Ot++)Ke(Et.features[Ot],Pt);else if(ht==="GeometryCollection")for(Ot=0;Ot<Et.geometries.length;Ot++)Ke(Et.geometries[Ot],Pt);else if(ht==="Feature")Ke(Et.geometry,Pt);else if(ht==="Polygon")G(Et.coordinates,Pt);else if(ht==="MultiPolygon")for(Ot=0;Ot<Et.coordinates.length;Ot++)G(Et.coordinates[Ot],Pt);return Et})(ae,!0);try{if(Oe.filter){var Be=o.createExpression(Oe.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Be.result==="error")throw new Error(Be.value.map(function(Ke){return Ke.key+": "+Ke.message}).join(", "));var g=ae.features.filter(function(Ke){return Be.value.evaluate({zoom:0},Ke)});ae={type:"FeatureCollection",features:g}}le._geoJSONIndex=Oe.cluster?new er(function(Ke){var Et=Ke.superclusterOptions,Pt=Ke.clusterProperties;if(!Pt||!Et)return Et;for(var Ot={},ht={},Lt={accumulated:null,zoom:0},Mt={properties:null},Ht=Object.keys(Pt),Ur=0,Qt=Ht;Ur<Qt.length;Ur+=1){var en=Qt[Ur],cn=Pt[en],Wr=cn[0],Jr=o.createExpression(cn[1]),Vr=o.createExpression(typeof Wr=="string"?[Wr,["accumulated"],["get",en]]:Wr);Ot[en]=Jr.value,ht[en]=Vr.value}return Et.map=function(yi){Mt.properties=yi;for(var Xr={},pr=0,Ie=Ht;pr<Ie.length;pr+=1){var Xt=Ie[pr];Xr[Xt]=Ot[Xt].evaluate(Lt,Mt)}return Xr},Et.reduce=function(yi,Xr){Mt.properties=Xr;for(var pr=0,Ie=Ht;pr<Ie.length;pr+=1){var Xt=Ie[pr];Lt.accumulated=yi[Xt],yi[Xt]=ht[Xt].evaluate(Lt,Mt)}},Et}(Oe)).load(ae.features):function(Ke,Et){return new bt(Ke,Et)}(ae,Oe.geojsonVtOptions)}catch(Ke){return ve(Ke)}le.loaded={};var ce={};if(he){var xt=he.finish();xt&&(ce.resourceTiming={},ce.resourceTiming[Oe.source]=JSON.parse(JSON.stringify(xt)))}ve(null,ce)})}},ne.prototype.coalesce=function(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())},ne.prototype.reloadTile=function(le,ve){var Oe=this.loaded;return Oe&&Oe[le.uid]?Y.prototype.reloadTile.call(this,le,ve):this.loadTile(le,ve)},ne.prototype.loadGeoJSON=function(le,ve){if(le.request)o.getJSON(le.request,ve);else{if(typeof le.data!="string")return ve(new Error("Input data given to '"+le.source+"' is not a valid GeoJSON object."));try{return ve(null,JSON.parse(le.data))}catch{return ve(new Error("Input data given to '"+le.source+"' is not a valid GeoJSON object."))}}},ne.prototype.removeSource=function(le,ve){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),ve()},ne.prototype.getClusterExpansionZoom=function(le,ve){try{ve(null,this._geoJSONIndex.getClusterExpansionZoom(le.clusterId))}catch(Oe){ve(Oe)}},ne.prototype.getClusterChildren=function(le,ve){try{ve(null,this._geoJSONIndex.getChildren(le.clusterId))}catch(Oe){ve(Oe)}},ne.prototype.getClusterLeaves=function(le,ve){try{ve(null,this._geoJSONIndex.getLeaves(le.clusterId,le.limit,le.offset))}catch(Oe){ve(Oe)}},ne}(N),lt=function(Y){var ne=this;this.self=Y,this.actor=new o.Actor(Y,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:N,geojson:Je},this.workerSources={},this.demWorkerSources={}
2102,this.self.registerWorkerSource=function(le,ve){if(ne.workerSourceTypes[le])throw new Error('Worker source with name "'+le+'" already registered.');ne.workerSourceTypes[le]=ve},this.self.registerRTLTextPlugin=function(le){if(o.plugin.isParsed())throw new Error("RTL text plugin already registered.");o.plugin.applyArabicShaping=le.applyArabicShaping,o.plugin.processBidirectionalText=le.processBidirectionalText,o.plugin.processStyledBidirectionalText=le.processStyledBidirectionalText}};return lt.prototype.setReferrer=function(Y,ne){this.referrer=ne},lt.prototype.setImages=function(Y,ne,le){for(var ve in this.availableImages[Y]=ne,this.workerSources[Y]){var Oe=this.workerSources[Y][ve];for(var he in Oe)Oe[he].availableImages=ne}le()},lt.prototype.setLayers=function(Y,ne,le){this.getLayerIndex(Y).replace(ne),le()},lt.prototype.updateLayers=function(Y,ne,le){this.getLayerIndex(Y).update(ne.layers,ne.removedIds),le()},lt.prototype.loadTile=function(Y,ne,le){this.getWorkerSource(Y,ne.type,ne.source).loadTile(ne,le)},lt.prototype.loadDEMTile=function(Y,ne,le){this.getDEMWorkerSource(Y,ne.source).loadTile(ne,le)},lt.prototype.reloadTile=function(Y,ne,le){this.getWorkerSource(Y,ne.type,ne.source).reloadTile(ne,le)},lt.prototype.abortTile=function(Y,ne,le){this.getWorkerSource(Y,ne.type,ne.source).abortTile(ne,le)},lt.prototype.removeTile=function(Y,ne,le){this.getWorkerSource(Y,ne.type,ne.source).removeTile(ne,le)},lt.prototype.removeDEMTile=function(Y,ne){this.getDEMWorkerSource(Y,ne.source).removeTile(ne)},lt.prototype.removeSource=function(Y,ne,le){if(this.workerSources[Y]&&this.workerSources[Y][ne.type]&&this.workerSources[Y][ne.type][ne.source]){var ve=this.workerSources[Y][ne.type][ne.source];delete this.workerSources[Y][ne.type][ne.source],ve.removeSource!==void 0?ve.removeSource(ne,le):le()}},lt.prototype.loadWorkerSource=function(Y,ne,le){try{this.self.importScripts(ne.url),le()}catch(ve){le(ve.toString())}},lt.prototype.syncRTLPluginState=function(Y,ne,le){try{o.plugin.setState(ne);var ve=o.plugin.getPluginURL();if(o.plugin.isLoaded()&&!o.plugin.isParsed()&&ve!=null){this.self.importScripts(ve);var Oe=o.plugin.isParsed();le(Oe?void 0:new Error("RTL Text Plugin failed to import scripts from "+ve),Oe)}}catch(he){le(he.toString())}},lt.prototype.getAvailableImages=function(Y){var ne=this.availableImages[Y];return ne||(ne=[]),ne},lt.prototype.getLayerIndex=function(Y){var ne=this.layerIndexes[Y];return ne||(ne=this.layerIndexes[Y]=new A),ne},lt.prototype.getWorkerSource=function(Y,ne,le){var ve=this;return this.workerSources[Y]||(this.workerSources[Y]={}),this.workerSources[Y][ne]||(this.workerSources[Y][ne]={}),this.workerSources[Y][ne][le]||(this.workerSources[Y][ne][le]=new this.workerSourceTypes[ne]({send:function(Oe,he,be){ve.actor.send(Oe,he,be,Y)}},this.getLayerIndex(Y),this.getAvailableImages(Y))),this.workerSources[Y][ne][le]},lt.prototype.getDEMWorkerSource=function(Y,ne){return this.demWorkerSources[Y]||(this.demWorkerSources[Y]={}),this.demWorkerSources[Y][ne]||(this.demWorkerSources[Y][ne]=new $),this.demWorkerSources[Y][ne]},lt.prototype.enforceCacheSizeLimit=function(Y,ne){o.enforceCacheSizeLimit(ne)},typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new lt(self)),lt}),s(["./shared"],function(o){var c=o.createCommonjsModule(function(l){function d(T){return!h(T)}function h(T){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 R,L,z=new Blob([""],{type:"text/javascript"}),X=URL.createObjectURL(z);try{L=new Worker(X),R=!0}catch{R=!1}return L&&L.terminate(),URL.revokeObjectURL(X),R}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var R=document.createElement("canvas");R.width=R.height=1;var L=R.getContext("2d");if(!L)return!1;var z=L.getImageData(0,0,1,1);return z&&z.width===R.width}()?(m[P=T&&T.failIfMajorPerformanceCaveat]===void 0&&(m[P]=function(R){var L=function(X){var ee=document.createElement("canvas"),Z=Object.create(d.webGLContextAttributes);return Z.failIfMajorPerformanceCaveat=X,ee.probablySupportsContext?ee.probablySupportsContext("webgl",Z)||ee.probablySupportsContext("experimental-webgl",Z):ee.supportsContext?ee.supportsContext("webgl",Z)||ee.supportsContext("experimental-webgl",Z):ee.getContext("webgl",Z)||ee.getContext("experimental-webgl",Z)}(R);if(!L)return!1;var z=L.createShader(L.VERTEX_SHADER);return!(!z||L.isContextLost())&&(L.shaderSource(z,"void main() {}"),L.compileShader(z),L.getShaderParameter(z,L.COMPILE_STATUS)===!0)}(P)),m[P]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray supp
2102ort":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var P}l.exports?l.exports=d:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=d,window.mapboxgl.notSupportedReason=h);var m={};d.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),f={create:function(l,d,h){var m=o.window.document.createElement(l);return d!==void 0&&(m.className=d),h&&h.appendChild(m),m},createNS:function(l,d){return o.window.document.createElementNS(l,d)}},A=o.window.document&&o.window.document.documentElement.style;function v(l){if(!A)return l[0];for(var d=0;d<l.length;d++)if(l[d]in A)return l[d];return l[0]}var w,S=v(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);f.disableDrag=function(){A&&S&&(w=A[S],A[S]="none")},f.enableDrag=function(){A&&S&&(A[S]=w)};var F=v(["transform","WebkitTransform"]);f.setTransform=function(l,d){l.style[F]=d};var N=!1;try{var U=Object.defineProperty({},"passive",{get:function(){N=!0}});o.window.addEventListener("test",U,U),o.window.removeEventListener("test",U,U)}catch{N=!1}f.addEventListener=function(l,d,h,m){m===void 0&&(m={}),l.addEventListener(d,h,"passive"in m&&N?m:m.capture)},f.removeEventListener=function(l,d,h,m){m===void 0&&(m={}),l.removeEventListener(d,h,"passive"in m&&N?m:m.capture)};var $=function(l){l.preventDefault(),l.stopPropagation(),o.window.removeEventListener("click",$,!0)};function G(l){var d=l.userImage;return!!(d&&d.render&&d.render())&&(l.data.replace(new Uint8Array(d.data.buffer)),!0)}f.suppressClick=function(){o.window.addEventListener("click",$,!0),o.window.setTimeout(function(){o.window.removeEventListener("click",$,!0)},0)},f.mousePos=function(l,d){var h=l.getBoundingClientRect();return new o.Point(d.clientX-h.left-l.clientLeft,d.clientY-h.top-l.clientTop)},f.touchPos=function(l,d){for(var h=l.getBoundingClientRect(),m=[],T=0;T<d.length;T++)m.push(new o.Point(d[T].clientX-h.left-l.clientLeft,d[T].clientY-h.top-l.clientTop));return m},f.mouseButton=function(l){return o.window.InstallTrigger!==void 0&&l.button===2&&l.ctrlKey&&o.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:l.button},f.remove=function(l){l.parentNode&&l.parentNode.removeChild(l)};var H=function(l){function d(){l.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.RGBAImage({width:1,height:1}),this.dirty=!0}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.isLoaded=function(){return this.loaded},d.prototype.setLoaded=function(h){if(this.loaded!==h&&(this.loaded=h,h)){for(var m=0,T=this.requestors;m<T.length;m+=1){var P=T[m];this._notify(P.ids,P.callback)}this.requestors=[]}},d.prototype.getImage=function(h){return this.images[h]},d.prototype.addImage=function(h,m){this._validate(h,m)&&(this.images[h]=m)},d.prototype._validate=function(h,m){var T=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new o.ErrorEvent(new Error('Image "'+h+'" has invalid "stretchX" value'))),T=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new o.ErrorEvent(new Error('Image "'+h+'" has invalid "stretchY" value'))),T=!1),this._validateContent(m.content,m)||(this.fire(new o.ErrorEvent(new Error('Image "'+h+'" has invalid "content" value'))),T=!1),T},d.prototype._validateStretch=function(h,m){if(!h)return!0;for(var T=0,P=0,R=h;P<R.length;P+=1){var L=R[P];if(L[0]<T||L[1]<L[0]||m<L[1])return!1;T=L[1]}return!0},d.prototype._validateContent=function(h,m){return!(h&&(h.length!==4||h[0]<0||m.data.width<h[0]||h[1]<0||m.data.height<h[1]||h[2]<0||m.data.width<h[2]||h[3]<0||m.data.height<h[3]||h[2]<h[0]||h[3]<h[1]))},d.prototype.updateImage=function(h,m){m.version=this.images[h].version+1,this.images[h]=m,this.updatedImages[h]=!0},d.prototype.removeImage=function(h){var m=this.images[h];delete this.images[h],delete this.patterns[h],m.userImage&&m.userImage.onRemove&&m.userImage.onRemove()},d.prototype.listImages=function(){return Object.keys(this.images)},d.prototype.getImages=function(h,m){var T=!0;if(!this.isLoaded())for(var P=0,R=h;P<R.length;P+=1)this.images[R[P]]||(T=!1);this.isLoaded()||T?this._notify(h,m):this.requestors.push({ids:h,callback:m})},d.prototype._notify=function(h,m){for(var T={},P=0,R=h;P<R.length;P+=1){var L=R[P];this.images[L]||this.fire(new o.Event("styleimagemissing",{id:L}));var z=this.images[L];z?T[L]={data:z.data.clone(),pixelRatio:z.pixelRatio,sdf:z.sdf,version:z.version,stretchX:z.stretchX,stretchY:z.stretchY,content:z.content,hasRenderCallback:!!(z.userImage&&z.userImage.render)}:o.warnOnce('Image "'+L+'" 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.')}m(null,T)},d.prototype.getPixelSize=function(){var h=this.atlasImage;return{width:h.width,height:h.height}},d.prototype.getPattern=function(h){var m=this.patterns[h],T=this.getImage(h);if(!T)return null;if(m&&m.position.version===T.version)return m.position;if(m)m.position.version=T.version;else{var P={w:T.data.width+2,h:T.data.height+2,x:0,y:0},R=new o.ImagePosition(P,T);this.patterns[h]={bin:P,position:R}}return this._updatePatternAtlas(),this.patterns[h].position},d.prototype.bind=function(h){var m=h.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new o.Texture(h,this.atlasImage,m.RGBA),this.atlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE)},d.prototype._updatePatternAtlas=function(){var h=[];for(var m in this.patterns)h.push(this.patterns[m].bin);var T=o.potpack(h),P=T.w,R=T.h,L=this.atlasImage;for(var z in L.resize({width:P||1,height:R||1}),this.patterns){var X=this.patterns[z].bin,ee=X.x+1,Z=X.y+1,te=this.images[z].data,oe=te.width,we=te.height;o.RGBAImage.copy(te,L,{x:0,y:0},{x:ee,y:Z},{width:oe,height:we}),o.RGBAImage.copy(te,L,{x:0,y:we-1},{x:ee,y:Z-1},{width:oe,height:1}),o.RGBAImage.copy(te,L,{x:0,y:0},{x:ee,y:Z+we},{width:oe,height:1}),o.RGBAImage.copy(te,L,{x:oe-1,y:0},{x:ee-1,y:Z},{width:1,height:we}),o.RGBAImage.copy(te,L,{x:0,y:0},{x:ee+oe,y:Z},{width:1,height:we})}this.dirty=!0},d.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},d.prototype.dispatchRenderCallbacks=function(h){for(var m=0,T=h;m<T.length;m+=1){var P=T[m];if(!this.callbackDispatchedThisFrame[P]){this.callbackDispatchedThisFrame[P]=!0;var R=this.images[P];G(R)&&this.updateImage(P,R)}}},d}(o.Evented),J=se,ue=se,q=1e20;function se(l,d,h,m,T,P){this.fontSize=l||24,this.buffer=d===void 0?3:d,this.cutoff=m||.25,this.fontFamily=T||"sans-serif",this.fontWeight=P||"normal",this.radius=h||8;var R=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=R,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(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.d=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Int16Array(R),this.middle=Math.round(R/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function Te(l,d,h,m,T,P,R){for(var L=0;L<d;L++){for(var z=0;z<h;z++)m[z]=l[z*d+L];for(Ue(m,T,P,R,h),z=0;z<h;z++)l[z*d+L]=T[z]}for(z=0;z<h;z++){for(L=0;L<d;L++)m[L]=l[z*d+L];for(Ue(m,T,P,R,d),L=0;L<d;L++)l[z*d+L]=Math.sqrt(T[L])}}function Ue(l,d,h,m,T){h[0]=0,m[0]=-q,m[1]=+q;for(var P=1,R=0;P<T;P++){for(var L=(l[P]+P*P-(l[h[R]]+h[R]*h[R]))/(2*P-2*h[R]);L<=m[R];)R--,L=(l[P]+P*P-(l[h[R]]+h[R]*h[R]))/(2*P-2*h[R]);h[++R]=P,m[R]=L,m[R+1]=+q}for(P=0,R=0;P<T;P++){for(;m[R+1]<P;)R++;d[P]=(P-h[R])*(P-h[R])+l[h[R]]}}se.prototype.draw=function(l){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(l,this.buffer,this.middle);for(var d=this.ctx.getImageData(0,0,this.size,this.size),h=new Uint8ClampedArray(this.size*this.size),m=0;m<this.size*this.size;m++){var T=d.data[4*m+3]/255;this.gridOuter[m]=T===1?0:T===0?q:Math.pow(Math.max(0,.5-T),2),this.gridInner[m]=T===1?q:T===0?0:Math.pow(Math.max(0,T-.5),2)}for(Te(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),Te(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),m=0;m<this.size*this.size;m++)h[m]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[m]-this.gridInner[m])/this.radius+this.cutoff))));return h},J.default=ue;var de=function(l,d){this.requestManager=l,this.localIdeographFontFamily=d,this.entries={}};de.prototype.setURL=function(l){this.url=l},de.prototype.getGlyphs=function(l,d){var h=this,m=[];for(var T in l)for(var P=0,R=l[T];P<R.length;P+=1)m.push({stack:T,id:R[P]});
vendor: 6,116 bytes, line 2102
2102o.asyncAll(m,function(L,z){var X=L.stack,ee=L.id,Z=h.entries[X];Z||(Z=h.entries[X]={glyphs:{},requests:{},ranges:{}});var te=Z.glyphs[ee];if(te===void 0){if(te=h._tinySDF(Z,X,ee))return Z.glyphs[ee]=te,void z(null,{stack:X,id:ee,glyph:te});var oe=Math.floor(ee/256);if(256*oe>65535)z(new Error("glyphs > 65535 not supported"));else if(Z.ranges[oe])z(null,{stack:X,id:ee,glyph:te});else{var we=Z.requests[oe];we||(we=Z.requests[oe]=[],de.loadGlyphRange(X,oe,h.url,h.requestManager,function(Fe,ge){if(ge){for(var Re in ge)h._doesCharSupportLocalGlyph(+Re)||(Z.glyphs[+Re]=ge[+Re]);Z.ranges[oe]=!0}for(var He=0,We=we;He<We.length;He+=1)(0,We[He])(Fe,ge);delete Z.requests[oe]})),we.push(function(Fe,ge){Fe?z(Fe):ge&&z(null,{stack:X,id:ee,glyph:ge[ee]||null})})}}else z(null,{stack:X,id:ee,glyph:te})},function(L,z){if(L)d(L);else if(z){for(var X={},ee=0,Z=z;ee<Z.length;ee+=1){var te=Z[ee],oe=te.stack,we=te.id,Fe=te.glyph;(X[oe]||(X[oe]={}))[we]=Fe&&{id:Fe.id,bitmap:Fe.bitmap.clone(),metrics:Fe.metrics}}d(null,X)}})},de.prototype._doesCharSupportLocalGlyph=function(l){return!!this.localIdeographFontFamily&&(o.isChar["CJK Unified Ideographs"](l)||o.isChar["Hangul Syllables"](l)||o.isChar.Hiragana(l)||o.isChar.Katakana(l))},de.prototype._tinySDF=function(l,d,h){var m=this.localIdeographFontFamily;if(m&&this._doesCharSupportLocalGlyph(h)){var T=l.tinySDF;if(!T){var P="400";/bold/i.test(d)?P="900":/medium/i.test(d)?P="500":/light/i.test(d)&&(P="200"),T=l.tinySDF=new de.TinySDF(24,3,8,.25,m,P)}return{id:h,bitmap:new o.AlphaImage({width:30,height:30},T.draw(String.fromCharCode(h))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},de.loadGlyphRange=function(l,d,h,m,T){var P=256*d,R=P+255,L=m.transformRequest(m.normalizeGlyphsURL(h).replace("{fontstack}",l).replace("{range}",P+"-"+R),o.ResourceType.Glyphs);o.getArrayBuffer(L,function(z,X){if(z)T(z);else if(X){for(var ee={},Z=0,te=o.parseGlyphPBF(X);Z<te.length;Z+=1){var oe=te[Z];ee[oe.id]=oe}T(null,ee)}})},de.TinySDF=J;var me=function(){this.specification=o.styleSpec.light.position};me.prototype.possiblyEvaluate=function(l,d){return o.sphericalToCartesian(l.expression.evaluate(d))},me.prototype.interpolate=function(l,d,h){return{x:o.number(l.x,d.x,h),y:o.number(l.y,d.y,h),z:o.number(l.z,d.z,h)}};var pe=new o.Properties({anchor:new o.DataConstantProperty(o.styleSpec.light.anchor),position:new me,color:new o.DataConstantProperty(o.styleSpec.light.color),intensity:new o.DataConstantProperty(o.styleSpec.light.intensity)}),W=function(l){function d(h){l.call(this),this._transitionable=new o.Transitionable(pe),this.setLight(h),this._transitioning=this._transitionable.untransitioned()}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getLight=function(){return this._transitionable.serialize()},d.prototype.setLight=function(h,m){if(m===void 0&&(m={}),!this._validate(o.validateLight,h,m))for(var T in h){var P=h[T];o.endsWith(T,"-transition")?this._transitionable.setTransition(T.slice(0,-11),P):this._transitionable.setValue(T,P)}},d.prototype.updateTransitions=function(h){this._transitioning=this._transitionable.transitioned(h,this._transitioning)},d.prototype.hasTransition=function(){return this._transitioning.hasTransition()},d.prototype.recalculate=function(h){this.properties=this._transitioning.possiblyEvaluate(h)},d.prototype._validate=function(h,m,T){return(!T||T.validate!==!1)&&o.emitValidationErrors(this,h.call(o.validateStyle,o.extend({value:m,style:{glyphs:!0,sprite:!0},styleSpec:o.styleSpec})))},d}(o.Evented),re=function(l,d){this.width=l,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};re.prototype.getDash=function(l,d){var h=l.join(",")+String(d);return this.dashEntry[h]||(this.dashEntry[h]=this.addDash(l,d)),this.dashEntry[h]},re.prototype.getDashRanges=function(l,d,h){var m=[],T=l.length%2==1?-l[l.length-1]*h:0,P=l[0]*h,R=!0;m.push({left:T,right:P,isDash:R,zeroLength:l[0]===0});for(var L=l[0],z=1;z<l.length;z++){var X=l[z];m.push({left:T=L*h,right:P=(L+=X)*h,isDash:R=!R,zeroLength:X===0})}return m},re.prototype.addRoundDash=function(l,d,h){for(var m=d/2,T=-h;T<=h;T++)for(var P=this.width*(this.nextRow+h+T),R=0,L=l[R],z=0;z<this.width;z++){z/L.right>1&&(L=l[++R]);var X=Math.abs(z-L.left),ee=Math.abs(z-L.right),Z=Math.min(X,ee),te=void 0,oe=T/h*(m+1);if(L.isDash){var we=m-Math.abs(oe);te=Math.sqrt(Z*Z+we*we)}else te=m-Math.sqrt(Z*Z+oe*oe);this.data[P+z]=Math.max(0,Math.min(255,te+128))}},re.prototype.addRegularDash=function(l){for(var d=l.length-1;d>=0;--d){var h=l[d],m=l[d+1];h.zeroLength?l.splice(d,1):m&&m.isDash===h.isDash&&(m.left=h.left,l.splice(d,1))}var T=l[0],P=l[l.length-1];T.isDash===P.isDash&&(T.left=P.left-this.width,P.right=T.right+this.width);for(var R=this.width*this.nextRow,L=0,z=l[L],X=0;X<this.width;X++){X/z.right>1&&(z=l[++L]);var ee=Math.abs(X-z.left),Z=Math.abs(X-z.right),te=Math.min(ee,Z);this.data[R+X]=Math.max(0,Math.min(255,(z.isDash?te:-te)+128))}},re.prototype.addDash=function(l,d){var h=d?7:0,m=2*h+1;if(this.nextRow+m>this.height)return o.warnOnce("LineAtlas out of space"),null;for(var T=0,P=0;P<l.length;P++)T+=l[P];if(T!==0){var R=this.width/T,L=this.getDashRanges(l,this.width,R);d?this.addRoundDash(L,R,h):this.addRegularDash(L)}var z={y:(this.nextRow+h+.5)/this.height,height:2*h/this.height,width:T};return this.nextRow+=m,this.dirty=!0,z},re.prototype.bind=function(l){var d=l.gl;this.texture?(d.bindTexture(d.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,d.texSubImage2D(d.TEXTURE_2D,0,0,0,this.width,this.height,d.ALPHA,d.UNSIGNED_BYTE,this.data))):(this.texture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this.texture),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texImage2D(d.TEXTURE_2D,0,d.ALPHA,this.width,this.height,0,d.ALPHA,d.UNSIGNED_BYTE,this.data))};var Ee=function l(d,h){this.workerPool=d,this.actors=[],this.currentActor=0,this.id=o.uniqueId();
2102for(var m=this.workerPool.acquire(this.id),T=0;T<m.length;T++){var P=new l.Actor(m[T],h,this.id);P.name="Worker "+T,this.actors.push(P)}};function et(l,d,h){var m=function(T,P){if(T)return h(T);if(P){var R=o.pick(o.extend(P,l),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);P.vector_layers&&(R.vectorLayers=P.vector_layers,R.vectorLayerIds=R.vectorLayers.map(function(L){return L.id})),R.tiles=d.canonicalizeTileset(R,l.url),h(null,R)}};return l.url?o.getJSON(d.transformRequest(d.normalizeSourceURL(l.url),o.ResourceType.Source),m):o.browser.frame(function(){return m(null,l)})}Ee.prototype.broadcast=function(l,d,h){o.asyncAll(this.actors,function(m,T){m.send(l,d,T)},h=h||function(){})},Ee.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},Ee.prototype.remove=function(){this.actors.forEach(function(l){l.remove()}),this.actors=[],this.workerPool.release(this.id)},Ee.Actor=o.Actor;var _e=function(l,d,h){this.bounds=o.LngLatBounds.convert(this.validateBounds(l)),this.minzoom=d||0,this.maxzoom=h||24};_e.prototype.validateBounds=function(l){return Array.isArray(l)&&l.length===4?[Math.max(-180,l[0]),Math.max(-90,l[1]),Math.min(180,l[2]),Math.min(90,l[3])]:[-180,-90,180,90]},_e.prototype.contains=function(l){var d=Math.pow(2,l.z),h=Math.floor(o.mercatorXfromLng(this.bounds.getWest())*d),m=Math.floor(o.mercatorYfromLat(this.bounds.getNorth())*d),T=Math.ceil(o.mercatorXfromLng(this.bounds.getEast())*d),P=Math.ceil(o.mercatorYfromLat(this.bounds.getSouth())*d);return l.x>=h&&l.x<T&&l.y>=m&&l.y<P};var Le=function(l){function d(h,m,T,P){if(l.call(this),this.id=h,this.dispatcher=T,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.extend(this,o.pick(m,["url","scheme","tileSize","promoteId"])),this._options=o.extend({type:"vector"},m),this._collectResourceTiming=m.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(P)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.load=function(){var h=this;this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=et(this._options,this.map._requestManager,function(m,T){h._tileJSONRequest=null,h._loaded=!0,m?h.fire(new o.ErrorEvent(m)):T&&(o.extend(h,T),T.bounds&&(h.tileBounds=new _e(T.bounds,h.minzoom,h.maxzoom)),o.postTurnstileEvent(T.tiles,h.map._requestManager._customAccessToken),o.postMapLoadEvent(T.tiles,h.map._getMapId(),h.map._requestManager._skuToken,h.map._requestManager._customAccessToken),h.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})),h.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})))})},d.prototype.loaded=function(){return this._loaded},d.prototype.hasTile=function(h){return!this.tileBounds||this.tileBounds.contains(h.canonical)},d.prototype.onAdd=function(h){this.map=h,this.load()},d.prototype.setSourceProperty=function(h){this._tileJSONRequest&&this._tileJSONRequest.cancel(),h(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},d.prototype.setTiles=function(h){var m=this;return this.setSourceProperty(function(){m._options.tiles=h}),this},d.prototype.setUrl=function(h){var m=this;return this.setSourceProperty(function(){m.url=h,m._options.url=h}),this},d.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},d.prototype.serialize=function(){return o.extend({},this._options)},d.prototype.loadTile=function(h,m){var T=this.map._requestManager.normalizeTileURL(h.tileID.canonical.url(this.tiles,this.scheme)),P={request:this.map._requestManager.transformRequest(T,o.ResourceType.Tile),uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,tileSize:this.tileSize*h.tileID.overscaleFactor(),type:this.t
2102ype,source:this.id,pixelRatio:o.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function R(L,z){return delete h.request,h.aborted?m(null):L&&L.status!==404?m(L):(z&&z.resourceTiming&&(h.resourceTiming=z.resourceTiming),this.map._refreshExpiredTiles&&z&&h.setExpiryData(z),h.loadVectorData(z,this.map.painter),o.cacheEntryPossiblyAdded(this.dispatcher),m(null),void(h.reloadCallback&&(this.loadTile(h,h.reloadCallback),h.reloadCallback=null)))}P.request.collectResourceTiming=this._collectResourceTiming,h.actor&&h.state!=="expired"?h.state==="loading"?h.reloadCallback=m:h.request=h.actor.send("reloadTile",P,R.bind(this)):(h.actor=this.dispatcher.getActor(),h.request=h.actor.send("loadTile",P,R.bind(this)))},d.prototype.abortTile=function(h){h.request&&(h.request.cancel(),delete h.request),h.actor&&h.actor.send("abortTile",{uid:h.uid,type:this.type,source:this.id},void 0)},d.prototype.unloadTile=function(h){h.unloadVectorData(),h.actor&&h.actor.send("removeTile",{uid:h.uid,type:this.t
vendor: 4,137 bytes, line 2102
2102ype,source:this.id},void 0)},d.prototype.hasTransition=function(){return!1},d}(o.Evented),Ge=function(l){function d(h,m,T,P){l.call(this),this.id=h,this.dispatcher=T,this.setEventedParent(P),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.extend({type:"raster"},m),o.extend(this,o.pick(m,["url","scheme","tileSize"]))}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.load=function(){var h=this;this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=et(this._options,this.map._requestManager,function(m,T){h._tileJSONRequest=null,h._loaded=!0,m?h.fire(new o.ErrorEvent(m)):T&&(o.extend(h,T),T.bounds&&(h.tileBounds=new _e(T.bounds,h.minzoom,h.maxzoom)),o.postTurnstileEvent(T.tiles),o.postMapLoadEvent(T.tiles,h.map._getMapId(),h.map._requestManager._skuToken),h.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})),h.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})))})},d.prototype.loaded=function(){return this._loaded},d.prototype.onAdd=function(h){this.map=h,this.load()},d.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},d.prototype.serialize=function(){return o.extend({},this._options)},d.prototype.hasTile=function(h){return!this.tileBounds||this.tileBounds.contains(h.canonical)},d.prototype.loadTile=function(h,m){var T=this,P=this.map._requestManager.normalizeTileURL(h.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);h.request=o.getImage(this.map._requestManager.transformRequest(P,o.ResourceType.Tile),function(R,L){if(delete h.request,h.aborted)h.state="unloaded",m(null);else if(R)h.state="errored",m(R);else if(L){T.map._refreshExpiredTiles&&h.setExpiryData(L),delete L.cacheControl,delete L.expires;var z=T.map.painter.context,X=z.gl;h.texture=T.map.painter.getTileTexture(L.width),h.texture?h.texture.update(L,{useMipmap:!0}):(h.texture=new o.Texture(z,L,X.RGBA,{useMipmap:!0}),h.texture.bind(X.LINEAR,X.CLAMP_TO_EDGE,X.LINEAR_MIPMAP_NEAREST),z.extTextureFilterAnisotropic&&X.texParameterf(X.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax)),h.state="loaded",o.cacheEntryPossiblyAdded(T.dispatcher),m(null)}})},d.prototype.abortTile=function(h,m){h.request&&(h.request.cancel(),delete h.request),m()},d.prototype.unloadTile=function(h,m){h.texture&&this.map.painter.saveTileTexture(h.texture),m()},d.prototype.hasTransition=function(){return!1},d}(o.Evented),Ze=function(l){function d(h,m,T,P){l.call(this,h,m,T,P),this.type="raster-dem",this.maxzoom=22,this._options=o.extend({type:"raster-dem"},m),this.encoding=m.encoding||"mapbox"}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},d.prototype.loadTile=function(h,m){var T=this.map._requestManager.normalizeTileURL(h.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function P(R,L){R&&(h.state="errored",m(R)),L&&(h.dem=L,h.needsHillshadePrepare=!0,h.state="loaded",m(null))}h.request=o.getImage(this.map._requestManager.transformRequest(T,o.ResourceType.Tile),(function(R,L){if(delete h.request,h.aborted)h.state="unloaded",m(null);else if(R)h.state="errored",m(R);else if(L){this.map._refreshExpiredTiles&&h.setExpiryData(L),delete L.cacheControl,delete L.expires;var z=o.window.ImageBitmap&&L instanceof o.window.ImageBitmap&&o.offscreenCanvasSupported()?L:o.browser.getImageData(L,1),X={uid:h.uid,coord:h.tileID,source:this.id,rawImageData:z,encoding:this.encoding};h.actor&&h.state!=="expired"||(h.actor=this.dispatcher.getActor(),h.actor.send("loadDEMTile",X,P.bind(this)))}}).bind(this)),h.neighboringTiles=this._getNeighboringTiles(h.tileID)},d.prototype._getNeighboringTiles=function(h){var m=h.canonical,T=Math.pow(2,m.z),P=(m.x-1+T)%T,R=m.x===0?h.wrap-1:h.wrap,L=(m.x+1+T)%T,z=m.x+1===T?h.wrap+1:h.wrap,X={};
2102return X[new o.OverscaledTileID(h.overscaledZ,R,m.z,P,m.y).key]={backfilled:!1},X[new o.OverscaledTileID(h.overscaledZ,z,m.z,L,m.y).key]={backfilled:!1},m.y>0&&(X[new o.OverscaledTileID(h.overscaledZ,R,m.z,P,m.y-1).key]={backfilled:!1},X[new o.OverscaledTileID(h.overscaledZ,h.wrap,m.z,m.x,m.y-1).key]={backfilled:!1},X[new o.OverscaledTileID(h.overscaledZ,z,m.z,L,m.y-1).key]={backfilled:!1}),m.y+1<T&&(X[new o.OverscaledTileID(h.overscaledZ,R,m.z,P,m.y+1).key]={backfilled:!1},X[new o.OverscaledTileID(h.overscaledZ,h.wrap,m.z,m.x,m.y+1).key]={backfilled:!1},X[new o.OverscaledTileID(h.overscaledZ,z,m.z,L,m.y+1).key]={backfilled:!1}),X},d.prototype.unloadTile=function(h){h.demTexture&&this.map.painter.saveTileTexture(h.demTexture),h.fbo&&(h.fbo.destroy(),delete h.fbo),h.dem&&delete h.dem,delete h.neighboringTiles,h.state="unloaded",h.actor&&h.actor.send("removeDEMTile",{uid:h.uid,source:this.id})},d}(Ge),tt=function(l){function d(h,m,T,P){l.call(this),this.id=h,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=T.getActor(),this.setEventedParent(P),this._data=m.data,this._options=o.extend({},m),this._collectResourceTiming=m.collectResourceTiming,this._resourceTiming=[],m.maxzoom!==void 0&&(this.maxzoom=m.maxzoom),m.type&&(this.type=m.type),m.attribution&&(this.attribution=m.attribution),this.promoteId=m.promoteId;var R=o.EXTENT/this.tileSize;this.workerOptions=o.extend({source:this.id,cluster:m.cluster||!1,geojsonVtOptions:{buffer:(m.buffer!==void 0?m.buffer:128)*R,tolerance:(m.tolerance!==void 0?m.tolerance:.375)*R,extent:o.EXTENT,maxZoom:this.maxzoom,lineMetrics:m.lineMetrics||!1,generateId:m.generateId||!1}
2102,superclusterOptions:{maxZoom:m.clusterMaxZoom!==void 0?Math.min(m.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,m.clusterMinPoints||2),extent:o.EXTENT,radius:(m.clusterRadius||50)*R,log:!1,generateId:m.generateId||!1},clusterProperties:m.clusterProperties,filter:m.filter},m.workerOptions)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.load=function(){var h=this;this.fire(new o.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(m){if(m)h.fire(new o.ErrorEvent(m));else{var T={dataType:"source",sourceDataType:"metadata"};h._collectResourceTiming&&h._resourceTiming&&h._resourceTiming.length>0&&(T.resourceTiming=h._resourceTiming,h._resourceTiming=[]),h.fire(new o.Event("data",T))}})},d.prototype.onAdd=function(h){this.map=h,this.load()},d.prototype.setData=function(h){var m=this;return this._data=h,this.fire(new o.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(T){if(T)m.fire(new o.ErrorEvent(T));else{var P={dataType:"source",sourceDataType:"content"};m._collectResourceTiming&&m._resourceTiming&&m._resourceTiming.length>0&&(P.resourceTiming=m._resourceTiming,m._resourceTiming=[]),m.fire(new o.Event("data",P))}}),this},d.prototype.getClusterExpansionZoom=function(h,m){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:h,source:this.id},m),this},d.prototype.getClusterChildren=function(h,m){return this.actor.send("geojson.getClusterChildren",{clusterId:h,source:this.id},m),this},d.prototype.getClusterLeaves=function(h,m,T,P){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:h,limit:m,offset:T},P),this},d.prototype._updateWorkerData=function(h){var m=this;this._loaded=!1;var T=o.extend({},this.workerOptions),P=this._data;typeof P=="string"?(T.request=this.map._requestManager.transformRequest(o.browser.resolveURL(P),o.ResourceType.Source),T.request.collectResourceTiming=this._collectResourceTiming):T.data=JSON.stringify(P),this.actor.send(this.type+".loadData",T,function(R,L){m._removed||L&&L.abandoned||(m._loaded=!0,L&&L.resourceTiming&&L.resourceTiming[m.id]&&(m._resourceTiming=L.resourceTiming[m.id].slice(0)),m.actor.send(m.type+".coalesce",{source:T.source},null),h(R))})},d.prototype.loaded=function(){return this._loaded},d.prototype.loadTile=function(h,m){var T=this,P=h.actor?"reloadTile":"loadTile";
2102h.actor=this.actor,h.request=this.actor.send(P,{type:this.type,uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:o.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},function(R,L){return delete h.request,h.unloadVectorData(),h.aborted?m(null):R?m(R):(h.loadVectorData(L,T.map.painter,P==="reloadTile"),m(null))})},d.prototype.abortTile=function(h){h.request&&(h.request.cancel(),delete h.request),h.aborted=!0},d.prototype.unloadTile=function(h){h.unloadVectorData(),this.actor.send("removeTile",{uid:h.uid,type:this.type,source:this.id})},d.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},d.prototype.serialize=function(){return o.extend({},this._options,{type:this.type,data:this._data})},d.prototype.hasTransition=function(){return!1},d}(o.Evented),rt=o.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),ut=function(l){function d(h,m,T,P){l.call(this),this.id=h,this.dispatcher=T,this.coordinates=m.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(P),this.options=m}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.load=function(h,m){var T=this;this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this.url=this.options.url,o.getImage(this.map._requestManager.transformRequest(this.url,o.ResourceType.Image),function(P,R){T._loaded=!0,P?T.fire(new o.ErrorEvent(P)):R&&(T.image=R,h&&(T.coordinates=h),m&&m(),T._finishLoading())})},d.prototype.loaded=function(){return this._loaded},d.prototype.updateImage=function(h){var m=this;return this.image&&h.url?(this.options.url=h.url,this.load(h.coordinates,function(){m.texture=null}),this):this},d.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})))},d.prototype.onAdd=function(h){this.map=h,this.load()},d.prototype.setCoordinates=function(h){var m=this;this.coordinates=h;var T=h.map(o.MercatorCoordinate.fromLngLat);this.tileID=function(R){for(var L=1/0,z=1/0,X=-1/0,ee=-1/0,Z=0,te=R;Z<te.length;Z+=1){var oe=te[Z];L=Math.min(L,oe.x),z=Math.min(z,oe.y),X=Math.max(X,oe.x),ee=Math.max(ee,oe.y)}var we=Math.max(X-L,ee-z),Fe=Math.max(0,Math.floor(-Math.log(we)/Math.LN2)),ge=Math.pow(2,Fe);return new o.CanonicalTileID(Fe,Math.floor((L+X)/2*ge),Math.floor((z+ee)/2*ge))}(T),this.minzoom=this.maxzoom=this.tileID.z;var P=T.map(function(R){return m.tileID.getTilePoint(R)._round()});return this._boundsArray=new o.StructArrayLayout4i8,this._boundsArray.emplaceBack(P[0].x,P[0].y,0,0),this._boundsArray.emplaceBack(P[1].x,P[1].y,o.EXTENT,0),this._boundsArray.emplaceBack(P[3].x,P[3].y,0,o.EXTENT),this._boundsArray.emplaceBack(P[2].x,P[2].y,o.EXTENT,o.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})),this},d.prototype.prepare=function(){if(Object.keys(this.tiles).length!==0&&this.image){var h=this.map.painter.context,m=h.gl;for(var T in this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,rt.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new o.Texture(h,this.image,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE)),this.tiles){var P=this.tiles[T];P.state!=="loaded"&&(P.state="loaded",P.texture=this.texture)}}},d.prototype.loadTile=function(h,m){this.tileID&&this.tileID.equals(h.tileID.canonical)?(this.tiles[String(h.tileID.wrap)]=h,h.buckets={},m(null)):(h.state="errored",m(null))},d.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},d.prototype.hasTransition=function(){return!1},d}(o.Evented),vt=function(l){function d(h,m,T,P){l.call(this,h,m,T,P),this.roundZoom=!0,this.type="video",this.options=m}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.load=function(){var h=this;this._loaded=!1;var m=this.options;this.urls=[];for(var T=0,P=m.urls;T<P.length;T+=1)this.urls.push(this.map._requestManager.transformRequest(P[T],o.ResourceType.Source).url);o.getVideo(this.urls,function(R,L){h._loaded=!0,R?h.fire(new o.ErrorEvent(R)):L&&(h.video=L,h.video.loop=!0,h.video.setAttribute("playsinline",""),h.video.addEventListener("playing",function(){h.map.triggerRepaint()}),h.map&&h.video.play(),h._finishLoading())})},d.prototype.pause=function(){this.video&&this.video.pause()},d.prototype.play=function(){this.video&&this.video.play()},d.prototype.seek=function(h){if(this.video){var m=this.video.seekable;h<m.start(0)||h>m.end(0)?this.fire(new o.ErrorEvent(new o.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+m.start(0)+" and "+m.end(0)+"-second mark."))):this.video.currentTime=h}},d.prototype.getVideo=function(){return this.video}
vendor: 21,099 bytes, line 2102
2102,d.prototype.onAdd=function(h){this.map||(this.map=h,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},d.prototype.prepare=function(){if(!(Object.keys(this.tiles).length===0||this.video.readyState<2)){var h=this.map.painter.context,m=h.gl;for(var T in this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,rt.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.texSubImage2D(m.TEXTURE_2D,0,0,0,m.RGBA,m.UNSIGNED_BYTE,this.video)):(this.texture=new o.Texture(h,this.video,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE)),this.tiles){var P=this.tiles[T];P.state!=="loaded"&&(P.state="loaded",P.texture=this.texture)}}},d.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},d.prototype.hasTransition=function(){return this.video&&!this.video.paused},d}(ut),St=function(l){function d(h,m,T,P){l.call(this,h,m,T,P),m.coordinates?Array.isArray(m.coordinates)&&m.coordinates.length===4&&!m.coordinates.some(function(R){return!Array.isArray(R)||R.length!==2||R.some(function(L){return typeof L!="number"})})||this.fire(new o.ErrorEvent(new o.ValidationError("sources."+h,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.ErrorEvent(new o.ValidationError("sources."+h,null,'missing required property "coordinates"'))),m.animate&&typeof m.animate!="boolean"&&this.fire(new o.ErrorEvent(new o.ValidationError("sources."+h,null,'optional "animate" property must be a boolean value'))),m.canvas?typeof m.canvas=="string"||m.canvas instanceof o.window.HTMLCanvasElement||this.fire(new o.ErrorEvent(new o.ValidationError("sources."+h,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 o.ErrorEvent(new o.ValidationError("sources."+h,null,'missing required property "canvas"'))),this.options=m,this.animate=m.animate===void 0||m.animate}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof o.window.HTMLCanvasElement?this.options.canvas:o.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.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())},d.prototype.getCanvas=function(){return this.canvas},d.prototype.onAdd=function(h){this.map=h,this.load(),this.canvas&&this.animate&&this.play()},d.prototype.onRemove=function(){this.pause()},d.prototype.prepare=function(){var h=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,h=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,h=!0),!this._hasInvalidDimensions()&&Object.keys(this.tiles).length!==0){var m=this.map.painter.context,T=m.gl;for(var P in this.boundsBuffer||(this.boundsBuffer=m.createVertexBuffer(this._boundsArray,rt.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(h||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.Texture(m,this.canvas,T.RGBA,{premultiply:!0}),this.tiles){var R=this.tiles[P];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture)}}},d.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},d.prototype.hasTransition=function(){return this._playing},d.prototype._hasInvalidDimensions=function(){for(var h=0,m=[this.canvas.width,this.canvas.height];h<m.length;h+=1){var T=m[h];if(isNaN(T)||T<=0)return!0}return!1},d}(ut),st={vector:Le,raster:Ge,"raster-dem":Ze,geojson:tt,video:vt,image:ut,canvas:St};function dr(l,d){var h=o.identity([]);return o.translate(h,h,[1,1,0]),o.scale(h,h,[.5*l.width,.5*l.height,1]),o.multiply(h,h,l.calculatePosMatrix(d.toUnwrapped()))}function er(l,d,h,m,T,P){var R=function(Fe,ge,Re){if(Fe)for(var He=0,We=Fe;He<We.length;He+=1){var nt=ge[We[He]];if(nt&&nt.source===Re&&nt.type==="fill-extrusion")return!0}else for(var Xe in ge){var Qe=ge[Xe];if(Qe.source===Re&&Qe.type==="fill-extrusion")return!0}return!1}(T&&T.layers,d,l.id),L=P.maxPitchScaleFactor(),z=l.tilesIn(m,L,R);z.sort(Kt);for(var X=[],ee=0,Z=z;ee<Z.length;ee+=1){var te=Z[ee];X.push({wrappedTileID:te.tileID.wrapped().key,queryResults:te.tile.queryRenderedFeatures(d,h,l._state,te.queryGeometry,te.cameraQueryGeometry,te.scale,T,P,L,dr(l.transform,te.tileID))})}var oe=function(Fe){for(var ge={},Re={},He=0,We=Fe;He<We.length;He+=1){var nt=We[He],Xe=nt.queryResults,Qe=nt.wrappedTileID,pt=Re[Qe]=Re[Qe]||{};for(var Dt in Xe)for(var Ct=Xe[Dt],zt=pt[Dt]=pt[Dt]||{},sr=ge[Dt]=ge[Dt]||[],Er=0,Mr=Ct;Er<Mr.length;Er+=1){var xn=Mr[Er];zt[xn.featureIndex]||(zt[xn.featureIndex]=!0,sr.push(xn))}}return ge}(X);for(var we in oe)oe[we].forEach(function(Fe){var ge=Fe.feature,Re=l.getFeatureState(ge.layer["source-layer"],ge.id);ge.source=ge.layer.source,ge.layer["source-layer"]&&(ge.sourceLayer=ge.layer["source-layer"]),ge.state=Re});return oe}function Kt(l,d){var h=l.tileID,m=d.tileID;return h.overscaledZ-m.overscaledZ||h.canonical.y-m.canonical.y||h.wrap-m.wrap||h.canonical.x-m.canonical.x}var Nt=function(l,d){this.max=l,this.onRemove=d,this.reset()};Nt.prototype.reset=function(){for(var l in this.data)for(var d=0,h=this.data[l];d<h.length;d+=1){var m=h[d];m.timeout&&clearTimeout(m.timeout),this.onRemove(m.value)}return this.data={},this.order=[],this},Nt.prototype.add=function(l,d,h){var m=this,T=l.wrapped().key;this.data[T]===void 0&&(this.data[T]=[]);var P={value:d,timeout:void 0};if(h!==void 0&&(P.timeout=setTimeout(function(){m.remove(l,P)},h)),this.data[T].push(P),this.order.push(T),this.order.length>this.max){var R=this._getAndRemoveByKey(this.order[0]);R&&this.onRemove(R)}return this},Nt.prototype.has=function(l){return l.wrapped().key in this.data},Nt.prototype.getAndRemove=function(l){return this.has(l)?this._getAndRemoveByKey(l.wrapped().key):null},Nt.prototype._getAndRemoveByKey=function(l){var d=this.data[l].shift();return d.timeout&&clearTimeout(d.timeout),this.data[l].length===0&&delete this.data[l],this.order.splice(this.order.indexOf(l),1),d.value},Nt.prototype.getByKey=function(l){var d=this.data[l];return d?d[0].value:null},Nt.prototype.get=function(l){return this.has(l)?this.data[l.wrapped().key][0].value:null},Nt.prototype.remove=function(l,d){if(!this.has(l))return this;var h=l.wrapped().key,m=d===void 0?0:this.data[h].indexOf(d),T=this.data[h][m];return this.data[h].splice(m,1),T.timeout&&clearTimeout(T.timeout),this.data[h].length===0&&delete this.data[h],this.onRemove(T.value),this.order.splice(this.order.indexOf(h),1),this},Nt.prototype.setMaxSize=function(l){for(this.max=l;this.order.length>this.max;){var d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this},Nt.prototype.filter=function(l){var d=[];for(var h in this.data)for(var m=0,T=this.data[h];m<T.length;m+=1){var P=T[m];l(P.value)||d.push(P)}for(var R=0,L=d;R<L.length;R+=1){var z=L[R];this.remove(z.value.tileID,z)}};var Ar=function(l,d,h){this.context=l;var m=l.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!h,this.context.unbindVAO(),l.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer};Ar.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},Ar.prototype.updateData=function(l){var d=this.context.gl;this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,l.arrayBuffer)},Ar.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var ln={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Pr=function(l,d,h,m){this.length=d.length,this.attributes=h,this.itemSize=d.bytesPerElement,this.dynamicDraw=m,this.context=l;var T=l.gl;this.buffer=T.createBuffer(),l.bindVertexBuffer.set(this.buffer),T.bufferData(T.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?T.DYNAMIC_DRAW:T.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer};Pr.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},Pr.prototype.updateData=function(l){var d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,l.arrayBuffer)},Pr.prototype.enableAttributes=function(l,d){for(var h=0;h<this.attributes.length;h++){var m=d.attributes[this.attributes[h].name];m!==void 0&&l.enableVertexAttribArray(m)}},Pr.prototype.setVertexAttribPointers=function(l,d,h){for(var m=0;m<this.attributes.length;m++){var T=this.attributes[m],P=d.attributes[T.name];P!==void 0&&l.vertexAttribPointer(P,T.components,l[ln[T.type]],!1,this.itemSize,T.offset+this.itemSize*(h||0))}},Pr.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var xr=function(l){this.gl=l.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};xr.prototype.get=function(){return this.current},xr.prototype.set=function(l){},xr.prototype.getDefault=function(){return this.default},xr.prototype.setDefault=function(){this.set(this.default)};var Vn=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return o.Color.transparent},d.prototype.set=function(h){var m=this.current;(h.r!==m.r||h.g!==m.g||h.b!==m.b||h.a!==m.a||this.dirty)&&(this.gl.clearColor(h.r,h.g,h.b,h.a),this.current=h,this.dirty=!1)},d}(xr),_r=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return 1},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.clearDepth(h),this.current=h,this.dirty=!1)},d}(xr),yr=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return 0},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.clearStencil(h),this.current=h,this.dirty=!1)},d}(xr),un=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return[!0,!0,!0,!0]},d.prototype.set=function(h){var m=this.current;(h[0]!==m[0]||h[1]!==m[1]||h[2]!==m[2]||h[3]!==m[3]||this.dirty)&&(this.gl.colorMask(h[0],h[1],h[2],h[3]),this.current=h,this.dirty=!1)},d}(xr),Dr=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return!0},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.depthMask(h),this.current=h,this.dirty=!1)},d}(xr),ci=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return 255},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.stencilMask(h),this.current=h,this.dirty=!1)},d}(xr),Yn=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},d.prototype.set=function(h){var m=this.current;(h.func!==m.func||h.ref!==m.ref||h.mask!==m.mask||this.dirty)&&(this.gl.stencilFunc(h.func,h.ref,h.mask),this.current=h,this.dirty=!1)},d}(xr),mn=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){var h=this.gl;return[h.KEEP,h.KEEP,h.KEEP]},d.prototype.set=function(h){var m=this.current;(h[0]!==m[0]||h[1]!==m[1]||h[2]!==m[2]||this.dirty)&&(this.gl.stencilOp(h[0],h[1],h[2]),this.current=h,this.dirty=!1)},d}(xr),ti=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return!1},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;h?m.enable(m.STENCIL_TEST):m.disable(m.STENCIL_TEST),this.current=h,this.dirty=!1}},d}(xr),Hn=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return[0,1]},d.prototype.set=function(h){var m=this.current;(h[0]!==m[0]||h[1]!==m[1]||this.dirty)&&(this.gl.depthRange(h[0],h[1]),this.current=h,this.dirty=!1)},d}(xr),Bn=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return!1},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;h?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),this.current=h,this.dirty=!1}},d}(xr),Zn=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return this.gl.LESS},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.depthFunc(h),this.current=h,this.dirty=!1)},d}(xr),Vt=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return!1},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;h?m.enable(m.BLEND):m.disable(m.BLEND),this.current=h,this.dirty=!1}},d}(xr),mr=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){var h=this.gl;return[h.ONE,h.ZERO]},d.prototype.set=function(h){var m=this.current;(h[0]!==m[0]||h[1]!==m[1]||this.dirty)&&(this.gl.blendFunc(h[0],h[1]),this.current=h,this.dirty=!1)},d}(xr),Rr=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return o.Color.transparent},d.prototype.set=function(h){var m=this.current;(h.r!==m.r||h.g!==m.g||h.b!==m.b||h.a!==m.a||this.dirty)&&(this.gl.blendColor(h.r,h.g,h.b,h.a),this.current=h,this.dirty=!1)},d}(xr),nn=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return this.gl.FUNC_ADD},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.blendEquation(h),this.current=h,this.dirty=!1)},d}(xr),_i=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return!1},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;h?m.enable(m.CULL_FACE):m.disable(m.CULL_FACE),this.current=h,this.dirty=!1}},d}(xr),Me=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return this.gl.BACK},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.cullFace(h),this.current=h,this.dirty=!1)},d}(xr),kt=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return this.gl.CCW},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.frontFace(h),this.current=h,this.dirty=!1)},d}(xr),$t=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.useProgram(h),this.current=h,this.dirty=!1)},d}(xr),lr=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return this.gl.TEXTURE0},d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.activeTexture(h),this.current=h,this.dirty=!1)},d}(xr),Ye=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){var h=this.gl;return[0,0,h.drawingBufferWidth,h.drawingBufferHeight]},d.prototype.set=function(h){var m=this.current;(h[0]!==m[0]||h[1]!==m[1]||h[2]!==m[2]||h[3]!==m[3]||this.dirty)&&(this.gl.viewport(h[0],h[1],h[2],h[3]),this.current=h,this.dirty=!1)},d}(xr),Rt=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,h),this.current=h,this.dirty=!1}},d}(xr),Ae=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,h),this.current=h,this.dirty=!1}},d}(xr),Gt=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;m.bindTexture(m.TEXTURE_2D,h),this.current=h,this.dirty=!1}},d}(xr),Tt=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;m.bindBuffer(m.ARRAY_BUFFER,h),this.current=h,this.dirty=!1}},d}(xr),j=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d.prototype.set=function(h){var m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h),this.current=h,this.dirty=!1},d}(xr),bt=function(l){function d(h){l.call(this,h),this.vao=h.extVertexArrayObject}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d.prototype.set=function(h){this.vao&&(h!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(h),this.current=h,this.dirty=!1)},d}(xr),Bt=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return 4},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;m.pixelStorei(m.UNPACK_ALIGNMENT,h),this.current=h,this.dirty=!1}},d}(xr),Ce=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return!1},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h),this.current=h,this.dirty=!1}},d}(xr),Je=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return!1},d.prototype.set=function(h){if(h!==this.current||this.dirty){var m=this.gl;m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,h),this.current=h,this.dirty=!1}},d}(xr),lt=function(l){function d(h,m){l.call(this,h),this.context=h,this.parent=m}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d}(xr),Y=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.setDirty=function(){this.dirty=!0},d.prototype.set=function(h){if(h!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,h,0),this.current=h,this.dirty=!1}},d}(lt),ne=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.set=function(h){if(h!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var m=this.gl;m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,h),this.current=h,this.dirty=!1}},d}(lt),le=function(l,d,h,m){this.context=l,this.width=d,this.height=h;var T=this.framebuffer=l.gl.createFramebuffer();
2102this.colorAttachment=new Y(l,T),m&&(this.depthAttachment=new ne(l,T))};le.prototype.destroy=function(){var l=this.context.gl,d=this.colorAttachment.get();if(d&&l.deleteTexture(d),this.depthAttachment){var h=this.depthAttachment.get();h&&l.deleteRenderbuffer(h)}l.deleteFramebuffer(this.framebuffer)};var ve=function(l,d,h){this.func=l,this.mask=d,this.range=h};ve.ReadOnly=!1,ve.ReadWrite=!0,ve.disabled=new ve(519,ve.ReadOnly,[0,1]);var Oe=function(l,d,h,m,T,P){this.test=l,this.ref=d,this.mask=h,this.fail=m,this.depthFail=T,this.pass=P};Oe.disabled=new Oe({func:519,mask:0},0,0,7680,7680,7680);var he=function(l,d,h){this.blendFunction=l,this.blendColor=d,this.mask=h};he.disabled=new he(he.Replace=[1,0],o.Color.transparent,[!1,!1,!1,!1]),he.unblended=new he(he.Replace,o.Color.transparent,[!0,!0,!0,!0]),he.alphaBlended=new he([1,771],o.Color.transparent,[!0,!0,!0,!0]);var be=function(l,d,h){this.enable=l,this.mode=d,this.frontFace=h};be.disabled=new be(!1,1029,2305),be.backCCW=new be(!0,1029,2305);var ae=function(l){this.gl=l,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Vn(this),this.clearDepth=new _r(this),this.clearStencil=new yr(this),this.colorMask=new un(this),this.depthMask=new Dr(this),this.stencilMask=new ci(this),this.stencilFunc=new Yn(this),this.stencilOp=new mn(this),this.stencilTest=new ti(this),this.depthRange=new Hn(this),this.depthTest=new Bn(this),this.depthFunc=new Zn(this),this.blend=new Vt(this),this.blendFunc=new mr(this),this.blendColor=new Rr(this),this.blendEquation=new nn(this),this.cullFace=new _i(this),this.cullFaceSide=new Me(this),this.frontFace=new kt(this),this.program=new $t(this),this.activeTexture=new lr(this),this.viewport=new Ye(this),this.bindFramebuffer=new Rt(this),this.bindRenderbuffer=new Ae(this),this.bindTexture=new Gt(this),this.bindVertexBuffer=new Tt(this),this.bindElementBuffer=new j(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new bt(this),this.pixelStoreUnpack=new Bt(this),this.pixelStoreUnpackPremultiplyAlpha=new Ce(this),this.pixelStoreUnpackFlipY=new Je(this),this.extTextureFilterAnisotropic=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=l.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=l.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(l.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=l.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=l.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE)};ae.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()},ae.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},ae.prototype.createIndexBuffer=function(l,d){return new Ar(this,l,d)},ae.prototype.createVertexBuffer=function(l,d,h){return new Pr(this,l,d,h)},ae.prototype.createRenderbuffer=function(l,d,h){var m=this.gl,T=m.createRenderbuffer();return this.bindRenderbuffer.set(T),m.renderbufferStorage(m.RENDERBUFFER,l,d,h),this.bindRenderbuffer.set(null),T},ae.prototype.createFramebuffer=function(l,d,h){return new le(this,l,d,h)},ae.prototype.clear=function(l){var d=l.color,h=l.depth,m=this.gl,T=0;d&&(T|=m.COLOR_BUFFER_BIT,this.clearColor.set(d),this.colorMask.set([!0,!0,!0,!0])),h!==void 0&&(T|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(h),this.depthMask.set(!0)),m.clear(T)},ae.prototype.setCullFace=function(l){l.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(l.mode),this.frontFace.set(l.frontFace))},ae.prototype.setDepthMode=function(l){l.func!==this.gl.ALWAYS||l.mask?(this.depthTest.set(!0),this.depthFunc.set(l.func),this.depthMask.set(l.mask),this.depthRange.set(l.range)):this.depthTest.set(!1)},ae.prototype.setStencilMode=function(l){l.test.func!==this.gl.ALWAYS||l.mask?(this.stencilTest.set(!0),this.stencilMask.set(l.mask),this.stencilOp.set([l.fail,l.depthFail,l.pass]),this.stencilFunc.set({func:l.test.func,ref:l.ref,mask:l.test.mask})):this.stencilTest.set(!1)},ae.prototype.setColorMode=function(l){o.deepEqual(l.blendFunction,he.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(l.blendFunction),this.blendColor.set(l.blendColor)),this.colorMask.set(l.mask)},ae.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Be=function(l){function d(h,m,T){var P=this;l.call(this),this.id=h,this.dispatcher=T,this.on("data",function(R){R.dataType==="source"&&R.sourceDataType==="metadata"&&(P._sourceLoaded=!0),P._sourceLoaded&&!P._paused&&R.dataType==="source"&&R.sourceDataType==="content"&&(P.reload(),P.transform&&P.update(P.transform))}),this.on("error",function(){P._sourceErrored=!0}),this._source=function(R,L,z,X){var ee=new st[L.type](R,L,z,X);if(ee.id!==R)throw new Error("Expected Source id to be "+R+" instead of "+ee.id);return o.bindAll(["load","abort","unload","serialize","prepare"],ee),ee}(h,m,T,this),this._tiles={},this._cache=new Nt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
2102,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new o.SourceFeatureState}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.onAdd=function(h){this.map=h,this._maxTileCacheSize=h?h._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(h)},d.prototype.onRemove=function(h){this._source&&this._source.onRemove&&this._source.onRemove(h)},d.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(var h in this._tiles){var m=this._tiles[h];if(m.state!=="loaded"&&m.state!=="errored")return!1}return!0},d.prototype.getSource=function(){return this._source},d.prototype.pause=function(){this._paused=!0},d.prototype.resume=function(){if(this._paused){var h=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,h&&this.reload(),this.transform&&this.update(this.transform)}},d.prototype._loadTile=function(h,m){return this._source.loadTile(h,m)},d.prototype._unloadTile=function(h){if(this._source.unloadTile)return this._source.unloadTile(h,function(){})},d.prototype._abortTile=function(h){if(this._source.abortTile)return this._source.abortTile(h,function(){})},d.prototype.serialize=function(){return this._source.serialize()},d.prototype.prepare=function(h){for(var m in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var T=this._tiles[m];T.upload(h),T.prepare(this.map.style.imageManager)}},d.prototype.getIds=function(){return o.values(this._tiles).map(function(h){return h.tileID}).sort(g).map(function(h){return h.key})},d.prototype.getRenderableIds=function(h){var m=this,T=[];for(var P in this._tiles)this._isIdRenderable(P,h)&&T.push(this._tiles[P]);return h?T.sort(function(R,L){var z=R.tileID,X=L.tileID,ee=new o.Point(z.canonical.x,z.canonical.y)._rotate(m.transform.angle),Z=new o.Point(X.canonical.x,X.canonical.y)._rotate(m.transform.angle);return z.overscaledZ-X.overscaledZ||Z.y-ee.y||Z.x-ee.x}).map(function(R){return R.tileID.key}):T.map(function(R){return R.tileID}).sort(g).map(function(R){return R.key})},d.prototype.hasRenderableParent=function(h){var m=this.findLoadedParent(h,0);return!!m&&this._isIdRenderable(m.tileID.key)},d.prototype._isIdRenderable=function(h,m){return this._tiles[h]&&this._tiles[h].hasData()&&!this._coveredTiles[h]&&(m||!this._tiles[h].holdingForFade())},d.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var h in this._cache.reset(),this._tiles)this._tiles[h].state!=="errored"&&this._reloadTile(h,"reloading")},d.prototype._reloadTile=function(h,m){var T=this._tiles[h];T&&(T.state!=="loading"&&(T.state=m),this._loadTile(T,this._tileLoaded.bind(this,T,h,m)))},d.prototype._tileLoaded=function(h,m,T,P){if(P)return h.state="errored",void(P.status!==404?this._source.fire(new o.ErrorEvent(P,{tile:h})):this.update(this.transform));h.timeAdded=o.browser.now(),T==="expired"&&(h.refreshedUponExpiration=!0),this._setTileReloadTimer(m,h),this.get
2102Source().type==="raster-dem"&&h.dem&&this._backfillDEM(h),this._state.initializeTileState(h,this.map?this.map.painter:null),this._source.fire(new o.Event("data",{dataType:"source",tile:h,coord:h.tileID}))},d.prototype._backfillDEM=function(h){for(var m=this.getRenderableIds(),T=0;T<m.length;T++){var P=m[T];if(h.neighboringTiles&&h.neighboringTiles[P]){var R=this.getTileByID(P);L(h,R),L(R,h)}}function L(z,X){z.needsHillshadePrepare=!0;var ee=X.tileID.canonical.x-z.tileID.canonical.x,Z=X.tileID.canonical.y-z.tileID.canonical.y,te=Math.pow(2,z.tileID.canonical.z),oe=X.tileID.key;ee===0&&Z===0||Math.abs(Z)>1||(Math.abs(ee)>1&&(Math.abs(ee+te)===1?ee+=te:Math.abs(ee-te)===1&&(ee-=te)),X.dem&&z.dem&&(z.dem.backfillBorder(X.dem,ee,Z),z.neighboringTiles&&z.neighboringTiles[oe]&&(z.neighboringTiles[oe].backfilled=!0)))}},d.prototype.getTile=function(h){return this.getTileByID(h.key)},d.prototype.getTileByID=function(h){return this._tiles[h]},d.prototype._retainLoadedChildren=function(h,m,T,P){for(var R in this._tiles){var L=this._tiles[R];if(!(P[R]||!L.hasData()||L.tileID.overscaledZ<=m||L.tileID.overscaledZ>T)){for(var z=L.tileID;L&&L.tileID.overscaledZ>m+1;){var X=L.tileID.scaledTo(L.tileID.overscaledZ-1);(L=this._tiles[X.key])&&L.hasData()&&(z=X)}for(var ee=z;ee.overscaledZ>m;)if(h[(ee=ee.scaledTo(ee.overscaledZ-1)).key]){P[z.key]=z;break}}}},d.prototype.findLoadedParent=function(h,m){if(h.key in this._loadedParentTiles){var T=this._loadedParentTiles[h.key];return T&&T.tileID.overscaledZ>=m?T:null}for(var P=h.overscaledZ-1;P>=m;P--){var R=h.scaledTo(P),L=this._getLoadedTile(R);if(L)return L}},d.prototype._getLoadedTile=function(h){var m=this._tiles[h.key];return m&&m.hasData()?m:this._cache.getByKey(h.wrapped().key)},d.prototype.updateCacheSize=function(h){var m=Math.ceil(h.width/this._source.tileSize)+1,T=Math.ceil(h.height/this._source.tileSize)+1,P=Math.floor(m*T*5),R=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,P):P;this._cache.setMaxSize(R)},d.prototype.handleWrapJump=function(h){var m=Math.round((h-(this._prevLng===void 0?h:this._prevLng))/360);if(this._prevLng=h,m){var T={};for(var P in this._tiles){var R=this._tiles[P];R.tileID=R.tileID.unwrapTo(R.tileID.wrap+m),T[R.tileID.key]=R}for(var L in this._tiles=T,this._timers)clearTimeout(this._timers[L]),delete this._timers[L];for(var z in this._tiles)this._setTileReloadTimer(z,this._tiles[z])}},d.prototype.update=function(h){var m=this;if(this.transform=h,this._sourceLoaded&&!this._paused){var T;this.updateCacheSize(h),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?T=h.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(pt){return new o.OverscaledTileID(pt.canonical.z,pt.wrap,pt.canonical.z,pt.canonical.x,pt.canonical.y)}):(T=h.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(T=T.filter(function(pt){return m._source.hasTile(pt)}))):T=[];var P=h.coveringZoomLevel(this._source),R=Math.max(P-d.maxOverzooming,this._source.minzoom),L=Math.max(P+d.maxUnderzooming,this._source.minzoom),z=this._updateRetainedTiles(T,P);if(ce(this._source.type)){for(var X={},ee={},Z=0,te=Object.keys(z);Z<te.length;Z+=1){var oe=te[Z],we=z[oe],Fe=this._tiles[oe];if(Fe&&!(Fe.fadeEndTime&&Fe.fadeEndTime<=o.browser.now())){var ge=this.findLoadedParent(we,R);ge&&(this._addTile(ge.tileID),X[ge.tileID.key]=ge.tileID),ee[oe]=we}}for(var Re in this._retainLoadedChildren(ee,P,L,z),X)z[Re]||(this._coveredTiles[Re]=!0,z[Re]=X[Re])}for(var He in z)this._tiles[He].clearFadeHold();for(var We=0,nt=o.keysDifference(this._tiles,z);We<nt.length;We+=1){var Xe=nt[We],Qe=this._tiles[Xe];Qe.hasSymbolBuckets&&!Qe.holdingForFade()?Qe.setHoldDuration(this.map._fadeDuration):Qe.hasSymbolBuckets&&!Qe.symbolFadeFinished()||this._removeTile(Xe)}this._updateLoadedParentTileCache()}},d.prototype.releaseSymbolFadeTiles=function(){for(var h in this._tiles)this._tiles[h].holdingForFade()&&this._removeTile(h)},d.prototype._updateRetainedTiles=function(h,m){for(var T={},P={},R=Math.max(m-d.maxOverzooming,this._source.minzoom),L=Math.max(m+d.maxUnderzooming,this._source.minzoom),z={},X=0,ee=h;X<ee.length;X+=1){var Z=ee[X],te=this._addTile(Z);T[Z.key]=Z,te.hasData()||m<this._source.maxzoom&&(z[Z.key]=Z)}this._retainLoadedChildren(z,m,L,T);for(var oe=0,we=h;oe<we.length;
2102oe+=1){var Fe=we[oe],ge=this._tiles[Fe.key];if(!ge.hasData()){if(m+1>this._source.maxzoom){var Re=Fe.children(this._source.maxzoom)[0],He=this.getTile(Re);if(He&&He.hasData()){T[Re.key]=Re;continue}}else{var We=Fe.children(this._source.maxzoom);if(T[We[0].key]&&T[We[1].key]&&T[We[2].key]&&T[We[3].key])continue}for(var nt=ge.wasRequested(),Xe=Fe.overscaledZ-1;Xe>=R;--Xe){var Qe=Fe.scaledTo(Xe);if(P[Qe.key]||(P[Qe.key]=!0,!(ge=this.getTile(Qe))&&nt&&(ge=this._addTile(Qe)),ge&&(T[Qe.key]=Qe,nt=ge.wasRequested(),ge.hasData())))break}}}return T},d.prototype._updateLoadedParentTileCache=function(){for(var h in this._loadedParentTiles={},this._tiles){for(var m=[],T=void 0,P=this._tiles[h].tileID;P.overscaledZ>0;){if(P.key in this._loadedParentTiles){T=this._loadedParentTiles[P.key];break}m.push(P.key);var R=P.scaledTo(P.overscaledZ-1);if(T=this._getLoadedTile(R))break;P=R}for(var L=0,z=m;L<z.length;L+=1)this._loadedParentTiles[z[L]]=T}},d.prototype._addTile=function(h){var m=this._tiles[h.key];if(m)return m;(m=this._cache.getAndRemove(h))&&(this._setTileReloadTimer(h.key,m),m.tileID=h,this._state.initializeTileState(m,this.map?this.map.painter:null),this._cacheTimers[h.key]&&(clearTimeout(this._cacheTimers[h.key]),delete this._cacheTimers[h.key],this._setTileReloadTimer(h.key,m)));var T=!!m;return T||(m=new o.Tile(h,this._source.tileSize*h.overscaleFactor()),this._loadTile(m,this._tileLoaded.bind(this,m,h.key,m.state))),m?(m.uses++,this._tiles[h.key]=m,T||this._source.fire(new o.Event("dataloading",{tile:m,coord:m.tileID,dataType:"source"})),m):null},d.prototype._setTileReloadTimer=function(h,m){var T=this;h in this._timers&&(clearTimeout(this._timers[h]),delete this._timers[h]);var P=m.getExpiryTimeout();P&&(this._timers[h]=setTimeout(function(){T._reloadTile(h,"expired"),delete T._timers[h]},P))},d.prototype._removeTile=function(h){var m=this._tiles[h];m&&(m.uses--,delete this._tiles[h],this._timers[h]&&(clearTimeout(this._timers[h]),delete this._timers[h]),m.uses>0||(m.hasData()&&m.state!=="reloading"?this._cache.add(m.tileID,m,m.getExpiryTimeout()):(m.aborted=!0,this._abortTile(m),this._unloadTile(m))))},d.prototype.clearTiles=function(){for(var h in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(h);this._cache.reset()},d.prototype.tilesIn=function(h,m,T){var P=this,R=[],L=this.transform;if(!L)return R;for(var z=T?L.getCameraQueryGeometry(h):h,X=h.map(function(Xe){return L.pointCoordinate(Xe)}),ee=z.map(function(Xe){return L.pointCoordinate(Xe)}),Z=this.getIds(),te=1/0,oe=1/0,we=-1/0,Fe=-1/0,ge=0,Re=ee;ge<Re.length;ge+=1){var He=Re[ge];te=Math.min(te,He.x),oe=Math.min(oe,He.y),we=Math.max(we,He.x),Fe=Math.max(Fe,He.y)}for(var We=function(Xe){var Qe=P._tiles[Z[Xe]];if(!Qe.holdingForFade()){var pt=Qe.tileID,Dt=Math.pow(2,L.zoom-Qe.tileID.overscaledZ),Ct=m*Qe.queryPadding*o.EXTENT/Qe.tileSize/Dt,zt=[pt.getTilePoint(new o.MercatorCoordinate(te,oe)),pt.getTilePoint(new o.MercatorCoordinate(we,Fe))];if(zt[0].x-Ct<o.EXTENT&&zt[0].y-Ct<o.EXTENT&&zt[1].x+Ct>=0&&zt[1].y+Ct>=0){var sr=X.map(function(Mr){return pt.getTilePoint(Mr)}),Er=ee.map(function(Mr){return pt.getTilePoint(Mr)});R.push({tile:Qe,tileID:pt,queryGeometry:sr,cameraQueryGeometry:Er,scale:Dt})}}},nt=0;nt<Z.length;nt++)We(nt);return R},d.prototype.getVisibleCoordinates=function(h){for(var m=this,T=this.getRenderableIds(h).map(function(z){return m._tiles[z].tileID}),P=0,R=T;P<R.length;P+=1){var L=R[P];L.posMatrix=this.transform.calculatePosMatrix(L.toUnwrapped())}return T},d.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(ce(this._source.type))for(var h in this._tiles){var m=this._tiles[h];if(m.fadeEndTime!==void 0&&m.fadeEndTime>=o.browser.now())return!0}return!1},d.prototype.setFeatureState=function(h,m,T){this._state.updateState(h=h||"_geojsonTileLayer",m,T)},d.prototype.removeFeatureState=function(h,m,T){this._state.removeFeatureState(h=h||"_geojsonTileLayer",m,T)},d.prototype.getFeatureState=function(h,m){return this._state.getState(h=h||"_geojsonTileLayer",m)},d.prototype.setDependencies=function(h,m,T){var P=this._tiles[h];P&&P.setDependencies(m,T)},d.prototype.reloadTilesForDependencies=function(h,m){for(var T in this._tiles)this._tiles[T].hasDependency(h,m)&&this._reloadTile(T,"reloading");this._cache.filter(function(P){return!P.hasDependency(h,m)})},d}(o.Evented);function g(l,d){var h=Math.abs(2*l.wrap)-+(l.wrap<0),m=Math.abs(2*d.wrap)-+(d.wrap<0);return l.overscaledZ-d.overscaledZ||m-h||d.canonical.y-l.canonical.y||d.canonical.x-l.canonical.x}function ce(l){return l==="raster"||l==="image"||l==="video"}
vendor: 37,839 bytes, line 2102
2102function xt(){return new o.window.Worker(O.workerUrl)}Be.maxOverzooming=10,Be.maxUnderzooming=3;var Ke="mapboxgl_preloaded_worker_pool",Et=function(){this.active={}};Et.prototype.acquire=function(l){if(!this.workers)for(this.workers=[];this.workers.length<Et.workerCount;)this.workers.push(new xt);return this.active[l]=!0,this.workers.slice()},Et.prototype.release=function(l){delete this.active[l],this.numActive()===0&&(this.workers.forEach(function(d){d.terminate()}),this.workers=null)},Et.prototype.isPreloaded=function(){return!!this.active[Ke]},Et.prototype.numActive=function(){return Object.keys(this.active).length};var Pt,Ot=Math.floor(o.browser.hardwareConcurrency/2);function ht(){return Pt||(Pt=new Et),Pt}function Lt(l,d){var h={};for(var m in l)m!=="ref"&&(h[m]=l[m]);return o.refProperties.forEach(function(T){T in d&&(h[T]=d[T])}),h}function Mt(l){l=l.slice();for(var d=Object.create(null),h=0;h<l.length;h++)d[l[h].id]=l[h];for(var m=0;m<l.length;m++)"ref"in l[m]&&(l[m]=Lt(l[m],d[l[m].ref]));return l}Et.workerCount=Math.max(Math.min(Ot,6),1);var Ht={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 Ur(l,d,h){h.push({command:Ht.addSource,args:[l,d[l]]})}function Qt(l,d,h){d.push({command:Ht.removeSource,args:[l]}),h[l]=!0}function en(l,d,h,m){Qt(l,h,m),Ur(l,d,h)}function cn(l,d,h){var m;for(m in l[h])if(l[h].hasOwnProperty(m)&&m!=="data"&&!o.deepEqual(l[h][m],d[h][m]))return!1;for(m in d[h])if(d[h].hasOwnProperty(m)&&m!=="data"&&!o.deepEqual(l[h][m],d[h][m]))return!1;return!0}function Wr(l,d,h,m,T,P){var R;for(R in d=d||{},l=l||{})l.hasOwnProperty(R)&&(o.deepEqual(l[R],d[R])||h.push({command:P,args:[m,R,d[R],T]}));for(R in d)d.hasOwnProperty(R)&&!l.hasOwnProperty(R)&&(o.deepEqual(l[R],d[R])||h.push({command:P,args:[m,R,d[R],T]}))}function Jr(l){return l.id}function Vr(l,d){return l[d.id]=d,l}var yi=function(l,d){this.reset(l,d)};yi.prototype.reset=function(l,d){this.points=l||[],this._distances=[0];for(var h=1;h<this.points.length;h++)this._distances[h]=this._distances[h-1]+this.points[h].dist(this.points[h-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(d||0,.5*this.length),this.paddedLength=this.length-2*this.padding},yi.prototype.lerp=function(l){if(this.points.length===1)return this.points[0];l=o.clamp(l,0,1);for(var d=1,h=this._distances[d],m=l*this.paddedLength+this.padding;h<m&&d<this._distances.length;)h=this._distances[++d];var T=d-1,P=this._distances[T],R=h-P,L=R>0?(m-P)/R:0;return this.points[T].mult(1-L).add(this.points[d].mult(L))};var Xr=function(l,d,h){var m=this.boxCells=[],T=this.circleCells=[];this.xCellCount=Math.ceil(l/h),this.yCellCount=Math.ceil(d/h);for(var P=0;P<this.xCellCount*this.yCellCount;P++)m.push([]),T.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=l,this.height=d,this.xScale=this.xCellCount/l,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0};function pr(l,d,h,m,T){var P=o.create();return d?(o.scale(P,P,[1/T,1/T,1]),h||o.rotateZ(P,P,m.angle)):o.multiply(P,m.labelPlaneMatrix,l),P}function Ie(l,d,h,m,T){if(d){var P=o.clone(l);return o.scale(P,P,[T,T,1]),h||o.rotateZ(P,P,-m.angle),P}return m.glCoordMatrix}function Xt(l,d){var h=[l.x,l.y,0,1];ui(h,h,d);var m=h[3];return{point:new o.Point(h[0]/m,h[1]/m),signedDistanceFromCamera:m}}function tn(l,d){return .5+l/d*.5}function $i(l,d){var h=l[0]/l[3],m=l[1]/l[3];return h>=-d[0]&&h<=d[0]&&m>=-d[1]&&m<=d[1]}function ya(l,d,h,m,T,P,R,L){var z=m?l.textSizeData:l.iconSizeData,X=o.evaluateSizeForZoom(z,h.transform.zoom),ee=[256/h.width*2+1,256/h.height*2+1],Z=m?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;Z.clear();for(var te=l.lineVertexArray,oe=m?l.text.placedSymbolArray:l.icon.placedSymbolArray,we=h.transform.width/h.transform.height,Fe=!1,ge=0;ge<oe.length;ge++){var Re=oe.get(ge);if(Re.hidden||Re.writingMode===o.WritingMode.vertical&&!Fe)Oi(Re.numGlyphs,Z);else{Fe=!1;var He=[Re.anchorX,Re.anchorY,0,1];if(o.transformMat4(He,He,d),$i(He,ee)){var We=tn(h.transform.cameraToCenterDistance,He[3]),nt=o.evaluateSizeForFeature(z,X,Re),Xe=R?nt/We:nt*We,Qe=new o.Point(Re.anchorX,Re.anchorY),pt=Xt(Qe,T).point,Dt={},Ct=Se(Re,Xe,!1,L,d,T,P,l.glyphOffsetArray,te,Z,pt,Qe,Dt,we);Fe=Ct.useVertical,(Ct.notEnoughRoom||Fe||Ct.needsFlipping&&Se(Re,Xe,!0,L,d,T,P,l.glyphOffsetArray,te,Z,pt,Qe,Dt,we).notEnoughRoom)&&Oi(Re.numGlyphs,Z)}else Oi(Re.numGlyphs,Z)}}m?l.text.dynamicLayoutVertexBuffer.updateData(Z):l.icon.dynamicLayoutVertexBuffer.updateData(Z)}function li(l,d,h,m,T,P,R,L,z,X,ee){var Z=L.glyphStartIndex+L.numGlyphs,te=L.lineStartIndex,oe=L.lineStartIndex+L.lineLength,we=d.getoffsetX(L.glyphStartIndex),Fe=d.getoffsetX(Z-1),ge=$n(l*we,h,m,T,P,R,L.segment,te,oe,z,X,ee);if(!ge)return null;var Re=$n(l*Fe,h,m,T,P,R,L.segment,te,oe,z,X,ee);return Re?{first:ge,last:Re}:null}function jn(l,d,h,m){return l===o.WritingMode.horizontal&&Math.abs(h.y-d.y)>Math.abs(h.x-d.x)*m?{useVertical:!0}:(l===o.WritingMode.vertical?d.y<h.y:d.x>h.x)?{needsFlipping:!0}:null}function Se(l,d,h,m,T,P,R,L,z,X,ee,Z,te,oe){var we,Fe=d/24,ge=l.lineOffsetX*Fe,Re=l.lineOffsetY*Fe;if(l.numGlyphs>1){var He=l.glyphStartIndex+l.numGlyphs,We=l.lineStartIndex,nt=l.lineStartIndex+l.lineLength,Xe=li(Fe,L,ge,Re,h,ee,Z,l,z,P,te);if(!Xe)return{notEnoughRoom:!0};var Qe=Xt(Xe.first.point,R).point,pt=Xt(Xe.last.point,R).point;if(m&&!h){var Dt=jn(l.writingMode,Qe,pt,oe);if(Dt)return Dt}we=[Xe.first];for(var Ct=l.glyphStartIndex+1;Ct<He-1;Ct++)we.push($n(Fe*L.getoffsetX(Ct),ge,Re,h,ee,Z,l.segment,We,nt,z,P,te));we.push(Xe.last)}else{if(m&&!h){var zt=Xt(Z,T).point,sr=l.lineStartIndex+l.segment+1,Er=new o.Point(z.getx(sr),z.gety(sr)),Mr=Xt(Er,T),xn=Mr.signedDistanceFromCamera>0?Mr.point:$o(Z,Er,zt,1,T),ar=jn(l.writingMode,zt,xn,oe);if(ar)return ar}var $r=$n(Fe*L.getoffsetX(l.glyphStartIndex),ge,Re,h,ee,Z,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,z,P,te);if(!$r)return{notEnoughRoom:!0};we=[$r]}for(var rn=0,jr=we;rn<jr.length;rn+=1){var Gr=jr[rn];o.addDynamicAttributes(X,Gr.point,Gr.angle)}return{}}function $o(l,d,h,m,T){var P=Xt(l.add(l.sub(d)._unit()),T).point,R=h.sub(P);return h.add(R._mult(m/R.mag()))}function $n(l,d,h,m,T,P,R,L,z,X,ee,Z){var te=m?l-d:l+d,oe=te>0?1:-1,we=0;m&&(oe*=-1,we=Math.PI),oe<0&&(we+=Math.PI);for(var Fe=oe>0?L+R:L+R+1,ge=T,Re=T,He=0,We=0,nt=Math.abs(te),Xe=[];He+We<=nt;){if((Fe+=oe)<L||Fe>=z)return null;if(Re=ge,Xe.push(ge),(ge=Z[Fe])===void 0){var Qe=new o.Point(X.getx(Fe),X.gety(Fe)),pt=Xt(Qe,ee);if(pt.signedDistanceFromCamera>0)ge=Z[Fe]=pt.point;else{var Dt=Fe-oe;ge=$o(He===0?P:new o.Point(X.getx(Dt),X.gety(Dt)),Qe,Re,nt-He+1,ee)}}He+=We,We=Re.dist(ge)}var Ct=(nt-He)/We,zt=ge.sub(Re),sr=zt.mult(Ct)._add(Re);sr._add(zt._unit()._perp()._mult(h*oe));var Er=we+Math.atan2(ge.y-Re.y,ge.x-Re.x);return Xe.push(sr),{point:sr,angle:Er,path:Xe}}Xr.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Xr.prototype.insert=function(l,d,h,m,T){this._forEachCell(d,h,m,T,this._insertBoxCell,this.boxUid++),this.boxKeys.push(l),this.bboxes.push(d),this.bboxes.push(h),this.bboxes.push(m),this.bboxes.push(T)},Xr.prototype.insertCircle=function(l,d,h,m){this._forEachCell(d-m,h-m,d+m,h+m,this._insertCircleCell,this.circleUid++),this.circleKeys.push(l),this.circles.push(d),this.circles.push(h),this.circles.push(m)},Xr.prototype._insertBoxCell=function(l,d,h,m,T,P){this.boxCells[T].push(P)},Xr.prototype._insertCircleCell=function(l,d,h,m,T,P){this.circleCells[T].push(P)},Xr.prototype._query=function(l,d,h,m,T,P){if(h<0||l>this.width||m<0||d>this.height)return!T&&[];var R=[];if(l<=0&&d<=0&&this.width<=h&&this.height<=m){if(T)return!0;for(var L=0;L<this.boxKeys.length;L++)R.push({key:this.boxKeys[L],x1:this.bboxes[4*L],y1:this.bboxes[4*L+1],x2:this.bboxes[4*L+2],y2:this.bboxes[4*L+3]});for(var z=0;z<this.circleKeys.length;z++){var X=this.circles[3*z],ee=this.circles[3*z+1],Z=this.circles[3*z+2];R.push({key:this.circleKeys[z],x1:X-Z,y1:ee-Z,x2:X+Z,y2:ee+Z})}return P?R.filter(P):R}return this._forEachCell(l,d,h,m,this._queryCell,R,{hitTest:T,seenUids:{box:{},circle:{}}},P),T?R.length>0:R},Xr.prototype._queryCircle=function(l,d,h,m,T){var P=l-h,R=l+h,L=d-h,z=d+h;if(R<0||P>this.width||z<0||L>this.height)return!m&&[];var X=[];return this._forEachCell(P,L,R,z,this._queryCellCircle,X,{hitTest:m,circle:{x:l,y:d,radius:h},seenUids:{box:{},circle:{}}},T),m?X.length>0:X},Xr.prototype.query=function(l,d,h,m,T){return this._query(l,d,h,m,!1,T)},Xr.prototype.hitTest=function(l,d,h,m,T){return this._query(l,d,h,m,!0,T)},Xr.prototype.hitTestCircle=function(l,d,h,m){return this._queryCircle(l,d,h,!0,m)},Xr.prototype._queryCell=function(l,d,h,m,T,P,R,L){var z=R.seenUids,X=this.boxCells[T];if(X!==null)for(var ee=this.bboxes,Z=0,te=X;Z<te.length;Z+=1){var oe=te[Z];if(!z.box[oe]){z.box[oe]=!0;var we=4*oe;if(l<=ee[we+2]&&d<=ee[we+3]&&h>=ee[we+0]&&m>=ee[we+1]&&(!L||L(this.boxKeys[oe]))){if(R.hitTest)return P.push(!0),!0;P.push({key:this.boxKeys[oe],x1:ee[we],y1:ee[we+1],x2:ee[we+2],y2:ee[we+3]})}}}var Fe=this.circleCells[T];if(Fe!==null)for(var ge=this.circles,Re=0,He=Fe;Re<He.length;Re+=1){var We=He[Re];if(!z.circle[We]){z.circle[We]=!0;var nt=3*We;if(this._circleAndRectCollide(ge[nt],ge[nt+1],ge[nt+2],l,d,h,m)&&(!L||L(this.circleKeys[We]))){if(R.hitTest)return P.push(!0),!0;var Xe=ge[nt],Qe=ge[nt+1],pt=ge[nt+2];P.push({key:this.circleKeys[We],x1:Xe-pt,y1:Qe-pt,x2:Xe+pt,y2:Qe+pt})}}}},Xr.prototype._queryCellCircle=function(l,d,h,m,T,P,R,L){var z=R.circle,X=R.seenUids,ee=this.boxCells[T];if(ee!==null)for(var Z=this.bboxes,te=0,oe=ee;te<oe.length;te+=1){var we=oe[te];if(!X.box[we]){X.box[we]=!0;var Fe=4*we;if(this._circleAndRectCollide(z.x,z.y,z.radius,Z[Fe+0],Z[Fe+1],Z[Fe+2],Z[Fe+3])&&(!L||L(this.boxKeys[we])))return P.push(!0),!0}}var ge=this.circleCells[T];if(ge!==null)for(var Re=this.circles,He=0,We=ge;He<We.length;He+=1){var nt=We[He];if(!X.circle[nt]){X.circle[nt]=!0;var Xe=3*nt;if(this._circlesCollide(Re[Xe],Re[Xe+1],Re[Xe+2],z.x,z.y,z.radius)&&(!L||L(this.circleKeys[nt])))return P.push(!0),!0}}},Xr.prototype._forEachCell=function(l,d,h,m,T,P,R,L){for(var z=this._convertToXCellCoord(l),X=this._convertToYCellCoord(d),ee=this._convertToXCellCoord(h),Z=this._convertToYCellCoord(m),te=z;te<=ee;te++)for(var oe=X;oe<=Z;oe++)if(T.call(this,l,d,h,m,this.xCellCount*oe+te,P,R,L))return},Xr.prototype._convertToXCellCoord=function(l){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(l*this.xScale)))},Xr.prototype._convertToYCellCoord=function(l){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(l*this.yScale)))},Xr.prototype._circlesCollide=function(l,d,h,m,T,P){var R=m-l,L=T-d,z=h+P;return z*z>R*R+L*L},Xr.prototype._circleAndRectCollide=function(l,d,h,m,T,P,R){var L=(P-m)/2,z=Math.abs(l-(m+L));if(z>L+h)return!1;var X=(R-T)/2,ee=Math.abs(d-(T+X));if(ee>X+h)return!1;if(z<=L||ee<=X)return!0;var Z=z-L,te=ee-X;return Z*Z+te*te<=h*h};var Wo=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Oi(l,d){for(var h=0;h<l;h++){var m=d.length;d.resize(m+4),d.float32.set(Wo,3*m)}}function ui(l,d,h){var m=d[0],T=d[1];return l[0]=h[0]*m+h[4]*T+h[12],l[1]=h[1]*m+h[5]*T+h[13],l[3]=h[3]*m+h[7]*T+h[15],l}var Ii=function(l,d,h){d===void 0&&(d=new Xr(l.width+200,l.height+200,25)),h===void 0&&(h=new Xr(l.width+200,l.height+200,25)),this.transform=l,this.grid=d,this.ignoredGrid=h,this.pitchfactor=Math.cos(l._pitch)*l.cameraToCenterDistance,this.screenRightBoundary=l.width+100,this.screenBottomBoundary=l.height+100,this.gridRightBoundary=l.width+200,this.gridBottomBoundary=l.height+200};function Rn(l,d,h){return d*(o.EXTENT/(l.tileSize*Math.pow(2,h-l.tileID.overscaledZ)))}Ii.prototype.placeCollisionBox=function(l,d,h,m,T){var P=this.projectAndGetPerspectiveRatio(m,l.anchorPointX,l.anchorPointY),R=h*P.perspectiveRatio,L=l.x1*R+P.point.x,z=l.y1*R+P.point.y,X=l.x2*R+P.point.x,ee=l.y2*R+P.point.y;return!this.isInsideGrid(L,z,X,ee)||!d&&this.grid.hitTest(L,z,X,ee,T)?{box:[],offscreen:!1}:{box:[L,z,X,ee],offscreen:this.isOffscreen(L,z,X,ee)}},Ii.prototype.placeCollisionCircles=function(l,d,h,m,T,P,R,L,z,X,ee,Z,te){var oe=[],we=new o.Point(d.anchorX,d.anchorY),Fe=Xt(we,P),ge=tn(this.transform.cameraToCenterDistance,Fe.signedDistanceFromCamera),Re=(X?T/ge:T*ge)/o.ONE_EM,He=Xt(we,R).point,We=li(Re,m,d.lineOffsetX*Re,d.lineOffsetY*Re,!1,He,we,d,h,R,{}),nt=!1,Xe=!1,Qe=!0;if(We){for(var pt=.5*Z*ge+te,Dt=new o.Point(-100,-100),Ct=new o.Point(this.screenRightBoundary,this.screenBottomBoundary),zt=new yi,sr=We.first,Er=We.last,Mr=[],xn=sr.path.length-1;xn>=1;xn--)Mr.push(sr.path[xn]);for(var ar=1;ar<Er.path.length;ar++)Mr.push(Er.path[ar]);var $r=2.5*pt;if(L){var rn=Mr.map(function(Lo){return Xt(Lo,L)});Mr=rn.some(function(Lo){return Lo.signedDistanceFromCamera<=0})?[]:rn.map(function(Lo){return Lo.point})}var jr=[];if(Mr.length>0){for(var Gr=Mr[0].clone(),Zr=Mr[0].clone(),kr=1;kr<Mr.length;kr++)Gr.x=Math.min(Gr.x,Mr[kr].x),Gr.y=Math.min(Gr.y,Mr[kr].y),Zr.x=Math.max(Zr.x,Mr[kr].x),Zr.y=Math.max(Zr.y,Mr[kr].y);jr=Gr.x>=Dt.x&&Zr.x<=Ct.x&&Gr.y>=Dt.y&&Zr.y<=Ct.y?[Mr]:Zr.x<Dt.x||Gr.x>Ct.x||Zr.y<Dt.y||Gr.y>Ct.y?[]:o.clipLine([Mr],Dt.x,Dt.y,Ct.x,Ct.y)}for(var Or=0,qi=jr;Or<qi.length;Or+=1){var Ei;zt.reset(qi[Or],.25*pt),Ei=zt.length<=.5*pt?1:Math.ceil(zt.paddedLength/$r)+1;for(var vs=0;vs<Ei;vs++){var as=vs/Math.max(Ei-1,1),bi=zt.lerp(as),Mi=bi.x+100,ao=bi.y+100;oe.push(Mi,ao,pt,0);var Ps=Mi-pt,jc=ao-pt,$s=Mi+pt,oa=ao+pt;if(Qe=Qe&&this.isOffscreen(Ps,jc,$s,oa),Xe=Xe||this.isInsideGrid(Ps,jc,$s,oa),!l&&this.grid.hitTestCircle(Mi,ao,pt,ee)&&(nt=!0,!z))return{circles:[],offscreen:!1,collisionDetected:nt}}}}return{circles:!z&&nt||!Xe?[]:oe,offscreen:Qe,collisionDetected:nt}},Ii.prototype.queryRenderedSymbols=function(l){if(l.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};for(var d=[],h=1/0,m=1/0,T=-1/0,P=-1/0,R=0,L=l;R<L.length;R+=1){var z=L[R],X=new o.Point(z.x+100,z.y+100);h=Math.min(h,X.x),m=Math.min(m,X.y),T=Math.max(T,X.x),P=Math.max(P,X.y),d.push(X)}for(var ee={},Z={},te=0,oe=this.grid.query(h,m,T,P).concat(this.ignoredGrid.query(h,m,T,P));te<oe.length;te+=1){var we=oe[te],Fe=we.key;if(ee[Fe.bucketInstanceId]===void 0&&(ee[Fe.bucketInstanceId]={}),!ee[Fe.bucketInstanceId][Fe.featureIndex]){var ge=[new o.Point(we.x1,we.y1),new o.Point(we.x2,we.y1),new o.Point(we.x2,we.y2),new o.Point(we.x1,we.y2)];o.polygonIntersectsPolygon(d,ge)&&(ee[Fe.bucketInstanceId][Fe.featureIndex]=!0,Z[Fe.bucketInstanceId]===void 0&&(Z[Fe.bucketInstanceId]=[]),Z[Fe.bucketInstanceId].push(Fe.featureIndex))}}return Z},Ii.prototype.insertCollisionBox=function(l,d,h,m,T){(d?this.ignoredGrid:this.grid).insert({bucketInstanceId:h,featureIndex:m,collisionGroupID:T},l[0],l[1],l[2],l[3])},Ii.prototype.insertCollisionCircles=function(l,d,h,m,T){for(var P=d?this.ignoredGrid:this.grid,R={bucketInstanceId:h,featureIndex:m,collisionGroupID:T},L=0;L<l.length;L+=4)P.insertCircle(R,l[L],l[L+1],l[L+2])},Ii.prototype.projectAndGetPerspectiveRatio=function(l,d,h){var m=[d,h,0,1];return ui(m,m,l),{point:new o.Point((m[0]/m[3]+1)/2*this.transform.width+100,(-m[1]/m[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/m[3]*.5}},Ii.prototype.isOffscreen=function(l,d,h,m){return h<100||l>=this.screenRightBoundary||m<100||d>this.screenBottomBoundary},Ii.prototype.isInsideGrid=function(l,d,h,m){return h>=0&&l<this.gridRightBoundary&&m>=0&&d<this.gridBottomBoundary},Ii.prototype.getViewportMatrix=function(){var l=o.identity([]);return o.translate(l,l,[-100,-100,0]),l};var ms=function(l,d,h,m){this.opacity=l?Math.max(0,Math.min(1,l.opacity+(l.placed?d:-d))):m&&h?1:0,this.placed=h};ms.prototype.isHidden=function(){return this.opacity===0&&!this.placed};var Wi=function(l,d,h,m,T){this.text=new ms(l?l.text:null,d,h,T),this.icon=new ms(l?l.icon:null,d,m,T)};Wi.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var Ns=function(l,d,h){this.text=l,this.icon=d,this.skipFade=h},Sn=function(){this.invProjMatrix=o.create(),this.viewportMatrix=o.create(),this.circles=[]},yl=function(l,d,h,m,T){this.bucketInstanceId=l,this.featureIndex=d,this.sourceLayerIndex=h,this.bucketIndex=m,this.tileID=T},xe=function(l){this.crossSourceCollisions=l,this.maxGroupID=0,this.collisionGroups={}};function Pe(l,d,h,m,T){var P=o.getAnchorAlignment(l),R=-(P.horizontalAlign-.5)*d,L=-(P.verticalAlign-.5)*h,z=o.evaluateVariableOffset(l,m);return new o.Point(R+z[0]*T,L+z[1]*T)}function $e(l,d,h,m,T,P){var R=l.x1,L=l.x2,z=l.y1,X=l.y2,ee=l.anchorPointX,Z=l.anchorPointY,te=new o.Point(d,h);return m&&te._rotate(T?P:-P),{x1:R+te.x,y1:z+te.y,x2:L+te.x,y2:X+te.y,anchorPointX:ee,anchorPointY:Z}}xe.prototype.get=function(l){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[l]){var d=++this.maxGroupID;this.collisionGroups[l]={ID:d,predicate:function(h){return h.collisionGroupID===d}}}return this.collisionGroups[l]};var gt=function(l,d,h,m){this.transform=l.clone(),this.collisionIndex=new Ii(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new xe(h),this.collisionCircleArrays={},this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}};function Wt(l,d,h,m,T){l.emplaceBack(d?1:0,h?1:0,m||0,T||0),l.emplaceBack(d?1:0,h?1:0,m||0,T||0),l.emplaceBack(d?1:0,h?1:0,m||0,T||0),l.emplaceBack(d?1:0,h?1:0,m||0,T||0)}gt.prototype.getBucketParts=function(l,d,h,m){var T=h.getBucket(d),P=h.latestFeatureIndex;if(T&&P&&d.id===T.layerIds[0]){var R=h.collisionBoxArray,L=T.layers[0].layout,z=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),X=h.tileSize/o.EXTENT,ee=this.transform.calculatePosMatrix(h.tileID.toUnwrapped()),Z=L.get("text-pitch-alignment")==="map",te=L.get("text-rotation-alignment")==="map",oe=Rn(h,1,this.transform.zoom),we=pr(ee,Z,te,this.transform,oe),Fe=null;if(Z){var ge=Ie(ee,Z,te,this.transform,oe);Fe=o.multiply([],this.transform.labelPlaneMatrix,ge)}this.retainedQueryData[T.bucketInstanceId]=new yl(T.bucketInstanceId,P,T.sourceLayerIndex,T.index,h.tileID);var Re={bucket:T,layout:L,posMatrix:ee,textLabelPlaneMatrix:we,labelToScreenMatrix:Fe,scale:z,textPixelRatio:X,holdingForFade:h.holdingForFade(),collisionBoxArray:R,partiallyEvaluatedTextSize:o.evaluateSizeForZoom(T.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(T.sourceID)};if(m)for(var He=0,We=T.sortKeyRanges;He<We.length;He+=1){var nt=We[He];l.push({sortKey:nt.sortKey,symbolInstanceStart:nt.symbolInstanceStart,symbolInstanceEnd:nt.symbolInstanceEnd,parameters:Re})}else l.push({symbolInstanceStart:0,symbolInstanceEnd:T.symbolInstances.length,parameters:Re})}},gt.prototype.attemptAnchorPlacement=function(l,d,h,m,T,P,R,L,z,X,ee,Z,te,oe,we){var Fe,ge=[Z.textOffset0,Z.textOffset1],Re=Pe(l,h,m,ge,T),He=this.collisionIndex.placeCollisionBox($e(d,Re.x,Re.y,P,R,this.transform.angle),ee,L,z,X.predicate);if(!we||this.collisionIndex.placeCollisionBox($e(we,Re.x,Re.y,P,R,this.transform.angle),ee,L,z,X.predicate).box.length!==0)return He.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),this.variableOffsets[Z.crossTileID]={textOffset:ge,width:h,height:m,anchor:l,textBoxScale:T,prevAnchor:Fe},this.markUsedJustification(te,l,Z,oe),te.allowVerticalPlacement&&(this.markUsedOrientation(te,oe,Z),this.placedOrientations[Z.crossTileID]=oe),{shift:Re,placedGlyphBoxes:He}):void 0},gt.prototype.placeLayerBucketPart=function(l,d,h){var m=this,T=l.parameters,P=T.bucket,R=T.layout,L=T.posMatrix,z=T.textLabelPlaneMatrix,X=T.labelToScreenMatrix,ee=T.textPixelRatio,Z=T.holdingForFade,te=T.collisionBoxArray,oe=T.partiallyEvaluatedTextSize,we=T.collisionGroup,Fe=R.get("text-optional"),ge=R.get("icon-optional"),Re=R.get("text-allow-overlap"),He=R.get("icon-allow-overlap"),We=R.get("text-rotation-alignment")==="map",nt=R.get("text-pitch-alignment")==="map",Xe=R.get("icon-text-fit")!=="none",Qe=R.get("symbol-z-order")==="viewport-y",pt=Re&&(He||!P.hasIconData()||ge),Dt=He&&(Re||!P.hasTextData()||Fe);!P.collisionArrays&&te&&P.deserializeCollisionBoxes(te);var Ct=function(ar,$r){if(!d[ar.crossTileID])if(Z)m.placements[ar.crossTileID]=new Ns(!1,!1,!1);else{var rn,jr=!1,Gr=!1,Zr=!0,kr=null,Or={box:null,offscreen:null},qi={box:null,offscreen:null},Ei=null,vs=null,as=0,bi=0,Mi=0;$r.textFeatureIndex?as=$r.textFeatureIndex:ar.useRuntimeCollisionCircles&&(as=ar.featureIndex),$r.verticalTextFeatureIndex&&(bi=$r.verticalTextFeatureIndex);var ao=$r.textBox;if(ao){var Ps=function(En){var Bo=o.WritingMode.horizontal;if(P.allowVerticalPlacement&&!En&&m.prevPlacement){var Ws=m.prevPlacement.placedOrientations[ar.crossTileID];Ws&&(m.placedOrientations[ar.crossTileID]=Ws,m.markUsedOrientation(P,Bo=Ws,ar))}return Bo},jc=function(En,Bo){if(P.allowVerticalPlacement&&ar.numVerticalGlyphVertices>0&&$r.verticalTextBox)for(var Ws=0,Ol=P.writingModes;Ws<Ol.length&&(Ol[Ws]===o.WritingMode.vertical?(Or=Bo(),qi=Or):Or=En(),!(Or&&Or.box&&Or.box.length));Ws+=1);else Or=En()};if(R.get("text-variable-anchor")){var $s=R.get("text-variable-anchor");if(m.prevPlacement&&m.prevPlacement.variableOffsets[ar.crossTileID]){var oa=m.prevPlacement.variableOffsets[ar.crossTileID];$s.indexOf(oa.anchor)>0&&($s=$s.filter(function(En){return En!==oa.anchor})).unshift(oa.anchor)}var Lo=function(En,Bo,Ws){for(var Ol=En.x2-En.x1,ov=En.y2-En.y1,Hh=ar.textBoxScale,av=Xe&&!He?Bo:null,Rf={box:[],offscreen:!1},rm=Re?2*$s.length:$s.length,Su=0;Su<rm;++Su){var jh=m.attemptAnchorPlacement($s[Su%$s.length],En,Ol,ov,Hh,We,nt,ee,L,we,Su>=$s.length,ar,P,Ws,av);if(jh&&(Rf=jh.placedGlyphBoxes)&&Rf.box&&Rf.box.length){jr=!0,kr=jh.shift;break}}return Rf};jc(function(){return Lo(ao,$r.iconBox,o.WritingMode.horizontal)},function(){var En=$r.verticalTextBox;return P.allowVerticalPlacement&&!(Or&&Or.box&&Or.box.length)&&ar.numVerticalGlyphVertices>0&&En?Lo(En,$r.verticalIconBox,o.WritingMode.vertical):{box:null,offscreen:null}}),Or&&(jr=Or.box,Zr=Or.offscreen);var If=Ps(Or&&Or.box);if(!jr&&m.prevPlacement){var Eu=m.prevPlacement.variableOffsets[ar.crossTileID];Eu&&(m.variableOffsets[ar.crossTileID]=Eu,m.markUsedJustification(P,Eu.anchor,ar,If))}}else{var $c=function(En,Bo){var Ws=m.collisionIndex.placeCollisionBox(En,Re,ee,L,we.predicate);return Ws&&Ws.box&&Ws.box.length&&(m.markUsedOrientation(P,Bo,ar),m.placedOrientations[ar.crossTileID]=Bo),Ws};jc(function(){return $c(ao,o.WritingMode.horizontal)},function(){var En=$r.verticalTextBox;return P.allowVerticalPlacement&&ar.numVerticalGlyphVertices>0&&En?$c(En,o.WritingMode.vertical):{box:null,offscreen:null}}),Ps(Or&&Or.box&&Or.box.length)}}if(jr=(rn=Or)&&rn.box&&rn.box.length>0,Zr=rn&&rn.offscreen,ar.useRuntimeCollisionCircles){var Bu=P.text.placedSymbolArray.get(ar.centerJustifiedTextSymbolIndex),Mf=o.evaluateSizeForFeature(P.textSizeData,oe,Bu),Ma=R.get("text-padding");Ei=m.collisionIndex.placeCollisionCircles(Re,Bu,P.lineVertexArray,P.glyphOffsetArray,Mf,L,z,X,h,nt,we.predicate,ar.collisionCircleDiameter,Ma),jr=Re||Ei.circles.length>0&&!Ei.collisionDetected,Zr=Zr&&Ei.offscreen}if($r.iconFeatureIndex&&(Mi=$r.iconFeatureIndex),$r.iconBox){var Pf=function(En){var Bo=Xe&&kr?$e(En,kr.x,kr.y,We,nt,m.transform.angle):En;return m.collisionIndex.placeCollisionBox(Bo,He,ee,L,we.predicate)};Gr=qi&&qi.box&&qi.box.length&&$r.verticalIconBox?(vs=Pf($r.verticalIconBox)).box.length>0:(vs=Pf($r.iconBox)).box.length>0,Zr=Zr&&vs.offscreen}var Pa=Fe||ar.numHorizontalGlyphVertices===0&&ar.numVerticalGlyphVertices===0,Yi=ge||ar.numIconVertices===0;if(Pa||Yi?Yi?Pa||(Gr=Gr&&jr):jr=Gr&&jr:Gr=jr=Gr&&jr,jr&&rn&&rn.box&&m.collisionIndex.insertCollisionBox(rn.box,R.get("text-ignore-placement"),P.bucketInstanceId,qi&&qi.box&&bi?bi:as,we.ID),Gr&&vs&&m.collisionIndex.insertCollisionBox(vs.box,R.get("icon-ignore-placement"),P.bucketInstanceId,Mi,we.ID),Ei&&(jr&&m.collisionIndex.insertCollisionCircles(Ei.circles,R.get("text-ignore-placement"),P.bucketInstanceId,as,we.ID),h)){var sc=P.bucketInstanceId,Wc=m.collisionCircleArrays[sc];Wc===void 0&&(Wc=m.collisionCircleArrays[sc]=new Sn);for(var Dl=0;Dl<Ei.circles.length;Dl+=4)Wc.circles.push(Ei.circles[Dl+0]),Wc.circles.push(Ei.circles[Dl+1]),Wc.circles.push(Ei.circles[Dl+2]),Wc.circles.push(Ei.collisionDetected?1:0)}m.placements[ar.crossTileID]=new Ns(jr||pt,Gr||Dt,Zr||P.justReloaded),d[ar.crossTileID]=!0}};if(Qe)for(var zt=P.getSortedSymbolIndexes(this.transform.angle),sr=zt.length-1;sr>=0;--sr){var Er=zt[sr];Ct(P.symbolInstances.get(Er),P.collisionArrays[Er])}else for(var Mr=l.symbolInstanceStart;Mr<l.symbolInstanceEnd;Mr++)Ct(P.symbolInstances.get(Mr),P.collisionArrays[Mr]);if(h&&P.bucketInstanceId in this.collisionCircleArrays){var xn=this.collisionCircleArrays[P.bucketInstanceId];o.invert(xn.invProjMatrix,L),xn.viewportMatrix=this.collisionIndex.getViewportMatrix()}P.justReloaded=!1},gt.prototype.markUsedJustification=function(l,d,h,m){var T;T=m===o.WritingMode.vertical?h.verticalPlacedTextSymbolIndex:{left:h.leftJustifiedTextSymbolIndex,center:h.centerJustifiedTextSymbolIndex,right:h.rightJustifiedTextSymbolIndex}[o.getAnchorJustification(d)];for(var P=0,R=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex,h.verticalPlacedTextSymbolIndex];P<R.length;P+=1){var L=R[P];L>=0&&(l.text.placedSymbolArray.get(L).crossTileID=T>=0&&L!==T?0:h.crossTileID)}},gt.prototype.markUsedOrientation=function(l,d,h){for(var m=d===o.WritingMode.horizontal||d===o.WritingMode.horizontalOnly?d:0,T=d===o.WritingMode.vertical?d:0,P=0,R=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];P<R.length;P+=1)l.text.placedSymbolArray.get(R[P]).placedOrientation=m;h.verticalPlacedTextSymbolIndex&&(l.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=T)},gt.prototype.commit=function(l){this.commitTime=l,this.zoomAtLastRecencyCheck=this.transform.zoom;var d=this.prevPlacement,h=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;var m=d?d.symbolFadeChange(l):1,T=d?d.opacities:{},P=d?d.variableOffsets:{},R=d?d.placedOrientations:{};for(var L in this.placements){var z=this.placements[L],X=T[L];X?(this.opacities[L]=new Wi(X,m,z.text,z.icon),h=h||z.text!==X.text.placed||z.icon!==X.icon.placed):(this.opacities[L]=new Wi(null,m,z.text,z.icon,z.skipFade),h=h||z.text||z.icon)}for(var ee in T){var Z=T[ee];if(!this.opacities[ee]){var te=new Wi(Z,m,!1,!1);te.isHidden()||(this.opacities[ee]=te,h=h||Z.text.placed||Z.icon.placed)}}for(var oe in P)this.variableOffsets[oe]||!this.opacities[oe]||this.opacities[oe].isHidden()||(this.variableOffsets[oe]=P[oe]);for(var we in R)this.placedOrientations[we]||!this.opacities[we]||this.opacities[we].isHidden()||(this.placedOrientations[we]=R[we]);h?this.lastPlacementChangeTime=l:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:l)},gt.prototype.updateLayerOpacities=function(l,d){for(var h={},m=0,T=d;m<T.length;m+=1){var P=T[m],R=P.getBucket(l);R&&P.latestFeatureIndex&&l.id===R.layerIds[0]&&this.updateBucketOpacities(R,h,P.collisionBoxArray)}},gt.prototype.updateBucketOpacities=function(l,d,h){var m=this;l.hasTextData()&&l.text.opacityVertexArray.clear(),l.hasIconData()&&l.icon.opacityVertexArray.clear(),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexArray.clear(),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexArray.clear();var T=l.layers[0].layout,P=new Wi(null,0,!1,!1,!0),R=T.get("text-allow-overlap"),L=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),X=T.get("text-rotation-alignment")==="map",ee=T.get("text-pitch-alignment")==="map",Z=T.get("icon-text-fit")!=="none",te=new Wi(null,0,R&&(L||!l.hasIconData()||T.get("icon-optional")),L&&(R||!l.hasTextData()||T.get("text-optional")),!0);!l.collisionArrays&&h&&(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData())&&l.deserializeCollisionBoxes(h);for(var oe=function(Re,He,We){for(var nt=0;nt<He/4;nt++)Re.opacityVertexArray.emplaceBack(We)},we=function(Re){var He=l.symbolInstances.get(Re),We=He.numHorizontalGlyphVertices,nt=He.numVerticalGlyphVertices,Xe=He.crossTileID,Qe=m.opacities[Xe];d[Xe]?Qe=P:Qe||(m.opacities[Xe]=Qe=te),d[Xe]=!0;var pt=He.numIconVertices>0,Dt=m.placedOrientations[He.crossTileID],Ct=Dt===o.WritingMode.vertical,zt=Dt===o.WritingMode.horizontal||Dt===o.WritingMode.horizontalOnly;if(We>0||nt>0){var sr=Af(Qe.text);oe(l.text,We,Ct?va:sr),oe(l.text,nt,zt?va:sr);var Er=Qe.text.isHidden();[He.rightJustifiedTextSymbolIndex,He.centerJustifiedTextSymbolIndex,He.leftJustifiedTextSymbolIndex].forEach(function(Or){Or>=0&&(l.text.placedSymbolArray.get(Or).hidden=Er||Ct?1:0)}),He.verticalPlacedTextSymbolIndex>=0&&(l.text.placedSymbolArray.get(He.verticalPlacedTextSymbolIndex).hidden=Er||zt?1:0);var Mr=m.variableOffsets[He.crossTileID];Mr&&m.markUsedJustification(l,Mr.anchor,He,Dt);var xn=m.placedOrientations[He.crossTileID];xn&&(m.markUsedJustification(l,"left",He,xn),m.markUsedOrientation(l,xn,He))}if(pt){var ar=Af(Qe.icon),$r=!(Z&&He.verticalPlacedIconSymbolIndex&&Ct);He.placedIconSymbolIndex>=0&&(oe(l.icon,He.numIconVertices,$r?ar:va),l.icon.placedSymbolArray.get(He.placedIconSymbolIndex).hidden=Qe.icon.isHidden()),He.verticalPlacedIconSymbolIndex>=0&&(oe(l.icon,He.numVerticalIconVertices,$r?va:ar),l.icon.placedSymbolArray.get(He.verticalPlacedIconSymbolIndex).hidden=Qe.icon.isHidden())}if(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData()){var rn=l.collisionArrays[Re];if(rn){var jr=new o.Point(0,0);if(rn.textBox||rn.verticalTextBox){var Gr=!0;if(z){var Zr=m.variableOffsets[Xe];Zr?(jr=Pe(Zr.anchor,Zr.width,Zr.height,Zr.textOffset,Zr.textBoxScale),X&&jr._rotate(ee?m.transform.angle:-m.transform.angle)):Gr=!1}rn.textBox&&Wt(l.textCollisionBox.collisionVertexArray,Qe.text.placed,!Gr||Ct,jr.x,jr.y),rn.verticalTextBox&&Wt(l.textCollisionBox.collisionVertexArray,Qe.text.placed,!Gr||zt,jr.x,jr.y)}var kr=!!(!zt&&rn.verticalIconBox);rn.iconBox&&Wt(l.iconCollisionBox.collisionVertexArray,Qe.icon.placed,kr,Z?jr.x:0,Z?jr.y:0),rn.verticalIconBox&&Wt(l.iconCollisionBox.collisionVertexArray,Qe.icon.placed,!kr,Z?jr.x:0,Z?jr.y:0)}}},Fe=0;Fe<l.symbolInstances.length;Fe++)we(Fe);if(l.sortFeatures(this.transform.angle),this.retainedQueryData[l.bucketInstanceId]&&(this.retainedQueryData[l.bucketInstanceId].featureSortOrder=l.featureSortOrder),l.hasTextData()&&l.text.opacityVertexBuffer&&l.text.opacityVertexBuffer.updateData(l.text.opacityVertexArray),l.hasIconData()&&l.icon.opacityVertexBuffer&&l.icon.opacityVertexBuffer.updateData(l.icon.opacityVertexArray),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexBuffer&&l.iconCollisionBox.collisionVertexBuffer.updateData(l.iconCollisionBox.collisionVertexArray),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexBuffer&&l.textCollisionBox.collisionVertexBuffer.updateData(l.textCollisionBox.collisionVertexArray),l.bucketInstanceId in this.collisionCircleArrays){var ge=this.collisionCircleArrays[l.bucketInstanceId];l.placementInvProjMatrix=ge.invProjMatrix,l.placementViewportMatrix=ge.viewportMatrix,l.collisionCircleArray=ge.circles,delete this.collisionCircleArrays[l.bucketInstanceId]}},gt.prototype.symbolFadeChange=function(l){return this.fadeDuration===0?1:(l-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},gt.prototype.zoomAdjustment=function(l){return Math.max(0,(this.transform.zoom-l)/1.5)},gt.prototype.hasTransitions=function(l){return this.stale||l-this.lastPlacementChangeTime<this.fadeDuration},gt.prototype.stillRecent=function(l,d){var h=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*h>l},gt.prototype.setStale=function(){this.stale=!0};var vr=Math.pow(2,25),Ir=Math.pow(2,24),fi=Math.pow(2,17),Li=Math.pow(2,16),Ji=Math.pow(2,9),Qs=Math.pow(2,8),Ph=Math.pow(2,1);function Af(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;var d=l.placed?1:0,h=Math.floor(127*l.opacity);return h*vr+d*Ir+h*fi+d*Li+h*Ji+d*Qs+h*Ph+d}var va=0,vl=function(l){this._sortAcrossTiles=l.layout.get("symbol-z-order")!=="viewport-y"&&l.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};vl.prototype.continuePlacement=function(l,d,h,m,T){for(var P=this._bucketParts;this._currentTileIndex<l.length;)if(d.getBucketParts(P,m,l[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,T())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,P.sort(function(R,L){return R.sortKey-L.sortKey}));this._currentPartIndex<P.length;)if(d.placeLayerBucketPart(P[this._currentPartIndex],this._seenCrossTileIDs,h),this._currentPartIndex++,T())return!0;return!1};var bl=function(l,d,h,m,T,P,R){this.placement=new gt(l,T,P,R),this._currentPlacementIndex=d.length-1,this._forceFullPlacement=h,this._showCollisionBoxes=m,this._done=!1};bl.prototype.isDone=function(){return this._done},bl.prototype.continuePlacement=function(l,d,h){for(var m=this,T=o.browser.now(),P=function(){var z=o.browser.now()-T;return!m._forceFullPlacement&&z>2};this._currentPlacementIndex>=0;){var R=d[l[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(R.type==="symbol"&&(!R.minzoom||R.minzoom<=L)&&(!R.maxzoom||R.maxzoom>L)){if(this._inProgressLayer||(this._inProgressLayer=new vl(R)),this._inProgressLayer.continuePlacement(h[R.source],this.placement,this._showCollisionBoxes,R,P))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},bl.prototype.commit=function(l){return this.placement.commit(l),this.placement};var Rh=512/o.EXTENT/2,xl=function(l,d,h){this.tileID=l,this.indexedSymbolInstances={},this.bucketInstanceId=h;for(var m=0;m<d.length;m++){var T=d.get(m),P=T.key;this.indexedSymbolInstances[P]||(this.indexedSymbolInstances[P]=[]),this.indexedSymbolInstances[P].push({crossTileID:T.crossTileID,coord:this.getScaledCoordinates(T,l)})}};xl.prototype.getScaledCoordinates=function(l,d){var h=Rh/Math.pow(2,d.canonical.z-this.tileID.canonical.z);return{x:Math.floor((d.canonical.x*o.EXTENT+l.anchorX)*h),y:Math.floor((d.canonical.y*o.EXTENT+l.anchorY)*h)}},xl.prototype.findMatches=function(l,d,h){for(var m=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z),T=0;T<l.length;T++){var P=l.get(T);if(!P.crossTileID){var R=this.indexedSymbolInstances[P.key];if(R)for(var L=this.getScaledCoordinates(P,d),z=0,X=R;z<X.length;z+=1){var ee=X[z];if(Math.abs(ee.coord.x-L.x)<=m&&Math.abs(ee.coord.y-L.y)<=m&&!h[ee.crossTileID]){h[ee.crossTileID]=!0,P.crossTileID=ee.crossTileID;break}}}}};var Us=function(){this.maxCrossTileID=0};Us.prototype.generate=function(){return++this.maxCrossTileID};var Jo=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};Jo.prototype.handleWrapJump=function(l){var d=Math.round((l-this.lng)/360);if(d!==0)for(var h in this.indexes){var m=this.indexes[h],T={};for(var P in m){var R=m[P];R.tileID=R.tileID.unwrapTo(R.tileID.wrap+d),T[R.tileID.key]=R}this.indexes[h]=T}this.lng=l},Jo.prototype.addBucket=function(l,d,h){if(this.indexes[l.overscaledZ]&&this.indexes[l.overscaledZ][l.key]){if(this.indexes[l.overscaledZ][l.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(l.overscaledZ,this.indexes[l.overscaledZ][l.key])}for(var m=0;m<d.symbolInstances.length;m++)d.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[l.overscaledZ]||(this.usedCrossTileIDs[l.overscaledZ]={});var T=this.usedCrossTileIDs[l.overscaledZ];for(var P in this.indexes){var R=this.indexes[P];if(Number(P)>l.overscaledZ)for(var L in R){var z=R[L];z.tileID.isChildOf(l)&&z.findMatches(d.symbolInstances,l,T)}else{var X=R[l.scaledTo(Number(P)).key];X&&X.findMatches(d.symbolInstances,l,T)}}for(var ee=0;ee<d.symbolInstances.length;ee++){var Z=d.symbolInstances.get(ee);Z.crossTileID||(Z.crossTileID=h.generate(),T[Z.crossTileID]=!0)}return this.indexes[l.overscaledZ]===void 0&&(this.indexes[l.overscaledZ]={}),this.indexes[l.overscaledZ][l.key]=new xl(l,d.symbolInstances,d.bucketInstanceId),!0},Jo.prototype.removeBucketCrossTileIDs=function(l,d){for(var h in d.indexedSymbolInstances)for(var m=0,T=d.indexedSymbolInstances[h];m<T.length;m+=1)delete this.usedCrossTileIDs[l][T[m].crossTileID]},Jo.prototype.removeStaleBuckets=function(l){var d=!1;for(var h in this.indexes){var m=this.indexes[h];for(var T in m)l[m[T].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,m[T]),delete m[T],d=!0)}return d};var ba=function(){this.layerIndexes={},this.crossTileIDs=new Us,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};ba.prototype.addLayer=function(l,d,h){var m=this.layerIndexes[l.id];m===void 0&&(m=this.layerIndexes[l.id]=new Jo);var T=!1,P={};m.handleWrapJump(h);for(var R=0,L=d;R<L.length;R+=1){var z=L[R],X=z.getBucket(l);X&&l.id===X.layerIds[0]&&(X.bucketInstanceId||(X.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(z.tileID,X,this.crossTileIDs)&&(T=!0),P[X.bucketInstanceId]=!0)}return m.removeStaleBuckets(P)&&(T=!0),T},ba.prototype.pruneUnusedLayers=function(l){var d={};for(var h in l.forEach(function(m){d[m]=!0}
2102),this.layerIndexes)d[h]||delete this.layerIndexes[h]};var Wa=function(l,d){return o.emitValidationErrors(l,d&&d.filter(function(h){return h.identifier!=="source.canvas"}))},xa=o.pick(Ht,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),vi=o.pick(Ht,["setCenter","setZoom","setBearing","setPitch"]),Ro=function(){var l={},d=o.styleSpec.$version;for(var h in o.styleSpec.$root){var m,T=o.styleSpec.$root[h];T.required&&(m=h==="version"?d:T.type==="array"?[]:{})!=null&&(l[h]=m)}return l}(),zn=function(l){function d(h,m){var T=this;m===void 0&&(m={}),l.call(this),this.map=h,this.dispatcher=new Ee(ht(),this),this.imageManager=new H,this.imageManager.setEventedParent(this),this.glyphManager=new de(h._requestManager,m.localIdeographFontFamily),this.lineAtlas=new re(256,512),this.crossTileSymbolIndex=new ba,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new o.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",o.getReferrer());var P=this;this._rtlTextPluginCallback=d.registerForPluginStateChange(function(R){P.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:R.pluginStatus,pluginURL:R.pluginURL},function(L,z){if(o.triggerPluginCompletionEvent(L),z&&z.every(function(ee){return ee}))for(var X in P.sourceCaches)P.sourceCaches[X].reload()})}),this.on("data",function(R){if(R.dataType==="source"&&R.sourceDataType==="metadata"){var L=T.sourceCaches[R.sourceId];if(L){var z=L.getSource();if(z&&z.vectorLayerIds)for(var X in T._layers){var ee=T._layers[X];ee.source===z.id&&T._validateLayer(ee)}}}})}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.loadURL=function(h,m){var T=this;m===void 0&&(m={}),this.fire(new o.Event("dataloading",{dataType:"style"}));var P=typeof m.validate=="boolean"?m.validate:!o.isMapboxURL(h);h=this.map._requestManager.normalizeStyleURL(h,m.accessToken);var R=this.map._requestManager.transformRequest(h,o.ResourceType.Style);this._request=o.getJSON(R,function(L,z){T._request=null,L?T.fire(new o.ErrorEvent(L)):z&&T._load(z,P)})},d.prototype.loadJSON=function(h,m){var T=this;m===void 0&&(m={}),this.fire(new o.Event("dataloading",{dataType:"style"})),this._request=o.browser.frame(function(){T._request=null,T._load(h,m.validate!==!1)})},d.prototype.loadEmpty=function(){this.fire(new o.Event("dataloading",{dataType:"style"})),this._load(Ro,!1)},d.prototype._load=function(h,m){if(!m||!Wa(this,o.validateStyle(h))){for(var T in this._loaded=!0,this.stylesheet=h,h.sources)this.addSource(T,h.sources[T],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs);var P=Mt(this.stylesheet.layers);this._order=P.map(function(X){return X.id}),this._layers={},this._serializedLayers={};for(var R=0,L=P;R<L.length;R+=1){var z=L[R];(z=o.createStyleLayer(z)).setEventedParent(this,{layer:{id:z.id}}),this._layers[z.id]=z,this._serializedLayers[z.id]=z.serialize()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new W(this.stylesheet.light),this.fire(new o.Event("data",{dataType:"style"})),this.fire(new o.Event("style.load"))}},d.prototype._loadSprite=function(h){var m=this;this._spriteRequest=function(T,P,R){var L,z,X,ee=o.browser.devicePixelRatio>1?"@2x":"",Z=o.getJSON(P.transformRequest(P.normalizeSpriteURL(T,ee,".json"),o.ResourceType.SpriteJSON),function(we,Fe){Z=null,X||(X=we,L=Fe,oe())}),te=o.getImage(P.transformRequest(P.normalizeSpriteURL(T,ee,".png"),o.ResourceType.SpriteImage),function(we,Fe){te=null,X||(X=we,z=Fe,oe())});function oe(){if(X)R(X);else if(L&&z){var we=o.browser.getImageData(z),Fe={};for(var ge in L){var Re=L[ge],He=Re.width,We=Re.height,nt=Re.x,Xe=Re.y,Qe=Re.sdf,pt=Re.pixelRatio,Dt=Re.stretchX,Ct=Re.stretchY,zt=Re.content,sr=new o.RGBAImage({width:He,height:We});o.RGBAImage.copy(we,sr,{x:nt,y:Xe},{x:0,y:0},{width:He,height:We}),Fe[ge]={data:sr,pixelRatio:pt,sdf:Qe,stretchX:Dt,stretchY:Ct,content:zt}}R(null,Fe)}}return{cancel:function(){Z&&(Z.cancel(),Z=null),te&&(te.cancel(),te=null)}}}(h,this.map._requestManager,function(T,P){if(m._spriteRequest=null,T)m.fire(new o.ErrorEvent(T));else if(P)for(var R in P)m.imageManager.addImage(R,P[R]);m.imageManager.setLoaded(!0),m._availableImages=m.imageManager.listImages(),m.dispatcher.broadcast("setImages",m._availableImages),m.fire(new o.Event("data",{dataType:"style"}))})},d.prototype._validateLayer=function(h){var m=this.sourceCaches[h.source];if(m){var T=h.sourceLayer;if(T){var P=m.getSource();(P.type==="geojson"||P.vectorLayerIds&&P.vectorLayerIds.indexOf(T)===-1)&&this.fire(new o.ErrorEvent(new Error('Source layer "'+T+'" does not exist on source "'+P.id+'" as specified by style layer "'+h.id+'"')))}}},d.prototype.loaded=function(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(var h in this.sourceCaches)if(!this.sourceCaches[h].loaded())return!1;return!!this.imageManager.isLoaded()},d.prototype._serializeLayers=function(h){for(var m=[],T=0,P=h;T<P.length;T+=1){var R=this._layers[P[T]];R.type!=="custom"&&m.push(R.serialize())}return m},d.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var h in this.sourceCaches)if(this.sourceCaches[h].hasTransition())return!0;for(var m in this._layers)if(this._layers[m].hasTransition())return!0;return!1},d.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},d.prototype.update=function(h){if(this._loaded){var m=this._changed;if(this._changed){var T=Object.keys(this._updatedLayers),P=Object.keys(this._removedLayers);for(var R in(T.length||P.length)&&this._updateWorkerLayers(T,P),this._updatedSources){var L=this._updatedSources[R];L==="reload"?this._reloadSource(R):L==="clear"&&this._clearSource(R)}for(var z in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[z].updateTransitions(h);this.light.updateTransitions(h),this._resetUpdates()}var X={};for(var ee in this.sourceCaches){var Z=this.sourceCaches[ee];
vendor: 4,258 bytes, line 2102
2102X[ee]=Z.used,Z.used=!1}for(var te=0,oe=this._order;te<oe.length;te+=1){var we=this._layers[oe[te]];we.recalculate(h,this._availableImages),!we.isHidden(h.zoom)&&we.source&&(this.sourceCaches[we.source].used=!0)}for(var Fe in X){var ge=this.sourceCaches[Fe];X[Fe]!==ge.used&&ge.fire(new o.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:Fe}))}this.light.recalculate(h),this.z=h.zoom,m&&this.fire(new o.Event("data",{dataType:"style"}))}},d.prototype._updateTilesForChangedImages=function(){var h=Object.keys(this._changedImages);if(h.length){for(var m in this.sourceCaches)this.sourceCaches[m].reloadTilesForDependencies(["icons","patterns"],h);this._changedImages={}}},d.prototype._updateWorkerLayers=function(h,m){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(h),removedIds:m})},d.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},d.prototype.setState=function(h){var m=this;if(this._checkLoaded(),Wa(this,o.validateStyle(h)))return!1;(h=o.clone$1(h)).layers=Mt(h.layers);var T=function(R,L){if(!R)return[{command:Ht.setStyle,args:[L]}];var z=[];try{if(!o.deepEqual(R.version,L.version))return[{command:Ht.setStyle,args:[L]}];o.deepEqual(R.center,L.center)||z.push({command:Ht.setCenter,args:[L.center]}),o.deepEqual(R.zoom,L.zoom)||z.push({command:Ht.setZoom,args:[L.zoom]}),o.deepEqual(R.bearing,L.bearing)||z.push({command:Ht.setBearing,args:[L.bearing]}),o.deepEqual(R.pitch,L.pitch)||z.push({command:Ht.setPitch,args:[L.pitch]}),o.deepEqual(R.sprite,L.sprite)||z.push({command:Ht.setSprite,args:[L.sprite]}),o.deepEqual(R.glyphs,L.glyphs)||z.push({command:Ht.setGlyphs,args:[L.glyphs]}),o.deepEqual(R.transition,L.transition)||z.push({command:Ht.setTransition,args:[L.transition]}),o.deepEqual(R.light,L.light)||z.push({command:Ht.setLight,args:[L.light]});var X={},ee=[];(function(te,oe,we,Fe){var ge;for(ge in oe=oe||{},te=te||{})te.hasOwnProperty(ge)&&(oe.hasOwnProperty(ge)||Qt(ge,we,Fe));for(ge in oe)oe.hasOwnProperty(ge)&&(te.hasOwnProperty(ge)?o.deepEqual(te[ge],oe[ge])||(te[ge].type==="geojson"&&oe[ge].type==="geojson"&&cn(te,oe,ge)?we.push({command:Ht.setGeoJSONSourceData,args:[ge,oe[ge].data]}):en(ge,oe,we,Fe)):Ur(ge,oe,we))})(R.sources,L.sources,ee,X);var Z=[];R.layers&&R.layers.forEach(function(te){X[te.source]?z.push({command:Ht.removeLayer,args:[te.id]}):Z.push(te)}),z=z.concat(ee),function(te,oe,we){oe=oe||[];var Fe,ge,Re,He,We,nt,Xe,Qe=(te=te||[]).map(Jr),pt=oe.map(Jr),Dt=te.reduce(Vr,{}),Ct=oe.reduce(Vr,{}),zt=Qe.slice(),sr=Object.create(null);for(Fe=0,ge=0;Fe<Qe.length;Fe++)Ct.hasOwnProperty(Re=Qe[Fe])?ge++:(we.push({command:Ht.removeLayer,args:[Re]}),zt.splice(zt.indexOf(Re,ge),1));for(Fe=0,ge=0;Fe<pt.length;Fe++)zt[zt.length-1-Fe]!==(Re=pt[pt.length-1-Fe])&&(Dt.hasOwnProperty(Re)?(we.push({command:Ht.removeLayer,args:[Re]}),zt.splice(zt.lastIndexOf(Re,zt.length-ge),1)):ge++,we.push({command:Ht.addLayer,args:[Ct[Re],nt=zt[zt.length-Fe]]}),zt.splice(zt.length-Fe,0,Re),sr[Re]=!0);for(Fe=0;Fe<pt.length;Fe++)if(He=Dt[Re=pt[Fe]],We=Ct[Re],!sr[Re]&&!o.deepEqual(He,We))if(o.deepEqual(He.source,We.source)&&o.deepEqual(He["source-layer"],We["source-layer"])&&o.deepEqual(He.type,We.type)){for(Xe in Wr(He.layout,We.layout,we,Re,null,Ht.setLayoutProperty),Wr(He.paint,We.paint,we,Re,null,Ht.setPaintProperty),o.deepEqual(He.filter,We.filter)||we.push({command:Ht.setFilter,args:[Re,We.filter]}),o.deepEqual(He.minzoom,We.minzoom)&&o.deepEqual(He.maxzoom,We.maxzoom)||we.push({command:Ht.setLayerZoomRange,args:[Re,We.minzoom,We.maxzoom]}),He)He.hasOwnProperty(Xe)&&Xe!=="layout"&&Xe!=="paint"&&Xe!=="filter"&&Xe!=="metadata"&&Xe!=="minzoom"&&Xe!=="maxzoom"&&(Xe.indexOf("paint.")===0?Wr(He[Xe],We[Xe],we,Re,Xe.slice(6),Ht.setPaintProperty):o.deepEqual(He[Xe],We[Xe])||we.push({command:Ht.setLayerProperty,args:[Re,Xe,We[Xe]]}));for(Xe in We)We.hasOwnProperty(Xe)&&!He.hasOwnProperty(Xe)&&Xe!=="layout"&&Xe!=="paint"&&Xe!=="filter"&&Xe!=="metadata"&&Xe!=="minzoom"&&Xe!=="maxzoom"&&(Xe.indexOf("paint.")===0?Wr(He[Xe],We[Xe],we,Re,Xe.slice(6),Ht.setPaintProperty):o.deepEqual(He[Xe],We[Xe])||we.push({command:Ht.setLayerProperty,args:[Re,Xe,We[Xe]]}))}
2102else we.push({command:Ht.removeLayer,args:[Re]}),nt=zt[zt.lastIndexOf(Re)+1],we.push({command:Ht.addLayer,args:[We,nt]})}(Z,L.layers,z)}catch(te){console.warn("Unable to compute style diff:",te),z=[{command:Ht.setStyle,args:[L]}]}return z}(this.serialize(),h).filter(function(R){return!(R.command in vi)});if(T.length===0)return!1;var P=T.filter(function(R){return!(R.command in xa)});if(P.length>0)throw new Error("Unimplemented: "+P.map(function(R){return R.command}).join(", ")+".");return T.forEach(function(R){R.command!=="setTransition"&&m[R.command].apply(m,R.args)}),this.stylesheet=h,!0},d.prototype.addImage=function(h,m){if(this.getImage(h))return this.fire(new o.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(h,m),this._afterImageUpdated(h)},d.prototype.updateImage=function(h,m){this.imageManager.updateImage(h,m)},d.prototype.getImage=function(h){return this.imageManager.getImage(h)},d.prototype.removeImage=function(h){if(!this.getImage(h))return this.fire(new o.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(h),this._afterImageUpdated(h)},d.prototype._afterImageUpdated=function(h){this._availableImages=this.imageManager.listImages(),this._changedImages[h]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new o.Event("data",{dataType:"style"}))},d.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},d.prototype.addSource=function(h,m,T){var P=this;if(T===void 0&&(T={}),this._checkLoaded(),this.sourceCaches[h]!==void 0)throw new Error("There is already a source with this ID");if(!m.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(m).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(o.validateStyle.source,"sources."+h,m,null,T))){this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);var R=this.sourceCaches[h]=new Be(h,m,this.dispatcher);R.style=this,R.setEventedParent(this,function(){return{isSourceLoaded:P.loaded(),source:R.serialize(),sourceId:h}}),R.onAdd(this.map),this._changed=!0}},d.prototype.removeSource=function(h){if(this._checkLoaded(),this.sourceCaches[h]===void 0)throw new Error("There is no source with this ID");for(var m in this._layers)if(this._layers[m].source===h)return this.fire(new o.ErrorEvent(new Error('Source "'+h+'" cannot be removed while layer "'+m+'" is using it.')));var T=this.sourceCaches[h];delete this.sourceCaches[h],delete this._updatedSources[h],T.fire(new o.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:h})),T.setEventedParent(null),T.clearTiles(),T.onRemove&&T.onRemove(this.map),this._changed=!0},d.prototype.setGeoJSONSourceData=function(h,m){this._checkLoaded(),this.sourceCaches[h].getSource().setData(m),this._changed=!0},d.prototype.getSource=function(h){return this.sourceCaches[h]&&this.sourceCaches[h].getSource()},d.prototype.addLayer=function(h,m,T){T===void 0&&(T={}),this._checkLoaded();var P=h.id;if(this.getLayer(P))this.fire(new o.ErrorEvent(new Error('Layer with i
2102d "'+P+'" already exists on this map')));else{var R;if(h.type==="custom"){if(Wa(this,o.validateCustomStyleLayer(h)))return;R=o.createStyleLayer(h)}else{if(typeof h.source=="object"&&(this.addSource(P,h.source),h=o.clone$1(h),h=o.extend(h,{source:P})),this._validate(o.validateStyle.layer,"layers."+P,h,{arrayIndex:-1},T))return;R=o.createStyleLayer(h),this._validateLayer(R),R.setEventedParent(this,{layer:{id:P}}),this._serializedLayers[R.id]=R.serialize()}var L=m?this._order.indexOf(m):this._order.length;if(m&&L===-1)this.fire(new o.ErrorEvent(new Error('Layer with id "'+m+'" does not exist on this map.')));else{if(this._order.splice(L,0,P),this._layerOrderChanged=!0,this._layers[P]=R,this._removedLayers[P]&&R.source&&R.type!=="custom"){var z=this._removedLayers[P];delete this._removedLayers[P],z.type!==R.type?this._updatedSources[R.source]="clear":(this._updatedSources[R.source]="reload",this.sourceCaches[R.source].pause())}this._updateLayer(R),R.onAdd&&R.onAdd(this.map)}}},d.prototype.moveLayer=function(h,m){if(this._checkLoaded(),this._changed=!0,this._layers[h]){if(h!==m){var T=this._order.indexOf(h);this._order.splice(T,1);var P=m?this._order.indexOf(m):this._order.length;
2102m&&P===-1?this.fire(new o.ErrorEvent(new Error('Layer with id "'+m+'" does not exist on this map.'))):(this._order.splice(P,0,h),this._layerOrderChanged=!0)}}else this.fire(new o.ErrorEvent(new Error("The layer '"+h+"' does not exist in the map's style and cannot be moved.")))},d.prototype.removeLayer=function(h){this._checkLoaded();var m=this._layers[h];if(m){m.setEventedParent(null);var T=this._order.indexOf(h);this._order.splice(T,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[h]=m,delete this._layers[h],delete this._serializedLayers[h],delete this._updatedLayers[h],delete this._updatedPaintProps[h],m.onRemove&&m.onRemove(this.map)}else this.fire(new o.ErrorEvent(new Error("The layer '"+h+"' does not exist in the map's style and cannot be removed.")))},d.prototype.getLayer=function(h){return this._layers[h]},d.prototype.hasLayer=function(h){return h in this._layers},d.prototype.setLayerZoomRange=function(h,m,T){this._checkLoaded();var P=this.getLayer(h);P?P.minzoom===m&&P.maxzoom===T||(m!=null&&(P.minzoom=m),T!=null&&(P.maxzoom=T),this._updateLayer(P)):this.fire(new o.ErrorEvent(new Error("The layer '"+h+"' does not exist in the map's style and cannot have zoom extent.")))},d.prototype.setFilter=function(h,m,T){T===void 0&&(T={}),this._checkLoaded();var P=this.getLayer(h);if(P){if(!o.deepEqual(P.filter,m))return m==null?(P.filter=void 0,void this._updateLayer(P)):void(this._validate(o.validateStyle.filter,"layers."+P.id+".filter",m,null,T)||(P.filter=o.clone$1(m),this._updateLayer(P)))}else this.fire(new o.ErrorEvent(new Error("The layer '"+h+"' does not exist in the map's style and cannot be filtered.")))},d.prototype.getFilter=function(h){return o.clone$1(this.getLayer(h).filter)},d.prototype.setLayoutProperty=function(h,m,T,P){P===void 0&&(P={}),this._checkLoaded();var R=this.getLayer(h);R?o.deepEqual(R.getLayoutProperty(m),T)||(R.setLayoutProperty(m,T,P),this._updateLayer(R)):this.fire(new o.ErrorEvent(new Error("The layer '"+h+"' does not exist in the map's style and cannot be styled.")))},d.prototype.getLayoutProperty=function(h,m){var T=this.getLayer(h);if(T)return T.getLayoutProperty(m);this.fire(new o.ErrorEvent(new Error("The layer '"+h+"' does not exist in the map's style.")))},d.prototype.setPaintProperty=function(h,m,T,P){P===void 0&&(P={}),this._checkLoaded();var R=this.getLayer(h);R?o.deepEqual(R.getPaintProperty(m),T)||(R.setPaintProperty(m,T,P)&&this._updateLayer(R),this._changed=!0,this._updatedPaintProps[h]=!0):this.fire(new o.ErrorEvent(new Error("The layer '"+h+"' does not exist in the map's style and cannot be styled.")))},d.prototype.getPaintProperty=function(h,m){return this.getLayer(h).getPaintProperty(m)},d.prototype.setFeatureState=function(h,m){this._checkLoaded();var T=h.source,P=h.sourceLayer,R=this.sourceCaches[T];if(R!==void 0){var L=R.getSource().type;L==="geojson"&&P?this.fire(new o.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):L!=="vector"||P?(h.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),R.setFeatureState(P,h.id,m)):this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new o.ErrorEvent(new Error("The source '"+T+"' does not exist in the map's style.")))},d.prototype.removeFeatureState=function(h,m){this._checkLoaded();var T=h.source,P=this.sourceCaches[T];if(P!==void 0){var R=P.getSource().type,L=R==="vector"?h.sourceLayer:void 0;R!=="vector"||L?m&&typeof h.id!="string"&&typeof h.id!="number"?this.fire(new o.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):P.removeFeatureState(L,h.id,m):this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new o.ErrorEvent(new Error("The source '"+T+"' does not exist in the map's style.")))},d.prototype.getFeatureState=function(h){this._checkLoaded();var m=h.source,T=h.sourceLayer,P=this.sourceCaches[m];if(P!==void 0){if(P.getSource().type!=="vector"||T)return h.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),P.getFeatureState(T,h.id);this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new o.ErrorEvent(new Error("The source '"+m+"' does not exist in the map's style.")))},d.prototype.getTransition=function(){return o.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},d.prototype.serialize=function(){return o.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:o.mapObject(this.sourceCaches,function(h){return h.serialize()}),layers:this._serializeLayers(this._order)},function(h){return h!==void 0})},d.prototype._updateLayer=function(h){this._updatedLayers[h.id]=!0,h.source&&!this._updatedSources[h.source]&&this.sourceCaches[h.source].getSource().type!=="raster"&&(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause()),this._changed=!0},d.prototype._flattenAndSortRenderedFeatures=function(h){for(var m=this,T=function(Dt){return m._layers[Dt].type==="fill-extrusion"},P={},R=[],L=this._order.length-1;L>=0;L--){var z=this._order[L];if(T(z)){P[z]=L;for(var X=0,ee=h;X<ee.length;X+=1){var Z=ee[X][z];if(Z)for(var te=0,oe=Z;te<oe.length;te+=1)R.push(oe[te])}}}R.sort(function(Dt,Ct){return Ct.intersectionZ-Dt.intersectionZ});for(var we=[],Fe=this._order.length-1;Fe>=0;Fe--){var ge=this._order[Fe];if(T(ge))for(var Re=R.length-1;Re>=0;Re--){var He=R[Re].feature;if(P[He.layer.id]<Fe)break;we.push(He),R.pop()}else for(var We=0,nt=h;We<nt.length;We+=1){var Xe=nt[We][ge];if(Xe)for(var Qe=0,pt=Xe;Qe<pt.length;Qe+=1)we.push(pt[Qe].feature)}}return we},d.prototype.queryRenderedFeatures=function(h,m,T){m&&m.filter&&this._val
vendor: 5,642 bytes, line 2102
2102idate(o.validateStyle.filter,"queryRenderedFeatures.filter",m.filter,null,m);var P={};if(m&&m.layers){if(!Array.isArray(m.layers))return this.fire(new o.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var R=0,L=m.layers;R<L.length;R+=1){var z=L[R],X=this._layers[z];if(!X)return this.fire(new o.ErrorEvent(new Error("The layer '"+z+"' does not exist in the map's style and cannot be queried for features."))),[];P[X.source]=!0}}var ee=[];for(var Z in m.availableImages=this._availableImages,this.sourceCaches)m.layers&&!P[Z]||ee.push(er(this.sourceCaches[Z],this._layers,this._serializedLayers,h,m,T));return this.placement&&ee.push(function(te,oe,we,Fe,ge,Re,He){for(var We={},nt=Re.queryRenderedSymbols(Fe),Xe=[],Qe=0,pt=Object.keys(nt).map(Number);Qe<pt.length;Qe+=1)Xe.push(He[pt[Qe]]);Xe.sort(Kt);for(var Dt=function(){var Mr=zt[Ct],xn=Mr.featureIndex.lookupSymbolFeatures(nt[Mr.bucketInstanceId],oe,Mr.bucketIndex,Mr.sourceLayerIndex,ge.filter,ge.layers,ge.availableImages,te);for(var ar in xn){var $r=We[ar]=We[ar]||[],rn=xn[ar];rn.sort(function(Zr,kr){var Or=Mr.featureSortOrder;if(Or){var qi=Or.indexOf(Zr.featureIndex);return Or.indexOf(kr.featureIndex)-qi}return kr.featureIndex-Zr.featureIndex});for(var jr=0,Gr=rn;jr<Gr.length;jr+=1)$r.push(Gr[jr])}},Ct=0,zt=Xe;Ct<zt.length;Ct+=1)Dt();var sr=function(Mr){We[Mr].forEach(function(xn){var ar=xn.feature,$r=we[te[Mr].source].getFeatureState(ar.layer["source-layer"],ar.id);ar.source=ar.layer.source,ar.layer["source-layer"]&&(ar.sourceLayer=ar.layer["source-layer"]),ar.state=$r})};for(var Er in We)sr(Er);return We}(this._layers,this._serializedLayers,this.sourceCaches,h,m,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(ee)},d.prototype.querySourceFeatures=function(h,m){m&&m.filter&&this._validate(o.validateStyle.filter,"querySourceFeatures.filter",m.filter,null,m);var T=this.sourceCaches[h];return T?function(P,R){for(var L=P.getRenderableIds().map(function(oe){return P.getTileByID(oe)}),z=[],X={},ee=0;ee<L.length;ee++){var Z=L[ee],te=Z.tileID.canonical.key;X[te]||(X[te]=!0,Z.querySourceFeatures(z,R))}return z}(T,m):[]},d.prototype.addSourceType=function(h,m,T){return d.getSourceType(h)?T(new Error('A source type called "'+h+'" already exists.')):(d.setSourceType(h,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:h,url:m.workerSourceURL},T):T(null,null))},d.prototype.getLight=function(){return this.light.getLight()},d.prototype.setLight=function(h,m){m===void 0&&(m={}),this._checkLoaded();var T=this.light.getLight(),P=!1;for(var R in h)if(!o.deepEqual(h[R],T[R])){P=!0;break}if(P){var L={now:o.browser.now(),transition:o.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(h,m),this.light.updateTransitions(L)}},d.prototype._validate=function(h,m,T,P,R){return R===void 0&&(R={}),(!R||R.validate!==!1)&&Wa(this,h.call(o.validateStyle,o.extend({key:m,style:this.serialize(),value:T,styleSpec:o.styleSpec},P)))},d.prototype._remove=function(){for(var h in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[h].setEventedParent(null);for(var m in this.sourceCaches)this.sourceCaches[m].clearTiles(),this.sourceCaches[m].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},d.prototype._clearSource=function(h){this.sourceCaches[h].clearTiles()},d.prototype._reloadSource=function(h){this.sourceCaches[h].resume(),this.sourceCaches[h].reload()},d.prototype._updateSources=function(h){for(var m in this.sourceCaches)this.sourceCaches[m].update(h)},d.prototype._generateCollisionBoxes=function(){for(var h in this.sourceCaches)this._reloadSource(h)},d.prototype._updatePlacement=function(h,m,T,P,R){R===void 0&&(R=!1);for(var L=!1,z=!1,X={},ee=0,Z=this._order;ee<Z.length;ee+=1){var te=this._layers[Z[ee]];if(te.type==="symbol"){if(!X[te.source]){var oe=this.sourceCaches[te.source];X[te.source]=oe.getRenderableIds(!0).map(function(He){return oe.getTileByID(He)}).sort(function(He,We){return We.tileID.overscaledZ-He.tileID.overscaledZ||(He.tileID.isLessThan(We.tileID)?-1:1)})}var we=this.crossTileSymbolIndex.addLayer(te,X[te.source],h.center.lng);L=L||we}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((R=R||this._layerOrderChanged||T===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.browser.now(),h.zoom))&&(this.pauseablePlacement=new bl(h,this._order,R,m,T,P,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,X),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.browser.now()),z=!0),L&&this.pauseablePlacement.placement.setStale()),z||L)for(var Fe=0,ge=this._order;Fe<ge.length;Fe+=1){var Re=this._layers[ge[Fe]];Re.type==="symbol"&&this.placement.updateLayerOpacities(Re,X[Re.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.browser.now())},d.prototype._releaseSymbolFadeTiles=function(){for(var h in this.sourceCaches)this.sourceCaches[h].releaseSymbolFadeTiles()},d.prototype.getImages=function(h,m,T){this.imageManager.getImages(m.icons,T),this._updateTilesForChangedImages();var P=this.sourceCaches[m.source];P&&P.setDependencies(m.tileID.key,m.type,m.icons)},d.prototype.getGlyphs=function(h,m,T){this.glyphManager.getGlyphs(m.stacks,T)}
2102,d.prototype.getResource=function(h,m,T){return o.makeRequest(m,T)},d}(o.Evented);zn.getSourceType=function(l){return st[l]},zn.setSourceType=function(l,d){st[l]=d},zn.registerForPluginStateChange=o.registerForPluginStateChange;var hi=o.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ja=In(`#ifdef GL_ES
2103precision mediump float;
2104#else
2105#if !defined(lowp)
2106#define lowp
2107#endif
2108#if !defined(mediump)
2109#define mediump
2110#endif
2111#if !defined(highp)
2112#define highp
2113#endif
2114#endif`,`#ifdef GL_ES
2115precision highp float;
2116#else
2117#if !defined(lowp)
2118#define lowp
2119#endif
2120#if !defined(mediump)
2121#define mediump
2122#endif
2123#if !defined(highp)
2124#define highp
2125#endif
2126#endif
2127vec2 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
2128);}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;}`),wl=In(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
2129#ifdef OVERDRAW_INSPECTOR
2130gl_FragColor=vec4(1.0);
2131#endif
2132}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Qp=In(`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;
2133#ifdef OVERDRAW_INSPECTOR
2134gl_FragColor=vec4(1.0);
2135#endif
2136}`,"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);}"),eA=In(`varying vec3 v_data;
2137#pragma mapbox: define highp vec4 color
2138#pragma mapbox: define mediump float radius
2139#pragma mapbox: define lowp float blur
2140#pragma mapbox: define lowp float opacity
2141#pragma mapbox: define highp vec4 stroke_color
2142#pragma mapbox: define mediump float stroke_width
2143#pragma mapbox: define lowp float stroke_opacity
2144void main() {
2145#pragma mapbox: initialize highp vec4 color
2146#pragma mapbox: initialize mediump float radius
2147#pragma mapbox: initialize lowp float blur
2148#pragma mapbox: initialize lowp float opacity
2149#pragma mapbox: initialize highp vec4 stroke_color
2150#pragma mapbox: initialize mediump float stroke_width
2151#pragma mapbox: initialize lowp float stroke_opacity
2152vec2 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
2152/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
2153#ifdef OVERDRAW_INSPECTOR
2154gl_FragColor=vec4(1.0);
2155#endif
2156}`,`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;
2157#pragma mapbox: define highp vec4 color
2158#pragma mapbox: define mediump float radius
2159#pragma mapbox: define lowp float blur
2160#pragma mapbox: define lowp float opacity
2161#pragma mapbox: define highp vec4 stroke_color
2162#pragma mapbox: define mediump float stroke_width
2163#pragma mapbox: define lowp float stroke_opacity
2164void main(void) {
2165#pragma mapbox: initialize highp vec4 color
2166#pragma mapbox: initialize mediump float radius
2167#pragma mapbox: initialize lowp float blur
2168#pragma mapbox: initialize lowp float opacity
2169#pragma mapbox: initialize highp vec4 stroke_color
2170#pragma mapbox: initialize mediump float stroke_width
2171#pragma mapbox: initialize lowp float stroke_opacity
2172vec2 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);}`),gf=In("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);}"),au=In(`uniform highp float u_intensity;varying vec2 v_extrude;
2173#pragma mapbox: define highp float weight
2174#define GAUSS_COEF 0.3989422804014327
2175void main() {
2176#pragma mapbox: initialize highp float weight
2177float 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);
2178#ifdef OVERDRAW_INSPECTOR
2179gl_FragColor=vec4(1.0);
2180#endif
2181}`,`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;
2182#pragma mapbox: define highp float weight
2183#pragma mapbox: define mediump float radius
2184const highp float ZERO=1.0/255.0/16.0;
2185#define GAUSS_COEF 0.3989422804014327
2186void main(void) {
2187#pragma mapbox: initialize highp float weight
2188#pragma mapbox: initialize mediump float radius
2189vec2 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;}`),Pc=In(`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;
2190#ifdef OVERDRAW_INSPECTOR
2191gl_FragColor=vec4(0.0);
2192#endif
2193}`,"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;}"),Xo=In("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;}"),mf=In("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);}"),_f=In("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);}"),cu=In(`#pragma mapbox: define highp vec4 color
2194#pragma mapbox: define lowp float opacity
2195void main() {
2196#pragma mapbox: initialize highp vec4 color
2197#pragma mapbox: initialize lowp float opacity
2198gl_FragColor=color*opacity;
2199#ifdef OVERDRAW_INSPECTOR
2200gl_FragColor=vec4(1.0);
2201#endif
2202}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
2203#pragma mapbox: define highp vec4 color
2204#pragma mapbox: define lowp float opacity
2205void main() {
2206#pragma mapbox: initialize highp vec4 color
2207#pragma mapbox: initialize lowp float opacity
2208gl_Position=u_matrix*vec4(a_pos,0,1);}`),xo=In(`varying vec2 v_pos;
2209#pragma mapbox: define highp vec4 outline_color
2210#pragma mapbox: define lowp float opacity
2211void main() {
2212#pragma mapbox: initialize highp vec4 outline_color
2213#pragma mapbox: initialize lowp float opacity
2214float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
2215#ifdef OVERDRAW_INSPECTOR
2216gl_FragColor=vec4(1.0);
2217#endif
2218}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
2219#pragma mapbox: define highp vec4 outline_color
2220#pragma mapbox: define lowp float opacity
2221void main() {
2222#pragma mapbox: initialize highp vec4 outline_color
2223#pragma mapbox: initialize lowp float opacity
2224gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),eo=In(`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;
2225#pragma mapbox: define lowp float opacity
2226#pragma mapbox: define lowp vec4 pattern_from
2227#pragma mapbox: define lowp vec4 pattern_to
2228void main() {
2229#pragma mapbox: initialize lowp float opacity
2230#pragma mapbox: initialize mediump vec4 pattern_from
2231#pragma mapbox: initialize mediump vec4 pattern_to
2232vec2 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;
2233#ifdef OVERDRAW_INSPECTOR
2234gl_FragColor=vec4(1.0);
2235#endif
2236}`,`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;
2237#pragma mapbox: define lowp float opacity
2238#pragma mapbox: define lowp vec4 pattern_from
2239#pragma mapbox: define lowp vec4 pattern_to
2240#pragma mapbox: define lowp float pixel_ratio_from
2241#pragma mapbox: define lowp float pixel_ratio_to
2242void main() {
2243#pragma mapbox: initialize lowp float opacity
2244#pragma mapbox: initialize mediump vec4 pattern_from
2245#pragma mapbox: initialize mediump vec4 pattern_to
2246#pragma mapbox: initialize lowp float pixel_ratio_from
2247#pragma mapbox: initialize lowp float pixel_ratio_to
2248vec2 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;}`),yf=In(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
2249#pragma mapbox: define lowp float opacity
2250#pragma mapbox: define lowp vec4 pattern_from
2251#pragma mapbox: define lowp vec4 pattern_to
2252void main() {
2253#pragma mapbox: initialize lowp float opacity
2254#pragma mapbox: initialize mediump vec4 pattern_from
2255#pragma mapbox: initialize mediump vec4 pattern_to
2256vec2 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;
2257#ifdef OVERDRAW_INSPECTOR
2258gl_FragColor=vec4(1.0);
2259#endif
2260}`,`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;
2261#pragma mapbox: define lowp float opacity
2262#pragma mapbox: define lowp vec4 pattern_from
2263#pragma mapbox: define lowp vec4 pattern_to
2264#pragma mapbox: define lowp float pixel_ratio_from
2265#pragma mapbox: define lowp float pixel_ratio_to
2266void main() {
2267#pragma mapbox: initialize lowp float opacity
2268#pragma mapbox: initialize mediump vec4 pattern_from
2269#pragma mapbox: initialize mediump vec4 pattern_to
2270#pragma mapbox: initialize lowp float pixel_ratio_from
2271#pragma mapbox: initialize lowp float pixel_ratio_to
2272vec2 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);}`),zi=In(`varying vec4 v_color;void main() {gl_FragColor=v_color;
2273#ifdef OVERDRAW_INSPECTOR
2274gl_FragColor=vec4(1.0);
2275#endif
2276}`,`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;
2277#pragma mapbox: define highp float base
2278#pragma mapbox: define highp float height
2279#pragma mapbox: define highp vec4 color
2280void main() {
2281#pragma mapbox: initialize highp float base
2282#pragma mapbox: initialize highp float height
2283#pragma mapbox: initialize highp vec4 color
2284vec3 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;}`),Cl=In(`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;
2285#pragma mapbox: define lowp float base
2286#pragma mapbox: define lowp float height
2287#pragma mapbox: define lowp vec4 pattern_from
2288#pragma mapbox: define lowp vec4 pattern_to
2289#pragma mapbox: define lowp float pixel_ratio_from
2290#pragma mapbox: define lowp float pixel_ratio_to
2291void main() {
2292#pragma mapbox: initialize lowp float base
2293#pragma mapbox: initialize lowp float height
2294#pragma mapbox: initialize mediump vec4 pattern_from
2295#pragma mapbox: initialize mediump vec4 pattern_to
2296#pragma mapbox: initialize lowp float pixel_ratio_from
2297#pragma mapbox: initialize lowp float pixel_ratio_to
2298vec2 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;
2299#ifdef OVERDRAW_INSPECTOR
2300gl_FragColor=vec4(1.0);
2301#endif
2302}`,`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;
2303#pragma mapbox: define lowp float base
2304#pragma mapbox: define lowp float height
2305#pragma mapbox: define lowp vec4 pattern_from
2306#pragma mapbox: define lowp vec4 pattern_to
2307#pragma mapbox: define lowp float pixel_ratio_from
2308#pragma mapbox: define lowp float pixel_ratio_to
2309void main() {
2310#pragma mapbox: initialize lowp float base
2311#pragma mapbox: initialize lowp float height
2312#pragma mapbox: initialize mediump vec4 pat
2312tern_from
2313#pragma mapbox: initialize mediump vec4 pattern_to
2314#pragma mapbox: initialize lowp float pixel_ratio_from
2315#pragma mapbox: initialize lowp float pixel_ratio_to
2316vec2 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
2317? a_pos
2318: 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;}`),wa=In(`#ifdef GL_ES
2319precision highp float;
2320#endif
2321uniform 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);
2322#ifdef OVERDRAW_INSPECTOR
2323gl_FragColor=vec4(1.0);
2324#endif
2325}`,"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;}"),Ca=In(`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;
2326#define PI 3.141592653589793
2327void 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;
2328#ifdef OVERDRAW_INSPECTOR
2329gl_FragColor=vec4(1.0);
2330#endif
2331}`,"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;}"),Ta=In(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
2332#pragma mapbox: define highp vec4 color
2333#pragma mapbox: define lowp float blur
2334#pragma mapbox: define lowp float opacity
2335void main() {
2336#pragma mapbox: initialize highp vec4 color
2337#pragma mapbox: initialize lowp float blur
2338#pragma mapbox: initialize lowp float opacity
2339float 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);
2340#ifdef OVERDRAW_INSPECTOR
2341gl_FragColor=vec4(1.0);
2342#endif
2343}`,`
2344#define scale 0.015873016
2345attribute 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;
2346#pragma mapbox: define highp vec4 color
2347#pragma mapbox: define lowp float blur
2348#pragma mapbox: define lowp float opacity
2349#pragma mapbox: define mediump float gapwidth
2350#pragma mapbox: define lowp float offset
2351#pragma mapbox: define mediump float width
2352void main() {
2353#pragma mapbox: initialize highp vec4 color
2354#pragma mapbox: initialize lowp float blur
2355#pragma mapbox: initialize lowp float opacity
2356#pragma mapbox: initialize mediump float gapwidth
2357#pragma mapbox: initialize lowp float offset
2358#pragma mapbox: initialize mediump float width
2359float 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);}`),Xa=In(`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;
2360#pragma mapbox: define lowp float blur
2361#pragma mapbox: define lowp float opacity
2362void main() {
2363#pragma mapbox: initialize lowp float blur
2364#pragma mapbox: initialize lowp float opacity
2365float 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);
2366#ifdef OVERDRAW_INSPECTOR
2367gl_FragColor=vec4(1.0);
2368#endif
2369}`,`
2370#define scale 0.015873016
2371attribute 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;
2372#pragma mapbox: define lowp float blur
2373#pragma mapbox: define lowp float opacity
2374#pragma mapbox: define mediump float gapwidth
2375#pragma mapbox: define lowp float offset
2376#pragma mapbox: define mediump float width
2377void main() {
2378#pragma mapbox: initialize lowp float blur
2379#pragma mapbox: initialize lowp float opacity
2380#pragma mapbox: initialize mediump float gapwidth
2381#pragma mapbox: initialize lowp float offset
2382#pragma mapbox: initialize mediump float width
2383float 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);}`),Ea=In(`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;
2384#pragma mapbox: define lowp vec4 pattern_from
2385#pragma mapbox: define lowp vec4 pattern_to
2386#pragma mapbox: define lowp float pixel_ratio_from
2387#pragma mapbox: define lowp float pixel_ratio_to
2388#pragma mapbox: define lowp float blur
2389#pragma mapbox: define lowp float opacity
2390void main() {
2391#pragma mapbox: initialize mediump vec4 pattern_from
2392#pragma mapbox: initialize mediump vec4 pattern_to
2393#pragma mapbox: initialize lowp float pixel_ratio_from
2394#pragma mapbox: initialize lowp float pixel_ratio_to
2395#pragma mapbox: initialize lowp float blur
2396#pragma mapbox: initialize lowp float opacity
2397vec2 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;
2398#ifdef OVERDRAW_INSPECTOR
2399gl_FragColor=vec4(1.0);
2400#endif
2401}`,`
2402#define scale 0.015873016
2403#define LINE_DISTANCE_SCALE 2.0
2404attribute 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;
2405#pragma mapbox: define lowp float blur
2406#pragma mapbox: define lowp float opacity
2407#pragma mapbox: define lowp float offset
2408#pragma mapbox: define mediump float gapwidth
2409#pragma mapbox: define mediump float width
2410#pragma mapbox: define lowp float floorwidth
2411#pragma mapbox: define lowp vec4 pattern_from
2412#pragma mapbox: define lowp vec4 pattern_to
2413#pragma mapbox: define lowp float pixel_ratio_from
2414#pragma mapbox: define lowp float pixel_ratio_to
2415void main() {
2416#pragma mapbox: initialize lowp float blur
2417#pragma mapbox: initialize lowp float opacity
2418#pragma mapbox: initialize lowp float offset
2419#pragma mapbox: initialize mediump float gapwidth
2420#pragma mapbox: initialize mediump float width
2421#pragma mapbox: initialize lowp float floorwidth
2422#pragma mapbox: initialize mediump vec4 pattern_from
2423#pragma mapbox: initialize mediump vec4 pattern_to
2424#pragma mapbox: initialize lowp float pixel_ratio_from
2425#pragma mapbox: initialize lowp float pixel_ratio_to
2426float 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;}`),Ka=In(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;
2426uniform 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;
2427#pragma mapbox: define highp vec4 color
2428#pragma mapbox: define lowp float blur
2429#pragma mapbox: define lowp float opacity
2430#pragma mapbox: define mediump float width
2431#pragma mapbox: define lowp float floorwidth
2432void main() {
2433#pragma mapbox: initialize highp vec4 color
2434#pragma mapbox: initialize lowp float blur
2435#pragma mapbox: initialize lowp float opacity
2436#pragma mapbox: initialize mediump float width
2437#pragma mapbox: initialize lowp float floorwidth
2438float 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);
2439#ifdef OVERDRAW_INSPECTOR
2440gl_FragColor=vec4(1.0);
2441#endif
2442}`,`
2443#define scale 0.015873016
2444#define LINE_DISTANCE_SCALE 2.0
2445attribute 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;
2446#pragma mapbox: define highp vec4 color
2447#pragma mapbox: define lowp float blur
2448#pragma mapbox: define lowp float opacity
2449#pragma mapbox: define mediump float gapwidth
2450#pragma mapbox: define lowp float offset
2451#pragma mapbox: define mediump float width
2452#pragma mapbox: define lowp float floorwidth
2453void main() {
2454#pragma mapbox: initialize highp vec4 color
2455#pragma mapbox: initialize lowp float blur
2456#pragma mapbox: initialize lowp float opacity
2457#pragma mapbox: initialize mediump float gapwidth
2458#pragma mapbox: initialize lowp float offset
2459#pragma mapbox: initialize mediump float width
2460#pragma mapbox: initialize lowp float floorwidth
2461float 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);}`),qa=In(`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);
2462#ifdef OVERDRAW_INSPECTOR
2463gl_FragColor=vec4(1.0);
2464#endif
2465}`,"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;}"),Ba=In(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
2466#pragma mapbox: define lowp float opacity
2467void main() {
2468#pragma mapbox: initialize lowp float opacity
2469lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
2470#ifdef OVERDRAW_INSPECTOR
2471gl_FragColor=vec4(1.0);
2472#endif
2473}`,`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;
2474#pragma mapbox: define lowp float opacity
2475void main() {
2476#pragma mapbox: initialize lowp float opacity
2477vec2 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 ?
2478camera_to_anchor_distance/u_camera_to_center_distance :
2479u_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));}`),Fh=In(`#define SDF_PX 8.0
2480uniform 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;
2481#pragma mapbox: define highp vec4 fill_color
2482#pragma mapbox: define highp vec4 halo_color
2483#pragma mapbox: define lowp float opacity
2484#pragma mapbox: define lowp float halo_width
2485#pragma mapbox: define lowp float halo_blur
2486void main() {
2487#pragma mapbox: initialize highp vec4 fill_color
2488#pragma mapbox: initialize highp vec4 halo_color
2489#pragma mapbox: initialize lowp float opacity
2490#pragma mapbox: initialize lowp float halo_width
2491#pragma mapbox: initialize lowp float halo_blur
2492float 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);
2493#ifdef OVERDRAW_INSPECTOR
2494gl_FragColor=vec4(1.0);
2495#endif
2496}`,`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;
2497#pragma mapbox: define highp vec4 fill_color
2498#pragma mapbox: define highp vec4 halo_color
2499#pragma mapbox: define lowp float opacity
2500#pragma mapbox: define lowp float halo_width
2501#pragma mapbox: define lowp float halo_blur
2502void main() {
2503#pragma mapbox: initialize highp vec4 fill_color
2504#pragma mapbox: initialize highp vec4 halo_color
2505#pragma mapbox: initialize lowp float opacity
2506#pragma mapbox: initialize lowp float halo_width
2507#pragma mapbox: initialize lowp float halo_blur
2508vec2 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 ?
2509camera_to_anchor_distance/u_camera_to_center_distance :
2510u_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);}`),Dh=In(`#define SDF_PX 8.0
2511#define SDF 1.0
2512#define ICON 0.0
2513uniform 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;
2514#pragma mapbox: define highp vec4 fill_color
2515#pragma mapbox: define highp vec4 halo_color
2516#pragma mapbox: define lowp float opacity
2517#pragma mapbox: define lowp float halo_width
2518#pragma mapbox: define lowp float halo_blur
2519void main() {
2520#pragma mapbox: initialize highp vec4 fill_color
2521#pragma mapbox: initialize highp vec4 halo_color
2522#pragma mapbox: initialize lowp float opacity
2523#pragma mapbox: initialize lowp float halo_width
2524#pragma mapbox: initialize lowp float halo_blur
2525float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
2525gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
2526#ifdef OVERDRAW_INSPECTOR
2527gl_FragColor=vec4(1.0);
2528#endif
2529return;}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);
2530#ifdef OVERDRAW_INSPECTOR
2531gl_FragColor=vec4(1.0);
2532#endif
2533}`,`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;
2534#pragma mapbox: define highp vec4 fill_color
2535#pragma mapbox: define highp vec4 halo_color
2536#pragma mapbox: define lowp float opacity
2537#pragma mapbox: define lowp float halo_width
2538#pragma mapbox: define lowp float halo_blur
2539void main() {
2540#pragma mapbox: initialize highp vec4 fill_color
2541#pragma mapbox: initialize highp vec4 halo_color
2542#pragma mapbox: initialize lowp float opacity
2543#pragma mapbox: initialize lowp float halo_width
2544#pragma mapbox: initialize lowp float halo_blur
2545vec2 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 ?
2546camera_to_anchor_distance/u_camera_to_center_distance :
2547u_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 In(l,d){var h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,m=d.match(/attribute ([\w]+) ([\w]+)/g),T=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),P=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),R=P?P.concat(T):T,L={};return{fragmentSource:l=l.replace(h,function(z,X,ee,Z,te){return L[te]=!0,X==="define"?`
2548#ifndef HAS_UNIFORM_u_`+te+`
2549varying `+ee+" "+Z+" "+te+`;
2550#else
2551uniform `+ee+" "+Z+" u_"+te+`;
2552#endif
2553`:`
2554#ifdef HAS_UNIFORM_u_`+te+`
2555    `+ee+" "+Z+" "+te+" = u_"+te+`;
2556#endif
2557`}),vertexSource:d=d.replace(h,function(z,X,ee,Z,te){var oe=Z==="float"?"vec2":"vec4",we=te.match(/color/)?"color":oe;return L[te]?X==="define"?`
2558#ifndef HAS_UNIFORM_u_`+te+`
2559uniform lowp float u_`+te+`_t;
2560attribute `+ee+" "+oe+" a_"+te+`;
2561varying `+ee+" "+Z+" "+te+`;
2562#else
2563uniform `+ee+" "+Z+" u_"+te+`;
2564#endif
2565`:we==="vec4"?`
2566#ifndef HAS_UNIFORM_u_`+te+`
2567    `+te+" = a_"+te+`;
2568#else
2569    `+ee+" "+Z+" "+te+" = u_"+te+`;
2570#endif
2571`:`
2572#ifndef HAS_UNIFORM_u_`+te+`
2573    `+te+" = unpack_mix_"+we+"(a_"+te+", u_"+te+`_t);
2574#else
2575    `+ee+" "+Z+" "+te+" = u_"+te+`;
2576#endif
2577`:X==="define"?`
2578#ifndef HAS_UNIFORM_u_`+te+`
2579uniform lowp float u_`+te+`_t;
2580attribute `+ee+" "+oe+" a_"+te+`;
2581#else
2582uniform `+ee+" "+Z+" u_"+te+`;
2583#endif
2584`:we==="vec4"?`
2585#ifndef HAS_UNIFORM_u_`+te+`
2586    `+ee+" "+Z+" "+te+" = a_"+te+`;
2587#else
2588    `+ee+" "+Z+" "+te+" = u_"+te+`;
2589#endif
2590`:`
2591#ifndef HAS_UNIFORM_u_`+te+`
2592    `+ee+" "+Z+" "+te+" = unpack_mix_"+we+"(a_"+te+", u_"+te+`_t);
2593#else
2594    `+ee+" "+Z+" "+te+" = u_"+te+`;
2595#endif
2596`}),staticAttributes:m,staticUniforms:R}}var lu=Object.freeze({__proto__:null,prelude:Ja,background:wl,backgroundPattern:Qp,circle:eA,clippingMask:gf,heatmap:au,heatmapTexture:Pc,collisionBox:Xo,collisionCircle:mf,debug:_f,fill:cu,fillOutline:xo,fillOutlinePattern:eo,fillPattern:yf,fillExtrusion:zi,fillExtrusionPattern:Cl,hillshadePrepare:wa,hillshade:Ca,line:Ta,lineGradient:Xa,linePattern:Ea,lineSDF:Ka,raster:qa,symbolIcon:Ba,symbolSDF:Fh,symbolTextAndIcon:Dh}),uu=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function Oh(l){for(var d=[],h=0;h<l.length;h++)if(l[h]!==null){var m=l[h].split(" ");d.push(m.pop())}return d}uu.prototype.bind=function(l,d,h,m,T,P,R,L){this.context=l;for(var z=this.boundPaintVertexBuffers.length!==m.length,X=0;!z&&X<m.length;X++)this.boundPaintVertexBuffers[X]!==m[X]&&(z=!0);l.extVertexArrayObject&&this.vao&&this.boundProgram===d&&this.boundLayoutVertexBuffer===h&&!z&&this.boundIndexBuffer===T&&this.boundVertexOffset===P&&this.boundDynamicVertexBuffer===R&&this.boundDynamicVertexBuffer2===L?(l.bindVertexArrayOES.set(this.vao),R&&R.bind(),T&&T.dynamicDraw&&T.bind(),L&&L.bind()):this.freshBind(d,h,m,T,P,R,L)}
vendor: 11,486 bytes, lines 2596-2598
2596,uu.prototype.freshBind=function(l,d,h,m,T,P,R){var L,z=l.numAttributes,X=this.context,ee=X.gl;if(X.extVertexArrayObject)this.vao&&this.destroy(),this.vao=X.extVertexArrayObject.createVertexArrayOES(),X.bindVertexArrayOES.set(this.vao),L=0,this.boundProgram=l,this.boundLayoutVertexBuffer=d,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=m,this.boundVertexOffset=T,this.boundDynamicVertexBuffer=P,this.boundDynamicVertexBuffer2=R;else{L=X.currentNumAttributes||0;for(var Z=z;Z<L;Z++)ee.disableVertexAttribArray(Z)}d.enableAttributes(ee,l);for(var te=0,oe=h;te<oe.length;te+=1)oe[te].enableAttributes(ee,l);P&&P.enableAttributes(ee,l),R&&R.enableAttributes(ee,l),d.bind(),d.setVertexAttribPointers(ee,l,T);for(var we=0,Fe=h;we<Fe.length;we+=1){var ge=Fe[we];ge.bind(),ge.setVertexAttribPointers(ee,l,T)}P&&(P.bind(),P.setVertexAttribPointers(ee,l,T)),m&&m.bind(),R&&(R.bind(),R.setVertexAttribPointers(ee,l,T)),X.currentNumAttributes=z},uu.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var Lh=function(l,d,h,m,T,P){var R=l.gl;this.program=R.createProgram();for(var L=Oh(h.staticAttributes),z=m?m.getBinderAttributes():[],X=L.concat(z),ee=h.staticUniforms?Oh(h.staticUniforms):[],Z=m?m.getBinderUniforms():[],te=[],oe=0,we=ee.concat(Z);oe<we.length;oe+=1){var Fe=we[oe];te.indexOf(Fe)<0&&te.push(Fe)}var ge=m?m.defines():[];P&&ge.push("#define OVERDRAW_INSPECTOR;");var Re=ge.concat(Ja.fragmentSource,h.fragmentSource).join(`
2597`),He=ge.concat(Ja.vertexSource,h.vertexSource).join(`
2598`),We=R.createShader(R.FRAGMENT_SHADER);if(R.isContextLost())this.failedToCreate=!0;else{R.shaderSource(We,Re),R.compileShader(We),R.attachShader(this.program,We);var nt=R.createShader(R.VERTEX_SHADER);if(R.isContextLost())this.failedToCreate=!0;else{R.shaderSource(nt,He),R.compileShader(nt),R.attachShader(this.program,nt),this.attributes={};var Xe={};this.numAttributes=X.length;for(var Qe=0;Qe<this.numAttributes;Qe++)X[Qe]&&(R.bindAttribLocation(this.program,Qe,X[Qe]),this.attributes[X[Qe]]=Qe);R.linkProgram(this.program),R.deleteShader(nt),R.deleteShader(We);for(var pt=0;pt<te.length;pt++){var Dt=te[pt];if(Dt&&!Xe[Dt]){var Ct=R.getUniformLocation(this.program,Dt);Ct&&(Xe[Dt]=Ct)}}this.fixedUniforms=T(l,Xe),this.binderUniforms=m?m.getUniforms(l,Xe):[]}}};function Rc(l,d,h){var m=1/Rn(h,1,d.transform.tileZoom),T=Math.pow(2,h.tileID.overscaledZ),P=h.tileSize*Math.pow(2,d.transform.tileZoom)/T,R=P*(h.tileID.canonical.x+h.tileID.wrap*T),L=P*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[m,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[R>>16,L>>16],u_pixel_coord_lower:[65535&R,65535&L]}}Lh.prototype.draw=function(l,d,h,m,T,P,R,L,z,X,ee,Z,te,oe,we,Fe){var ge,Re=l.gl;if(!this.failedToCreate){for(var He in l.program.set(this.program),l.setDepthMode(h),l.setStencilMode(m),l.setColorMode(T),l.setCullFace(P),this.fixedUniforms)this.fixedUniforms[He].set(R[He]);oe&&oe.setUniforms(l,this.binderUniforms,Z,{zoom:te});for(var We=(ge={},ge[Re.LINES]=2,ge[Re.TRIANGLES]=3,ge[Re.LINE_STRIP]=1,ge)[d],nt=0,Xe=ee.get();nt<Xe.length;nt+=1){var Qe=Xe[nt],pt=Qe.vaos||(Qe.vaos={});(pt[L]||(pt[L]=new uu)).bind(l,this,z,oe?oe.getPaintVertexBuffers():[],X,Qe.vertexOffset,we,Fe),Re.drawElements(d,Qe.primitiveLength*We,Re.UNSIGNED_SHORT,Qe.primitiveOffset*We*2)}}};var kh=function(l,d,h,m){var T=d.style.light,P=T.properties.get("position"),R=[P.x,P.y,P.z],L=o.create$1();T.properties.get("anchor")==="viewport"&&o.fromRotation(L,-d.transform.angle),o.transformMat3(R,R,L);var z=T.properties.get("color");return{u_matrix:l,u_lightpos:R,u_lightintensity:T.properties.get("intensity"),u_lightcolor:[z.r,z.g,z.b],u_vertical_gradient:+h,u_opacity:m}},Ko=function(l,d,h,m,T,P,R){return o.extend(kh(l,d,h,m),Rc(P,d,R),{u_height_factor:-Math.pow(2,T.overscaledZ)/R.tileSize/8})},qo=function(l){return{u_matrix:l}},to=function(l,d,h,m){return o.extend(qo(l),Rc(h,d,m))},Nh=function(l,d){return{u_matrix:l,u_world:d}},fu=function(l,d,h,m,T){return o.extend(to(l,d,h,m),{u_world:T})},hu=function(l,d,h,m){var T,P,R=l.transform;if(m.paint.get("circle-pitch-alignment")==="map"){var L=Rn(h,1,R.zoom);T=!0,P=[L,L]}else T=!1,P=R.pixelsToGLUnits;return{u_camera_to_center_distance:R.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:l.translatePosMatrix(d.posMatrix,h,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+T,u_device_pixel_ratio:o.browser.devicePixelRatio,u_extrude_scale:P}},Ya=function(l,d,h){var m=Rn(h,1,d.zoom),T=Math.pow(2,d.zoom-h.tileID.overscaledZ),P=h.tileID.overscaleFactor();return{u_matrix:l,u_camera_to_center_distance:d.cameraToCenterDistance,u_pixels_to_tile_units:m,u_extrude_scale:[d.pixelsToGLUnits[0]/(m*T),d.pixelsToGLUnits[1]/(m*T)],u_overscale_factor:P}},vf=function(l,d,h){return{u_matrix:l,u_inv_matrix:d,u_camera_to_center_distance:h.cameraToCenterDistance,u_viewport_size:[h.width,h.height]}},Yo=function(l,d,h){return h===void 0&&(h=1),{u_matrix:l,u_color:d,u_overlay:0,u_overlay_scale:h}},Zo=function(l){return{u_matrix:l}},Tl=function(l,d,h,m){return{u_matrix:l,u_extrude_scale:Rn(d,1,h),u_intensity:m}},Fn=function(l,d,h){var m=l.transform;return{u_matrix:Uh(l,d,h),u_ratio:1/Rn(d,1,m.zoom),u_device_pixel_ratio:o.browser.devicePixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},On=function(l,d,h,m){return o.extend(Fn(l,d,h),{u_image:0,u_image_height:m})},du=function(l,d,h,m){var T=l.transform,P=Fc(d,T);return{u_matrix:Uh(l,d,h),u_texsize:d.imageAtlasTexture.size,u_ratio:1/Rn(d,1,T.zoom),u_device_pixel_ratio:o.browser.devicePixelRatio,u_image:0,u_scale:[P,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/T.pixelsToGLUnits[0],1/T.pixelsToGLUnits[1]]}},tA=function(l,d,h,m,T){var P=l.lineAtlas,R=Fc(d,l.transform),L=h.layout.get("line-cap")==="round",z=P.getDash(m.from,L),X=P.getDash(m.to,L),ee=z.width*T.fromScale,Z=X.width*T.toScale;return o.extend(Fn(l,d,h),{u_patternscale_a:[R/ee,-z.height/2],u_patternscale_b:[R/Z,-X.height/2],u_sdfgamma:P.width/(256*Math.min(ee,Z)*o.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:z.y,u_tex_y_b:X.y,u_mix:T.t})};function Fc(l,d){return 1/Rn(l,1,d.tileZoom)}function Uh(l,d,h){return l.translatePosMatrix(d.tileID.posMatrix,d,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}var rA=function(l,d,h,m,T){return{u_matrix:l,u_tl_parent:d,u_scale_parent:h,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*T.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:T.paint.get("raster-brightness-min"),u_brightness_high:T.paint.get("raster-brightness-max"),u_saturation_factor:(R=T.paint.get("raster-saturation"),R>0?1-1/(1.001-R):-R),u_contrast_factor:(P=T.paint.get("raster-contrast"),P>0?1/(1-P):1+P),u_spin_weights:zh(T.paint.get("raster-hue-rotate"))};var P,R};function zh(l){l*=Math.PI/180;var d=Math.sin(l),h=Math.cos(l);return[(2*h+1)/3,(-Math.sqrt(3)*d-h+1)/3,(Math.sqrt(3)*d-h+1)/3]}var ns,Sa=function(l,d,h,m,T,P,R,L,z,X){var ee=T.transform;return{u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:ee.width/ee.height,u_fade_change:T.options.fadeDuration?T.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:R,u_coord_matrix:L,u_is_text:+z,u_pitch_with_map:+m,u_texsize:X,u_texture:0}},wo=function(l,d,h,m,T,P,R,L,z,X,ee){var Z=T.transform;return o.extend(Sa(l,d,h,m,T,P,R,L,z,X),{u_gamma_scale:m?Math.cos(Z._pitch)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:o.browser.devicePixelRatio,u_is_halo:1})},pu=function(l,d,h,m,T,P,R,L,z,X){return o.extend(wo(l,d,h,m,T,P,R,L,!0,z),{u_texsize_icon:X,u_texture_icon:1})},Za=function(l,d,h){return{u_matrix:l,u_opacity:d,u_color:h}},Dc=function(l,d,h,m,T,P){return o.extend(function(R,L,z,X){var ee=z.imageManager.getPattern(R.from.toString()),Z=z.imageManager.getPattern(R.to.toString()),te=z.imageManager.getPixelSize(),oe=te.width,we=te.height,Fe=Math.pow(2,X.tileID.overscaledZ),ge=X.tileSize*Math.pow(2,z.transform.tileZoom)/Fe,Re=ge*(X.tileID.canonical.x+X.tileID.wrap*Fe),He=ge*X.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:ee.tl,u_pattern_br_a:ee.br,u_pattern_tl_b:Z.tl,u_pattern_br_b:Z.br,u_texsize:[oe,we],u_mix:L.t,u_pattern_size_a:ee.displaySize,u_pattern_size_b:Z.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Rn(X,1,z.transform.tileZoom),u_pixel_coord_upper:[Re>>16,He>>16],u_pixel_coord_lower:[65535&Re,65535&He]}}(m,P,h,T),{u_matrix:l,u_opacity:d})},zs={fillExtrusion:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_lightpos:new o.Uniform3f(l,d.u_lightpos),u_lightintensity:new o.Uniform1f(l,d.u_lightintensity),u_lightcolor:new o.Uniform3f(l,d.u_lightcolor),u_vertical_gradient:new o.Uniform1f(l,d.u_vertical_gradient),u_opacity:new o.Uniform1f(l,d.u_opacity)}},fillExtrusionPattern:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_lightpos:new o.Uniform3f(l,d.u_lightpos),u_lightintensity:new o.Uniform1f(l,d.u_lightintensity),u_lightcolor:new o.Uniform3f(l,d.u_lightcolor),u_vertical_gradient:new o.Uniform1f(l,d.u_vertical_gradient),u_height_factor:new o.Uniform1f(l,d.u_height_factor),u_image:new o.Uniform1i(l,d.u_image),u_texsize:new o.Uniform2f(l,d.u_texsize),u_pixel_coord_upper:new o.Uniform2f(l,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(l,d.u_pixel_coord_lower),u_scale:new o.Uniform3f(l,d.u_scale),u_fade:new o.Uniform1f(l,d.u_fade),u_opacity:new o.Uniform1f(l,d.u_opacity)}},fill:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix)}},fillPattern:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_image:new o.Uniform1i(l,d.u_image),u_texsize:new o.Uniform2f(l,d.u_texsize),u_pixel_coord_upper:new o.Uniform2f(l,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(l,d.u_pixel_coord_lower),u_scale:new o.Uniform3f(l,d.u_scale),u_fade:new o.Uniform1f(l,d.u_fade)}},fillOutline:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_world:new o.Uniform2f(l,d.u_world)}},fillOutlinePattern:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_world:new o.Uniform2f(l,d.u_world),u_image:new o.Uniform1i(l,d.u_image),u_texsize:new o.Uniform2f(l,d.u_texsize),u_pixel_coord_upper:new o.Uniform2f(l,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(l,d.u_pixel_coord_lower),u_scale:new o.Uniform3f(l,d.u_scale),u_fade:new o.Uniform1f(l,d.u_fade)}},circle:function(l,d){return{u_camera_to_center_distance:new o.Uniform1f(l,d.u_camera_to_center_distance),u_scale_with_map:new o.Uniform1i(l,d.u_scale_with_map),u_pitch_with_map:new o.Uniform1i(l,d.u_pitch_with_map),u_extrude_scale:new o.Uniform2f(l,d.u_extrude_scale),u_device_pixel_ratio:new o.Uniform1f(l,d.u_device_pixel_ratio),u_matrix:new o.UniformMatrix4f(l,d.u_matrix)}},collisionBox:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_camera_to_center_distance:new o.Uniform1f(l,d.u_camera_to_center_distance),u_pixels_to_tile_units:new o.Uniform1f(l,d.u_pixels_to_tile_units),u_extrude_scale:new o.Uniform2f(l,d.u_extrude_scale),u_overscale_factor:new o.Uniform1f(l,d.u_overscale_factor)}},collisionCircle:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_inv_matrix:new o.UniformMatrix4f(l,d.u_inv_matrix
2598),u_camera_to_center_distance:new o.Uniform1f(l,d.u_camera_to_center_distance),u_viewport_size:new o.Uniform2f(l,d.u_viewport_size)}},debug:function(l,d){return{u_color:new o.UniformColor(l,d.u_color),u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_overlay:new o.Uniform1i(l,d.u_overlay),u_overlay_scale:new o.Uniform1f(l,d.u_overlay_scale)}},clippingMask:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix)}},heatmap:function(l,d){return{u_extrude_scale:new o.Uniform1f(l,d.u_extrude_scale),u_intensity:new o.Uniform1f(l,d.u_intensity),u_matrix:new o.UniformMatrix4f(l,d.u_matrix)}},heatmapTexture:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_world:new o.Uniform2f(l,d.u_world),u_image:new o.Uniform1i(l,d.u_image),u_color_ramp:new o.Uniform1i(l,d.u_color_ramp),u_opacity:new o.Uniform1f(l,d.u_opacity)}},hillshade:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_image:new o.Uniform1i(l,d.u_image),u_latrange:new o.Uniform2f(l,d.u_latrange),u_light:new o.Uniform2f(l,d.u_light),u_shadow:new o.UniformColor(l,d.u_shadow),u_highlight:new o.UniformColor(l,d.u_highlight),u_accent:new o.UniformColor(l,d.u_accent)}},hillshadePrepare:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_image:new o.Uniform1i(l,d.u_image),u_dimension:new o.Uniform2f(l,d.u_dimension),u_zoom:new o.Uniform1f(l,d.u_zoom),u_unpack:new o.Uniform4f(l,d.u_unpack)}},line:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_ratio:new o.Uniform1f(l,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(l,d.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(l,d.u_units_to_pixels)}},lineGradient:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_ratio:new o.Uniform1f(l,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(l,d.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(l,d.u_units_to_pixels),u_image:new o.Uniform1i(l,d.u_image),u_image_height:new o.Uniform1f(l,d.u_image_height)}},linePattern:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_texsize:new o.Uniform2f(l,d.u_texsize),u_ratio:new o.Uniform1f(l,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(l,d.u_device_pixel_ratio),u_image:new o.Uniform1i(l,d.u_image),u_units_to_pixels:new o.Uniform2f(l,d.u_units_to_pixels),u_scale:new o.Uniform3f(l,d.u_scale),u_fade:new o.Uniform1f(l,d.u_fade)}},lineSDF:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_ratio:new o.Uniform1f(l,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(l,d.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(l,d.u_units_to_pixels),u_patternscale_a:new o.Uniform2f(l,d.u_patternscale_a),u_patternscale_b:new o.Uniform2f(l,d.u_patternscale_b),u_sdfgamma:new o.Uniform1f(l,d.u_sdfgamma),u_image:new o.Uniform1i(l,d.u_image),u_tex_y_a:new o.Uniform1f(l,d.u_tex_y_a),u_tex_y_b:new o.Uniform1f(l,d.u_tex_y_b),u_mix:new o.Uniform1f(l,d.u_mix)}},raster:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_tl_parent:new o.Uniform2f(l,d.u_tl_parent),u_scale_parent:new o.Uniform1f(l,d.u_scale_parent),u_buffer_scale:new o.Uniform1f(l,d.u_buffer_scale),u_fade_t:new o.Uniform1f(l,d.u_fade_t),u_opacity:new o.Uniform1f(l,d.u_opacity),u_image0:new o.Uniform1i(l,d.u_image0),u_image1:new o.Uniform1i(l,d.u_image1),u_brightness_low:new o.Uniform1f(l,d.u_brightness_low),u_brightness_high:new o.Uniform1f(l,d.u_brightness_high),u_saturation_factor:new o.Uniform1f(l,d.u_saturation_factor),u_contrast_factor:new o.Uniform1f(l,d.u_contrast_factor),u_spin_weights:new o.Uniform3f(l,d.u_spin_weights)}},symbolIcon:function(l,d){return{u_is_size_zoom_constant:new o.Uniform1i(l,d.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(l,d.u_is_size_feature_constant),u_size_t:new o.Uniform1f(l,d.u_size_t),u_size:new o.Uniform1f(l,d.u_size),u_camera_to_center_distance:new o.Uniform1f(l,d.u_camera_to_center_distance),u_pitch:new o.Uniform1f(l,d.u_pitch),u_rotate_symbol:new o.Uniform1i(l,d.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(l,d.u_aspect_ratio),u_fade_change:new o.Uniform1f(l,d.u_fade_change),u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(l,d.u_label_plane_matrix
2598),u_coord_matrix:new o.UniformMatrix4f(l,d.u_coord_matrix),u_is_text:new o.Uniform1i(l,d.u_is_text),u_pitch_with_map:new o.Uniform1i(l,d.u_pitch_with_map),u_texsize:new o.Uniform2f(l,d.u_texsize),u_texture:new o.Uniform1i(l,d.u_texture)}},symbolSDF:function(l,d){return{u_is_size_zoom_constant:new o.Uniform1i(l,d.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(l,d.u_is_size_feature_constant),u_size_t:new o.Uniform1f(l,d.u_size_t),u_size:new o.Uniform1f(l,d.u_size),u_camera_to_center_distance:new o.Uniform1f(l,d.u_camera_to_center_distance),u_pitch:new o.Uniform1f(l,d.u_pitch),u_rotate_symbol:new o.Uniform1i(l,d.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(l,d.u_aspect_ratio),u_fade_change:new o.Uniform1f(l,d.u_fade_change),u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(l,d.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(l,d.u_coord_matrix),u_is_text:new o.Uniform1i(l,d.u_is_text),u_pitch_with_map:new o.Uniform1i(l,d.u_pitch_with_map),u_texsize:new o.Uniform2f(l,d.u_texsize),u_texture:new o.Uniform1i(l,d.u_texture),u_gamma_scale:new o.Uniform1f(l,d.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(l,d.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(l,d.u_is_halo)}},symbolTextAndIcon:function(l,d){return{u_is_size_zoom_constant:new o.Uniform1i(l,d.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(l,d.u_is_size_feature_constant),u_size_t:new o.Uniform1f(l,d.u_size_t),u_size:new o.Uniform1f(l,d.u_size),u_camera_to_center_distance:new o.Uniform1f(l,d.u_camera_to_center_distance),u_pitch:new o.Uniform1f(l,d.u_pitch),u_rotate_symbol:new o.Uniform1i(l,d.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(l,d.u_aspect_ratio),u_fade_change:new o.Uniform1f(l,d.u_fade_change),u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(l,d.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(l,d.u_coord_matrix),u_is_text:new o.Uniform1i(l,d.u_is_text),u_pitch_with_map:new o.Uniform1i(l,d.u_pitch_with_map),u_texsize:new o.Uniform2f(l,d.u_texsize),u_texsize_icon:new o.Uniform2f(l,d.u_texsize_icon),u_texture:new o.Uniform1i(l,d.u_texture),u_texture_icon:new o.Uniform1i(l,d.u_texture_icon),u_gamma_scale:new o.Uniform1f(l,d.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(l,d.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(l,d.u_is_halo)}},background:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_opacity:new o.Uniform1f(l,d.u_opacity),u_color:new o.UniformColor(l,d.u_color)}},backgroundPattern:function(l,d){return{u_matrix:new o.UniformMatrix4f(l,d.u_matrix),u_opacity:new o.Uniform1f(l,d.u_opacity),u_image:new o.Uniform1i(l,d.u_image),u_pattern_tl_a:new o.Uniform2f(l,d.u_pattern_tl_a),u_pattern_br_a:new o.Uniform2f(l,d.u_pattern_br_a),u_pattern_tl_b:new o.Uniform2f(l,d.u_pattern_tl_b),u_pattern_br_b:new o.Uniform2f(l,d.u_pattern_br_b),u_texsize:new o.Uniform2f(l,d.u_texsize),u_mix:new o.Uniform1f(l,d.u_mix),u_pattern_size_a:new o.Uniform2f(l,d.u_pattern_size_a),u_pattern_size_b:new o.Uniform2f(l,d.u_pattern_size_b),u_scale_a:new o.Uniform1f(l,d.u_scale_a),u_scale_b:new o.Uniform1f(l,d.u_scale_b),u_pixel_coord_upper:new o.Uniform2f(l,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(l,d.u_pixel_coord_lower),u_tile_units_to_pixels:new o.Uniform1f(l,d.u_tile_units_to_pixels)}}};
2598function Qa(l,d,h,m,T,P,R){for(var L=l.context,z=L.gl,X=l.useProgram("collisionBox"),ee=[],Z=0,te=0,oe=0;oe<m.length;oe++){var we=m[oe],Fe=d.getTile(we),ge=Fe.getBucket(h);if(ge){var Re=we.posMatrix;T[0]===0&&T[1]===0||(Re=l.translatePosMatrix(we.posMatrix,Fe,T,P));var He=R?ge.textCollisionBox:ge.iconCollisionBox,We=ge.collisionCircleArray;if(We.length>0){var nt=o.create(),Xe=Re;o.mul(nt,ge.placementInvProjMatrix,l.transform.glCoordMatrix),o.mul(nt,nt,ge.placementViewportMatrix),ee.push({circleArray:We,circleOffset:te,transform:Xe,invTransform:nt}),te=Z+=We.length/4}He&&X.draw(L,z.LINES,ve.disabled,Oe.disabled,l.colorModeForRenderPass(),be.disabled,Ya(Re,l.transform,Fe),h.id,He.layoutVertexBuffer,He.indexBuffer,He.segments,null,l.transform.zoom,null,null,He.collisionVertexBuffer)}}if(R&&ee.length){var Qe=l.useProgram("collisionCircle"),pt=new o.StructArrayLayout2f1f2i16;pt.resize(4*Z),pt._trim();for(var Dt=0,Ct=0,zt=ee;Ct<zt.length;Ct+=1)for(var sr=zt[Ct],Er=0;Er<sr.circleArray.length/4;Er++){var Mr=4*Er,xn=sr.circleArray[Mr+0],ar=sr.circleArray[Mr+1],$r=sr.circleArray[Mr+2],rn=sr.circleArray[Mr+3];pt.emplace(Dt++,xn,ar,$r,rn,0),pt.emplace(Dt++,xn,ar,$r,rn,1),pt.emplace(Dt++,xn,ar,$r,rn,2),pt.emplace(Dt++,xn,ar,$r,rn,3)}(!ns||ns.length<2*Z)&&(ns=function(Ei){var vs=2*Ei,as=new o.StructArrayLayout3ui6;as.resize(vs),as._trim();for(var bi=0;bi<vs;bi++){var Mi=6*bi;as.uint16[Mi+0]=4*bi+0,as.uint16[Mi+1]=4*bi+1,as.uint16[Mi+2]=4*bi+2,as.uint16[Mi+3]=4*bi+2,as.uint16[Mi+4]=4*bi+3,as.uint16[Mi+5]=4*bi+0}return as}(Z));for(var jr=L.createIndexBuffer(ns,!0),Gr=L.createVertexBuffer(pt,o.collisionCircleLayout.members,!0),Zr=0,kr=ee;Zr<kr.length;Zr+=1){var Or=kr[Zr],qi=vf(Or.transform,Or.invTransform,l.transform);Qe.draw(L,z.TRIANGLES,ve.disabled,Oe.disabled,l.colorModeForRenderPass(),be.disabled,qi,h.id,Gr,jr,o.SegmentVector.simpleSegment(0,2*Or.circleOffset,Or.circleArray.length,Or.circleArray.length/2),null,l.transform.zoom,null,null,null)}Gr.destroy(),jr.destroy()}}var Gs=o.identity(new Float32Array(16));function ec(l,d,h,m,T,P){var R=o.getAnchorAlignment(l),L=-(R.horizontalAlign-.5)*d,z=-(R.verticalAlign-.5)*h,X=o.evaluateVariableOffset(l,m);return new o.Point((L/T+X[0])*P,(z/T+X[1])*P)}function Oc(l,d,h,m,T,P,R,L,z,X,ee){var Z=l.text.placedSymbolArray,te=l.text.dynamicLayoutVertexArray,oe=l.icon.dynamicLayoutVertexArray,we={};te.clear();for(var Fe=0;Fe<Z.length;Fe++){var ge=Z.get(Fe),Re=ge.hidden||!ge.crossTileID||l.allowVerticalPlacement&&!ge.placedOrientation?null:m[ge.crossTileID];if(Re){var He=new o.Point(ge.anchorX,ge.anchorY),We=Xt(He,h?L:R),nt=tn(P.cameraToCenterDistance,We.signedDistanceFromCamera),Xe=T.evaluateSizeForFeature(l.textSizeData,X,ge)*nt/o.ONE_EM;h&&(Xe*=l.tilePixelRatio/z);for(var Qe=ec(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale,Xe),pt=h?Xt(He.add(Qe),R).point:We.point.add(d?Qe.rotate(-P.angle):Qe),Dt=l.allowVerticalPlacement&&ge.placedOrientation===o.WritingMode.vertical?Math.PI/2:0,Ct=0;Ct<ge.numGlyphs;Ct++)o.addDynamicAttributes(te,pt,Dt);ee&&ge.associatedIconIndex>=0&&(we[ge.associatedIconIndex]={shiftedAnchor:pt,angle:Dt})}else Oi(ge.numGlyphs,te)}if(ee){oe.clear();for(var zt=l.icon.placedSymbolArray,sr=0;sr<zt.length;sr++){var Er=zt.get(sr);if(Er.hidden)Oi(Er.numGlyphs,oe);else{var Mr=we[sr];if(Mr)for(var xn=0;xn<Er.numGlyphs;xn++)o.addDynamicAttributes(oe,Mr.shiftedAnchor,Mr.angle);else Oi(Er.numGlyphs,oe)}}l.icon.dynamicLayoutVertexBuffer.updateData(oe)}l.text.dynamicLayoutVertexBuffer.updateData(te)}function Lc(l,d,h){return h.iconsInText&&d?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function tc(l,d,h,m,T,P,R,L,z,X,ee,Z){for(var te=l.context,oe=te.gl,we=l.transform,Fe=L==="map",ge=z==="map",Re=Fe&&h.layout.get("symbol-placement")!=="point",He=Fe&&!ge&&!Re,We=h.layout.get("symbol-sort-key").constantOr(1)!==void 0,nt=!1,Xe=l.depthModeForSublayer(0,ve.ReadOnly),Qe=h.layout.get("text-variable-anchor"),pt=[],Dt=0,Ct=m;Dt<Ct.length;Dt+=1){var zt=Ct[Dt],sr=d.getTile(zt),Er=sr.getBucket(h);if(Er){var Mr=T?Er.text:Er.icon;if(Mr&&Mr.segments.get().length){var xn=Mr.programConfigurations.get(h.id),ar=T||Er.sdfIcons,$r=T?Er.textSizeData:Er.iconSizeData,rn=ge||we.pitch!==0,jr=l.useProgram(Lc(ar,T,Er),xn),Gr=o.evaluateSizeForZoom($r,we.zoom),Zr=void 0,kr=[0,0],Or=void 0,qi=void 0,Ei=null,vs=void 0;if(T)Or=sr.glyphAtlasTexture,qi=oe.LINEAR,Zr=sr.glyphAtlasTexture.size,Er.iconsInText&&(kr=sr.imageAtlasTexture.size,Ei=sr.imageAtlasTexture,vs=rn||l.options.rotating||l.options.zooming||$r.kind==="composite"||$r.kind==="camera"?oe.LINEAR:oe.NEAREST);else{var as=h.layout.get("icon-size").constantOr(0)!==1||Er.iconsNeedLinear;Or=sr.imageAtlasTexture,qi=ar||l.options.rotating||l.options.zooming||as||rn?oe.LINEAR:oe.NEAREST,Zr=sr.imageAtlasTexture.size}var bi=Rn(sr,1,l.transform.zoom),Mi=pr(zt.posMatrix,ge,Fe,l.transform,bi),ao=Ie(zt.posMatrix,ge,Fe,l.transform,bi),Ps=Qe&&Er.hasTextData(),jc=h.layout.get("icon-text-fit")!=="none"&&Ps&&Er.hasIconData();Re&&ya(Er,zt.posMatrix,l,T,Mi,ao,ge,X);var $s=l.translatePosMatrix(zt.posMatrix,sr,P,R),oa=Re||T&&Qe||jc?Gs:Mi,Lo=l.translatePosMatrix(ao,sr,P,R,!0),If=ar&&h.paint.get(T?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Eu={program:jr,buffers:Mr,uniformValues:ar?Er.
vendor: 6,498 bytes, line 2598
2598iconsInText?pu($r.kind,Gr,He,ge,l,$s,oa,Lo,Zr,kr):wo($r.kind,Gr,He,ge,l,$s,oa,Lo,T,Zr):Sa($r.kind,Gr,He,ge,l,$s,oa,Lo,T,Zr),atlasTexture:Or,atlasTextureIcon:Ei,atlasInterpolation:qi,atlasInterpolationIcon:vs,isSDF:ar,hasHalo:If};if(We&&Er.canOverlap){nt=!0;for(var $c=0,Bu=Mr.segments.get();$c<Bu.length;$c+=1){var Mf=Bu[$c];pt.push({segments:new o.SegmentVector([Mf]),sortKey:Mf.sortKey,state:Eu})}}else pt.push({segments:Mr.segments,sortKey:0,state:Eu})}}}nt&&pt.sort(function(Wc,Dl){return Wc.sortKey-Dl.sortKey});for(var Ma=0,Pf=pt;Ma<Pf.length;Ma+=1){var Pa=Pf[Ma],Yi=Pa.state;if(te.activeTexture.set(oe.TEXTURE0),Yi.atlasTexture.bind(Yi.atlasInterpolation,oe.CLAMP_TO_EDGE),Yi.atlasTextureIcon&&(te.activeTexture.set(oe.TEXTURE1),Yi.atlasTextureIcon&&Yi.atlasTextureIcon.bind(Yi.atlasInterpolationIcon,oe.CLAMP_TO_EDGE)),Yi.isSDF){var sc=Yi.uniformValues;Yi.hasHalo&&(sc.u_is_halo=1,kc(Yi.buffers,Pa.segments,h,l,Yi.program,Xe,ee,Z,sc)),sc.u_is_halo=0}kc(Yi.buffers,Pa.segments,h,l,Yi.program,Xe,ee,Z,Yi.uniformValues)}}function kc(l,d,h,m,T,P,R,L,z){var X=m.context;T.draw(X,X.gl.TRIANGLES,P,R,L,be.disabled,z,h.id,l.layoutVertexBuffer,l.indexBuffer,d,h.paint,m.transform.zoom,l.programConfigurations.get(h.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function Au(l,d,h,m,T,P,R){var L,z,X,ee,Z,te=l.context.gl,oe=h.paint.get("fill-pattern"),we=oe&&oe.constantOr(1),Fe=h.getCrossfadeParameters();R?(z=we&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=te.LINES):(z=we?"fillPattern":"fill",L=te.TRIANGLES);for(var ge=0,Re=m;ge<Re.length;ge+=1){var He=Re[ge],We=d.getTile(He);if(!we||We.patternsLoaded()){var nt=We.getBucket(h);if(nt){var Xe=nt.programConfigurations.get(h.id),Qe=l.useProgram(z,Xe);we&&(l.context.activeTexture.set(te.TEXTURE0),We.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),Xe.updatePaintBuffers(Fe));var pt=oe.constantOr(null);if(pt&&We.imageAtlas){var Dt=We.imageAtlas,Ct=Dt.patternPositions[pt.to.toString()],zt=Dt.patternPositions[pt.from.toString()];Ct&&zt&&Xe.setConstantPatternPositions(Ct,zt)}var sr=l.translatePosMatrix(He.posMatrix,We,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(R){ee=nt.indexBuffer2,Z=nt.segments2;var Er=[te.drawingBufferWidth,te.drawingBufferHeight];X=z==="fillOutlinePattern"&&we?fu(sr,l,Fe,We,Er):Nh(sr,Er)}else ee=nt.indexBuffer,Z=nt.segments,X=we?to(sr,l,Fe,We):qo(sr);Qe.draw(l.context,L,T,l.stencilModeForClipping(He),P,be.disabled,X,h.id,nt.layoutVertexBuffer,ee,Z,h.paint,l.transform.zoom,Xe)}}}}function El(l,d,h,m,T,P,R){for(var L=l.context,z=L.gl,X=h.paint.get("fill-extrusion-pattern"),ee=X.constantOr(1),Z=h.getCrossfadeParameters(),te=h.paint.get("fill-extrusion-opacity"),oe=0,we=m;oe<we.length;oe+=1){var Fe=we[oe],ge=d.getTile(Fe),Re=ge.getBucket(h);if(Re){var He=Re.programConfigurations.get(h.id),We=l.useProgram(ee?"fillExtrusionPattern":"fillExtrusion",He);ee&&(l.context.activeTexture.set(z.TEXTURE0),ge.imageAtlasTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),He.updatePaintBuffers(Z));var nt=X.constantOr(null);if(nt&&ge.imageAtlas){var Xe=ge.imageAtlas,Qe=Xe.patternPositions[nt.to.toString()],pt=Xe.patternPositions[nt.from.toString()];Qe&&pt&&He.setConstantPatternPositions(Qe,pt)}var Dt=l.translatePosMatrix(Fe.posMatrix,ge,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Ct=h.paint.get("fill-extrusion-vertical-gradient"),zt=ee?Ko(Dt,l,Ct,te,Fe,Z,ge):kh(Dt,l,Ct,te);We.draw(L,L.gl.TRIANGLES,T,P,R,be.backCCW,zt,h.id,Re.layoutVertexBuffer,Re.indexBuffer,Re.segments,h.paint,l.transform.zoom,He)}}}function gu(l,d,h,m,T,P){var R=l.context,L=R.gl,z=d.fbo;if(z){var X=l.useProgram("hillshade");R.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,z.colorAttachment.get());var ee=function(Z,te,oe){var we=oe.paint.get("hillshade-shadow-color"),Fe=oe.paint.get("hillshade-highlight-color"),ge=oe.paint.get("hillshade-accent-color"),Re=oe.paint.get("hillshade-illumination-direction")*(Math.PI/180);oe.paint.get("hillshade-illumination-anchor")==="viewport"&&(Re-=Z.transform.angle);var He,We,nt,Xe=!Z.options.moving;return{u_matrix:Z.transform.calculatePosMatrix(te.tileID.toUnwrapped(),Xe),u_image:0,u_latrange:(He=te.tileID,We=Math.pow(2,He.canonical.z),nt=He.canonical.y,[new o.MercatorCoordinate(0,nt/We).toLngLat().lat,new o.MercatorCoordinate(0,(nt+1)/We).toLngLat().lat]),u_light:[oe.paint.get("hillshade-exaggeration"),Re],u_shadow:we,u_highlight:Fe,u_accent:ge}}(l,d,h);X.draw(R,L.TRIANGLES,m,T,P,be.disabled,ee,h.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}}function nA(l,d,h,m,T,P){var R=l.context,L=R.gl,z=d.dem;if(z&&z.data){var X=z.dim,ee=z.stride,Z=z.getPixels();if(R.activeTexture.set(L.TEXTURE1),R.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||l.getTileTexture(ee),d.demTexture){var te=d.demTexture;te.update(Z,{premultiply:!1}),te.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else d.demTexture=new o.Texture(R,Z,L.RGBA,{premultiply:!1}),d.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);R.activeTexture.set(L.TEXTURE0);var oe=d.fbo;if(!oe){var we=new o.Texture(R,{width:X,height:X,data:null},L.RGBA);we.bind(L.LINEAR,L.CLAMP_TO_EDGE),(oe=d.fbo=R.createFramebuffer(X,X,!0)).colorAttachment.set(we.texture)}R.bindFramebuffer.set(oe.framebuffer),R.viewport.set([0,0,X,X]),l.useProgram("hillshadePrepare").draw(R,L.TRIANGLES,m,T,P,be.disabled,function(Fe,ge){var Re=ge.stride,He=o.create();return o.ortho(He,0,o.EXTENT,-o.EXTENT,0,0,1),o.translate(He,He,[0,-o.EXTENT,0]),{u_matrix:He,u_image:1,u_dimension:[Re,Re],u_zoom:Fe.overscaledZ,u_unpack:ge.getUnpackVector()}}(d.tileID,z),h.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),d.needsHillshadePrepare=!1}}function Bl(l,d,h,m,T){var P=m.paint.get("raster-fade-duration");if(P>0){var R=o.browser.now(),L=(R-l.timeAdded)/P,z=d?(R-d.timeAdded)/P:-1,X=h.getSource(),ee=T.coveringZoomLevel({tileSize:X.tileSize,roundZoom:X.roundZoom}),Z=!d||Math.abs(d.tileID.overscaledZ-ee)>Math.abs(l.tileID.overscaledZ-ee),te=Z&&l.refreshedUponExpiration?1:o.clamp(Z?L:1-z,0,1);return l.refreshedUponExpiration&&L>=1&&(l.refreshedUponExpiration=!1),d?{opacity:1,mix:1-te}:{opacity:te,mix:0}}return{opacity:1,mix:0}}var mu=new o.Color(1,0,0,1),Nc=new o.Color(0,1,0,1),rc=new o.Color(0,0,1,1),_u=new o.Color(1,0,1,1),nc=new o.Color(0,1,1,1);function bf(l,d,h,m){Sl(l,0,d+h/2,l.transform.width,h,m)}function xf(l,d,h,m){Sl(l,d-h/2,0,h,l.transform.height,m)}function Sl(l,d,h,m,T,P){var R=l.context,L=R.gl;
2598L.enable(L.SCISSOR_TEST),L.scissor(d*o.browser.devicePixelRatio,h*o.browser.devicePixelRatio,m*o.browser.devicePixelRatio,T*o.browser.devicePixelRatio),R.clear({color:P}),L.disable(L.SCISSOR_TEST)}function Gh(l,d,h){var m=l.context,T=m.gl,P=h.posMatrix,R=l.useProgram("debug"),L=ve.disabled,z=Oe.disabled,X=l.colorModeForRenderPass();m.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),R.draw(m,T.LINE_STRIP,L,z,X,be.disabled,Yo(P,o.Color.red),"$debug",l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments);var ee=d.getTileByID(h.key).latestRawTileData,Z=Math.floor((ee&&ee.byteLength||0)/1024),te=d.getTile(h).tileSize,oe=512/Math.min(te,512)*(h.overscaledZ/l.transform.zoom)*.5,we=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(we+=" => "+h.overscaledZ),function(Fe,ge){Fe.initDebugOverlayCanvas();var Re=Fe.debugOverlayCanvas,He=Fe.context.gl,We=Fe.debugOverlayCanvas.getContext("2d");We.clearRect(0,0,Re.width,Re.height),We.shadowColor="white",We.shadowBlur=2,We.lineWidth=1.5,We.strokeStyle="white",We.textBaseline="top",We.font="bold 36px Open Sans, sans-serif",We.fillText(ge,5,5),We.strokeText(ge,5,5),Fe.debugOverlayTexture.update(Re),Fe.debugOverlayTexture.bind(He.LINEAR,He.CLAMP_TO_EDGE)}(l,we+" "+Z+"kb"),R.draw(m,T.TRIANGLES,L,z,he.alphaBlended,be.disabled,Yo(P,o.Color.transparent,oe),"$debug",l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments)}var ic={symbol:function(l,d,h,m,T){if(l.renderPass==="translucent"){var P=Oe.disabled,R=l.colorModeForRenderPass();h.layout.get("text-variable-anchor")&&function(L,z,X,ee,Z,te,oe){for(var we=z.transform,Fe=Z==="map",ge=te==="map",Re=0,He=L;Re<He.length;Re+=1){var We=He[Re],nt=ee.getTile(We),Xe=nt.getBucket(X);if(Xe&&Xe.text&&Xe.text.segments.get().length){var Qe=o.evaluateSizeForZoom(Xe.textSizeData,we.zoom),pt=Rn(nt,1,z.transform.zoom),Dt=pr(We.posMatrix,ge,Fe,z.transform,pt),Ct=X.layout.get("icon-text-fit")!=="none"&&Xe.hasIconData();if(Qe){var zt=Math.pow(2,we.zoom-nt.tileID.overscaledZ);Oc(Xe,Fe,ge,oe,o.symbolSize,we,Dt,We.posMatrix,zt,Qe,Ct)}}}}(m,l,h,d,h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),T),h.paint.get("icon-opacity").constantOr(1)!==0&&tc(l,d,h,m,!1,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),h.layout.get("icon-rotation-alignment"),h.layout.get("icon-pitch-alignment"),h.layout.get("icon-keep-upright"),P,R),h.paint.get("text-opacity").constantOr(1)!==0&&tc(l,d,h,m,!0,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),h.layout.get("text-keep-upright"),P,R),d.map.showCollisionBoxes&&(Qa(l,d,h,m,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),!0),Qa(l,d,h,m,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),!1))}},circle:function(l,d,h,m){if(l.renderPass==="translucent"){var T=h.paint.get("circle-opacity"),P=h.paint.get("circle-stroke-width"),R=h.paint.get("circle-stroke-opacity"),L=h.layout.get("circle-sort-key").constantOr(1)!==void 0;if(T.constantOr(1)!==0||P.constantOr(1)!==0&&R.constantOr(1)!==0){for(var z=l.context,X=z.gl,ee=l.depthModeForSublayer(0,ve.ReadOnly),Z=Oe.disabled,te=l.colorModeForRenderPass(),oe=[],we=0;we<m.length;we++){var Fe=m[we],ge=d.getTile(Fe),Re=ge.getBucket(h);if(Re){var He=Re.programConfigurations.get(h.id),We={programConfiguration:He,program:l.useProgram("circle",He),layoutVertexBuffer:Re.layoutVertexBuffer,indexBuffer:Re.indexBuffer,uniformValues:hu(l,Fe,ge,h)};if(L)for(var nt=0,Xe=Re.segments.get();nt<Xe.length;nt+=1){var Qe=Xe[nt];oe.push({segments:new o.SegmentVector([Qe]),sortKey:Qe.sortKey,state:We})}else oe.push({segments:Re.segments,sortKey:0,state:We})}}L&&oe.sort(function(sr,Er){return sr.sortKey-Er.sortKey});for(var pt=0,Dt=oe;pt<Dt.length;pt+=1){var Ct=Dt[pt],zt=Ct.state;zt.program.draw(z,X.TRIANGLES,ee,Z,te,be.disabled,zt.uniformValues,h.id,zt.layoutVertexBuffer,zt.indexBuffer,Ct.segments,h.paint,l.transform.zoom,zt.programConfiguration)}}}},heatmap:function(l,d,h,m){if(h.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){var T=l.context,P=T.gl,R=Oe.disabled,L=new he([P.ONE,P.ONE],o.Color.transparent,[!0,!0,!0,!0]);(function(oe,we,Fe){var ge=oe.gl;oe.activeTexture.set(ge.TEXTURE1),oe.viewport.set([0,0,we.width/4,we.height/4]);var Re=Fe.heatmapFbo;if(Re)ge.bindTexture(ge.TEXTURE_2D,Re.colorAttachment.get()),oe.bindFramebuffer.set(Re.framebuffer);else{var He=ge.createTexture();ge.bindTexture(ge.TEXTURE_2D,He),ge.texParameteri(ge.TEXTURE_2D,ge.TEXTURE_WRAP_S,ge.CLAMP_TO_EDGE),ge.texParameteri(ge.TEXTURE_2D,ge.TEXTURE_WRAP_T,ge.CLAMP_TO_EDGE),ge.texParameteri(ge.TEXTURE_2D,ge.TEXTURE_MIN_FILTER,ge.LINEAR),ge.texParameteri(ge.TEXTURE_2D,ge.TEXTURE_MAG_FILTER,ge.LINEAR),Re=Fe.heatmapFbo=oe.createFramebuffer(we.width/4,we.height/4,!1),function(We,nt,Xe,Qe){var pt=We.gl;pt.texImage2D(pt.TEXTURE_2D,0,pt.RGBA,nt.width/4,nt.height/4,0,pt.RGBA,We.extRenderToTextureHalfFloat?We.extTextureHalfFloat.HALF_FLOAT_OES:pt.UNSIGNED_BYTE,null),Qe.colorAttachment.set(Xe)}(oe,we,He,Re)}})(T,l,h),T.clear({color:o.Color.transparent});for(var z=0;z<m.length;z++){var X=m[z];if(!d.hasRenderableParent(X)){var ee=d.getTile(X),Z=ee.getBucket(h);if(Z){var te=Z.programConfigurations.get(h.id);l.useProgram("heatmap",te).draw(T,P.TRIANGLES,ve.disabled,R,L,be.disabled,Tl(X.posMatrix,ee,l.transform.zoom,h.paint.get("heatmap-intensity")),h.id,Z.layoutVertexBuffer,Z.indexBuffer,Z.segments,h.paint,l.transform.zoom,te)}}}T.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(oe,we){var Fe=oe.context,ge=Fe.gl,Re=we.heatmapFbo;if(Re){Fe.activeTexture.set(ge.TEXTURE0),ge.bindTexture(ge.TEXTURE_2D,Re.colorAttachment.get()),Fe.activeTexture.set(ge.TEXTURE1);var He=we.colorRampTexture;He||(He=we.colorRampTexture=new o.Texture(Fe,we.colorRamp,ge.RGBA)),He.bind(ge.LINEAR,ge.CLAMP_TO_EDGE),oe.useProgram("heatmapTexture").draw(Fe,ge.TRIANGLES,ve.disabled,Oe.disabled,oe.colorModeForRenderPass(),be.disabled,function(We,nt,Xe,Qe){var pt=o.create();o.ortho(pt,0,We.width,We.height,0,0,1);var Dt=We.context.gl;return{u_matrix:pt,u_world:[Dt.drawingBufferWidth,Dt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:nt.paint.get("heatmap-opacity")}}(oe,we),we.id,oe.viewportBuffer,oe.quadTriangleIndexBuffer,oe.viewportSegments,we.paint,oe.transform.zoom)}}(l,h))},line:function(l,d,h,m){if(l.renderPass==="translucent"){var T=h.paint.get("line-opacity"),P=h.paint.get("line-width");if(T.constantOr(1)!==0&&P.constantOr(1)!==0)for(var R=l.depthModeForSublayer(0,ve.ReadOnly),L=l.colorModeForRenderPass(),z=h.paint.get("line-dasharray"),X=h.paint.get("line-pattern"),ee=X.constantOr(1),Z=h.paint.get("line-gradient"),te=h.getCrossfadeParameters(),oe=ee?"linePattern":z?"lineSDF":Z?"lineGradient":"line",we=l.context,Fe=we.gl,ge=!0,Re=0,He=m;Re<He.length;Re+=1){var We=He[Re],nt=d.getTile(We);if(!ee||nt.patternsLoaded()){var Xe=nt.getBucket(h);if(Xe){var Qe=Xe.programConfigurations.get(h.id),pt=l.context.program.get(),Dt=l.useProgram(oe,Qe),Ct=ge||Dt.program!==pt,zt=X.constantOr(null);if(zt&&nt.imageAtlas){var sr=nt.imageAtlas,Er=sr.patternPositions[zt.to.toString()],Mr=sr.patternPositions[zt.from.toString()];Er&&Mr&&Qe.setConstantPatternPositions(Er,Mr)}var xn=ee?du(l,nt,h,te):z?tA(l,nt,h,z,te):Z?On(l,nt,h,Xe.lineClipsArray.length):Fn(l,nt,h);if(ee)we.activeTexture.set(Fe.TEXTURE0),nt.imageAtlasTexture.bind(Fe.LINEAR,Fe.CLAMP_TO_EDGE),Qe.updatePaintBuffers(te);else if(z&&(Ct||l.lineAtlas.dirty))we.activeTexture.set(Fe.TEXTURE0),l.lineAtlas.bind(we);else if(Z){var ar=Xe.gradients[h.id],$r=ar.texture;if(h.gradientVersion!==ar.version){var rn=256;if(h.stepInterpolant){var jr=d.getSource().maxzoom,Gr=We.canonical.z===jr?Math.ceil(1<<l.transform.maxZoom-We.canonical.z):1;rn=o.clamp(o.nextPowerOfTwo(Xe.maxLineLength/o.EXTENT*1024*Gr),256,we.maxTextureSize)}ar.gradient=o.renderColorRamp({expression:h.gradientExpression(),evaluationKey:"lineProgress",resolution:rn,image:ar.gradient||void 0,clips:Xe.lineClipsArray}),ar.texture?ar.texture.update(ar.gradient):ar.texture=new o.Texture(we,ar.gradient,Fe.RGBA),ar.version=h.gradientVersion,$r=ar.texture}we.activeTexture.set(Fe.TEXTURE0),$r.bind(h.stepInterpolant?Fe.NEAREST:Fe.LINEAR,Fe.CLAMP_TO_EDGE)}Dt.draw(we,Fe.TRIANGLES,R,l.stencilModeForClipping(We),L,be.disabled,xn,h.id,Xe.layoutVertexBuffer,Xe.indexBuffer,Xe.segments,h.paint,l.transform.zoom,Qe,Xe.layoutVertexBuffer2),ge=!1}}}}},fill:function(l,d,h,m){var T=h.paint.get("fill-color"),P=h.paint.get("fill-opacity");if(P.constantOr(1)!==0){var R=l.colorModeForRenderPass(),L=h.paint.get("fill-pattern"),z=l.opaquePassEnabledForLayer()&&!L.constantOr(1)&&T.constantOr(o.Color.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===z){var X=l.depthModeForSublayer(1,l.renderPass==="opaque"?ve.ReadWrite:ve.ReadOnly);Au(l,d,h,m,X,R,!1)}if(l.renderPass==="translucent"&&h.paint.get("fill-antialias")){var ee=l.depthModeForSublayer(h.getPaintProperty("fill-outline-color")?2:0,ve.ReadOnly);Au(l,d,h,m,ee,R,!0)}}},"fill-extrusion":function(l,d,h,m){var T=h.paint.get("fill-extrusion-opacity");if(T!==0&&l.renderPass==="translucent"){var P=new ve(l.context.gl.LEQUAL,ve.ReadWrite,l.depthRangeFor3D);if(T!==1||h.paint.get("fill-extrusion-pattern").constantOr(1))El(l,d,h,m,P,Oe.disabled,he.disabled),El(l,d,h,m,P,l.stencilModeFor3D(),l.colorModeForRenderPass());else{var R=l.colorModeForRenderPass();El(l,d,h,m,P,Oe.disabled,R)}}},hillshade:function(l,d,h,m){if(l.renderPass==="offscreen"||l.renderPass==="translucent"){for(var T=l.context,P=l.depthModeForSublayer(0,ve.ReadOnly),R=l.colorModeForRenderPass(),L=l.renderPass==="translucent"?l.stencilConfigForOverlap(m):[{},m],z=L[0],X=0,ee=L[1];X<ee.length;X+=1){var Z=ee[X],te=d.getTile(Z);te.needsHillshadePrepare&&l.renderPass==="offscreen"?nA(l,te,h,P,Oe.disabled,R):l.renderPass==="translucent"&&gu(l,te,h,P,z[Z.overscaledZ],R)}T.viewport.set([0,0,l.width,l.height])}},raster:function(l,d,h,m){if(l.renderPass==="translucent"&&h.paint.get("raster-opacity")!==0&&m.length)for(var T=l.context,P=T.gl,R=d.getSource(),L=l.useProgram("raster"),z=l.colorModeForRenderPass(),X=R instanceof ut?[{},m]:l.stencilConfigForOverlap(m),ee=X[0],Z=X[1],te=Z[Z.length-1].overscaledZ,oe=!l.options.moving,we=0,Fe=Z;we<Fe.length;we+=1){var ge=Fe[we],Re=l.depthModeForSublayer(ge.overscaledZ-te,h.paint.get("raster-opacity")===1?ve.ReadWrite:ve.ReadOnly,P.LESS),He=d.getTile(ge),We=l.transform.calculatePosMatrix(ge.toUnwrapped(),oe);He.registerFadeDuration(h.paint.get("raster-fade-duration"));var nt=d.findLoadedParent(ge,0),Xe=Bl(He,nt,d,h,l.transform),Qe=void 0,pt=void 0,Dt=h.paint.get("raster-resampling")==="nearest"?P.NEAREST:P.LINEAR;T.activeTexture.set(P.TEXTURE0),He.texture.bind(Dt,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),T.activeTexture.set(P.TEXTURE1),nt?(nt.texture.bind(Dt,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),Qe=Math.pow(2,nt.tileID.overscaledZ-He.tileID.overscaledZ
vendor: 48,270 bytes, line 2598
2598),pt=[He.tileID.canonical.x*Qe%1,He.tileID.canonical.y*Qe%1]):He.texture.bind(Dt,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST);var Ct=rA(We,pt||[0,0],Qe||1,Xe,h);R instanceof ut?L.draw(T,P.TRIANGLES,Re,Oe.disabled,z,be.disabled,Ct,h.id,R.boundsBuffer,l.quadTriangleIndexBuffer,R.boundsSegments):L.draw(T,P.TRIANGLES,Re,ee[ge.overscaledZ],z,be.disabled,Ct,h.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,d,h){var m=h.paint.get("background-color"),T=h.paint.get("background-opacity");if(T!==0){var P=l.context,R=P.gl,L=l.transform,z=L.tileSize,X=h.paint.get("background-pattern");if(!l.isPatternMissing(X)){var ee=!X&&m.a===1&&T===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass===ee){var Z=Oe.disabled,te=l.depthModeForSublayer(0,ee==="opaque"?ve.ReadWrite:ve.ReadOnly),oe=l.colorModeForRenderPass(),we=l.useProgram(X?"backgroundPattern":"background"),Fe=L.coveringTiles({tileSize:z});X&&(P.activeTexture.set(R.TEXTURE0),l.imageManager.bind(l.context));for(var ge=h.getCrossfadeParameters(),Re=0,He=Fe;Re<He.length;Re+=1){var We=He[Re],nt=l.transform.calculatePosMatrix(We.toUnwrapped()),Xe=X?Dc(nt,T,l,X,{tileID:We,tileSize:z},ge):Za(nt,T,m);we.draw(P,R.TRIANGLES,te,Z,oe,be.disabled,Xe,h.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}}}}},debug:function(l,d,h){for(var m=0;m<h.length;m++)Gh(l,d,h[m])},custom:function(l,d,h){var m=l.context,T=h.implementation;if(l.renderPass==="offscreen"){var P=T.prerender;P&&(l.setCustomLayerDefaults(),m.setColorMode(l.colorModeForRenderPass()),P.call(T,m.gl,l.transform.customLayerMatrix()),m.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),m.setColorMode(l.colorModeForRenderPass()),m.setStencilMode(Oe.disabled);var R=T.renderingMode==="3d"?new ve(l.context.gl.LEQUAL,ve.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,ve.ReadOnly);m.setDepthMode(R),T.render(m.gl,l.transform.customLayerMatrix()),m.setDirty(),l.setBaseState(),m.bindFramebuffer.set(null)}}},Wn=function(l,d){this.context=new ae(l),this.transform=d,this._tileTextures={},this.setup(),this.numSublayers=Be.maxUnderzooming+Be.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ba,this.gpuTimers={}};Wn.prototype.resize=function(l,d){if(this.width=l*o.browser.devicePixelRatio,this.height=d*o.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var h=0,m=this.style._order;h<m.length;h+=1)this.style._layers[m[h]].resize()},Wn.prototype.setup=function(){var l=this.context,d=new o.StructArrayLayout2i4;d.emplaceBack(0,0),d.emplaceBack(o.EXTENT,0),d.emplaceBack(0,o.EXTENT),d.emplaceBack(o.EXTENT,o.EXTENT),this.tileExtentBuffer=l.createVertexBuffer(d,hi.members),this.tileExtentSegments=o.SegmentVector.simpleSegment(0,0,4,2);var h=new o.StructArrayLayout2i4;h.emplaceBack(0,0),h.emplaceBack(o.EXTENT,0),h.emplaceBack(0,o.EXTENT),h.emplaceBack(o.EXTENT,o.EXTENT),this.debugBuffer=l.createVertexBuffer(h,hi.members),this.debugSegments=o.SegmentVector.simpleSegment(0,0,4,5);var m=new o.StructArrayLayout4i8;m.emplaceBack(0,0,0,0),m.emplaceBack(o.EXTENT,0,o.EXTENT,0),m.emplaceBack(0,o.EXTENT,0,o.EXTENT),m.emplaceBack(o.EXTENT,o.EXTENT,o.EXTENT,o.EXTENT),this.rasterBoundsBuffer=l.createVertexBuffer(m,rt.members),this.rasterBoundsSegments=o.SegmentVector.simpleSegment(0,0,4,2);var T=new o.StructArrayLayout2i4;T.emplaceBack(0,0),T.emplaceBack(1,0),T.emplaceBack(0,1),T.emplaceBack(1,1),this.viewportBuffer=l.createVertexBuffer(T,hi.members),this.viewportSegments=o.SegmentVector.simpleSegment(0,0,4,2);var P=new o.StructArrayLayout1ui2;P.emplaceBack(0),P.emplaceBack(1),P.emplaceBack(3),P.emplaceBack(2),P.emplaceBack(0),this.tileBorderIndexBuffer=l.createIndexBuffer(P);var R=new o.StructArrayLayout3ui6;R.emplaceBack(0,1,2),R.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=l.createIndexBuffer(R),this.emptyTexture=new o.Texture(l,{width:1,height:1,data:new Uint8Array([0,0,0,0])},l.gl.RGBA);var L=this.context.gl;this.stencilClearMode=new Oe({func:L.ALWAYS,mask:0},0,255,L.ZERO,L.ZERO,L.ZERO)},Wn.prototype.clearStencil=function(){var l=this.context,d=l.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var h=o.create();o.ortho(h,0,this.width,this.height,0,0,1),o.scale(h,h,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(l,d.TRIANGLES,ve.disabled,this.stencilClearMode,he.disabled,be.disabled,Zo(h),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},Wn.prototype._renderTileClippingMasks=function(l,d){if(this.currentStencilSource!==l.source&&l.isTileClipped()&&d&&d.length){this.currentStencilSource=l.source;var h=this.context,m=h.gl;this.nextStencilID+d.length>256&&this.clearStencil(),h.setColorMode(he.disabled),h.setDepthMode(ve.disabled);var T=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var P=0,R=d;P<R.length;P+=1){var L=R[P],z=this._tileClippingMaskIDs[L.key]=this.nextStencilID++;T.draw(h,m.TRIANGLES,ve.disabled,new Oe({func:m.ALWAYS,mask:0},z,255,m.KEEP,m.KEEP,m.REPLACE),he.disabled,be.disabled,Zo(L.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},Wn.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var l=this.nextStencilID++,d=this.context.gl;return new Oe({func:d.NOTEQUAL,mask:255},l,255,d.KEEP,d.KEEP,d.REPLACE)},Wn.prototype.stencilModeForClipping=function(l){var d=this.context.gl;return new Oe({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[l.key],0,d.KEEP,d.KEEP,d.REPLACE)},Wn.prototype.stencilConfigForOverlap=function(l){var d,h=this.context.gl,m=l.sort(function(z,X){return X.overscaledZ-z.overscaledZ}),T=m[m.length-1].overscaledZ,P=m[0].overscaledZ-T+1;if(P>1){this.currentStencilSource=void 0,this.nextStencilID+P>256&&this.clearStencil();for(var R={},L=0;L<P;L++)R[L+T]=new Oe({func:h.GEQUAL,mask:255},L+this.nextStencilID,255,h.KEEP,h.KEEP,h.REPLACE);return this.nextStencilID+=P,[R,m]}return[(d={},d[T]=Oe.disabled,d),m]},Wn.prototype.colorModeForRenderPass=function(){var l=this.context.gl;return this._showOverdrawInspector?new he([l.CONSTANT_COLOR,l.ONE],new o.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?he.unblended:he.alphaBlended},Wn.prototype.depthModeForSublayer=function(l,d,h){if(!this.opaquePassEnabledForLayer())return ve.disabled;var m=1-((1+this.currentLayer)*this.numSublayers+l)*this.depthEpsilon;return new ve(h||this.context.gl.LEQUAL,d,[m,m])},Wn.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},Wn.prototype.render=function(l,d){var h=this;this.style=l,this.options=d,this.lineAtlas=l.lineAtlas,this.imageManager=l.imageManager,this.glyphManager=l.glyphManager,this.symbolFadeChange=l.placement.symbolFadeChange(o.browser.now()),this.imageManager.beginFrame();var m=this.style._order,T=this.style.sourceCaches;for(var P in T){var R=T[P];R.used&&R.prepare(this.context)}var L,z,X={},ee={},Z={};for(var te in T){var oe=T[te];X[te]=oe.getVisibleCoordinates(),ee[te]=X[te].slice().reverse(),Z[te]=oe.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var we=0;we<m.length;we++)if(this.style._layers[m[we]].is3D()){this.opaquePassCutoff=we;break}this.renderPass="offscreen";for(var Fe=0,ge=m;Fe<ge.length;Fe+=1){var Re=this.style._layers[ge[Fe]];if(Re.hasOffscreenPass()&&!Re.isHidden(this.transform.zoom)){var He=ee[Re.source];(Re.type==="custom"||He.length)&&this.renderLayer(this,T[Re.source],Re,He)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?o.Color.black:o.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(l._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){var We=this.style._layers[m[this.currentLayer]],nt=T[We.source],Xe=X[We.source];this._renderTileClippingMasks(We,Xe),this.renderLayer(this,nt,We,Xe)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){var Qe=this.style._layers[m[this.currentLayer]],pt=T[Qe.source],Dt=(Qe.type==="symbol"?Z:ee)[Qe.source];this._renderTileClippingMasks(Qe,X[Qe.source]),this.renderLayer(this,pt,Qe,Dt)}this.options.showTileBoundaries&&(o.values(this.style._layers).forEach(function(Ct){Ct.source&&!Ct.isHidden(h.transform.zoom)&&(Ct.source!==(z&&z.id)&&(z=h.style.sourceCaches[Ct.source]),(!L||L.getSource().maxzoom<z.getSource().maxzoom)&&(L=z))}),L&&ic.debug(this,L,L.getVisibleCoordinates())),this.options.showPadding&&function(Ct){var zt=Ct.transform.padding;bf(Ct,Ct.transform.height-(zt.top||0),3,mu),bf(Ct,zt.bottom||0,3,Nc),xf(Ct,zt.left||0,3,rc),xf(Ct,Ct.transform.width-(zt.right||0),3,_u);var sr=Ct.transform.centerPoint;(function(Er,Mr,xn,ar){Sl(Er,Mr-1,xn-10,2,20,ar),Sl(Er,Mr-10,xn-1,20,2,ar)})(Ct,sr.x,Ct.transform.height-sr.y,nc)}(this),this.context.setDefault()},Wn.prototype.renderLayer=function(l,d,h,m){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="custom"||m.length)&&(this.id=h.id,this.gpuTimingStart(h),ic[h.type](l,d,h,m,this.style.placement.variableOffsets),this.gpuTimingEnd())},Wn.prototype.gpuTimingStart=function(l){if(this.options.gpuTiming){var d=this.context.extTimerQuery,h=this.gpuTimers[l.id];h||(h=this.gpuTimers[l.id]={calls:0,cpuTime:0,query:d.createQueryEXT()}),h.calls++,d.beginQueryEXT(d.TIME_ELAPSED_EXT,h.query)}},Wn.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var l=this.context.extTimerQuery;l.endQueryEXT(l.TIME_ELAPSED_EXT)}},Wn.prototype.collectGpuTimers=function(){var l=this.gpuTimers;return this.gpuTimers={},l},Wn.prototype.queryGpuTimers=function(l){var d={};for(var h in l){var m=l[h],T=this.context.extTimerQuery,P=T.getQueryObjectEXT(m.query,T.QUERY_RESULT_EXT)/1e6;T.deleteQueryEXT(m.query),d[h]=P}return d},Wn.prototype.translatePosMatrix=function(l,d,h,m,T){if(!h[0]&&!h[1])return l;var P=T?m==="map"?this.transform.angle:0:m==="viewport"?-this.transform.angle:0;if(P){var R=Math.sin(P),L=Math.cos(P);h=[h[0]*L-h[1]*R,h[0]*R+h[1]*L]}var z=[T?h[0]:Rn(d,h[0],this.transform.zoom),T?h[1]:Rn(d,h[1],this.transform.zoom),0],X=new Float32Array(16);return o.translate(X,l,z),X},Wn.prototype.saveTileTexture=function(l){var d=this._tileTextures[l.size[0]];d?d.push(l):this._tileTextures[l.size[0]]=[l]},Wn.prototype.getTileTexture=function(l){var d=this._tileTextures[l];return d&&d.length>0?d.pop():null},Wn.prototype.isPatternMissing=function(l){if(!l)return!1;if(!l.from||!l.to)return!0;var d=this.imageManager.getPattern(l.from.toString()),h=this.imageManager.getPattern(l.to.toString());return!d||!h},Wn.prototype.useProgram=function(l,d){this.cache=this.cache||{};var h=""+l+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[h]||(this.cache[h]=new Lh(this.context,l,lu[l],d,zs[l],this._showOverdrawInspector)),this.cache[h]},Wn.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()},Wn.prototype.setBaseState=function(){var l=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(l.FUNC_ADD)},Wn.prototype.initDebugOverlayCanvas=function(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=o.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new o.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},Wn.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var yu=function(l,d){this.points=l,this.planes=d};yu.fromInvProjectionMatrix=function(l,d,h){var m=Math.pow(2,h),T=[[-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(R){return o.transformMat4([],R,l)}).map(function(R){return o.scale$1([],R,1/R[3]/d*m)}),P=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(function(R){var L=o.sub([],T[R[0]],T[R[1]]),z=o.sub([],T[R[2]],T[R[1]]),X=o.normalize([],o.cross([],L,z)),ee=-o.dot(X,T[R[1]]);return X.concat(ee)});return new yu(T,P)};var Qo=function(l,d){this.min=l,this.max=d,this.center=o.scale$2([],o.add([],this.min,this.max),.5)};Qo.prototype.quadrant=function(l){for(var d=[l%2==0,l<2],h=o.clone$2(this.min),m=o.clone$2(this.max),T=0;T<d.length;T++)h[T]=d[T]?this.min[T]:this.center[T],m[T]=d[T]?this.center[T]:this.max[T];return m[2]=this.max[2],new Qo(h,m)},Qo.prototype.distanceX=function(l){return Math.max(Math.min(this.max[0],l[0]),this.min[0])-l[0]},Qo.prototype.distanceY=function(l){return Math.max(Math.min(this.max[1],l[1]),this.min[1])-l[1]},Qo.prototype.intersects=function(l){for(var d=[[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]],h=!0,m=0;m<l.planes.length;m++){for(var T=l.planes[m],P=0,R=0;R<d.length;R++)P+=o.dot$1(T,d[R])>=0;if(P===0)return 0;P!==d.length&&(h=!1)}if(h)return 2;for(var L=0;L<3;L++){for(var z=Number.MAX_VALUE,X=-Number.MAX_VALUE,ee=0;ee<l.points.length;ee++){var Z=l.points[ee][L]-this.min[L];z=Math.min(z,Z),X=Math.max(X,Z)}if(X<0||z>this.max[L]-this.min[L])return 0}return 1};var ea=function(l,d,h,m){if(l===void 0&&(l=0),d===void 0&&(d=0),h===void 0&&(h=0),m===void 0&&(m=0),isNaN(l)||l<0||isNaN(d)||d<0||isNaN(h)||h<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=l,this.bottom=d,this.left=h,this.right=m};ea.prototype.interpolate=function(l,d,h){return d.top!=null&&l.top!=null&&(this.top=o.number(l.top,d.top,h)),d.bottom!=null&&l.bottom!=null&&(this.bottom=o.number(l.bottom,d.bottom,h)),d.left!=null&&l.left!=null&&(this.left=o.number(l.left,d.left,h)),d.right!=null&&l.right!=null&&(this.right=o.number(l.right,d.right,h)),this},ea.prototype.getCenter=function(l,d){var h=o.clamp((this.left+l-this.right)/2,0,l),m=o.clamp((this.top+d-this.bottom)/2,0,d);return new o.Point(h,m)},ea.prototype.equals=function(l){return this.top===l.top&&this.bottom===l.bottom&&this.left===l.left&&this.right===l.right},ea.prototype.clone=function(){return new ea(this.top,this.bottom,this.left,this.right)},ea.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var fn=function(l,d,h,m,T){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=T===void 0||T,this._minZoom=l||0,this._maxZoom=d||22,this._minPitch=h??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new o.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ea,this._posMatrixCache={},this._alignedPosMatrixCache={}},Ln={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}};fn.prototype.clone=function(){var l=new fn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return l.tileSize=this.tileSize,l.latRange=this.latRange,l.width=this.width,l.height=this.height,l._center=this._center,l.zoom=this.zoom,l.angle=this.angle,l._fov=this._fov,l._pitch=this._pitch,l._unmodified=this._unmodified,l._edgeInsets=this._edgeInsets.clone(),l._calcMatrices(),l},Ln.minZoom.get=function(){return this._minZoom},Ln.minZoom.set=function(l){this._minZoom!==l&&(this._minZoom=l,this.zoom=Math.max(this.zoom,l))},Ln.maxZoom.get=function(){return this._maxZoom},Ln.maxZoom.set=function(l){this._maxZoom!==l&&(this._maxZoom=l,this.zoom=Math.min(this.zoom,l))},Ln.minPitch.get=function(){return this._minPitch},Ln.minPitch.set=function(l){this._minPitch!==l&&(this._minPitch=l,this.pitch=Math.max(this.pitch,l))},Ln.maxPitch.get=function(){return this._maxPitch},Ln.maxPitch.set=function(l){this._maxPitch!==l&&(this._maxPitch=l,this.pitch=Math.min(this.pitch,l))},Ln.renderWorldCopies.get=function(){return this._renderWorldCopies},Ln.renderWorldCopies.set=function(l){l===void 0?l=!0:l===null&&(l=!1),this._renderWorldCopies=l},Ln.worldSize.get=function(){return this.tileSize*this.scale},Ln.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Ln.size.get=function(){return new o.Point(this.width,this.height)},Ln.bearing.get=function(){return-this.angle/Math.PI*180},Ln.bearing.set=function(l){var d=-o.wrap(l,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=o.create$2(),o.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Ln.pitch.get=function(){return this._pitch/Math.PI*180},Ln.pitch.set=function(l){var d=o.clamp(l,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())},Ln.fov.get=function(){return this._fov/Math.PI*180},Ln.fov.set=function(l){l=Math.max(.01,Math.min(60,l)),this._fov!==l&&(this._unmodified=!1,this._fov=l/180*Math.PI,this._calcMatrices())},Ln.zoom.get=function(){return this._zoom},Ln.zoom.set=function(l){var d=Math.min(Math.max(l,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.scale=this.zoomScale(d),this.tileZoom=Math.floor(d),this.zoomFraction=d-this.tileZoom,this._constrain(),this._calcMatrices())},Ln.center.get=function(){return this._center},Ln.center.set=function(l){l.lat===this._center.lat&&l.lng===this._center.lng||(this._unmodified=!1,this._center=l,this._constrain(),this._calcMatrices())},Ln.padding.get=function(){return this._edgeInsets.toJSON()},Ln.padding.set=function(l){this._edgeInsets.equals(l)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,l,1),this._calcMatrices())},Ln.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},fn.prototype.isPaddingEqual=function(l){return this._edgeInsets.equals(l)},fn.prototype.interpolatePadding=function(l,d,h){this._unmodified=!1,this._edgeInsets.interpolate(l,d,h),this._constrain(),this._calcMatrices()},fn.prototype.coveringZoomLevel=function(l){var d=(l.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/l.tileSize));return Math.max(0,d)},fn.prototype.getVisibleUnwrappedCoordinates=function(l){var d=[new o.UnwrappedTileID(0,l)];if(this._renderWorldCopies)for(var h=this.pointCoordinate(new o.Point(0,0)),m=this.pointCoordinate(new o.Point(this.width,0)),T=this.pointCoordinate(new o.Point(this.width,this.height)),P=this.pointCoordinate(new o.Point(0,this.height)),R=Math.floor(Math.min(h.x,m.x,T.x,P.x)),L=Math.floor(Math.max(h.x,m.x,T.x,P.x)),z=R-1;z<=L+1;z++)z!==0&&d.push(new o.UnwrappedTileID(z,l));return d},fn.prototype.coveringTiles=function(l){var d=this.coveringZoomLevel(l),h=d;if(l.minzoom!==void 0&&d<l.minzoom)return[];l.maxzoom!==void 0&&d>l.maxzoom&&(d=l.maxzoom);var m=o.MercatorCoordinate.fromLngLat(this.center),T=Math.pow(2,d),P=[T*m.x,T*m.y,0],R=yu.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d),L=l.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(L=d);var z=function(Ct){return{aabb:new Qo([Ct*T,0,0],[(Ct+1)*T,T,0]),zoom:0,x:0,y:0,wrap:Ct,fullyVisible:!1}},X=[],ee=[],Z=d,te=l.reparseOverscaled?h:d;if(this._renderWorldCopies)for(var oe=1;oe<=3;oe++)X.push(z(-oe)),X.push(z(oe));for(X.push(z(0));X.length>0;){var we=X.pop(),Fe=we.x,ge=we.y,Re=we.fullyVisible;if(!Re){var He=we.aabb.intersects(R);if(He===0)continue;Re=He===2}var We=we.aabb.distanceX(P),nt=we.aabb.distanceY(P),Xe=Math.max(Math.abs(We),Math.abs(nt));if(we.zoom===Z||Xe>3+(1<<Z-we.zoom)-2&&we.zoom>=L)ee.push({tileID:new o.OverscaledTileID(we.zoom===Z?te:we.zoom,we.wrap,we.zoom,Fe,ge),distanceSq:o.sqrLen([P[0]-.5-Fe,P[1]-.5-ge])});else for(var Qe=0;Qe<4;Qe++){var pt=(Fe<<1)+Qe%2,Dt=(ge<<1)+(Qe>>1);X.push({aabb:we.aabb.quadrant(Qe),zoom:we.zoom+1,x:pt,y:Dt,wrap:we.wrap,fullyVisible:Re})}}return ee.sort(function(Ct,zt){return Ct.distanceSq-zt.distanceSq}).map(function(Ct){return Ct.tileID})},fn.prototype.resize=function(l,d){this.width=l,this.height=d,this.pixelsToGLUnits=[2/l,-2/d],this._constrain(),this._calcMatrices()},Ln.unmodified.get=function(){return this._unmodified},fn.prototype.zoomScale=function(l){return Math.pow(2,l)},fn.prototype.scaleZoom=function(l){return Math.log(l)/Math.LN2},fn.prototype.project=function(l){var d=o.clamp(l.lat,-this.maxValidLatitude,this.maxValidLatitude);return new o.Point(o.mercatorXfromLng(l.lng)*this.worldSize,o.mercatorYfromLat(d)*this.worldSize)},fn.prototype.unproject=function(l){return new o.MercatorCoordinate(l.x/this.worldSize,l.y/this.worldSize).toLngLat()},Ln.point.get=function(){return this.project(this.center)},fn.prototype.setLocationAtPoint=function(l,d){var h=this.pointCoordinate(d),m=this.pointCoordinate(this.centerPoint),T=this.locationCoordinate(l),P=new o.MercatorCoordinate(T.x-(h.x-m.x),T.y-(h.y-m.y));this.center=this.coordinateLocation(P),this._renderWorldCopies&&(this.center=this.center.wrap())},fn.prototype.locationPoint=function(l){return this.coordinatePoint(this.locationCoordinate(l))},fn.prototype.pointLocation=function(l){return this.coordinateLocation(this.pointCoordinate(l))},fn.prototype.locationCoordinate=function(l){return o.MercatorCoordinate.fromLngLat(l)},fn.prototype.coordinateLocation=function(l){return l.toLngLat()},fn.prototype.pointCoordinate=function(l){var d=[l.x,l.y,0,1],h=[l.x,l.y,1,1];o.transformMat4(d,d,this.pixelMatrixInverse),o.transformMat4(h,h,this.pixelMatrixInverse);var m=d[3],T=h[3],P=d[1]/m,R=h[1]/T,L=d[2]/m,z=h[2]/T,X=L===z?0:(0-L)/(z-L);return new o.MercatorCoordinate(o.number(d[0]/m,h[0]/T,X)/this.worldSize,o.number(P,R,X)/this.worldSize)},fn.prototype.coordinatePoint=function(l){var d=[l.x*this.worldSize,l.y*this.worldSize,0,1];return o.transformMat4(d,d,this.pixelMatrix),new o.Point(d[0]/d[3],d[1]/d[3])},fn.prototype.getBounds=function(){return new o.LngLatBounds().extend(this.pointLocation(new o.Point(0,0))).extend(this.pointLocation(new o.Point(this.width,0))).extend(this.pointLocation(new o.Point(this.width,this.height))).extend(this.pointLocation(new o.Point(0,this.height)))},fn.prototype.getMaxBounds=function(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new o.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},fn.prototype.setMaxBounds=function(l){l?(this.lngRange=[l.getWest(),l.getEast()],this.latRange=[l.getSouth(),l.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},fn.prototype.calculatePosMatrix=function(l,d){d===void 0&&(d=!1);var h=l.key,m=d?this._alignedPosMatrixCache:this._posMatrixCache;if(m[h])return m[h];var T=l.canonical,P=this.worldSize/this.zoomScale(T.z),R=T.x+Math.pow(2,T.z)*l.wrap,L=o.identity(new Float64Array(16));return o.translate(L,L,[R*P,T.y*P,0]),o.scale(L,L,[P/o.EXTENT,P/o.EXTENT,1]),o.multiply(L,d?this.alignedProjMatrix:this.projMatrix,L),m[h]=new Float32Array(L),m[h]},fn.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},fn.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var l,d,h,m,T=-90,P=90,R=-180,L=180,z=this.size,X=this._unmodified;if(this.latRange){var ee=this.latRange;T=o.mercatorYfromLat(ee[1])*this.worldSize,l=(P=o.mercatorYfromLat(ee[0])*this.worldSize)-T<z.y?z.y/(P-T):0}if(this.lngRange){var Z=this.lngRange;R=o.mercatorXfromLng(Z[0])*this.worldSize,d=(L=o.mercatorXfromLng(Z[1])*this.worldSize)-R<z.x?z.x/(L-R):0}var te=this.point,oe=Math.max(d||0,l||0);if(oe)return this.center=this.unproject(new o.Point(d?(L+R)/2:te.x,l?(P+T)/2:te.y)),this.zoom+=this.scaleZoom(oe),this._unmodified=X,void(this._constraining=!1);if(this.latRange){var we=te.y,Fe=z.y/2;we-Fe<T&&(m=T+Fe),we+Fe>P&&(m=P-Fe)}if(this.lngRange){var ge=te.x,Re=z.x/2;ge-Re<R&&(h=R+Re),ge+Re>L&&(h=L-Re)}h===void 0&&m===void 0||(this.center=this.unproject(new o.Point(h!==void 0?h:te.x,m!==void 0?m:te.y))),this._unmodified=X,this._constraining=!1}},fn.prototype._calcMatrices=function(){if(this.height){var l=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var d=Math.PI/2+this._pitch,h=this._fov*(.5+l.y/this.height),m=Math.sin(h)*this.cameraToCenterDistance/Math.sin(o.clamp(Math.PI-d-h,.01,Math.PI-.01)),T=this.point,P=T.x,R=T.y,L=1.01*(Math.cos(Math.PI/2-this._pitch)*m+this.cameraToCenterDistance),z=this.height/50,X=new Float64Array(16);o.perspective(X,this._fov,this.width/this.height,z,L),X[8]=2*-l.x/this.width,X[9]=2*l.y/this.height,o.scale(X,X,[1,-1,1]),o.translate(X,X,[0,0,-this.cameraToCenterDistance]),o.rotateX(X,X,this._pitch),o.rotateZ(X,X,this.angle),o.translate(X,X,[-P,-R,0]),this.mercatorMatrix=o.scale([],X,[this.worldSize,this.worldSize,this.worldSize]),o.scale(X,X,[1,1,o.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=X,this.invProjMatrix=o.invert([],this.projMatrix);var ee=this.width%2/2,Z=this.height%2/2,te=Math.cos(this.angle),oe=Math.sin(this.angle),we=P-Math.round(P)+te*ee+oe*Z,Fe=R-Math.round(R)+te*Z+oe*ee,ge=new Float64Array(X);if(o.translate(ge,ge,[we>.5?we-1:we,Fe>.5?Fe-1:Fe,0]),this.alignedProjMatrix=ge,X=o.create(),o.scale(X,X,[this.width/2,-this.height/2,1]),o.translate(X,X,[1,-1,0]),this.labelPlaneMatrix=X,X=o.create(),o.scale(X,X,[1,-1,1]),o.translate(X,X,[-1,-1,0]),o.scale(X,X,[2/this.width,2/this.height,1]),this.glCoordMatrix=X,this.pixelMatrix=o.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(X=o.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=X,this._posMatrixCache={},this._alignedPosMatrixCache={}}},fn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var l=this.pointCoordinate(new o.Point(0,0)),d=[l.x*this.worldSize,l.y*this.worldSize,0,1];return o.transformMat4(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance},fn.prototype.getCameraPoint=function(){var l=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.Point(0,l))},fn.prototype.getCameraQueryGeometry=function(l){var d=this.getCameraPoint();if(l.length===1)return[l[0],d];for(var h=d.x,m=d.y,T=d.x,P=d.y,R=0,L=l;R<L.length;R+=1){var z=L[R];h=Math.min(h,z.x),m=Math.min(m,z.y),T=Math.max(T,z.x),P=Math.max(P,z.y)}return[new o.Point(h,m),new o.Point(T,m),new o.Point(T,P),new o.Point(h,P),new o.Point(h,m)]},Object.defineProperties(fn.prototype,Ln);var Vs=function(l){var d,h,m,T;this._hashName=l&&encodeURIComponent(l),o.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(d=this._updateHashUnthrottled.bind(this),h=!1,m=null,T=function(){m=null,h&&(d(),m=setTimeout(T,300),h=!1)},function(){return h=!0,m||T(),m})};Vs.prototype.addTo=function(l){return this._map=l,o.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Vs.prototype.remove=function(){return o.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Vs.prototype.getHashString=function(l){var d=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,m=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),T=Math.pow(10,m),P=Math.round(d.lng*T)/T,R=Math.round(d.lat*T)/T,L=this._map.getBearing(),z=this._map.getPitch(),X="";if(X+=l?"/"+P+"/"+R+"/"+h:h+"/"+R+"/"+P,(L||z)&&(X+="/"+Math.round(10*L)/10),z&&(X+="/"+Math.round(z)),this._hashName){var ee=this._hashName,Z=!1,te=o.window.location.hash.slice(1).split("&").map(function(oe){var we=oe.split("=")[0];return we===ee?(Z=!0,we+"="+X):oe}).filter(function(oe){return oe});return Z||te.push(ee+"="+X),"#"+te.join("&")}return"#"+X},Vs.prototype._getCurrentHash=function(){var l,d=this,h=o.window.location.hash.replace("#","");return this._hashName?(h.split("&").map(function(m){return m.split("=")}).forEach(function(m){m[0]===d._hashName&&(l=m)}),(l&&l[1]||"").split("/")):h.split("/")},Vs.prototype._onHashChange=function(){var l=this._getCurrentHash();if(l.length>=3&&!l.some(function(h){return isNaN(h)})){var d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(l[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+l[2],+l[1]],zoom:+l[0],bearing:d,pitch:+(l[4]||0)}),!0}return!1},Vs.prototype._updateHashUnthrottled=function(){var l=o.window.location.href.replace(/(#.+)?$/,this.getHashString());try{o.window.history.replaceState(o.window.history.state,null,l)}catch{}};var Il={linearity:.3,easing:o.bezier(0,0,.3,1)},Uc=o.extend({deceleration:2500,maxSpeed:1400},Il),Ml=o.extend({deceleration:20,maxSpeed:1400},Il),iA=o.extend({deceleration:1e3,maxSpeed:360},Il),sA=o.extend({deceleration:1e3,maxSpeed:90},Il),zc=function(l){this._map=l,this.clear()};function Pl(l,d){(!l.duration||l.duration<d.duration)&&(l.duration=d.duration,l.easing=d.easing)}function Fo(l,d,h){var m=h.maxSpeed,T=h.linearity,P=h.deceleration,R=o.clamp(l*T/(d/1e3),-m,m),L=Math.abs(R)/(P*T);return{easing:h.easing,duration:1e3*L,amount:R*(L/2)}}zc.prototype.clear=function(){this._inertiaBuffer=[]},zc.prototype.record=function(l){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.browser.now(),settings:l})},zc.prototype._drainInertiaBuffer=function(){for(var l=this._inertiaBuffer,d=o.browser.now();l.length>0&&d-l[0].time>160;)l.shift()},zc.prototype._onMoveEnd=function(l){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var d={zoom:0,bearing:0,pitch:0,pan:new o.Point(0,0),pinchAround:void 0,around:void 0},h=0,m=this._inertiaBuffer;h<m.length;h+=1){var T=m[h].settings;d.zoom+=T.zoomDelta||0,d.bearing+=T.bearingDelta||0,d.pitch+=T.pitchDelta||0,T.panDelta&&d.pan._add(T.panDelta),T.around&&(d.around=T.around),T.pinchAround&&(d.pinchAround=T.pinchAround)}var P=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,R={};if(d.pan.mag()){var L=Fo(d.pan.mag(),P,o.extend({},Uc,l||{}));R.offset=d.pan.mult(L.amount/d.pan.mag()),R.center=this._map.transform.center,Pl(R,L)}if(d.zoom){var z=Fo(d.zoom,P,Ml);R.zoom=this._map.transform.zoom+z.amount,Pl(R,z)}if(d.bearing){var X=Fo(d.bearing,P,iA);R.bearing=this._map.transform.bearing+o.clamp(X.amount,-179,179),Pl(R,X)}if(d.pitch){var ee=Fo(d.pitch,P,sA);R.pitch=this._map.transform.pitch+ee.amount,Pl(R,ee)}if(R.zoom||R.bearing){var Z=d.pinchAround===void 0?d.around:d.pinchAround;R.around=Z?this._map.unproject(Z):this._map.getCenter()}return this.clear(),o.extend(R,{noMoveStart:!0})}};var kn=function(l){function d(m,T,P,R){R===void 0&&(R={});var L=f.mousePos(T.getCanvasContainer(),P),z=T.unproject(L);l.call(this,m,o.extend({point:L,lngLat:z,originalEvent:P},R)),this._defaultPrevented=!1,this.target=T}l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d;var h={defaultPrevented:{configurable:!0}};return d.prototype.preventDefault=function(){this._defaultPrevented=!0},h.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(d.prototype,h),d}(o.Event),Gc=function(l){function d(m,T,P){var R=m==="touchend"?P.changedTouches:P.touches,L=f.touchPos(T.getCanvasContainer(),R),z=L.map(function(Z){return T.unproject(Z)}),X=L.reduce(function(Z,te,oe,we){return Z.add(te.div(we.length))},new o.Point(0,0)),ee=T.unproject(X);l.call(this,m,{points:L,point:X,lngLats:z,lngLat:ee,originalEvent:P}),this._defaultPrevented=!1}l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d;var h={defaultPrevented:{configurable:!0}};return d.prototype.preventDefault=function(){this._defaultPrevented=!0},h.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(d.prototype,h),d}(o.Event),Vh=function(l){function d(m,T,P){l.call(this,m,{originalEvent:P}),this._defaultPrevented=!1}l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d;var h={defaultPrevented:{configurable:!0}};return d.prototype.preventDefault=function(){this._defaultPrevented=!0},h.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(d.prototype,h),d}(o.Event),Ci=function(l,d){this._map=l,this._clickTolerance=d.clickTolerance};Ci.prototype.reset=function(){delete this._mousedownPos},Ci.prototype.wheel=function(l){return this._firePreventable(new Vh(l.type,this._map,l))},Ci.prototype.mousedown=function(l,d){return this._mousedownPos=d,this._firePreventable(new kn(l.type,this._map,l))},Ci.prototype.mouseup=function(l){this._map.fire(new kn(l.type,this._map,l))},Ci.prototype.click=function(l,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new kn(l.type,this._map,l))},Ci.prototype.dblclick=function(l){return this._firePreventable(new kn(l.type,this._map,l))},Ci.prototype.mouseover=function(l){this._map.fire(new kn(l.type,this._map,l))},Ci.prototype.mouseout=function(l){this._map.fire(new kn(l.type,this._map,l))},Ci.prototype.touchstart=function(l){return this._firePreventable(new Gc(l.type,this._map,l))},Ci.prototype.touchmove=function(l){this._map.fire(new Gc(l.type,this._map,l))},Ci.prototype.touchend=function(l){this._map.fire(new Gc(l.type,this._map,l))},Ci.prototype.touchcancel=function(l){this._map.fire(new Gc(l.type,this._map,l))},Ci.prototype._firePreventable=function(l){if(this._map.fire(l),l.defaultPrevented)return{}},Ci.prototype.isEnabled=function(){return!0},Ci.prototype.isActive=function(){return!1},Ci.prototype.enable=function(){},Ci.prototype.disable=function(){};var or=function(l){this._map=l};or.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},or.prototype.mousemove=function(l){this._map.fire(new kn(l.type,this._map,l))},or.prototype.mousedown=function(){this._delayContextMenu=!0},or.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new kn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},or.prototype.contextmenu=function(l){this._delayContextMenu?this._contextMenuEvent=l:this._map.fire(new kn(l.type,this._map,l)),this._map.listens("contextmenu")&&l.preventDefault()},or.prototype.isEnabled=function(){return!0},or.prototype.isActive=function(){return!1},or.prototype.enable=function(){},or.prototype.disable=function(){};var Ss=function(l,d){this._map=l,this._el=l.getCanvasContainer(),this._container=l.getContainer(),this._clickTolerance=d.clickTolerance||1};function vu(l,d){for(var h={},m=0;m<l.length;m++)h[l[m].identifier]=d[m];return h}Ss.prototype.isEnabled=function(){return!!this._enabled},Ss.prototype.isActive=function(){return!!this._active},Ss.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Ss.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Ss.prototype.mousedown=function(l,d){this.isEnabled()&&l.shiftKey&&l.button===0&&(f.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)},Ss.prototype.mousemoveWindow=function(l,d){if(this._active){var h=d;if(!(this._lastPos.equals(h)||!this._box&&h.dist(this._startPos)<this._clickTolerance)){var m=this._startPos;this._lastPos=h,this._box||(this._box=f.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",l));var T=Math.min(m.x,h.x),P=Math.max(m.x,h.x),R=Math.min(m.y,h.y),L=Math.max(m.y,h.y);f.setTransform(this._box,"translate("+T+"px,"+R+"px)"),this._box.style.width=P-T+"px",this._box.style.height=L-R+"px"}}},Ss.prototype.mouseupWindow=function(l,d){var h=this;if(this._active&&l.button===0){var m=this._startPos,T=d;if(this.reset(),f.suppressClick(),m.x!==T.x||m.y!==T.y)return this._map.fire(new o.Event("boxzoomend",{originalEvent:l})),{cameraAnimation:function(P){return P.fitScreenCoordinates(m,T,h._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",l)}},Ss.prototype.keydown=function(l){this._active&&l.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",l))},Ss.prototype.blur=function(){this.reset()},Ss.prototype.reset=function(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(f.remove(this._box),this._box=null),f.enableDrag(),delete this._startPos,delete this._lastPos},Ss.prototype._fireEvent=function(l,d){return this._map.fire(new o.Event(l,{originalEvent:d}))};var Hs=function(l){this.reset(),this.numTouches=l.numTouches};Hs.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},Hs.prototype.touchstart=function(l,d,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=l.timeStamp),h.length===this.numTouches&&(this.centroid=function(m){for(var T=new o.Point(0,0),P=0,R=m;P<R.length;P+=1)T._add(R[P]);return T.div(m.length)}(d),this.touches=vu(h,d)))},Hs.prototype.touchmove=function(l,d,h){if(!this.aborted&&this.centroid){var m=vu(h,d);for(var T in this.touches){var P=m[T];(!P||P.dist(this.touches[T])>30)&&(this.aborted=!0)}}},Hs.prototype.touchend=function(l,d,h){if((!this.centroid||l.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){var m=!this.aborted&&this.centroid;if(this.reset(),m)return m}};var ro=function(l){this.singleTap=new Hs(l),this.numTaps=l.numTaps,this.reset()};ro.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},ro.prototype.touchstart=function(l,d,h){this.singleTap.touchstart(l,d,h)},ro.prototype.touchmove=function(l,d,h){this.singleTap.touchmove(l,d,h)},ro.prototype.touchend=function(l,d,h){var m=this.singleTap.touchend(l,d,h);if(m){var T=l.timeStamp-this.lastTime<500,P=!this.lastTap||this.lastTap.dist(m)<30;if(T&&P||this.reset(),this.count++,this.lastTime=l.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}};var _s=function(){this._zoomIn=new ro({numTouches:1,numTaps:2}),this._zoomOut=new ro({numTouches:2,numTaps:1}),this.reset()};_s.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},_s.prototype.touchstart=function(l,d,h){this._zoomIn.touchstart(l,d,h),this._zoomOut.touchstart(l,d,h)},_s.prototype.touchmove=function(l,d,h){this._zoomIn.touchmove(l,d,h),this._zoomOut.touchmove(l,d,h)},_s.prototype.touchend=function(l,d,h){var m=this,T=this._zoomIn.touchend(l,d,h),P=this._zoomOut.touchend(l,d,h);return T?(this._active=!0,l.preventDefault(),setTimeout(function(){return m.reset()},0),{cameraAnimation:function(R){return R.easeTo({duration:300,zoom:R.getZoom()+1,around:R.unproject(T)},{originalEvent:l})}}):P?(this._active=!0,l.preventDefault(),setTimeout(function(){return m.reset()},0),{cameraAnimation:function(R){return R.easeTo({duration:300,zoom:R.getZoom()-1,around:R.unproject(P)},{originalEvent:l})}}):void 0},_s.prototype.touchcancel=function(){this.reset()},_s.prototype.enable=function(){this._enabled=!0},_s.prototype.disable=function(){this._enabled=!1,this.reset()},_s.prototype.isEnabled=function(){return this._enabled},_s.prototype.isActive=function(){return this._active};var wf={0:1,2:2},Yt=function(l){this.reset(),this._clickTolerance=l.clickTolerance||1};Yt.prototype.blur=function(){this.reset()},Yt.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Yt.prototype._correctButton=function(l,d){return!1},Yt.prototype._move=function(l,d){return{}},Yt.prototype.mousedown=function(l,d){if(!this._lastPoint){var h=f.mouseButton(l);this._correctButton(l,h)&&(this._lastPoint=d,this._eventButton=h)}},Yt.prototype.mousemoveWindow=function(l,d){var h=this._lastPoint;if(h){if(l.preventDefault(),function(m,T){var P=wf[T];return m.buttons===void 0||(m.buttons&P)!==P}(l,this._eventButton))this.reset();else if(this._moved||!(d.dist(h)<this._clickTolerance))return this._moved=!0,this._lastPoint=d,this._move(h,d)}},Yt.prototype.mouseupWindow=function(l){this._lastPoint&&f.mouseButton(l)===this._eventButton&&(this._moved&&f.suppressClick(),this.reset())},Yt.prototype.enable=function(){this._enabled=!0},Yt.prototype.disable=function(){this._enabled=!1,this.reset()},Yt.prototype.isEnabled=function(){return this._enabled},Yt.prototype.isActive=function(){return this._active};var Cf=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.mousedown=function(h,m){l.prototype.mousedown.call(this,h,m),this._lastPoint&&(this._active=!0)},d.prototype._correctButton=function(h,m){return m===0&&!h.ctrlKey},d.prototype._move=function(h,m){return{around:m,panDelta:m.sub(h)}},d}(Yt),bu=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype._correctButton=function(h,m){return m===0&&h.ctrlKey||m===2},d.prototype._move=function(h,m){var T=.8*(m.x-h.x);if(T)return this._active=!0,{bearingDelta:T}},d.prototype.contextmenu=function(h){h.preventDefault()},d}(Yt),Tf=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype._correctButton=function(h,m){return m===0&&h.ctrlKey||m===2},d.prototype._move=function(h,m){var T=-.5*(m.y-h.y);if(T)return this._active=!0,{pitchDelta:T}},d.prototype.contextmenu=function(h){h.preventDefault()},d}(Yt),no=function(l){this._minTouches=1,this._clickTolerance=l.clickTolerance||1,this.reset()};no.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new o.Point(0,0)},no.prototype.touchstart=function(l,d,h){return this._calculateTransform(l,d,h)},no.prototype.touchmove=function(l,d,h){if(this._active&&!(h.length<this._minTouches))return l.preventDefault(),this._calculateTransform(l,d,h)},no.prototype.touchend=function(l,d,h){this._calculateTransform(l,d,h),this._active&&h.length<this._minTouches&&this.reset()},no.prototype.touchcancel=function(){this.reset()},no.prototype._calculateTransform=function(l,d,h){h.length>0&&(this._active=!0);var m=vu(h,d),T=new o.Point(0,0),P=new o.Point(0,0),R=0;for(var L in m){var z=m[L],X=this._touches[L];X&&(T._add(z),P._add(z.sub(X)),R++,m[L]=z)}if(this._touches=m,!(R<this._minTouches)&&P.mag()){var ee=P.div(R);if(this._sum._add(ee),!(this._sum.mag()<this._clickTolerance))return{around:T.div(R),panDelta:ee}}},no.prototype.enable=function(){this._enabled=!0},no.prototype.disable=function(){this._enabled=!1,this.reset()},no.prototype.isEnabled=function(){return this._enabled},no.prototype.isActive=function(){return this._active};var Is=function(){this.reset()};function xu(l,d,h){for(var m=0;m<l.length;m++)if(l[m].identifier===h)return d[m]}function wu(l,d){return Math.log(l/d)/Math.LN2}Is.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Is.prototype._start=function(l){},Is.prototype._move=function(l,d,h){return{}},Is.prototype.touchstart=function(l,d,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([d[0],d[1]]))},Is.prototype.touchmove=function(l,d,h){if(this._firstTwoTouches){l.preventDefault();var m=this._firstTwoTouches,T=m[1],P=xu(h,d,m[0]),R=xu(h,d,T);if(P&&R){var L=this._aroundCenter?null:P.add(R).div(2);return this._move([P,R],L,l)}}},Is.prototype.touchend=function(l,d,h){if(this._firstTwoTouches){var m=this._firstTwoTouches,T=m[1],P=xu(h,d,m[0]),R=xu(h,d,T);P&&R||(this._active&&f.suppressClick(),this.reset())}},Is.prototype.touchcancel=function(){this.reset()},Is.prototype.enable=function(l){this._enabled=!0,this._aroundCenter=!!l&&l.around==="center"},Is.prototype.disable=function(){this._enabled=!1,this.reset()},Is.prototype.isEnabled=function(){return this._enabled},Is.prototype.isActive=function(){return this._active};var Ms=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.reset=function(){l.prototype.reset.call(this),delete this._distance,delete this._startDistance},d.prototype._start=function(h){this._startDistance=this._distance=h[0].dist(h[1])},d.prototype._move=function(h,m){var T=this._distance;if(this._distance=h[0].dist(h[1]),this._active||!(Math.abs(wu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:wu(this._distance,T),pinchAround:m}},d}(Is);function ta(l,d){return 180*l.angleWith(d)/Math.PI}var Ef=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.reset=function(){l.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},d.prototype._start=function(h){this._startVector=this._vector=h[0].sub(h[1]),this._minDiameter=h[0].dist(h[1])},d.prototype._move=function(h,m){var T=this._vector;if(this._vector=h[0].sub(h[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ta(this._vector,T),pinchAround:m}},d.prototype._isBelowThreshold=function(h){this._minDiameter=Math.min(this._minDiameter,h.mag());var m=25/(Math.PI*this._minDiameter)*360,T=ta(h,this._startVector);return Math.abs(T)<m},d}(Is);function Vc(l){return Math.abs(l.y)>Math.abs(l.x)}var Ti=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.reset=function(){l.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},d.prototype._start=function(h){this._lastPoints=h,Vc(h[0].sub(h[1]))&&(this._valid=!1)},d.prototype._move=function(h,m,T){var P=h[0].sub(this._lastPoints[0]),R=h[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(P,R,T.timeStamp),this._valid)return this._lastPoints=h,this._active=!0,{pitchDelta:(P.y+R.y)/2*-.5}},d.prototype.gestureBeginsVertically=function(h,m,T){if(this._valid!==void 0)return this._valid;var P=h.mag()>=2,R=m.mag()>=2;if(P||R){if(!P||!R)return this._firstMove===void 0&&(this._firstMove=T),T-this._firstMove<100&&void 0;var L=h.y>0==m.y>0;return Vc(h)&&Vc(m)&&L}},d}(Is),Bf={panStep:100,bearingStep:15,pitchStep:10},Co=function(){var l=Bf;this._panStep=l.panStep,this._bearingStep=l.bearingStep,this._pitchStep=l.pitchStep,this._rotationDisabled=!1};function is(l){return l*(2-l)}Co.prototype.blur=function(){this.reset()},Co.prototype.reset=function(){this._active=!1},Co.prototype.keydown=function(l){var d=this;if(!(l.altKey||l.ctrlKey||l.metaKey)){var h=0,m=0,T=0,P=0,R=0;switch(l.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:l.shiftKey?m=-1:(l.preventDefault(),P=-1);break;case 39:l.shiftKey?m=1:(l.preventDefault(),P=1);break;case 38:l.shiftKey?T=1:(l.preventDefault(),R=-1);break;case 40:l.shiftKey?T=-1:(l.preventDefault(),R=1);break;default:return}return this._rotationDisabled&&(m=0,T=0),{cameraAnimation:function(L){var z=L.getZoom();L.easeTo({duration:300,easeId:"keyboardHandler",easing:is,zoom:h?Math.round(z)+h*(l.shiftKey?2:1):z,bearing:L.getBearing()+m*d._bearingStep,pitch:L.getPitch()+T*d._pitchStep,offset:[-P*d._panStep,-R*d._panStep],center:L.getCenter()},{originalEvent:l})}}}},Co.prototype.enable=function(){this._enabled=!0},Co.prototype.disable=function(){this._enabled=!1,this.reset()},Co.prototype.isEnabled=function(){return this._enabled},Co.prototype.isActive=function(){return this._active},Co.prototype.disableRotation=function(){this._rotationDisabled=!0},Co.prototype.enableRotation=function(){this._rotationDisabled=!1};var Hr=function(l,d){this._map=l,this._el=l.getCanvasContainer(),this._handler=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,o.bindAll(["_onT
2598imeout"],this)};Hr.prototype.setZoomRate=function(l){this._defaultZoomRate=l},Hr.prototype.setWheelZoomRate=function(l){this._wheelZoomRate=l},Hr.prototype.isEnabled=function(){return!!this._enabled},Hr.prototype.isActive=function(){return!!this._active||this._finishTimeout!==void 0},Hr.prototype.isZooming=function(){return!!this._zooming},Hr.prototype.enable=function(l){this.isEnabled()||(this._enabled=!0,this._aroundCenter=l&&l.around==="center")},Hr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Hr.prototype.wheel=function(l){if(this.isEnabled()){var d=l.deltaMode===o.window.WheelEvent.DOM_DELTA_LINE?40*l.deltaY:l.deltaY,h=o.browser.now(),m=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,d!==0&&d%4.000244140625==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,l)):this._type||(this._type=Math.abs(m*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),l.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=l,this._delta-=d,this._active||this._start(l)),l.preventDefault()}}
vendor: 22,043 bytes, line 2598
2598,Hr.prototype._onTimeout=function(l){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(l)},Hr.prototype._start=function(l){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 d=f.mousePos(this._el,l);this._around=o.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(d)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},Hr.prototype.renderFrame=function(){var l=this;if(this._frameId&&(this._frameId=null,this.isActive())){var d=this._map.transform;if(this._delta!==0){var h=this._type==="wheel"&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,m=2/(1+Math.exp(-Math.abs(this._delta*h)));this._delta<0&&m!==0&&(m=1/m);var T=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):d.scale;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(T*m))),this._type==="wheel"&&(this._startZoom=d.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var P,R=typeof this._targetZoom=="number"?this._targetZoom:d.zoom,L=this._startZoom,z=this._easing,X=!1;if(this._type==="wheel"&&L&&z){var ee=Math.min((o.browser.now()-this._lastWheelEventTime)/200,1),Z=z(ee);P=o.number(L,R,Z),ee<1?this._frameId||(this._frameId=!0):X=!0}else P=R,X=!0;return this._active=!0,X&&(this._active=!1,this._finishTimeout=setTimeout(function(){l._zooming=!1,l._handler._triggerRenderFrame(),delete l._targetZoom,delete l._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!X,zoomDelta:P-d.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},Hr.prototype._smoothOutEasing=function(l){var d=o.ease;if(this._prevEase){var h=this._prevEase,m=(o.browser.now()-h.start)/h.duration,T=h.easing(m+.01)-h.easing(m),P=.27/Math.sqrt(T*T+1e-4)*.01,R=Math.sqrt(.0729-P*P);d=o.bezier(P,R,.25,1)}return this._prevEase={start:o.browser.now(),duration:l,easing:d},d},Hr.prototype.blur=function(){this.reset()},Hr.prototype.reset=function(){this._active=!1};var Do=function(l,d){this._clickZoom=l,this._tapZoom=d};Do.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},Do.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},Do.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},Do.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var io=function(){this.reset()};io.prototype.reset=function(){this._active=!1},io.prototype.blur=function(){this.reset()},io.prototype.dblclick=function(l,d){return l.preventDefault(),{cameraAnimation:function(h){h.easeTo({duration:300,zoom:h.getZoom()+(l.shiftKey?-1:1),around:h.unproject(d)},{originalEvent:l})}}},io.prototype.enable=function(){this._enabled=!0},io.prototype.disable=function(){this._enabled=!1,this.reset()},io.prototype.isEnabled=function(){return this._enabled},io.prototype.isActive=function(){return this._active};var Xi=function(){this._tap=new ro({numTouches:1,numTaps:1}),this.reset()};Xi.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},Xi.prototype.touchstart=function(l,d,h){this._swipePoint||(this._tapTime&&l.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?h.length>0&&(this._swipePoint=d[0],this._swipeTouch=h[0].identifier):this._tap.touchstart(l,d,h))},Xi.prototype.touchmove=function(l,d,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;var m=d[0],T=m.y-this._swipePoint.y;return this._swipePoint=m,l.preventDefault(),this._active=!0,{zoomDelta:T/128}}}else this._tap.touchmove(l,d,h)},Xi.prototype.touchend=function(l,d,h){this._tapTime?this._swipePoint&&h.length===0&&this.reset():this._tap.touchend(l,d,h)&&(this._tapTime=l.timeStamp)},Xi.prototype.touchcancel=function(){this.reset()},Xi.prototype.enable=function(){this._enabled=!0},Xi.prototype.disable=function(){this._enabled=!1,this.reset()},Xi.prototype.isEnabled=function(){return this._enabled},Xi.prototype.isActive=function(){return this._active};var Ia=function(l,d,h){this._el=l,this._mousePan=d,this._touchPan=h};Ia.prototype.enable=function(l){this._inertiaOptions=l||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},Ia.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},Ia.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},Ia.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var ra=function(l,d,h){this._pitchWithRotate=l.pitchWithRotate,this._mouseRotate=d,this._mousePitch=h};ra.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},ra.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},ra.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},ra.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var so=function(l,d,h,m){this._el=l,this._touchZoom=d,this._touchRotate=h,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0};so.prototype.enable=function(l){this._touchZoom.enable(l),this._rotationDisabled||this._touchRotate.enable(l),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},so.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},so.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},so.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},so.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},so.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var ss=function(l){return l.zoom||l.drag||l.pitch||l.rotate},Rl=function(l){function d(){l.apply(this,arguments)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d}(o.Event);function wr(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}var ur=function(l,d){this._map=l,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(l),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d),o.bindAll(["handleEvent","handleWindowEvent"],this);var h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[o.window.document,"mousemove",{capture:!0}],[o.window.document,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[o.window,"blur",void 0]];for(var m=0,T=this._listeners;m<T.length;m+=1){var P=T[m],R=P[0];f.addEventListener(R,P[1],R===o.window.document?this.handleWindowEvent:this.handleEvent,P[2])}};ur.prototype.destroy=function(){for(var l=0,d=this._listeners;l<d.length;l+=1){var h=d[l],m=h[0];f.removeEventListener(m,h[1],m===o.window.document?this.handleWindowEvent:this.handleEvent,h[2])}},ur.prototype._addDefaultHandlers=function(l){var d=this._map,h=d.getCanvasContainer();this._add("mapEvent",new Ci(d,l));var m=d.boxZoom=new Ss(d,l);this._add("boxZoom",m);var T=new _s,P=new io;d.doubleClickZoom=new Do(P,T),this._add("tapZoom",T),this._add("clickZoom",P);var R=new Xi;this._add("tapDragZoom",R);var L=d.touchPitch=new Ti;this._add("touchPitch",L);var z=new bu(l),X=new Tf(l);d.dragRotate=new ra(l,z,X),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",X,["mouseRotate"]);var ee=new Cf(l),Z=new no(l);d.dragPan=new Ia(h,ee,Z),this._add("mousePan",ee),this._add("touchPan",Z,["touchZoom","touchRotate"]);var te=new Ef,oe=new Ms;d.touchZoomRotate=new so(h,oe,te,R),this._add("touchRotate",te,["touchPan","touchZoom"]),this._add("touchZoom",oe,["touchPan","touchRotate"]);var we=d.scrollZoom=new Hr(d,this);this._add("scrollZoom",we,["mousePan"]);var Fe=d.keyboard=new Co;this._add("keyboard",Fe),this._add("blockableMapEvent",new or(d));for(var ge=0,Re=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];ge<Re.length;ge+=1){var He=Re[ge];l.interactive&&l[He]&&d[He].enable(l[He])}},ur.prototype._add=function(l,d,h){this._handlers.push({handlerName:l,handler:d,allowed:h}),this._handlersById[l]=d},ur.prototype.stop=function(l){if(!this._updatingCamera){for(var d=0,h=this._handlers;d<h.length;d+=1)h[d].handler.reset();this._inertia.clear(),this._fireEvents({},{},l),this._changes=[]}},ur.prototype.isActive=function(){for(var l=0,d=this._handlers;l<d.length;l+=1)if(d[l].handler.isActive())return!0;return!1},ur.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},ur.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},ur.prototype.isMoving=function(){return!!ss(this._eventsInProgress)||this.isZooming()},ur.prototype._blockedByActive=function(l,d,h){for(var m in l)if(m!==h&&(!d||d.indexOf(m)<0))return!0;return!1},ur.prototype.handleWindowEvent=function(l){this.handleEvent(l,l.type+"Window")},ur.prototype._getMapTouches=function(l){for(var d=[],h=0,m=l;h<m.length;h+=1){var T=m[h];this._el.contains(T.target)&&d.push(T)}return d},ur.prototype.handleEvent=function(l,d){this._updatingCamera=!0;for(var h=l.type==="renderFrame"?void 0:l,m={needsRenderFrame:!1},T={},P={},R=l.touches?this._getMapTouches(l.touches):void 0,L=R?f.touchPos(this._el,R):f.mousePos(this._el,l),z=0,X=this._handlers;z<X.length;z+=1){var ee=X[z],Z=ee.handlerName,te=ee.handler,oe=ee.allowed;if(te.isEnabled()){var we=void 0;this._blockedByActive(P,oe,Z)?te.reset():te[d||l.type]&&(we=te[d||l.type](l,L,R),this.mergeHandlerResult(m,T,we,Z,h),we&&we.needsRenderFrame&&this._triggerRenderFrame()),(we||te.isActive())&&(P[Z]=te)}}var Fe={};for(var ge in this._previousActiveHandlers)P[ge]||(Fe[ge]=h);this._previousActiveHandlers=P,(Object.keys(Fe).length||wr(m))&&(this._changes.push([m,T,Fe]),this._triggerRenderFrame()),(Object.keys(P).length||wr(m))&&this._map._stop(!0),this._updatingCamera=!1;var Re=m.cameraAnimation;Re&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Re(this._map))},ur.prototype.mergeHandlerResult=function(l,d,h,m,T){if(h){o.extend(l,h);var P={handlerName:m,originalEvent:h.originalEvent||T};h.zoomDelta!==void 0&&(d.zoom=P),h.panDelta!==void 0&&(d.drag=P),h.pitchDelta!==void 0&&(d.pitch=P),h.bearingDelta!==void 0&&(d.rotate=P)}},ur.prototype._applyChanges=function(){for(var l={},d={},h={},m=0,T=this._changes;m<T.length;m+=1){var P=T[m],R=P[0],L=P[1],z=P[2];R.panDelta&&(l.panDelta=(l.panDelta||new o.Point(0,0))._add(R.panDelta)),R.zoomDelta&&(l.zoomDelta=(l.zoomDelta||0)+R.zoomDelta),R.bearingDelta&&(l.bearingDelta=(l.bearingDelta||0)+R.bearingDelta),R.pitchDelta&&(l.pitchDelta=(l.pitchDelta||0)+R.pitchDelta),R.around!==void 0&&(l.around=R.around),R.pinchAround!==void 0&&(l.pinchAround=R.pinchAround),R.noInertia&&(l.noInertia=R.noInertia),o.extend(d,L),o.extend(h,z)}this._updateMapTransform(l,d,h),this._changes=[]},ur.prototype._updateMapTransform=function(l,d,h){var m=this._map,T=m.transform;if(!wr(l))return this._fireEvents(d,h,!0);var P=l.panDelta,R=l.zoomDelta,L=l.bearingDelta,z=l.pitchDelta,X=l.around,ee=l.pinchAround;ee!==void 0&&(X=ee),m._stop(!0),X=X||m.transform.centerPoint;var Z=T.pointLocation(P?X.sub(P):X);L&&(T.bearing+=L),z&&(T.pitch+=z),R&&(T.zoom+=R),T.setLocationAtPoint(Z,X),this._map._update(),l.noInertia||this._inertia.record(l),this._fireEvents(d,h,!0)},ur.prototype._fireEvents=function(l,d,h){var m=this,T=ss(this._eventsInProgress),P=ss(l),R={};for(var L in l)this._eventsInProgress[L]||(R[L+"start"]=l[L].originalEvent),this._eventsInProgress[L]=l[L];for(var z in!T&&P&&this._fireEvent("movestart",P.originalEvent),R)this._fireEvent(z,R[z]);for(var X in P&&this._fireEvent("move",P.originalEvent),l)this._fireEvent(X,l[X].originalEvent);var ee,Z={};for(var te in this._eventsInProgress){var oe=this._eventsInProgress[te],we=oe.handlerName,Fe=oe.originalEvent;this._handlersById[we].isActive()||(delete this._eventsInProgress[te],Z[te+"end"]=ee=d[we]||Fe)}for(var ge in Z)this._fireEvent(ge,Z[ge]);var Re=ss(this._eventsInProgress);if(h&&(T||P)&&!Re){this._updatingCamera=!0;var He=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),We=function(nt){return nt!==0&&-m._bearingSnap<nt&&nt<m._bearingSnap};He?(We(He.bearing||this._map.getBearing())&&(He.bearing=0),this._map.easeTo(He,{originalEvent:ee})):(this._map.fire(new o.Event("moveend",{originalEvent:ee})),We(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},ur.prototype._fireEvent=function(l,d){this._map.fire(new o.Event(l,d?{originalEvent:d}:{}))},ur.prototype._requestFrame=function(){var l=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add(function(d){delete l._frameId,l.handleEvent(new Rl("renderFrame",{timeStamp:d})),l._applyChanges()})},ur.prototype._triggerRenderFrame=function(){this._frameId===void 0&&(this._frameId=this._requestFrame())};var Cu=function(l){function d(h,m){l.call(this),this._moving=!1,this._zooming=!1,this.transform=h,this._bearingSnap=m.bearingSnap,o.bindAll(["_renderFrameCallback"],this)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.getCenter=function(){return new o.LngLat(this.transform.center.lng,this.transform.center.lat)},d.prototype.setCenter=function(h,m){return this.jumpTo({center:h},m)},d.prototype.panBy=function(h,m,T){return h=o.Point.convert(h).mult(-1),this.panTo(this.transform.center,o.extend({offset:h},m),T)},d.prototype.panTo=function(h,m,T){return this.easeTo(o.extend({center:h},m),T)},d.prototype.getZoom=function(){return this.transform.zoom},d.prototype.setZoom=function(h,m){return this.jumpTo({zoom:h},m),this},d.prototype.zoomTo=function(h,m,T){return this.easeTo(o.extend({zoom:h},m),T)},d.prototype.zoomIn=function(h,m){return this.zoomTo(this.getZoom()+1,h,m),this},d.prototype.zoomOut=function(h,m){return this.zoomTo(this.getZoom()-1,h,m),this},d.prototype.getBearing=function(){return this.transform.bearing},d.prototype.setBearing=function(h,m){return this.jumpTo({bearing:h},m),this},d.prototype.getPadding=function(){return this.transform.padding},d.prototype.setPadding=function(h,m){return this.jumpTo({padding:h},m),this},d.prototype.rotateTo=function(h,m,T){return this.easeTo(o.extend({bearing:h},m),T)},d.prototype.resetNorth=function(h,m){return this.rotateTo(0,o.extend({duration:1e3},h),m),this},d.prototype.resetNorthPitch=function(h,m){return this.easeTo(o.extend({bearing:0,pitch:0,duration:1e3},h),m),this},d.prototype.snapToNorth=function(h,m){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(h,m):this},d.prototype.getPitch=function(){return this.transform.pitch},d.prototype.setPitch=function(h,m){return this.jumpTo({pitch:h},m),this},d.prototype.cameraForBounds=function(h,m){h=o.LngLatBounds.convert(h);var T=m&&m.bearing||0;return this._cameraForBoxAndBearing(h.getNorthWest(),h.getSouthEast(),T,m)},d.prototype._cameraForBoxAndBearing=function(h,m,T,P){var R={top:0,bottom:0,right:0,left:0};if(typeof(P=o.extend({padding:R,offset:[0,0],maxZoom:this.transform.maxZoom},P)).padding=="number"){var L=P.padding;P.padding={top:L,bottom:L,right:L,left:L}}P.padding=o.extend(R,P.padding);var z=this.transform,X=z.padding,ee=z.project(o.LngLat.convert(h)),Z=z.project(o.LngLat.convert(m)),te=ee.rotate(-T*Math.PI/180),oe=Z.rotate(-T*Math.PI/180),we=new o.Point(Math.max(te.x,oe.x),Math.max(te.y,oe.y)),Fe=new o.Point(Math.min(te.x,oe.x),Math.min(te.y,oe.y)),ge=we.sub(Fe),Re=(z.width-(X.left+X.right+P.padding.left+P.padding.right))/ge.x,He=(z.height-(X.top+X.bottom+P.padding.top+P.padding.bottom))/ge.y;if(!(He<0||Re<0)){var We=Math.min(z.scaleZoom(z.scale*Math.min(Re,He)),P.maxZoom),nt=typeof P.offset.x=="number"?new o.Point(P.offset.x,P.offset.y):o.Point.convert(P.offset),Xe=new o.Point((P.padding.left-P.padding.right)/2,(P.padding.top-P.padding.bottom)/2).rotate(T*Math.PI/180),Qe=nt.add(Xe).mult(z.scale/z.zoomScale(We));return{center:z.unproject(ee.add(Z).div(2).sub(Qe)),zoom:We,bearing:T}}o.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},d.prototype.fitBounds=function(h,m,T){return this._fitInternal(this.cameraForBounds(h,m),m,T)},d.prototype.fitScreenCoordinates=function(h,m,T,P,R){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(o.Point.convert(h)),this.transform.pointLocation(o.Point.convert(m)),T,P),P,R)},d.prototype._fitInternal=function(h,m,T){return h?(delete(m=o.extend(h,m)).padding,m.linear?this.easeTo(m,T):this.flyTo(m,T)):this},d.prototype.jumpTo=function(h,m){this.stop();var T=this.transform,P=!1,R=!1,L=!1;return"zoom"in h&&T.zoom!==+h.zoom&&(P=!0,T.zoom=+h.zoom),h.center!==void 0&&(T.center=o.LngLat.convert(h.center)),"bearing"in h&&T.bearing!==+h.bearing&&(R=!0,T.bearing=+h.bearing),"pitch"in h&&T.pitch!==+h.pitch&&(L=!0,T.pitch=+h.pitch),h.padding==null||T.isPaddingEqual(h.padding)||(T.padding=h.padding),this.fire(new o.Event("movestart",m)).fire(new o.Event("move",m)),P&&this.fire(new o.Event("zoomstart",m)).fire(new o.Event("zoom",m)).fire(new o.Event("zoomend",m)),R&&this.fire(new o.Event("rotatestart",m)).fire(new o.Event("rotate",m)).fire(new o.Event("rotateend",m)),L&&this.fire(new o.Event("pitchstart",m)).fire(new o.Event("pitch",m)).fire(new o.Event("pitchend",m)),this.fire(new o.Event("moveend",m))},d.prototype.easeTo=function(h,m){var T=this;this._stop(!1,h.easeId),((h=o.extend({offset:[0,0],duration:500,easing:o.ease},h)).animate===!1||!h.essential&&o.browser.prefersReducedMotion)&&(h.duration=0);var P=this.transform,R=this.getZoom(),L=this.getBearing(),z=this.getPitch(),X=this.getPadding(),ee="zoom"in h?+h.zoom:R,Z="bearing"in h?this._normalizeBearing(h.bearing,L):L,te="pitch"in h?+h.pitch:z,oe="padding"in h?h.padding:P.padding,we=o.Point.convert(h.offset),Fe=P.centerPoint.add(we),ge=P.pointLocation(Fe),Re=o.LngLat.convert(h.center||ge);this._normalizeCenter(Re);var He,We,nt=P.project(ge),Xe=P.project(Re).sub(nt),Qe=P.zoomScale(ee-R);h.around&&(He=o.LngLat.convert(h.around),We=P.locationPoint(He));var pt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ee!==R,this._rotating=this._rotating||L!==Z,this._pitching=this._pitching||te!==z,this._padding=!P.isPaddingEqual(oe),this._easeId=h.easeId,this._prepareEase(m,h.noMoveStart,pt),this._ease(function(Dt){if(T._zooming&&(P.zoom=o.number(R,ee,Dt)),T._rotating&&(P.bearing=o.number(L,Z,Dt)),T._pitching&&(P.pitch=o.number(z,te,Dt)),T._padding&&(P.interpolatePadding(X,oe,Dt),Fe=P.centerPoint.add(we)),He)P.setLocationAtPoint(He,We);else{var Ct=P.zoomScale(P.zoom-R),zt=ee>R?Math.min(2,Qe):Math.max(.5,Qe),sr=Math.pow(zt,1-Dt),Er=P.unproject(nt.add(Xe.mult(Dt*sr)).mult(Ct));P.setLocationAtPoint(P.renderWorldCopies?Er.wrap():Er,Fe)}T._fireMoveEvents(m)},function(Dt){T._afterEase(m,Dt)},h),this},d.prototype._prepareEase=function(h,m,T){T===void 0&&(T={}),this._moving=!0,m||T.moving||this.fire(new o.Event("movestart",h)),this._zooming&&!T.zooming&&this.fire(new o.Event("zoomstart",h)),this._rotating&&!T.rotating&&this.fire(new o.Event("rotatestart",h)),this._pitching&&!T.pitching&&this.fire(new o.Event("pitchstart",h))},d.prototype._fireMoveEvents=function(h){this.fire(new o.Event("move",h)),this._zooming&&this.fire(new o.Event("zoom",h)),this._rotating&&this.fire(new o.Event("rotate",h)),this._pitching&&this.fire(new o.Event("pitch",h))},d.prototype._afterEase=function(h,m){if(!this._easeId||!m||this._easeId!==m){delete this._easeId;var T=this._zooming,P=this._rotating,R=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,T&&this.fire(new o.Event("zoomend",h)),P&&this.fire(new o.Event("rotateend",h)),R&&this.fire(new o.Event("pitchend",h)),this.fire(new o.Event("moveend",h))}},d.prototype.flyTo=function(h,m){var T=this;if(!h.essential&&o.browser.prefersReducedMotion){var P=o.pick(h,["center","zoom","bearing","pitch","around"]);return this.jumpTo(P,m)}this.stop(),h=o.extend({offset:[0,0],speed:1.2,curve:1.42,easing:o.ease},h);var R=this.transform,L=this.getZoom(),z=this.getBearing(),X=this.getPitch(),ee=this.getPadding(),Z="zoom"in h?o.clamp(+h.zoom,R.minZoom,R.maxZoom):L,te="bearing"in h?this._normalizeBearing(h.bearing,z):z,oe="pitch"in h?+h.pitch:X,we="padding"in h?h.padding:R.padding,Fe=R.zoomScale(Z-L),ge=o.Point.convert(h.offset),Re=R.centerPoint.add(ge),He=R.pointLocation(Re),We=o.LngLat.convert(h.center||He);this._normalizeCenter(We);var nt=R.project(He),Xe=R.project(We).sub(nt),Qe=h.curve,pt=Math.max(R.width,R.height),Dt=pt/Fe,Ct=Xe.mag();if("minZoom"in h){var zt=o.clamp(Math.min(h.minZoom,L,Z),R.minZoom,R.maxZoom),sr=pt/R.zoomScale(zt-L);Qe=Math.sqrt(sr/Ct*2)}var Er=Qe*Qe;function Mr(kr){var Or=(Dt*Dt-pt*pt+(kr?-1:1)*Er*Er*Ct*Ct)/(2*(kr?Dt:pt)*Er*Ct);return Math.log(Math.sqrt(Or*Or+1)-Or)}function xn(kr){return(Math.exp(kr)-Math.exp(-kr))/2}function ar(kr){return(Math.exp(kr)+Math.exp(-kr))/2}var $r=Mr(0),rn=function(kr){return ar($r)/ar($r+Qe*kr)},jr=function(kr){return pt*((ar($r)*(xn(Or=$r+Qe*kr)/ar(Or))-xn($r))/Er)/Ct;var Or},Gr=(Mr(1)-$r)/Qe;
2598if(Math.abs(Ct)<1e-6||!isFinite(Gr)){if(Math.abs(pt-Dt)<1e-6)return this.easeTo(h,m);var Zr=Dt<pt?-1:1;Gr=Math.abs(Math.log(Dt/pt))/Qe,jr=function(){return 0},rn=function(kr){return Math.exp(Zr*Qe*kr)}}return h.duration="duration"in h?+h.duration:1e3*Gr/("screenSpeed"in h?+h.screenSpeed/Qe:+h.speed),h.maxDuration&&h.duration>h.maxDuration&&(h.duration=0),this._zooming=!0,this._rotating=z!==te,this._pitching=oe!==X,this._padding=!R.isPaddingEqual(we),this._prepareEase(m,!1),this._ease(function(kr){var Or=kr*Gr,qi=1/rn(Or);R.zoom=kr===1?Z:L+R.scaleZoom(qi),T._rotating&&(R.bearing=o.number(z,te,kr)),T._pitching&&(R.pitch=o.number(X,oe,kr)),T._padding&&(R.interpolatePadding(ee,we,kr),Re=R.centerPoint.add(ge));var Ei=kr===1?We:R.unproject(nt.add(Xe.mult(jr(Or))).mult(qi));R.setLocationAtPoint(R.renderWorldCopies?Ei.wrap():Ei,Re),T._fireMoveEvents(m)},function(){return T._afterEase(m)},h),this},d.prototype.isEasing=function(){return!!this._easeFrameId},d.prototype.stop=function(){return this._stop()},d.prototype._stop=function(h,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var T=this._onEaseEnd;delete this._onEaseEnd,T.call(this,m)}if(!h){var P=this.handlers;P&&P.stop(!1)}return this},d.prototype._ease=function(h,m,T){T.animate===!1||T.duration===0?(h(1),m()):(this._easeStart=o.browser.now(),this._easeOptions=T,this._onEaseFrame=h,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},d.prototype._renderFrameCallback=function(){var h=Math.min((o.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(h)),h<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},d.prototype._normalizeBearing=function(h,m){h=o.wrap(h,-180,180);var T=Math.abs(h-m);return Math.abs(h-360-m)<T&&(h-=360),Math.abs(h+360-m)<T&&(h+=360),h},d.prototype._normalizeCenter=function(h){var m=this.transform;if(m.renderWorldCopies&&!m.lngRange){var T=h.lng-m.center.lng;h.lng+=T>180?-360:T<-180?360:0}},d}(o.Evented),fs=function(l){l===void 0&&(l={}),this.options=l,o.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};fs.prototype.getDefaultPosition=function(){return"bottom-right"},fs.prototype.onAdd=function(l){var d=this.options&&this.options.compact;return this._map=l,this._container=f.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=f.create("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=f.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),d&&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),d===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},fs.prototype.onRemove=function(){f.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},fs.prototype._setElementTitle=function(l,d){var h=this._map._getUIString("AttributionControl."+d);l.title=h,l.setAttribute("aria-label",h)},fs.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"))},fs.prototype._updateEditLink=function(){var l=this._editLink;l||(l=this._editLink=this._container.querySelector(".mapbox-improve-map"));var d=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||o.config.ACCESS_TOKEN}];if(l){var h=d.reduce(function(m,T,P){return T.value&&(m+=T.key+"="+T.value+(P<d.length-1?"&":"")),m},"?");l.href=o.config.FEEDBACK_URL+"/"+h+(this._map._hash?this._map._hash.getHashString(!0):""),l.rel="noopener nofollow",this._setElementTitle(l,"MapFeedback")}},fs.prototype._updateData=function(l){!l||l.sourceDataType!=="metadata"&&l.sourceDataType!=="visibility"&&l.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())},fs.prototype._updateAttributions=function(){if(this._map.style){var l=[];
2598if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?l=l.concat(this.options.customAttribution.map(function(L){return typeof L!="string"?"":L})):typeof this.options.customAttribution=="string"&&l.push(this.options.customAttribution)),this._map.style.stylesheet){var d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}var h=this._map.style.sourceCaches;for(var m in h){var T=h[m];if(T.used){var P=T.getSource();P.attribution&&l.indexOf(P.attribution)<0&&l.push(P.attribution)}}l.sort(function(L,z){return L.length-z.length});var R=(l=l.filter(function(L,z){for(var X=z+1;X<l.length;X++)if(l[X].indexOf(L)>=0)return!1;return!0})).join(" | ");R!==this._attribHTML&&(this._attribHTML=R,l.length?(this._innerContainer.innerHTML=R,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},fs.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")};var Ki=function(){o.bindAll(["_updateLogo"],this),o.bindAll(["_updateCompact"],this)};Ki.prototype.onAdd=function(l){this._map=l,this._container=f.create("div","mapboxgl-ctrl");var d=f.create("a","mapboxgl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://www.mapbox.com/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},Ki.prototype.onRemove=function(){f.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Ki.prototype.getDefaultPosition=function(){return"bottom-left"},Ki.prototype._updateLogo=function(l){l&&l.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")},Ki.prototype._logoRequired=function(){if(this._map.style){var l=this._map.style.sourceCaches;for(var d in l)if(l[d].getSource().mapbox_logo)return!0;return!1}},Ki.prototype._updateCompact=function(){var l=this._container.children;if(l.length){var d=l[0];this._map.getCanvasContainer().offsetWidth<250?d.classList.add("mapboxgl-compact"):d.classList.remove("mapboxgl-compact")}};var Jn=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};Jn.prototype.add=function(l){var d=++this._id;return this._queue.push({callback:l,id:d,cancelled:!1}),d},Jn.prototype.remove=function(l){for(var d=this._currentlyRunning,h=0,m=d?this._queue.concat(d):this._queue;h<m.length;h+=1){var T=m[h];if(T.id===l)return void(T.cancelled=!0)}},Jn.prototype.run=function(l){l===void 0&&(l=0);var d=this._currentlyRunning=this._queue;this._queue=[];for(var h=0,m=d;h<m.length;h+=1){var T=m[h];if(!T.cancelled&&(T.callback(l),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},Jn.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var zr={"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"},oo=o.window.HTMLImageElement,An=o.window.HTMLElement,Kr=o.window.ImageBitmap,ki={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,maxTileC
2598acheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},Tu=function(l){function d(m){var T=this;if((m=o.extend({},ki,m)).minZoom!=null&&m.maxZoom!=null&&m.minZoom>m.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(m.minPitch!=null&&m.maxPitch!=null&&m.minPitch>m.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(m.minPitch!=null&&m.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(m.maxPitch!=null&&m.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var P=new fn(m.minZoom,m.maxZoom,m.minPitch,m.maxPitch,m.renderWorldCopies);if(l.call(this,P,m),this._interactive=m.interactive,this._maxTileCacheSize=m.maxTileCacheSize,this._failIfMajorPerformanceCaveat=m.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=m.preserveDrawingBuffer,this._antialias=m.antialias,this._trackResize=m.trackResize,this._bearingSnap=m.bearingSnap,this._refreshExpiredTiles=m.refreshExpiredTiles,this._fadeDuration=m.fadeDuration,this._crossSourceCollisions=m.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=m.collectResourceTiming,this._renderTaskQueue=new Jn,this._controls=[],this._mapId=o.uniqueId(),this._locale=o.extend({},zr,m.locale),this._clickTolerance=m.clickTolerance,this._requestManager=new o.RequestManager(m.transformRequest,m.accessToken),typeof m.container=="string"){if(this._container=o.window.document.getElementById(m.container),!this._container)throw new Error("Container '"+m.container+"' not found.")}else{if(!(m.container instanceof An))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=m.container}if(m.maxBounds&&this.setMaxBounds(m.maxBounds),o.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 T._update(!1)}),this.on("moveend",function(){return T._update(!1)}),this.on("zoom",function(){return T._update(!0)}),o.window!==void 0&&(o.window.addEventListener("online",this._onWindowOnline,!1),o.window.addEventListener("resize",this._onWindowResize,!1),o.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new ur(this,m),this._hash=m.hash&&new Vs(typeof m.hash=="string"&&m.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch}),m.bounds&&(this.resize(),this.fitBounds(m.bounds,o.extend({},m.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=m.localIdeographFontFamily,m.style&&this.setStyle(m.style,{localIdeographFontFamily:m.localIdeographFontFamily}),m.attributionControl&&this.addControl(new fs({customAttribution:m.customAttribution})),this.addControl(new Ki,m.logoPosition),this.on("style.load",function(){T.transform.unmodified&&T.jumpTo(T.style.stylesheet)}),this.on("data",function(R){T._update(R.dataType==="style"),T.fire(new o.Event(R.dataType+"data",R))}),this.on("dataloading",function(R){T.fire(new o.Event(R.dataType+"dataloading",R))})}l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d;var h={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return d.prototype._getMapId=function(){return this._mapId},d.prototype.addControl=function(m,T){if(T===void 0&&(T=m.getDefaultPosition?m.getDefaultPosition():"top-right"),!m||!m.onAdd)return this.fire(new o.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var P=m.onAdd(this);this._controls.push(m);var R=this._controlPositions[T];return T.indexOf("bottom")!==-1?R.insertBefore(P,R.firstChild):R.appendChild(P),this},d.prototype.removeControl=function(m){if(!m||!m.onRemove)return this.fire(new o.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var T=this._controls.indexOf(m);return T>-1&&this._controls.splice(T,1),m.onRemove(this),this}
2598,d.prototype.hasControl=function(m){return this._controls.indexOf(m)>-1},d.prototype.resize=function(m){var T=this._containerDimensions(),P=T[0],R=T[1];if(P===this.transform.width&&R===this.transform.height)return this;this._resizeCanvas(P,R),this.transform.resize(P,R),this.painter.resize(P,R);var L=!this._moving;return L&&this.fire(new o.Event("movestart",m)).fire(new o.Event("move",m)),this.fire(new o.Event("resize",m)),L&&this.fire(new o.Event("moveend",m)),this},d.prototype.getBounds=function(){return this.transform.getBounds()},d.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},d.prototype.setMaxBounds=function(m){return this.transform.setMaxBounds(o.LngLatBounds.convert(m)),this._update()},d.prototype.setMinZoom=function(m){if((m=m??-2)>=-2&&m<=this.transform.maxZoom)return this.transform.minZoom=m,this._update(),this.getZoom()<m&&this.setZoom(m),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")},d.prototype.getMinZoom=function(){return this.transform.minZoom},d.prototype.setMaxZoom=function(m){if((m=m??22)>=this.transform.minZoom)return this.transform.maxZoom=m,this._update(),this.getZoom()>m&&this.setZoom(m),this;throw new Error("maxZoom must be greater than the current minZoom")},d.prototype.getMaxZoom=function(){return this.transform.maxZoom},d.prototype.setMinPitch=function(m){if((m=m??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(m>=0&&m<=this.transform.maxPitch)return this.transform.minPitch=m,this._update(),this.getPitch()<m&&this.setPitch(m),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},d.prototype.getMinPitch=function(){return this.transform.minPitch},d.prototype.setMaxPitch=function(m){if((m=m??60)>60)throw new Error("maxPitch must be less than or equal to 60");if(m>=this.transform.minPitch)return this.transform.maxPitch=m,this._update(),this.getPitch()>m&&this.setPitch(m),this;throw new Error("maxPitch must be greater than the current minPitch")},d.prototype.getMaxPitch=function(){return this.transform.maxPitch},d.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},d.prototype.setRenderWorldCopies=function(m){return this.transform.renderWorldCopies=m,this._update()},d.prototype.project=function(m){return this.transform.locationPoint(o.LngLat.convert(m))},d.prototype.unproject=function(m){return this.transform.pointLocation(o.Point.convert(m))},d.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},d.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},d.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},d.prototype._createDelegatedListener=function(m,T,P){var R,L=this;if(m==="mouseenter"||m==="mouseover"){var z=!1;return{layer:T,listener:P,delegates:{mousemove:function(ee){var Z=L.getLayer(T)?L.queryRenderedFeatures(ee.point,{layers:[T]}):[];Z.length?z||(z=!0,P.call(L,new kn(m,L,ee.originalEvent,{features:Z}))):z=!1},mouseout:function(){z=!1}}}}if(m==="mouseleave"||m==="mouseout"){var X=!1;return{layer:T,listener:P,delegates:{mousemove:function(ee){(L.getLayer(T)?L.queryRenderedFeatures(ee.point,{layers:[T]}):[]).length?X=!0:X&&(X=!1,P.call(L,new kn(m,L,ee.originalEvent)))},mouseout:function(ee){X&&(X=!1,P.call(L,new kn(m,L,ee.originalEvent)))}}}}return{layer:T,listener:P,delegates:(R={},R[m]=function(ee){var Z=L.getLayer(T)?L.queryRenderedFeatures(ee.point,{layers:[T]}):[];Z.length&&(ee.features=Z,P.call(L,ee),delete ee.features)},R)}},d.prototype.on=function(m,T,P){if(P===void 0)return l.prototype.on.call(this,m,T);var R=this._createDelegatedListener(m,T,P);for(var L in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[m]=this._delegatedListeners[m]||[],this._delegatedListeners[m].push(R),R.delegates)this.on(L,R.delegates[L]);return this},d.prototype.once=function(m,T,P){if(P===void 0)return l.prototype.once.call(this,m,T);var R=this._createDelegatedListener(m,T,P);for(var L in R.delegates)this.once(L,R.delegates[L]);return this},d.prototype.off=function(m,T,P){var R=this;return P===void 0?l.prototype.off.call(this,m,T):(this._delegatedListeners&&this._delegatedListeners[m]&&function(L){for(var z=L[m],X=0;X<z.length;X++){var ee=z[X];if(ee.layer===T&&ee.listener===P){for(var Z in ee.delegates)R.off(Z,ee.delegates[Z]);return z.splice(X,1),R}}}(this._delegatedListeners),this)},d.prototype.queryRenderedFeatures=function(m,T){if(!this.style)return[];var P;if(T!==void 0||m===void 0||m instanceof o.Point||Array.isArray(m)||(T=m,m=void 0),T=T||{},(m=m||[[0,0],[this.transform.width,this.transform.height]])instanceof o.Point||typeof m[0]=="number")P=[o.Point.convert(m)];else{var R=o.Point.convert(m[0]),L=o.Point.convert(m[1]);P=[R,new o.Point(L.x,R.y),L,new o.Point(R.x,L.y),R]}return this.style.queryRenderedFeatures(P,T,this.transform)},d.prototype.querySourceFeatures=function(m,T){return this.style.querySourceFeatures(m,T)},d.prototype.setStyle=function(m,T){return(T=o.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},T)).diff!==!1&&T.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&m?(this._diffStyle(m,T),this):(this._localIdeographFontFamily=T.localIdeographFontFamily,this._updateStyle(m,T))},d.prototype._getUIString=function(m){var T=this._locale[m];
2598if(T==null)throw new Error("Missing UI string '"+m+"'");return T},d.prototype._updateStyle=function(m,T){return this.style&&(this.style.setEventedParent(null),this.style._remove()),m?(this.style=new zn(this,T||{}),this.style.setEventedParent(this,{style:this.style}),typeof m=="string"?this.style.loadURL(m):this.style.loadJSON(m),this):(delete this.style,this)},d.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new zn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},d.prototype._diffStyle=function(m,T){var P=this;if(typeof m=="string"){var R=this._requestManager.normalizeStyleURL(m),L=this._requestManager.transformRequest(R,o.ResourceType.Style);o.getJSON(L,function(z,X){z?P.fire(new o.ErrorEvent(z)):X&&P._updateDiff(X,T)})}else typeof m=="object"&&this._updateDiff(m,T)},d.prototype._updateDiff=function(m,T){try{this.style.setState(m)&&this._update(!0)}catch(P){o.warnOnce("Unable to perform style diff: "+(P.message||P.error||P)+".  Rebuilding the style from scratch."),this._updateStyle(m,T)}},d.prototype.getStyle=function(){if(this.style)return this.style.serialize()},d.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():o.warnOnce("There is no style added to the map.")},d.prototype.addSource=function(m,T){return this._lazyInitEmptyStyle(),this.style.addSource(m,T),this._update(!0)},d.prototype.isSourceLoaded=function(m){var T=this.style&&this.style.sourceCaches[m];if(T!==void 0)return T.loaded();this.fire(new o.ErrorEvent(new Error("There is no source with ID '"+m+"'")))},d.prototype.areTilesLoaded=function(){var m=this.style&&this.style.sourceCaches;for(var T in m){var P=m[T]._tiles;for(var R in P){var L=P[R];if(L.state!=="loaded"&&L.state!=="errored")return!1}}return!0},d.prototype.addSourceType=function(m,T,P){return this._lazyInitEmptyStyle(),this.style.addSourceType(m,T,P)},d.prototype.removeSource=function(m){return this.style.removeSource(m),this._update(!0)},d.prototype.getSource=function(m){return this.style.getSource(m)},d.prototype.addImage=function(m,T,P){P===void 0&&(P={});var R=P.pixelRatio;R===void 0&&(R=1);var L=P.sdf;L===void 0&&(L=!1);var z=P.stretchX,X=P.stretchY,ee=P.content;if(this._lazyInitEmptyStyle(),T instanceof oo||Kr&&T instanceof Kr){var Z=o.browser.getImageData(T);this.style.addImage(m,{data:new o.RGBAImage({width:Z.width,height:Z.height},Z.data),pixelRatio:R,stretchX:z,stretchY:X,content:ee,sdf:L,version:0})}else{if(T.width===void 0||T.height===void 0)return this.fire(new o.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 te=T;this.style.addImage(m,{data:new o.RGBAImage({width:T.width,height:T.height},new Uint8Array(T.data)),pixelRatio:R,stretchX:z,stretchY:X,content:ee,sdf:L,version:0,userImage:te}),te.onAdd&&te.onAdd(this,m)}},d.prototype.updateImage=function(m,T){var P=this.style.getImage(m);if(!P)return this.fire(new o.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var R=T instanceof oo||Kr&&T instanceof Kr?o.browser.getImageData(T):T,L=R.width,z=R.height,X=R.data;return L===void 0||z===void 0?this.fire(new o.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`"))):L!==P.data.width||z!==P.data.height?this.fire(new o.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(P.data.replace(X,!(T instanceof oo||Kr&&T instanceof Kr)),void this.style.updateImage(m,P))},d.prototype.hasImage=function(m){return m?!!this.style.getImage(m):(this.fire(new o.ErrorEvent(new Error("Missing required image id"))),!1)},d.prototype.removeImage=function(m){this.style.removeImage(m)},d.prototype.loadImage=function(m,T){o.getImage(this._requestManager.transformRequest(m,o.ResourceType.Image),T)},d.prototype.listImages=function(){return this.style.listImages()},d.prototype.addLayer=function(m,T){return this._lazyInitEmptyStyle(),this.style.addLayer(m,T),this._update(!0)},d.prototype.moveLayer=function(m,T){return this.style.moveLayer(m,T),this._update(!0)},d.prototype.removeLayer=function(m){return this.style.removeLayer(m),this._update(!0)},d.prototype.getLayer=function(m){return this.style.getLayer(m)},d.prototype.setLayerZoomRange=function(m,T,P){return this.style.setLayerZoomRange(m,T,P),this._update(!0)},d.prototype.setFilter=function(m,T,P){return P===void 0&&(P={}),this.style.setFilter(m,T,P),this._update(!0)},d.prototype.getFilter=function(m){return this.style.getFilter(m)},d.prototype.setPaintProperty=function(m,T,P,R){return R===void 0&&(R={}),this.style.setPaintProperty(m,T,P,R),this._update(!0)},d.prototype.getPaintProperty=function(m,T){return this.style.getPaintProperty(m,T)},d.prototype.setLayoutProperty=function(m,T,P,R){return R===void 0&&(R={}),this.style.setLayoutProperty(m,T,P,R),this._update(!0)},d.prototype.getLayoutProperty=function(m,T){return this.style.getLayoutProperty(m,T)},d.prototype.setLight=function(m,T){return T===void 0&&(T={}),this._lazyInitEmptyStyle(),this.style.setLight(m,T),this._update(!0)},d.prototype.getLight=function(){return this.style.getLight()},d.prototype.setFeatureState=function(m,T){return this.style.setFeatureState(m,T),this._update()},d.prototype.removeFeatureState=function(m,T){return this.style.removeFeatureState(m,T),this._update()},d.prototype.getFeatureState=function(m){return this.style.getFeatureState(m)},d.prototype.getContainer=function(){return this._container},d.prototype.getCanvasContainer=function(){return this._canvasContainer},d.prototype.getCanvas=function(){return this._canvas},d.prototype._containerDimensions=function(){var m=0,T=0;return this._container&&(m=this._container.clientWidth||400,T=this._container.clientHeight||300),[m,T]},d.prototype._detectMissingCSS=function(){o.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&o.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 
2598in https://www.mapbox.com/mapbox-gl-js/api/.")},d.prototype._setupContainer=function(){var m=this._container;m.classList.add("mapboxgl-map"),(this._missingCSSCanary=f.create("div","mapboxgl-canary",m)).style.visibility="hidden",this._detectMissingCSS();var T=this._canvasContainer=f.create("div","mapboxgl-canvas-container",m);this._interactive&&T.classList.add("mapboxgl-interactive"),this._canvas=f.create("canvas","mapboxgl-canvas",T),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var P=this._containerDimensions();this._resizeCanvas(P[0],P[1]);var R=this._controlContainer=f.create("div","mapboxgl-control-container",m),L=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(z){L[z]=f.create("div","mapboxgl-ctrl-"+z,R)}),this._container.addEventListener("scroll",this._onMapScroll,!1)},d.prototype._resizeCanvas=function(m,T){var P=o.browser.devicePixelRatio||1;this._canvas.width=P*m,this._canvas.height=P*T,this._canvas.style.width=m+"px",this._canvas.style.height=T+"px"},d.prototype._setupPainter=function(){var m=o.extend({},c.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),T=this._canvas.getContext("webgl",m)||this._canvas.getContext("experimental-webgl",m);T?(this.painter=new Wn(T,this.transform),o.webpSupported.testSupport(T)):this.fire(new o.ErrorEvent(new Error("Failed to initialize WebGL")))},d.prototype._contextLost=function(m){m.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.Event("webglcontextlost",{originalEvent:m}))},d.prototype._contextRestored=function(m){this._setupPainter(),this.resize(),this._update(),this.fire(new o.Event("webglcontextrestored",{originalEvent:m}))},d.prototype._onMapScroll=function(m){if(m.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},d.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},d.prototype._update=function(m){return this.style?(this._styleDirty=this._styleDirty||m,this._sourcesDirty=!0,this.triggerRepaint(),this):this},d.prototype._requestRenderFrame=function(m){return this._update(),this._renderTaskQueue.add(m)},d.prototype._cancelRenderFrame=function(m){this._renderTaskQueue.remove(m)},d.prototype._render=function(m){var T,P=this,R=0,L=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(T=L.createQueryEXT(),L.beginQueryEXT(L.TIME_ELAPSED_EXT,T),R=o.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(m),!this._removed){var z=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var X=this.transform.zoom,ee=o.browser.now();this.style.zoomHistory.update(X,ee);var Z=new o.EvaluationParameters(X,{now:ee,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),te=Z.crossFadingFactor();te===1&&te===this._crossFadingFactor||(z=!0,this._crossFadingFactor=te),this.style.update(Z)}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 o.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new o.Event("load"))),this.style&&(this.style.hasTransitions()||z)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var oe=o.browser.now()-R;L.endQueryEXT(L.TIME_ELAPSED_EXT,T),setTimeout(function(){var ge=L.getQueryObjectEXT(T,L.QUERY_RESULT_EXT)/1e6;L.deleteQueryEXT(T),P.fire(new o.Event("gpu-timing-frame",{cpuTime:oe,gpuTime:ge}))},50)}if(this.listens("gpu-timing-layer")){var we=this.painter.collectGpuTimers();setTimeout(function(){var ge=P.painter.queryGpuTimers(we);P.fire(new o.Event("gpu-timing-layer",{layerTimes:ge}))},50)}var Fe=this._sourcesDirty||this._styleDirty||this._placementDirty;return Fe||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.Event("idle")),!this._loaded||this._fullyLoaded||Fe||(this._fullyLoaded=!0),this}},d.prototype.remove=function(){this._hash&&this._hash.remove();for(var m=0,T=this._controls;m<T.length;m+=1)T[m].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),o.window!==void 0&&(o.window.removeEventListener("resize",this._onWindowResize,!1),o.window.removeEventListener("orientationchange",this._onWindowResize,!1),o.window.removeEventListener("online",this._onWindowOnline,!1));var P=this.painter.context.gl.getExtension("WEBGL_lose_context");P&&P.loseContext(),js(this._canvasContainer),js(this._controlContainer),js(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),this._removed=!0,this.fire(new o.Event("remove"))},d.prototype.triggerRepaint=function(){var m=this;this.style&&!this._frame&&(this._frame=o.browser.frame(function(T){m._frame=null,m._render(T)}))},d.prototype._onWindowOnline=function(){this._update()},d.prototype._onWindowResize=function(m){this._trackResize&&this.resize({originalEvent:m})._update()},h.showTileBoundaries.get=function(){return!!this._showTileBoundaries},h.showTileBoundaries.set=function(m){this._showTileBoundaries!==m&&(this._showTileBoundaries=m,this._update())},h.showPadding.get=function(){return!!this._showPadding},h.showPadding.set=function(m){this._showPadding!==m&&(this._showPadding=m,this._update())},h.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},h.showCollisionBoxes.set=function(m){this._showCollisionBoxes!==m&&(this._showCollisionBoxes=m,m?this.style._generateCollisionBoxes():this._update())},h.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},h.showOverdrawInspector.set=function(m){this._showOverdrawInspector!==m&&(this._showOverdrawInspector=m,this._update())},h.repaint.get=function(){return!!this._repaint},h.repaint.set=function(m){this._repaint!==m&&(this._repaint=m,this.triggerRepaint())},h.vertices.get=function(){return!!this._vertices}
vendor: 12,937 bytes, line 2598
2598,h.vertices.set=function(m){this._vertices=m,this._update()},d.prototype._setCacheLimits=function(m,T){o.setCacheLimits(m,T)},h.version.get=function(){return o.version},Object.defineProperties(d.prototype,h),d}(Cu);function js(l){l.parentNode&&l.parentNode.removeChild(l)}var Sf={showCompass:!0,showZoom:!0,visualizePitch:!1},di=function(l){var d=this;this.options=o.extend({},Sf,l),this._container=f.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(h){return h.preventDefault()}),this.options.showZoom&&(o.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",function(h){return d._map.zoomIn({},{originalEvent:h})}),f.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",function(h){return d._map.zoomOut({},{originalEvent:h})}),f.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(o.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",function(h){d.options.visualizePitch?d._map.resetNorthPitch({},{originalEvent:h}):d._map.resetNorth({},{originalEvent:h})}),this._compassIcon=f.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};di.prototype._updateZoomButtons=function(){var l=this._map.getZoom(),d=l===this._map.getMaxZoom(),h=l===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",d.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())},di.prototype._rotateCompassArrow=function(){var l=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=l},di.prototype.onAdd=function(l){return this._map=l,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 os(this._map,this._compass,this.options.visualizePitch)),this._container},di.prototype.onRemove=function(){f.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},di.prototype._createButton=function(l,d){var h=f.create("button",l,this._container);return h.type="button",h.addEventListener("click",d),h},di.prototype._setButtonTitle=function(l,d){var h=this._map._getUIString("NavigationControl."+d);l.title=h,l.setAttribute("aria-label",h)};var os=function(l,d,h){h===void 0&&(h=!1),this._clickTolerance=10,this.element=d,this.mouseRotate=new bu({clickTolerance:l.dragRotate._mouseRotate._clickTolerance}),this.map=l,h&&(this.mousePitch=new Tf({clickTolerance:l.dragRotate._mousePitch._clickTolerance})),o.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),f.addEventListener(d,"mousedown",this.mousedown),f.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),f.addEventListener(d,"touchmove",this.touchmove),f.addEventListener(d,"touchend",this.touchend),f.addEventListener(d,"touchcancel",this.reset)};function To(l,d,h){if(l=new o.LngLat(l.lng,l.lat),d){var m=new o.LngLat(l.lng-360,l.lat),T=new o.LngLat(l.lng+360,l.lat),P=h.locationPoint(l).distSqr(d);h.locationPoint(m).distSqr(d)<P?l=m:h.locationPoint(T).distSqr(d)<P&&(l=T)}for(;Math.abs(l.lng-h.center.lng)>180;){var R=h.locationPoint(l);if(R.x>=0&&R.y>=0&&R.x<=h.width&&R.y<=h.height)break;l.lng>h.center.lng?l.lng-=360:l.lng+=360}return l}os.prototype.down=function(l,d){this.mouseRotate.mousedown(l,d),this.mousePitch&&this.mousePitch.mousedown(l,d),f.disableDrag()},os.prototype.move=function(l,d){var h=this.map,m=this.mouseRotate.mousemoveWindow(l,d);if(m&&m.bearingDelta&&h.setBearing(h.getBearing()+m.bearingDelta),this.mousePitch){var T=this.mousePitch.mousemoveWindow(l,d);T&&T.pitchDelta&&h.setPitch(h.getPitch()+T.pitchDelta)}},os.prototype.off=function(){var l=this.element;f.removeEventListener(l,"mousedown",this.mousedown),f.removeEventListener(l,"touchstart",this.touchstart,{passive:!1}),f.removeEventListener(l,"touchmove",this.touchmove),f.removeEventListener(l,"touchend",this.touchend),f.removeEventListener(l,"touchcancel",this.reset),this.offTemp()},os.prototype.offTemp=function(){f.enableDrag(),f.removeEventListener(o.window,"mousemove",this.mousemove),f.removeEventListener(o.window,"mouseup",this.mouseup)},os.prototype.mousedown=function(l){this.down(o.extend({},l,{ctrlKey:!0,preventDefault:function(){return l.preventDefault()}}),f.mousePos(this.element,l)),f.addEventListener(o.window,"mousemove",this.mousemove),f.addEventListener(o.window,"mouseup",this.mouseup)},os.prototype.mousemove=function(l){this.move(l,f.mousePos(this.element,l))},os.prototype.mouseup=function(l){this.mouseRotate.mouseupWindow(l),this.mousePitch&&this.mousePitch.mouseupWindow(l),this.offTemp()},os.prototype.touchstart=function(l){l.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=f.touchPos(this.element,l.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return l.preventDefault()}},this._startPos))},os.prototype.touchmove=function(l){l.targetTouches.length!==1?this.reset():(this._lastPos=f.touchPos(this.element,l.targetTouches)[0],this.move({preventDefault:function(){return l.preventDefault()}},this._lastPos))},os.prototype.touchend=function(l){l.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},os.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var Eo={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 Jt(l,d,h){var m=l.classList;for(var T in Eo)m.remove("mapboxgl-"+h+"-anchor-"+T);m.add("mapboxgl-"+h+"-anchor-"+d)}var tr,Hc=function(l){function d(h,m){if(l.call(this),(h instanceof o.window.HTMLElement||m)&&(h=o.extend({element:h},m)),o.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=h&&h.anchor||"center",this._color=h&&h.color||"#3FB1CE",this._scale=h&&h.scale||1,this._draggable=h&&h.draggable||!1,this._clickTolerance=h&&h.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=h&&h.rotation||0,this._rotationAlignment=h&&h.rotationAlignment||"auto",this._pitchAlignment=h&&h.pitchAlignment&&h.pitchAlignment!=="auto"?h.pitchAlignment:this._rotationAlignment,h&&h.element)this._element=h.element,this._offset=o.Point.convert(h&&h.offset||[0,0]);else{this._defaultMarker=!0,this._element=f.create("div"),this._element.setAttribute("aria-label","Map marker");var T=f.createNS("http://www.w3.org/2000/svg","svg");T.setAttributeNS(null,"display","block"),T.setAttributeNS(null,"height","41px"),T.setAttributeNS(null,"width","27px"),T.setAttributeNS(null,"viewBox","0 0 27 41");var P=f.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"stroke","none"),P.setAttributeNS(null,"stroke-width","1"),P.setAttributeNS(null,"fill","none"),P.setAttributeNS(null,"fill-rule","evenodd");var R=f.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill-rule","nonzero");var L=f.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.setAttributeNS(null,"fill","#000000");for(var z=0,X=[{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"}];z<X.length;z+=1){var ee=X[z],Z=f.createNS("http://www.w3.org/2000/svg","ellipse");Z.setAttributeNS(null,"opacity","0.04"),Z.setAttributeNS(null,"cx","10.5"),Z.setAttributeNS(null,"cy","5.80029008"),Z.setAttributeNS(null,"rx",ee.rx),Z.setAttributeNS(null,"ry",ee.ry),L.appendChild(Z)}var te=f.createNS("http://www.w3.org/2000/svg","g");te.setAttributeNS(null,"fill",this._color);var oe=f.createNS("http://www.w3.org/2000/svg","path");oe.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"),te.appendChild(oe);var we=f.createNS("http://www.w3.org/2000/svg","g");we.setAttributeNS(null,"opacity","0.25"),we.setAttributeNS(null,"fill","#000000");var Fe=f.createNS("http://www.w3.org/2000/svg","path");Fe.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"),we.appendChild(Fe);var ge=f.createNS("http://www.w3.org/2000/svg","g");ge.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ge.setAttributeNS(null,"fill","#FFFFFF");var Re=f.createNS("http://www.w3.org/2000/svg","g");Re.setAttributeNS(null,"transform","translate(8.0, 8.0)");var He=f.createNS("http://www.w3.org/2000/svg","circle");He.setAttributeNS(null,"fill","#000000"),He.setAttributeNS(null,"opacity","0.25"),He.setAttributeNS(null,"cx","5.5"),He.setAttributeNS(null,"cy","5.5"),He.setAttributeNS(null,"r","5.4999962");var We=f.createNS("http://www.w3.org/2000/svg","circle");We.setAttributeNS(null,"fill","#FFFFFF"),We.setAttributeNS(null,"cx","5.5"),We.setAttributeNS(null,"cy","5.5"),We.setAttributeNS(null,"r","5.4999962"),Re.appendChild(He),Re.appendChild(We),R.appendChild(L),R.appendChild(te),R.appendChild(we),R.appendChild(ge),R.appendChild(Re),T.appendChild(R),T.setAttributeNS(null,"height",41*this._scale+"px"),T.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(T),this._offset=o.Point.convert(h&&h.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",function(nt){nt.preventDefault()}),this._element.addEventListener("mousedown",function(nt){nt.preventDefault()}),Jt(this._element,this._anchor,"marker"),this._popup=null}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.addTo=function(h){return this.remove(),this._map=h,h.getCanvasContainer().appendChild(this._element),h.on("move",this._update),h.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},d.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),f.remove(this._element),this._popup&&this._popup.remove(),this},d.prototype.getLngLat=function(){return this._lngLat},d.prototype.setLngLat=function(h){return this._lngLat=o.LngLat.convert(h),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},d.prototype.getElement=function(){return this._element},d.prototype.setPopup=function(h){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),h){if(!("offset"in h.options)){var m=Math.sqrt(Math.pow(13.5,2)/2);h.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
25980,-38.1],"bottom-left":[m,-1*(24.6+m)],"bottom-right":[-m,-1*(24.6+m)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=h,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},d.prototype._onKeyPress=function(h){var m=h.code,T=h.charCode||h.keyCode;m!=="Space"&&m!=="Enter"&&T!==32&&T!==13||this.togglePopup()},d.prototype._onMapClick=function(h){var m=h.originalEvent.target,T=this._element;this._popup&&(m===T||T.contains(m))&&this.togglePopup()},d.prototype.getPopup=function(){return this._popup},d.prototype.togglePopup=function(){var h=this._popup;return h?(h.isOpen()?h.remove():h.addTo(this._map),this):this},d.prototype._update=function(h){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=To(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var m="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?m="rotateZ("+this._rotation+"deg)":this._rotationAlignment==="map"&&(m="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var T="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?T="rotateX(0deg)":this._pitchAlignment==="map"&&(T="rotateX("+this._map.getPitch()+"deg)"),h&&h.type!=="moveend"||(this._pos=this._pos.round()),f.setTransform(this._element,Eo[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+T+" "+m)}},d.prototype.getOffset=function(){return this._offset},d.prototype.setOffset=function(h){return this._offset=o.Point.convert(h),this._update(),this},d.prototype._onMove=function(h){if(!this._isDragging){var m=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=h.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 o.Event("dragstart"))),this.fire(new o.Event("drag")))},d.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 o.Event("dragend")),this._state="inactive"},d.prototype._addDragHandler=function(h){this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.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))},d.prototype.setDraggable=function(h){return this._draggable=!!h,this._map&&(h?(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},d.prototype.isDraggable=function(){return this._draggable},d.prototype.setRotation=function(h){return this._rotation=h||0,this._update(),this},d.prototype.getRotation=function(){return this._rotation},d.prototype.setRotationAlignment=function(h){return this._rotationAlignment=h||"auto",this._update(),this},d.prototype.getRotationAlignment=function(){return this._rotationAlignment},d.prototype.setPitchAlignment=function(h){return this._pitchAlignment=h&&h!=="auto"?h:this._rotationAlignment,this._update(),this},d.prototype.getPitchAlignment=function(){return this._pitchAlignment},d}(o.Evented),Fl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},na=0,Oo=!1,ia=function(l){function d(h){l.call(this),this.options=o.extend({},Fl,h),o.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.onAdd=function(h){var m;return this._map=h,this._container=f.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),m=this._setupUI,tr!==void 0?m(tr):o.window.navigator.permissions!==void 0?o.window.navigator.permissions.query({name:"geolocation"}).then(function(T){m(tr=T.state!=="denied")}):m(tr=!!o.window.navigator.geolocation),this._container},d.prototype.onRemove=function(){this._geolocationWatchID!==void 0&&(o.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(),f.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,na=0,Oo=!1},d.prototype._isOutOfMapMaxBounds=function(h){var m=this._map.getMaxBounds(),T=h.coords;return m&&(T.longitude<m.getWest()||T.longitude>m.getEast()||T.latitude<m.getSouth()||T.latitude>m.getNorth())},d.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
2598RROR",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")}},d.prototype._onSuccess=function(h){if(this._map){if(this._isOutOfMapMaxBounds(h))return this._setErrorState(),this.fire(new o.Event("outofmaxbounds",h)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=h,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(h),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(h),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new o.Event("geolocate",h)),this._finish()}},d.prototype._updateCamera=function(h){var m=new o.LngLat(h.coords.longitude,h.coords.latitude),T=h.coords.accuracy,P=this._map.getBearing(),R=o.extend({bearing:P},this.options.fitBoundsOptions);this._map.fitBounds(m.toBounds(T),R,{geolocateSource:!0})},d.prototype._updateMarker=function(h){if(h){var m=new o.LngLat(h.coords.longitude,h.coords.latitude);this._accuracyCircleMarker.setLngLat(m).addTo(this._map),this._userLocationDotMarker.setLngLat(m).addTo(this._map),this._accuracy=h.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},d.prototype._updateCircleRadius=function(){var h=this._map._container.clientHeight/2,m=this._map.unproject([0,h]),T=this._map.unproject([1,h]),P=m.distanceTo(T),R=Math.ceil(2*this._accuracy/P);this._circleElement.style.width=R+"px",this._circleElement.style.height=R+"px"},d.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},d.prototype._onError=function(h){if(this._map){if(this.options.trackUserLocation)if(h.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 m=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=m,this._geolocateButton.setAttribute("aria-label",m),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(h.code===3&&Oo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new o.Event("error",h)),this._finish()}},d.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},d.prototype._setupUI=function(h){var m=this;if(this._container.addEventListener("contextmenu",function(R){return R.preventDefault()}),this._geolocateButton=f.create("button","mapboxgl-ctrl-geolocate",this._container),f.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",h===!1){o.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var T=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=T,this._geolocateButton.setAttribute("aria-label",T)}else{var P=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=P,this._geolocateButton.setAttribute("aria-label",P)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2598se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=f.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Hc(this._dotElement),this._circleElement=f.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Hc({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(R){R.geolocateSource||m._watchState!=="ACTIVE_LOCK"||R.originalEvent&&R.originalEvent.type==="resize"||(m._watchState="BACKGROUND",m._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),m._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),m.fire(new o.Event("trackuserlocationend")))})},d.prototype.trigger=function(){if(!this._setup)return o.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 o.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":na--,Oo=!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 o.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 o.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 h;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++na>1?(h={maximumAge:6e5,timeout:0},Oo=!0):(h=this.options.positionOptions,Oo=!1),this._geolocationWatchID=o.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else o.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},d.prototype._clearWatch=function(){o.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)},d}(o.Evented),sa={maxWidth:100,unit:"metric"},ys=function(l){this.options=o.extend({},sa,l),o.bindAll(["_onMove","setUnit"],this)};function y(l,d,h){var m=h&&h.maxWidth||100,T=l._container.clientHeight/2,P=l.unproject([0,T]),R=l.unproject([m,T]),L=P.distanceTo(R);if(h&&h.unit==="imperial"){var z=3.2808*L;z>5280?_(d,m,z/5280,l._getUIString("ScaleControl.Miles")):_(d,m,z,l._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?_(d,m,L/1852,l._getUIString("ScaleControl.NauticalMiles")):L>=1e3?_(d,m,L/1e3,l._getUIString("ScaleControl.Kilometers")):_(d,m,L,l._getUIString("ScaleControl.Meters"))}function _(l,d,h,m){var T,P,R,L=(T=h,(P=Math.pow(10,(""+Math.floor(T)).length-1))*(R=(R=T/P)>=10?10:R>=5?5:R>=3?3:R>=2?2:R>=1?1:function(z){var X=Math.pow(10,Math.ceil(-Math.log(z)/Math.LN10));return Math.round(z*X)/X}(R)));l.style.width=d*(L/h)+"px",l.innerHTML=L+"&nbsp;"+m}ys.prototype.getDefaultPosition=function(){return"bottom-left"},ys.prototype._onMove=function(){y(this._map,this._container,this.options)},ys.prototype.onAdd=function(l){return this._map=l,this._container=f.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},ys.prototype.onRemove=function(){f.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},ys.prototype.setUnit=function(l){this.options.unit=l,y(this._map,this._container,this.options)};var b=function(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof o.window.HTMLElement?this._container=l.container:o.warnOnce("Full screen control 'container' must be a DOM element.")),o.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in o.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in o.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in o.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in o.window.document&&(this._fullscreenchange="MSFullscreenChange")};b.prototype.onAdd=function(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=f.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},b.prototype.onRemove=function(){f.remove(this._controlContainer),this._map=null,o.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},b.prototype._checkFullscreenSupport=function(){return!!(o.window.document.fullscreenEnabled||o.window.document.mozFullScreenEnabled||o.window.document.msFullscreenEnabled||o.window.document.webkitFullscreenEnabled)},b.prototype._setupUI=function(){var l=this._fullscreenButton=f.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);f.create("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden",!0),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),o.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},b.prototype._updateTitle=function(){var l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.title=l},b.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},b.prototype._isFullscreen=function(){return this._fullscreen},b.prototype._changeIcon=function(){(o.window.document.fullscreenElement||o.window.document.mozFullScreenElement||o.window.document.webkitFullscreenElement||o.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())},b.prototype._onClickFullscreen=function(){this._isFullscreen()?o.window.document.exitFullscreen?o.window.document.exitFullscreen():o.window.document.mozCancelFullScreen?o.window.document.mozCancelFullScreen():o.window.document.msExitFullscreen?o.window.document.msExitFullscreen():o.window.document.webkitCancelFullScreen&&o.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 C={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"}
vendor: 6,313 bytes, line 2598
2598,B=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),M=function(l){function d(h){l.call(this),this.options=o.extend(Object.create(C),h),o.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return l&&(d.__proto__=l),(d.prototype=Object.create(l&&l.prototype)).constructor=d,d.prototype.addTo=function(h){return this._map&&this.remove(),this._map=h,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 o.Event("open")),this},d.prototype.isOpen=function(){return!!this._map},d.prototype.remove=function(){return this._content&&f.remove(this._content),this._container&&(f.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 o.Event("close")),this},d.prototype.getLngLat=function(){return this._lngLat},d.prototype.setLngLat=function(h){return this._lngLat=o.LngLat.convert(h),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},d.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},d.prototype.getElement=function(){return this._container},d.prototype.setText=function(h){return this.setDOMContent(o.window.document.createTextNode(h))},d.prototype.setHTML=function(h){var m,T=o.window.document.createDocumentFragment(),P=o.window.document.createElement("body");for(P.innerHTML=h;m=P.firstChild;)T.appendChild(m);return this.setDOMContent(T)},d.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},d.prototype.setMaxWidth=function(h){return this.options.maxWidth=h,this._update(),this},d.prototype.setDOMContent=function(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=f.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this},d.prototype.addClassName=function(h){this._container&&this._container.classList.add(h)},d.prototype.removeClassName=function(h){this._container&&this._container.classList.remove(h)},d.prototype.setOffset=function(h){return this.options.offset=h,this._update(),this},d.prototype.toggleClassName=function(h){if(this._container)return this._container.classList.toggle(h)},d.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=f.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))},d.prototype._onMouseUp=function(h){this._update(h.point)},d.prototype._onMouseMove=function(h){this._update(h.point)},d.prototype._onDrag=function(h){this._update(h.point)},d.prototype._update=function(h){var m=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=f.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=f.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(Z){return m._container.classList.add(Z)}),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=To(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||h)){var T=this._pos=this._trackPointer&&h?h:this._map.project(this._lngLat),P=this.options.anchor,R=function Z(te){if(te){if(typeof te=="number"){var oe=Math.round(Math.sqrt(.5*Math.pow(te,2)));return{center:new o.Point(0,0),top:new o.Point(0,te),"top-left":new o.Point(oe,oe),"top-right":new o.Point(-oe,oe),bottom:new o.Point(0,-te),"bottom-left":new o.Point(oe,-oe),"bottom-right":new o.Point(-oe,-oe),left:new o.Point(te,0),right:new o.Point(-te,0)}}if(te instanceof o.Point||Array.isArray(te)){var we=o.Point.convert(te);return{center:we,top:we,"top-left":we,"top-right":we,bottom:we,"bottom-left":we,"bottom-right":we,left:we,right:we}}return{center:o.Point.convert(te.center||[0,0]),top:o.Point.convert(te.top||[0,0]),"top-left":o.Point.convert(te["top-left"]||[0,0]),"top-right":o.Point.convert(te["top-right"]||[0,0]),bottom:o.Point.convert(te.bottom||[0,0]),"bottom-left":o.Point.convert(te["bottom-left"]||[0,0]),"bottom-right":o.Point.convert(te["bottom-right"]||[0,0]),left:o.Point.convert(te.left||[0,0]),right:o.Point.convert(te.right||[0,0])}}return Z(new o.Point(0,0))}(this.options.offset);if(!P){var L,z=this._container.offsetWidth,X=this._container.offsetHeight;L=T.y+R.bottom.y<X?["top"]:T.y>this._map.transform.height-X?["bottom"]:[],T.x<z/2?L.push("left"):T.x>this._map.transform.width-z/2&&L.push("right"),P=L.length===0?"bottom":L.join("-")}
2598var ee=T.add(R[P]).round();f.setTransform(this._container,Eo[P]+" translate("+ee.x+"px,"+ee.y+"px)"),Jt(this._container,P,"popup")}},d.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var h=this._container.querySelector(B);h&&h.focus()}},d.prototype._onClose=function(){this.remove()},d}(o.Evented),O={version:o.version,supported:c,setRTLTextPlugin:o.setRTLTextPlugin,getRTLTextPluginStatus:o.getRTLTextPluginStatus,Map:Tu,NavigationControl:di,GeolocateControl:ia,AttributionControl:fs,ScaleControl:ys,FullscreenControl:b,Popup:M,Marker:Hc,Style:zn,LngLat:o.LngLat,LngLatBounds:o.LngLatBounds,Point:o.Point,MercatorCoordinate:o.MercatorCoordinate,Evented:o.Evented,config:o.config,prewarm:function(){ht().acquire(Ke)},clearPrewarmedResources:function(){var l=Pt;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(Ke),Pt=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 o.config.ACCESS_TOKEN},set accessToken(l){o.config.ACCESS_TOKEN=l},get baseApiUrl(){return o.config.API_URL},set baseApiUrl(l){o.config.API_URL=l},get workerCount(){return Et.workerCount},set workerCount(l){Et.workerCount=l},get maxParallelImageRequests(){return o.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){o.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage:function(l){o.clearTileCache(l)},workerUrl:""};return O}),i})}(J0)),J0.exports}var kse=Lse();const dl=_h(kse);var Nse=1e-7;function ex(r){return Array.isArray(r)||ArrayBuffer.isView(r)}function e6(r,e){if(r===e)return!0;if(ex(r)&&ex(e)){if(r.length!==e.length)return!1;for(var t=0;t<r.length;++t)if(!e6(r[t],e[t]))return!1;return!0}return Math.abs(r-e)<=Nse}function r0(r,e,t){return Math.max(e,Math.min(t,r))}function k_(r,e,t){return ex(r)?r.map(function(n,i){return k_(n,e[i],t)}):t*e+(1-t)*r}function pc(r,e){if(!r)throw new Error(e||"react-map-gl: assertion failed.")}function zI(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function GI(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zI(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):zI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Qf={minZoom:0,maxZoom:24,minPitch:0,maxPitch:60},Ob={pitch:0,bearing:0,altitude:1.5},VI=5,Use=1.2,wp=function(){function r(e){var t=e.width,n=e.height,i=e.latitude,s=e.longitude,o=e.zoom,c=e.bearing,f=c===void 0?Ob.bearing:c,A=e.pitch,v=A===void 0?Ob.pitch:A,w=e.altitude,S=w===void 0?Ob.altitude:w,F=e.maxZoom,N=F===void 0?Qf.maxZoom:F,U=e.minZoom,$=U===void 0?Qf.minZoom:U,G=e.maxPitch,H=G===void 0?Qf.maxPitch:G,J=e.minPitch,ue=J===void 0?Qf.minPitch:J,q=e.transitionDuration,se=e.transitionEasing,Te=e.transitionInterpolator,Ue=e.transitionInterruption,de=e.startPanLngLat,me=e.startZoomLngLat,pe=e.startRotatePos,W=e.startBearing,re=e.startPitch,Ee=e.startZoom;af(this,r),pc(Number.isFinite(t),"`width` must be supplied"),pc(Number.isFinite(n),"`height` must be supplied"),pc(Number.isFinite(s),"`longitude` must be supplied"),pc(Number.isFinite(i),"`latitude` must be supplied"),pc(Number.isFinite(o),"`zoom` must be supplied"),this._viewportProps=this._applyConstraints({width:t,height:n,latitude:i,longitude:s,zoom:o,bearing:f,pitch:v,altitude:S,maxZoom:N,minZoom:$,maxPitch:H,minPitch:ue,transitionDuration:q,transitionEasing:se,transitionInterpolator:Te,transitionInterruption:Ue}),this._state={startPanLngLat:de,startZoomLngLat:me,startRotatePos:pe,startBearing:W,startPitch:re,startZoom:Ee}}return of(r,[{key:"getViewportProps",value:function(){return this._viewportProps}},{key:"getState",value:function(){return this._state}},{key:"panStart",value:function(t){var n=t.pos;
2598return this._getUpdatedMapState({startPanLngLat:this._unproject(n)})}},{key:"pan",value:function(t){var n=t.pos,i=t.startPos,s=this._state.startPanLngLat||this._unproject(i);if(!s)return this;var o=this._calculateNewLngLat({startPanLngLat:s,pos:n}),c=gs(o,2),f=c[0],A=c[1];return this._getUpdatedMapState({longitude:f,latitude:A})}},{key:"panEnd",value:function(){return this._getUpdatedMapState({startPanLngLat:null})}},{key:"rotateStart",value:function(t){var n=t.pos;return this._getUpdatedMapState({startRotatePos:n,startBearing:this._viewportProps.bearing,startPitch:this._viewportProps.pitch})}},{key:"rotate",value:function(t){var n=t.pos,i=t.deltaAngleX,s=i===void 0?0:i,o=t.deltaAngleY,c=o===void 0?0:o,f=this._state,A=f.startRotatePos,v=f.startBearing,w=f.startPitch;if(!Number.isFinite(v)||!Number.isFinite(w))return this;var S;return n?S=this._calculateNewPitchAndBearing(GI(GI({},this._getRotationParams(n,A)),{},{startBearing:v,startPitch:w})):S={bearing:v+s,pitch:w+c},this._getUpdatedMapState(S)}},{key:"rotateEnd",value:function(){return this._getUpdatedMapState({startBearing:null,startPitch:null})}},{key:"zoomStart",value:function(t){var n=t.pos;return this._getUpdatedMapState({startZoomLngLat:this._unproject(n),startZoom:this._viewportProps.zoom})}},{key:"zoom",value:function(t){var n=t.pos,i=t.startPos,s=t.scale;pc(s>0,"`scale` must be a positive number");var o=this._state,c=o.startZoom,f=o.startZoomLngLat;Number.isFinite(c)||(c=this._viewportProps.zoom,f=this._unproject(i)||this._unproject(n)),pc(f,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var A=this._calculateNewZoom({scale:s,startZoom:c||0}),v=new fl(Object.assign({},this._viewportProps,{zoom:A})),w=v.getMapCenterByLngLatPosition({lngLat:f,pos:n}),S=gs(w,2),F=S[0],N=S[1];return this._getUpdatedMapState({zoom:A,longitude:F,latitude:N})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(t){return new r(Object.assign({},this._viewportProps,this._state,t))}},{key:"_applyConstraints",value:function(t){var n=t.maxZoom,i=t.minZoom,s=t.zoom;t.zoom=r0(s,i,n);var o=t.maxPitch,c=t.minPitch,f=t.pitch;return t.pitch=r0(f,c,o),Object.assign(t,Ese(t)),t}},{key:"_unproject",value:function(t){var n=new fl(this._viewportProps);return t&&n.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var n=t.startPanLngLat,i=t.pos,s=new fl(this._viewportProps);return s.getMapCenterByLngLatPosition({lngLat:n,pos:i})}},{key:"_calculateNewZoom",value:function(t){var n=t.scale,i=t.startZoom,s=this._viewportProps,o=s.maxZoom,c=s.minZoom,f=i+Math.log2(n);return r0(f,c,o)}},{key:"_calculateNewPitchAndBearing",value:function(t){var n=t.deltaScaleX,i=t.deltaScaleY,s=t.startBearing,o=t.startPitch;i=r0(i,-1,1);var c=this._viewportProps,f=c.minPitch,A=c.maxPitch,v=s+180*n,w=o;return i>0?w=o+i*(A-o):i<0&&(w=o-i*(f-o)),{pitch:w,bearing:v}}},{key:"_getRotationParams",value:function(t,n){var i=t[0]-n[0],s=t[1]-n[1],o=t[1],c=n[1],f=this._viewportProps,A=f.width,v=f.height,w=i/A,S=0;return s>0?Math.abs(v-c)>VI&&(S=s/(c-v)*Use):s<0&&c>VI&&(S=1-o/c),S=Math.min(1,Math.max(-1,S)),{deltaScaleX:w,deltaScaleY:S}}}]),r}();function zse(r){return r[0].toLowerCase()+r.slice(1)}function Gse(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qf;for(var t in e){var n=t.slice(0,3),i=zse(t.slice(3));if(n==="min"&&r[i]<e[t]||n==="max"&&r[i]>e[t])return!1}return!0}function HI(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function jI(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?HI(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):HI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Th=It.createContext({viewport:null,map:null,container:null,onViewportChange:null,onViewStateChange:null,eventManager:null}),rC=Th.Provider;function Vse(r){var e=r.value,t=r.children,n=It.useState(null),i=gs(n,2),s=i[0],o=i[1],c=It.useContext(Th);return e=jI(jI({setMap:o},c),{},{map:c&&c.map||s},e),It.createElement(rC,{value:e},t)}Th.Provider=Vse;var tx=typeof window<"u"?It.useLayoutEffect:It.useEffect;function $I(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function dc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2598e%2?$I(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):$I(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Hse="https://visgl.github.io/react-map-gl/docs/get-started/mapbox-tokens",t6="A valid API access token is required to use Mapbox data";function jse(){}function r6(r){var e=r.props,t=r.width,n=r.height;return new fl(dc(dc(dc({},e),e.viewState),{},{width:t,height:n}))}var $se=401,WI={position:"absolute",width:"100%",height:"100%",overflow:"hidden"},Wse=Object.assign({},Ch.propTypes,{width:At.oneOfType([At.number,At.string]),height:At.oneOfType([At.number,At.string]),onResize:At.func,disableTokenWarning:At.bool,visible:At.bool,className:At.string,style:At.object,visibilityConstraints:At.object}),Jse=Object.assign({},Ch.defaultProps,{disableTokenWarning:!1,visible:!0,onResize:jse,className:"",style:null,visibilityConstraints:Qf});function Xse(){var r={position:"absolute",left:0,top:0};return It.createElement("div",{key:"warning",id:"no-token-warning",style:r},It.createElement("h3",{key:"header"},t6),It.createElement("div",{key:"text"},"For information on setting up your basemap, read"),It.createElement("a",{key:"link",href:Hse},"Note on Map Tokens"))}function Kse(r){return{getMap:function(){return r.current&&r.current.getMap()},queryRenderedFeatures:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.current&&r.current.getMap();return i&&i.queryRenderedFeatures(t,n)}}}var nu=It.forwardRef(function(r,e){var t=It.useState(!0),n=gs(t,2),i=n[0],s=n[1],o=It.useState({width:0,height:0}),c=gs(o,2),f=c[0],A=c[1],v=It.useRef(null),w=It.useRef(null),S=It.useRef(null),F=It.useRef(null),N=It.useContext(Th);tx(function(){if(nu.supported()){var me=new Ch(dc(dc(dc({},r),f),{},{mapboxgl:dl,container:w.current,onError:function(re){var Ee=re.error&&re.error.status||re.status;Ee===$se&&i&&(console.error(t6),s(!1)),r.onError(re)}}));v.current=me,N&&N.setMap&&N.setMap(me.getMap());var pe=new c5(function(W){if(W[0].contentRect){var re=W[0].contentRect,Ee=re.width,et=re.height;A({width:Ee,height:et}),r.onResize({width:Ee,height:et})}});return pe.observe(S.current),function(){me.finalize(),v.current=null,pe.disconnect()}}},[]),tx(function(){v.current&&v.current.setProps(dc(dc({},r),f))});var U=v.current&&v.current.getMap();It.useImperativeHandle(e,function(){return Kse(v)},[]);var $=It.useCallback(function(me){var pe=me.target;pe===F.current&&pe.scrollTo(0,0)},[]),G=U&&It.createElement(rC,{value:dc(dc({},N),{},{viewport:N.viewport||r6(dc({map:U,props:r},f)),map:U,container:N.container||S.current})},It.createElement("div",{key:"map-overlays",className:"overlays",ref:F,style:WI,onScroll:$},r.children)),H=r.className,J=r.width,ue=r.height,q=r.style,se=r.visibilityConstraints,Te=Object.assign({position:"relative"},q,{width:J,height:ue}),Ue=r.visible&&Gse(r.viewState||r,se),de=Object.assign({},WI,{visibility:Ue?"inherit":"hidden"});return It.createElement("div",{key:"map-container",ref:S,style:Te},It.createElement("div",{key:"map-mapbox",ref:w,style:de,className:H}),G,!i&&!r.disableTokenWarning&&It.createElement(Xse,null))});nu.supported=function(){return dl&&dl.supported()};nu.propTypes=Wse;nu.defaultProps=Jse;function qse(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=Yse(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(A){throw A},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2599In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,c;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,c=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw c}}}}function Yse(r,e){if(r){if(typeof r=="string")return JI(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);
2599if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return JI(r,e)}}function JI(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var n6=function(){function r(){af(this,r),Tr(this,"propNames",[])}return of(r,[{key:"arePropsEqual",value:function(t,n){var i=qse(this.propNames||[]),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;if(!e6(t[o],n[o]))return!1}}catch(c){i.e(c)}finally{i.f()}return!0}},{key:"initializeProps",value:function(t,n){return{start:t,end:n}}},{key:"interpolateProps",value:function(t,n,i){pc(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,n){return n.transitionDuration}}]),r}(),Zse={longitude:1,bearing:1};function N_(r){return Number.isFinite(r)||Array.isArray(r)}function Qse(r){return r in Zse}function rx(r,e,t){return Qse(r)&&Math.abs(t-e)>180&&(t=t<0?t+360:t-360),t}function Lb(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=eoe(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(A){throw A},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2600In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,c;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,c=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw c}}}}function eoe(r,e){if(r){if(typeof r=="string")return XI(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return XI(r,e)}}function XI(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function toe(r){var e=roe();return function(){var n=Bp(r),i;if(e){var s=Bp(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return zx(this,i)}}function roe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var noe=["longitude","latitude","zoom","bearing","pitch"],ioe=["latitude","longitude","zoom","width","height"],KI=["bearing","pitch"],soe={speed:1.2,curve:1.414};(function(r){Ux(t,r);var e=toe(t);function t(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return af(this,t),n=e.call(this),Tr(zu(n),"propNames",noe),n.props=Object.assign({},soe,i),n}return of(t,[{key:"initializeProps",value:function(i,s){var o={},c={},f=Lb(ioe),A;try{for(f.s();!(A=f.n()).done;){var v=A.value,w=i[v],S=s[v];pc(N_(w)&&N_(S),"".concat(v," must be supplied for transition")),o[v]=w,c[v]=rx(v,w,S)}}catch(H){f.e(H)}finally{f.f()}var F=Lb(KI),N;try{for(F.s();!(N=F.n()).done;){var U=N.value,$=i[U]||0,G=s[U]||0;o[U]=$,c[U]=rx(U,$,G)}}catch(H){F.e(H)}finally{F.f()}return{start:o,end:c}}},{key:"interpolateProps",value:function(i,s,o){var c=Sse(i,s,o,this.props),f=Lb(KI),A;try{for(f.s();!(A=f.n()).done;){var v=A.value;c[v]=k_(i[v],s[v],o)}}catch(w){f.e(w)}finally{f.f()}return c}},{key:"getDuration",value:function(i,s){var o=s.transitionDuration;return o==="auto"&&(o=Ise(i,s,this.props)),o}}]),t})(n6);function qI(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=ooe(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(A){throw A},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2601In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,c;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,c=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw c}}}}function ooe(r,e){if(r){if(typeof r=="string")return YI(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);
2601if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return YI(r,e)}}function YI(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function aoe(r){var e=coe();return function(){var n=Bp(r),i;if(e){var s=Bp(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return zx(this,i)}}function coe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var loe=["longitude","latitude","zoom","bearing","pitch"],ug=function(r){Ux(t,r);var e=aoe(t);function t(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return af(this,t),n=e.call(this),Array.isArray(i)&&(i={transitionProps:i}),n.propNames=i.transitionProps||loe,i.around&&(n.around=i.around),n}return of(t,[{key:"initializeProps",value:function(i,s){var o={},c={};if(this.around){o.around=this.around;var f=new fl(i).unproject(this.around);Object.assign(c,s,{around:new fl(s).project(f),aroundLngLat:f})}var A=qI(this.propNames),v;try{for(A.s();!(v=A.n()).done;){var w=v.value,S=i[w],F=s[w];pc(N_(S)&&N_(F),"".concat(w," must be supplied for transition")),o[w]=S,c[w]=rx(w,S,F)}}catch(N){A.e(N)}finally{A.f()}return{start:o,end:c}}},{key:"interpolateProps",value:function(i,s,o){var c={},f=qI(this.propNames),A;try{for(f.s();!(A=f.n()).done;){var v=A.value;c[v]=k_(i[v],s[v],o)}}catch(U){f.e(U)}finally{f.f()}if(s.around){var w=new fl(Object.assign({},s,c)).getMapCenterByLngLatPosition({lngLat:s.aroundLngLat,pos:k_(i.around,s.around,o)}),S=gs(w,2),F=S[0],N=S[1];c.longitude=F,c.latitude=N}return c}}]),t}(n6),fg=function(){};function uoe(r,e){var t=r(e);return function(n){return 1/(1-t)*(r(n*(1-e)+e)-t)}}var hg={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},foe={transitionDuration:0,transitionEasing:function(e){return e},transitionInterpolator:new ug,transitionInterruption:hg.BREAK,onTransitionStart:fg,onTransitionInterrupt:fg,onTransitionEnd:fg},nC=function(){function r(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};af(this,r),Tr(this,"_animationFrame",null),Tr(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=t.onViewportChange||fg,this.onStateChange=t.onStateChange||fg,this.time=t.getTime||Date.now}return of(r,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(t){var n=this.props;if(this.props=t,!n||this._shouldIgnoreViewportChange(n,t))return!1;if(this._isTransitionEnabled(t)){var i=Object.assign({},n),s=Object.assign({},t);if(this._isTransitionInProgress()&&(n.onTransitionInterrupt(),this.state.interruption===hg.SNAP_TO_END?Object.assign(i,this.state.endProps):Object.assign(i,this.state.propsInTransition),this.state.interruption===hg.UPDATE)){var o=this.time(),c=(o-this.state.startTime)/this.state.duration;s.transitionDuration=this.state.duration-(o-this.state.startTime),s.transitionEasing=uoe(this.state.easing,c),s.transitionInterpolator=i.transitionInterpolator}return s.onTransitionStart(),this._triggerTransition(i,s),!0}return this._isTransitionInProgress()&&(n.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return!!this._animationFrame}},{key:"_isTransitionEnabled",value:function(t){var n=t.transitionDuration,i=t.transitionInterpolator;return(n>0||n==="auto")&&!!i}},{key:"_isUpdateDueToCurrentTransition",value:function(t){return this.state.propsInTransition?this.state.interpolator.arePropsEqual(t,this.state.propsInTransition):!1}},{key:"_shouldIgnoreViewportChange",value:function(t,n){return t?this._isTransitionInProgress()?this.state.interruption===hg.IGNORE||this._isUpdateDueToCurrentTransition(n):this._isTransitionEnabled(n)?n.transitionInterpolator.arePropsEqual(t,n):!0:!0}},{key:"_triggerTransition",value:function(t,n){pc(this._isTransitionEnabled(n)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var i=n.transitionInterpolator,s=i.getDuration?i.getDuration(t,n):n.transitionDuration;if(s!==0){var o=n.transitionInterpolator.initializeProps(t,n),c={inTransition:!0,isZooming:t.zoom!==n.zoom,isPanning:t.longitude!==n.longitude||t.latitude!==n.latitude,isRotating:t.bearing!==n.bearing||t.pitch!==n.pitch};this.state={duration:s,easing:n.transitionEasing,interpolator:n.transitionInterpolator,interruption:n.transitionInterruption,startTime:this.time(),startProps:o.start,endProps:o.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(c)}}},{key:"_endTransition",value:function(){this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=null),this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1})}},{key:"_updateViewport",value:function(){var t=this.time(),n=this.state,i=n.startTime,s=n.duration,o=n.easing,c=n.interpolator,f=n.startProps,A=n.endProps,v=!1,w=(t-i)/s;w>=1&&(w=1,v=!0),w=o(w);var S=c.interpolateProps(f,A,w),F=new wp(Object.assign({},this.props,S));this.state.propsInTransition=F.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),v&&(this._endTransition(),this.props.onTransitionEnd())}}]),r}();Tr(nC,"defaultProps",foe);var kb={exports:{}};var ZI;function hoe(){return ZI||(ZI=1,function(r){(function(e,t,n,i){var s=["","webkit","Moz","MS","ms","o"],o=t.createElement("div"),c="function",f=Math.round,A=Math.abs,v=Date.now;function w(xe,Pe,$e){return setTimeout(J(xe,$e),Pe)}function S(xe,Pe,$e){return Array.isArray(xe)?(F(xe,$e[Pe],$e),!0):!1}function F(xe,Pe,$e){var gt;if(xe)if(xe.forEach)xe.forEach(Pe,$e);else if(xe.length!==i)for(gt=0;gt<xe.length;)Pe.call($e,xe[gt],gt,xe),gt++;else for(gt in xe)xe.hasOwnProperty(gt)&&Pe.call($e,xe[gt],gt,xe)}function N(xe,Pe,$e){var gt="DEPRECATED METHOD: "+Pe+`
2602`+$e+` AT 
2603`;return function(){var Wt=new Error("get-stack-trace"),vr=Wt&&Wt.stack?Wt.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Ir=e.console&&(e.console.warn||e.console.log);return Ir&&Ir.call(e.console,gt,vr),xe.apply(this,arguments)}}var U;typeof Object.assign!="function"?U=function(Pe){if(Pe===i||Pe===null)throw new TypeError("Cannot convert undefined or null to object");for(var $e=Object(Pe),gt=1;gt<arguments.length;gt++){var Wt=arguments[gt];if(Wt!==i&&Wt!==null)for(var vr in Wt)Wt.hasOwnProperty(vr)&&($e[vr]=Wt[vr])}return $e}:U=Object.assign;var $=N(function(Pe,$e,gt){for(var Wt=Object.keys($e),vr=0;vr<Wt.length;)(!gt||gt&&Pe[Wt[vr]]===i)&&(Pe[Wt[vr]]=$e[Wt[vr]]),vr++;return Pe},"extend","Use `assign`."),G=N(function(Pe,$e){return $(Pe,$e,!0)},"merge","Use `assign`.");function H(xe,Pe,$e){var gt=Pe.prototype,Wt;Wt=xe.prototype=Object.create(gt),Wt.constructor=xe,Wt._super=gt,$e&&U(Wt,$e)}function J(xe,Pe){return function(){return xe.apply(Pe,arguments)}}function ue(xe,Pe){return typeof xe==c?xe.apply(Pe&&Pe[0]||i,Pe):xe}function q(xe,Pe){return xe===i?Pe:xe}
vendor: 28,618 bytes, line 2603
2603function se(xe,Pe,$e){F(me(Pe),function(gt){xe.addEventListener(gt,$e,!1)})}function Te(xe,Pe,$e){F(me(Pe),function(gt){xe.removeEventListener(gt,$e,!1)})}function Ue(xe,Pe){for(;xe;){if(xe==Pe)return!0;xe=xe.parentNode}return!1}function de(xe,Pe){return xe.indexOf(Pe)>-1}function me(xe){return xe.trim().split(/\s+/g)}function pe(xe,Pe,$e){if(xe.indexOf&&!$e)return xe.indexOf(Pe);for(var gt=0;gt<xe.length;){if($e&&xe[gt][$e]==Pe||!$e&&xe[gt]===Pe)return gt;gt++}return-1}function W(xe){return Array.prototype.slice.call(xe,0)}function re(xe,Pe,$e){for(var gt=[],Wt=[],vr=0;vr<xe.length;){var Ir=xe[vr][Pe];pe(Wt,Ir)<0&&gt.push(xe[vr]),Wt[vr]=Ir,vr++}return gt=gt.sort(function(Li,Ji){return Li[Pe]>Ji[Pe]}),gt}function Ee(xe,Pe){for(var $e,gt,Wt=Pe[0].toUpperCase()+Pe.slice(1),vr=0;vr<s.length;){if($e=s[vr],gt=$e?$e+Wt:Pe,gt in xe)return gt;vr++}return i}var et=1;function _e(){return et++}function Le(xe){var Pe=xe.ownerDocument||xe;return Pe.defaultView||Pe.parentWindow||e}var Ge=/mobile|tablet|ip(ad|hone|od)|android/i,Ze="ontouchstart"in e,tt=Ee(e,"PointerEvent")!==i,rt=Ze&&Ge.test(navigator.userAgent),ut="touch",vt="pen",St="mouse",st="kinect",dr=25,er=1,Kt=2,Nt=4,Ar=8,ln=1,Pr=2,xr=4,Vn=8,_r=16,yr=Pr|xr,un=Vn|_r,Dr=yr|un,ci=["x","y"],Yn=["clientX","clientY"];function mn(xe,Pe){var $e=this;this.manager=xe,this.callback=Pe,this.element=xe.element,this.target=xe.options.inputTarget,this.domHandler=function(gt){ue(xe.options.enable,[xe])&&$e.handler(gt)},this.init()}mn.prototype={handler:function(){},init:function(){this.evEl&&se(this.element,this.evEl,this.domHandler),this.evTarget&&se(this.target,this.evTarget,this.domHandler),this.evWin&&se(Le(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&Te(this.element,this.evEl,this.domHandler),this.evTarget&&Te(this.target,this.evTarget,this.domHandler),this.evWin&&Te(Le(this.element),this.evWin,this.domHandler)}};function ti(xe){var Pe,$e=xe.options.inputClass;return $e?Pe=$e:tt?Pe=Ce:rt?Pe=he:Ze?Pe=g:Pe=Gt,new Pe(xe,Hn)}function Hn(xe,Pe,$e){var gt=$e.pointers.length,Wt=$e.changedPointers.length,vr=Pe&er&&gt-Wt===0,Ir=Pe&(Nt|Ar)&&gt-Wt===0;$e.isFirst=!!vr,$e.isFinal=!!Ir,vr&&(xe.session={}),$e.eventType=Pe,Bn(xe,$e),xe.emit("hammer.input",$e),xe.recognize($e),xe.session.prevInput=$e}function Bn(xe,Pe){var $e=xe.session,gt=Pe.pointers,Wt=gt.length;$e.firstInput||($e.firstInput=mr(Pe)),Wt>1&&!$e.firstMultiple?$e.firstMultiple=mr(Pe):Wt===1&&($e.firstMultiple=!1);var vr=$e.firstInput,Ir=$e.firstMultiple,fi=Ir?Ir.center:vr.center,Li=Pe.center=Rr(gt);Pe.timeStamp=v(),Pe.deltaTime=Pe.timeStamp-vr.timeStamp,Pe.angle=kt(fi,Li),Pe.distance=Me(fi,Li),Zn($e,Pe),Pe.offsetDirection=_i(Pe.deltaX,Pe.deltaY);var Ji=nn(Pe.deltaTime,Pe.deltaX,Pe.deltaY);Pe.overallVelocityX=Ji.x,Pe.overallVelocityY=Ji.y,Pe.overallVelocity=A(Ji.x)>A(Ji.y)?Ji.x:Ji.y,Pe.scale=Ir?lr(Ir.pointers,gt):1,Pe.rotation=Ir?$t(Ir.pointers,gt):0,Pe.maxPointers=$e.prevInput?Pe.pointers.length>$e.prevInput.maxPointers?Pe.pointers.length:$e.prevInput.maxPointers:Pe.pointers.length,Vt($e,Pe);var Qs=xe.element;Ue(Pe.srcEvent.target,Qs)&&(Qs=Pe.srcEvent.target),Pe.target=Qs}function Zn(xe,Pe){var $e=Pe.center,gt=xe.offsetDelta||{},Wt=xe.prevDelta||{},vr=xe.prevInput||{};(Pe.eventType===er||vr.eventType===Nt)&&(Wt=xe.prevDelta={x:vr.deltaX||0,y:vr.deltaY||0},gt=xe.offsetDelta={x:$e.x,y:$e.y}),Pe.deltaX=Wt.x+($e.x-gt.x),Pe.deltaY=Wt.y+($e.y-gt.y)}function Vt(xe,Pe){var $e=xe.lastInterval||Pe,gt=Pe.timeStamp-$e.timeStamp,Wt,vr,Ir,fi;if(Pe.eventType!=Ar&&(gt>dr||$e.velocity===i)){var Li=Pe.deltaX-$e.deltaX,Ji=Pe.deltaY-$e.deltaY,Qs=nn(gt,Li,Ji);vr=Qs.x,Ir=Qs.y,Wt=A(Qs.x)>A(Qs.y)?Qs.x:Qs.y,fi=_i(Li,Ji),xe.lastInterval=Pe}else Wt=$e.velocity,vr=$e.velocityX,Ir=$e.velocityY,fi=$e.direction;Pe.velocity=Wt,Pe.velocityX=vr,Pe.velocityY=Ir,Pe.direction=fi}function mr(xe){for(var Pe=[],$e=0;$e<xe.pointers.length;)Pe[$e]={clientX:f(xe.pointers[$e].clientX),clientY:f(xe.pointers[$e].clientY)},$e++;return{timeStamp:v(),pointers:Pe,center:Rr(Pe),deltaX:xe.deltaX,deltaY:xe.deltaY}}function Rr(xe){var Pe=xe.length;if(Pe===1)return{x:f(xe[0].clientX),y:f(xe[0].clientY)};for(var $e=0,gt=0,Wt=0;Wt<Pe;)$e+=xe[Wt].clientX,gt+=xe[Wt].clientY,Wt++;return{x:f($e/Pe),y:f(gt/Pe)}}function nn(xe,Pe,$e){return{x:Pe/xe||0,y:$e/xe||0}}function _i(xe,Pe){return xe===Pe?ln:A(xe)>=A(Pe)?xe<0?Pr:xr:Pe<0?Vn:_r}function Me(xe,Pe,$e){$e||($e=ci);var gt=Pe[$e[0]]-xe[$e[0]],Wt=Pe[$e[1]]-xe[$e[1]];return Math.sqrt(gt*gt+Wt*Wt)}function kt(xe,Pe,$e){$e||($e=ci);var gt=Pe[$e[0]]-xe[$e[0]],Wt=Pe[$e[1]]-xe[$e[1]];return Math.atan2(Wt,gt)*180/Math.PI}function $t(xe,Pe){return kt(Pe[1],Pe[0],Yn)+kt(xe[1],xe[0],Yn)}function lr(xe,Pe){return Me(Pe[0],Pe[1],Yn)/Me(xe[0],xe[1],Yn)}var Ye={mousedown:er,mousemove:Kt,mouseup:Nt},Rt="mousedown",Ae="mousemove mouseup";function Gt(){this.evEl=Rt,this.evWin=Ae,this.pressed=!1,mn.apply(this,arguments)}H(Gt,mn,{handler:function(Pe){var $e=Ye[Pe.type];$e&er&&Pe.button===0&&(this.pressed=!0),$e&Kt&&Pe.which!==1&&($e=Nt),this.pressed&&($e&Nt&&(this.pressed=!1),this.callback(this.manager,$e,{pointers:[Pe],changedPointers:[Pe],pointerType:St,srcEvent:Pe}))}});var Tt={pointerdown:er,pointermove:Kt,pointerup:Nt,pointercancel:Ar,pointerout:Ar},j={2:ut,3:vt,4:St,5:st},bt="pointerdown",Bt="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(bt="MSPointerDown",Bt="MSPointerMove MSPointerUp MSPointerCancel");function Ce(){this.evEl=bt,this.evWin=Bt,mn.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}H(Ce,mn,{handler:function(Pe){var $e=this.store,gt=!1,Wt=Pe.type.toLowerCase().replace("ms",""),vr=Tt[Wt],Ir=j[Pe.pointerType]||Pe.pointerType,fi=Ir==ut,Li=pe($e,Pe.pointerId,"pointerId");vr&er&&(Pe.button===0||fi)?Li<0&&($e.push(Pe),Li=$e.length-1):vr&(Nt|Ar)&&(gt=!0),!(Li<0)&&($e[Li]=Pe,this.callback(this.manager,vr,{pointers:$e,changedPointers:[Pe],pointerType:Ir,srcEvent:Pe}),gt&&$e.splice(Li,1))}});var Je={touchstart:er,touchmove:Kt,touchend:Nt,touchcancel:Ar},lt="touchstart",Y="touchstart touchmove touchend touchcancel";function ne(){this.evTarget=lt,this.evWin=Y,this.started=!1,mn.apply(this,arguments)}H(ne,mn,{handler:function(Pe){var $e=Je[Pe.type];if($e===er&&(this.started=!0),!!this.started){var gt=le.call(this,Pe,$e);$e&(Nt|Ar)&&gt[0].length-gt[1].length===0&&(this.started=!1),this.callback(this.manager,$e,{pointers:gt[0],changedPointers:gt[1],pointerType:ut,srcEvent:Pe})}}});function le(xe,Pe){var $e=W(xe.touches),gt=W(xe.changedTouches);return Pe&(Nt|Ar)&&($e=re($e.concat(gt),"identifier")),[$e,gt]}var ve={touchstart:er,touchmove:Kt,touchend:Nt,touchcancel:Ar},Oe="touchstart touchmove touchend touchcancel";function he(){this.evTarget=Oe,this.targetIds={},mn.apply(this,arguments)}H(he,mn,{handler:function(Pe){var $e=ve[Pe.type],gt=be.call(this,Pe,$e);gt&&this.callback(this.manager,$e,{pointers:gt[0],changedPointers:gt[1],pointerType:ut,srcEvent:Pe})}});function be(xe,Pe){var $e=W(xe.touches),gt=this.targetIds;if(Pe&(er|Kt)&&$e.length===1)return gt[$e[0].identifier]=!0,[$e,$e];var Wt,vr,Ir=W(xe.changedTouches),fi=[],Li=this.target;if(vr=$e.filter(function(Ji){return Ue(Ji.target,Li)}),Pe===er)for(Wt=0;Wt<vr.length;)gt[vr[Wt].identifier]=!0,Wt++;for(Wt=0;Wt<Ir.length;)gt[Ir[Wt].identifier]&&fi.push(Ir[Wt]),Pe&(Nt|Ar)&&delete gt[Ir[Wt].identifier],Wt++;if(fi.length)return[re(vr.concat(fi),"identifier"),fi]}var ae=2500,Be=25;function g(){mn.apply(this,arguments);var xe=J(this.handler,this);this.touch=new he(this.manager,xe),this.mouse=new Gt(this.manager,xe),this.primaryTouch=null,this.lastTouches=[]}H(g,mn,{handler:function(Pe,$e,gt){var Wt=gt.pointerType==ut,vr=gt.pointerType==St;if(!(vr&&gt.sourceCapabilities&&gt.sourceCapabilities.firesTouchEvents)){if(Wt)ce.call(this,$e,gt);else if(vr&&Ke.call(this,gt))return;this.callback(Pe,$e,gt)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ce(xe,Pe){xe&er?(this.primaryTouch=Pe.changedPointers[0].identifier,xt.call(this,Pe)):xe&(Nt|Ar)&&xt.call(this,Pe)}function xt(xe){var Pe=xe.changedPointers[0];if(Pe.identifier===this.primaryTouch){var $e={x:Pe.clientX,y:Pe.clientY};this.lastTouches.push($e);var gt=this.lastTouches,Wt=function(){var vr=gt.indexOf($e);vr>-1&&gt.splice(vr,1)};setTimeout(Wt,ae)}}function Ke(xe){for(var Pe=xe.srcEvent.clientX,$e=xe.srcEvent.clientY,gt=0;gt<this.lastTouches.length;gt++){var Wt=this.lastTouches[gt],vr=Math.abs(Pe-Wt.x),Ir=Math.abs($e-Wt.y);if(vr<=Be&&Ir<=Be)return!0}return!1}var Et=Ee(o.style,"touchAction"),Pt=Et!==i,Ot="compute",ht="auto",Lt="manipulation",Mt="none",Ht="pan-x",Ur="pan-y",Qt=Wr();function en(xe,Pe){this.manager=xe,this.set(Pe)}en.prototype={set:function(xe){xe==Ot&&(xe=this.compute()),Pt&&this.manager.element.style&&Qt[xe]&&(this.manager.element.style[Et]=xe),this.actions=xe.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var xe=[];return F(this.manager.recognizers,function(Pe){ue(Pe.options.enable,[Pe])&&(xe=xe.concat(Pe.getTouchAction()))}),cn(xe.join(" "))},preventDefaults:function(xe){var Pe=xe.srcEvent,$e=xe.offsetDirection;if(this.manager.session.prevented){Pe.preventDefault();return}var gt=this.actions,Wt=de(gt,Mt)&&!Qt[Mt],vr=de(gt,Ur)&&!Qt[Ur],Ir=de(gt,Ht)&&!Qt[Ht];if(Wt){var fi=xe.pointers.length===1,Li=xe.distance<2,Ji=xe.deltaTime<250;if(fi&&Li&&Ji)return}if(!(Ir&&vr)&&(Wt||vr&&$e&yr||Ir&&$e&un))return this.preventSrc(Pe)},preventSrc:function(xe){this.manager.session.prevented=!0,xe.preventDefault()}};function cn(xe){if(de(xe,Mt))return Mt;var Pe=de(xe,Ht),$e=de(xe,Ur);return Pe&&$e?Mt:Pe||$e?Pe?Ht:Ur:de(xe,Lt)?Lt:ht}function Wr(){if(!Pt)return!1;var xe={},Pe=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function($e){xe[$e]=Pe?e.CSS.supports("touch-action",$e):!0}),xe}var Jr=1,Vr=2,yi=4,Xr=8,pr=Xr,Ie=16,Xt=32;function tn(xe){this.options=U({},this.defaults,xe||{}),this.id=_e(),this.manager=null,this.options.enable=q(this.options.enable,!0),this.state=Jr,this.simultaneous={},this.requireFail=[]}tn.prototype={defaults:{},set:function(xe){return U(this.options,xe),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(xe){if(S(xe,"recognizeWith",this))return this;var Pe=this.simultaneous;return xe=li(xe,this),Pe[xe.id]||(Pe[xe.id]=xe,xe.recognizeWith(this)),this},dropRecognizeWith:function(xe){return S(xe,"dropRecognizeWith",this)?this:(xe=li(xe,this),delete this.simultaneous[xe.id],this)},requireFailure:function(xe){if(S(xe,"requireFailure",this))return this;var Pe=this.requireFail;return xe=li(xe,this),pe(Pe,xe)===-1&&(Pe.push(xe),xe.requireFailure(this)),this},dropRequireFailure:function(xe){if(S(xe,"dropRequireFailure",this))return this;xe=li(xe,this);var Pe=pe(this.requireFail,xe);return Pe>-1&&this.requireFail.splice(Pe,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(xe){return!!this.simultaneous[xe.id]},emit:function(xe){var Pe=this,$e=this.state;function gt(Wt){Pe.manager.emit(Wt,xe)}$e<Xr&&gt(Pe.options.event+$i($e)),gt(Pe.options.event),xe.additionalEvent&&gt(xe.additionalEvent),$e>=Xr&&gt(Pe.options.event+$i($e))},tryEmit:function(xe){if(this.canEmit())return this.emit(xe);this.state=Xt},canEmit:function(){for(var xe=0;xe<this.requireFail.length;){if(!(this.requireFail[xe].state&(Xt|Jr)))return!1;xe++}return!0},recognize:function(xe){var Pe=U({},xe);if(!ue(this.options.enable,[this,Pe])){this.reset(),this.state=Xt;return}this.state&(pr|Ie|Xt)&&(this.state=Jr),this.state=this.process(Pe),this.state&(Vr|yi|Xr|Ie)&&this.tryEmit(Pe)},process:function(xe){},getTouchAction:function(){},reset:function(){}};function $i(xe){return xe&Ie?"cancel":xe&Xr?"end":xe&yi?"move":xe&Vr?"start":""}function ya(xe){return xe==_r?"down":xe==Vn?"up":xe==Pr?"left":xe==xr?"right":""}function li(xe,Pe){var $e=Pe.manager;return $e?$e.get(xe):xe}function jn(){tn.apply(this,arguments)}H(jn,tn,{defaults:{pointers:1},attrTest:function(xe){var Pe=this.options.pointers;return Pe===0||xe.pointers.length===Pe},process:function(xe){var Pe=this.state,$e=xe.eventType,gt=Pe&(Vr|yi),Wt=this.attrTest(xe);return gt&&($e&Ar||!Wt)?Pe|Ie:gt||Wt?$e&Nt?Pe|Xr:Pe&Vr?Pe|yi:Vr:Xt}});function Se(){jn.apply(this,arguments),this.pX=null,this.pY=null}H(Se,jn,{defaults:{event:"pan",threshold:10,pointers:1,direction:Dr},getTouchAction:function(){var xe=this.options.direction,Pe=[];return xe&yr&&Pe.push(Ur),xe&un&&Pe.push(Ht),Pe},directionTest:function(xe){var Pe=this.options,$e=!0,gt=xe.distance,Wt=xe.direction,vr=xe.deltaX,Ir=xe.deltaY;return Wt&Pe.direction||(Pe.direction&yr?(Wt=vr===0?ln:vr<0?Pr:xr,$e=vr!=this.pX,gt=Math.abs(xe.deltaX)):(Wt=Ir===0?ln:Ir<0?Vn:_r,$e=Ir!=this.pY,gt=Math.abs(xe.deltaY))),xe.direction=Wt,$e&&gt>Pe.threshold&&Wt&Pe.direction},attrTest:function(xe){return jn.prototype.attrTest.call(this,xe)&&(this.state&Vr||!(this.state&Vr)&&this.directionTest(xe))},emit:function(xe){this.pX=xe.deltaX,this.pY=xe.deltaY;var Pe=ya(xe.direction);Pe&&(xe.additionalEvent=this.options.event+Pe),this._super.emit.call(this,xe)}});function $o(){jn.apply(this,arguments)}H($o,jn,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Mt]},attrTest:function(xe){return this._super.attrTest.call(this,xe)&&(Math.abs(xe.scale-1)>this.options.threshold||this.state&Vr)},emit:function(xe){if(xe.scale!==1){var Pe=xe.scale<1?"in":"out";xe.additionalEvent=this.options.event+Pe}this._super.emit.call(this,xe)}});function $n(){tn.apply(this,arguments),this._timer=null,this._input=null}H($n,tn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ht]},process:function(xe){var Pe=this.options,$e=xe.pointers.length===Pe.pointers,gt=xe.distance<Pe.threshold,Wt=xe.deltaTime>Pe.time;if(this._input=xe,!gt||!$e||xe.eventType&(Nt|Ar)&&!Wt)this.reset();else if(xe.eventType&er)this.reset(),this._timer=w(function(){this.state=pr,this.tryEmit()},Pe.time,this);else if(xe.eventType&Nt)return pr;return Xt},reset:function(){clearTimeout(this._timer)},emit:function(xe){this.state===pr&&(xe&&xe.eventType&Nt?this.manager.emit(this.options.event+"up",xe):(this._input.timeStamp=v(),this.manager.emit(this.options.event,this._input)))}});function Wo(){jn.apply(this,arguments)}H(Wo,jn,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Mt]},attrTest:function(xe){return this._super.attrTest.call(this,xe)&&(Math.abs(xe.rotation)>this.options.threshold||this.state&Vr)}});function Oi(){jn.apply(this,arguments)}H(Oi,jn,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:yr|un,pointers:1},getTouchAction:function(){return Se.prototype.getTouchAction.call(this)},attrTest:function(xe){var Pe=this.options.direction,$e;return Pe&(yr|un)?$e=xe.overallVelocity:Pe&yr?$e=xe.overallVelocityX:Pe&un&&($e=xe.overallVelocityY),this._super.attrTest.call(this,xe)&&Pe&xe.offsetDirection&&xe.distance>this.options.threshold&&xe.maxPointers==this.options.pointers&&A($e)>this.options.velocity&&xe.eventType&Nt},emit:function(xe){var Pe=ya(xe.offsetDirection);Pe&&this.manager.emit(this.options.event+Pe,xe),this.manager.emit(this.options.event,xe)}});function ui(){tn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}H(ui,tn,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Lt]},process:function(xe){var Pe=this.options,$e=xe.pointers.length===Pe.pointers,gt=xe.distance<Pe.threshold,Wt=xe.deltaTime<Pe.time;if(this.reset(),xe.eventType&er&&this.count===0)return this.failTimeout();if(gt&&Wt&&$e){if(xe.eventType!=Nt)return this.failTimeout();var vr=this.pTime?xe.timeStamp-this.pTime<Pe.interval:!0,Ir=!this.pCenter||Me(this.pCenter,xe.center)<Pe.posThreshold;this.pTime=xe.timeStamp,this.pCenter=xe.center,!Ir||!vr?this.count=1:this.count+=1,this._input=xe;var fi=this.count%Pe.taps;if(fi===0)return this.hasRequireFailures()?(this._timer=w(function(){this.state=pr,this.tryEmit()},Pe.interval,this),Vr):pr}return Xt},failTimeout:function(){return this._timer=w(function(){this.state=Xt},this.options.interval,this),Xt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==pr&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ii(xe,Pe){return Pe=Pe||{},Pe.recognizers=q(Pe.recognizers,Ii.defaults.preset),new Wi(xe,Pe)}Ii.VERSION="2.0.7",Ii.defaults={domEvents:!1,touchAction:Ot,enable:!0,inputTarget:null,inputClass:null,preset:[[Wo,{enable:!1}],[$o,{enable:!1},["rotate"]],[Oi,{direction:yr}],[Se,{direction:yr},["swipe"]],[ui],[ui,{event:"doubletap",taps:2},["tap"]],[$n]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Rn=1,ms=2;function Wi(xe,Pe){this.options=U({},Ii.defaults,Pe||{}),this.options.inputTarget=this.options.inputTarget||xe,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=xe,this.input=ti(this),this.touchAction=new en(this,this.options.touchAction),Ns(this,!0),F(this.options.recognizers,function($e){var gt=this.add(new $e[0]($e[1]));$e[2]&&gt.recognizeWith($e[2]),$e[3]&&gt.requireFailure($e[3])},this)}Wi.prototype={set:function(xe){return U(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?ms:Rn},recognize:function(xe){var Pe=this.session;if(!Pe.stopped){this.touchAction.preventDefaults(xe);var $e,gt=this.recognizers,Wt=Pe.curRecognizer;(!Wt||Wt&&Wt.state&pr)&&(Wt=Pe.curRecognizer=null);for(var vr=0;vr<gt.length;)$e=gt[vr],Pe.stopped!==ms&&(!Wt||$e==Wt||$e.canRecognizeWith(Wt))?$e.recognize(xe):$e.reset(),!Wt&&$e.state&(Vr|yi|Xr)&&(Wt=Pe.curRecognizer=$e),vr++}},get:function(xe){if(xe instanceof tn)return xe;for(var Pe=this.recognizers,$e=0;$e<Pe.length;$e++)if(Pe[$e].options.event==xe)return Pe[$e];return null},add:function(xe){if(S(xe,"add",this))return this;var Pe=this.get(xe.options.event);return Pe&&this.remove(Pe),this.recognizers.push(xe),xe.manager=this,this.touchAction.update(),xe},remove:function(xe){if(S(xe,"remove",this))return this;if(xe=this.get(xe),xe){var Pe=this.recognizers,$e=pe(Pe,xe);$e!==-1&&(Pe.splice($e,1),this.touchAction.update())}return this},on:function(xe,Pe){if(xe!==i&&Pe!==i){var $e=this.handlers;return F(me(xe),function(gt){$e[gt]=$e[gt]||[],$e[gt].push(Pe)}),this}},off:function(xe,Pe){if(xe!==i){var $e=this.handlers;return F(me(xe),function(gt){Pe?$e[gt]&&$e[gt].splice(pe($e[gt],Pe),1):delete $e[gt]}),this}},emit:function(xe,Pe){this.options.domEvents&&Sn(xe,Pe);var $e=this.handlers[xe]&&this.handlers[xe].slice();if(!(!$e||!$e.length)){Pe.type=xe,Pe.preventDefault=function(){Pe.srcEvent.preventDefault()};for(var gt=0;gt<$e.length;)$e[gt](Pe),gt++}},destroy:function(){this.element&&Ns(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ns(xe,Pe){var $e=xe.element;if($e.style){var gt;F(xe.options.cssProps,function(Wt,vr){gt=Ee($e.style,vr),Pe?(xe.oldCssProps[gt]=$e.style[gt],$e.style[gt]=Wt):$e.style[gt]=xe.oldCssProps[gt]||""}),Pe||(xe.oldCssProps={})}}function Sn(xe,Pe){var $e=t.createEvent("Event");$e.initEvent(xe,!0,!0),$e.gesture=Pe,Pe.target.dispatchEvent($e)}U(Ii,{INPUT_START:er,INPUT_MOVE:Kt,INPUT_END:Nt,INPUT_CANCEL:Ar,STATE_POSSIBLE:Jr,STATE_BEGAN:Vr,STATE_CHANGED:yi,STATE_ENDED:Xr,STATE_RECOGNIZED:pr,STATE_CANCELLED:Ie,STATE_FAILED:Xt,DIRECTION_NONE:ln,DIRECTION_LEFT:Pr,DIRECTION_RIGHT:xr,DIRECTION_UP:Vn,DIRECTION_DOWN:_r,DIRECTION_HORIZONTAL:yr,DIRECTION_VERTICAL:un,DIRECTION_ALL:Dr,Manager:Wi,Input:mn,TouchAction:en,TouchInput:he,MouseInput:Gt,PointerEventInput:Ce,TouchMouseInput:g,SingleTouchInput:ne,Recognizer:tn,AttrRecognizer:jn,Tap:ui,Pan:Se,Swipe:Oi,Pinch:$o,Rotate:Wo,Press:$n,on:se,off:Te,each:F,merge:G,extend:$,assign:U,inherit:H,bindFn:J,prefixed:Ee});var yl=typeof e<"u"?e:typeof self<"u"?self:{};yl.Hammer=Ii,r.exports?r.exports=Ii:e[n]=Ii})(window,document,"Hammer")}(kb)),kb.exports}var Hg=hoe();const doe=_h(Hg),tl=x5({__proto__:null,default:doe},[Hg]),i6=1,s6=2,nx=4,poe={mousedown:i6,mousemove:s6,mouseup:nx};function Aoe(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return!0;return!1}function goe(r){const e=r.prototype.handler;r.prototype.handler=function(n){const i=this.store;n.button>0&&n.type==="pointerdown"&&(Aoe(i,s=>s.pointerId===n.pointerId)||i.push(n)),e.call(this,n)}}function moe(r){r.prototype.handler=function(t){let n=poe[t.type];n&i6&&t.button>=0&&(this.pressed=!0),n&s6&&t.buttons===0&&(n=nx),this.pressed&&(n&nx&&(this.pressed=!1),this.callback(this.manager,n,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))}}goe(Hg.PointerEventInput);moe(Hg.MouseInput);const _oe=Hg.Manager;class Ey{constructor(e,t,n){this.element=e,this.callback=t,this.options={enable:!0,...n}}}const yoe=tl?[[tl.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[tl.Rotate,{enable:!1}],[tl.Pinch,{enable:!1}],[tl.Swipe,{enable:!1}],[tl.Pan,{threshold:0,enable:!1}],[tl.Press,{enable:!1}],[tl.Tap,{event:"doubletap",taps:2,enable:!1}],[tl.Tap,{event:"anytap",enable:!1}],[tl.Tap,{enable:!1}]]:null,QI={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},voe={doubletap:["tap"]},boe={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},iC={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},xoe={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"},eM={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},woe=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",fp=typeof window<"u"?window:global;let ix=!1;try{const r={get passive(){return ix=!0,!0}};fp.addEventListener("test",null,r),fp.removeEventListener("test",null)}catch{ix=!1}const Coe=woe.indexOf("firefox")!==-1,{WHEEL_EVENTS:Toe}=iC,tM="wheel",rM=4.000244140625,Eoe=40,Boe=.25;class Soe extends Ey{constructor(e,t,n){super(e,t,n),this.handleEvent=i=>{if(!this.options.enable)return;let s=i.deltaY;fp.WheelEvent&&(Coe&&i.deltaMode===fp.WheelEvent.DOM_DELTA_PIXEL&&(s/=fp.devicePixelRatio),i.deltaMode===fp.WheelEvent.DOM_DELTA_LINE&&(s*=Eoe)),s!==0&&s%rM===0&&(s=Math.floor(s/rM)),i.shiftKey&&s&&(s=s*Boe),this.callback({type:tM,center:{x:i.clientX,y:i.clientY},delta:-s,srcEvent:i,pointerType:"mouse",target:i.target})},this.events=(this.options.events||[]).concat(Toe),this.events.forEach(i=>e.addEventListener(i,this.handleEvent,ix?{passive:!1}:!1))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){e===tM&&(this.options.enable=t)}}const{MOUSE_EVENTS:Ioe}=iC,nM="pointermove",iM="pointerover",sM="pointerout",oM="pointerenter",aM="pointerleave";class Moe extends Ey{constructor(e,t,n){super(e,t,n),this.handleEvent=s=>{this.handleOverEvent(s),this.handleOutEvent(s),this.handleEnterEvent(s),this.handleLeaveEvent(s),this.handleMoveEvent(s)},this.pressed=!1;const{enable:i}=this.options;this.enableMoveEvent=i,this.enableLeaveEvent=i,this.enableEnterEvent=i,this.enableOutEvent=i,this.enableOverEvent=i,this.events=(this.options.events||[]).concat(Ioe),this.events.forEach(s=>e.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){e===nM&&(this.enableMoveEvent=t),e===iM&&(this.enableOverEvent=t),e===sM&&(this.enableOutEvent=t),e===oM&&(this.enableEnterEvent=t),e===aM&&(this.enableLeaveEvent=t)}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit(iM,e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit(sM,e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit(oM,e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit(aM,e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.buttons===0&&(this.pressed=!1),this.pressed||this._emit(nM,e);break;case"mouseup":this.pressed=!1;break}}_emit(e,t){this.callback({type:e,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}const{KEY_EVENTS:Poe}=iC,cM="keydown",lM="keyup";class Roe extends Ey{constructor(e,t,n){super(e,t,n),this.handleEvent=i=>{const s=i.target||i.srcElement;s.tagName==="INPUT"&&s.type==="text"||s.tagName==="TEXTAREA"||(this.enableDownEvent&&i.type==="keydown"&&this.callback({type:cM,srcEvent:i,key:i.key,target:i.target}),this.enableUpEvent&&i.type==="keyup"&&this.callback({type:lM,srcEvent:i,key:i.key,target:i.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(Poe),e.tabIndex=this.options.tabIndex||0,e.style.outline="none",this.events.forEach(i=>e.addEventListener(i,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){e===cM&&(this.enableDownEvent=t),e===lM&&(this.enableUpEvent=t)}}const uM="contextmenu";class Foe extends Ey{constructor(e,t,n){super(e,t,n),this.handleEvent=i=>{this.options.enable&&this.callback({type:uM,center:{x:i.clientX,y:i.clientY},srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,t){e===uM&&(this.options.enable=t)}}const fM=1,sx=2,hM=4,Doe={pointerdown:fM,pointermove:sx,pointerup:hM,mousedown:fM,mousemove:sx,mouseup:hM},Ooe=0,Loe=1,koe=2,Noe=1,Uoe=2,zoe=4;function Goe(r){const e=Doe[r.srcEvent.type];if(!e)return null;const{buttons:t,button:n}=r.srcEvent;let i=!1,s=!1,o=!1;return e===sx?(i=!!(t&Noe),s=!!(t&zoe),o=!!(t&Uoe)):(i=n===Ooe,s=n===Loe,o=n===koe),{leftButton:i,middleButton:s,rightButton:o}}function Voe(r,e){const t=r.center;if(!t)return null;const n=e.getBoundingClientRect(),i=n.width/e.offsetWidth||1,s=n.height/e.offsetHeight||1,o={x:(t.x-n.left-e.clientLeft)/i,y:(t.y-n.top-e.clientTop)/s};return{center:t,offsetCenter:o}}const Nb={srcElement:"root",priority:0};class Hoe{constructor(e){this.handleEvent=t=>{if(this.isEmpty())return;const n=this._normalizeEvent(t);let i=t.srcEvent.target;for(;i&&i!==n.rootElement;){if(this._emit(n,i),n.handled)return;i=i.parentNode}this._emit(n,"root")},this.eventManager=e,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,t,n,i=!1,s=!1){const{handlers:o,handlersByElement:c}=this;let f=Nb;typeof n=="string"||n&&n.addEventListener?f={...Nb,srcElement:n}:n&&(f={...Nb,...n});let A=c.get(f.srcElement);A||(A=[],c.set(f.srcElement,A));const v={type:e,handler:t,srcElement:f.srcElement,priority:f.priority};i&&(v.once=!0),s&&(v.passive=!0),o.push(v),this._active=this._active||!v.passive;let w=A.length-1;for(;w>=0&&!(A[w].priority>=v.priority);)w--;A.splice(w+1,0,v)}remove(e,t){const{handlers:n,handlersByElement:i}=this;for(let s=n.length-1;s>=0;s--){const o=n[s];if(o.type===e&&o.handler===t){n.splice(s,1);const c=i.get(o.srcElement);c.splice(c.indexOf(o),1),c.length===0&&i.delete(o.srcElement)}}this._active=n.some(s=>!s.passive)}_emit(e,t){const n=this.handlersByElement.get(t);if(n){let i=!1;const s=()=>{e.handled=!0},o=()=>{e.handled=!0,i=!0},c=[];for(let f=0;f<n.length;f++){const{type:A,handler:v,once:w}=n[f];if(v({...e,type:A,stopPropagation:s,stopImmediatePropagation:o}),w&&c.push(n[f]),i)break}for(let f=0;f<c.length;f++){const{type:A,handler:v}=c[f];this.remove(A,v)}
2603}}_normalizeEvent(e){const t=this.eventManager.getElement();return{...e,...Goe(e),...Voe(e,t),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:t}}}const joe={events:null,recognizers:null,recognizerOptions:{},Manager:_oe,touchAction:"none",tabIndex:0};class $oe{constructor(e=null,t){this._onBasicInput=i=>{const{srcEvent:s}=i,o=boe[s.type];o&&this.manager.emit(o,i)},this._onOtherEvent=i=>{this.manager.emit(i.type,i)},this.options={...joe,...t},this.events=new Map,this.setElement(e);const{events:n}=this.options;n&&this.on(n)}getElement(){return this.element}setElement(e){if(this.element&&this.destroy(),this.element=e,!e)return;const{options:t}=this,n=t.Manager;this.manager=new n(e,{touchAction:t.touchAction,recognizers:t.recognizers||yoe}).on("hammer.input",this._onBasicInput),t.recognizers||Object.keys(QI).forEach(i=>{const s=this.manager.get(i);s&&QI[i].forEach(o=>{s.recognizeWith(o)})});for(const i in t.recognizerOptions){const s=this.manager.get(i);if(s){const o=t.recognizerOptions[i];delete o.enable,s.set(o)}}this.wheelInput=new Soe(e,this._onOtherEvent,{enable:!1}),this.moveInput=new Moe(e,this._onOtherEvent,{enable:!1}),this.keyInput=new Roe(e,this._onOtherEvent,{enable:!1,tabIndex:t.tabIndex}),this.contextmenuInput=new Foe(e,this._onOtherEvent,{enable:!1});for(const[i,s]of this.events)s.isEmpty()||(this._toggleRecognizer(s.recognizerName,!0),this.manager.on(i,s.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,t,n){this._addEventHandler(e,t,n,!1)}once(e,t,n){this._addEventHandler(e,t,n,!0)}watch(e,t,n){this._addEventHandler(e,t,n,!1,!0)}off(e,t){this._removeEventHandler(e,t)}_toggleRecognizer(e,t){const{manager:n}=this;if(!n)return;const i=n.get(e);if(i&&i.options.enable!==t){i.set({enable:t});const s=voe[e];s&&!this.options.recognizers&&s.forEach(o=>{const c=n.get(o);t?(c.requireFailure(e),i.dropRequireFailure(o)):c.dropRequireFailure(e)})}this.wheelInput.enableEventType(e,t),this.moveInput.enableEventType(e,t),this.keyInput.enableEventType(e,t),this.contextmenuInput.enableEventType(e,t)}_addEventHandler(e,t,n,i,s){if(typeof e!="string"){n=t;for(const v in e)this._addEventHandler(v,e[v],n,i,s);return}const{manager:o,events:c}=this,f=eM[e]||e;let A=c.get(f);A||(A=new Hoe(this),c.set(f,A),A.recognizerName=xoe[f]||f,o&&o.on(f,A.handleEvent)),A.add(e,t,n,i,s),A.isEmpty()||this._toggleRecognizer(A.recognizerName,!0)}_removeEventHandler(e,t){if(typeof e!="string"){for(const o in e)this._removeEventHandler(o,e[o]);return}const{events:n}=this,i=eM[e]||e,s=n.get(i);if(s&&(s.remove(e,t),s.isEmpty())){const{recognizerName:o}=s;let c=!1;for(const f of n.values())if(f.recognizerName===o&&!f.isEmpty()){c=!0;break}c||this._toggleRecognizer(o,!1)}}}function dM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Mo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Vf={transitionDuration:0},jl={transitionDuration:300,transitionEasing:function(e){return e},transitionInterpolator:new ug,transitionInterruption:hg.BREAK},n0=300,i0=function(e){return 1-(1-e)*(1-e)},Fd={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},o6=function(){function r(){var e=this;af(this,r),Tr(this,"events",[]),Tr(this,"scrollZoom",!0),Tr(this,"dragPan",!0),Tr(this,"dragRotate",!0),Tr(this,"doubleClickZoom",!0),Tr(this,"touchZoom",!0),Tr(this,"touchRotate",!1),Tr(this,"keyboard",!0),Tr(this,"_interactionState",{isDragging:!1}),Tr(this,"_events",{}),Tr(this,"_setInteractionState",function(t){Object.assign(e._interactionState,t),e.onStateChange&&e.onStateChange(e._interactionState)}),Tr(this,"_onTransition",function(t,n){e.onViewportChange(t,e._interactionState,n)}),this.handleEvent=this.handleEvent.bind(this),this._transitionManager=new nC({onViewportChange:this._onTransition,onStateChange:this._setInteractionState})}return of(r,[{key:"handleEvent",value:function(t){this.mapState=this.getMapState();var n=this._eventStartBlocked;switch(t.type){case"panstart":return n?!1:this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return n?!1:this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"tripanstart":return n?!1:this._onTriplePanStart(t);case"tripanmove":return this._onTriplePan(t);case"tripanend":return this._onTriplePanEnd(t);case"doubletap":return this._onDoubleTap(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}},{key:"getCenter",value:function(t){var n=t.offsetCenter,i=n.x,s=n.y;return[i,s]}},{key:"isFunctionKeyPressed",value:function(t){var n=t.srcEvent;return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}},{key:"blockEvents",value:function(t){var n=this,i=setTimeout(function(){n._eventStartBlocked===i&&(n._eventStartBlocked=null)},t);this._eventStartBlocked=i}},{key:"updateViewport",value:function(t,n,i){var s=this.mapState instanceof wp?this.mapState.getViewportProps():this.mapState,o=Mo(Mo({},t.getViewportProps()),n),c=Object.keys(o).some(function(f){return s[f]!==o[f]});this._state=t.getState(),this._setInteractionState(i),c&&this.onViewportChange(o,this._interactionState,s)}},{key:"getMapState",value:function(t){return new wp(Mo(Mo(Mo({},this.mapStateProps),this._state),t))}},{key:"isDragging",value:function(){return this._interactionState.isDragging}},{key:"setOptions",value:function(t){var n=t.onViewportChange,i=t.onStateChange,s=t.eventManager,o=s===void 0?this.eventManager:s,c=t.
2603isInteractive,f=c===void 0?!0:c,A=t.scrollZoom,v=A===void 0?this.scrollZoom:A,w=t.dragPan,S=w===void 0?this.dragPan:w,F=t.dragRotate,N=F===void 0?this.dragRotate:F,U=t.doubleClickZoom,$=U===void 0?this.doubleClickZoom:U,G=t.touchZoom,H=G===void 0?this.touchZoom:G,J=t.touchRotate,ue=J===void 0?this.touchRotate:J,q=t.keyboard,se=q===void 0?this.keyboard:q;this.onViewportChange=n,this.onStateChange=i;var Te=this.mapStateProps||{},Ue=Te.height!==t.height||Te.width!==t.width;this.mapStateProps=t,Ue&&(this.mapState=Te,this.updateViewport(new wp(t))),this._transitionManager.processViewportChange(t),this.eventManager!==o&&(this.eventManager=o,this._events={},this.toggleEvents(this.events,!0)),this.toggleEvents(Fd.WHEEL,f&&!!v),this.toggleEvents(Fd.PAN,f&&!!(S||N)),this.toggleEvents(Fd.PINCH,f&&!!(H||ue)),this.toggleEvents(Fd.TRIPLE_PAN,f&&!!ue),this.toggleEvents(Fd.DOUBLE_TAP,f&&!!$),this.toggleEvents(Fd.KEYBOARD,f&&!!se),this.scrollZoom=v,this.dragPan=S,this.dragRotate=N,this.doubleClickZoom=$,this.touchZoom=H,this.touchRotate=ue,this.keyboard=se}},{key:"toggleEvents",value:function(t,n){var i=this;this.eventManager&&t.forEach(function(s){i._events[s]!==n&&(i._events[s]=n,n?i.eventManager.on(s,i.handleEvent):i.eventManager.off(s,i.handleEvent))})}},{key:"_onPanStart",value:function(t){var n=this.getCenter(t);this._panRotate=this.isFunctionKeyPressed(t)||t.rightButton;var i=this._panRotate?this.mapState.rotateStart({pos:n}):this.mapState.panStart({pos:n});return this.updateViewport(i,Vf,{isDragging:!0}),!0}},{key:"_onPan",value:function(t){return this.isDragging()?this._panRotate?this._onPanRotate(t):this._onPanMove(t):!1}},{key:"_onPanEnd",value:function(t){return this.isDragging()?this._panRotate?this._onPanRotateEnd(t):this._onPanMoveEnd(t):!1}},{key:"_onPanMove",value:function(t){if(!this.dragPan)return!1;var n=this.getCenter(t),i=this.mapState.pan({pos:n});return this.updateViewport(i,Vf,{isPanning:!0}),!0}},{key:"_onPanMoveEnd",value:function(t){if(this.dragPan){var n=this.dragPan.inertia,i=n===void 0?n0:n;if(i&&t.velocity){var s=this.getCenter(t),o=[s[0]+t.velocityX*i/2,s[1]+t.velocityY*i/2],c=this.mapState.pan({pos:o}).panEnd();return this.updateViewport(c,Mo(Mo({},jl),{},{transitionDuration:i,transitionEasing:i0}),{isDragging:!1,isPanning:!0}),!0}}var f=this.mapState.panEnd();return this.updateViewport(f,null,{isDragging:!1,isPanning:!1}),!0}},{key:"_onPanRotate",value:function(t){if(!this.dragRotate)return!1;var n=this.getCenter(t),i=this.mapState.rotate({pos:n});return this.updateViewport(i,Vf,{isRotating:!0}),!0}},{key:"_onPanRotateEnd",value:function(t){if(this.dragRotate){var n=this.dragRotate.inertia,i=n===void 0?n0:n;if(i&&t.velocity){var s=this.getCenter(t),o=[s[0]+t.velocityX*i/2,s[1]+t.velocityY*i/2],c=this.mapState.rotate({pos:o}).rotateEnd();return this.updateViewport(c,Mo(Mo({},jl),{},{transitionDuration:i,transitionEasing:i0}),{isDragging:!1,isRotating:!0}),!0}}var f=this.mapState.panEnd();return this.updateViewport(f,null,{isDragging:!1,isRotating:!1}),!0}},{key:"_onWheel",value:function(t){if(!this.scrollZoom)return!1;var n=this.scrollZoom,i=n.speed,s=i===void 0?.01:i,o=n.smooth,c=o===void 0?!1:o;t.preventDefault();var f=this.getCenter(t),A=t.delta,v=2/(1+Math.exp(-Math.abs(A*s)));A<0&&v!==0&&(v=1/v);var w=this.mapState.zoom({pos:f,scale:v});return w.getViewportProps().zoom===this.mapStateProps.zoom?!1:(this.updateViewport(w,Mo(Mo({},jl),{},{transitionInterpolator:new ug({around:f}),transitionDuration:c?250:1}),{isPanning:!0,isZooming:!0}),!0)}},{key:"_onPinchStart",value:function(t){var n=this.getCenter(t),i=this.mapState.zoomStart({pos:n}).rotateStart({pos:n});return this._startPinchRotation=t.rotation,this._lastPinchEvent=t,this.updateViewport(i,Vf,{isDragging:!0}),!0}},{key:"_onPinch",value:function(t){if(!this.isDragging()||!this.touchZoom&&!this.touchRotate)return!1;var n=this.mapState;if(this.touchZoom){var i=t.scale,s=this.getCenter(t);n=n.zoom({pos:s,scale:i})}if(this.touchRotate){var o=t.rotation;n=n.rotate({deltaAngleX:this._startPinchRotation-o})}return this.updateViewport(n,Vf,{isDragging:!0,isPanning:!!this.touchZoom,isZooming:!!this.touchZoom,isRotating:!!this.touchRotate}),this._lastPinchEvent=t,!0}},{key:"_onPinchEnd",value:function(t){if(!this.isDragging())return!1;if(this.touchZoom){var n=this.touchZoom.inertia,i=n===void 0?n0:n,s=this._lastPinchEvent;if(i&&s&&t.scale!==s.scale){var o=this.getCenter(t),c=this.mapState.rotateEnd(),f=Math.log2(t.scale),A=(f-Math.log2(s.scale))/(t.deltaTime-s.deltaTime),v=Math.pow(2,f+A*i/2);return c=c.zoom({pos:o,scale:v}).zoomEnd(),this.updateViewport(c,Mo(Mo({},jl),{},{transitionInterpolator:new ug({around:o}),transitionDuration:i,transitionEasing:i0}),{isDragging:!1,isPanning:!!this.touchZoom,isZooming:!!this.touchZoom,isRotating:!1}),this.blockEvents(i),!0}}var w=this.mapState.zoomEnd().rotateEnd();return this._state.startPinchRotation=0,this.updateViewport(w,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1}),this._startPinchRotation=null,this._lastPinchEvent=null,!0}},{key:"_onTriplePanStart",value:function(t){var n=this.getCenter(t),i=this.mapState.rotateStart({pos:n});return this.updateViewport(i,Vf,{isDragging:!0}),!0}},{key:"_onTriplePan",value:function(t){if(!this.isDragging()||!this.touchRotate)return!1;var n=this.getCenter(t);n[0]-=t.deltaX;var i=this.mapState.rotate({pos:n});return this.updateViewport(i,Vf,{isRotating:!0}),!0}},{key:"_onTriplePanEnd",value:function(t){if(!this.isDragging())return!1;if(this.touchRotate){var n=this.touchRotate.inertia,i=n===void 0?n0:n;if(i&&t.velocityY){var s=this.getCenter(t),o=[s[0],s[1]+=t.velocityY*i/2],c=this.mapState.rotate({pos:o});return this.updateViewport(c,Mo(Mo({},jl),{},{transitionDuration:i,transitionEasing:i0}),{isDragging:!1,isRotating:!0}),this.blockEvents(i),!1}}var f=this.mapState.rotateEnd();return this.updateViewport(f,null,{isDragging:!1,isRotating:!1}),!0}},{key:"_onDoubleTap",value:function(t){if(!this.doubleClickZoom)return!1;var n=this.getCenter(t),i=this.isFunctionKeyPressed(t),s=this.mapState.zoom({pos:n,scale:i?.5:2});return this.updateViewport(s,Object.assign({},jl,{transitionInterpolator:new ug({around:n})}),{isZooming:!0}),!0}},{key:"_onKeyDown",value:function(t){if(!this.keyboard)return!1;var n=this.isFunctionKeyPressed(t),i=this.keyboard,s=i.zoomSpeed,o=s===void 0?2:s,c=i.moveSpeed,f=c===void 0?100:c,A=i.rotateSpeedX,v=A===void 0?15:A,w=i.rotateSpeedY,S=w===void 0?10:w,F=this.mapStateProps,N;switch(t.srcEvent.keyCode){case 189:n?N=this.getMapState({zoom:F.zoom-Math.log2(o)-1}):N=this.getMapState({zoom:F.zoom-Math.log2(o)});break;case 187:n?N=this.getMapState({zoom:F.zoom+Math.log2(o)+1}):N=this.getMapState({zoom:F.zoom+Math.log2(o)});break;case 37:n?N=this.getMapState({bearing:F.bearing-v}):N=this.mapState.pan({pos:[f,0],startPos:[0,0]});break;case 39:n?N=this.getMapState({bearing:F.bearing+v}):N=this.mapState.pan({pos:[-f,0],startPos:[0,0]});break;case 38:n?N=this.getMapState({pitch:F.pitch+S}):N=this.mapState.pan({pos:[0,f],startPos:[0,0]});break;case 40:n?N=this.getMapState({pitch:F.pitch-S}):N=this.mapState.pan({pos:[0,-f],startPos:[0,0]});break;default:return!1}return this.updateViewport(N,jl)}}]),r}();function pM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Vl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2603e%2?pM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):pM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Woe=Object.assign({},nu.propTypes,{maxZoom:At.number,minZoom:At.number,maxPitch:At.number,minPitch:At.number,onViewStateChange:At.func,onViewportChange:At.func,onInteractionStateChange:At.func,transitionDuration:At.oneOfType([At.number,At.string]),transitionInterpolator:At.object,transitionInterruption:At.number,transitionEasing:At.func,onTransitionStart:At.func,onTransitionInterrupt:At.func,onTransitionEnd:At.func,scrollZoom:At.oneOfType([At.bool,At.object]),dragPan:At.oneOfType([At.bool,At.object]),dragRotate:At.oneOfType([At.bool,At.object]),doubleClickZoom:At.bool,touchZoom:At.oneOfType([At.bool,At.object]),touchRotate:At.oneOfType([At.bool,At.object]),keyboard:At.oneOfType([At.bool,At.object]),onHover:At.func,onClick:At.func,onDblClick:At.func,onContextMenu:At.func,onMouseDown:At.func,onMouseMove:At.func,onMouseUp:At.func,onTouchStart:At.func,onTouchMove:At.func,onTouchEnd:At.func,onMouseEnter:At.func,onMouseLeave:At.func,onMouseOut:At.func,onWheel:At.func,touchAction:At.string,eventRecognizerOptions:At.object,clickRadius:At.number,interactiveLayerIds:At.array,getCursor:At.func,controller:At.instanceOf(o6)}),Joe=function(e){var t=e.isDragging,n=e.isHovering;return t?"grabbing":n?"pointer":"grab"},Xoe=Object.assign({},nu.defaultProps,Qf,nC.defaultProps,{onViewStateChange:null,onViewportChange:null,onClick:null,onNativeClick:null,onHover:null,onContextMenu:function(e){return e.preventDefault()},scrollZoom:!0,dragPan:!0,dragRotate:!0,doubleClickZoom:!0,touchZoom:!0,touchRotate:!1,keyboard:!0,touchAction:"none",eventRecognizerOptions:{},clickRadius:0,getCursor:Joe});function sC(r){if(r.lngLat||!r.offsetCenter)return r;var e=r.offsetCenter,t=e.x,n=e.y;if(!Number.isFinite(t)||!Number.isFinite(n))return r;var i=[t,n];return r.point=i,r.lngLat=this.viewport.unproject(i),r}function a6(r){var e=this.map;if(!e||!r)return null;var t={},n=this.props.clickRadius;this.props.interactiveLayerIds&&(t.layers=this.props.interactiveLayerIds);try{return e.queryRenderedFeatures(n?[[r[0]-n,r[1]+n],[r[0]+n,r[1]-n]]:r,t)}catch{return null}}function ql(r,e){var t=this.props[r];t&&t(sC.call(this,e))}function Koe(r){ql.call(this,r.pointerType==="touch"?"onTouchStart":"onMouseDown",r)}function qoe(r){ql.call(this,r.pointerType==="touch"?"onTouchEnd":"onMouseUp",r)}function Yoe(r){if(ql.call(this,r.pointerType==="touch"?"onTouchMove":"onMouseMove",r),!this.state.isDragging){var e=this.props,t=e.onHover,n=e.interactiveLayerIds,i;r=sC.call(this,r),(n||t)&&(i=a6.call(this,r.point));var s=!!(n&&i&&i.length>0),o=s&&!this.state.isHovering,c=!s&&this.state.isHovering;(t||o)&&(r.features=i,t&&t(r)),o&&ql.call(this,"onMouseEnter",r),c&&ql.call(this,"onMouseLeave",r),(o||c)&&this.setState({isHovering:s})}}function AM(r){var e=this.props,t=e.onClick,n=e.onNativeClick,i=e.onDblClick,s=e.doubleClickZoom,o=[],c=i||s;switch(r.type){case"anyclick":o.push(n),c||o.push(t);break;case"click":c&&o.push(t);break}o=o.filter(Boolean),o.length&&(r=sC.call(this,r),r.features=a6.call(this,r.point),o.forEach(function(f){return f(r)}))}function Zoe(r){return{getMap:r.current&&r.current.getMap,queryRenderedFeatures:r.current&&r.current.queryRenderedFeatures}}var oC=It.forwardRef(function(r,e){var t=It.useContext(Th),n=It.useMemo(function(){return r.controller||new o6},[]),i=It.useMemo(function(){return new $oe(null,{touchAction:r.touchAction,recognizerOptions:r.eventRecognizerOptions})},[]),s=It.useRef(null),o=It.useRef(null),c=It.useRef({width:0,height:0,state:{isHovering:!1,isDragging:!1}}),f=c.current;f.props=r,f.map=o.current&&o.current.getMap(),f.setState=function(se){f.state=Vl(Vl({},f.state),se),s.current.style.cursor=r.getCursor(f.state)};var A=!0,v,w,S=function(Te,Ue,de){if(A){v=[Te,Ue,de];return}var me=f.props,pe=me.onViewStateChange,W=me.onViewportChange;pe&&pe({viewState:Te,interactionState:Ue,oldViewState:de}),W&&W(Te,Ue,de)};It.useImperativeHandle(e,function(){return Zoe(o)},[]);var F=It.useMemo(function(){return Vl(Vl({},t),{},{eventManager:i,container:t.container||s.current})},[t,s.current]);F.onViewportChange=S,F.viewport=t.viewport||r6(f),f.viewport=F.viewport;var N=function(Te){var Ue=Te.isDragging,de=Ue===void 0?!1:Ue;if(de!==f.state.isDragging&&f.setState({isDragging:de}),A){w=Te;return}var me=f.props.onInteractionStateChange;me&&me(Te)},U=function(){f.width&&f.height&&n.setOptions(Vl(Vl(Vl({},f.props),f.props.viewState),{},{isInteractive:!!(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:S,onStateChange:N,eventManager:i,width:f.width,height:f.height}))},$=function(Te){var Ue=Te.width,de=Te.height;f.width=Ue,f.height=de,U(),f.props.onResize({width:Ue,height:de})};It.useEffect(function(){return i.setElement(s.current),i.on({pointerdown:Koe.bind(f),pointermove:Yoe.bind(f),pointerup:qoe.bind(f),pointerleave:ql.bind(f,"onMouseOut"),click:AM.bind(f),anyclick:AM.bind(f),dblclick:ql.bind(f,"onDblClick"),wheel:ql.bind(f,"onWheel"),contextmenu:ql.bind(f,"onContextMenu")}),function(){i.destroy()}},[]),tx(function(){v&&S.apply(void 0,p5(v)),w&&N(w)}),U();var G=r.width,H=r.height,J=r.style,ue=r.getCursor,q=It.useMemo(function(){return Vl(Vl({position:"relative"},J),{},{width:G,height:H,cursor:ue(f.state)})},[J,G,H,ue,f.state]);return(!v||!f._child)&&(f._child=It.createElement(rC,{value:F},It.createElement("div",{key:"event-canvas",ref:s,style:q},It.createElement(nu,$D({},r,{width:"100%",height:"100%",style:null,onResize:$,ref:o}))))),A=!1,f._child});oC.supported=nu.supported;oC.propTypes=Woe;oC.defaultProps=Xoe;At.string.isRequired;var Qoe=["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade"];At.oneOf(Qoe).isRequired;var cf={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},Ic={captureScroll:At.bool,captureDrag:At.bool,captureClick:At.bool,captureDoubleClick:At.bool,capturePointerMove:At.bool};function eae(r){var e=r.containerRef.current,t=r.context.eventManager;if(!(!e||!t)){var n={wheel:function(s){var o=r.props;o.captureScroll&&s.stopPropagation(),o.onScroll&&o.onScroll(s,r)},panstart:function(s){var o=r.props;o.captureDrag&&s.stopPropagation(),o.onDragStart&&o.onDragStart(s,r)},anyclick:function(s){var o=r.props;o.captureClick&&s.stopPropagation(),o.onNativeClick&&o.onNativeClick(s,r)},click:function(s){var o=r.props;o.captureClick&&s.stopPropagation(),o.onClick&&o.onClick(s,r)},dblclick:function(s){var o=r.props;o.captureDoubleClick&&s.stopPropagation(),o.onDoubleClick&&o.onDoubleClick(s,r)},pointermove:function(s){var o=r.props;o.capturePointerMove&&s.stopPropagation(),o.onPointerMove&&o.onPointerMove(s,r)}};return t.watch(n,e),function(){t.off(n)}}}function lf(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}
2603,e=It.useContext(Th),t=It.useRef(null),n=It.useRef({props:r,state:{},context:e,containerRef:t}),i=n.current;return i.props=r,i.context=e,It.useEffect(function(){return eae(i)},[e.eventManager]),i}function tae(r){var e=rae();return function(){var n=Bp(r),i;if(e){var s=Bp(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return zx(this,i)}}function rae(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function nae(r){var e=r.instance,t=lf(r),n=t.context,i=t.containerRef;return e._context=n,e._containerRef=i,e._render()}var c6=function(r){Ux(t,r);var e=tae(t);function t(){var n;af(this,t);for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];return n=e.call.apply(e,[this].concat(s)),Tr(zu(n),"_context",{}),Tr(zu(n),"_containerRef",It.createRef()),Tr(zu(n),"_onScroll",function(c){}),Tr(zu(n),"_onDragStart",function(c){}),Tr(zu(n),"_onDblClick",function(c){}),Tr(zu(n),"_onClick",function(c){}),Tr(zu(n),"_onPointerMove",function(c){}),n}return of(t,[{key:"_render",value:function(){throw new Error("_render() not implemented")}},{key:"render",value:function(){return It.createElement(nae,$D({instance:this},this.props,{onScroll:this._onScroll,onDragStart:this._onDragStart,onDblClick:this._onDblClick,onClick:this._onClick,onPointerMove:this._onPointerMove}))}}]),t}(It.PureComponent);Tr(c6,"propTypes",Ic);Tr(c6,"defaultProps",cf);function gM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function mM(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var iae=Object.assign({},Ic,{draggable:At.bool,onDrag:At.func,onDragEnd:At.func,onDragStart:At.func,offsetLeft:At.number,offsetTop:At.number}),sae=Object.assign({},cf,{draggable:!1,offsetLeft:0,offsetTop:0});function l6(r){var e=r.offsetCenter,t=e.x,n=e.y;return[t,n]}function oae(r,e){var t=r.center,n=t.x,i=t.y;if(e){var s=e.getBoundingClientRect();return[s.left-n,s.top-i]}return null}function aC(r,e,t,n){var i=r[0]+e[0]-t.offsetLeft,s=r[1]+e[1]-t.offsetTop;return n.viewport.unproject([i,s])}function aae(r,e){var t=e.props,n=e.callbacks,i=e.state,s=e.context,o=e.containerRef,c=t.draggable;if(c){r.stopPropagation();var f=l6(r),A=oae(r,o.current);if(i.setDragPos(f),i.setDragOffset(A),n.onDragStart&&A){var v=Object.assign({},r);v.lngLat=aC(f,A,t,s),n.onDragStart(v)}}}function cae(r,e){var t=e.props,n=e.callbacks,i=e.state,s=e.context;r.stopPropagation();var o=l6(r);i.setDragPos(o);var c=i.dragOffset;if(n.onDrag&&c){var f=Object.assign({},r);f.lngLat=aC(o,c,t,s),n.onDrag(f)}}function lae(r,e){var t=e.props,n=e.callbacks,i=e.state,s=e.context;r.stopPropagation();var o=i.dragPos,c=i.dragOffset;if(i.setDragPos(null),i.setDragOffset(null),n.onDragEnd&&o&&c){var f=Object.assign({},r);f.lngLat=aC(o,c,t,s),n.onDragEnd(f)}}function uae(r,e){var t=e.state;r.stopPropagation(),t.setDragPos(null),t.setDragOffset(null)}function fae(r){var e=r.context.eventManager;if(!(!e||!r.state.dragPos)){var t={panmove:function(i){return cae(i,r)},panend:function(i){return lae(i,r)},pancancel:function(i){return uae(i,r)}};return e.watch(t),function(){e.off(t)}}}function hae(r){var e=It.useState(null),t=gs(e,2),n=t[0],i=t[1],s=It.useState(null),o=gs(s,2),c=o[0],f=o[1],A=lf(mM(mM({},r),{},{onDragStart:aae}));return A.callbacks=r,A.state.dragPos=n,A.state.setDragPos=i,A.state.dragOffset=c,A.state.setDragOffset=f,It.useEffect(function(){return fae(A)},[A.context.eventManager,!!n]),A}var _M=typeof window<"u"&&window.devicePixelRatio||1,Bg=function(e){return Math.round(e*_M)/_M},yM=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"x";if(e===null)return t;var i=n==="x"?e.offsetWidth:e.offsetHeight;return Bg(t/100*i)/i*100};function vM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function dae(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2603e%2?vM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var pae=Object.assign({},iae,{className:At.string,longitude:At.number.isRequired,latitude:At.number.isRequired,style:At.object}),Aae=Object.assign({},sae,{className:""});function gae(r){var e=r.props,t=r.state,n=r.context,i=e.longitude,s=e.latitude,o=e.offsetLeft,c=e.offsetTop,f=t.dragPos,A=t.dragOffset;if(f&&A)return[f[0]+A[0],f[1]+A[1]];var v=n.viewport.project([i,s]),w=gs(v,2),S=w[0],F=w[1];return S+=o,F+=c,[S,F]}function cC(r){var e=hae(r),t=e.state,n=e.containerRef,i=r.children,s=r.className,o=r.draggable,c=r.style,f=t.dragPos,A=gae(e),v=gs(A,2),w=v[0],S=v[1],F="translate(".concat(Bg(w),"px, ").concat(Bg(S),"px)"),N=o?f?"grabbing":"grab":"auto",U=It.useMemo(function(){var G=dae({position:"absolute",left:0,top:0,transform:F,cursor:N},c);return It.createElement("div",{className:"mapboxgl-marker ".concat(s),ref:e.containerRef,style:G},i)},[i,s]),$=n.current;return $&&($.style.transform=F,$.style.cursor=N),U}cC.defaultProps=Aae;cC.propTypes=pae;It.memo(cC);var Sg={top:{x:.5,y:0},"top-left":{x:0,y:0},"top-right":{x:1,y:0},bottom:{x:.5,y:1},"bottom-left":{x:0,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5}},mae=Object.keys(Sg);function _ae(r){var e=r.x,t=r.y,n=r.width,i=r.height,s=r.selfWidth,o=r.selfHeight,c=r.anchor,f=r.padding,A=f===void 0?0:f,v=Sg[c],w=v.x,S=v.y,F=t-S*o,N=F+o,U=Math.max(0,A-F)+Math.max(0,N-i+A);if(U>0){var $=S,G=U;for(S=0;S<=1;S+=.5)F=t-S*o,N=F+o,U=Math.max(0,A-F)+Math.max(0,N-i+A),U<G&&(G=U,$=S);S=$}var H=.5;S===.5&&(w=Math.floor(w),H=1);var J=e-w*s,ue=J+s,q=Math.max(0,A-J)+Math.max(0,ue-n+A);if(q>0){var se=w,Te=q;for(w=0;w<=1;w+=H)J=e-w*s,ue=J+s,q=Math.max(0,A-J)+Math.max(0,ue-n+A),q<Te&&(Te=q,se=w);w=se}return mae.find(function(Ue){var de=Sg[Ue];return de.x===w&&de.y===S})||c}var yae=Object.assign({},Ic,{className:At.string,longitude:At.number.isRequired,latitude:At.number.isRequired,altitude:At.number,offsetLeft:At.number,offsetTop:At.number,tipSize:At.number,closeButton:At.bool,closeOnClick:At.bool,anchor:At.oneOf(Object.keys(Sg)),dynamicPosition:At.bool,sortByDepth:At.bool,onClose:At.func}),vae=Object.assign({},cf,{className:"",altitude:0,offsetLeft:0,offsetTop:0,tipSize:10,anchor:"bottom",dynamicPosition:!0,sortByDepth:!1,closeButton:!0,closeOnClick:!0,onClose:function(){}});function bae(r,e,t,n){var i=gs(n,2),s=i[0],o=i[1],c=r.anchor,f=r.dynamicPosition,A=r.tipSize;return t&&f?_ae({x:s,y:o,anchor:c,padding:A,width:e.width,height:e.height,selfWidth:t.clientWidth,selfHeight:t.clientHeight}):c}function xae(r,e,t,n,i){var s=gs(n,3),o=s[0],c=s[1],f=s[2],A=r.offsetLeft,v=r.offsetTop,w=r.sortByDepth,S=Sg[i],F=o+A,N=c+v,U=yM(t,-S.x*100),$=yM(t,-S.y*100,"y"),G={position:"absolute",transform:`
2604      translate(`.concat(U,"%, ").concat($,`%)
2605      translate(`).concat(Bg(F),"px, ").concat(Bg(N),`px)
2606    `),display:void 0,zIndex:void 0};return w&&(f>1||f<-1||o<0||o>e.width||c<0||c>e.height?G.display="none":G.zIndex=Math.floor((1-f)/2*1e5)),G}function lC(r){var e=It.useRef(null),t=lf(r),n=t.context,i=t.containerRef,s=It.useState(!1),o=gs(s,2),c=o[1];It.useEffect(function(){c(!0)},[e.current]),It.useEffect(function(){if(n.eventManager&&r.closeOnClick){var ue=function(){return t.props.onClose()};return n.eventManager.on("anyclick",ue),function(){n.eventManager.off("anyclick",ue)}}},[n.eventManager,r.closeOnClick]);var f=n.viewport,A=r.className,v=r.longitude,w=r.latitude,S=r.altitude,F=r.tipSize,N=r.closeButton,U=r.children,$=f.project([v,w,S]),G=bae(r,f,e.current,$),H=xae(r,f,i.current,$,G),J=It.useCallback(function(ue){t.props.onClose();var q=t.context.eventManager;q&&q.once("click",function(se){return se.stopPropagation()},ue.target)},[]);return It.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(G," ").concat(A),style:H,ref:i},It.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:F}}
2606),It.createElement("div",{key:"content",ref:e,className:"mapboxgl-popup-content"},N&&It.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:J},"×"),U))}lC.propTypes=yae;lC.defaultProps=vae;It.memo(lC);function bM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wae(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Cae=Object.assign({},Ic,{toggleLabel:At.string,className:At.string,style:At.object,compact:At.bool,customAttribution:At.oneOfType([At.string,At.arrayOf(At.string)])}),Tae=Object.assign({},cf,{className:"",toggleLabel:"Toggle Attribution"});function Eae(r,e,t,n){var i=new dl.AttributionControl(r);return i._map=e,i._container=t,i._innerContainer=n,i._updateAttributions(),i._updateEditLink(),e.on("styledata",i._updateData),e.on("sourcedata",i._updateData),i}function Bae(r){r._map.off("styledata",r._updateData),r._map.off("sourcedata",r._updateData)}function uC(r){var e=lf(r),t=e.context,n=e.containerRef,i=It.useRef(null),s=It.useState(!1),o=gs(s,2),c=o[0],f=o[1];It.useEffect(function(){var S;return t.map&&(S=Eae({customAttribution:r.customAttribution},t.map,n.current,i.current)),function(){return S&&Bae(S)}},[t.map]);var A=r.compact===void 0?t.viewport.width<=640:r.compact;It.useEffect(function(){!A&&c&&f(!1)},[A]);var v=It.useCallback(function(){return f(function(S){return!S})},[]),w=It.useMemo(function(){return wae({position:"absolute"},r.style)},[r.style]);return It.createElement("div",{style:w,className:r.className},It.createElement("div",{ref:n,"aria-pressed":c,className:"mapboxgl-ctrl mapboxgl-ctrl-attrib ".concat(A?"mapboxgl-compact":""," ").concat(c?"mapboxgl-compact-show":"")},It.createElement("button",{type:"button",className:"mapboxgl-ctrl-attrib-button",title:r.toggleLabel,onClick:v}),It.createElement("div",{ref:i,className:"mapboxgl-ctrl-attrib-inner",role:"list"})))}uC.propTypes=Cae;uC.defaultProps=Tae;It.memo(uC);function xM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sae(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Iae=Object.assign({},Ic,{className:At.string,style:At.object,container:At.object,label:At.string}),Mae=Object.assign({},cf,{className:"",container:null,label:"Toggle fullscreen"});function fC(r){var e=lf(r),t=e.context,n=e.containerRef,i=It.useState(!1),s=gs(i,2),o=s[0],c=s[1],f=It.useState(!1),A=gs(f,2),v=A[0],w=A[1],S=It.useState(null),F=gs(S,2),N=F[0],U=F[1];It.useEffect(function(){var q=new dl.FullscreenControl;U(q),w(q._checkFullscreenSupport());var se=function(){var Ue=!q._fullscreen;q._fullscreen=Ue,c(Ue)};return Xl.addEventListener(q._fullscreenchange,se),function(){Xl.removeEventListener(q._fullscreenchange,se)}},[]);var $=function(){N&&(N._container=r.container||t.container,N._onClickFullscreen())},G=It.useMemo(function(){return Sae({position:"absolute"},r.style)},[r.style]);if(!v)return null;var H=r.className,J=r.label,ue=o?"shrink":"fullscreen";return It.createElement("div",{style:G,className:H},It.createElement("div",{className:"mapboxgl-ctrl mapboxgl-ctrl-group",ref:n},It.createElement("button",{key:ue,className:"mapboxgl-ctrl-icon mapboxgl-ctrl-".concat(ue),type:"button",title:J,onClick:$},It.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true"}))))}fC.propTypes=Iae;fC.defaultProps=Mae;It.memo(fC);var Dd;function Pae(){return Dd!==void 0?Promise.resolve(Dd):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(function(r){return Dd=r.state!=="denied",Dd}):(Dd=!!window.navigator.geolocation,Promise.resolve(Dd))}function wM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Rae(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2606e%2?wM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var CM=function(){},Fae=Object.assign({},Ic,{className:At.string,style:At.object,label:At.string,disabledLabel:At.string,auto:At.bool,positionOptions:At.object,fitBoundsOptions:At.object,trackUserLocation:At.bool,showUserLocation:At.bool,showAccuracyCircle:At.bool,showUserHeading:At.bool,onViewStateChange:At.func,onViewportChange:At.func,onGeolocate:At.func}),Dae=Object.assign({},cf,{className:"",label:"Find My Location",disabledLabel:"Location Not Available",auto:!1,positionOptions:{enableHighAccuracy:!1,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showUserLocation:!0,showUserHeading:!1,showAccuracyCircle:!0,onGeolocate:function(){}});function Oae(r){var e=new dl.LngLat(r.coords.longitude,r.coords.latitude),t=r.coords.accuracy,n=e.toBounds(t);return[[n._ne.lng,n._ne.lat],[n._sw.lng,n._sw.lat]]}function Lae(r,e,t){var n=new dl.GeolocateControl(e);n._container=Xl.createElement("div"),n._map={on:function(){},_getUIString:function(){return""}},n._setupUI(!0),n._map=r.map,n._geolocateButton=t;var i=r.eventManager;return n.options.trackUserLocation&&i&&i.on("panstart",function(){n._watchState==="ACTIVE_LOCK"&&(n._watchState="BACKGROUND",t.classList.add("mapboxgl-ctrl-geolocate-background"),t.classList.remove("mapboxgl-ctrl-geolocate-active"))}),n.on("geolocate",e.onGeolocate),n}function kae(r,e){var t=e.context,n=e.props,i=Oae(r),s=t.viewport.fitBounds(i,n.fitBoundsOptions),o=s.longitude,c=s.latitude,f=s.zoom,A=Object.assign({},t.viewport,{longitude:o,latitude:c,zoom:f}),v=new wp(A),w=Object.assign({},v.getViewportProps(),jl),S=n.onViewportChange||t.onViewportChange||CM,F=n.onViewStateChange||t.onViewStateChange||CM;F({viewState:w}),S(w)}function hC(r){var e=lf(r),t=e.context,n=e.containerRef,i=It.useRef(null),s=It.useState(null),o=gs(s,2),c=o[0],f=o[1],A=It.useState(!1),v=gs(A,2),w=v[0],S=v[1];It.useEffect(function(){var J;return t.map&&Pae().then(function(ue){S(ue),i.current&&(J=Lae(t,r,i.current),J._updateCamera=function(q){return kae(q,e)},f(J))}),function(){J&&J._clearWatch()}},[t.map]);var F=It.useCallback(function(){c&&(c.options=e.props,c.trigger())},[c]);It.useEffect(function(){r.auto&&F()},[c,r.auto]),It.useEffect(function(){c&&c._onZoom()},[t.viewport.zoom]);var N=r.className,U=r.label,$=r.disabledLabel,G=r.trackUserLocation,H=It.useMemo(function(){return Rae({position:"absolute"},r.style)},[r.style]);return It.createElement("div",{style:H,className:N},It.createElement("div",{key:"geolocate-control",className:"mapboxgl-ctrl mapboxgl-ctrl-group",ref:n},It.createElement("button",{key:"geolocate",className:"mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",ref:i,disabled:!w,"aria-pressed":!G,type:"button",title:w?U:$,"aria-label":w?U:$,onClick:F},It.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true"}))))}hC.propTypes=Fae;hC.defaultProps=Dae;It.memo(hC);function Nae(r,e){for(var t=(r||"").split(".").map(Number),n=e.split(".").map(Number),i=0;i<3;i++){var s=t[i]||0,o=n[i]||0;if(s<o)return-1;if(s>o)return 1}return 0}function TM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Uae(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?TM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):TM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var EM=function(){},zae=Object.assign({},Ic,{className:At.string,style:At.object,onViewStateChange:At.func,onViewportChange:At.func,showCompass:At.bool,showZoom:At.bool,zoomInLabel:At.string,zoomOutLabel:At.string,compassLabel:At.string}),Gae=Object.assign({},cf,{className:"",showCompass:!0,showZoom:!0,zoomInLabel:"Zoom In",zoomOutLabel:"Zoom Out",compassLabel:"Reset North"}),Vae=1,ox=2;function Hae(r){return Nae(r,"1.6.0")>=0?ox:Vae}function Ub(r,e,t){var n=r.viewport,i=new wp(Object.assign({},n,t)),s=Object.assign({},i.getViewportProps(),jl),o=e.onViewportChange||r.onViewportChange||EM,c=e.onViewStateChange||r.onViewStateChange||EM;c({viewState:s}),o(s)}function zb(r,e,t,n){return It.createElement("button",{key:r,className:"mapboxgl-ctrl-icon mapboxgl-ctrl-".concat(r),type:"button",title:e,onClick:t},n||It.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true"}))}function jae(r){var e=It.useMemo(function(){return r.map?Hae(r.map.version):ox},[r.map]),t=r.viewport.bearing,n={transform:"rotate(".concat(-t,"deg)")};return e===ox?It.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:n}):It.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:n})}function dC(r){var e=lf(r),t=e.context,n=e.containerRef,i=function(){Ub(t,r,{zoom:t.viewport.zoom+1})},s=function(){Ub(t,r,{zoom:t.viewport.zoom-1})},o=function(){Ub(t,r,{bearing:0,pitch:0})},c=r.className,f=r.showCompass,A=r.showZoom,v=r.zoomInLabel,w=r.zoomOutLabel,S=r.compassLabel,F=It.useMemo(function(){return Uae({position:"absolute"},r.style)}
2606,[r.style]);return It.createElement("div",{style:F,className:c},It.createElement("div",{className:"mapboxgl-ctrl mapboxgl-ctrl-group",ref:n},A&&zb("zoom-in",v,i),A&&zb("zoom-out",w,s),f&&zb("compass",S,o,jae(t))))}dC.propTypes=zae;dC.defaultProps=Gae;const $ae=It.memo(dC);function BM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Wae(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?BM(Object(t),!0).forEach(function(n){Tr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):BM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Jae=Object.assign({},Ic,{className:At.string,style:At.object,maxWidth:At.number,unit:At.oneOf(["imperial","metric","nautical"])}),Xae=Object.assign({},cf,{className:"",maxWidth:100,unit:"metric"});function pC(r){var e=lf(r),t=e.context,n=e.containerRef,i=It.useState(null),s=gs(i,2),o=s[0],c=s[1];It.useEffect(function(){if(t.map){var A=new dl.ScaleControl;A._map=t.map,A._container=n.current,c(A)}},[t.map]),o&&(o.options=r,o._onMove&&o._onMove());var f=It.useMemo(function(){return Wae({position:"absolute"},r.style)},[r.style]);return It.createElement("div",{style:f,className:r.className},It.createElement("div",{ref:n,className:"mapboxgl-ctrl mapboxgl-ctrl-scale"}))}pC.propTypes=Jae;pC.defaultProps=Xae;It.memo(pC);Object.assign({},Ic,{redraw:At.func.isRequired});Object.assign({},Ic,{redraw:At.func.isRequired,style:At.object});Object.assign({},Ic,{redraw:At.func.isRequired,style:At.object});dl&&dl.setRTLTextPlugin;const Kae=()=>Jf(l5,{}),SM=WD("div",{target:"e7mj6ya0"})(({isStretchHeight:r})=>({position:"relative",height:"100%",width:"100%",...r&&{minHeight:"6.25rem"}})),qae=WD("div",{target:"e7mj6ya1"})(({theme:r})=>({position:"absolute",right:"2.625rem",top:r.spacing.md,zIndex:r.zIndices.priority,".mapboxgl-ctrl.mapboxgl-ctrl-group":{overflow:"hidden",background:r.colors.bgColor},"button:not(:disabled)":{background:r.colors.bgColor,width:r.iconSizes.twoXL,height:r.iconSizes.twoXL,"& + button":{borderTopColor:r.colors.borderColor},".mapboxgl-ctrl-icon":{backgroundSize:r.iconSizes.twoXL,"&:hover":{backgroundColor:r.colors.darkenedBgMix25}},"& span":{filter:JD(r)?"":"invert(100%)"}}})),Yae=({container:r,element:e,heightFallback:t="auto",isFullScreen:n,shouldUseContainerWidth:i,widthFallback:s="auto"})=>{const o=It.useMemo(()=>i||n?"100%":e.width||r.width||s,[r.width,e.width,n,i,s]),c=It.useMemo(()=>n&&r.height?r.height:e.height||r.height||t,[n,e.height,r.height,t]);return{width:o,height:c}},IM=`uniform arcUniforms {
2607  bool greatCircle;
2608  bool useShortestPath;
2609  float numSegments;
2610  float widthScale;
2611  float widthMinPixels;
2612  float widthMaxPixels;
2613  highp int widthUnits;
2614} arc;
2615`,Zae={name:"arc",vs:IM,fs:IM,uniformTypes:{greatCircle:"f32",useShortestPath:"f32",numSegments:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",widthUnits:"i32"}},Qae=`#version 300 es
2616#define SHADER_NAME arc-layer-vertex-shader
2617in vec4 instanceSourceColors;
2618in vec4 instanceTargetColors;
2619in vec3 instanceSourcePositions;
2620in vec3 instanceSourcePositions64Low;
2621in vec3 instanceTargetPositions;
2622in vec3 instanceTargetPositions64Low;
2623in vec3 instancePickingColors;
2624in float instanceWidths;
2625in float instanceHeights;
2626in float instanceTilts;
2627out vec4 vColor;
2628out vec2 uv;
2629out float isValid;
2630float paraboloid(float distance, float sourceZ, float targetZ, float ratio) {
2631float deltaZ = targetZ - sourceZ;
2632float dh = distance * instanceHeights;
2633if (dh == 0.0) {
2634return sourceZ + deltaZ * ratio;
2635}
2636float unitZ = deltaZ / dh;
2637float p2 = unitZ * unitZ + 1.0;
2638float dir = step(deltaZ, 0.0);
2639float z0 = mix(sourceZ, targetZ, dir);
2640float r = mix(ratio, 1.0 - ratio, dir);
2641return sqrt(r * (p2 - r)) * dh + z0;
2642}
2643vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
2644vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
2645dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
2646return dir_screenspace * offset_direction * width / 2.0;
2647}
2648float getSegmentRatio(float index) {
2649return smoothstep(0.0, 1.0, index / (arc.numSegments - 1.0));
2650}
2651vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {
2652float distance = length(source.xy - target.xy);
2653float z = paraboloid(distance, source.z, target.z, segmentRatio);
2654float tiltAngle = radians(instanceTilts);
2655vec2 tiltDirection = normalize(target.xy - source.xy);
2656vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);
2657return vec3(
2658mix(source.xy, target.xy, segmentRatio) + tilt,
2659z * cos(tiltAngle)
2660);
2661}
2662float getAngularDist (vec2 source, vec2 target) {
2663vec2 sourceRadians = radians(source);
2664vec2 targetRadians = radians(target);
2665vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);
2666vec2 shd_sq = sin_half_delta * sin_half_delta;
2667float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;
2668return 2.0 * asin(sqrt(a));
2669}
2670vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {
2671vec2 lngLat;
2672if(abs(angularDist - PI) < 0.001) {
2673lngLat = (1.0 - t) * source.xy + t * target.xy;
2674} else {
2675float a = sin((1.0 - t) * angularDist);
2676float b = sin(t * angularDist);
2677vec3 p = source3D.yxz * a + target3D.yxz * b;
2678lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));
2679}
2680float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);
2681return vec3(lngLat, z);
2682}
2683void main(void) {
2684geometry.worldPosition = instanceSourcePositions;
2685geometry.worldPositionAlt = instanceTargetPositions;
2686float segmentIndex = float(gl_VertexID / 2);
2687float segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.;
2688float segmentRatio = getSegmentRatio(segmentIndex);
2689float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));
2690float nextSegmentRatio = getSegmentRatio(min(arc.numSegments - 1.0, segmentIndex + 1.0));
2691float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
2692isValid = 1.0;
2693uv = vec2(segmentRatio, segmentSide);
2694geometry.uv = uv;
2695geometry.pickingColor = instancePickingColors;
2696vec4 curr;
2697vec4 next;
2698vec3 source;
2699vec3 target;
2700if ((arc.greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
2701source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));
2702target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));
2703float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);
2704vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);
2705vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);
2706vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);
2707if (abs(currPos.x - prevPos.x) > 180.0) {
2708indexDir = -1.0;
2709isValid = 0.0;
2710} else if (abs(currPos.x - nextPos.x) > 180.0) {
2711indexDir = 1.0;
2712isValid = 0.0;
2713}
2714nextPos = indexDir < 0.0 ? prevPos : nextPos;
2715nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
2716if (isValid == 0.0) {
2717nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;
2718float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);
2719currPos = mix(currPos, nextPos, t);
2720segmentRatio = mix(segmentRatio, nextSegmentRatio, t);
2721}
2722vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);
2723vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);
2724curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);
2725next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));
2726} else {
2727vec3 source_world = instanceSourcePositions;
2728vec3 target_world = instanceTargetPositions;
2729if (arc.useShortestPath) {
2730source_world.x = mod(source_world.x + 180., 360.0) - 180.;
2731target_world.x = mod(target_world.x + 180., 360.0) - 180.;
2732float deltaLng = target_world.x - source_world.x;
2733if (deltaLng > 180.) target_world.x -= 360.;
2734if (deltaLng < -180.) source_world.x -= 360.;
2735}
2736source = project_position(source_world, instanceSourcePositions64Low);
2737target = project_position(target_world, instanceTargetPositions64Low);
2738float antiMeridianX = 0.0;
2739if (arc.useShortestPath) {
2740if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
2741antiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE;
2742}
2743float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);
2744if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {
2745isValid = 0.0;
2746indexDir = sign(segmentRatio - thresholdRatio);
2747segmentRatio = thresholdRatio;
2748}
2749}
2750nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
2751vec3 currPos = interpolateFlat(source, target, segmentRatio);
2752vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);
2753if (arc.useShortestPath) {
2754if (nextPos.x < antiMeridianX) {
2755currPos.x += TILE_SIZE;
2756nextPos.x += TILE_SIZE;
2757}
2758}
2759curr = project_common_position_to_clipspace(vec4(currPos, 1.0));
2760next = project_common_position_to_clipspace(vec4(nextPos, 1.0));
2761geometry.position = vec4(currPos, 1.0);
2762}
2763float widthPixels = clamp(
2764project_size_to_pixel(instanceWidths * arc.widthScale, arc.widthUnits),
2765arc.widthMinPixels, arc.widthMaxPixels
2766);
2767vec3 offset = vec3(
2768getExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels),
27690.0);
2770DECKGL_FILTER_SIZE(offset, geometry);
2771DECKGL_FILTER_GL_POSITION(curr, geometry);
2772gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
2773vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);
2774vColor = vec4(color.rgb, color.a * layer.opacity);
2775DECKGL_FILTER_COLOR(vColor, geometry);
2776}
2777`,ece=`#version 300 es
2778#define SHADER_NAME arc-layer-fragment-shader
2779precision highp float;
2780in vec4 vColor;
2781in vec2 uv;
2782in float isValid;
2783out vec4 fragColor;
2784void main(void) {
2785if (isValid == 0.0) {
2786discard;
2787}
2788fragColor = vColor;
2789geometry.uv = uv;
2790DECKGL_FILTER_COLOR(fragColor, geometry);
2791}
2792`,U_=[0,0,0,255],tce={getSourcePosition:{type:"accessor",value:r=>r.sourcePosition},getTargetPosition:{type:"accessor",value:r=>r.targetPosition},getSourceColor:{type:"accessor",value:U_},getTargetColor:{type:"accessor",value:U_},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}};class jg extends Es{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:Qae,fs:ece,modules:[Ls,_a,Zae]})}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:U_},instanceTargetColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getTargetColor",defaultValue:U_},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}){const{widthUnits:t,widthScale:n,widthMinPixels:i,widthMaxPixels:s,greatCircle:o,wrapLongitude:c,numSegments:f}=this.props,A={numSegments:f,widthUnits:Po[t],widthScale:n,widthMinPixels:i,widthMaxPixels:s,greatCircle:o,useShortestPath:c},v=this.state.model;v.shaderInputs.setProps({arc:A}),v.setVertexCount(f*2),v.draw(this.context.renderPass)}
2792_getModel(){return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-strip",isInstanced:!0})}}jg.layerName="ArcLayer";jg.defaultProps=tce;const rce=new Uint32Array([0,2,1,0,3,2]),nce=new Float32Array([0,1,0,0,1,0,1,1]);function ice(r,e){if(!e)return sce(r);const t=Math.max(Math.abs(r[0][0]-r[3][0]),Math.abs(r[1][0]-r[2][0])),n=Math.max(Math.abs(r[1][1]-r[0][1]),Math.abs(r[2][1]-r[3][1])),i=Math.ceil(t/e)+1,s=Math.ceil(n/e)+1,o=(i-1)*(s-1)*6,c=new Uint32Array(o),f=new Float32Array(i*s*2),A=new Float64Array(i*s*3);let v=0,w=0;for(let S=0;S<i;S++){const F=S/(i-1);for(let N=0;N<s;N++){const U=N/(s-1),$=oce(r,F,U);A[v*3+0]=$[0],A[v*3+1]=$[1],A[v*3+2]=$[2]||0,f[v*2+0]=F,f[v*2+1]=1-U,S>0&&N>0&&(c[w++]=v-s,c[w++]=v-s-1,c[w++]=v-1,c[w++]=v-s,c[w++]=v-1,c[w++]=v),v++}}return{vertexCount:o,positions:A,indices:c,texCoords:f}}function sce(r){const e=new Float64Array(12);for(let t=0;t<r.length;t++)e[t*3+0]=r[t][0],e[t*3+1]=r[t][1],e[t*3+2]=r[t][2]||0;return{vertexCount:6,positions:e,indices:rce,texCoords:nce}}function oce(r,e,t){return Cc(Cc(r[0],r[1],t),Cc(r[3],r[2],t),e)}const MM=`uniform bitmapUniforms {
2793  vec4 bounds;
2794  float coordinateConversion;
2795  float desaturate;
2796  vec3 tintColor;
2797  vec4 transparentColor;
2798} bitmap;
2799`,ace={name:"bitmap",vs:MM,fs:MM,uniformTypes:{bounds:"vec4<f32>",coordinateConversion:"f32",desaturate:"f32",tintColor:"vec3<f32>",transparentColor:"vec4<f32>"}},cce=`#version 300 es
2800#define SHADER_NAME bitmap-layer-vertex-shader
2801
2802in vec2 texCoords;
2803in vec3 positions;
2804in vec3 positions64Low;
2805
2806out vec2 vTexCoord;
2807out vec2 vTexPos;
2808
2809const vec3 pickingColor = vec3(1.0, 0.0, 0.0);
2810
2811void main(void) {
2812  geometry.worldPosition = positions;
2813  geometry.uv = texCoords;
2814  geometry.pickingColor = pickingColor;
2815
2816  gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);
2817  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
2818
2819  vTexCoord = texCoords;
2820
2821  if (bitmap.coordinateConversion < -0.5) {
2822    vTexPos = geometry.position.xy + project.commonOrigin.xy;
2823  } else if (bitmap.coordinateConversion > 0.5) {
2824    vTexPos = geometry.worldPosition.xy;
2825  }
2826
2827  vec4 color = vec4(0.0);
2828  DECKGL_FILTER_COLOR(color, geometry);
2829}
2830`,lce=`
2831vec3 packUVsIntoRGB(vec2 uv) {
2832  // Extract the top 8 bits. We want values to be truncated down so we can add a fraction
2833  vec2 uv8bit = floor(uv * 256.);
2834
2835  // Calculate the normalized remainders of u and v parts that do not fit into 8 bits
2836  // Scale and clamp to 0-1 range
2837  vec2 uvFraction = fract(uv * 256.);
2838  vec2 uvFraction4bit = floor(uvFraction * 16.);
2839
2840  // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates
2841  float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;
2842
2843  return vec3(uv8bit, fractions) / 255.;
2844}
2845`,uce=`#version 300 es
2846#define SHADER_NAME bitmap-layer-fragment-shader
2847
2848#ifdef GL_ES
2849precision highp float;
2850#endif
2851
2852uniform sampler2D bitmapTexture;
2853
2854in vec2 vTexCoord;
2855in vec2 vTexPos;
2856
2857out vec4 fragColor;
2858
2859/* projection utils */
2860const float TILE_SIZE = 512.0;
2861const float PI = 3.1415926536;
2862const float WORLD_SCALE = TILE_SIZE / PI / 2.0;
2863
2864// from degrees to Web Mercator
2865vec2 lnglat_to_mercator(vec2 lnglat) {
2866  float x = lnglat.x;
2867  float y = clamp(lnglat.y, -89.9, 89.9);
2868  return vec2(
2869    radians(x) + PI,
2870    PI + log(tan(PI * 0.25 + radians(y) * 0.5))
2871  ) * WORLD_SCALE;
2872}
2873
2874// from Web Mercator to degrees
2875vec2 mercator_to_lnglat(vec2 xy) {
2876  xy /= WORLD_SCALE;
2877  return degrees(vec2(
2878    xy.x - PI,
2879    atan(exp(xy.y - PI)) * 2.0 - PI * 0.5
2880  ));
2881}
2882/* End projection utils */
2883
2884// apply desaturation
2885vec3 color_desaturate(vec3 color) {
2886  float luminance = (color.r + color.g + color.b) * 0.333333333;
2887  return mix(color, vec3(luminance), bitmap.desaturate);
2888}
2889
2890// apply tint
2891vec3 color_tint(vec3 color) {
2892  return color * bitmap.tintColor;
2893}
2894
2895// blend with background color
2896vec4 apply_opacity(vec3 color, float alpha) {
2897  if (bitmap.transparentColor.a == 0.0) {
2898    return vec4(color, alpha);
2899  }
2900  float blendedAlpha = alpha + bitmap.transparentColor.a * (1.0 - alpha);
2901  float highLightRatio = alpha / blendedAlpha;
2902  vec3 blendedRGB = mix(bitmap.transparentColor.rgb, color, highLightRatio);
2903  return vec4(blendedRGB, blendedAlpha);
2904}
2905
2906vec2 getUV(vec2 pos) {
2907  return vec2(
2908    (pos.x - bitmap.bounds[0]) / (bitmap.bounds[2] - bitmap.bounds[0]),
2909    (pos.y - bitmap.bounds[3]) / (bitmap.bounds[1] - bitmap.bounds[3])
2910  );
2911}
2912
2913${lce}
2914
2915void main(void) {
2916  vec2 uv = vTexCoord;
2917  if (bitmap.coordinateConversion < -0.5) {
2918    vec2 lnglat = mercator_to_lnglat(vTexPos);
2919    uv = getUV(lnglat);
2920  } else if (bitmap.coordinateConversion > 0.5) {
2921    vec2 commonPos = lnglat_to_mercator(vTexPos);
2922    uv = getUV(commonPos);
2923  }
2924  vec4 bitmapColor = texture(bitmapTexture, uv);
2925
2926  fragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * layer.opacity);
2927
2928  geometry.uv = uv;
2929  DECKGL_FILTER_COLOR(fragColor, geometry);
2930
2931  if (bool(picking.isActive) && !bool(picking.isAttribute)) {
2932    // Since instance information is not used, we can use picking color for pixel index
2933    fragColor.rgb = packUVsIntoRGB(uv);
2934  }
2935}
2936`,fce={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:Qr.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}};
2936class By extends Es{getShaders(){return super.getShaders({vs:cce,fs:uce,modules:[Ls,_a,ace]})}initializeState(){const e=this.getAttributeManager();e.remove(["instancePickingColors"]);const t=!0;e.add({indices:{size:1,isIndexed:!0,update:n=>n.value=this.state.mesh.indices,noAlloc:t},positions:{size:3,type:"float64",fp64:this.use64bitPositions(),update:n=>n.value=this.state.mesh.positions,noAlloc:t},texCoords:{size:2,update:n=>n.value=this.state.mesh.texCoords,noAlloc:t}})}updateState({props:e,oldProps:t,changeFlags:n}){const i=this.getAttributeManager();if(n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),i.invalidateAll()),e.bounds!==t.bounds){const s=this.state.mesh,o=this._createMesh();this.state.model.setVertexCount(o.vertexCount);for(const c in o)s&&s[c]!==o[c]&&i.invalidate(c);this.setState({mesh:o,...this._getCoordinateUniforms()})}else e._imageCoordinateSystem!==t._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(e){const{image:t}=this.props,n=e.info;if(!n.color||!t)return n.bitmap=null,n;const{width:i,height:s}=t;n.index=0;const o=hce(n.color);return n.bitmap={size:{width:i,height:s},uv:o,pixel:[Math.floor(o[0]*i),Math.floor(o[1]*s)]},n}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(e){super._updateAutoHighlight({...e,color:this.encodePickingColor(0)})}_createMesh(){const{bounds:e}=this.props;let t=e;return PM(e)&&(t=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),ice(t,this.context.viewport.resolution)}_getModel(){return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-list",isInstanced:!1})}draw(e){const{shaderModuleProps:t}=e,{model:n,coordinateConversion:i,bounds:s,disablePicking:o}=this.state,{image:c,desaturate:f,transparentColor:A,tintColor:v}=this.props;if(!(t.picking.isActive&&o)&&c&&n){const w={bitmapTexture:c,bounds:s,coordinateConversion:i,desaturate:f,tintColor:v.slice(0,3).map(S=>S/255),transparentColor:A.map(S=>S/255)};n.shaderInputs.setProps({bitmap:w}),n.draw(this.context.renderPass)}}_getCoordinateUniforms(){const{LNGLAT:e,CARTESIAN:t,DEFAULT:n}=Qr;let{_imageCoordinateSystem:i}=this.props;if(i!==n){const{bounds:s}=this.props;if(!PM(s))throw new Error("_imageCoordinateSystem only supports rectangular bounds");const o=this.context.viewport.resolution?e:t;
2936if(i=i===e?e:t,i===e&&o===t)return{coordinateConversion:-1,bounds:s};if(i===t&&o===e){const c=eu([s[0],s[1]]),f=eu([s[2],s[3]]);return{coordinateConversion:1,bounds:[c[0],c[1],f[0],f[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}}By.layerName="BitmapLayer";By.defaultProps=fce;function hce(r){const[e,t,n]=r,i=(n&240)/256,s=(n&15)/16;return[(e+s)/256,(t+i)/256]}function PM(r){return Number.isFinite(r[0])}const RM=`uniform iconUniforms {
2937  float sizeScale;
2938  vec2 iconsTextureDim;
2939  float sizeMinPixels;
2940  float sizeMaxPixels;
2941  bool billboard;
2942  highp int sizeUnits;
2943  float alphaCutoff;
2944} icon;
2945`,dce={name:"icon",vs:RM,fs:RM,uniformTypes:{sizeScale:"f32",iconsTextureDim:"vec2<f32>",sizeMinPixels:"f32",sizeMaxPixels:"f32",billboard:"f32",sizeUnits:"i32",alphaCutoff:"f32"}},pce=`#version 300 es
2946#define SHADER_NAME icon-layer-vertex-shader
2947in vec2 positions;
2948in vec3 instancePositions;
2949in vec3 instancePositions64Low;
2950in float instanceSizes;
2951in float instanceAngles;
2952in vec4 instanceColors;
2953in vec3 instancePickingColors;
2954in vec4 instanceIconFrames;
2955in float instanceColorModes;
2956in vec2 instanceOffsets;
2957in vec2 instancePixelOffset;
2958out float vColorMode;
2959out vec4 vColor;
2960out vec2 vTextureCoords;
2961out vec2 uv;
2962vec2 rotate_by_angle(vec2 vertex, float angle) {
2963float angle_radian = angle * PI / 180.0;
2964float cos_angle = cos(angle_radian);
2965float sin_angle = sin(angle_radian);
2966mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
2967return rotationMatrix * vertex;
2968}
2969void main(void) {
2970geometry.worldPosition = instancePositions;
2971geometry.uv = positions;
2972geometry.pickingColor = instancePickingColors;
2973uv = positions;
2974vec2 iconSize = instanceIconFrames.zw;
2975float sizePixels = clamp(
2976project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
2977icon.sizeMinPixels, icon.sizeMaxPixels
2978);
2979float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;
2980vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;
2981pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;
2982pixelOffset += instancePixelOffset;
2983pixelOffset.y *= -1.0;
2984if (icon.billboard)  {
2985gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
2986DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
2987vec3 offset = vec3(pixelOffset, 0.0);
2988DECKGL_FILTER_SIZE(offset, geometry);
2989gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
2990} else {
2991vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
2992DECKGL_FILTER_SIZE(offset_common, geometry);
2993gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
2994DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
2995}
2996vTextureCoords = mix(
2997instanceIconFrames.xy,
2998instanceIconFrames.xy + iconSize,
2999(positions.xy + 1.0) / 2.0
3000) / icon.iconsTextureDim;
3001vColor = instanceColors;
3002DECKGL_FILTER_COLOR(vColor, geometry);
3003vColorMode = instanceColorModes;
3004}
3005`,Ace=`#version 300 es
3006#define SHADER_NAME icon-layer-fragment-shader
3007precision highp float;
3008uniform sampler2D iconsTexture;
3009in float vColorMode;
3010in vec4 vColor;
3011in vec2 vTextureCoords;
3012in vec2 uv;
3013out vec4 fragColor;
3014void main(void) {
3015geometry.uv = uv;
3016vec4 texColor = texture(iconsTexture, vTextureCoords);
3017vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);
3018float a = texColor.a * layer.opacity * vColor.a;
3019if (a < icon.alphaCutoff) {
3020discard;
3021}
3022fragColor = vec4(color, a);
3023DECKGL_FILTER_COLOR(fragColor, geometry);
3024}
3025`,gce=1024,mce=4,FM=()=>{},DM={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},_ce={x:0,y:0,width:0,height:0};function yce(r){return Math.pow(2,Math.ceil(Math.log2(r)))}function vce(r,e,t,n){const i=Math.min(t/e.width,n/e.height),s=Math.floor(e.width*i),o=Math.floor(e.height*i);return i===1?{image:e,width:s,height:o}:(r.canvas.height=o,r.canvas.width=s,r.clearRect(0,0,s,o),r.drawImage(e,0,0,e.width,e.height,0,0,s,o),{image:r.canvas,width:s,height:o})}function Ig(r){return r&&(r.id||r.url)}function bce(r,e,t,n){const{width:i,height:s,device:o}=r,c=o.createTexture({format:"rgba8unorm",width:e,height:t,sampler:n,mipmaps:!0}),f=o.createCommandEncoder();return f.copyTextureToTexture({sourceTexture:r,destinationTexture:c,width:i,height:s}),f.finish(),r.destroy(),c}function OM(r,e,t){for(let n=0;n<e.length;n++){const{icon:i,xOffset:s}=e[n],o=Ig(i);r[o]={...i,x:s,y:t}}}function xce({icons:r,buffer:e,mapping:t={},xOffset:n=0,yOffset:i=0,rowHeight:s=0,canvasWidth:o}){let c=[];for(let f=0;f<r.length;f++){const A=r[f],v=Ig(A);if(!t[v]){const{height:w,width:S}=A;n+S+e>o&&(OM(t,c,i),n=0,i=s+i+e,s=0,c=[]),c.push({icon:A,xOffset:n}),n=n+S+e,s=Math.max(s,w)}}return c.length>0&&OM(t,c,i),{mapping:t,rowHeight:s,xOffset:n,yOffset:i,canvasWidth:o,canvasHeight:yce(s+i+e)}}function wce(r,e,t){if(!r||!e)return null;t=t||{};const n={},{iterable:i,objectInfo:s}=gl(r);for(const o of i){s.index++;const c=e(o,s),f=Ig(c);if(!c)throw new Error("Icon is missing.");if(!c.url)throw new Error("Icon url is missing.");!n[f]&&(!t[f]||c.url!==t[f].url)&&(n[f]={...c,source:o,sourceIndex:s.index})}return n}class Cce{constructor(e,{onUpdate:t=FM,onError:n=FM}){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=mce,this._canvasWidth=gce,this._canvasHeight=0,this._canvas=null,this.device=e,this.onUpdate=t,this.onError=n}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(e){const t=this._autoPacking?Ig(e):e;return this._mapping[t]||_ce}setProps({loadOptions:e,autoPacking:t,iconAtlas:n,iconMapping:i,textureParameters:s}){e&&(this._loadOptions=e),t!==void 0&&(this._autoPacking=t),i&&(this._mapping=i),n&&(this._texture?.delete(),this._texture=null,this._externalTexture=n),s&&(this._samplerParameters=s)}get isLoaded(){return this._pendingCount===0}packIcons(e,t){if(!this._autoPacking||typeof document>"u")return;const n=Object.values(wce(e,t,this._mapping)||{});if(n.length>0){const{mapping:i,xOffset:s,yOffset:o,rowHeight:c,canvasHeight:f}=xce({icons:n,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=c,this._mapping=i,this._xOffset=s,this._yOffset=o,this._canvasHeight=f,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",width:this._canvasWidth,height:this._canvasHeight,sampler:this._samplerParameters||DM,mipmaps:!0})),this._texture.height!==this._canvasHeight&&(this._texture=bce(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||DM)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(n)}}_loadIcons(e){const t=this._canvas.getContext("2d",{willReadFrequently:!0});
3025for(const n of e)this._pendingCount++,Wp(n.url,this._loadOptions).then(i=>{const s=Ig(n),o=this._mapping[s],{x:c,y:f,width:A,height:v}=o,{image:w,width:S,height:F}=vce(t,i,A,v);this._texture?.copyExternalImage({image:w,x:c+(A-S)/2,y:f+(v-F)/2,width:S,height:F}),o.width=S,o.height=F,this._texture.generateMipmap(),this.onUpdate()}).catch(i=>{this.onError({url:n.url,source:n.source,sourceIndex:n.sourceIndex,loadOptions:this._loadOptions,error:i})}).finally(()=>{this._pendingCount--})}}const u6=[0,0,0,255],Tce={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:r=>r.position},getIcon:{type:"accessor",value:r=>r.icon},getColor:{type:"accessor",value:u6},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}};class Jp extends Es{getShaders(){return super.getShaders({vs:pce,fs:Ace,modules:[Ls,_a,dce]})}initializeState(){this.state={iconManager:new Cce(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:u6},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(e){super.updateState(e);const{props:t,oldProps:n,changeFlags:i}=e,s=this.getAttributeManager(),{iconAtlas:o,iconMapping:c,data:f,getIcon:A,textureParameters:v}=t,{iconManager:w}=this.state;if(typeof o=="string")return;const S=o||this.internalState.isAsyncPropLoading("iconAtlas");w.setProps({loadOptions:t.loadOptions,autoPacking:!S,iconAtlas:o,iconMapping:S?c:null,textureParameters:v}),S?n.iconMapping!==t.iconMapping&&s.invalidate("getIcon"):(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getIcon))&&w.packIcons(f,A),i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),s.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(e){super.finalizeState(e),this.state.iconManager.finalize()}draw({uniforms:e}){const{sizeScale:t,sizeMinPixels:n,sizeMaxPixels:i,sizeUnits:s,billboard:o,alphaCutoff:c}=this.props,{iconManager:f}=this.state,A=f.getTexture();if(A){const v=this.state.model,w={iconsTexture:A,iconsTextureDim:[A.width,A.height],sizeUnits:Po[s],sizeScale:t,sizeMinPixels:n,sizeMaxPixels:i,billboard:o,alphaCutoff:c};v.shaderInputs.setProps({icon:w}),v.draw(this.context.renderPass)}}_getModel(){const e=[-1,-1,1,-1,-1,1,1,1];return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ys({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(e){const t=this.getCurrentLayer()?.props.onIconError;t?t(e):Yr.error(e.error.message)()}getInstanceOffset(e){const{width:t,height:n,anchorX:i=t/2,anchorY:s=n/2}=this.state.iconManager.getIconMapping(e);return[t/2-i,n/2-s]}getInstanceColorMode(e){return this.state.iconManager.getIconMapping(e).mask?1:0}getInstanceIconFrame(e){const{x:t,y:n,width:i,height:s}=this.state.iconManager.getIconMapping(e);return[t,n,i,s]}}Jp.defaultProps=Tce;Jp.layerName="IconLayer";const Ece=`struct LineUniforms {
3026  widthScale: f32,
3027  widthMinPixels: f32,
3028  widthMaxPixels: f32,
3029  useShortestPath: f32,
3030  widthUnits: i32,
3031};
3032
3033@group(0) @binding(1)
3034var<uniform> line: LineUniforms;
3035`,LM=`uniform lineUniforms {
3036  float widthScale;
3037  float widthMinPixels;
3038  float widthMaxPixels;
3039  float useShortestPath;
3040  highp int widthUnits;
3041} line;
3042`,Bce={name:"line",source:Ece,vs:LM,fs:LM,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",useShortestPath:"f32",widthUnits:"i32"}},Sce=`// TODO(ibgreen): Hack for Layer uniforms (move to new "color" module?)
3043struct LayerUniforms {
3044  opacity: f32,
3045};
3046var<private> layer: LayerUniforms = LayerUniforms(1.0);
3047// @group(0) @binding(1) var<uniform> layer: LayerUniforms;
3048
3049// ---------- Helper Structures & Functions ----------
3050
3051// Placeholder filter functions.
3052fn deckgl_filter_size(offset: vec3<f32>, geometry: Geometry) -> vec3<f32> {
3053  return offset;
3054}
3055fn deckgl_filter_gl_position(p: vec4<f32>, geometry: Geometry) -> vec4<f32> {
3056  return p;
3057}
3058fn deckgl_filter_color(color: vec4<f32>, geometry: Geometry) -> vec4<f32> {
3059  return color;
3060}
3061
3062// Compute an extrusion offset given a line direction (in clipspace),
3063// an offset direction (-1 or 1), and a width in pixels.
3064// Assumes a uniform "project" with a viewportSize field is available.
3065fn getExtrusionOffset(line_clipspace: vec2<f32>, offset_direction: f32, width: f32) -> vec2<f32> {
3066  // project.viewportSize should be provided as a uniform (not shown here)
3067  let dir_screenspace = normalize(line_clipspace * project.viewportSize);
3068  // Rotate by 90°: (x,y) becomes (-y,x)
3069  let rotated = vec2<f32>(-dir_screenspace.y, dir_screenspace.x);
3070  return rotated * offset_direction * width / 2.0;
3071}
3072
3073// Splits the line between two points at a given x coordinate.
3074// Interpolates the y and z components.
3075fn splitLine(a: vec3<f32>, b: vec3<f32>, x: f32) -> vec3<f32> {
3076  let t: f32 = (x - a.x) / (b.x - a.x);
3077  return vec3<f32>(x, a.yz + t * (b.yz - a.yz));
3078}
3079
3080// ---------- Uniforms & Global Structures ----------
3081
3082// Uniforms for line, layer, and project are assumed to be defined elsewhere.
3083// For example:
3084//
3085// @group(0) @binding(0)
3086// var<uniform> line: LineUniform;
3087//
3088// struct LayerUniform {
3089//   opacity: f32,
3090// };
3091// @group(0) @binding(1)
3092// var<uniform> layer: LayerUniform;
3093//
3094// struct ProjectUniform {
3095//   viewportSize: vec2<f32>,
3096// };
3097// @group(0) @binding(2)
3098// var<uniform> project: ProjectUniform;
3099
3100
3101
3102// ---------- Vertex Output Structure ----------
3103
3104struct Varyings {
3105  @builtin(position) gl_Position: vec4<f32>,
3106  @location(0) vColor: vec4<f32>,
3107  @location(1) uv: vec2<f32>,
3108};
3109
3110// ---------- Vertex Shader Entry Point ----------
3111
3112@vertex
3113fn vertexMain(
3114  @location(0) positions: vec3<f32>,
3115  @location(1) instanceSourcePositions: vec3<f32>,
3116  @location(2) instanceTargetPositions: vec3<f32>,
3117  @location(3) instanceSourcePositions64Low: vec3<f32>,
3118  @location(4) instanceTargetPositions64Low: vec3<f32>,
3119  @location(5) instanceColors: vec4<f32>,
3120  @location(6) instancePickingColors: vec3<f32>,
3121  @location(7) instanceWidths: f32
3122) -> Varyings {
3123  var geometry: Geometry;
3124  geometry.worldPosition = instanceSourcePositions;
3125  geometry.worldPositionAlt = instanceTargetPositions;
3126
3127  var source_world: vec3<f32> = instanceSourcePositions;
3128  var target_world: vec3<f32> = instanceTargetPositions;
3129  var source_world_64low: vec3<f32> = instanceSourcePositions64Low;
3130  var target_world_64low: vec3<f32> = instanceTargetPositions64Low;
3131
3132  // Apply shortest-path adjustments if needed.
3133  if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) {
3134    source_world.x = (source_world.x + 180.0 % 360.0) - 180.0;
3135    target_world.x = (target_world.x + 180.0 % 360.0) - 180.0;
3136    let deltaLng: f32 = target_world.x - source_world.x;
3137
3138    if (deltaLng * line.useShortestPath > 180.0) {
3139      source_world.x = source_world.x + 360.0 * line.useShortestPath;
3140      source_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath);
3141      source_world_64low = vec3<f32>(0.0, 0.0, 0.0);
3142    } else if (deltaLng * line.useShortestPath < -180.0) {
3143      target_world.x = target_world.x + 360.0 * line.useShortestPath;
3144      target_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath);
3145      target_world_64low = vec3<f32>(0.0, 0.0, 0.0);
3146    } else if (line.useShortestPath < 0.0) {
3147      var abortOut: Varyings;
3148      abortOut.gl_Position = vec4<f32>(0.0);
3149      abortOut.vColor = vec4<f32>(0.0);
3150      abortOut.uv = vec2<f32>(0.0);
3151      return abortOut;
3152    }
3153  }
3154
3155  // Project Pos and target positions to clip space.
3156  let sourceResult = project_position_to_clipspace_and_commonspace(source_world, source_world_64low, vec3<f32>(0.0));
3157  let targetResult = project_position_to_clipspace_and_commonspace(target_world, target_world_64low, vec3<f32>(0.0));
3158  let sourcePos: vec4<f32> = sourceResult.clipPosition;
3159  let targetPos: vec4<f32> = targetResult.clipPosition;
3160  let source_commonspace: vec4<f32> = sourceResult.commonPosition;
3161  let target_commonspace: vec4<f32> = targetResult.commonPosition;
3162
3163  // Interpolate along the line segment.
3164  let segmentIndex: f32 = positions.x;
3165  let p: vec4<f32> = sourcePos + segmentIndex * (targetPos - sourcePos);
3166  geometry.position = source_commonspace + segmentIndex * (target_commonspace - source_commonspace);
3167  let uv: vec2<f32> = positions.xy;
3168  geometry.uv = uv;
3169  geometry.pickingColor = instancePickingColors;
3170
3171  // Determine width in pixels.
3172  let widthPixels: f32 = clamp(
3173    project_unit_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits),
3174    line.widthMinPixels, line.widthMaxPixels
3175  );
3176
3177  // Compute extrusion offset.
3178  let extrusion: vec2<f32> = getExtrusionOffset(targetPos.xy - sourcePos.xy, positions.y, widthPixels);
3179  let offset: vec3<f32> = vec3<f32>(extrusion, 0.0);
3180
3181  // Apply deck.gl filter functions.
3182  let filteredOffset = deckgl_filter_size(offset, geometry);
3183  let filteredP = deckgl_filter_gl_position(p, geometry);
3184
3185  let clipOffset: vec2<f32> = project_pixel_size_to_clipspace(filteredOffset.xy);
3186  let finalPosition: vec4<f32>
3186 = filteredP + vec4<f32>(clipOffset, 0.0, 0.0);
3187
3188  // Compute color.
3189  var vColor: vec4<f32> = vec4<f32>(instanceColors.rgb, instanceColors.a * layer.opacity);
3190  // vColor = deckgl_filter_color(vColor, geometry);
3191
3192  var output: Varyings;
3193  output.gl_Position = finalPosition;
3194  output.vColor = vColor;
3195  output.uv = uv;
3196  return output;
3197}
3198
3199@fragment
3200fn fragmentMain(
3201  @location(0) vColor: vec4<f32>,
3202  @location(1) uv: vec2<f32>
3203) -> @location(0) vec4<f32> {
3204  // Create and initialize geometry with the provided uv.
3205  var geometry: Geometry;
3206  geometry.uv = uv;
3207
3208  // Start with the input color.
3209  var fragColor: vec4<f32> = vColor;
3210
3211  // Apply the deck.gl filter to the color.
3212  fragColor = deckgl_filter_color(fragColor, geometry);
3213
3214  return fragColor;
3215}
3216`,Ice=`#version 300 es
3217#define SHADER_NAME line-layer-vertex-shader
3218in vec3 positions;
3219in vec3 instanceSourcePositions;
3220in vec3 instanceTargetPositions;
3221in vec3 instanceSourcePositions64Low;
3222in vec3 instanceTargetPositions64Low;
3223in vec4 instanceColors;
3224in vec3 instancePickingColors;
3225in float instanceWidths;
3226out vec4 vColor;
3227out vec2 uv;
3228vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
3229vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
3230dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
3231return dir_screenspace * offset_direction * width / 2.0;
3232}
3233vec3 splitLine(vec3 a, vec3 b, float x) {
3234float t = (x - a.x) / (b.x - a.x);
3235return vec3(x, mix(a.yz, b.yz, t));
3236}
3237void main(void) {
3238geometry.worldPosition = instanceSourcePositions;
3239geometry.worldPositionAlt = instanceTargetPositions;
3240vec3 source_world = instanceSourcePositions;
3241vec3 target_world = instanceTargetPositions;
3242vec3 source_world_64low = instanceSourcePositions64Low;
3243vec3 target_world_64low = instanceTargetPositions64Low;
3244if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) {
3245source_world.x = mod(source_world.x + 180., 360.0) - 180.;
3246target_world.x = mod(target_world.x + 180., 360.0) - 180.;
3247float deltaLng = target_world.x - source_world.x;
3248if (deltaLng * line.useShortestPath > 180.) {
3249source_world.x += 360. * line.useShortestPath;
3250source_world = splitLine(source_world, target_world, 180. * line.useShortestPath);
3251source_world_64low = vec3(0.0);
3252} else if (deltaLng * line.useShortestPath < -180.) {
3253target_world.x += 360. * line.useShortestPath;
3254target_world = splitLine(source_world, target_world, 180. * line.useShortestPath);
3255target_world_64low = vec3(0.0);
3256} else if (line.useShortestPath < 0.) {
3257gl_Position = vec4(0.);
3258return;
3259}
3260}
3261vec4 source_commonspace;
3262vec4 target_commonspace;
3263vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace);
3264vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace);
3265float segmentIndex = positions.x;
3266vec4 p = mix(source, target, segmentIndex);
3267geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);
3268uv = positions.xy;
3269geometry.uv = uv;
3270geometry.pickingColor = instancePickingColors;
3271float widthPixels = clamp(
3272project_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits),
3273line.widthMinPixels, line.widthMaxPixels
3274);
3275vec3 offset = vec3(
3276getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),
32770.0);
3278DECKGL_FILTER_SIZE(offset, geometry);
3279DECKGL_FILTER_GL_POSITION(p, geometry);
3280gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
3281vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);
3282DECKGL_FILTER_COLOR(vColor, geometry);
3283}
3284`,Mce=`#version 300 es
3285#define SHADER_NAME line-layer-fragment-shader
3286precision highp float;
3287in vec4 vColor;
3288in vec2 uv;
3289out vec4 fragColor;
3290void main(void) {
3291geometry.uv = uv;
3292fragColor = vColor;
3293DECKGL_FILTER_COLOR(fragColor, geometry);
3294}
3295`,Pce=[0,0,0,255],Rce={getSourcePosition:{type:"accessor",value:r=>r.sourcePosition},getTargetPosition:{type:"accessor",value:r=>r.targetPosition},getColor:{type:"accessor",value:Pce},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}};class Sy extends Es{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:Ice,fs:Mce,source:Sce,modules:[Ls,_a,Bce]})}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}){const{widthUnits:t,widthScale:n,widthMinPixels:i,widthMaxPixels:s,wrapLongitude:o}=this.props,c=this.state.model,f={widthUnits:Po[t],widthScale:n,widthMinPixels:i,widthMaxPixels:s,useShortestPath:o?1:0};c.shaderInputs.setProps({line:f}),c.draw(this.context.renderPass),o&&(c.shaderInputs.setProps({line:{...f,useShortestPath:-1}}),c.draw(this.context.renderPass))}_getModel(){const e=[0,-1,0,0,1,0,1,-1,0,1,1,0];return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ys({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}}Sy.layerName="LineLayer";Sy.defaultProps=Rce;const kM=`uniform pointCloudUniforms {
3296  float radiusPixels;
3297  highp int sizeUnits;
3298} pointCloud;
3299`,Fce={name:"pointCloud",vs:kM,fs:kM,uniformTypes:{radiusPixels:"f32",sizeUnits:"i32"}},Dce=`#version 300 es
3300#define SHADER_NAME point-cloud-layer-vertex-shader
3301in vec3 positions;
3302in vec3 instanceNormals;
3303in vec4 instanceColors;
3304in vec3 instancePositions;
3305in vec3 instancePositions64Low;
3306in vec3 instancePickingColors;
3307out vec4 vColor;
3308out vec2 unitPosition;
3309void main(void) {
3310geometry.worldPosition = instancePositions;
3311geometry.normal = project_normal(instanceNormals);
3312unitPosition = positions.xy;
3313geometry.uv = unitPosition;
3314geometry.pickingColor = instancePickingColors;
3315vec3 offset = vec3(positions.xy * project_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0);
3316DECKGL_FILTER_SIZE(offset, geometry);
3317gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);
3318DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
3319gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
3320vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
3321vColor = vec4(lightColor, instanceColors.a * layer.opacity);
3322DECKGL_FILTER_COLOR(vColor, geometry);
3323}
3324`,Oce=`#version 300 es
3325#define SHADER_NAME point-cloud-layer-fragment-shader
3326precision highp float;
3327in vec4 vColor;
3328in vec2 unitPosition;
3329out vec4 fragColor;
3330void main(void) {
3331geometry.uv = unitPosition.xy;
3332float distToCenter = length(unitPosition);
3333if (distToCenter > 1.0) {
3334discard;
3335}
3336fragColor = vColor;
3337DECKGL_FILTER_COLOR(fragColor, geometry);
3338}
3339`,f6=[0,0,0,255],h6=[0,0,1],Lce={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:r=>r.position},getNormal:{type:"accessor",value:h6},getColor:{type:"accessor",value:f6},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};function kce(r){const{header:e,attributes:t}=r;if(!(!e||!t)&&(r.length=e.vertexCount,t.POSITION&&(t.instancePositions=t.POSITION),t.NORMAL&&(t.instanceNormals=t.NORMAL),t.COLOR_0)){const{size:n,value:i}=t.COLOR_0;t.instanceColors={size:n,type:"unorm8",value:i}}}class $g extends Es{getShaders(){return super.getShaders({vs:Dce,fs:Oce,modules:[Ls,uy,_a,Fce]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:h6},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:f6}})}updateState(e){const{changeFlags:t,props:n}=e;super.updateState(e),t.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),t.dataChanged&&kce(n.data)}draw({uniforms:e}){const{pointSize:t,sizeUnits:n}=this.props,i=this.state.model,s={sizeUnits:Po[n],radiusPixels:t};i.shaderInputs.setProps({pointCloud:s}),i.draw(this.context.renderPass)}_getModel(){const e=[];for(let t=0;t<3;t++){const n=t/3*Math.PI*2;e.push(Math.cos(n)*2,Math.sin(n)*2,0)}return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ys({topology:"triangle-list",attributes:{positions:new Float32Array(e)}}),isInstanced:!0})}}$g.layerName="PointCloudLayer";$g.defaultProps=Lce;const NM=`uniform scatterplotUniforms {
3340  float radiusScale;
3341  float radiusMinPixels;
3342  float radiusMaxPixels;
3343  float lineWidthScale;
3344  float lineWidthMinPixels;
3345  float lineWidthMaxPixels;
3346  float stroked;
3347  float filled;
3348  bool antialiasing;
3349  bool billboard;
3350  highp int radiusUnits;
3351  highp int lineWidthUnits;
3352} scatterplot;
3353`,Nce={name:"scatterplot",vs:NM,fs:NM,source:"",uniformTypes:{radiusScale:"f32",radiusMinPixels:"f32",radiusMaxPixels:"f32",lineWidthScale:"f32",lineWidthMinPixels:"f32",lineWidthMaxPixels:"f32",stroked:"f32",filled:"f32",antialiasing:"f32",billboard:"f32",radiusUnits:"i32",lineWidthUnits:"i32"}},Uce=`#version 300 es
3354#define SHADER_NAME scatterplot-layer-vertex-shader
3355in vec3 positions;
3356in vec3 instancePositions;
3357in vec3 instancePositions64Low;
3358in float instanceRadius;
3359in float instanceLineWidths;
3360in vec4 instanceFillColors;
3361in vec4 instanceLineColors;
3362in vec3 instancePickingColors;
3363out vec4 vFillColor;
3364out vec4 vLineColor;
3365out vec2 unitPosition;
3366out float innerUnitRadius;
3367out float outerRadiusPixels;
3368void main(void) {
3369geometry.worldPosition = instancePositions;
3370outerRadiusPixels = clamp(
3371project_size_to_pixel(scatterplot.radiusScale * instanceRadius, scatterplot.radiusUnits),
3372scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels
3373);
3374float lineWidthPixels = clamp(
3375project_size_to_pixel(scatterplot.lineWidthScale * instanceLineWidths, scatterplot.lineWidthUnits),
3376scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels
3377);
3378outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0;
3379float edgePadding = scatterplot.antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;
3380unitPosition = edgePadding * positions.xy;
3381geometry.uv = unitPosition;
3382geometry.pickingColor = instancePickingColors;
3383innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / outerRadiusPixels;
3384if (scatterplot.billboard) {
3385gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
3386DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
3387vec3 offset = edgePadding * positions * outerRadiusPixels;
3388DECKGL_FILTER_SIZE(offset, geometry);
3389gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
3390} else {
3391vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);
3392DECKGL_FILTER_SIZE(offset, geometry);
3393gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);
3394DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
3395}
3396vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity);
3397DECKGL_FILTER_COLOR(vFillColor, geometry);
3398vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);
3399DECKGL_FILTER_COLOR(vLineColor, geometry);
3400}
3401`,zce=`#version 300 es
3402#define SHADER_NAME scatterplot-layer-fragment-shader
3403precision highp float;
3404in vec4 vFillColor;
3405in vec4 vLineColor;
3406in vec2 unitPosition;
3407in float innerUnitRadius;
3408in float outerRadiusPixels;
3409out vec4 fragColor;
3410void main(void) {
3411geometry.uv = unitPosition;
3412float distToCenter = length(unitPosition) * outerRadiusPixels;
3413float inCircle = scatterplot.antialiasing ?
3414smoothedge(distToCenter, outerRadiusPixels) :
3415step(distToCenter, outerRadiusPixels);
3416if (inCircle == 0.0) {
3417discard;
3418}
3419if (scatterplot.stroked > 0.5) {
3420float isLine = scatterplot.antialiasing ?
3421smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :
3422step(innerUnitRadius * outerRadiusPixels, distToCenter);
3423if (scatterplot.filled > 0.5) {
3424fragColor = mix(vFillColor, vLineColor, isLine);
3425} else {
3426if (isLine == 0.0) {
3427discard;
3428}
3429fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);
3430}
3431} else if (scatterplot.filled < 0.5) {
3432discard;
3433} else {
3434fragColor = vFillColor;
3435}
3436fragColor.a *= inCircle;
3437DECKGL_FILTER_COLOR(fragColor, geometry);
3438}
3439`,Gce=`// TODO(ibgreen): Hack for Layer uniforms (move to new "color" module?)
3440
3441struct LayerUniforms {
3442  opacity: f32,
3443};
3444
3445var<private> layer: LayerUniforms = LayerUniforms(1.0);
3446// @group(0) @binding(1) var<uniform> layer: LayerUniforms;
3447
3448// Main shaders
3449
3450struct ScatterplotUniforms {
3451  radiusScale: f32,
3452  radiusMinPixels: f32,
3453  radiusMaxPixels: f32,
3454  lineWidthScale: f32,
3455  lineWidthMinPixels: f32,
3456  lineWidthMaxPixels: f32,
3457  stroked: f32,
3458  filled: i32,
3459  antialiasing: i32,
3460  billboard: i32,
3461  radiusUnits: i32,
3462  lineWidthUnits: i32,
3463};
3464
3465struct ConstantAttributeUniforms {
3466 instancePositions: vec3<f32>,
3467 instancePositions64Low: vec3<f32>,
3468 instanceRadius: f32,
3469 instanceLineWidths: f32,
3470 instanceFillColors: vec4<f32>,
3471 instanceLineColors: vec4<f32>,
3472 instancePickingColors: vec3<f32>,
3473
3474 instancePositionsConstant: i32,
3475 instancePositions64LowConstant: i32,
3476 instanceRadiusConstant: i32,
3477 instanceLineWidthsConstant: i32,
3478 instanceFillColorsConstant: i32,
3479 instanceLineColorsConstant: i32,
3480 instancePickingColorsConstant: i32
3481};
3482
3483@group(0) @binding(2) var<uniform> scatterplot: ScatterplotUniforms;
3484
3485struct ConstantAttributes {
3486  instancePositions: vec3<f32>,
3487  instancePositions64Low: vec3<f32>,
3488  instanceRadius: f32,
3489  instanceLineWidths: f32,
3490  instanceFillColors: vec4<f32>,
3491  instanceLineColors: vec4<f32>,
3492  instancePickingColors: vec3<f32>
3493};
3494
3495const constants = ConstantAttributes(
3496  vec3<f32>(0.0),
3497  vec3<f32>(0.0),
3498  0.0,
3499  0.0,
3500  vec4<f32>(0.0, 0.0, 0.0, 1.0),
3501  vec4<f32>(0.0, 0.0, 0.0, 1.0),
3502  vec3<f32>(0.0)
3503);
3504
3505struct Attributes {
3506  @builtin(instance_index) instanceIndex : u32,
3507  @builtin(vertex_index) vertexIndex : u32,
3508  @location(0) positions: vec3<f32>,
3509  @location(1) instancePositions: vec3<f32>,
3510  @location(2) instancePositions64Low: vec3<f32>,
3511  @location(3) instanceRadius: f32,
3512  @location(4) instanceLineWidths: f32,
3513  @location(5) instanceFillColors: vec4<f32>,
3514  @location(6) instanceLineColors: vec4<f32>,
3515  @location(7) instancePickingColors: vec3<f32>
3516};
3517
3518struct Varyings {
3519  @builtin(position) position: vec4<f32>,
3520  @location(0) vFillColor: vec4<f32>,
3521  @location(1) vLineColor: vec4<f32>,
3522  @location(2) unitPosition: vec2<f32>,
3523  @location(3) innerUnitRadius: f32,
3524  @location(4) outerRadiusPixels: f32,
3525};
3526
3527@vertex
3528fn vertexMain(attributes: Attributes) -> Varyings {
3529  var varyings: Varyings;
3530
3531  // Draw an inline geometry constant array clip space triangle to verify that rendering works.
3532  // var positions = array<vec2<f32>, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5));
3533  // if (attributes.instanceIndex == 0) {
3534  //   varyings.position = vec4<f32>(positions[attributes.vertexIndex], 0.0, 1.0);
3535  //   return varyings;
3536  // }
3537
3538  // var geometry: Geometry;
3539  // geometry.worldPosition = instancePositions;
3540
3541  // Multiply out radius and clamp to limits
3542  varyings.outerRadiusPixels = clamp(
3543    project_unit_size_to_pixel(scatterplot.radiusScale * attributes.instanceRadius, scatterplot.radiusUnits),
3544    scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels
3545  );
3546
3547  // Multiply out line width and clamp to limits
3548  let lineWidthPixels = clamp(
3549    project_unit_size_to_pixel(scatterplot.lineWidthScale * attributes.instanceLineWidths, scatterplot.lineWidthUnits),
3550    scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels
3551  );
3552
3553  // outer radius needs to offset by half stroke width
3554  varyings.outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0;
3555  // Expand geometry to accommodate edge smoothing
3556  let edgePadding = select(
3557    (varyings.outerRadiusPixels + SMOOTH_EDGE_RADIUS) / varyings.outerRadiusPixels,
3558    1.0,
3559    scatterplot.antialiasing != 0
3560  );
3561
3562  // position on the containing square in [-1, 1] space
3563  varyings.unitPosition = edgePadding * attributes.positions.xy;
3564  geometry.uv = varyings.unitPosition;
3565  geometry.pickingColor = attributes.instancePickingColors;
3566
3567  varyings.innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / varyings.outerRadiusPixels;
3568
3569  if (scatterplot.billboard != 0) {
3570    varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, vec3<f32>(0.0)); // TODO , geometry.position);
3571    // DECKGL_FILTER_GL_POSITION(varyings.position, geometry);
3572    let offset = attributes.positions; // * edgePadding * varyings.outerRadiusPixels;
3573    // DECKGL_FILTER_SIZE(offset, geometry);
3574    let clipPixels = project_pixel_size_to_clipspace(offset.xy);
3575    varyings.position.x = clipPixels.x;
3576    varyings.position.y = clipPixels.y;
3577  } else {
3578    let offset = edgePadding * attributes.positions * project_pixel_size_float(varyings.outerRadiusPixels);
3579    // DECKGL_FILTER_SIZE(offset, geometry);
3580    varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, offset); // TODO , geometry.position);
3581    // DECKGL_FILTER_GL_POSITION(varyings.position, geometry);
3582  }
3583
3584  // Apply opacity to instance color, or return instance picking color
3585  varyings.vFillColor = vec4<f32>(attributes.instanceFillColors.rgb, attributes.instanceFillColors.a * layer.opacity);
3586  // DECKGL_FILTER_COLOR(varyings.vFillColor, geometry);
3587  varyings.vLineColor = vec4<f32>(attributes.instanceLineColors.rgb, attributes.instanceLineColors.a * layer.opacity);
3588  // DECKGL_FILTER_COLOR(varyings.vLineColor, geometry);
3589
3590  return varyings;
3591}
3592
3593@fragment
3594fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
3595  // var geometry: Geometry;
3596  // geometry.uv = unitPosition;
3597
3598  let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels;
3599  let inCircle = select(
3600    smoothedge(distToCenter, varyings.outerRadiusPixels),
3601    step(distToCenter, varyings.outerRadiusPixels),
3602    scatterplot.antialiasing != 0
3603  );
3604
3605  if (inCircle == 0.0) {
3606    // discard;
3607  }
3608
3609  var fragColor: vec4<f32>;
3610
3611  if (scatterplot.stroked != 0) {
3612    let isLine = select(
3613      smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
3614      step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
3615      scatterplot.antialiasing != 0
3616    );
3617
3618    if (scatterplot.filled != 0) {
3619      fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine);
3620    } else {
3621      if (isLine == 0.0) {
3622        // discard;
3623      }
3624      fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine);
3625    }
3626  } else if (scatterplot.filled == 0) {
3627    // discard;
3628  } else {
3629    fragColor = varyings.vFillColor;
3630  }
3631
3632  fragColor.a *= inCircle;
3633  // DECKGL_FILTER_COLOR(fragColor, geometry);
3634
3635  return fragColor;
3636  // return vec4<f32>(0, 0, 1, 1);
3637}
3638`,UM=[0,0,0,255],Vce={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:r=>r.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:UM},getLineColor:{type:"accessor",value:UM},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};
3638class Wg extends Es{getShaders(){return super.getShaders({vs:Uce,fs:zce,source:Gce,modules:[Ls,_a,Nce]})}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}){const{radiusUnits:t,radiusScale:n,radiusMinPixels:i,radiusMaxPixels:s,stroked:o,filled:c,billboard:f,antialiasing:A,lineWidthUnits:v,lineWidthScale:w,lineWidthMinPixels:S,lineWidthMaxPixels:F}=this.props,N={stroked:o,filled:c,billboard:f,antialiasing:A,radiusUnits:Po[t],radiusScale:n,radiusMinPixels:i,radiusMaxPixels:s,lineWidthUnits:Po[v],lineWidthScale:w,lineWidthMinPixels:S,lineWidthMaxPixels:F},U=this.state.model;U.shaderInputs.setProps({scatterplot:N}),U.draw(this.context.renderPass)}_getModel(){const e=[-1,-1,0,1,-1,0,-1,1,0,1,1,0];return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ys({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}}Wg.defaultProps=Vce;Wg.layerName="ScatterplotLayer";const AC={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function gC(r,e,t={}){return Hce(r,t)!==e?($ce(r,t),!0):!1}function Hce(r,e={}){return Math.sign(jce(r,e))}const zM={x:0,y:1,z:2};function jce(r,e={}){const{start:t=0,end:n=r.length,plane:i="xy"}=e,s=e.size||2;let o=0;const c=zM[i[0]],f=zM[i[1]];for(let A=t,v=n-s;A<n;A+=s)o+=(r[A+c]-r[v+c])*(r[A+f]+r[v+f]),v=A;return o/2}function $ce(r,e){const{start:t=0,end:n=r.length,size:i=2}=e,s=(n-t)/i,o=Math.floor(s/2);for(let c=0;c<o;++c){const f=t+c*i,A=t+(s-1-c)*i;for(let v=0;v<i;++v){const w=r[f+v];r[f+v]=r[A+v],r[A+v]=w}}}function xc(r,e){const t=e.length,n=r.length;if(n>0){let i=!0;for(let s=0;s<t;s++)if(r[n-t+s]!==e[s]){i=!1;break}if(i)return!1}for(let i=0;i<t;i++)r[n+i]=e[i];return!0}function ax(r,e){const t=e.length;for(let n=0;n<t;n++)r[n]=e[n]}function Mg(r,e,t,n,i=[]){const s=n+e*t;for(let o=0;o<t;o++)i[o]=r[s+o];return i}function cx(r,e,t,n,i=[]){let s,o;if(t&8)s=(n[3]-r[1])/(e[1]-r[1]),o=3;else if(t&4)s=(n[1]-r[1])/(e[1]-r[1]),o=1;else if(t&2)s=(n[2]-r[0])/(e[0]-r[0]),o=2;else if(t&1)s=(n[0]-r[0])/(e[0]-r[0]),o=0;else return null;for(let c=0;c<r.length;c++)i[c]=(o&1)===c?n[o]:s*(e[c]-r[c])+r[c];return i}function X0(r,e){let t=0;return r[0]<e[0]?t|=1:r[0]>e[2]&&(t|=2),r[1]<e[1]?t|=4:r[1]>e[3]&&(t|=8),t}function d6(r,e){const{size:t=2,broken:n=!1,gridResolution:i=10,gridOffset:s=[0,0],startIndex:o=0,endIndex:c=r.length}=e||{},f=(c-o)/t;let A=[];const v=[A],w=Mg(r,0,t,o);let S,F;const N=A6(w,i,s,[]),U=[];xc(A,w);for(let $=1;$<f;$++){for(S=Mg(r,$,t,o,S),F=X0(S,N);F;){cx(w,S,F,N,U);const G=X0(U,N);G&&(cx(w,U,G,N,U),F=G),xc(A,U),ax(w,U),Jce(N,i,F),n&&A.length>t&&(A=[],v.push(A),xc(A,w)),F=X0(S,N)}xc(A,S),ax(w,S)}return n?v:v[0]}const GM=0,Wce=1;function p6(r,e=null,t){if(!r.length)return[];const{size:n=2,gridResolution:i=10,gridOffset:s=[0,0],edgeTypes:o=!1}=t||{},c=[],f=[{pos:r,types:o?new Array(r.length/n).fill(Wce):null,holes:e||[]}],A=[[],[]];let v=[];for(;f.length;){const{pos:w,types:S,holes:F}=f.shift();Xce(w,n,F[0]||w.length,A),v=A6(A[0],i,s,v);const N=X0(A[1],v);if(N){let U=VM(w,S,n,0,F[0]||w.length,v,N);const $={pos:U[0].pos,types:U[0].types,holes:[]},G={pos:U[1].pos,types:U[1].types,holes:[]};f.push($,G);for(let H=0;H<F.length;H++)U=VM(w,S,n,F[H],F[H+1]||w.length,v,N),U[0]&&($.holes.push($.pos.length),$.pos=s0($.pos,U[0].pos),o&&($.types=s0($.types,U[0].types))),U[1]&&(G.holes.push(G.pos.length),G.pos=s0(G.pos,U[1].pos),o&&(G.types=s0(G.types,U[1].types)))}else{const U={positions:w};o&&(U.edgeTypes=S),F.length&&(U.holeIndices=F),c.push(U)}}return c}
3638function VM(r,e,t,n,i,s,o){const c=(i-n)/t,f=[],A=[],v=[],w=[],S=[];let F,N,U;const $=Mg(r,c-1,t,n);let G=Math.sign(o&8?$[1]-s[3]:$[0]-s[2]),H=e&&e[c-1],J=0,ue=0;for(let q=0;q<c;q++)F=Mg(r,q,t,n,F),N=Math.sign(o&8?F[1]-s[3]:F[0]-s[2]),U=e&&e[n/t+q],N&&G&&G!==N&&(cx($,F,o,s,S),xc(f,S)&&v.push(H),xc(A,S)&&w.push(H)),N<=0?(xc(f,F)&&v.push(U),J-=N):v.length&&(v[v.length-1]=GM),N>=0?(xc(A,F)&&w.push(U),ue+=N):w.length&&(w[w.length-1]=GM),ax($,F),G=N,H=U;return[J?{pos:f,types:e&&v}:null,ue?{pos:A,types:e&&w}:null]}function A6(r,e,t,n){const i=Math.floor((r[0]-t[0])/e)*e+t[0],s=Math.floor((r[1]-t[1])/e)*e+t[1];return n[0]=i,n[1]=s,n[2]=i+e,n[3]=s+e,n}function Jce(r,e,t){t&8?(r[1]+=e,r[3]+=e):t&4?(r[1]-=e,r[3]-=e):t&2?(r[0]+=e,r[2]+=e):t&1&&(r[0]-=e,r[2]-=e)}function Xce(r,e,t,n){let i=1/0,s=-1/0,o=1/0,c=-1/0;for(let f=0;f<t;f+=e){const A=r[f],v=r[f+1];i=A<i?A:i,s=A>s?A:s,o=v<o?v:o,c=v>c?v:c}return n[0][0]=i,n[0][1]=o,n[1][0]=s,n[1][1]=c,n}function s0(r,e){for(let t=0;t<e.length;t++)r.push(e[t]);return r}const Kce=85.051129;function qce(r,e){const{size:t=2,startIndex:n=0,endIndex:i=r.length,normalize:s=!0}=e||{},o=r.slice(n,i);g6(o,t,0,i-n);const c=d6(o,{size:t,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(s)for(const f of c)m6(f,t);return c}function Yce(r,e=null,t){const{size:n=2,normalize:i=!0,edgeTypes:s=!1}=t||{};e=e||[];const o=[],c=[];let f=0,A=0;for(let w=0;w<=e.length;w++){const S=e[w]||r.length,F=A,N=Zce(r,n,f,S);for(let U=N;U<S;U++)o[A++]=r[U];for(let U=f;U<N;U++)o[A++]=r[U];g6(o,n,F,A),Qce(o,n,F,A,t?.maxLatitude),f=S,c[w]=A}c.pop();const v=p6(o,c,{size:n,gridResolution:360,gridOffset:[-180,-180],edgeTypes:s});if(i)for(const w of v)m6(w.positions,n);return v}function Zce(r,e,t,n){let i=-1,s=-1;for(let o=t+1;o<n;o+=e){const c=Math.abs(r[o]);c>i&&(i=c,s=o-1)}return s}function Qce(r,e,t,n,i=Kce){const s=r[t],o=r[n-e];if(Math.abs(s-o)>180){const c=Mg(r,0,e,t);c[0]+=Math.round((o-s)/360)*360,xc(r,c),c[1]=Math.sign(c[1])*i,xc(r,c),c[0]=s,xc(r,c)}}function g6(r,e,t,n){let i=r[0],s;for(let o=t;o<n;o+=e){s=r[o];const c=s-i;(c>180||c<-180)&&(s-=Math.round(c/360)*360),r[o]=i=s}}function m6(r,e){let t;const n=r.length/e;for(let s=0;s<n&&(t=r[s*e],(t+180)%360===0);s++);const i=-Math.round(t/360)*360;if(i!==0)for(let s=0;s<n;s++)r[s*e]+=i}class ele extends Ys{constructor(e){const{indices:t,attributes:n}=tle(e);super({...e,indices:t,attributes:n})}}function tle(r){const{radius:e,height:t=1,nradial:n=10}=r;let{vertices:i}=r;i&&(Yr.assert(i.length>=n),i=i.flatMap(F=>[F[0],F[1]]),gC(i,AC.COUNTER_CLOCKWISE));const s=t>0,o=n+1,c=s?o*3+1:n,f=Math.PI*2/n,A=new Uint16Array(s?n*3*2:0),v=new Float32Array(c*3),w=new Float32Array(c*3);let S=0;if(s){for(let F=0;F<o;F++){const N=F*f,U=F%n,$=Math.sin(N),G=Math.cos(N);for(let H=0;H<2;H++)v[S+0]=i?i[U*2]:G*e,v[S+1]=i?i[U*2+1]:$*e,v[S+2]=(1/2-H)*t,w[S+0]=i?i[U*2]:G,w[S+1]=i?i[U*2+1]:$,S+=3}v[S+0]=v[S-3],v[S+1]=v[S-2],v[S+2]=v[S-1],S+=3}for(let F=s?0:1;F<o;F++){const N=Math.floor(F/2)*Math.sign(.5-F%2),U=N*f,$=(N+n)%n,G=Math.sin(U),H=Math.cos(U);v[S+0]=i?i[$*2]:H*e,v[S+1]=i?i[$*2+1]:G*e,v[S+2]=t/2,w[S+2]=1,S+=3}if(s){let F=0;for(let N=0;N<n;N++)A[F++]=N*2+0,A[F++]=N*2+2,A[F++]=N*2+0,A[F++]=N*2+1,A[F++]=N*2+1,A[F++]=N*2+3}return{indices:A,attributes:{POSITION:{size:3,value:v},NORMAL:{size:3,value:w}}}}const HM=`uniform columnUniforms {
3639  float radius;
3640  float angle;
3641  vec2 offset;
3642  bool extruded;
3643  bool stroked;
3644  bool isStroke;
3645  float coverage;
3646  float elevationScale;
3647  float edgeDistance;
3648  float widthScale;
3649  float widthMinPixels;
3650  float widthMaxPixels;
3651  highp int radiusUnits;
3652  highp int widthUnits;
3653} column;
3654`,rle={name:"column",vs:HM,fs:HM,uniformTypes:{radius:"f32",angle:"f32",offset:"vec2<f32>",extruded:"f32",stroked:"f32",isStroke:"f32",coverage:"f32",elevationScale:"f32",edgeDistance:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",radiusUnits:"i32",widthUnits:"i32"}},nle=`#version 300 es
3655#define SHADER_NAME column-layer-vertex-shader
3656in vec3 positions;
3657in vec3 normals;
3658in vec3 instancePositions;
3659in float instanceElevations;
3660in vec3 instancePositions64Low;
3661in vec4 instanceFillColors;
3662in vec4 instanceLineColors;
3663in float instanceStrokeWidths;
3664in vec3 instancePickingColors;
3665out vec4 vColor;
3666#ifdef FLAT_SHADING
3667out vec3 cameraPosition;
3668out vec4 position_commonspace;
3669#endif
3670void main(void) {
3671geometry.worldPosition = instancePositions;
3672vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;
3673mat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle));
3674float elevation = 0.0;
3675float strokeOffsetRatio = 1.0;
3676if (column.extruded) {
3677elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;
3678} else if (column.stroked) {
3679float widthPixels = clamp(
3680project_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits),
3681column.widthMinPixels, column.widthMaxPixels) / 2.0;
3682float halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius);
3683if (column.isStroke) {
3684strokeOffsetRatio -= sign(positions.z) * halfOffset;
3685} else {
3686strokeOffsetRatio -= halfOffset;
3687}
3688}
3689float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
3690float dotRadius = column.radius * column.coverage * shouldRender;
3691geometry.pickingColor = instancePickingColors;
3692vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);
3693vec3 centroidPosition64Low = instancePositions64Low;
3694vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;
3695if (column.radiusUnits == UNIT_METERS) {
3696offset = project_size(offset);
3697}
3698vec3 pos = vec3(offset, 0.);
3699DECKGL_FILTER_SIZE(pos, geometry);
3700gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
3701geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));
3702DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
3703if (column.extruded && !column.isStroke) {
3704#ifdef FLAT_SHADING
3705cameraPosition = project.cameraPosition;
3706position_commonspace = geometry.position;
3707vColor = vec4(color.rgb, color.a * layer.opacity);
3708#else
3709vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
3710vColor = vec4(lightColor, color.a * layer.opacity);
3711#endif
3712} else {
3713vColor = vec4(color.rgb, color.a * layer.opacity);
3714}
3715DECKGL_FILTER_COLOR(vColor, geometry);
3716}
3717`,ile=`#version 300 es
3718#define SHADER_NAME column-layer-fragment-shader
3719precision highp float;
3720out vec4 fragColor;
3721in vec4 vColor;
3722#ifdef FLAT_SHADING
3723in vec3 cameraPosition;
3724in vec4 position_commonspace;
3725#endif
3726void main(void) {
3727fragColor = vColor;
3728geometry.uv = vec2(0.);
3729#ifdef FLAT_SHADING
3730if (column.extruded && !column.isStroke && !bool(picking.isActive)) {
3731vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
3732fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);
3733}
3734#endif
3735DECKGL_FILTER_COLOR(fragColor, geometry);
3736}
3737`,z_=[0,0,0,255],sle={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:r=>r.position},getFillColor:{type:"accessor",value:z_},getLineColor:{type:"accessor",value:z_},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}};
3737class ml extends Es{getShaders(){const e={},{flatShading:t}=this.props;return t&&(e.FLAT_SHADING=1),super.getShaders({vs:nle,fs:ile,defines:e,modules:[Ls,t?Tw:uy,_a,rle]})}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:z_},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:z_},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(e){super.updateState(e);const{props:t,oldProps:n,changeFlags:i}=e,s=i.extensionsChanged||t.flatShading!==n.flatShading;s&&(this.state.models?.forEach(c=>c.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());const o=this.getNumInstances();this.state.fillModel.setInstanceCount(o),this.state.wireframeModel.setInstanceCount(o),(s||t.diskResolution!==n.diskResolution||t.vertices!==n.vertices||(t.extruded||t.stroked)!==(n.extruded||n.stroked))&&this._updateGeometry(t)}getGeometry(e,t,n){const i=new ele({radius:1,height:n?2:0,vertices:t,nradial:e});let s=0;if(t)for(let o=0;o<e;o++){const c=t[o],f=Math.sqrt(c[0]*c[0]+c[1]*c[1]);s+=f/e}else s=1;return this.setState({edgeDistance:Math.cos(Math.PI/e)*s}),i}_getModels(){const e=this.getShaders(),t=this.getAttributeManager().getBufferLayouts(),n=new Di(this.context.device,{...e,id:`${this.props.id}-fill`,bufferLayout:t,isInstanced:!0}),i=new Di(this.context.device,{...e,id:`${this.props.id}-wireframe`,bufferLayout:t,isInstanced:!0});return{fillModel:n,wireframeModel:i,models:[i,n]}}_updateGeometry({diskResolution:e,vertices:t,extruded:n,stroked:i}){const s=this.getGeometry(e,t,n||i);this.setState({fillVertexCount:s.attributes.POSITION.value.length/3});const o=this.state.fillModel,c=this.state.wireframeModel;o.setGeometry(s),o.setTopology("triangle-strip"),o.setIndexBuffer(null),c.setGeometry(s),c.setTopology("line-list")}draw({uniforms:e}){const{lineWidthUnits:t,lineWidthScale:n,lineWidthMinPixels:i,lineWidthMaxPixels:s,radiusUnits:o,elevationScale:c,extruded:f,filled:A,stroked:v,wireframe:w,offset:S,coverage:F,radius:N,angle:U}=this.props,$=this.state.fillModel,G=this.state.wireframeModel,{fillVertexCount:H,edgeDistance:J}=this.state,ue={radius:N,angle:U/180*Math.PI,offset:S,extruded:f,stroked:v,coverage:F,elevationScale:c,edgeDistance:J,radiusUnits:Po[o],widthUnits:Po[t],widthScale:n,widthMinPixels:i,widthMaxPixels:s};f&&w&&(G.shaderInputs.setProps({column:{...ue,isStroke:!0}}),G.draw(this.context.renderPass)),A&&($.setVertexCount(H),$.shaderInputs.setProps({column:{...ue,isStroke:!1}}),$.draw(this.context.renderPass)),!f&&v&&($.setVertexCount(H*2/3),$.shaderInputs.setProps({column:{...ue,isStroke:!0}}),$.draw(this.context.renderPass))}}ml.layerName="ColumnLayer";ml.defaultProps=sle;const ole={cellSize:{type:"number",min:0,value:1e3},offset:{type:"array",value:[1,1]}};let mC=class extends ml{_updateGeometry(){const e=new sL;this.state.fillModel.setGeometry(e)}draw({uniforms:e}){const{elevationScale:t,extruded:n,offset:i,coverage:s,cellSize:o,angle:c,radiusUnits:f}=this.props,A=this.state.fillModel,v={radius:o/2,radiusUnits:Po[f],angle:c,offset:i,extruded:n,stroked:!1,coverage:s,elevationScale:t,edgeDistance:1,isStroke:!1,widthUnits:0,widthScale:0,widthMinPixels:0,widthMaxPixels:0};A.shaderInputs.setProps({column:v}),A.draw(this.context.renderPass)}};mC.layerName="GridCellLayer";mC.defaultProps=ole;function ale(r,e,t,n){let i;if(Array.isArray(r[0])){const s=r.length*e;i=new Array(s);for(let o=0;o<r.length;o++)for(let c=0;c<e;c++)i[o*e+c]=r[o][c]||0}else i=r;return t?d6(i,{size:e,gridResolution:t}):n?qce(i,{size:e}):i}const cle=1,lle=2,Gb=4;class ule extends zL{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?ale(e,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):e}getGeometrySize(e){if(jM(e)){let n=0;for(const i of e)n+=this.getGeometrySize(i);return n}const t=this.getPathLength(e);return t<2?0:this.isClosed(e)?t<3?0:t+2:t}updateGeometryAttributes(e,t){if(t.geometrySize!==0)if(e&&jM(e))for(const n of e){const i=this.getGeometrySize(n);t.geometrySize=i,this.updateGeometryAttributes(n,t),t.vertexStart+=i}else this._updateSegmentTypes(e,t),this._updatePositions(e,t)}_updateSegmentTypes(e,t){const n=this.attributes.segmentTypes,i=e?this.isClosed(e):!1,{vertexStart:s,geometrySize:o}=t;n.fill(0,s,s+o),i?(n[s]=Gb,n[s+o-2]=Gb):(n[s]+=cle,n[s+o-2]+=lle),n[s+o-1]=Gb}_updatePositions(e,t){const{positions:n}=this.attributes;if(!n||!e)return;const{vertexStart:i,geometrySize:s}=t,o=new Array(3);for(let c=i,f=0;f<s;c++,f++)this.getPointOnPath(e,f,o),n[c*3]=o[0],n[c*3+1]=o[1],n[c*3+2]=o[2]}getPathLength(e){return e.length/this.positionSize}getPointOnPath(e,t,n=[]){const{positionSize:i}=this;t*i>=e.length&&(t+=1-e.length/i);const s=t*i;return n[0]=e[s],n[1]=e[s+1],n[2]=i===3&&e[s+2]||0,n}isClosed(e){if(!this.normalize)return!!this.opts.loop;const{positionSize:t}=this,n=e.length-t;return e[0]===e[n]&&e[1]===e[n+1]&&(t===2||e[2]===e[n+2])}}function jM(r){return Array.isArray(r[0])}const $M=`uniform pathUniforms {
3738  float widthScale;
3739  float widthMinPixels;
3740  float widthMaxPixels;
3741  float jointType;
3742  float capType;
3743  float miterLimit;
3744  bool billboard;
3745  highp int widthUnits;
3746} path;
3747`,fle={name:"path",vs:$M,fs:$M,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",jointType:"f32",capType:"f32",miterLimit:"f32",billboard:"f32",widthUnits:"i32"}},hle=`#version 300 es
3748#define SHADER_NAME path-layer-vertex-shader
3749in vec2 positions;
3750in float instanceTypes;
3751in vec3 instanceStartPositions;
3752in vec3 instanceEndPositions;
3753in vec3 instanceLeftPositions;
3754in vec3 instanceRightPositions;
3755in vec3 instanceLeftPositions64Low;
3756in vec3 instanceStartPositions64Low;
3757in vec3 instanceEndPositions64Low;
3758in vec3 instanceRightPositions64Low;
3759in float instanceStrokeWidths;
3760in vec4 instanceColors;
3761in vec3 instancePickingColors;
3762uniform float opacity;
3763out vec4 vColor;
3764out vec2 vCornerOffset;
3765out float vMiterLength;
3766out vec2 vPathPosition;
3767out float vPathLength;
3768out float vJointType;
3769const float EPSILON = 0.001;
3770const vec3 ZERO_OFFSET = vec3(0.0);
3771float flipIfTrue(bool flag) {
3772return -(float(flag) * 2. - 1.);
3773}
3774vec3 getLineJoinOffset(
3775vec3 prevPoint, vec3 currPoint, vec3 nextPoint,
3776vec2 width
3777) {
3778bool isEnd = positions.x > 0.0;
3779float sideOfPath = positions.y;
3780float isJoint = float(sideOfPath == 0.0);
3781vec3 deltaA3 = (currPoint - prevPoint);
3782vec3 deltaB3 = (nextPoint - currPoint);
3783mat3 rotationMatrix;
3784bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix);
3785if (needsRotation) {
3786deltaA3 = deltaA3 * rotationMatrix;
3787deltaB3 = deltaB3 * rotationMatrix;
3788}
3789vec2 deltaA = deltaA3.xy / width;
3790vec2 deltaB = deltaB3.xy / width;
3791float lenA = length(deltaA);
3792float lenB = length(deltaB);
3793vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);
3794vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);
3795vec2 perpA = vec2(-dirA.y, dirA.x);
3796vec2 perpB = vec2(-dirB.y, dirB.x);
3797vec2 tangent = dirA + dirB;
3798tangent = length(tangent) > 0. ? normalize(tangent) : perpA;
3799vec2 miterVec = vec2(-tangent.y, tangent.x);
3800vec2 dir = isEnd ? dirA : dirB;
3801vec2 perp = isEnd ? perpA : perpB;
3802float L = isEnd ? lenA : lenB;
3803float sinHalfA = abs(dot(miterVec, perp));
3804float cosHalfA = abs(dot(dirA, miterVec));
3805float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);
3806float cornerPosition = sideOfPath * turnDirection;
3807float miterSize = 1.0 / max(sinHalfA, EPSILON);
3808miterSize = mix(
3809min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),
3810miterSize,
3811step(0.0, cornerPosition)
3812);
3813vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))
3814* (sideOfPath + isJoint * turnDirection);
3815bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));
3816bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));
3817bool isCap = isStartCap || isEndCap;
3818if (isCap) {
3819offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint);
3820vJointType = path.capType;
3821} else {
3822vJointType = path.jointType;
3823}
3824vPathLength = L;
3825vCornerOffset = offsetVec;
3826vMiterLength = dot(vCornerOffset, miterVec * turnDirection);
3827vMiterLength = isCap ? isJoint : vMiterLength;
3828vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);
3829vPathPosition = vec2(
3830dot(offsetFromStartOfPath, perp),
3831dot(offsetFromStartOfPath, dir)
3832);
3833geometry.uv = vPathPosition;
3834float isValid = step(instanceTypes, 3.5);
3835vec3 offset = vec3(offsetVec * width * isValid, 0.0);
3836if (needsRotation) {
3837offset = rotationMatrix * offset;
3838}
3839return offset;
3840}
3841void clipLine(inout vec4 position, vec4 refPosition) {
3842if (position.w < EPSILON) {
3843float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);
3844position = refPosition + (position - refPosition) * r;
3845}
3846}
3847void main() {
3848geometry.pickingColor = instancePickingColors;
3849vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);
3850float isEnd = positions.x;
3851vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);
3852vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);
3853vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);
3854vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);
3855vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);
3856vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);
3857geometry.worldPosition = currPosition;
3858vec2 widthPixels = vec2(clamp(
3859project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits),
3860path.widthMinPixels, path.widthMaxPixels) / 2.0);
3861vec3 width;
3862if (path.billboard) {
3863vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);
3864vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);
3865vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);
3866clipLine(prevPositionScreen, currPositionScreen);
3867clipLine(nextPositionScreen, currPositionScreen);
3868clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));
3869width = vec3(widthPixels, 0.0);
3870DECKGL_FILTER_SIZE(width, geometry);
3871vec3 offset = getLineJoinOffset(
3872prevPositionScreen.xyz / prevPositionScreen.w,
3873currPositionScreen.xyz / currPositionScreen.w,
3874nextPositionScreen.xyz / nextPositionScreen.w,
3875project_pixel_size_to_clipspace(width.xy)
3876);
3877DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);
3878gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);
3879} else {
3880prevPosition = project_position(prevPosition, prevPosition64Low);
3881currPosition = project_position(currPosition, currPosition64Low);
3882nextPosition = project_position(nextPosition, nextPosition64Low);
3883width = vec3(project_pixel_size(widthPixels), 0.0);
3884DECKGL_FILTER_SIZE(width, geometry);
3885vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);
3886geometry.position = vec4(currPosition + offset, 1.0);
3887gl_Position = project_common_position_to_clipspace(geometry.position);
3888DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
3889}
3890DECKGL_FILTER_COLOR(vColor, geometry);
3891}
3892`,dle=`#version 300 es
3893#define SHADER_NAME path-layer-fragment-shader
3894precision highp float;
3895in vec4 vColor;
3896in vec2 vCornerOffset;
3897in float vMiterLength;
3898in vec2 vPathPosition;
3899in float vPathLength;
3900in float vJointType;
3901out vec4 fragColor;
3902void main(void) {
3903geometry.uv = vPathPosition;
3904if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {
3905if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {
3906discard;
3907}
3908if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) {
3909discard;
3910}
3911}
3912fragColor = vColor;
3913DECKGL_FILTER_COLOR(fragColor, geometry);
3914}
3915`,_6=[0,0,0,255],ple={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:r=>r.path},getColor:{type:"accessor",value:_6},getWidth:{type:"accessor",value:1}
3915,rounded:{deprecatedFor:["jointRounded","capRounded"]}},Vb={enter:(r,e)=>e.length?e.subarray(e.length-r.length):r};class uf extends Es{getShaders(){return super.getShaders({vs:hle,fs:dle,modules:[Ls,_a,fle]})}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:Vb,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:Vb,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:Vb,defaultValue:_6},instancePickingColors:{size:4,type:"uint8",accessor:(n,{index:i,target:s})=>this.encodePickingColor(n&&n.__source?n.__source.index:i,s)}}),this.setState({pathTesselator:new ule({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);const{props:t,changeFlags:n}=e,i=this.getAttributeManager();if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPath)){const{pathTesselator:o}=this.state,c=t.data.attributes||{};o.updateGeometry({data:t.data,geometryBuffer:c.getPath,buffers:c,normalize:!t._pathType,loop:t._pathType==="loop",getGeometry:t.getPath,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:n.dataChanged}),this.setState({numInstances:o.instanceCount,startIndices:o.vertexStarts}),n.dataChanged||i.invalidateAll()}n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),i.invalidateAll())}getPickingInfo(e){const t=super.getPickingInfo(e),{index:n}=t,i=this.props.data;return i[0]&&i[0].__source&&(t.object=i.find(s=>s.__source.index===n)),t}disablePickingIndex(e){const t=this.props.data;if(t[0]&&t[0].__source)for(let n=0;n<t.length;n++)t[n].__source.index===e&&this._disablePickingIndex(n);else super.disablePickingIndex(e)}draw({uniforms:e}){const{jointRounded:t,capRounded:n,billboard:i,miterLimit:s,widthUnits:o,widthScale:c,widthMinPixels:f,widthMaxPixels:A}=this.props,v=this.state.model,w={jointType:Number(t),capType:Number(n),billboard:i,widthUnits:Po[o],widthScale:c,miterLimit:s,widthMinPixels:f,widthMaxPixels:A};v.shaderInputs.setProps({path:w}),v.draw(this.context.renderPass)}_getModel(){const e=[0,1,2,1,4,2,1,3,4,3,5,4],t=[0,0,0,-1,0,1,1,-1,1,1,1,0];return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ys({topology:"triangle-list",attributes:{indices:new Uint16Array(e),positions:{value:new Float32Array(t),size:2}}}),isInstanced:!0})}calculatePositions(e){const{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("positions")}calculateSegmentTypes(e){const{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("segmentTypes")}}uf.defaultProps=ple;uf.layerName="PathLayer";var o0={exports:{}},WM;function Ale(){if(WM)return o0.exports;WM=1,o0.exports=r,o0.exports.default=r;function r(_e,Le,Ge){Ge=Ge||2;var Ze=Le&&Le.length,tt=Ze?Le[0]*Ge:_e.length,rt=e(_e,0,tt,Ge,!0),ut=[];if(!rt||rt.next===rt.prev)return ut;var vt,St,st,dr,er,Kt,Nt;if(Ze&&(rt=f(_e,Le,rt,Ge)),_e.length>80*Ge){vt=st=_e[0],St=dr=_e[1];for(var Ar=Ge;Ar<tt;Ar+=Ge)er=_e[Ar],Kt=_e[Ar+1],er<vt&&(vt=er),Kt<St&&(St=Kt),er>st&&(st=er),Kt>dr&&(dr=Kt);Nt=Math.max(st-vt,dr-St),Nt=Nt!==0?32767/Nt:0}return n(rt,ut,Ge,vt,St,Nt,0),ut}function e(_e,Le,Ge,Ze,tt){var rt,ut;if(tt===et(_e,Le,Ge,Ze)>0)for(rt=Le;rt<Ge;rt+=Ze)ut=W(rt,_e[rt],_e[rt+1],ut);else for(rt=Ge-Ze;rt>=Le;rt-=Ze)ut=W(rt,_e[rt],_e[rt+1],ut);return ut&&ue(ut,ut.next)&&(re(ut),ut=ut.next),ut}function t(_e,Le){if(!_e)return _e;Le||(Le=_e);var Ge=_e,Ze;do if(Ze=!1,!Ge.steiner&&(ue(Ge,Ge.next)||J(Ge.prev,Ge,Ge.next)===0)){if(re(Ge),Ge=Le=Ge.prev,Ge===Ge.next)break;Ze=!0}else Ge=Ge.next;while(Ze||Ge!==Le);return Le}function n(_e,Le,Ge,Ze,tt,rt,ut){if(_e){!ut&&rt&&F(_e,Ze,tt,rt);for(var vt=_e,St,st;
vendor: 5,067 bytes, line 3915
3915_e.prev!==_e.next;){if(St=_e.prev,st=_e.next,rt?s(_e,Ze,tt,rt):i(_e)){Le.push(St.i/Ge|0),Le.push(_e.i/Ge|0),Le.push(st.i/Ge|0),re(_e),_e=st.next,vt=st.next;continue}if(_e=st,_e===vt){ut?ut===1?(_e=o(t(_e),Le,Ge),n(_e,Le,Ge,Ze,tt,rt,2)):ut===2&&c(_e,Le,Ge,Ze,tt,rt):n(t(_e),Le,Ge,Ze,tt,rt,1);break}}}}function i(_e){var Le=_e.prev,Ge=_e,Ze=_e.next;if(J(Le,Ge,Ze)>=0)return!1;for(var tt=Le.x,rt=Ge.x,ut=Ze.x,vt=Le.y,St=Ge.y,st=Ze.y,dr=tt<rt?tt<ut?tt:ut:rt<ut?rt:ut,er=vt<St?vt<st?vt:st:St<st?St:st,Kt=tt>rt?tt>ut?tt:ut:rt>ut?rt:ut,Nt=vt>St?vt>st?vt:st:St>st?St:st,Ar=Ze.next;Ar!==Le;){if(Ar.x>=dr&&Ar.x<=Kt&&Ar.y>=er&&Ar.y<=Nt&&G(tt,vt,rt,St,ut,st,Ar.x,Ar.y)&&J(Ar.prev,Ar,Ar.next)>=0)return!1;Ar=Ar.next}return!0}function s(_e,Le,Ge,Ze){var tt=_e.prev,rt=_e,ut=_e.next;if(J(tt,rt,ut)>=0)return!1;for(var vt=tt.x,St=rt.x,st=ut.x,dr=tt.y,er=rt.y,Kt=ut.y,Nt=vt<St?vt<st?vt:st:St<st?St:st,Ar=dr<er?dr<Kt?dr:Kt:er<Kt?er:Kt,ln=vt>St?vt>st?vt:st:St>st?St:st,Pr=dr>er?dr>Kt?dr:Kt:er>Kt?er:Kt,xr=U(Nt,Ar,Le,Ge,Ze),Vn=U(ln,Pr,Le,Ge,Ze),_r=_e.prevZ,yr=_e.nextZ;_r&&_r.z>=xr&&yr&&yr.z<=Vn;){if(_r.x>=Nt&&_r.x<=ln&&_r.y>=Ar&&_r.y<=Pr&&_r!==tt&&_r!==ut&&G(vt,dr,St,er,st,Kt,_r.x,_r.y)&&J(_r.prev,_r,_r.next)>=0||(_r=_r.prevZ,yr.x>=Nt&&yr.x<=ln&&yr.y>=Ar&&yr.y<=Pr&&yr!==tt&&yr!==ut&&G(vt,dr,St,er,st,Kt,yr.x,yr.y)&&J(yr.prev,yr,yr.next)>=0))return!1;yr=yr.nextZ}for(;_r&&_r.z>=xr;){if(_r.x>=Nt&&_r.x<=ln&&_r.y>=Ar&&_r.y<=Pr&&_r!==tt&&_r!==ut&&G(vt,dr,St,er,st,Kt,_r.x,_r.y)&&J(_r.prev,_r,_r.next)>=0)return!1;_r=_r.prevZ}for(;yr&&yr.z<=Vn;){if(yr.x>=Nt&&yr.x<=ln&&yr.y>=Ar&&yr.y<=Pr&&yr!==tt&&yr!==ut&&G(vt,dr,St,er,st,Kt,yr.x,yr.y)&&J(yr.prev,yr,yr.next)>=0)return!1;yr=yr.nextZ}return!0}function o(_e,Le,Ge){var Ze=_e;do{var tt=Ze.prev,rt=Ze.next.next;!ue(tt,rt)&&q(tt,Ze,Ze.next,rt)&&de(tt,rt)&&de(rt,tt)&&(Le.push(tt.i/Ge|0),Le.push(Ze.i/Ge|0),Le.push(rt.i/Ge|0),re(Ze),re(Ze.next),Ze=_e=rt),Ze=Ze.next}while(Ze!==_e);return t(Ze)}function c(_e,Le,Ge,Ze,tt,rt){var ut=_e;do{for(var vt=ut.next.next;vt!==ut.prev;){if(ut.i!==vt.i&&H(ut,vt)){var St=pe(ut,vt);ut=t(ut,ut.next),St=t(St,St.next),n(ut,Le,Ge,Ze,tt,rt,0),n(St,Le,Ge,Ze,tt,rt,0);return}vt=vt.next}ut=ut.next}while(ut!==_e)}function f(_e,Le,Ge,Ze){var tt=[],rt,ut,vt,St,st;for(rt=0,ut=Le.length;rt<ut;rt++)vt=Le[rt]*Ze,St=rt<ut-1?Le[rt+1]*Ze:_e.length,st=e(_e,vt,St,Ze,!1),st===st.next&&(st.steiner=!0),tt.push($(st));for(tt.sort(A),rt=0;rt<tt.length;rt++)Ge=v(tt[rt],Ge);return Ge}function A(_e,Le){return _e.x-Le.x}function v(_e,Le){var Ge=w(_e,Le);if(!Ge)return Le;var Ze=pe(Ge,_e);return t(Ze,Ze.next),t(Ge,Ge.next)}function w(_e,Le){var Ge=Le,Ze=_e.x,tt=_e.y,rt=-1/0,ut;do{if(tt<=Ge.y&&tt>=Ge.next.y&&Ge.next.y!==Ge.y){var vt=Ge.x+(tt-Ge.y)*(Ge.next.x-Ge.x)/(Ge.next.y-Ge.y);if(vt<=Ze&&vt>rt&&(rt=vt,ut=Ge.x<Ge.next.x?Ge:Ge.next,vt===Ze))return ut}Ge=Ge.next}while(Ge!==Le);if(!ut)return null;var St=ut,st=ut.x,dr=ut.y,er=1/0,Kt;Ge=ut;do Ze>=Ge.x&&Ge.x>=st&&Ze!==Ge.x&&G(tt<dr?Ze:rt,tt,st,dr,tt<dr?rt:Ze,tt,Ge.x,Ge.y)&&(Kt=Math.abs(tt-Ge.y)/(Ze-Ge.x),de(Ge,_e)&&(Kt<er||Kt===er&&(Ge.x>ut.x||Ge.x===ut.x&&S(ut,Ge)))&&(ut=Ge,er=Kt)),Ge=Ge.next;while(Ge!==St);return ut}function S(_e,Le){return J(_e.prev,_e,Le.prev)<0&&J(Le.next,_e,_e.next)<0}function F(_e,Le,Ge,Ze){var tt=_e;do tt.z===0&&(tt.z=U(tt.x,tt.y,Le,Ge,Ze)),tt.prevZ=tt.prev,tt.nextZ=tt.next,tt=tt.next;while(tt!==_e);tt.prevZ.nextZ=null,tt.prevZ=null,N(tt)}function N(_e){var Le,Ge,Ze,tt,rt,ut,vt,St,st=1;do{for(Ge=_e,_e=null,rt=null,ut=0;Ge;){for(ut++,Ze=Ge,vt=0,Le=0;Le<st&&(vt++,Ze=Ze.nextZ,!!Ze);Le++);for(St=st;vt>0||St>0&&Ze;)vt!==0&&(St===0||!Ze||Ge.z<=Ze.z)?(tt=Ge,Ge=Ge.nextZ,vt--):(tt=Ze,Ze=Ze.nextZ,St--),rt?rt.nextZ=tt:_e=tt,tt.prevZ=rt,rt=tt;Ge=Ze}rt.nextZ=null,st*=2}while(ut>1);return _e}function U(_e,Le,Ge,Ze,tt){return _e=(_e-Ge)*tt|0,Le=(Le-Ze)*tt|0,_e=(_e|_e<<8)&16711935,_e=(_e|_e<<4)&252645135,_e=(_e|_e<<2)&858993459,_e=(_e|_e<<1)&1431655765,Le=(Le|Le<<8)&16711935,Le=(Le|Le<<4)&252645135,Le=(Le|Le<<2)&858993459,Le=(Le|Le<<1)&1431655765,_e|Le<<1}function $(_e){var Le=_e,Ge=_e;do(Le.x<Ge.x||Le.x===Ge.x&&Le.y<Ge.y)&&(Ge=Le),Le=Le.next;while(Le!==_e);return Ge}function G(_e,Le,Ge,Ze,tt,rt,ut,vt){return(tt-ut)*(Le-vt)>=(_e-ut)*(rt-vt)&&(_e-ut)*(Ze-vt)>=(Ge-ut)*(Le-vt)&&(Ge-ut)*(rt-vt)>=(tt-ut)*(Ze-vt)}function H(_e,Le){return _e.next.i!==Le.i&&_e.prev.i!==Le.i&&!Ue(_e,Le)&&(de(_e,Le)&&de(Le,_e)&&me(_e,Le)&&(J(_e.prev,_e,Le.prev)||J(_e,Le.prev,Le))||ue(_e,Le)&&J(_e.prev,_e,_e.next)>0&&J(Le.prev,Le,Le.next)>0)}function J(_e,Le,Ge){return(Le.y-_e.y)*(Ge.x-Le.x)-(Le.x-_e.x)*(Ge.y-Le.y)}function ue(_e,Le){return _e.x===Le.x&&_e.y===Le.y}function q(_e,Le,Ge,Ze){var tt=Te(J(_e,Le,Ge)),rt=Te(J(_e,Le,Ze)),ut=Te(J(Ge,Ze,_e)),vt=Te(J(Ge,Ze,Le));return!!(tt!==rt&&ut!==vt||tt===0&&se(_e,Ge,Le)||rt===0&&se(_e,Ze,Le)||ut===0&&se(Ge,_e,Ze)||vt===0&&se(Ge,Le,Ze))}function se(_e,Le,Ge){return Le.x<=Math.max(_e.x,Ge.x)&&Le.x>=Math.min(_e.x,Ge.x)&&Le.y<=Math.max(_e.y,Ge.y)&&Le.y>=Math.min(_e.y,Ge.y)}function Te(_e){return _e>0?1:_e<0?-1:0}function Ue(_e,Le){var Ge=_e;do{if(Ge.i!==_e.i&&Ge.next.i!==_e.i&&Ge.i!==Le.i&&Ge.next.i!==Le.i&&q
3915(Ge,Ge.next,_e,Le))return!0;Ge=Ge.next}while(Ge!==_e);return!1}function de(_e,Le){return J(_e.prev,_e,_e.next)<0?J(_e,Le,_e.next)>=0&&J(_e,_e.prev,Le)>=0:J(_e,Le,_e.prev)<0||J(_e,_e.next,Le)<0}function me(_e,Le){var Ge=_e,Ze=!1,tt=(_e.x+Le.x)/2,rt=(_e.y+Le.y)/2;do Ge.y>rt!=Ge.next.y>rt&&Ge.next.y!==Ge.y&&tt<(Ge.next.x-Ge.x)*(rt-Ge.y)/(Ge.next.y-Ge.y)+Ge.x&&(Ze=!Ze),Ge=Ge.next;while(Ge!==_e);return Ze}function pe(_e,Le){var Ge=new Ee(_e.i,_e.x,_e.y),Ze=new Ee(Le.i,Le.x,Le.y),tt=_e.next,rt=Le.prev;return _e.next=Le,Le.prev=_e,Ge.next=tt,tt.prev=Ge,Ze.next=Ge,Ge.prev=Ze,rt.next=Ze,Ze.prev=rt,Ze}function W(_e,Le,Ge,Ze){var tt=new Ee(_e,Le,Ge);return Ze?(tt.next=Ze.next,tt.prev=Ze,Ze.next.prev=tt,Ze.next=tt):(tt.prev=tt,tt.next=tt),tt}function re(_e){_e.next.prev=_e.prev,_e.prev.next=_e.next,_e.prevZ&&(_e.prevZ.nextZ=_e.nextZ),_e.nextZ&&(_e.nextZ.prevZ=_e.prevZ)}function Ee(_e,Le,Ge){this.i=_e,this.x=Le,this.y=Ge,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(_e,Le,Ge,Ze){var tt=Le&&Le.length,rt=tt?Le[0]*Ge:_e.length,ut=Math.abs(et(_e,0,rt,Ge));if(tt)for(var vt=0,St=Le.length;vt<St;vt++){var st=Le[vt]*Ge,dr=vt<St-1?Le[vt+1]*Ge:_e.length;ut-=Math.abs(et(_e,st,dr,Ge))}var er=0;for(vt=0;vt<Ze.length;vt+=3){var Kt=Ze[vt]*Ge,Nt=Ze[vt+1]*Ge,Ar=Ze[vt+2]*Ge;er+=Math.abs((_e[Kt]-_e[Ar])*(_e[Nt+1]-_e[Kt+1])-(_e[Kt]-_e[Nt])*(_e[Ar+1]-_e[Kt+1]))}return ut===0&&er===0?0:Math.abs((er-ut)/ut)};function et(_e,Le,Ge,Ze){for(var tt=0,rt=Le,ut=Ge-Ze;rt<Ge;rt+=Ze)tt+=(_e[ut]-_e[rt])*(_e[rt+1]+_e[ut+1]),ut=rt;return tt}return r.flatten=function(_e){for(var Le=_e[0][0].length,Ge={vertices:[],holes:[],dimensions:Le},Ze=0,tt=0;tt<_e.length;tt++){for(var rt=0;rt<_e[tt].length;rt++)for(var ut=0;ut<Le;ut++)Ge.vertices.push(_e[tt][rt][ut]);tt>0&&(Ze+=_e[tt-1].length,Ge.holes.push(Ze))}return Ge},o0.exports}var gle=Ale();const y6=_h(gle),a0=AC.CLOCKWISE,JM=AC.COUNTER_CLOCKWISE,Wu={};function mle(r){if(r=r&&r.positions||r,!Array.isArray(r)&&!ArrayBuffer.isView(r))throw new Error("invalid polygon")}function KA(r){return"positions"in r?r.positions:r}function K0(r){return"holeIndices"in r?r.holeIndices:null}function _le(r){return Array.isArray(r[0])}function yle(r){return r.length>=1&&r[0].length>=2&&Number.isFinite(r[0][0])}function vle(r){const e=r[0],t=r[r.length-1];return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ble(r,e,t,n){for(let i=0;i<e;i++)if(r[t+i]!==r[n-e+i])return!1;return!0}function XM(r,e,t,n,i){let s=e;const o=t.length;for(let c=0;c<o;c++)for(let f=0;f<n;f++)r[s++]=t[c][f]||0;if(!vle(t))for(let c=0;c<n;c++)r[s++]=t[0][c]||0;return Wu.start=e,Wu.end=s,Wu.size=n,gC(r,i,Wu),s}function KM(r,e,t,n,i=0,s,o){s=s||t.length;const c=s-i;if(c<=0)return e;let f=e;for(let A=0;A<c;A++)r[f++]=t[i+A];if(!ble(t,n,i,s))for(let A=0;A<n;A++)r[f++]=t[i+A];return Wu.start=e,Wu.end=f,Wu.size=n,gC(r,o,Wu),f}function v6(r,e){mle(r);const t=[],n=[];if("positions"in r){const{positions:i,holeIndices:s}=r;if(s){let o=0;for(let c=0;c<=s.length;c++)o=KM(t,o,i,e,s[c-1],s[c],c===0?a0:JM),n.push(o);return n.pop(),{positions:t,holeIndices:n}}r=i}if(!_le(r))return KM(t,0,r,e,0,t.length,a0),t;if(!yle(r)){let i=0;for(const[s,o]of r.entries())i=XM(t,i,o,e,s===0?a0:JM),n.push(i);return n.pop(),{positions:t,holeIndices:n}}return XM(t,0,r,e,a0),t}function Hb(r,e,t){const n=r.length/3;let i=0;for(let s=0;s<n;s++){const o=(s+1)%n;i+=r[s*3+e]*r[o*3+t],i-=r[o*3+e]*r[s*3+t]}return Math.abs(i/2)}function qM(r,e,t,n){const i=r.length/3;for(let s=0;s<i;s++){const o=s*3,c=r[o+0],f=r[o+1],A=r[o+2];r[o+e]=c,r[o+t]=f,r[o+n]=A}}function xle(r,e,t,n){let i=K0(r);i&&(i=i.map(c=>c/e));let s=KA(r);const o=n&&e===3;if(t){const c=s.length;s=s.slice();const f=[];for(let A=0;A<c;A+=e){f[0]=s[A],f[1]=s[A+1],o&&(f[2]=s[A+2]);const v=t(f);s[A]=v[0],s[A+1]=v[1],o&&(s[A+2]=v[2])}}if(o){const c=Hb(s,0,1),f=Hb(s,0,2),A=Hb(s,1,2);if(!c&&!f&&!A)return[];c>f&&c>A||(f>A?(t||(s=s.slice()),qM(s,0,2,1)):(t||(s=s.slice()),qM(s,2,0,1)))}return y6(s,i,e)}class wle extends zL{constructor(e){const{fp64:t,IndexType:n=Uint32Array}=e;super({...e,attributes:{positions:{size:3,type:t?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:n,size:1}}})}get(e){const{attributes:t}=this;return e==="indices"?t.indices&&t.indices.subarray(0,this.vertexCount):t[e]}updateGeometry(e){super.updateGeometry(e);const t=this.buffers.indices;if(t)this.vertexCount=(t.value||t).length;else if(this.data&&!this.getGeometry)throw new Error("missing indices buffer")}normalizeGeometry(e){if(this.normalize){const t=v6(e,this.positionSize);return this.opts.resolution?p6(KA(t),K0(t),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?Yce(KA(t),K0(t),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):t}return e}getGeometrySize(e){if(YM(e)){let t=0;for(const n of e)t+=this.getGeometrySize(n);return t}return KA(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,t){if(e&&YM(e))for(const n of e){const i=this.getGeometrySize(n);t.geometrySize=i,this.updateGeometryAttributes(n,t),t.vertexStart+=i,t.indexStart=this.indexStarts[t.geometryIndex+1]}else{const n=e;this._updateIndices(n,t),this._updatePositions(n,t),this._updateVertexValid(n,t)}}_updateIndices(e,{geometryIndex:t,vertexStart:n,indexStart:i}){const{attributes:s,indexStarts:o,typedArrayManager:c}=this;let f=s.indices;if(!f||!e)return;let A=i;
3915const v=xle(e,this.positionSize,this.opts.preproject,this.opts.full3d);f=c.allocate(f,i+v.length,{copy:!0});for(let w=0;w<v.length;w++)f[A++]=v[w]+n;o[t+1]=i+v.length,s.indices=f}_updatePositions(e,{vertexStart:t,geometrySize:n}){const{attributes:{positions:i},positionSize:s}=this;if(!i||!e)return;const o=KA(e);for(let c=t,f=0;f<n;c++,f++){const A=o[f*s],v=o[f*s+1],w=s>2?o[f*s+2]:0;i[c*3]=A,i[c*3+1]=v,i[c*3+2]=w}}_updateVertexValid(e,{vertexStart:t,geometrySize:n}){const{positionSize:i}=this,s=this.attributes.vertexValid,o=e&&K0(e);if(e&&e.edgeTypes?s.set(e.edgeTypes,t):s.fill(1,t,t+n),o)for(let c=0;c<o.length;c++)s[t+o[c]/i-1]=0;s[t+n-1]=0}}function YM(r){return Array.isArray(r)&&r.length>0&&!Number.isFinite(r[0])}const ZM=`uniform solidPolygonUniforms {
3916  bool extruded;
3917  bool isWireframe;
3918  float elevationScale;
3919} solidPolygon;
3920`,Cle={name:"solidPolygon",vs:ZM,fs:ZM,uniformTypes:{extruded:"f32",isWireframe:"f32",elevationScale:"f32"}},b6=`in vec4 fillColors;
3921in vec4 lineColors;
3922in vec3 pickingColors;
3923out vec4 vColor;
3924struct PolygonProps {
3925vec3 positions;
3926vec3 positions64Low;
3927vec3 normal;
3928float elevations;
3929};
3930vec3 project_offset_normal(vec3 vector) {
3931if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
3932project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {
3933return normalize(vector * project.commonUnitsPerWorldUnit);
3934}
3935return project_normal(vector);
3936}
3937void calculatePosition(PolygonProps props) {
3938vec3 pos = props.positions;
3939vec3 pos64Low = props.positions64Low;
3940vec3 normal = props.normal;
3941vec4 colors = solidPolygon.isWireframe ? lineColors : fillColors;
3942geometry.worldPosition = props.positions;
3943geometry.pickingColor = pickingColors;
3944if (solidPolygon.extruded) {
3945pos.z += props.elevations * solidPolygon.elevationScale;
3946}
3947gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);
3948DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
3949if (solidPolygon.extruded) {
3950#ifdef IS_SIDE_VERTEX
3951normal = project_offset_normal(normal);
3952#else
3953normal = project_normal(normal);
3954#endif
3955geometry.normal = normal;
3956vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
3957vColor = vec4(lightColor, colors.a * layer.opacity);
3958} else {
3959vColor = vec4(colors.rgb, colors.a * layer.opacity);
3960}
3961DECKGL_FILTER_COLOR(vColor, geometry);
3962}
3963`,Tle=`#version 300 es
3964#define SHADER_NAME solid-polygon-layer-vertex-shader
3965in vec3 vertexPositions;
3966in vec3 vertexPositions64Low;
3967in float elevations;
3968${b6}
3969void main(void) {
3970PolygonProps props;
3971props.positions = vertexPositions;
3972props.positions64Low = vertexPositions64Low;
3973props.elevations = elevations;
3974props.normal = vec3(0.0, 0.0, 1.0);
3975calculatePosition(props);
3976}
3977`,Ele=`#version 300 es
3978#define SHADER_NAME solid-polygon-layer-vertex-shader-side
3979#define IS_SIDE_VERTEX
3980in vec2 positions;
3981in vec3 vertexPositions;
3982in vec3 nextVertexPositions;
3983in vec3 vertexPositions64Low;
3984in vec3 nextVertexPositions64Low;
3985in float elevations;
3986in float instanceVertexValid;
3987${b6}
3988void main(void) {
3989if(instanceVertexValid < 0.5){
3990gl_Position = vec4(0.);
3991return;
3992}
3993PolygonProps props;
3994vec3 pos;
3995vec3 pos64Low;
3996vec3 nextPos;
3997vec3 nextPos64Low;
3998#if RING_WINDING_ORDER_CW == 1
3999pos = vertexPositions;
4000pos64Low = vertexPositions64Low;
4001nextPos = nextVertexPositions;
4002nextPos64Low = nextVertexPositions64Low;
4003#else
4004pos = nextVertexPositions;
4005pos64Low = nextVertexPositions64Low;
4006nextPos = vertexPositions;
4007nextPos64Low = vertexPositions64Low;
4008#endif
4009props.positions = mix(pos, nextPos, positions.x);
4010props.positions64Low = mix(pos64Low, nextPos64Low, positions.x);
4011props.normal = vec3(
4012pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y),
4013nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),
40140.0);
4015props.elevations = elevations * positions.y;
4016calculatePosition(props);
4017}
4018`,Ble=`#version 300 es
4019#define SHADER_NAME solid-polygon-layer-fragment-shader
4020precision highp float;
4021in vec4 vColor;
4022out vec4 fragColor;
4023void main(void) {
4024fragColor = vColor;
4025geometry.uv = vec2(0.);
4026DECKGL_FILTER_COLOR(fragColor, geometry);
4027}
4028`,G_=[0,0,0,255],Sle={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:r=>r.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:G_},getLineColor:{type:"accessor",value:G_},material:!0},c0={enter:(r,e)=>e.length?e.subarray(e.length-r.length):r};
4028class ff extends Es{getShaders(e){return super.getShaders({vs:e==="top"?Tle:Ele,fs:Ble,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[Ls,uy,_a,Cle]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){const{viewport:e}=this.context;let{coordinateSystem:t}=this.props;const{_full3d:n}=this.props;e.isGeospatial&&t===Qr.DEFAULT&&(t=Qr.LNGLAT);let i;t===Qr.LNGLAT&&(n?i=e.projectPosition.bind(e):i=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new wle({preproject:i,fp64:this.use64bitPositions(),IndexType:Uint32Array})});const s=this.getAttributeManager(),o=!0;s.remove(["instancePickingColors"]),s.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:o},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:c0,accessor:"getPolygon",update:this.calculatePositions,noAlloc:o,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:o},elevations:{size:1,stepMode:"dynamic",transition:c0,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:c0,accessor:"getFillColor",defaultValue:G_},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:c0,accessor:"getLineColor",defaultValue:G_},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(c,{index:f,target:A})=>this.encodePickingColor(c&&c.__source?c.__source.index:f,A)}})}getPickingInfo(e){const t=super.getPickingInfo(e),{index:n}=t,i=this.props.data;return i[0]&&i[0].__source&&(t.object=i.find(s=>s.__source.index===n)),t}disablePickingIndex(e){const t=this.props.data;if(t[0]&&t[0].__source)for(let n=0;n<t.length;n++)t[n].__source.index===e&&this._disablePickingIndex(n);else super.disablePickingIndex(e)}draw({uniforms:e}){const{extruded:t,filled:n,wireframe:i,elevationScale:s}=this.props,{topModel:o,sideModel:c,wireframeModel:f,polygonTesselator:A}=this.state,v={extruded:!!t,elevationScale:s,isWireframe:!1};f&&i&&(f.setInstanceCount(A.instanceCount-1),f.shaderInputs.setProps({solidPolygon:{...v,isWireframe:!0}}),f.draw(this.context.renderPass)),c&&n&&(c.setInstanceCount(A.instanceCount-1),c.shaderInputs.setProps({solidPolygon:v}),c.draw(this.context.renderPass)),o&&n&&(o.setVertexCount(A.vertexCount),o.shaderInputs.setProps({solidPolygon:v}),o.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);const{props:t,oldProps:n,changeFlags:i}=e,s=this.getAttributeManager();(i.extensionsChanged||t.filled!==n.filled||t.extruded!==n.extruded)&&(this.state.models?.forEach(c=>c.destroy()),this.setState(this._getModels()),s.invalidateAll())}updateGeometry({props:e,oldProps:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPolygon)){const{polygonTesselator:s}=this.state,o=e.data.attributes||{};s.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:o.getPolygon,buffers:o,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:n.dataChanged,full3d:e._full3d}),this.setState({numInstances:s.instanceCount,startIndices:s.vertexStarts}),n.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){const{id:e,filled:t,extruded:n}=this.props;let i,s,o;if(t){const c=this.getShaders("top");c.defines.NON_INSTANCED_MODEL=1;const f=this.getAttributeManager().getBufferLayouts({isInstanced:!1});i=new Di(this.context.device,{...c,id:`${e}-top`,topology:"triangle-list",bufferLayout:f,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(n){const c=this.getAttributeManager().getBufferLayouts({isInstanced:!0});s=new Di(this.context.device,{...this.getShaders("side"),id:`${e}-side`,bufferLayout:c,geometry:new Ys({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}
4028),o=new Di(this.context.device,{...this.getShaders("side"),id:`${e}-wireframe`,bufferLayout:c,geometry:new Ys({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:[s,o,i].filter(Boolean),topModel:i,sideModel:s,wireframeModel:o}}calculateIndices(e){const{polygonTesselator:t}=this.state;e.startIndices=t.indexStarts,e.value=t.get("indices")}calculatePositions(e){const{polygonTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}}ff.defaultProps=Sle;ff.layerName="SolidPolygonLayer";function x6({data:r,getIndex:e,dataRange:t,replace:n}){const{startRow:i=0,endRow:s=1/0}=t,o=r.length;let c=o,f=o;for(let S=0;S<o;S++){const F=e(r[S]);if(c>S&&F>=i&&(c=S),F>=s){f=S;break}}let A=c;const w=f-c!==n.length?r.slice(f):void 0;for(let S=0;S<n.length;S++)r[A++]=n[S];if(w){for(let S=0;S<w.length;S++)r[A++]=w[S];r.length=A}return{startRow:c,endRow:c+n.length}}const w6=[0,0,0,255],Ile=[0,0,0,255],Mle={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:r=>r.polygon},getFillColor:{type:"accessor",value:Ile},getLineColor:{type:"accessor",value:w6},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class hf extends Bs{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&Yr.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){const t=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(t&&Array.isArray(e.dataChanged)){const n=this.state.paths.slice(),i=e.dataChanged.map(s=>x6({data:n,getIndex:o=>o.__source.index,dataRange:s,replace:this._getPaths(s)}));this.setState({paths:n,pathsDiff:i})}else t&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){const{data:t,getPolygon:n,positionFormat:i,_normalize:s}=this.props,o=[],c=i==="XY"?2:3,{startRow:f,endRow:A}=e,{iterable:v,objectInfo:w}=gl(t,f,A);for(const S of v){w.index++;let F=n(S,w);s&&(F=v6(F,c));const{holeIndices:N}=F,U=F.positions||F;if(N)for(let $=0;$<=N.length;$++){const G=U.slice(N[$-1]||0,N[$]||U.length);o.push(this.getSubLayerRow({path:G},S,w.index))}else o.push(this.getSubLayerRow({path:U},S,w.index))}return o}renderLayers(){const{data:e,_dataDiff:t,stroked:n,filled:i,extruded:s,wireframe:o,_normalize:c,_windingOrder:f,elevationScale:A,transitions:v,positionFormat:w}=this.props,{lineWidthUnits:S,lineWidthScale:F,lineWidthMinPixels:N,lineWidthMaxPixels:U,lineJointRounded:$,lineMiterLimit:G,lineDashJustified:H}=this.props,{getFillColor:J,getLineColor:ue,getLineWidth:q,getLineDashArray:se,getElevation:Te,getPolygon:Ue,updateTriggers:de,material:me}=this.props,{paths:pe,pathsDiff:W}=this.state,re=this.getSubLayerClass("fill",ff),Ee=this.getSubLayerClass("stroke",uf),et=this.shouldRenderSubLayer("fill",pe)&&new re({_dataDiff:t,extruded:s,elevationScale:A,filled:i,wireframe:o,_normalize:c,_windingOrder:f,getElevation:Te,getFillColor:J,getLineColor:s&&o?ue:w6,material:me,transitions:v},this.getSubLayerProps({id:"fill",updateTriggers:de&&{getPolygon:de.getPolygon,getElevation:de.getElevation,getFillColor:de.getFillColor,lineColors:s&&o,getLineColor:de.getLineColor}}),{data:e,positionFormat:w,getPolygon:Ue}),_e=!s&&n&&this.shouldRenderSubLayer("stroke",pe)&&new Ee({_dataDiff:W&&(()=>W),widthUnits:S,widthScale:F,widthMinPixels:N,widthMaxPixels:U,jointRounded:$,miterLimit:G,dashJustified:H,_pathType:"loop",transitions:v&&{getWidth:v.getLineWidth,getColor:v.getLineColor,getPath:v.getPolygon},getColor:this.getSubLayerAccessor(ue),getWidth:this.getSubLayerAccessor(q),getDashArray:this.getSubLayerAccessor(se)},this.getSubLayerProps({id:"stroke",updateTriggers:de&&{getWidth:de.getLineWidth,getColor:de.getLineColor,getDashArray:de.getLineDashArray}}),{data:pe,positionFormat:w,getPath:Le=>Le.path});return[!s&&et,_e,s&&et]}}hf.layerName="PolygonLayer";hf.defaultProps=Mle;function Ple(r,e){if(!r)return null;const t="startIndices"in r?r.startIndices[e]:e,n=r.featureIds.value[t];
4028return t!==-1?Rle(r,n,t):null}function Rle(r,e,t){const n={properties:{...r.properties[e]}};for(const i in r.numericProps)n.properties[i]=r.numericProps[i].value[t];return n}function Fle(r,e){const t={points:null,lines:null,polygons:null};for(const n in t){const i=r[n].globalFeatureIds.value;t[n]=new Uint8ClampedArray(i.length*4);const s=[];for(let o=0;o<i.length;o++)e(i[o],s),t[n][o*4+0]=s[0],t[n][o*4+1]=s[1],t[n][o*4+2]=s[2],t[n][o*4+3]=255}return t}const QM=`uniform sdfUniforms {
4029  float gamma;
4030  bool enabled;
4031  float buffer;
4032  float outlineBuffer;
4033  vec4 outlineColor;
4034} sdf;
4035`,Dle={name:"sdf",vs:QM,fs:QM,uniformTypes:{gamma:"f32",enabled:"f32",buffer:"f32",outlineBuffer:"f32",outlineColor:"vec4<f32>"}},Ole=`#version 300 es
4036#define SHADER_NAME multi-icon-layer-fragment-shader
4037precision highp float;
4038uniform sampler2D iconsTexture;
4039in vec4 vColor;
4040in vec2 vTextureCoords;
4041in vec2 uv;
4042out vec4 fragColor;
4043void main(void) {
4044geometry.uv = uv;
4045if (!bool(picking.isActive)) {
4046float alpha = texture(iconsTexture, vTextureCoords).a;
4047vec4 color = vColor;
4048if (sdf.enabled) {
4049float distance = alpha;
4050alpha = smoothstep(sdf.buffer - sdf.gamma, sdf.buffer + sdf.gamma, distance);
4051if (sdf.outlineBuffer > 0.0) {
4052float inFill = alpha;
4053float inBorder = smoothstep(sdf.outlineBuffer - sdf.gamma, sdf.outlineBuffer + sdf.gamma, distance);
4054color = mix(sdf.outlineColor, vColor, inFill);
4055alpha = inBorder;
4056}
4057}
4058float a = alpha * color.a;
4059if (a < icon.alphaCutoff) {
4060discard;
4061}
4062fragColor = vec4(color.rgb, a * layer.opacity);
4063}
4064DECKGL_FILTER_COLOR(fragColor, geometry);
4065}
4066`,jb=192/256,eP=[],Lle={getIconOffsets:{type:"accessor",value:r=>r.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}};class Iy extends Jp{getShaders(){const e=super.getShaders();return{...e,modules:[...e.modules,Dle],fs:Ole}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:"uint8",size:3,accessor:(t,{index:n,target:i})=>this.encodePickingColor(n,i)}})}updateState(e){super.updateState(e);const{props:t,oldProps:n}=e;let{outlineColor:i}=t;i!==n.outlineColor&&(i=i.map(s=>s/255),i[3]=Number.isFinite(i[3])?i[3]:1,this.setState({outlineColor:i})),!t.sdf&&t.outlineWidth&&Yr.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(e){const{sdf:t,smoothing:n,outlineWidth:i}=this.props,{outlineColor:s}=this.state,o=i?Math.max(n,jb*(1-i)):-1,c=this.state.model,f={buffer:jb,outlineBuffer:o,gamma:n,enabled:!!t,outlineColor:s};if(c.shaderInputs.setProps({sdf:f}),super.draw(e),t&&i){const{iconManager:A}=this.state;A.getTexture()&&(c.shaderInputs.setProps({sdf:{...f,outlineBuffer:jb}}),c.draw(this.context.renderPass))}}getInstanceOffset(e){return e?Array.from(e).flatMap(t=>super.getInstanceOffset(t)):eP}getInstanceColorMode(e){return 1}getInstanceIconFrame(e){return e?Array.from(e).flatMap(t=>super.getInstanceIconFrame(t)):eP}}Iy.defaultProps=Lle;Iy.layerName="MultiIconLayer";const dg=1e20;class kle{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:i=.25,fontFamily:s="sans-serif",fontWeight:o="normal",fontStyle:c="normal"}={}){this.buffer=t,this.cutoff=i,this.radius=n;const f=this.size=e+t*4,A=this._createCanvas(f),v=this.ctx=A.getContext("2d",{willReadFrequently:!0});v.font=`${c} ${o} ${e}px ${s}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:i,actualBoundingBoxLeft:s,actualBoundingBoxRight:o}=this.ctx.measureText(e),c=Math.ceil(n),f=0,A=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-s))),v=Math.min(this.size-this.buffer,c+Math.ceil(i)),w=A+2*this.buffer,S=v+2*this.buffer,F=Math.max(w*S,0),N=new Uint8ClampedArray(F),U={data:N,width:w,height:S,glyphWidth:A,glyphHeight:v,glyphTop:c,glyphLeft:f,glyphAdvance:t};if(A===0||v===0)return U;const{ctx:$,buffer:G,gridInner:H,gridOuter:J}=this;$.clearRect(G,G,A,v),$.fillText(e,G,G+c);const ue=$.getImageData(G,G,A,v);
4066J.fill(dg,0,F),H.fill(0,0,F);for(let q=0;q<v;q++)for(let se=0;se<A;se++){const Te=ue.data[4*(q*A+se)+3]/255;if(Te===0)continue;const Ue=(q+G)*w+se+G;if(Te===1)J[Ue]=0,H[Ue]=dg;else{const de=.5-Te;J[Ue]=de>0?de*de:0,H[Ue]=de<0?de*de:0}}tP(J,0,0,w,S,w,this.f,this.v,this.z),tP(H,G,G,A,v,w,this.f,this.v,this.z);for(let q=0;q<F;q++){const se=Math.sqrt(J[q])-Math.sqrt(H[q]);N[q]=Math.round(255-255*(se/this.radius+this.cutoff))}return U}}function tP(r,e,t,n,i,s,o,c,f){for(let A=e;A<e+n;A++)rP(r,t*s+A,s,i,o,c,f);for(let A=t;A<t+i;A++)rP(r,A*s+e,1,n,o,c,f)}function rP(r,e,t,n,i,s,o){s[0]=0,o[0]=-dg,o[1]=dg,i[0]=r[e];for(let c=1,f=0,A=0;c<n;c++){i[c]=r[e+c*t];const v=c*c;do{const w=s[f];A=(i[c]-i[w]+v-w*w)/(c-w)/2}while(A<=o[f]&&--f>-1);f++,s[f]=c,o[f]=A,o[f+1]=dg}for(let c=0,f=0;c<n;c++){for(;o[f+1]<c;)f++;const A=s[f],v=c-A;r[e+c*t]=i[A]+v*v}}const Nle=32,Ule=[];function zle(r){return Math.pow(2,Math.ceil(Math.log2(r)))}function Gle({characterSet:r,getFontWidth:e,fontHeight:t,buffer:n,maxCanvasWidth:i,mapping:s={},xOffset:o=0,yOffset:c=0}){let f=0,A=o;const v=t+n*2;for(const w of r)if(!s[w]){const S=e(w);A+S+n*2>i&&(A=0,f++),s[w]={x:A+n,y:c+f*v+n,width:S,height:v,layoutWidth:S,layoutHeight:t},A+=S+n*2}return{mapping:s,xOffset:A,yOffset:c+f*v,canvasHeight:zle(c+(f+1)*v)}}function C6(r,e,t,n){let i=0;for(let s=e;s<t;s++){const o=r[s];i+=n[o]?.layoutWidth||0}return i}function T6(r,e,t,n,i,s){let o=e,c=0;for(let f=e;f<t;f++){const A=C6(r,f,f+1,i);c+A>n&&(o<f&&s.push(f),o=f,c=0),c+=A}return c}function Vle(r,e,t,n,i,s){let o=e,c=e,f=e,A=0;for(let v=e;v<t;v++)if((r[v]===" "||r[v+1]===" "||v+1===t)&&(f=v+1),f>c){let w=C6(r,c,f,i);A+w>n&&(o<c&&(s.push(c),o=c,A=0),w>n&&(w=T6(r,c,f,n,i,s),o=s[s.length-1])),c=f,A+=w}return A}function Hle(r,e,t,n,i=0,s){s===void 0&&(s=r.length);const o=[];return e==="break-all"?T6(r,i,s,t,n,o):Vle(r,i,s,t,n,o),o}function jle(r,e,t,n,i,s){let o=0,c=0;for(let f=e;f<t;f++){const A=r[f],v=n[A];v?(c||(c=v.layoutHeight),i[f]=o+v.layoutWidth/2,o+=v.layoutWidth):(Yr.warn(`Missing character: ${A} (${A.codePointAt(0)})`)(),i[f]=o,o+=Nle)}s[0]=o,s[1]=c}function $le(r,e,t,n,i){const s=Array.from(r),o=s.length,c=new Array(o),f=new Array(o),A=new Array(o),v=(t==="break-word"||t==="break-all")&&isFinite(n)&&n>0,w=[0,0],S=[0,0];let F=0,N=0,U=0;for(let $=0;$<=o;$++){const G=s[$];if((G===`
4067`||$===o)&&(U=$),U>N){const H=v?Hle(s,t,n,i,N,U):Ule;for(let J=0;J<=H.length;J++){const ue=J===0?N:H[J-1],q=J<H.length?H[J]:U;jle(s,ue,q,i,c,S);for(let se=ue;se<q;se++){c[se]-S[0]/2;const Te=s[se],Ue=i[Te]?.layoutOffsetY||0;f[se]=F+S[1]/2+Ue,A[se]=S[0]}F=F+S[1]*e,w[0]=Math.max(w[0],S[0])}N=U}G===`
4068`&&(c[N]=0,f[N]=0,A[N]=0,N++)}return w[1]=F,{x:c,y:f,rowWidth:A,size:w}}function Wle({value:r,length:e,stride:t,offset:n,startIndices:i,characterSet:s}){const o=r.BYTES_PER_ELEMENT,c=t?t/o:1,f=n?n/o:0,A=i[e]||Math.ceil((r.length-f)/c),v=s&&new Set,w=new Array(e);let S=r;if(c>1||f>0){const F=r.constructor;S=new F(A);for(let N=0;N<A;N++)S[N]=r[N*c+f]}for(let F=0;F<e;F++){const N=i[F],U=i[F+1]||A,$=S.subarray(N,U);w[F]=String.fromCodePoint.apply(null,$),v&&$.forEach(v.add,v)}if(v)for(const F of v)s.add(String.fromCodePoint(F));return{texts:w,characterCount:A}}class E6{constructor(e=5){this._cache={},this._order=[],this.limit=e}get(e){const t=this._cache[e];return t&&(this._deleteOrder(e),this._appendOrder(e)),t}set(e,t){this._cache[e]?(this.delete(e),this._cache[e]=t,this._appendOrder(e)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[e]=t,this._appendOrder(e))}delete(e){this._cache[e]&&(delete this._cache[e],this._deleteOrder(e))}_deleteOrder(e){const t=this._order.indexOf(e);t>=0&&this._order.splice(t,1)}_appendOrder(e){this._order.push(e)}}function Jle(){const r=[];for(let e=32;e<128;e++)r.push(String.fromCharCode(e));return r}const Cp={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:Jle(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},nP=1024,iP=.9,sP=1.2,B6=3;let V_=new E6(B6);function Xle(r,e){let t;typeof e=="string"?t=new Set(Array.from(e)):t=new Set(e);const n=V_.get(r);if(!n)return t;for(const i in n.mapping)t.has(i)&&t.delete(i);return t}function Kle(r,e){for(let t=0;t<r.length;t++)e.data[4*t+3]=r[t]}function oP(r,e,t,n){r.font=`${n} ${t}px ${e}`,r.fillStyle="#000",r.textBaseline="alphabetic",r.textAlign="left"}function qle(r){Yr.assert(Number.isFinite(r)&&r>
4068=B6,"Invalid cache limit"),V_=new E6(r)}class Yle{constructor(){this.props={...Cp}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){const{fontSize:e,buffer:t}=this.props;return(e*sP+t*2)/e}setProps(e={}){Object.assign(this.props,e),this._key=this._getKey();const t=Xle(this._key,this.props.characterSet),n=V_.get(this._key);if(n&&t.size===0){this._atlas!==n&&(this._atlas=n);return}const i=this._generateFontAtlas(t,n);this._atlas=i,V_.set(this._key,i)}_generateFontAtlas(e,t){const{fontFamily:n,fontWeight:i,fontSize:s,buffer:o,sdf:c,radius:f,cutoff:A}=this.props;let v=t&&t.data;v||(v=document.createElement("canvas"),v.width=nP);const w=v.getContext("2d",{willReadFrequently:!0});oP(w,n,s,i);const{mapping:S,canvasHeight:F,xOffset:N,yOffset:U}=Gle({getFontWidth:$=>w.measureText($).width,fontHeight:s*sP,buffer:o,characterSet:e,maxCanvasWidth:nP,...t&&{mapping:t.mapping,xOffset:t.xOffset,yOffset:t.yOffset}});if(v.height!==F){const $=w.getImageData(0,0,v.width,v.height);v.height=F,w.putImageData($,0,0)}if(oP(w,n,s,i),c){const $=new kle({fontSize:s,buffer:o,radius:f,cutoff:A,fontFamily:n,fontWeight:`${i}`});for(const G of e){const{data:H,width:J,height:ue,glyphTop:q}=$.draw(G);S[G].width=J,S[G].layoutOffsetY=s*iP-q;const se=w.createImageData(J,ue);Kle(H,se),w.putImageData(se,S[G].x,S[G].y)}}else for(const $ of e)w.fillText($,S[$].x,S[$].y+o+s*iP);return{xOffset:N,yOffset:U,mapping:S,data:v,width:v.width,height:v.height}}_getKey(){const{fontFamily:e,fontWeight:t,fontSize:n,buffer:i,sdf:s,radius:o,cutoff:c}=this.props;return s?`${e} ${t} ${n} ${i} ${o} ${c}`:`${e} ${t} ${n} ${i}`}}const aP=`uniform textBackgroundUniforms {
4069  bool billboard;
4070  float sizeScale;
4071  float sizeMinPixels;
4072  float sizeMaxPixels;
4073  vec4 borderRadius;
4074  vec4 padding;
4075  highp int sizeUnits;
4076  bool stroked;
4077} textBackground;
4078`,Zle={name:"textBackground",vs:aP,fs:aP,uniformTypes:{billboard:"f32",sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",borderRadius:"vec4<f32>",padding:"vec4<f32>",sizeUnits:"i32",stroked:"f32"}},Qle=`#version 300 es
4079#define SHADER_NAME text-background-layer-vertex-shader
4080in vec2 positions;
4081in vec3 instancePositions;
4082in vec3 instancePositions64Low;
4083in vec4 instanceRects;
4084in float instanceSizes;
4085in float instanceAngles;
4086in vec2 instancePixelOffsets;
4087in float instanceLineWidths;
4088in vec4 instanceFillColors;
4089in vec4 instanceLineColors;
4090in vec3 instancePickingColors;
4091out vec4 vFillColor;
4092out vec4 vLineColor;
4093out float vLineWidth;
4094out vec2 uv;
4095out vec2 dimensions;
4096vec2 rotate_by_angle(vec2 vertex, float angle) {
4097float angle_radian = radians(angle);
4098float cos_angle = cos(angle_radian);
4099float sin_angle = sin(angle_radian);
4100mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
4101return rotationMatrix * vertex;
4102}
4103void main(void) {
4104geometry.worldPosition = instancePositions;
4105geometry.uv = positions;
4106geometry.pickingColor = instancePickingColors;
4107uv = positions;
4108vLineWidth = instanceLineWidths;
4109float sizePixels = clamp(
4110project_size_to_pixel(instanceSizes * textBackground.sizeScale, textBackground.sizeUnits),
4111textBackground.sizeMinPixels, textBackground.sizeMaxPixels
4112);
4113dimensions = instanceRects.zw * sizePixels + textBackground.padding.xy + textBackground.padding.zw;
4114vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-textBackground.padding.xy, textBackground.padding.zw, positions);
4115pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);
4116pixelOffset += instancePixelOffsets;
4117pixelOffset.y *= -1.0;
4118if (textBackground.billboard)  {
4119gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
4120DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
4121vec3 offset = vec3(pixelOffset, 0.0);
4122DECKGL_FILTER_SIZE(offset, geometry);
4123gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
4124} else {
4125vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
4126DECKGL_FILTER_SIZE(offset_common, geometry);
4127gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
4128DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
4129}
4130vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity);
4131DECKGL_FILTER_COLOR(vFillColor, geometry);
4132vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);
4133DECKGL_FILTER_COLOR(vLineColor, geometry);
4134}
4135`,eue=`#version 300 es
4136#define SHADER_NAME text-background-layer-fragment-shader
4137precision highp float;
4138in vec4 vFillColor;
4139in vec4 vLineColor;
4140in float vLineWidth;
4141in vec2 uv;
4142in vec2 dimensions;
4143out vec4 fragColor;
4144float round_rect(vec2 p, vec2 size, vec4 radii) {
4145vec2 pixelPositionCB = (p - 0.5) * size;
4146vec2 sizeCB = size * 0.5;
4147float maxBorderRadius = min(size.x, size.y) * 0.5;
4148vec4 borderRadius = vec4(min(radii, maxBorderRadius));
4149borderRadius.xy =
4150(pixelPositionCB.x > 0.0) ? borderRadius.xy : borderRadius.zw;
4151borderRadius.x = (pixelPositionCB.y > 0.0) ? borderRadius.x : borderRadius.y;
4152vec2 q = abs(pixelPositionCB) - sizeCB + borderRadius.x;
4153return -(min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - borderRadius.x);
4154}
4155float rect(vec2 p, vec2 size) {
4156vec2 pixelPosition = p * size;
4157return min(min(pixelPosition.x, size.x - pixelPosition.x),
4158min(pixelPosition.y, size.y - pixelPosition.y));
4159}
4160vec4 get_stroked_fragColor(float dist) {
4161float isBorder = smoothedge(dist, vLineWidth);
4162return mix(vFillColor, vLineColor, isBorder);
4163}
4164void main(void) {
4165geometry.uv = uv;
4166if (textBackground.borderRadius != vec4(0.0)) {
4167float distToEdge = round_rect(uv, dimensions, textBackground.borderRadius);
4168if (textBackground.stroked) {
4169fragColor = get_stroked_fragColor(distToEdge);
4170} else {
4171fragColor = vFillColor;
4172}
4173float shapeAlpha = smoothedge(-distToEdge, 0.0);
4174fragColor.a *= shapeAlpha;
4175} else {
4176if (textBackground.stroked) {
4177float distToEdge = rect(uv, dimensions);
4178fragColor = get_stroked_fragColor(distToEdge);
4179} else {
4180fragColor = vFillColor;
4181}
4182}
4183DECKGL_FILTER_COLOR(fragColor, geometry);
4184}
4185`,tue={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,borderRadius:{type:"object",value:0},padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:r=>r.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}};class Jg extends Es{getShaders(){return super.getShaders({vs:Qle,fs:eue,modules:[Ls,_a,Zle]})}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);const{changeFlags:t}=e;t.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}
4185){const{billboard:t,sizeScale:n,sizeUnits:i,sizeMinPixels:s,sizeMaxPixels:o,getLineWidth:c}=this.props;let{padding:f,borderRadius:A}=this.props;f.length<4&&(f=[f[0],f[1],f[0],f[1]]),Array.isArray(A)||(A=[A,A,A,A]);const v=this.state.model,w={billboard:t,stroked:!!c,borderRadius:A,padding:f,sizeUnits:Po[i],sizeScale:n,sizeMinPixels:s,sizeMaxPixels:o};v.shaderInputs.setProps({textBackground:w}),v.draw(this.context.renderPass)}_getModel(){const e=[0,0,1,0,0,1,1,1];return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ys({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}}Jg.defaultProps=tue;Jg.layerName="TextBackgroundLayer";const cP={start:1,middle:0,end:-1},lP={top:1,center:0,bottom:-1},$b=[0,0,0,255],rue=1,nue={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:$b},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:Cp.characterSet},fontFamily:Cp.fontFamily,fontWeight:Cp.fontWeight,lineHeight:rue,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:$b},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:r=>r.text},getPosition:{type:"accessor",value:r=>r.position},getColor:{type:"accessor",value:$b},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"]}};class Eh extends Bs{constructor(){super(...arguments),this.getBoundingRect=(e,t)=>{let{size:[n,i]}=this.transformParagraph(e,t);const{fontSize:s}=this.state.fontAtlasManager.props;n/=s,i/=s;const{getTextAnchor:o,getAlignmentBaseline:c}=this.props,f=cP[typeof o=="function"?o(e,t):o],A=lP[typeof c=="function"?c(e,t):c];return[(f-1)*n/2,(A-1)*i/2,n,i]},this.getIconOffsets=(e,t)=>{const{getTextAnchor:n,getAlignmentBaseline:i}=this.props,{x:s,y:o,rowWidth:c,size:[f,A]}=this.transformParagraph(e,t),v=cP[typeof n=="function"?n(e,t):n],w=lP[typeof i=="function"?i(e,t):i],S=s.length,F=new Array(S*2);let N=0;for(let U=0;U<S;U++){const $=(1-v)*(f-c[U])/2;F[N++]=(v-1)*f/2+$+s[U],F[N++]=(w-1)*A/2+o[U]}return F}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new Yle},this.props.maxWidth>0&&Yr.once(1,"v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){const{props:t,oldProps:n,changeFlags:i}=e;(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||t.lineHeight!==n.lineHeight||t.wordBreak!==n.wordBreak||t.maxWidth!==n.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(){const{fontSettings:e,fontFamily:t,fontWeight:n}=this.props,{fontAtlasManager:i,characterSet:s}=this.state,o={...e,characterSet:s,fontFamily:t,fontWeight:n};if(!i.mapping)return i.setProps(o),!0;for(const c in o)if(o[c]!==i.props[c])return i.setProps(o),!0;return!1}_updateText(){const{data:e,characterSet:t}=this.props,n=e.attributes?.getText;let{getText:i}=this.props,s=e.startIndices,o;const c=t==="auto"&&new Set;if(n&&s){const{texts:f,characterCount:A}=Wle({...ArrayBuffer.isView(n)?{value:n}:n,length:e.length,startIndices:s,characterSet:c});o=A,i=(v,{index:w})=>f[w]}else{const{iterable:f,objectInfo:A}=gl(e);s=[0],o=0;for(const v of f){A.index++;const w=Array.from(i(v,A)||"");c&&w.forEach(c.add,c),o+=w.length,s.push(o)}}this.setState({getText:i,startIndices:s,numInstances:o,characterSet:c||t})}transformParagraph(e,t){const{fontAtlasManager:n}=this.state,i=n.mapping,s=this.state.getText,{wordBreak:o,lineHeight:c,maxWidth:f}=this.props,A=s(e,t)||"";return $le(A,c,o,f*n.props.fontSize,i)}renderLayers(){const{startIndices:e,numInstances:t,getText:n,fontAtlasManager:{scale:i,atlas:s,mapping:o},styleVersion:c}=this.state,{data:f,_dataDiff:A,getPosition:v,getColor:w,getSize:S,getAngle:F,getPixelOffset:N,getBackgroun
4185dColor:U,getBorderColor:$,getBorderWidth:G,backgroundBorderRadius:H,backgroundPadding:J,background:ue,billboard:q,fontSettings:se,outlineWidth:Te,outlineColor:Ue,sizeScale:de,sizeUnits:me,sizeMinPixels:pe,sizeMaxPixels:W,transitions:re,updateTriggers:Ee}=this.props,et=this.getSubLayerClass("characters",Iy),_e=this.getSubLayerClass("background",Jg);return[ue&&new _e({getFillColor:U,getLineColor:$,getLineWidth:G,borderRadius:H,padding:J,getPosition:v,getSize:S,getAngle:F,getPixelOffset:N,billboard:q,sizeScale:de,sizeUnits:me,sizeMinPixels:pe,sizeMaxPixels:W,transitions:re&&{getPosition:re.getPosition,getAngle:re.getAngle,getSize:re.getSize,getFillColor:re.getBackgroundColor,getLineColor:re.getBorderColor,getLineWidth:re.getBorderWidth,getPixelOffset:re.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:Ee.getPosition,getAngle:Ee.getAngle,getSize:Ee.getSize,getFillColor:Ee.getBackgroundColor,getLineColor:Ee.getBorderColor,getLineWidth:Ee.getBorderWidth,getPixelOffset:Ee.getPixelOffset,getBoundingRect:{getText:Ee.getText,getTextAnchor:Ee.getTextAnchor,getAlignmentBaseline:Ee.getAlignmentBaseline,styleVersion:c}}}),{data:f.attributes&&f.attributes.background?{length:f.length,attributes:f.attributes.background}:f,_dataDiff:A,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new et({sdf:se.sdf,smoothing:Number.isFinite(se.smoothing)?se.smoothing:Cp.smoothing,outlineWidth:Te/(se.radius||Cp.radius),outlineColor:Ue,iconAtlas:s,iconMapping:o,getPosition:v,getColor:w,getSize:S,getAngle:F,getPixelOffset:N,billboard:q,sizeScale:de*i,sizeUnits:me,sizeMinPixels:pe*i,sizeMaxPixels:W*i,transitions:re&&{getPosition:re.getPosition,getAngle:re.getAngle,getColor:re.getColor,getSize:re.getSize,getPixelOffset:re.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:Ee.getText,getPosition:Ee.getPosition,getAngle:Ee.getAngle,getColor:Ee.getColor,getSize:Ee.getSize,getPixelOffset:Ee.getPixelOffset,getIconOffsets:{getTextAnchor:Ee.getTextAnchor,getAlignmentBaseline:Ee.getAlignmentBaseline,styleVersion:c}}}),{data:f,_dataDiff:A,startIndices:e,numInstances:t,getIconOffsets:this.getIconOffsets,getIcon:n})]}static set fontAtlasCacheLimit(e){qle(e)}}Eh.defaultProps=nue;Eh.layerName="TextLayer";const q0={circle:{type:Wg,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:Jp,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:Eh,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPi
4185xels:"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"}}},Y0={type:uf,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},lx={type:ff,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function OA({type:r,props:e}){const t={};for(const n in e)t[n]=r.defaultProps[e[n]];return t}function Wb(r,e){const{transitions:t,updateTriggers:n}=r.props,i={updateTriggers:{},transitions:t&&{getPosition:t.geometry}};for(const s in e){const o=e[s];let c=r.props[s];s.startsWith("get")&&(c=r.getSubLayerAccessor(c),i.updateTriggers[o]=n[s],t&&(i.transitions[o]=t[s])),i[o]=c}return i}function iue(r){if(Array.isArray(r))return r;switch(Yr.assert(r.type,"GeoJSON does not have type"),r.type){case"Feature":return[r];case"FeatureCollection":return Yr.assert(Array.isArray(r.features),"GeoJSON does not have features array"),r.features;default:return[{geometry:r}]}}function uP(r,e,t={}){const n={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:i=0,endRow:s=r.length}=t;for(let o=i;o<s;o++){const c=r[o],{geometry:f}=c;if(f)if(f.type==="GeometryCollection"){Yr.assert(Array.isArray(f.geometries),"GeoJSON does not have geometries array");const{geometries:A}=f;for(let v=0;v<A.length;v++){const w=A[v];fP(w,n,e,c,o)}}else fP(f,n,e,c,o)}return n}function fP(r,e,t,n,i){const{type:s,coordinates:o}=r,{pointFeatures:c,lineFeatures:f,polygonFeatures:A,polygonOutlineFeatures:v}=e;if(!oue(s,o)){Yr.warn(`${s} coordinates are malformed`)();return}switch(s){case"Point":c.push(t({geometry:r},n,i));break;case"MultiPoint":o.forEach(w=>{c.push(t({geometry:{type:"Point",coordinates:w}},n,i))});break;case"LineString":f.push(t({geometry:r},n,i));break;case"MultiLineString":o.forEach(w=>{f.push(t({geometry:{type:"LineString",coordinates:w}},n,i))});break;case"Polygon":A.push(t({geometry:r},n,i)),o.forEach(w=>{v.push(t({geometry:{type:"LineString",coordinates:w}},n,i))});break;case"MultiPolygon":o.forEach(w=>{A.push(t({geometry:{type:"Polygon",coordinates:w}},n,i)),w.forEach(S=>{v.push(t({geometry:{type:"LineString",coordinates:S}},n,i))})});break}}const sue={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function oue(r,e){let t=sue[r];for(Yr.assert(t,`Unknown GeoJSON type ${r}`);e&&--t>0;)e=e[0];return e&&Number.isFinite(e[0])}function S6(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function l0(r){return r.geometry.coordinates}function aue(r,e){const t=S6(),{pointFeatures:n,lineFeatures:i,polygonFeatures:s,polygonOutlineFeatures:o}=r;return t.points.data=n,t.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),t.points.getPosition=l0,t.lines.data=i,t.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),t.lines.getPath=l0,t.polygons.data=s,t.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),t.polygons.getPolygon=l0,t.polygonsOutline.data=o,t.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),t.polygonsOutline.getPath=l0,t}function cue(r,e){const t=S6(),{points:n,lines:i,polygons:s}=r,o=Fle(r,e);return t.points.data={length:n.positions.value.length/n.positions.size,attributes:{...n.attributes,getPosition:n.positions,instancePickingColors:{size:4,value:o.points}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},t.lines.data={length:i.pathIndices.value.length-1,startIndices:i.pathIndices.value,attributes:{...i.attributes,getPath:i.positions,instancePickingColors:{size:4,value:o.lines}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},t.lines._pathType="open",t.polygons.data={length:s.polygonIndices.value.length-1,startIndices:s.polygonIndices.value,attributes:{...s.attributes,getPolygon:s.positions,pickingColors:{size:4,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},t.polygons._normalize=!1,s.triangles&&(t.polygons.data.attributes.indices=s.triangles.value),t.polygonsOutline.data={length:s.primitivePolygonIndices.value.length-1,startIndices:s.primitivePolygonIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:4,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},t.polygonsOutline._pathType="open",t}const lue=["points","linestrings","polygons"],uue={...OA(q0.circle),...OA(q0.icon),...OA(q0.text),...OA(Y0),...OA(lx),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:r=>r.properties.icon},getText:{type:"accessor",value:r=>r.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}};class iu extends Bs{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:t}){if(!t.dataChanged)return;const{data:n}=this.props,i=n&&"points"in n&&"polygons"in n&&"lines"in n;this.setState({binary:i}),i?this._updateStateBinary({props:e,changeFlags:t}):this._updateStateJSON({props:e,changeFlags:t})}_updateStateBinary({props:e,changeFlags:t}){const n=cue(e.data,this.encodePickingColor);this.setState({layerProps:n})}_updateStateJSON({props:e,changeFlags:t}){const n=iue(e.data),i=this.getSubLayerRow.bind(this);let s={};const o={};if(Array.isArray(t.dataChanged)){const f=this.state.features;for(const A in f)s[A]=f[A].slice(),o[A]=[];for(const A of t.dataChanged){const v=uP(n,i,A);for(const w in f)o[w].push(x6({data:s[w],getIndex:S=>S.__source.index,dataRange:A,replace:v[w]}))}}else s=uP(n,i);const c=aue(s,o);this.setState({features:s,featuresDiff:o,layerProps:c})}getPickingInfo(e){const t=super.getPickingInfo(e),{index:n,sourceLayer:i}=t;return t.featureType=lue.find(s=>
4185i.id.startsWith(`${this.id}-${s}-`)),n>=0&&i.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(t.index=this.props.data.points.globalFeatureIds.value[n]),t}_updateAutoHighlight(e){const t=`${this.id}-points-`,n=e.featureType==="points";for(const i of this.getSubLayers())i.id.startsWith(t)===n&&i.updateAutoHighlight(e)}_renderPolygonLayer(){const{extruded:e,wireframe:t}=this.props,{layerProps:n}=this.state,i="polygons-fill",s=this.shouldRenderSubLayer(i,n.polygons?.data)&&this.getSubLayerClass(i,lx.type);if(s){const o=Wb(this,lx.props),c=e&&t;return c||delete o.getLineColor,o.updateTriggers.lineColors=c,new s(o,this.getSubLayerProps({id:i,updateTriggers:o.updateTriggers}),n.polygons)}return null}_renderLineLayers(){const{extruded:e,stroked:t}=this.props,{layerProps:n}=this.state,i="polygons-stroke",s="linestrings",o=!e&&t&&this.shouldRenderSubLayer(i,n.polygonsOutline?.data)&&this.getSubLayerClass(i,Y0.type),c=this.shouldRenderSubLayer(s,n.lines?.data)&&this.getSubLayerClass(s,Y0.type);if(o||c){const f=Wb(this,Y0.props);return[o&&new o(f,this.getSubLayerProps({id:i,updateTriggers:f.updateTriggers}),n.polygonsOutline),c&&new c(f,this.getSubLayerProps({id:s,updateTriggers:f.updateTriggers}),n.lines)]}return null}_renderPointLayers(){const{pointType:e}=this.props,{layerProps:t,binary:n}=this.state;let{highlightedObjectIndex:i}=this.props;!n&&Number.isFinite(i)&&(i=t.points.data.findIndex(c=>c.__source.index===i));const s=new Set(e.split("+")),o=[];for(const c of s){const f=`points-${c}`,A=q0[c],v=A&&this.shouldRenderSubLayer(f,t.points?.data)&&this.getSubLayerClass(f,A.type);if(v){const w=Wb(this,A.props);let S=t.points;if(c==="text"&&n){const{instancePickingColors:F,...N}=S.data.attributes;S={...S,data:{...S.data,attributes:N}}}o.push(new v(w,this.getSubLayerProps({id:f,updateTriggers:w.updateTriggers,highlightedObjectIndex:i}),S))}}return o}renderLayers(){const{extruded:e}=this.props,t=this._renderPolygonLayer(),n=this._renderLineLayers(),i=this._renderPointLayers();return[!e&&t,n,i,e&&t]}getSubLayerAccessor(e){const{binary:t}=this.state;return!t||typeof e!="function"?super.getSubLayerAccessor(e):(n,i)=>{const{data:s,index:o}=i,c=Ple(s,o);return e(c,i)}}}iu.layerName="GeoJsonLayer";iu.defaultProps=uue;const fue=Object.freeze(Object.defineProperty({__proto__:null,ArcLayer:jg,BitmapLayer:By,ColumnLayer:ml,GeoJsonLayer:iu,GridCellLayer:mC,IconLayer:Jp,LineLayer:Sy,PathLayer:uf,PointCloudLayer:$g,PolygonLayer:hf,ScatterplotLayer:Wg,SolidPolygonLayer:ff,TextLayer:Eh,_MultiIconLayer:Iy,_TextBackgroundLayer:Jg},Symbol.toStringTag,{value:"Module"}));function hue(r){return typeof r=="string"?r.charAt(0).toLowerCase()+r.slice(1):r}function ux(r){if(Array.isArray(r))return r.map(e=>ux(e));if(r&&typeof r=="object"){const e={};for(const[t,n]of Object.entries(r))e[hue(t)]=ux(n);return e}return r}var Jb={},Xb={},hP;function _C(){return hP||(hP=1,function(r){const e=":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",t=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",n="["+e+"]["+t+"]*",i=new RegExp("^"+n+"$"),s=function(c,f){const A=[];let v=f.exec(c);for(;v;){const w=[];w.startIndex=f.lastIndex-v[0].length;const S=v.length;for(let F=0;F<S;F++)w.push(v[F]);A.push(w),v=f.exec(c)}return A},o=function(c){const f=i.exec(c);return!(f===null||typeof f>"u")};r.isExist=function(c){return typeof c<"u"},r.isEmptyObject=function(c){return Object.keys(c).length===0},r.merge=function(c,f,A){if(f){const v=Object.keys(f),w=v.length;for(let S=0;S<w;S++)A==="strict"?c[v[S]]=[f[v[S]]]:c[v[S]]=f[v[S]]}},r.getValue=function(c){return r.isExist(c)?c:""},r.isName=o,r.getAllMatches=s,r.nameRegexp=n}(Xb)),Xb}var dP;function I6(){if(dP)return Jb;dP=1;const r=_C(),e={allowBooleanAttributes:!1,unpairedTags:[]};Jb.validate=function(G,H){H=Object.assign({},e,H);const J=[];let ue=!1,q=!1;G[0]==="\uFEFF"&&(G=G.substr(1));for(let se=0;se<G.length;se++)if(G[se]==="<"&&G[se+1]==="?"){if(se+=2,se=n(G,se),se.err)return se}else if(G[se]==="<"){let Te=se;if(se++,G[se]==="!"){se=i(G,se);continue}else{let Ue=!1;G[se]==="/"&&(Ue=!0,se++);let de="";for(;se<G.length&&G[se]!==">"&&G[se]!==" "&&G[se]!=="	"&&G[se]!==`
4186`&&G[se]!=="\r";se++)de+=G[se];if(de=de.trim(),de[de.length-1]==="/"&&(de=de.substring(0,de.length-1),se--),!N(de)){let W;return de.trim().length===0?W="Invalid space after '<'.":W="Tag '"+de+"' is an invali
4186d name.",S("InvalidTag",W,U(G,se))}const me=c(G,se);if(me===!1)return S("InvalidAttr","Attributes for '"+de+"' have open quote.",U(G,se));let pe=me.value;if(se=me.index,pe[pe.length-1]==="/"){const W=se-pe.length;pe=pe.substring(0,pe.length-1);const re=A(pe,H);if(re===!0)ue=!0;else return S(re.err.code,re.err.msg,U(G,W+re.err.line))}else if(Ue)if(me.tagClosed){if(pe.trim().length>0)return S("InvalidTag","Closing tag '"+de+"' can't have attributes or invalid starting.",U(G,Te));if(J.length===0)return S("InvalidTag","Closing tag '"+de+"' has not been opened.",U(G,Te));{const W=J.pop();if(de!==W.tagName){let re=U(G,W.tagStartPos);return S("InvalidTag","Expected closing tag '"+W.tagName+"' (opened in line "+re.line+", col "+re.col+") instead of closing tag '"+de+"'.",U(G,Te))}J.length==0&&(q=!0)}}else return S("InvalidTag","Closing tag '"+de+"' doesn't have proper closing.",U(G,se));else{const W=A(pe,H);if(W!==!0)return S(W.err.code,W.err.msg,U(G,se-pe.length+W.err.line));if(q===!0)return S("InvalidXml","Multiple possible root nodes found.",U(G,se));H.unpairedTags.indexOf(de)!==-1||J.push({tagName:de,tagStartPos:Te}),ue=!0}for(se++;se<G.length;se++)if(G[se]==="<")if(G[se+1]==="!"){se++,se=i(G,se);continue}else if(G[se+1]==="?"){if(se=n(G,++se),se.err)return se}else break;else if(G[se]==="&"){const W=w(G,se);
4186if(W==-1)return S("InvalidChar","char '&' is not expected.",U(G,se));se=W}else if(q===!0&&!t(G[se]))return S("InvalidXml","Extra text at the end",U(G,se));G[se]==="<"&&se--}}else{if(t(G[se]))continue;return S("InvalidChar","char '"+G[se]+"' is not expected.",U(G,se))}if(ue){if(J.length==1)return S("InvalidTag","Unclosed tag '"+J[0].tagName+"'.",U(G,J[0].tagStartPos));if(J.length>0)return S("InvalidXml","Invalid '"+JSON.stringify(J.map(se=>se.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return S("InvalidXml","Start tag expected.",1);return!0};function t(G){return G===" "||G==="	"||G===`
4187`||G==="\r"}function n(G,H){const J=H;for(;H<G.length;H++)if(G[H]=="?"||G[H]==" "){const ue=G.substr(J,H-J);if(H>5&&ue==="xml")return S("InvalidXml","XML declaration allowed only at the start of the document.",U(G,H));if(G[H]=="?"&&G[H+1]==">"){H++;break}else continue}return H}function i(G,H){if(G.length>H+5&&G[H+1]==="-"&&G[H+2]==="-"){for(H+=3;H<G.length;H++)if(G[H]==="-"&&G[H+1]==="-"&&G[H+2]===">"){H+=2;break}}else if(G.length>H+8&&G[H+1]==="D"&&G[H+2]==="O"&&G[H+3]==="C"&&G[H+4]==="T"&&G[H+5]==="Y"&&G[H+6]==="P"&&G[H+7]==="E"){let J=1;for(H+=8;H<G.length;H++)if(G[H]==="<")J++;else if(G[H]===">"&&(J--,J===0))break}else if(G.length>H+9&&G[H+1]==="["&&G[H+2]==="C"&&G[H+3]==="D"&&G[H+4]==="A"&&G[H+5]==="T"&&G[H+6]==="A"&&G[H+7]==="["){for(H+=8;H<G.length;H++)if(G[H]==="]"&&G[H+1]==="]"&&G[H+2]===">"){H+=2;break}}return H}const s='"',o="'";function c(G,H){let J="",ue="",q=!1;for(;H<G.length;H++){if(G[H]===s||G[H]===o)ue===""?ue=G[H]:ue!==G[H]||(ue="");else if(G[H]===">"&&ue===""){q=!0;break}J+=G[H]}return ue!==""?!1:{value:J,index:H,tagClosed:q}}const f=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function A(G,H){const J=r.getAllMatches(G,f),ue={};for(let q=0;q<J.length;q++){if(J[q][1].length===0)return S("InvalidAttr","Attribute '"+J[q][2]+"' has no space in starting.",$(J[q]));if(J[q][3]!==void 0&&J[q][4]===void 0)return S("InvalidAttr","Attribute '"+J[q][2]+"' is without value.",$(J[q]));if(J[q][3]===void 0&&!H.allowBooleanAttributes)return S("InvalidAttr","boolean attribute '"+J[q][2]+"' is not allowed.",$(J[q]));const se=J[q][2];if(!F(se))return S("InvalidAttr","Attribute '"+se+"' is an invalid name.",$(J[q]));if(!ue.hasOwnProperty(se))ue[se]=1;else return S("InvalidAttr","Attribute '"+se+"' is repeated.",$(J[q]))}return!0}function v(G,H){let J=/\d/;for(G[H]==="x"&&(H++,J=/[\da-fA-F]/);H<G.length;H++){if(G[H]===";")return H;if(!G[H].match(J))break}return-1}function w(G,H){if(H++,G[H]===";")return-1;if(G[H]==="#")return H++,v(G,H);let J=0;for(;H<G.length;H++,J++)if(!(G[H].match(/\w/)&&J<20)){if(G[H]===";")break;return-1}return H}function S(G,H,J){return{err:{code:G,msg:H,line:J.line||J,col:J.col}}}function F(G){return r.isName(G)}function N(G){return r.isName(G)}function U(G,H){const J=G.substring(0,H).split(/\r?\n/);return{line:J.length,col:J[J.length-1].length+1}}function $(G){return G.startIndex+G[1].length}return Jb}var u0={},pP;function due(){if(pP)return u0;pP=1;const r={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,n){return n},attributeValueProcessor:function(t,n){return n},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,n,i){return t}},e=function(t){return Object.assign({},r,t)};return u0.buildOptions=e,u0.defaultOptions=r,u0}var Kb,AP;function pue(){if(AP)return Kb;AP=1;class r{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}return Kb=r,Kb}var qb,gP;function Aue(){if(gP)return qb;gP=1;const r=_C();function e(A,v){const w={};if(A[v+3]==="O"&&A[v+4]==="C"&&A[v+5]==="T"&&A[v+6]==="Y"&&A[v+7]==="P"&&A[v+8]==="E"){v=v+9;let S=1,F=!1,N=!1,U="";for(;v<A.length;v++)if(A[v]==="<"&&!N){if(F&&i(A,v))v+=7,[entityName,val,v]=t(A,v+1),val.indexOf("&")===-1&&(w[f(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(F&&s(A,v))v+=8;else if(F&&o(A,v))v+=8;else if(F&&c(A,v))v+=9;else if(n)N=!0;else throw new Error("Invalid DOCTYPE");S++,U=""}else if(A[v]===">"){if(N?A[v-1]==="-"&&A[v-2]==="-"&&(N=!1,S--):S--,S===0)break}else A[v]==="["?F=!0:U+=A[v];
4187if(S!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:w,i:v}}function t(A,v){let w="";for(;v<A.length&&A[v]!=="'"&&A[v]!=='"';v++)w+=A[v];if(w=w.trim(),w.indexOf(" ")!==-1)throw new Error("External entites are not supported");const S=A[v++];let F="";for(;v<A.length&&A[v]!==S;v++)F+=A[v];return[w,F,v]}function n(A,v){return A[v+1]==="!"&&A[v+2]==="-"&&A[v+3]==="-"}function i(A,v){return A[v+1]==="!"&&A[v+2]==="E"&&A[v+3]==="N"&&A[v+4]==="T"&&A[v+5]==="I"&&A[v+6]==="T"&&A[v+7]==="Y"}function s(A,v){return A[v+1]==="!"&&A[v+2]==="E"&&A[v+3]==="L"&&A[v+4]==="E"&&A[v+5]==="M"&&A[v+6]==="E"&&A[v+7]==="N"&&A[v+8]==="T"}function o(A,v){return A[v+1]==="!"&&A[v+2]==="A"&&A[v+3]==="T"&&A[v+4]==="T"&&A[v+5]==="L"&&A[v+6]==="I"&&A[v+7]==="S"&&A[v+8]==="T"}function c(A,v){return A[v+1]==="!"&&A[v+2]==="N"&&A[v+3]==="O"&&A[v+4]==="T"&&A[v+5]==="A"&&A[v+6]==="T"&&A[v+7]==="I"&&A[v+8]==="O"&&A[v+9]==="N"}function f(A){if(r.isName(A))return A;throw new Error(`Invalid entity name ${A}`)}return qb=e,qb}var Yb,mP;function gue(){if(mP)return Yb;mP=1;const r=/^[-+]?0x[a-fA-F0-9]+$/,e=/^([\-\+])?(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);const t={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function n(s,o={}){if(o=Object.assign({},t,o),!s||typeof s!="string")return s;let c=s.trim();if(o.skipLike!==void 0&&o.skipLike.test(c))return s;if(o.hex&&r.test(c))return Number.parseInt(c,16);{const f=e.exec(c);if(f){const A=f[1],v=f[2];let w=i(f[3]);const S=f[4]||f[6];if(!o.leadingZeros&&v.length>0&&A&&c[2]!==".")return s;if(!o.leadingZeros&&v.length>0&&!A&&c[1]!==".")return s;{const F=Number(c),N=""+F;return N.search(/[eE]/)!==-1||S?o.eNotation?F:s:c.indexOf(".")!==-1?N==="0"&&w===""||N===w||A&&N==="-"+w?F:s:v?w===N||A+w===N?F:s:c===N||c===A+N?F:s}}else return s}}function i(s){return s&&s.indexOf(".")!==-1&&(s=s.replace(/0+$/,""),s==="."?s="0":s[0]==="."?s="0"+s:s[s.length-1]==="."&&(s=s.substr(0,s.length-1))),s}return Yb=n,Yb}var Zb,_P;function M6(){if(_P)return Zb;_P=1;function r(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}return Zb=r,Zb}var Qb,yP;function mue(){if(yP)return Qb;yP=1;const r=_C(),e=pue(),t=Aue(),n=gue(),i=M6();class s{constructor(se){this.options=se,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:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(Te,Ue)=>String.fromCharCode(Number.parseInt(Ue,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(Te,Ue)=>String.fromCharCode(Number.parseInt(Ue,16))}},this.addExternalEntities=o,this.parseXml=w,this.parseTextData=c,this.resolveNameSpace=f,this.buildAttributesMap=v,this.isItStopNode=U,this.replaceEntitiesValue=F,this.readStopNodeData=J,this.saveTextToParentTag=N,this.addChild=S,this.ignoreAttributesFn=i(this.options.ignoreAttributes)}}function o(q){const se=Object.keys(q);for(let Te=0;Te<se.length;Te++){const Ue=se[Te];this.lastEntities[Ue]={regex:new RegExp("&"+Ue+";","g"),val:q[Ue]}}}function c(q,se,Te,Ue,de,me,pe){if(q!==void 0&&(this.options.trimValues&&!Ue&&(q=q.trim()),q.length>0)){pe||(q=this.replaceEntitiesValue(q));const W=this.options.tagValueProcessor(se,q,Te,de,me);return W==null?q:typeof W!=typeof q||W!==q?W:this.options.trimValues?ue(q,this.options.parseTagValue,this.options.numberParseOptions):q.trim()===q?ue(q,this.options.parseTagValue,this.options.numberParseOptions):q}}
4187function f(q){if(this.options.removeNSPrefix){const se=q.split(":"),Te=q.charAt(0)==="/"?"/":"";if(se[0]==="xmlns")return"";se.length===2&&(q=Te+se[1])}return q}const A=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function v(q,se,Te){if(this.options.ignoreAttributes!==!0&&typeof q=="string"){const Ue=r.getAllMatches(q,A),de=Ue.length,me={};for(let pe=0;pe<de;pe++){const W=this.resolveNameSpace(Ue[pe][1]);if(this.ignoreAttributesFn(W,se))continue;let re=Ue[pe][4],Ee=this.options.attributeNamePrefix+W;if(W.length)if(this.options.transformAttributeName&&(Ee=this.options.transformAttributeName(Ee)),Ee==="__proto__"&&(Ee="#__proto__"),re!==void 0){this.options.trimValues&&(re=re.trim()),re=this.replaceEntitiesValue(re);const et=this.options.attributeValueProcessor(W,re,se);et==null?me[Ee]=re:typeof et!=typeof re||et!==re?me[Ee]=et:me[Ee]=ue(re,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(me[Ee]=!0)}if(!Object.keys(me).length)return;if(this.options.attributesGroupName){const pe={};return pe[this.options.attributesGroupName]=me,pe}return me}}const w=function(q){q=q.replace(/\r\n?/g,`
4188`);const se=new e("!xml");let Te=se,Ue="",de="";for(let me=0;me<q.length;me++)if(q[me]==="<")if(q[me+1]==="/"){const W=G(q,">",me,"Closing Tag is not closed.");let re=q.substring(me+2,W).trim();if(this.options.removeNSPrefix){const _e=re.indexOf(":");_e!==-1&&(re=re.substr(_e+1))}this.options.transformTagName&&(re=this.options.transformTagName(re)),Te&&(Ue=this.saveTextToParentTag(Ue,Te,de));const Ee=de.substring(de.lastIndexOf(".")+1);if(re&&this.options.unpairedTags.indexOf(re)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${re}>`);let et=0;Ee&&this.options.unpairedTags.indexOf(Ee)!==-1?(et=de.lastIndexOf(".",de.lastIndexOf(".")-1),this.tagsNodeStack.pop()):et=de.lastIndexOf("."),de=de.substring(0,et),Te=this.tagsNodeStack.pop(),Ue="",me=W}else if(q[me+1]==="?"){let W=H(q,me,!1,"?>");if(!W)throw new Error("Pi Tag is not closed.");if(Ue=this.saveTextToParentTag(Ue,Te,de),!(this.options.ignoreDeclaration&&W.tagName==="?xml"||this.options.ignorePiTags)){const re=new e(W.tagName);re.add(this.options.textNodeName,""),W.tagName!==W.tagExp&&W.attrExpPresent&&(re[":@"]=this.buildAttributesMap(W.tagExp,de,W.tagName)),this.addChild(Te,re,de)}me=W.closeIndex+1}else if(q.substr(me+1,3)==="!--"){const W=G(q,"-->",me+4,"Comment is not closed.");if(this.options.commentPropName){const re=q.substring(me+4,W-2);Ue=this.saveTextToParentTag(Ue,Te,de),Te.add(this.options.commentPropName,[{[this.options.textNodeName]:re}])}me=W}else if(q.substr(me+1,2)==="!D"){const W=t(q,me);this.docTypeEntities=W.entities,me=W.i}else if(q.substr(me+1,2)==="!["){const W=G(q,"]]>",me,"CDATA is not closed.")-2,re=q.substring(me+9,W);Ue=this.saveTextToParentTag(Ue,Te,de);let Ee=this.parseTextData(re,Te.tagname,de,!0,!1,!0,!0);Ee==null&&(Ee=""),this.options.cdataPropName?Te.add(this.options.cdataPropName,[{[this.options.textNodeName]:re}]):Te.add(this.options.textNodeName,Ee),me=W+2}else{let W=H(q,me,this.options.removeNSPrefix),re=W.tagName;const Ee=W.rawTagName;let et=W.tagExp,_e=W.attrExpPresent,Le=W.closeIndex;this.options.transformTagName&&(re=this.options.transformTagName(re)),Te&&Ue&&Te.tagname!=="!xml"&&(Ue=this.saveTextToParentTag(Ue,Te,de,!1));const Ge=Te;if(Ge&&this.options.unpairedTags.indexOf(Ge.tagname)!==-1&&(Te=this.tagsNodeStack.pop(),de=de.substring(0,de.lastIndexOf("."))),re!==se.tagname&&(de+=de?"."+re:re),this.isItStopNode(this.options.stopNodes,de,re)){let Ze="";if(et.length>0&&et.lastIndexOf("/")===et.length-1)re[re.length-1]==="/"?(re=re.substr(0,re.length-1),de=de.substr(0,de.length-1),et=re):et=et.substr(0,et.length-1),me=W.closeIndex;else if(this.options.unpairedTags.indexOf(re)!==-1)me=W.closeIndex;else{const rt=this.readStopNodeData(q,Ee,Le+1);if(!rt)throw new Error(`Unexpected end of ${Ee}`);me=rt.i,Ze=rt.tagContent}const tt=new e(re);re!==et&&_e&&(tt[":@"]=this.buildAttributesMap(et,de,re)),Ze&&(Ze=this.parseTextData(Ze,re,de,!0,_e,!0,!0)),de=de.substr(0,de.lastIndexOf(".")),tt.add(this.options.textNodeName,Ze),this.addChild(Te,tt,de)}else{if(et.length>0&&et.lastIndexOf("/")===et.length-1){re[re.length-1]==="/"?(re=re.substr(0,re.length-1),de=de.substr(0,de.length-1),et=re):et=et.substr(0,et.length-1),this.options.transformTagName&&(re=this.options.transformTagName(re));const Ze=new e(re);re!==et&&_e&&(Ze[":@"]=this.buildAttributesMap(et,de,re)),this.addChild(Te,Ze,de),de=de.substr(0,de.lastIndexOf("."))}else{const Ze=new e(re);this.tagsNodeStack.push(Te),re!==et&&_e&&(Ze[":@"]=this.buildAttributesMap(et,de,re)),this.addChild(Te,Ze,de),Te=Ze}Ue="",me=Le}}else Ue+=q[me];return se.child};function S(q,se,Te){const Ue=this.options.updateTag(se.tagname,Te,se[":@"]);Ue===!1||(typeof Ue=="string"&&(se.tagname=Ue),q.addChild(se))}const F=function(q){if(this.options.processEntities){for(let se in this.docTypeEntities){const Te=this.docTypeEntities[se];q=q.replace(Te.regx,Te.val)}for(let se in this.lastEntities){const Te=this.lastEntities[se];q=q.replace(Te.regex,Te.val)}if(this.options.htmlEntities)for(let se in this.htmlEntities){const Te=this.htmlEntities[se];q=q.replace(Te.regex,Te.val)}q=q.replace(this.ampEntity.regex,this.ampEntity.val)}return q};function N(q,se,Te,Ue){return q&&(Ue===void 0&&(Ue=Object.keys(se.child).length===0),q=this.parseTextData(q,se.tagname,Te,!1,se[":@"]?Object.keys(se[":@"]).length!==0:!1,Ue),q!==void 0&&q!==""&&se.add(this.options.textNodeName,q),q=""),q}function U(q,se,Te){const Ue="*."+Te;for(const de in q){const me=q[de];if(Ue===me||se===me)return!0}return!1}function $(q,se,Te=">"){let Ue,de="";for(let me=se;me<q.length;me++){let pe=q[me];if(Ue)pe===Ue&&(Ue="");else if(pe==='"'||pe==="'")Ue=pe;else if(pe===Te[0])if(Te[1]){if(q[me+1]===Te[1])return{data:de,index:me}}else return{data:de,index:me};else pe==="	"&&(pe=" ");de+=pe}}function G(q,se,Te,Ue){const de=q.indexOf(se,Te);if(de===-1)throw new Error(Ue);return de+se.length-1}function H(q,se,Te,Ue=">"){const de=$(q,se+1,Ue);if(!de)return;let me=de.data;const pe=de.index,W=me.search(/\s/);let re=me,Ee=!0;W!==-1&&(re=me.substring(0,W),me=me.substring(W+1).trimStart());const et=re;if(Te){const _e=re.indexOf(":");_e!==-1&&(re=re.substr(_e+1),Ee=re!==de.data.substr(_e+1))}return{tagName:re,tagExp:me,closeIndex:pe,attrExpPresent:Ee,rawTagName:et}}function J(q,se,Te){const Ue=Te;let de=1;for(;Te<q.length;Te++)if(q[Te]==="<")if(q[Te+1]==="/"){const me=G(q,">",Te,`${se} is not closed`);if(q.substring(Te+2,me).trim()===se&&(de--,de===0))return{tagContent:q.substring(Ue,Te),i:me};Te=me}else if(q[Te+1]==="?")Te=G(q,"?>",Te+1,"StopNode is not closed.");else if(q.substr(Te+1,3)==="!--")Te=G(q,"-->",Te+3,"StopNode is not closed.");else if(q.substr(Te+1,2)==="![")Te=G(q,"]]>",Te,"StopNode is not closed.")-2;else{const me=H(q,Te,">");me&&((me&&me.tagName)===se&&me.tagExp[me.tagExp.length-1]!=="/"&&de++,Te=me.closeIndex)}}function ue(q,se,Te){if(se&&typeof q=="string"){const Ue=q.trim();return Ue==="true"?!0:Ue==="false"?!1:n(q,Te)}else return r.isExist(q)?q:""}return Qb=s,Qb}var e1={},vP;function _ue(){if(vP)return e1;vP=1;function r(s,o){return e(s,o)}function e(s,o,c){let f;const A={};for(let v=0;v<s.length;v++){const w=s[v],S=t(w);let F="";if(c===void 0?F=S:F=c+"."+S,S===o.textNodeName)f===void 0?f=w[S]:f+=""+w[S];else{if(S===void 0)continue;if(w[S]){let N=e(w[S],o,F);const U=i(N,o);w[":@"]?n(N,w[":@"],F,o):Object.keys(N).length===1&&N[o.textNodeName]!==void 0&&!o.alwaysCreateTextNode?N=N[o.textNodeName]:Object.keys(N).length===0&&(o.alwaysCreateTextNode?N[o.textNodeName]="":N=""),A[S]!==void 0&&A.hasOwnProperty(S)?(Array.isArray(A[S])||(A[S]=[A[S]]),A[S].push(N)):o.isArray(S,F,U)?A[S]=[N]:A[S]=N}}}return typeof f=="string"?f.length>0&&(A[o.textNodeName]=f):f!==void 0&&(A[o.textNodeName]=f),A}function t(s){const o=Object.keys(s);for(let c=0;c<o.length;c++){const f=o[c];if(f!==":@")return f}}function n(s,o,c,f){if(o){const A=Object.keys(o),v=A.length;for(let w=0;w<v;w++){const S=A[w];
4188f.isArray(S,c+"."+S,!0,!0)?s[S]=[o[S]]:s[S]=o[S]}}}function i(s,o){const{textNodeName:c}=o,f=Object.keys(s).length;return!!(f===0||f===1&&(s[c]||typeof s[c]=="boolean"||s[c]===0))}return e1.prettify=r,e1}var t1,bP;function yue(){if(bP)return t1;bP=1;const{buildOptions:r}=due(),e=mue(),{prettify:t}=_ue(),n=I6();class i{constructor(o){this.externalEntities={},this.options=r(o)}parse(o,c){if(typeof o!="string")if(o.toString)o=o.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(c){c===!0&&(c={});const v=n.validate(o,c);if(v!==!0)throw Error(`${v.err.msg}:${v.err.line}:${v.err.col}`)}const f=new e(this.options);f.addExternalEntities(this.externalEntities);const A=f.parseXml(o);return this.options.preserveOrder||A===void 0?A:t(A,this.options)}addEntity(o,c){if(c.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(o.indexOf("&")!==-1||o.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(c==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[o]=c}}return t1=i,t1}var r1,xP;function vue(){if(xP)return r1;xP=1;const r=`
4189`;function e(c,f){let A="";return f.format&&f.indentBy.length>0&&(A=r),t(c,f,"",A)}function t(c,f,A,v){let w="",S=!1;for(let F=0;F<c.length;F++){const N=c[F],U=n(N);if(U===void 0)continue;let $="";if(A.length===0?$=U:$=`${A}.${U}`,U===f.textNodeName){let q=N[U];s($,f)||(q=f.tagValueProcessor(U,q),q=o(q,f)),S&&(w+=v),w+=q,S=!1;continue}else if(U===f.cdataPropName){S&&(w+=v),w+=`<![CDATA[${N[U][0][f.textNodeName]}]]>`,S=!1;continue}else if(U===f.commentPropName){w+=v+`<!--${N[U][0][f.textNodeName]}-->`,S=!0;continue}else if(U[0]==="?"){const q=i(N[":@"],f),se=U==="?xml"?"":v;let Te=N[U][0][f.textNodeName];Te=Te.length!==0?" "+Te:"",w+=se+`<${U}${Te}${q}?>`,S=!0;continue}let G=v;G!==""&&(G+=f.indentBy);const H=i(N[":@"],f),J=v+`<${U}${H}`,ue=t(N[U],f,$,G);f.unpairedTags.indexOf(U)!==-1?f.suppressUnpairedNode?w+=J+">":w+=J+"/>":(!ue||ue.length===0)&&f.suppressEmptyNode?w+=J+"/>":ue&&ue.endsWith(">")?w+=J+`>${ue}${v}</${U}>`:(w+=J+">",ue&&v!==""&&(ue.includes("/>")||ue.includes("</"))?w+=v+f.indentBy+ue+v:w+=ue,w+=`</${U}>`),S=!0}return w}function n(c){const f=Object.keys(c);for(let A=0;A<f.length;A++){const v=f[A];if(c.hasOwnProperty(v)&&v!==":@")return v}}function i(c,f){let A="";if(c&&!f.ignoreAttributes)for(let v in c){if(!c.hasOwnProperty(v))continue;let w=f.attributeValueProcessor(v,c[v]);w=o(w,f),w===!0&&f.suppressBooleanAttributes?A+=` ${v.substr(f.attributeNamePrefix.length)}`:A+=` ${v.substr(f.attributeNamePrefix.length)}="${w}"`}return A}function s(c,f){c=c.substr(0,c.length-f.textNodeName.length-1);let A=c.substr(c.lastIndexOf(".")+1);for(let v in f.stopNodes)if(f.stopNodes[v]===c||f.stopNodes[v]==="*."+A)return!0;return!1}function o(c,f){if(c&&c.length>0&&f.processEntities)for(let A=0;A<f.entities.length;A++){const v=f.entities[A];c=c.replace(v.regex,v.val)}return c}return r1=e,r1}var n1,wP;function bue(){if(wP)return n1;wP=1;const r=vue(),e=M6(),t={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:"  ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(c,f){return f},attributeValueProcessor:function(c,f){return f},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 n(c){this.options=Object.assign({},t,c),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=e(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=o),this.processTextOrObjNode=i,this.options.format?(this.indentate=s,this.tagEndChar=`>
4190`,this.newLine=`
4191`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}n.prototype.build=function(c){return this.options.preserveOrder?r(c,this.options):(Array.isArray(c)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(c={[this.options.arrayNodeName]:c}),this.j2x(c,0,[]).val)},n.prototype.j2x=function(c,f,A){let v="",w="";const S=A.join(".");for(let F in c)if(Object.prototype.hasOwnProperty.call(c,F))if(typeof c[F]>"u")this.isAttribute(F)&&(w+="");else if(c[F]===null)this.isAttribute(F)?w+="":F[0]==="?"?w+=this.indentate(f)+"<"+F+"?"+this.tagEndChar:w+=this.indentate(f)+"<"+F+"/"+this.tagEndChar;
4191else if(c[F]instanceof Date)w+=this.buildTextValNode(c[F],F,"",f);else if(typeof c[F]!="object"){const N=this.isAttribute(F);if(N&&!this.ignoreAttributesFn(N,S))v+=this.buildAttrPairStr(N,""+c[F]);else if(!N)if(F===this.options.textNodeName){let U=this.options.tagValueProcessor(F,""+c[F]);w+=this.replaceEntitiesValue(U)}else w+=this.buildTextValNode(c[F],F,"",f)}else if(Array.isArray(c[F])){const N=c[F].length;let U="",$="";for(let G=0;G<N;G++){const H=c[F][G];if(!(typeof H>"u"))if(H===null)F[0]==="?"?w+=this.indentate(f)+"<"+F+"?"+this.tagEndChar:w+=this.indentate(f)+"<"+F+"/"+this.tagEndChar;else if(typeof H=="object")if(this.options.oneListGroup){const J=this.j2x(H,f+1,A.concat(F));U+=J.val,this.options.attributesGroupName&&H.hasOwnProperty(this.options.attributesGroupName)&&($+=J.attrStr)}else U+=this.processTextOrObjNode(H,F,f,A);else if(this.options.oneListGroup){let J=this.options.tagValueProcessor(F,H);J=this.replaceEntitiesValue(J),U+=J}else U+=this.buildTextValNode(H,F,"",f)}this.options.oneListGroup&&(U=this.buildObjectNode(U,F,$,f)),w+=U}else if(this.options.attributesGroupName&&F===this.options.attributesGroupName){const N=Object.keys(c[F]),U=N.length;for(let $=0;$<U;$++)v+=this.buildAttrPairStr(N[$],""+c[F][N[$]])}else w+=this.processTextOrObjNode(c[F],F,f,A);return{attrStr:v,val:w}},n.prototype.buildAttrPairStr=function(c,f){return f=this.options.attributeValueProcessor(c,""+f),f=this.replaceEntitiesValue(f),this.options.suppressBooleanAttributes&&f==="true"?" "+c:" "+c+'="'+f+'"'};function i(c,f,A,v){const w=this.j2x(c,A+1,v.concat(f));return c[this.options.textNodeName]!==void 0&&Object.keys(c).length===1?this.buildTextValNode(c[this.options.textNodeName],f,w.attrStr,A):this.buildObjectNode(w.val,f,w.attrStr,A)}n.prototype.buildObjectNode=function(c,f,A,v){if(c==="")return f[0]==="?"?this.indentate(v)+"<"+f+A+"?"+this.tagEndChar:this.indentate(v)+"<"+f+A+this.closeTag(f)+this.tagEndChar;{let w="</"+f+this.tagEndChar,S="";return f[0]==="?"&&(S="?",w=""),(A||A==="")&&c.indexOf("<")===-1?this.indentate(v)+"<"+f+A+S+">"+c+w:this.options.commentPropName!==!1&&f===this.options.commentPropName&&S.length===0?this.indentate(v)+`<!--${c}-->`+this.newLine:this.indentate(v)+"<"+f+A+S+this.tagEndChar+c+this.indentate(v)+w}},n.prototype.closeTag=function(c){let f="";return this.options.unpairedTags.indexOf(c)!==-1?this.options.suppressUnpairedNode||(f="/"):this.options.suppressEmptyNode?f="/":f=`></${c}`,f},n.prototype.buildTextValNode=function(c,f,A,v){if(this.options.cdataPropName!==!1&&f===this.options.cdataPropName)return this.indentate(v)+`<![CDATA[${c}]]>`+this.newLine;if(this.options.commentPropName!==!1&&f===this.options.commentPropName)return this.indentate(v)+`<!--${c}-->`+this.newLine;if(f[0]==="?")return this.indentate(v)+"<"+f+A+"?"+this.tagEndChar;{let w=this.options.tagValueProcessor(f,c);return w=this.replaceEntitiesValue(w),w===""?this.indentate(v)+"<"+f+A+this.closeTag(f)+this.tagEndChar:this.indentate(v)+"<"+f+A+">"+w+"</"+f+this.tagEndChar}},n.prototype.replaceEntitiesValue=function(c){if(c&&c.length>0&&this.options.processEntities)for(let f=0;f<this.options.entities.length;f++){const A=this.options.entities[f];c=c.replace(A.regex,A.val)}return c};function s(c){return this.options.indentBy.repeat(c)}function o(c){return c.startsWith(this.options.attributeNamePrefix)&&c!==this.options.textNodeName?c.substr(this.attrPrefixLen):!1}return n1=n,n1}var i1,CP;function xue(){if(CP)return i1;CP=1;const r=I6(),e=yue(),t=bue();return i1={XMLParser:e,XMLValidator:r,XMLBuilder:t},i1}var wue=xue();function TP(r,e){if(e?._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);const t={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(i,s,o,c)=>!!e?.arrayPaths?.some(A=>s===A),...e?._fastXML},n=Cue(r,t);return e?.uncapitalizeKeys?ux(n):n}function Cue(r,e){return new wue.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(r)}const Tue="4.2.4",kp={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:Tue,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:Eue,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(r,e)=>TP(new TextDecoder().decode(r),{...kp.options.xml,...e?.xml}),parseTextSync:(r,e)=>TP(r,{...kp.options.xml,...e?.xml})};function Eue(r){return r.startsWith("<?xml")}async function Bh(r,e,t,n){return n._parse(r,e,t,n)}function Ai(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const P6=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),EP=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);EP&&parseFloat(EP[1]);function Bue(r,e){return R6(r||{},e)}function R6(r,e,t=0){if(t>3)return e;const n={...r};for(const[i,s]of Object.entries(e))s&&typeof s=="object"&&!Array.isArray(s)?n[i]=R6(n[i]||{},e[i],t+1):n[i]=e[i];return n}function Sue(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function Iue(r){return globalThis.loaders?.modules?.[r]||null}
vendor: 4,735 bytes, line 4191
4191function Mue(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.4"),globalThis._loadersgl_.version}const Pue=Mue();function Rue(r,e){if(!r)throw new Error("loaders.gl assertion failed.")}const Xg=typeof process!="object"||String(process)!=="[object process]"||process.browser,yC=typeof importScripts=="function",BP=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);BP&&parseFloat(BP[1]);const s1={};async function ch(r,e=null,t={},n=null){return e&&(r=Fue(r,e,t,n)),s1[r]=s1[r]||Due(r),await s1[r]}function Fue(r,e,t={},n=null){if(!t.useLocalLibraries&&r.startsWith("http"))return r;n=n||r;const i=t.modules||{};return i[n]?i[n]:Xg?t.CDN?(Rue(t.CDN.startsWith("http")),`${t.CDN}/${e}@${Pue}/dist/libs/${n}`):yC?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function Due(r){if(r.endsWith("wasm"))return await Lue(r);if(!Xg)try{const{requireFromFile:t}=globalThis.loaders||{};return await t?.(r)}catch(t){return console.error(t),null}if(yC)return importScripts(r);const e=await kue(r);return Oue(e,r)}function Oue(r,e){if(!Xg){const{requireFromString:n}=globalThis.loaders||{};return n?.(r,e)}if(yC)return eval.call(globalThis,r),null;const t=document.createElement("script");t.id=e;try{t.appendChild(document.createTextNode(r))}catch{t.text=r}return document.body.appendChild(t),null}async function Lue(r){const{readFileAsArrayBuffer:e}=globalThis.loaders||{};return Xg||!e||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await e(r)}async function kue(r){const{readFileAsText:e}=globalThis.loaders||{};return Xg||!e||r.startsWith("http")?await(await fetch(r)).text():await e(r)}function Nue(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?SP(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?SP(r,0,e):""}function SP(r,e,t){if(r.byteLength<=e+t)return"";const n=new DataView(r);let i="";for(let s=0;s<t;s++)i+=String.fromCharCode(n.getUint8(e+s));return i}function F6(r){try{return JSON.parse(r)}catch{throw new Error(`Failed to parse JSON from data starting with "${Nue(r)}"`)}}function Kg(r,e,t){const n=t!==void 0?new Uint8Array(r).subarray(e,e+t):new Uint8Array(r).subarray(e);return new Uint8Array(n).buffer}function su(r,e){return Ai(r>=0),Ai(e>0),r+(e-1)&-4}function D6(r,e,t){let n;if(r instanceof ArrayBuffer)n=new Uint8Array(r);else{const i=r.byteOffset,s=r.byteLength;n=new Uint8Array(r.buffer||r.arrayBuffer,i,s)}return e.set(n,t),t+su(n.byteLength,4)}const Uue="Queued Requests",zue="Active Requests",Gue="Cancelled Requests",Vue="Queued Requests Ever",Hue="Active Requests Ever",jue={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class O6{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...jue,...e},this.stats=new YL({id:this.props.id}),this.stats.get(Uue),this.stats.get(zue),this.stats.get(Gue),this.stats.get(Vue),this.stats.get(Hue)}scheduleRequest(e,t=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);const n={handle:e,priority:0,getPriority:t},i=new Promise(s=>(n.resolve=s,n));return this.requestQueue.push(n),this.requestMap.set(e,i),this._issueNewRequests(),i}_issueRequest(e){const{handle:t,resolve:n}=e;let i=!1;const s=()=>{i||(i=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:s}):Promise.resolve({done:s})}_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;const e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let t=0;t<e;++t){const n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){const e=this.requestQueue;for(let t=0;t<e.length;++t){const n=e[t];this._updateRequest(n)||(e.splice(t,1),this.requestMap.delete(n.handle),t--)}e.sort((t,n)=>t.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}}function $ue(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();const r=window.location?.pathname;return r?.slice(0,r.lastIndexOf("/")+1)||""}function L6(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(0,e):""}function Wue(...r){const e=[];for(let s=0;s<r.length;s++)e[s]=r[s];let t="",n=!1,i;for(let s=e.length-1;s>=-1&&!n;s--){let o;s>=0?o=e[s]:(i===void 0&&(i=$ue()),o=i),o.length!==0&&(t=`${o}/${t}
4191`,n=o.charCodeAt(0)===qA)}return t=Jue(t,!n),n?`/${t}`:t.length>0?t:"."}const qA=47,o1=46;function Jue(r,e){let t="",n=-1,i=0,s,o=!1;for(let c=0;c<=r.length;++c){if(c<r.length)s=r.charCodeAt(c);else{if(s===qA)break;s=qA}if(s===qA){if(!(n===c-1||i===1))if(n!==c-1&&i===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==o1||t.charCodeAt(t.length-2)!==o1){if(t.length>2){const f=t.length-1;let A=f;for(;A>=0&&t.charCodeAt(A)!==qA;--A);if(A!==f){t=A===-1?"":t.slice(0,A),n=c,i=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",n=c,i=0,o=!1;continue}}e&&(t.length>0?t+="/..":t="..",o=!0)}else{const f=r.slice(n+1,c);t.length>0?t+=`/${f}`:t=f,o=!1}n=c,i=0}else s===o1&&i!==-1?++i:i=-1}return t}class Xue{fetch;loadOptions;_needsRefresh=!0;props;constructor(e){this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Kue(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){const t=this._needsRefresh;return e&&(this._needsRefresh=!1),t}}function Kue(r){const e=r?.fetch;if(e&&typeof e=="function")return(n,i)=>e(n,i);const t=r?.fetch;return t&&typeof t!="function"?n=>fetch(n,t):n=>fetch(n)}class vC extends Xue{static type="template";static testURL=e=>!1}function que(r,e){const t=kp.parseTextSync?.(r,e),n=t?.ServiceExceptionReport?.ServiceException||t?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}const Yue="4.2.4",Z0={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:Yue,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:Zue,options:{wms:{throwOnError:!1}},parse:async(r,e)=>a1(new TextDecoder().decode(r),e),parseSync:(r,e)=>a1(new TextDecoder().decode(r),e),parseTextSync:(r,e)=>a1(r,e)};function Zue(r){return r.startsWith("<?xml")}function a1(r,e){const t={...Z0.options.wms,...e?.wms},n=que(r,t),i=t.minimalErrors?n:`WMS Service error: ${n}`;if(t.throwOnError)throw new Error(i);return i}function Np(r){return Array.isArray(r)?r:r?[r]:[]}function My(r){const e=Np(r);return e.length>0&&e.every(t=>typeof t=="string")?e:[]}function f0(r,e=void 0){switch(typeof r){case"number":return r;case"string":return parseFloat(r);default:return}}function c1(r,e=void 0){switch(typeof r){case"number":return r;case"string":return parseInt(r,10);default:return}}function Tp(r){switch(r){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function IP(r,e){const t=kp.parseTextSync?.(r,e),n=t.WMT_MS_Capabilities||t.WMS_Capabilities||t,i=Que(n);if(e?.inheritedLayerProps)for(const s of i.layers)N6(s,null);return e?.includeRawJSON&&(i.json=n),e?.includeXMLText&&(i.xml=r),i}function Que(r){const e={version:String(r.version||""),name:String(r.Service?.Name||"unnamed"),title:r.Service?.Title?String(r.Service?.Title):void 0,abstract:r.Service?.Abstract?String(r.Service?.Abstract):void 0,keywords:My(r.Service?.KeywordList?.Keyword),fees:r.Service?.Fees?JSON.stringify(r.Service?.Fees):void 0,accessConstraints:r.Service?.AccessConstraints?JSON.stringify(r.Service?.AccessConstraints):void 0,layerLimit:c1(r.Service?.LayerLimit),maxWidth:c1(r.Service?.maxWidth),maxHeight:c1(r.Service?.maxHeight),layers:[],requests:efe(r.Capability?.Request),exceptions:tfe(r.Exception)},t=Np(r.Capability?.Layer);for(const n of t)e.layers.push(k6(n));for(const[n,i]of Object.entries(e))i===void 0&&delete e[n];return e}function efe(r){const e={};for(const[t,n]of Object.entries(r||{})){const i=My(n?.Format);e[t]={mimeTypes:i}}return e}function tfe(r){if(Np(r?.Format).length>0)return{mimeTypes:My(r)}}function k6(r){const e={title:String(r?.Title||""),name:r?.Name&&String(r?.Name),abstract:r?.Name&&String(r?.Abstract),keywords:My(r.KeywordList?.Keyword)},t=r?.CRS||r?.SRS;t&&Array.isArray(t)&&t.every(A=>typeof A=="string")&&(e.crs=t);let n=r?.EX_GeographicBoundingBox&&rfe(r?.EX_GeographicBoundingBox);n&&(e.geographicBoundingBox=n),n=r?.LatLonBoundingBox&&nfe(r?.LatLonBoundingBox),n&&(e.geographicBoundingBox=n);const i=r?.BoundingBox&&ife(r?.BoundingBox);i&&i.length>0&&(e.boundingBoxes=i);const o=Np(r?.Dimension).map(A=>ofe(A));o.length&&(e.dimensions=o),r?.opaque&&(e.opaque=Tp(r?.opaque)),r?.cascaded&&(e.cascaded=Tp(r?.cascaded)),r?.query
4191able&&(e.queryable=Tp(r?.queryable));const c=Np(r?.Layer),f=[];for(const A of c)f.push(k6(A));f.length>0&&(e.layers=f);for(const[A,v]of Object.entries(e))v===void 0&&delete e[A];return e}function rfe(r){const{westBoundLongitude:e,northBoundLatitude:t,eastBoundLongitude:n,southBoundLatitude:i}=r;return[[e,i],[n,t]]}function nfe(r){const{minx:e,miny:t,maxx:n,maxy:i}=r;return[[e,t],[n,i]]}function ife(r){return Np(r).map(t=>sfe(t))}function sfe(r){const{CRS:e,SRS:t,minx:n,miny:i,maxx:s,maxy:o,resx:c,resy:f}=r,A={crs:e||t,boundingBox:[[f0(n),f0(i)],[f0(s),f0(o)]]};return c&&(A.xResolution=c),f&&(A.yResolution=f),A}function ofe(r){const{name:e,units:t,value:n}=r,i={name:e,units:t,extent:n};return r.unitSymbol&&(i.unitSymbol=r.unitSymbol),r.default&&(i.defaultValue=r.default),r.multipleValues&&(i.multipleValues=Tp(r.multipleValues)),r.nearestValue&&(i.nearestValue=Tp(r.nearestValue)),r.current&&(i.current=Tp(r.current)),i}function N6(r,e){e?.geographicBoundingBox&&!r.geographicBoundingBox&&(r.geographicBoundingBox=[...e.geographicBoundingBox]),e?.crs&&!r.crs&&(r.crs=[...e.crs]),e?.boundingBoxes&&!r.boundingBoxes&&(r.boundingBoxes=[...e.boundingBoxes]),e?.dimensions&&!r.dimensions&&(r.dimensions=[...e.dimensions]);for(const t of r.layers||[])N6(t,r)}const afe="4.2.4",bC={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:afe,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:cfe,options:{wms:{}},parse:async(r,e)=>IP(new TextDecoder().decode(r),e?.wms),parseTextSync:(r,e)=>IP(r,e?.wms)};function cfe(r){return r.startsWith("<?xml")}function MP(r,e){const n=(kp.parseTextSync?.(r,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(s=>lfe(s))}}function lfe(r){return{attributes:r||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}const ufe={...bC,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(r,e)=>MP(new TextDecoder().decode(r),e),parseTextSync:(r,e)=>MP(r,e)};function PP(r,e){return kp.parseTextSync?.(r,e)}const ffe={...bC,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(r,e)=>PP(new TextDecoder().decode(r),e),parseTextSync:(r,e)=>PP(r,e)};function hfe(r,e){const{type:t="auto"}=r,n=t==="auto"?pfe(r.url,e):dfe(t,e);if(!n)throw new Error("Not a valid image source type");return n.create(r)}function dfe(r,e){for(const t of e)if(t.type===r)return t;return null}function pfe(r,e){for(const t of e)if(t.testURL&&t.testURL(r))return t;return null}const Afe="4.2.4",gfe=globalThis.loaders?.parseImageNode,fx=typeof Image<"u",hx=typeof ImageBitmap<"u",mfe=!!gfe,dx=P6?!0:mfe;function _fe(r){switch(r){case"auto":return hx||fx||dx;case"imagebitmap":return hx;case"image":return fx;case"data":return dx;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function yfe(){if(hx)return"imagebitmap";if(fx)return"image";if(dx)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function vfe(r){const e=bfe(r);if(!e)throw new Error("Not an image");return e}function xC(r){switch(vfe(r)){case"data":return r;case"image":case"imagebitmap":const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)throw new Error("getImageData");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height);default:throw new Error("getImageData")}}function bfe(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&r instanceof Image?"image":r&&typeof r=="object"&&r.data&&r.width&&r.height?"data":null}const xfe=/^data:image\/svg\+xml/,wfe=/\.svg((\?|#).*)?$/;function wC(r){return r&&(xfe.test(r)||wfe.test(r))}function Cfe(r,e){if(wC(e)){let n=new TextDecoder().decode(r);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(s){throw new Error(s.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return U6(r,e)}function U6(r,e){if(wC(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}
4191async function z6(r,e,t){const n=Cfe(r,t),i=self.URL||self.webkitURL,s=typeof n!="string"&&i.createObjectURL(n);try{return await Tfe(s||n,e)}finally{s&&i.revokeObjectURL(s)}}async function Tfe(r,e){const t=new Image;return t.src=r,e.image&&e.image.decode&&t.decode?(await t.decode(),t):await new Promise((n,i)=>{try{t.onload=()=>n(t),t.onerror=s=>{const o=s instanceof Error?s.message:"error";i(new Error(o))}}catch(s){i(s)}})}const Efe={};let RP=!0;async function Bfe(r,e,t){let n;wC(t)?n=await z6(r,e,t):n=U6(r,t);const i=e&&e.imagebitmap;return await Sfe(n,i)}async function Sfe(r,e=null){if((Ife(e)||!RP)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),RP=!1}return await createImageBitmap(r)}function Ife(r){for(const e in r||Efe)return!1;return!0}function Mfe(r){return!Dfe(r,"ftyp",4)||(r[8]&96)===0?null:Pfe(r)}function Pfe(r){switch(Rfe(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Rfe(r,e,t){return String.fromCharCode(...r.slice(e,t))}function Ffe(r){return[...r].map(e=>e.charCodeAt(0))}function Dfe(r,e,t=0){const n=Ffe(e);for(let i=0;i<n.length;++i)if(n[i]!==r[i+t])return!1;return!0}const ol=!1,pg=!0;function Py(r){const e=qg(r);return Lfe(e)||Ufe(e)||kfe(e)||Nfe(e)||Ofe(e)}function Ofe(r){const e=new Uint8Array(r instanceof DataView?r.buffer:r),t=Mfe(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function Lfe(r){const e=qg(r);return e.byteLength>=24&&e.getUint32(0,ol)===2303741511?{mimeType:"image/png",width:e.getUint32(16,ol),height:e.getUint32(20,ol)}:null}function kfe(r){const e=qg(r);return e.byteLength>=10&&e.getUint32(0,ol)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,pg),height:e.getUint16(8,pg)}:null}function Nfe(r){const e=qg(r);return e.byteLength>=14&&e.getUint16(0,ol)===16973&&e.getUint32(2,pg)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,pg),height:e.getUint32(22,pg)}:null}function Ufe(r){const e=qg(r);if(!(e.byteLength>=3&&e.getUint16(0,ol)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:n,sofMarkers:i}=zfe();let s=2;for(;s+9<e.byteLength;){const o=e.getUint16(s,ol);if(i.has(o))return{mimeType:"image/jpeg",height:e.getUint16(s+5,ol),width:e.getUint16(s+7,ol)};if(!n.has(o))return null;s+=2,s+=e.getUint16(s,ol)}return null}function zfe(){const r=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)r.add(t);return{tableMarkers:r,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function qg(r){if(r instanceof DataView)return r;if(ArrayBuffer.isView(r))return new DataView(r.buffer);if(r instanceof ArrayBuffer)return new DataView(r);throw new Error("toDataView")}async function Gfe(r,e){const{mimeType:t}=Py(r)||{},n=globalThis.loaders?.parseImageNode;return Ai(n),await n(r,t)}async function Vfe(r,e,t){e=e||{};const i=(e.image||{}).type||"auto",{url:s}=t||{},o=Hfe(i);let c;switch(o){case"imagebitmap":c=await Bfe(r,e,s);break;case"image":c=await z6(r,e,s);break;case"data":c=await Gfe(r);break;default:Ai(!1)}return i==="data"&&(c=xC(c)),c}function Hfe(r){switch(r){case"auto":case"data":return yfe();default:return _fe(r),r}}const jfe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],$fe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Wfe={image:{type:"auto",decode:!0}},Pg={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Afe,mimeTypes:$fe,extensions:jfe,parse:Vfe,tests:[r=>!!Py(new DataView(r))],options:Wfe},l1={};function G6(r){if(l1[r]===void 0){const e=P6?Xfe(r):Jfe(r);l1[r]=e}return l1[r]}function Jfe(r){const e=["image/png","image/jpeg","image/gif"],t=globalThis.loaders?.imageFormatsNode||e;return!!globalThis.loaders?.parseImageNode&&t.includes(r)}function Xfe(r){switch(r){case"image/avif":case"image/webp":return Kfe(r);default:return!0}}function Kfe(r){try{return document.createElement("canvas").toDataURL(r).indexOf(`data:${r}`)===0}catch{return!1}}const qfe={type:"wms",testURL:r=>r.toLowerCase().includes("wms"),create:r=>new Yfe(r)};class Yfe extends vC{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(){const e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){const{boundingBox:t,bbox:n,...i}=e,s={bbox:t?[...t[0],...t[1]]:n,...i};return await this.getMap(s)}normalizeMetadata(e){return e}async getCapabilities(e,t){const n=this.getCapabilitiesURL(e,t),i=await this.fetch(n),s=await i.arrayBuffer();this._checkResponse(i,s);const o=await bC.parse(s,this.loadOptions);return this.capabilities=o,o}async getMap(e,t){const n=this.getMapURL(e,t),i=await this.fetch(n),s=await i.arrayBuffer();this._checkResponse(i,s);try{return await Pg.parse(s,this.loadOptions)}catch{throw this._parseError(s)}}async getFeatureInfo(e,t){const n=this.getFeatureInfoURL(e,t),i=await this.fetch(n),s=await i.arrayBuffer();return this._checkResponse(i,s),await ufe.parse(s,this.loadOptions)}async getFeatureInfoText(e,t){const n=this.getFeatureInfoURL(e,t),i=await this.fetch(n),s=await i.arrayBuffer();return this._checkResponse(i,s),new TextDecoder().decode(s)}async describeLayer(e,t){const n=this.describeLayerURL(e,t),i=await this.fetch(n),s=await i.arrayBuffer();return this._checkResponse(i,s),await ffe.parse(s,this.loadOptions)}async getLegendGraphic(e,t){const n=this.getLegendGraphicURL(e,t),i=await this.fetch(n),s=await i.arrayBuffer();this._checkResponse(i,s);try{return await Pg.parse(s,this.loadOptions)}catch{throw this._parseError(s)}}getCapabilitiesURL(e,t){const n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",n,t)}getMapURL(e,t){e=this._getWMS130Parameters(e);const n={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",n,t)}getFeatureInfoURL(e,t){e=this._getWMS130Parameters(e);const{boundingBox:n,bbox:i}=e;e.bbox=n?[...n[0],...n[1]]:i;const s={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",s,t)}describeLayerURL(e,t){const n={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",n,t)}getLegendGraphicURL(e,t){const n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",n,t)}_parseWMSUrl(e){const[t,n]=e.split("?"),i=n.split("&"),s={};for(const o of i){const[c,f]=o.split("=");s[c]=f}return{url:t,parameters:s}}_getWMSUrl(e,t,n){let i=this.url,s=!0;const o={service:"WMS",version:t.version,request:e,...t,...this.vendorParameters,...n},c=["transparent","time","elevation"];for(const[f,A]of Object.entries(o))(!c.includes(f)||A)&&(i+=s?"?":"&",s=!1,i+=this._getURLParameter(f,A,t));return encodeURI(i)}_getWMS130Parameters(e){const t={...e};return t.srs&&(t.crs=t.crs||t.srs,delete t.srs),t}_getURLParameter(e,t,n){switch(e){case"crs":n.version!=="1.3.0"?e="srs":this.substituteCRS84&&t==="EPSG:4326"&&(t="CRS:84");break;case"srs":n.version==="1.3.0"&&(e="crs");break;case"bbox":const i=this._flipBoundingBox(t,n);i&&(t=i);break;case"x":n.version==="1.3.0"&&(e="i");break;case"y":n.version==="1.3.0"&&(e="j");break}return e=e.toUpperCase(),Array.isArray(t)?`${e}=${t.join(",")}`:`${e}
4191=${t?String(t):""}`}_flipBoundingBox(e,t){if(!Array.isArray(e)||e.length!==4)return null;const n=t.version==="1.3.0"&&this.flipCRS.includes(t.crs||"")&&!(this.substituteCRS84&&t.crs==="EPSG:4326"),i=e;return n?[i[1],i[0],i[3],i[2]]:i}async _fetchArrayBuffer(e){const t=await this.fetch(e),n=await t.arrayBuffer();return this._checkResponse(t,n),n}_checkResponse(e,t){const n=e.headers["content-type"];if(!e.ok||Z0.mimeTypes.includes(n)){const i=Bue(this.loadOptions,{wms:{throwOnError:!0}}),s=Z0.parseSync?.(t,i);throw new Error(s)}}_parseError(e){const t=Z0.parseSync?.(e,this.loadOptions);return new Error(t)}}class Zfe extends vC{static type="template";static testURL=e=>e.toLowerCase().includes("{");constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){const t=this.getGranularParameters(e),n=this.getURLFromTemplate(t),s=await(await this.fetch(n)).arrayBuffer();return await Pg.parse(s)}getGranularParameters(e){const[[t,n],[i,s]]=e.boundingBox;return{...e,east:t,north:n,south:s,west:i}}getURLFromTemplate(e){let t=this.props.url;for(const[n,i]of Object.entries(e))t=t.replace(`\${${n}}`,String(i)),t=t.replace(`{${n}}`,String(i));return t}}class Qfe extends Zfe{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){const t=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,n=`size=${e.width},${e.height}`,i={...e,bbox:t,size:n};return delete i.width,delete i.height,this.getUrl("exportImage",i)}getUrl(e,t,n){let i=`${this.props.url}/${e}`,s=!0;for(const[o,c]of Object.entries(t))i+=s?"?":"&",s=!1,Array.isArray(c)?i+=`${o.toUpperCase()}=${c.join(",")}`:i+=`${o.toUpperCase()}=${c?String(c):""}`;return i}async checkResponse(e){if(!e.ok)throw new Error("error")}}const ehe={type:"arcgis-image-server",testURL:r=>r.toLowerCase().includes("ImageServer"),create:r=>new Qfe(r)},the=[qfe,ehe];function rhe(r){return hfe(r,the)}const FP=6378137*Math.PI;function DP(r){const e=eu(r);return e[0]=(e[0]/256-1)*FP,e[1]=(e[1]/256-1)*FP,e}const nhe={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:(r,e)=>console.error(e,r)}};class CC extends Bs{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:t,oldProps:n}){const{viewport:i}=this.context;e.dataChanged||t.serviceType!==n.serviceType?(this.state.imageSource=this._createImageSource(t),this._loadMetadata(),this.debounce(()=>this.loadImage(i,"image source changed"),0)):rs(t.layers,n.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(i,"viewport changed")):this.debounce(()=>this.loadImage(i,"layers changed"),0)}finalizeState(){}renderLayers(){const{bounds:e,image:t,lastRequestParameters:n}=this.state;return t&&new By({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?Qr.LNGLAT:Qr.CARTESIAN,bounds:e,image:t})}async getFeatureInfoText(e,t){const{lastRequestParameters:n}=this.state;return n?await this.state.imageSource.getFeatureInfoText?.({...n,query_layers:n.layers,x:e,y:t,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof vC)return e.data;if(typeof e.data=="string")return rhe({url:e.data,loadOptions:e.loadOptions,type:e.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){const{imageSource:e}=this.state;try{this.state.loadCounter++;const t=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(t)}catch(t){this.getCurrentLayer()?.props.onMetadataLoadError(t)}finally{this.state.loadCounter--}}async loadImage(e,t){const{layers:n,serviceType:i}=this.props;if(i==="wms"&&n.length===0)return;const s=e.getBounds(),{width:o,height:c}=e,f=this.getRequestId();let{srs:A}=this.props;A==="auto"&&(A=e.resolution?"EPSG:4326":"EPSG:3857");const v={width:o,height:c,boundingBox:[[s[0],s[1]],[s[2],s[3]]],layers:n,crs:A};if(A==="EPSG:3857"){const w=DP([s[0],s[1]]),S=DP([s[2],s[3]]);
vendor: 22,668 bytes, line 4191
4191v.boundingBox=[w,S]}try{this.state.loadCounter++,this.props.onImageLoadStart(f);const w=await this.state.imageSource.getImage(v);this.state.lastRequestId<f&&(this.getCurrentLayer()?.props.onImageLoad(f),this.setState({image:w,bounds:s,lastRequestParameters:v,lastRequestId:f}))}catch(w){this.raiseError(w,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(f,w)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,t=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),t)}}CC.layerName="WMSLayer";CC.defaultProps=nhe;const ihe={getHeight:{type:"accessor",value:0},greatCircle:!0};class TC extends jg{}TC.layerName="GreatCircleLayer";TC.defaultProps=ihe;const she={...hf.defaultProps};class df extends Bs{indexToBounds(){return null}renderLayers(){const{elevationScale:e,extruded:t,wireframe:n,filled:i,stroked:s,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:f,lineWidthMaxPixels:A,lineJointRounded:v,lineMiterLimit:w,lineDashJustified:S,getElevation:F,getFillColor:N,getLineColor:U,getLineWidth:$}=this.props,{updateTriggers:G,material:H,transitions:J}=this.props,ue=this.getSubLayerClass("cell",hf),{updateTriggers:q,...se}=this.indexToBounds()||{};return new ue({filled:i,wireframe:n,extruded:t,elevationScale:e,stroked:s,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:f,lineWidthMaxPixels:A,lineJointRounded:v,lineMiterLimit:w,lineDashJustified:S,material:H,transitions:J,getElevation:F,getFillColor:N,getLineColor:U,getLineWidth:$},this.getSubLayerProps({id:"cell",updateTriggers:G&&{...q,getElevation:G.getElevation,getFillColor:G.getFillColor,getLineColor:G.getLineColor,getLineWidth:G.getLineWidth}}),se)}}df.layerName="GeoCellLayer";df.defaultProps=she;function ohe(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Q0={exports:{}},ahe=Q0.exports,OP;function che(){return OP||(OP=1,function(r){(function(e,t){typeof ohe=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(ahe,function(){function e(me,pe,W){this.low=me|0,this.high=pe|0,this.unsigned=!!W}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(me){return(me&&me.__isLong__)===!0}e.isLong=t;var n={},i={};function s(me,pe){var W,re,Ee;return pe?(me>>>=0,(Ee=0<=me&&me<256)&&(re=i[me],re)?re:(W=c(me,(me|0)<0?-1:0,!0),Ee&&(i[me]=W),W)):(me|=0,(Ee=-128<=me&&me<128)&&(re=n[me],re)?re:(W=c(me,me<0?-1:0,!1),Ee&&(n[me]=W),W))}e.fromInt=s;function o(me,pe){if(isNaN(me)||!isFinite(me))return pe?H:G;if(pe){if(me<0)return H;if(me>=N)return Te}else{if(me<=-U)return Ue;if(me+1>=U)return se}return me<0?o(-me,pe).neg():c(me%F|0,me/F|0,pe)}e.fromNumber=o;function c(me,pe,W){return new e(me,pe,W)}e.fromBits=c;var f=Math.pow;function A(me,pe,W){if(me.length===0)throw Error("empty string");if(me==="NaN"||me==="Infinity"||me==="+Infinity"||me==="-Infinity")return G;if(typeof pe=="number"?(W=pe,pe=!1):pe=!!pe,W=W||10,W<2||36<W)throw RangeError("radix");var re;if((re=me.indexOf("-"))>0)throw Error("interior hyphen");if(re===0)return A(me.substring(1),pe,W).neg();for(var Ee=o(f(W,8)),et=G,_e=0;_e<me.length;_e+=8){var Le=Math.min(8,me.length-_e),Ge=parseInt(me.substring(_e,_e+Le),W);if(Le<8){var Ze=o(f(W,Le));et=et.mul(Ze).add(o(Ge))}else et=et.mul(Ee),et=et.add(o(Ge))}return et.unsigned=pe,et}e.fromString=A;function v(me){return me instanceof e?me:typeof me=="number"?o(me):typeof me=="string"?A(me):c(me.low,me.high,me.unsigned)}e.fromValue=v;var w=65536,S=1<<24,F=w*w,N=F*F,U=N/2,$=s(S),G=s(0);e.ZERO=G;var H=s(0,!0);e.UZERO=H;var J=s(1);e.ONE=J;var ue=s(1,!0);e.UONE=ue;var q=s(-1);e.NEG_ONE=q;var se=c(-1,2147483647,!1);e.MAX_VALUE=se;var Te=c(-1,-1,!0);e.MAX_UNSIGNED_VALUE=Te;var Ue=c(0,-2147483648,!1);e.MIN_VALUE=Ue;var de=e.prototype;return de.toInt=function(){return this.unsigned?this.low>>>0:this.low},de.toNumber=function(){return this.unsigned?(this.high>>>0)*F+(this.low>>>0):this.high*F+(this.low>>>0)},de.toString=function(pe){if(pe=pe||10,pe<2||36<pe)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Ue)){var W=o(pe),re=this.div(W),Ee=re.mul(W).sub(this);return re.toString(pe)+Ee.toInt().toString(pe)}else return"-"+this.neg().toString(pe);for(var et=o(f(pe,6),this.unsigned),_e=this,Le="";;){var Ge=_e.div(et),Ze=_e.sub(Ge.mul(et)).toInt()>>>0,tt=Ze.toString(pe);if(_e=Ge,_e.isZero())return tt+Le;for(;tt.length<6;)tt="0"+tt;Le=""+tt+Le}},de.getHighBits=function(){return this.high},de.getHighBitsUnsigned=function(){return this.high>>>0},de.getLowBits=function(){return this.low},de.getLowBitsUnsigned=function(){return this.low>>>0},de.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ue)?64:this.neg().getNumBitsAbs();for(var pe=this.high!=0?this.high:this.low,W=31;W>0&&(pe&1<<W)==0;W--);return this.high!=0?W+33:W+1},de.isZero=function(){return this.high===0&&this.low===0},de.isNegative=function(){return!this.unsigned&&this.high<0},de.isPositive=function(){return this.unsigned||this.high>=0},de.isOdd=function(){return(this.low&1)===1},de.isEven=function(){return(this.low&1)===0},de.equals=function(pe){return t(pe)||(pe=v(pe)),this.unsigned!==pe.unsigned&&this.high>>>31===1&&pe.high>>>31===1?!1:this.high===pe.high&&this.low===pe.low},de.eq=de.equals,de.notEquals=function(pe){return!this.eq(pe)},de.neq=de.notEquals,de.lessThan=function(pe){return this.comp(pe)<0},de.lt=de.lessThan,de.lessThanOrEqual=function(pe){return this.comp(pe)<=0},de.lte=de.lessThanOrEqual,de.greaterThan=function(pe){return this.comp(pe)>0},de.gt=de.greaterThan,de.greaterThanOrEqual=function(pe){return this.comp(pe)>=0},de.gte=de.greaterThanOrEqual,de.compare=function(pe){if(t(pe)||(pe=v(pe)),this.eq(pe))return 0;var W=this.isNegative(),re=pe.isNegative();return W&&!re?-1:!W&&re?1:this.unsigned?pe.high>>>0>this.high>>>0||pe.high===this.high&&pe.low>>>0>this.low>>>0?-1:1:this.sub(pe).isNegative()?-1:1},de.comp=de.compare,de.negate=function(){return!this.unsigned&&this.eq(Ue)?Ue:this.not().add(J)},de.neg=de.negate,de.add=function(pe){t(pe)||(pe=v(pe));var W=this.high>>>16,re=this.high&65535,Ee=this.low>>>16,et=this.low&65535,_e=pe.high>>>16,Le=pe.high&65535,Ge=pe.low>>>16,Ze=pe.low&65535,tt=0,rt=0,ut=0,vt=0;return vt+=et+Ze,ut+=vt>>>16,vt&=65535,ut+=Ee+Ge,rt+=ut>>>16,ut&=65535,rt+=re+Le,tt+=rt>>>16,rt&=65535,tt+=W+_e,tt&=65535,c(ut<<16|vt,tt<<16|rt,this.unsigned)},de.subtract=function(pe){return t(pe)||(pe=v(pe)),this.add(pe.neg())},de.sub=de.subtract,de.multiply=function(pe){if(this.isZero()||(t(pe)||(pe=v(pe)),pe.isZero()))return G;if(this.eq(Ue))return pe.isOdd()?Ue:G;if(pe.eq(Ue))return this.isOdd()?Ue:G;if(this.isNegative())return pe.isNegative()?this.neg().mul(pe.neg()):this.neg().mul(pe).neg();if(pe.isNegative())return this.mul(pe.neg()).neg();if(this.lt($)&&pe.lt($))return o(this.toNumber()*pe.toNumber(),this.unsigned);var W=this.high>>>16,re=this.high&65535,Ee=this.low>>>16,et=this.low&65535,_e=pe.high>>>16,Le=pe.high&65535,Ge=pe.low>>>16,Ze=pe.low&65535,tt=0,rt=0,ut=0,vt=0;return vt+=et*Ze,ut+=vt>>>16,vt&=65535,ut+=Ee*Ze,rt+=ut>>>16,ut&=65535,ut+=et*Ge,rt+=ut>>>16,ut&=65535,rt+=re*Ze,tt+=rt>>>16,rt&=65535,rt+=Ee*Ge,tt+=rt>>>16,rt&=65535,rt+=et*Le,tt+=rt>>>16,rt&=65535,tt+=W*Ze+re*Ge+Ee*Le+et*_e,tt&=65535,c(ut<<16|vt,tt<<16|rt,this.unsigned)},de.mul=de.multiply,de.divide=function(pe){if(t(pe)||(pe=v(pe)),pe.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?H:G;var W,re,Ee;if(this.unsigned){if(pe.unsigned||(pe=pe.toUnsigned()),pe.gt(this))return H;if(pe.gt(this.shru(1)))return ue;Ee=H}else{if(this.eq(Ue)){if(pe.eq(J)||pe.eq(q))return Ue;if(pe.eq(Ue))return J;var et=this.shr(1);return W=et.div(pe).shl(1),W.eq(G)?pe.isNegative()?J:q:(re=this.sub(pe.mul(W)),Ee=W.add(re.div(pe)),Ee)}else if(pe.eq(Ue))return this.unsigned?H:G;if(this.isNegative())return pe.isNegative()?this.neg().div(pe.neg()):this.neg().div(pe).neg();if(pe.isNegative())return this.div(pe.neg()).neg();Ee=G}for(re=this;re.gte(pe);){W=Math.max(1,Math.floor(re.toNumber()/pe.toNumber()));for(var _e=Math.ceil(Math.log(W)/Math.LN2),Le=_e<=48?1:f(2,_e-48),Ge=o(W),Ze=Ge.mul(pe);Ze.isNegative()||Ze.gt(re);)W-=Le,Ge=o(W,this.unsigned),Ze=Ge.mul(pe);Ge.isZero()&&(Ge=J),Ee=Ee.add(Ge),re=re.sub(Ze)}return Ee},de.div=de.divide,de.modulo=function(pe){return t(pe)||(pe=v(pe)),this.sub(this.div(pe).mul(pe))},de.mod=de.modulo,de.not=function(){return c(~this.low,~this.high,this.unsigned)},de.and=function(pe){return t(pe)||(pe=v(pe)),c(this.low&pe.low,this.high&pe.high,this.unsigned)},de.or=function(pe){return t(pe)||(pe=v(pe)),c(this.low|pe.low,this.high|pe.high,this.unsigned)},de.xor=function(pe){return t(pe)||(pe=v(pe)),c(this.low^pe.low,this.high^pe.high,this.unsigned)},de.shiftLeft=function(pe){return t(pe)&&(pe=pe.toInt()),(pe&=63)===0?this:pe<32?c(this.low<<pe,this.high<<pe|this.low>>>32-pe,this.unsigned):c(0,this.low<<pe-32,this.unsigned)},de.shl=de.shiftLeft,de.shiftRight=function(pe){return t(pe)&&(pe=pe.toInt()),(pe&=63)===0?this:pe<32?c(this.low>>>pe|this.high<<32-pe,this.high>>pe,this.unsigned):c(this.high>>pe-32,this.high>=0?0:-1,this.unsigned)},de.shr=de.shiftRight,de.shiftRightUnsigned=function(pe){if(t(pe)&&(pe=pe.toInt()),pe&=63,pe===0)return this;var W=this.high;if(pe<32){var re=this.low;return c(re>>>pe|W<<32-pe,W>>>pe,this.unsigned)}else return pe===32?c(W,0,this.unsigned):c(W>>>pe-32,0,this.unsigned)},de.shru=de.shiftRightUnsigned,de.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},de.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},de.toBytes=function(me){return me?this.toBytesLE():this.toBytesBE()},de.toBytesLE=function(){var me=this.high,pe=this.low;return[pe&255,pe>>>8&255,pe>>>16&255,pe>>>24&255,me&255,me>>>8&255,me>>>16&255,me>>>24&255]},de.toBytesBE=function(){var me=this.high,pe=this.low;return[me>>>24&255,me>>>16&255,me>>>8&255,me&255,pe>>>24&255,pe>>>16&255,pe>>>8&255,pe&255]},e})}(Q0)),Q0.exports}var lhe=che();const e_=_h(lhe),uhe=3,fhe=30,hhe=2*fhe+1,LP=180/Math.PI;function dhe(r,e,t){const n=1<<e;return[(r[0]+t[0])/n,(r[1]+t[1])/n]}function kP(r){return r>=.5?1/3*(4*r*r-1):1/3*(1-4*(1-r)*(1-r))}function phe(r){return[kP(r[0]),kP(r[1])]}function Ahe(r,[e,t]){switch(r){case 0:return[1,e,t];case 1:return[-e,1,t];case 2:return[-e,-t,1];case 3:return[-1,-t,-e];case 4:return[t,-1,-e];case 5:return[t,e,-1];default:throw new Error("Invalid face")}}function ghe([r,e,t]){const n=Math.atan2(t,Math.sqrt(r*r+e*e));return[Math.atan2(e,r)*LP,n*LP]}function mhe(r){let e=e_.fromString(r,!0,10).toString(2);for(;e.length<uhe+hhe;)e="0"+e;const t=e.lastIndexOf("1"),n=e.substring(0,3),i=e.substring(3,t),s=i.length/2,o=e_.fromString(n,!0,2).toString(10);let c=e_.fromString(i,!0,2).toString(4);for(;c.length<s;)c="0"+c;return`${o}/${c}`}function _he(r,e,t,n){if(n===0){t===1&&(e[0]=r-1-e[0],e[1]=r-1-e[1]);const i=e[0];e[0]=e[1],e[1]=i}}function yhe(r){const e=r.split("/"),t=parseInt(e[0],10),n=e[1],i=n.length,s=[0,0];let o;for(let c=i-1;c>=0;c--){o=i-c;const f=n[c];let A=0,v=0;f==="1"?v=1:f==="2"?(A=1,v=1):f==="3"&&(A=1);const w=Math.pow(2,o-1);_he(w,s,A,v),s[0]+=w*A,s[1]+=w*v}if(t%2===1){const c=s[0];s[0]=s[1],s[1]=c}return{face:t,ij:s,level:o}}function vhe(r){const e=r.padEnd(16,"0");return e_.fromString(e,16)}const bhe=100;function xhe({face:r,ij:e,level:t}){const n=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(bhe*Math.pow(2,-t))),s=new Float64Array(4*i*2+2);let o=0,c=0;for(let f=0;f<4;f++){const A=n[f].slice(0),v=n[f+1],w=(v[0]-A[0])/i,S=(v[1]-A[1])/i;for(let F=0;F<i;F++){A[0]+=w,A[1]+=S;const N=dhe(e,t,A),U=phe(N),$=Ahe(r,U),G=ghe($);Math.abs(G[1])>89.999&&(G[0]=c);const H=G[0]-c;G[0]+=H>180?-360:H<-180?360:0,s[o++]=G[0],s[o++]=G[1],c=G[0]}}return s[o++]=s[0],s[o++]=s[1],s}function whe(r){if(typeof r=="string"){if(r.indexOf("/")>0)return r;r=vhe(r)}return mhe(r.toString())}function Che(r){const e=whe(r),t=yhe(e);return xhe(t)}const The={getS2Token:{type:"accessor",value:r=>r.token}};class Ry extends df{indexToBounds(){const{data:e,getS2Token:t}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,i)=>Che(t(n,i))}}}Ry.layerName="S2Layer";Ry.defaultProps=The;const u1=512;function Ehe(r,e){let t=0,n=0,i=1<<r.length;const s=i/u1;for(let o=0;o<r.length;o++){i>>=1;const c=parseInt(r[o]);c%2&&(t|=i),c>1&&(n|=i)}return[[t/s,u1-n/s],[(t+e)/s,u1-(n+e)/s]]}function Bhe(r,e=1){const[t,n]=Ehe(r,e),[i,s]=hl(t),[o,c]=hl(n);return[o,s,o,c,i,c,i,s,o,s]}const She={getQuadkey:{type:"accessor",value:r=>r.quadkey}};class Fy extends df{indexToBounds(){const{data:e,extruded:t,getQuadkey:n}=this.props,i=t?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(s,o)=>Bhe(n(s,o),i),updateTriggers:{getPolygon:i}}}}Fy.layerName="QuadkeyLayer";Fy.defaultProps=She;class V6{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!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){const 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:t,onLoad:n,onError:i}){const{index:s,id:o,bbox:c,userData:f,zoom:A}=this,v=this._loaderId;this._abortController=new AbortController;const{signal:w}=this._abortController,S=await t.scheduleRequest(this,U=>U.isSelected?1:-1);if(!S){this._isCancelled=!0;return}if(this._isCancelled){S.done();return}let F=null,N;try{F=await e({index:s,id:o,bbox:c,userData:f,zoom:A,signal:w})}catch(U){N=U||!0}finally{S.done()}if(v===this._loaderId){if(this._loader=void 0,this.content=F,this._isCancelled&&!F){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,N?i(N,this):n(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())}}const go={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},NP=new dt,Ihe=new dt;class EC{constructor(e=[0,0,0],t=[0,0,0],n){n=n||NP.copy(e).add(t).scale(.5),this.center=new dt(n),this.halfDiagonal=new dt(t).subtract(this.center),this.minimum=new dt(e),this.maximum=new dt(t)}clone(){return new EC(this.minimum,this.maximum,this.center)}equals(e){return this===e||!!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){const{halfDiagonal:t}=this,n=Ihe.from(e.normal),i=t.x*Math.abs(n.x)+t.y*Math.abs(n.y)+t.z*Math.abs(n.z),s=this.center.dot(n)+e.distance;return s-i>0?go.INSIDE:s+i<0?go.OUTSIDE:go.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const t=NP.from(e).subtract(this.center),{halfDiagonal:n}=this;let i=0,s;return s=Math.abs(t.x)-n.x,s>0&&(i+=s*s),s=Math.abs(t.y)-n.y,s>0&&(i+=s*s),s=Math.abs(t.z)-n.z,s>0&&(i+=s*s),i}}const LA=new dt,UP=new dt;class Yg{constructor(e=[0,0,0],t=0){this.radius=-0,this.center=new dt,this.fromCenterRadius(e,t)}fromCenterRadius(e,t){return this.center.from(e),this.radius=t,this}fromCornerPoints(e,t){return t=LA.from(t),this.center=new dt().from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Yg(this.center,this.radius)}union(e){const t=this.center,n=this.radius,i=e.center,s=e.radius,o=LA.copy(i).subtract(t),c=o.magnitude();if(n>=c+s)return this.clone();if(s>=c+n)return e.clone();const f=(n+c+s)*.5;return UP.copy(o).scale((-n+f)/c).add(t),this.center.copy(UP),this.radius=f,this}expand(e){const n=LA.from(e).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(e){this.center.transform(e);const t=ej(LA,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}distanceSquaredTo(e){const t=this.distanceTo(e);return t*t}distanceTo(e){const n=LA.from(e).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(e){const t=this.center,n=this.radius,s=e.normal.dot(t)+e.distance;return s<-n?go.OUTSIDE:s<n?go.INTERSECTING:go.INSIDE}}const Mhe=new dt,Phe=new dt,h0=new dt,d0=new dt,p0=new dt,Rhe=new dt,Fhe=new dt,Hl={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8};class Zg{constructor(e=[0,0,0],t=[0,0,0,0,0,0,0,0,0]){this.center=new dt().from(e),this.halfAxes=new gi(t)}get halfSize(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new dt(e).len(),new dt(t).len(),new dt(n).len()]}get quaternion(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new dt(e).normalize(),s=new dt(t).normalize(),o=new dt(n).normalize();return new vg().fromMatrix3(new gi([...i,...s,...o]))}fromCenterHalfSizeQuaternion(e,t,n){const i=new vg(n),s=new gi().fromQuaternion(i);return s[0]=s[0]*t[0],s[1]=s[1]*t[0],s[2]=s[2]*t[0],s[3]=s[3]*t[1],s[4]=s[4]*t[1],s[5]=s[5]*t[1],s[6]=s[6]*t[2],s[7]=s[7]*t[2],s[8]=s[8]*t[2],this.center=new dt().from(e),this.halfAxes=s,this}clone(){return new Zg(this.center,this.halfAxes)}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Yg){const t=this.halfAxes,n=t.getColumn(0,h0),i=t.getColumn(1,d0),s=t.getColumn(2,p0),o=Mhe.copy(n).add(i).add(s);return e.center.copy(this.center),e.radius=o.magnitude(),e}intersectPlane(e){const t=this.center,n=e.normal,i=this.halfAxes,s=n.x,o=n.y,c=n.z,f=Math.abs(s*i[Hl.COLUMN0ROW0]+o*i[Hl.COLUMN0ROW1]+c*i[Hl.COLUMN0ROW2])+Math.abs(s*i[Hl.COLUMN1ROW0]+o*i[Hl.COLUMN1ROW1]+c*i[Hl.COLUMN1ROW2])+Math.abs(s*i[Hl.COLUMN2ROW0]+o*i[Hl.COLUMN2ROW1]+c*i[Hl.COLUMN2ROW2]),A=n.dot(t)+e.distance;return A<=-f?go.OUTSIDE:A>=f?go.INSIDE:go.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const t=Phe.from(e).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,h0),s=n.getColumn(1,d0),o=n.getColumn(2,p0),c=i.magnitude(),f=s.magnitude(),A=o.magnitude();i.normalize(),s.normalize(),o.normalize();let v=0,w;return w=Math.abs(t.dot(i))-c,w>0&&(v+=w*w),w=Math.abs(t.dot(s))-f,w>0&&(v+=w*w),w=Math.abs(t.dot(o))-A,w>0&&(v+=w*w),v}computePlaneDistances(e,t,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const o=this.center,c=this.halfAxes,f=c.getColumn(0,h0),A=c.getColumn(1,d0),v=c.getColumn(2,p0),w=Rhe.copy(f).add(A).add(v).add(o),S=Fhe.copy(w).subtract(e);let F=t.dot(S);return i=Math.min(F,i),s=Math.max(F,s),w.copy(o).add(f).add(A).subtract(v),S.copy(w).subtract(e),F=t.dot(S),i=Math.min(F,i),s=Math.max(F,s),w.copy(o).add(f).subtract(A).add(v),S.copy(w).subtract(e),F=t.dot(S),i=Math.min(F,i),s=Math.max(F,s),w.copy(o).add(f).subtract(A).subtract(v),S.copy(w).subtract(e),F=t.dot(S),i=Math.min(F,i),s=Math.max(F,s),o.copy(w).subtract(f).add(A).add(v),S.copy(w).subtract(e),F=t.dot(S),i=Math.min(F,i),s=Math.max(F,s),o.copy(w).subtract(f).add(A).subtract(v),S.copy(w).subtract(e),F=t.dot(S),i=Math.min(F,i),s=Math.max(F,s),o.copy(w).subtract(f).subtract(A).add(v),S.copy(w).subtract(e),F=t.dot(S),i=Math.min(F,i),s=Math.max(F,s),o.copy(w).subtract(f).subtract(A).subtract(v),S.copy(w).subtract(e),F=t.dot(S),i=Math.min(F,i),s=Math.max(F,s),n[0]=i,n[1]=s,n}transform(e){this.center.transformAsPoint(e);const t=this.halfAxes.getColumn(0,h0);t.transformAsPoint(e);const n=this.halfAxes.getColumn(1,d0);n.transformAsPoint(e);const i=this.halfAxes.getColumn(2,p0);return i.transformAsPoint(e),this.halfAxes=new gi([...t,...n,...i]),this}getTransform(){throw new Error("not implemented")}}const zP=new dt,GP=new dt;class gc{constructor(e=[0,0,1],t=0){this.normal=new dt,this.distance=-0,this.fromNormalDistance(e,t)}fromNormalDistance(e,t){return mc(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}fromPointNormal(e,t){e=zP.from(e),this.normal.from(t).normalize();const n=-this.normal.dot(e);return this.distance=n,this}fromCoefficients(e,t,n,i){return this.normal.set(e,t,n),mc(ma(this.normal.len(),1)),this.distance=i,this}clone(){return new gc(this.normal,this.distance)}equals(e){return ma(this.distance,e.distance)&&ma(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const t=GP.copy(this.normal).transformAsVector(e).normalize(),n=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(n,t)}projectPointOntoPlane(e,t=[0,0,0]){const n=zP.from(e),i=this.getPointDistance(n),s=GP.copy(this.normal).scale(i);return n.subtract(s).to(t)}}const VP=[new dt([1,0,0]),new dt([0,1,0]),new dt([0,0,1])],HP=new dt,Dhe=new dt;class pa{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*VP.length;const t=e.center,n=e.radius;let i=0;for(const s of VP){let o=this.planes[i],c=this.planes[i+1];o||(o=this.planes[i]=new gc),c||(c=this.planes[i+1]=new gc);const f=HP.copy(s).scale(-n).add(t);o.fromPointNormal(f,s);const A=HP.copy(s).scale(n).add(t),v=Dhe.copy(s).negate();c.fromPointNormal(A,v),i+=2}return this}computeVisibility(e){let t=go.INSIDE;for(const n of this.planes)switch(e.intersectPlane(n)){case go.OUTSIDE:return go.OUTSIDE;case go.INTERSECTING:t=go.INTERSECTING;break}return t}computeVisibilityWithPlaneMask(e,t){if(mc(Number.isFinite(t),"parentPlaneMask is required."),t===pa.MASK_OUTSIDE||t===pa.MASK_INSIDE)return t;let n=pa.MASK_INSIDE;const i=this.planes;for(let s=0;s<this.planes.length;++s){const o=s<31?1<<s:0;if(s<31&&(t&o)===0)continue;const c=i[s],f=e.intersectPlane(c);if(f===go.OUTSIDE)return pa.MASK_OUTSIDE;f===go.INTERSECTING&&(n|=o)}return n}}pa.MASK_OUTSIDE=4294967295;pa.MASK_INSIDE=0;pa.MASK_INDETERMINATE=2147483647;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;new dt;
4191const rl=new gi,Ohe=new gi,Lhe=new gi,A0=new gi,jP=new gi;function khe(r,e={}){const t=Uj,n=10;let i=0,s=0;const o=Ohe,c=Lhe;o.identity(),c.copy(r);const f=t*Nhe(c);for(;s<n&&Uhe(c)>f;)zhe(c,A0),jP.copy(A0).transpose(),c.multiplyRight(A0),c.multiplyLeft(jP),o.multiplyRight(A0),++i>2&&(++s,i=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=c.toTarget(e.diagonal),e}function Nhe(r){let e=0;for(let t=0;t<9;++t){const n=r[t];e+=n*n}return Math.sqrt(e)}const px=[1,0,0],Ax=[2,2,1];function Uhe(r){let e=0;for(let t=0;t<3;++t){const n=r[rl.getElementIndex(Ax[t],px[t])];e+=2*n*n}return Math.sqrt(e)}function zhe(r,e){const t=M4;let n=0,i=1;for(let A=0;A<3;++A){const v=Math.abs(r[rl.getElementIndex(Ax[A],px[A])]);v>n&&(i=A,n=v)}const s=px[i],o=Ax[i];let c=1,f=0;if(Math.abs(r[rl.getElementIndex(o,s)])>t){const A=r[rl.getElementIndex(o,o)],v=r[rl.getElementIndex(s,s)],w=r[rl.getElementIndex(o,s)],S=(A-v)/2/w;let F;S<0?F=-1/(-S+Math.sqrt(1+S*S)):F=1/(S+Math.sqrt(1+S*S)),c=1/Math.sqrt(1+F*F),f=F*c}return gi.IDENTITY.to(e),e[rl.getElementIndex(s,s)]=e[rl.getElementIndex(o,o)]=c,e[rl.getElementIndex(o,s)]=f,e[rl.getElementIndex(s,o)]=-f,e}const Nu=new dt,Ghe=new dt,Vhe=new dt,Hhe=new dt,jhe=new dt,$he=new gi,Whe={diagonal:new gi,unitary:new gi};function H6(r,e=new Zg){if(!r||r.length===0)return e.halfAxes=new gi([0,0,0,0,0,0,0,0,0]),e.center=new dt,e;const t=r.length,n=new dt(0,0,0);for(const de of r)n.add(de);const i=1/t;n.multiplyByScalar(i);let s=0,o=0,c=0,f=0,A=0,v=0;for(const de of r){const me=Nu.copy(de).subtract(n);s+=me.x*me.x,o+=me.x*me.y,c+=me.x*me.z,f+=me.y*me.y,A+=me.y*me.z,v+=me.z*me.z}s*=i,o*=i,c*=i,f*=i,A*=i,v*=i;const w=$he;w[0]=s,w[1]=o,w[2]=c,w[3]=o,w[4]=f,w[5]=A,w[6]=c,w[7]=A,w[8]=v;const{unitary:S}=khe(w,Whe),F=e.halfAxes.copy(S);let N=F.getColumn(0,Vhe),U=F.getColumn(1,Hhe),$=F.getColumn(2,jhe),G=-Number.MAX_VALUE,H=-Number.MAX_VALUE,J=-Number.MAX_VALUE,ue=Number.MAX_VALUE,q=Number.MAX_VALUE,se=Number.MAX_VALUE;for(const de of r)Nu.copy(de),G=Math.max(Nu.dot(N),G),H=Math.max(Nu.dot(U),H),J=Math.max(Nu.dot($),J),ue=Math.min(Nu.dot(N),ue),q=Math.min(Nu.dot(U),q),se=Math.min(Nu.dot($),se);N=N.multiplyByScalar(.5*(ue+G)),U=U.multiplyByScalar(.5*(q+H)),$=$.multiplyByScalar(.5*(se+J)),e.center.copy(N).add(U).add($);const Te=Ghe.set(G-ue,H-q,J-se).multiplyByScalar(.5),Ue=new gi([Te[0],0,0,0,Te[1],0,0,0,Te[2]]);return e.halfAxes.multiplyRight(Ue),e}const hp=512,$P=3,j6=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],$6=j6.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Jhe=$6.concat([[.25,.5],[.75,.5]]);class dp{constructor(e,t,n){this.x=e,this.y=t,this.z=n}get children(){if(!this._children){const e=this.x*2,t=this.y*2,n=this.z+1;this._children=[new dp(e,t,n),new dp(e,t+1,n),new dp(e+1,t,n),new dp(e+1,t+1,n)]}return this._children}update(e){const{viewport:t,cullingVolume:n,elevationBounds:i,minZ:s,maxZ:o,bounds:c,offset:f,project:A}=e,v=this.getBoundingVolume(i,f,A);if(c&&!this.insideBounds(c)||n.computeVisibility(v)<0)return!1;if(!this.childVisible){let{z:S}=this;if(S<o&&S>=s){const F=v.distanceTo(t.cameraPosition)*t.scale/t.height;S+=Math.floor(Math.log2(F))}if(S>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const S of this.children)S.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(const t of this._children)t.getSelected(e);return e}insideBounds([e,t,n,i]){const s=Math.pow(2,this.z),o=hp/s;return this.x*o<n&&this.y*o<i&&(this.x+1)*o>e&&(this.y+1)*o>t}getBoundingVolume(e,t,n){if(n){const f=this.z<1?Jhe:this.z<2?$6:j6,A=[];for(const v of f){const w=mx(this.x+v[0],this.y+v[1],this.z);w[2]=e[0],A.push(n(w)),e[0]!==e[1]&&(w[2]=e[1],A.push(n(w)))}return H6(A)}const i=Math.pow(2,this.z),s=hp/i,o=this.x*s+t*hp,c=hp-(this.y+1)*s;return new EC([o,c,e[0]],[o+s,c+s,e[1]])}}function Xhe(r,e,t,n){const i=r instanceof hZ&&r.resolution?r.projectPosition:null,s=Object.values(r.getFrustumPlanes()).map(({normal:F,distance:N})=>new gc(F.clone().negate(),N)),o=new pa(s),c=r.distanceScales.unitsPerMeter[2],f=t&&t[0]*c||0,A=t&&t[1]*c||0,v=r instanceof wg&&r.pitch<=60?e:0;if(n){const[F,N,U,$]=n,G=eu([F,$]),H=eu([U,N]);
4191n=[G[0],hp-G[1],H[0],hp-H[1]]}const w=new dp(0,0,0),S={viewport:r,project:i,cullingVolume:o,elevationBounds:[f,A],minZ:v,maxZ:e,bounds:n,offset:0};if(w.update(S),r instanceof wg&&r.subViewports&&r.subViewports.length>1){for(S.offset=-1;w.update(S)&&!(--S.offset<-$P););for(S.offset=1;w.update(S)&&!(++S.offset>$P););}return w.getSelected()}const tu=512,Khe=[-1/0,-1/0,1/0,1/0],H_={type:"object",value:null,validate:(r,e)=>e.optional&&r===null||typeof r=="string"||Array.isArray(r)&&r.every(t=>typeof t=="string"),equal:(r,e)=>{if(r===e)return!0;if(!Array.isArray(r)||!Array.isArray(e))return!1;const t=r.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(r[n]!==e[n])return!1;return!0}};function W6(r,e){const t=[e.transformAsPoint([r[0],r[1]]),e.transformAsPoint([r[2],r[1]]),e.transformAsPoint([r[0],r[3]]),e.transformAsPoint([r[2],r[3]])];return[Math.min(...t.map(i=>i[0])),Math.min(...t.map(i=>i[1])),Math.max(...t.map(i=>i[0])),Math.max(...t.map(i=>i[1]))]}function qhe(r){return Math.abs(r.split("").reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0))}function ph(r,e){if(!r||!r.length)return null;const{index:t,id:n}=e;if(Array.isArray(r)){const s=qhe(n)%r.length;r=r[s]}let i=r;for(const s of Object.keys(t)){const o=new RegExp(`{${s}}`,"g");i=i.replace(o,String(t[s]))}return Number.isInteger(t.y)&&Number.isInteger(t.z)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,t.z)-t.y-1))),i}function Yhe(r,e,t){let n;return n=r.getBounds(),r.isGeospatial?[Math.max(n[0],t[0]),Math.max(n[1],t[1]),Math.min(n[2],t[2]),Math.min(n[3],t[3])]:[Math.max(Math.min(n[0],t[2]),t[0]),Math.max(Math.min(n[1],t[3]),t[1]),Math.min(Math.max(n[2],t[0]),t[2]),Math.min(Math.max(n[3],t[1]),t[3])]}function Zhe({viewport:r,z:e,cullRect:t}){return(r.subViewports||[r]).map(i=>gx(i,e||0,t))}function gx(r,e,t){if(!Array.isArray(e)){const s=t.x-r.x,o=t.y-r.y,{width:c,height:f}=t,A={targetZ:e},v=r.unproject([s,o],A),w=r.unproject([s+c,o],A),S=r.unproject([s,o+f],A),F=r.unproject([s+c,o+f],A);return[Math.min(v[0],w[0],S[0],F[0]),Math.min(v[1],w[1],S[1],F[1]),Math.max(v[0],w[0],S[0],F[0]),Math.max(v[1],w[1],S[1],F[1])]}const n=gx(r,e[0],t),i=gx(r,e[1],t);return[Math.min(n[0],i[0]),Math.min(n[1],i[1]),Math.max(n[2],i[2]),Math.max(n[3],i[3])]}function Qhe(r,e,t){return t?W6(r,t).map(i=>i*e/tu):r.map(n=>n*e/tu)}function BC(r,e){return Math.pow(2,r)*tu/e}function mx(r,e,t){const n=BC(t,tu),i=r/n*360-180,s=Math.PI-2*Math.PI*e/n,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[i,o]}function WP(r,e,t,n){const i=BC(t,n);return[r/i*tu,e/i*tu]}function ede(r,e,t,n,i=tu){if(r.isGeospatial){const[A,v]=mx(e,t,n),[w,S]=mx(e+1,t+1,n);return{west:A,north:v,east:w,south:S}}const[s,o]=WP(e,t,n,i),[c,f]=WP(e+1,t+1,n,i);return{left:s,top:o,right:c,bottom:f}}function tde(r,e,t,n,i){const s=Yhe(r,null,n),o=BC(e,t),[c,f,A,v]=Qhe(s,o,i),w=[];for(let S=Math.floor(c);S<A;S++)for(let F=Math.floor(f);F<v;F++)w.push({x:S,y:F,z:e});return w}function rde({viewport:r,maxZoom:e,minZoom:t,zRange:n,extent:i,tileSize:s=tu,modelMatrix:o,modelMatrixInverse:c,zoomOffset:f=0}){let A=r.isGeospatial?Math.round(r.zoom+Math.log2(tu/s))+f:Math.ceil(r.zoom)+f;if(typeof t=="number"&&Number.isFinite(t)&&A<t){if(!i)return[];A=t}typeof e=="number"&&Number.isFinite(e)&&A>e&&(A=e);let v=i;return o&&c&&i&&!r.isGeospatial&&(v=W6(i,o)),r.isGeospatial?Xhe(r,A,n,i):tde(r,A,s,v||Khe,c)}function nde(r){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(r)}function ide(r){return Number.isFinite(r.west)&&Number.isFinite(r.north)&&Number.isFinite(r.east)&&Number.isFinite(r.south)}function sde(r){let e={},t;return n=>{for(const i in n)if(!ode(n[i],e[i])){t=r(n),e=n;break}return t}}function ode(r,e){if(r===e)return!0;if(Array.isArray(r)){const t=r.length;if(!e||e.length!==t)return!1;for(let n=0;n<t;n++)if(r[n]!==e[n])return!1;return!0}return!1}const JP=1,Dy=2,ade="never",cde="no-overlap",SC="best-available",lde=5,ude={[SC]:hde,[cde]:dde,[ade]:()=>{}},fde={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{}
4191,onTileUnload:()=>{},onTileError:()=>{}};class Oy{constructor(e){this._getCullBounds=sde(Zhe),this.opts={...fde,...e},this.setOptions(this.opts),this.onTileLoad=t=>{this.opts.onTileLoad?.(t),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=t.byteLength,this._resizeCache())},this._requestScheduler=new O6({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 vn,this._modelMatrixInverse=new vn}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(const e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(const e of this._cache.keys()){const t=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(t)?this._cache.delete(e):t.setNeedsReload()}}update(e,{zRange:t,modelMatrix:n}={zRange:null,modelMatrix:null}){const i=n?new vn(n):new vn,s=!i.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!ma(this._zRange,t)||s){s&&(this._modelMatrixInverse=i.clone().invert(),this._modelMatrix=i),this._viewport=e,this._zRange=t;const c=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:t,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(f=>this._getTile(f,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));const o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(e,t){if(!e.isVisible)return!1;if(t&&this._viewport){const n=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:t}),{bbox:i}=e;for(const[s,o,c,f]of n){let A;if("west"in i)A=i.west<c&&i.east>s&&i.south<f&&i.north>o;else{const v=Math.min(i.top,i.bottom),w=Math.max(i.top,i.bottom);A=i.left<c&&i.right>s&&v<f&&w>o}if(A)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:t,minZoom:n,zRange:i,modelMatrix:s,modelMatrixInverse:o}){const{tileSize:c,extent:f,zoomOffset:A}=this.opts;return rde({viewport:e,maxZoom:t,minZoom:n,zRange:i,tileSize:c,extent:f,modelMatrix:s,modelMatrixInverse:o,zoomOffset:A})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){const{tileSize:t}=this.opts;return{bbox:ede(this._viewport,e.x,e.y,e.z,t)}}getParentIndex(e){const t=Math.floor(e.x/2),n=Math.floor(e.y/2),i=e.z-1;return{x:t,y:n,z:i}}updateTileStates(){const e=this.opts.refinementStrategy||SC,t=new Array(this._cache.size);let n=0;for(const i of this._cache.values())t[n++]=i.isVisible,i.isSelected=!1,i.isVisible=!1;for(const i of this._selectedTiles)i.isSelected=!0,i.isVisible=!0;(typeof e=="function"?e:ude[e])(Array.from(this._cache.values())),n=0;for(const i of this._cache.values())if(t[n++]!==i.isVisible)return!0;return!1}_pruneRequests(){const{maxRequests:e=0}=this.opts,t=[];let n=0;for(const i of this._cache.values())i.isLoading&&(n++,!i.isSelected&&!i.isVisible&&t.push(i));for(;e>0&&n>e&&t.length>0;)t.shift().abort(),n--}_rebuildTree(){const{_cache:e}=this;for(const t of e.values())t.parent=null,t.children&&(t.children.length=0);for(const t of e.values()){const n=this._getNearestAncestor(t);t.parent=n,n?.children&&n.children.push(t)}}_resizeCache(){const{_cache:e,opts:t}=this,n=t.maxCacheSize??(t.maxCacheByteSize!==null?1/0:lde*this.selectedTiles.length),i=t.maxCacheByteSize??1/0;if(e.size>n||this._cacheByteSize>i){for(const[o,c]of e)if(!c.isVisible&&!c.isSelected&&(this._cacheByteSize-=t.maxCacheByteSize!==null?c.byteLength:0,e.delete(o),this.opts.onTileUnload?.(c)),e.size<=n&&this._cacheByteSize<=i)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,c)=>o.zoom-c.zoom),this._dirty=!1)}_getTile(e,t){const n=this.getTileId(e);let i=this._cache.get(n),s=!1;return!i&&t?(i=new V6(e),Object.assign(i,this.getTileMetadata(i.index)),Object.assign(i,{id:n,zoom:this.getTileZoom(i.index)}),s=!0,this._cache.set(n,i),this._dirty=!0):i&&i.needsReload&&(s=!0),i&&s&&i.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),i}_getNearestAncestor(e){const{_minZoom:t=0}=this;let n=e.index;for(;this.getTileZoom(n)>t;){n=this.getParentIndex(n);const i=this._getTile(n);if(i)return i}return null}}function hde(r){for(const e of r)e.state=0;for(const e of r)e.isSelected&&!J6(e)&&IC(e);for(const e of r)e.isVisible=!!(e.state&Dy)}function dde(r){for(const t of r)t.state=0;for(const t of r)t.isSelected&&J6(t);const e=Array.from(r).sort((t,n)=>t.zoom-n.zoom);for(const t of e)if(t.isVisible=!!(t.state&Dy),t.children&&(t.isVisible||t.state&JP))for(const n of t.children)n.state=JP;else t.isSelected&&IC(t)}function J6(r){let e=r;
4191for(;e;){if(e.isLoaded||e.content)return e.state|=Dy,!0;e=e.parent}return!1}function IC(r){for(const e of r.children)e.isLoaded||e.content?e.state|=Dy:IC(e)}const pde={TilesetClass:Oy,data:{type:"data",value:[]},dataComparator:H_.equal,renderSubLayers:{type:"function",value:r=>new iu(r)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:r=>{}},onTileUnload:{type:"function",value:r=>{}},onTileError:{type:"function",value:r=>console.error(r)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:SC,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0};class ou extends Bs{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(t=>t.isLoaded))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:t}=this.state;const n=e.propsOrDataChanged||e.updateTriggersChanged,i=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);t?n&&(t.setOptions(this._getTilesetOptions()),i?t.reloadAll():t.tiles.forEach(s=>{s.layers=null})):(t=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:t})),this._updateTileset()}_getTilesetOptions(){const{tileSize:e,maxCacheSize:t,maxCacheByteSize:n,refinementStrategy:i,extent:s,maxZoom:o,minZoom:c,maxRequests:f,debounceTime:A,zoomOffset:v}=this.props;return{maxCacheSize:t,maxCacheByteSize:n,maxZoom:o,minZoom:c,tileSize:e,refinementStrategy:i,extent:s,maxRequests:f,debounceTime:A,zoomOffset:v,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){const e=this.state.tileset,{zRange:t,modelMatrix:n}=this.props,i=e.update(this.context.viewport,{zRange:t,modelMatrix:n}),{isLoaded:s}=e,o=this.state.isLoaded!==s,c=this.state.frameNumber!==i;s&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:i}),this.state.isLoaded=s}_onViewportLoad(){const{tileset:e}=this.state,{onViewportLoad:t}=this.props;t&&t(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,t){this.props.onTileError(e),t.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){const{data:t,getTileData:n,fetch:i}=this.props,{signal:s}=e;return e.url=typeof t=="string"||Array.isArray(t)?ph(t,e):null,n?n(e):i&&e.url?i(e.url,{propName:"data",layer:this,signal:s}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){const t=e.sourceLayer,n=t.props.tile,i=e.info;return i.picked&&(i.tile=n),i.sourceTile=n,i.sourceTileSubLayer=t,i}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{const t=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)t&&e.layers[0]&&Object.keys(t).some(n=>e.layers[0].props[n]!==t[n])&&(e.layers=e.layers.map(n=>n.clone(t)));else{const n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=py(n,Boolean).map(i=>i.clone({tile:e,...t}))}return e.layers})}filterSubLayer({layer:e,cullRect:t}){const{tile:n}=e.props;return this.state.tileset.isTileVisible(n,t)}}ou.defaultProps=pde;ou.layerName="TileLayer";const XP=`uniform tripsUniforms {
4192  bool fadeTrail;
4193  float trailLength;
4194  float currentTime;
4195} trips;
4196`,Ade={name:"trips",vs:XP,fs:XP,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}},gde={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:r=>r.timestamps}};class Ly extends uf{getShaders(){const e=super.getShaders();return e.inject={"vs:#decl":`in float instanceTimestamps;
4197in float instanceNextTimestamps;
4198out float vTime;
4199`,"vs:#main-end":`vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;
4200`,"fs:#decl":`in float vTime;
4201`,"fs:#main-start":`if(vTime > trips.currentTime || (trips.fadeTrail && (vTime < trips.currentTime - trips.trailLength))) {
4202  discard;
4203}
4204`,"fs:DECKGL_FILTER_COLOR":`if(trips.fadeTrail) {
4205  color.a *= 1.0 - (trips.currentTime - vTime) / trips.trailLength;
4206}
4207`},e.modules=[...e.modules,Ade],e}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(e){const{fadeTrail:t,trailLength:n,currentTime:i}=this.props,s={fadeTrail:t,trailLength:n,currentTime:i};this.state.model.shaderInputs.setProps({trips:s}),super.draw(e)}}Ly.layerName="TripsLayer";Ly.defaultProps=gde;var Nr=function(r){r=r||{};var e=typeof r<"u"?r:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var i="";function s(he){return e.locateFile?e.locateFile(he,i):i+he}var o;typeof document<"u"&&document.currentScript&&(i=document.currentScript.src),i.indexOf("blob:")!==0?i=i.substr(0,i.lastIndexOf("/")+1):i="",o=function(be,ae,Be){var g=new XMLHttpRequest;g.open("GET",be,!0),g.responseType="arraybuffer",g.onload=function(){if(g.status==200||g.status==0&&g.response){ae(g.response);return}var xt=Rt(be);if(xt){ae(xt.buffer);return}Be()},g.onerror=Be,g.send(null)};var c=e.print||console.log.bind(console),f=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&e.arguments;var A=0,v=function(he){A=he},w=function(){return A},S=8;function F(he,be,ae,Be){switch(ae=ae||"i8",ae.charAt(ae.length-1)==="*"&&(ae="i32"),ae){case"i1":W[he>>0]=be;break;case"i8":W[he>>0]=be;break;case"i16":Ee[he>>1]=be;break;case"i32":et[he>>2]=be;break;case"i64":Zn=[be>>>0,(Bn=be,+xr(Bn)>=1?Bn>0?(yr(+_r(Bn/4294967296),4294967295)|0)>>>0:~~+Vn((Bn-+(~~Bn>>>0))/4294967296)>>>0:0)],et[he>>2]=Zn[0],et[he+4>>2]=Zn[1];break;case"float":_e[he>>2]=be;break;case"double":Le[he>>3]=be;break;default:Oe("invalid type for setValue: "+ae)}}function N(he,be,ae){switch(be=be||"i8",be.charAt(be.length-1)==="*"&&(be="i32"),be){case"i1":return W[he>>0];case"i8":return W[he>>0];case"i16":return Ee[he>>1];case"i32":return et[he>>2];case"i64":return et[he>>2];case"float":return _e[he>>2];case"double":return Le[he>>3];default:Oe("invalid type for getValue: "+be)}return null}var U=!1;function $(he,be){he||Oe("Assertion failed: "+be)}function G(he){var be=e["_"+he];return $(be,"Cannot call unknown function "+he+", make sure it is exported"),be}function H(he,be,ae,Be,g){var ce={string:function(Mt){var Ht=0;if(Mt!=null&&Mt!==0){var Ur=(Mt.length<<2)+1;Ht=bt(Ur),Ue(Mt,Ht,Ur)}return Ht},array:function(Mt){var Ht=bt(Mt.length);return de(Mt,Ht),Ht}};function xt(Mt){return be==="string"?se(Mt):be==="boolean"?!!Mt:Mt}var Ke=G(he),Et=[],Pt=0;if(Be)for(var Ot=0;Ot<Be.length;Ot++){var ht=ce[ae[Ot]];ht?(Pt===0&&(Pt=Ce()),Et[Ot]=ht(Be[Ot])):Et[Ot]=Be[Ot]}var Lt=Ke.apply(null,Et);return Lt=xt(Lt),Pt!==0&&Bt(Pt),Lt}function J(he,be,ae,Be){ae=ae||[];var g=ae.every(function(xt){return xt==="number"}),ce=be!=="string";return ce&&g&&!Be?G(he):function(){return H(he,be,ae,arguments)}}var ue=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function q(he,be,ae){for(var Be=be+ae,g=be;he[g]&&!(g>=Be);)++g;if(g-be>16&&he.subarray&&ue)return ue.decode(he.subarray(be,g));for(var ce="";be<g;){var xt=he[be++];if(!(xt&128)){ce+=String.fromCharCode(xt);continue}var Ke=he[be++]&63;if((xt&224)==192){ce+=String.fromCharCode((xt&31)<<6|Ke);continue}var Et=he[be++]&63;if((xt&240)==224?xt=(xt&15)<<12|Ke<<6|Et:xt=(xt&7)<<18|Ke<<12|Et<<6|he[be++]&63,xt<65536)ce+=String.fromCharCode(xt);else{var Pt=xt-65536;ce+=String.fromCharCode(55296|Pt>>10,56320|Pt&1023)}}return ce}function se(he,be){return he?q(re,he,be):""}function Te(he,be,ae,Be){if(!(Be>0))return 0;for(var g=ae,ce=ae+Be-1,xt=0;xt<he.length;++xt){var Ke=he.charCodeAt(xt);if(Ke>=55296&&Ke<=57343){var Et=he.charCodeAt(++xt);Ke=65536+((Ke&1023)<<10)|Et&1023}if(Ke<=127){if(ae>=ce)break;be[ae++]=Ke}
4207else if(Ke<=2047){if(ae+1>=ce)break;be[ae++]=192|Ke>>6,be[ae++]=128|Ke&63}else if(Ke<=65535){if(ae+2>=ce)break;be[ae++]=224|Ke>>12,be[ae++]=128|Ke>>6&63,be[ae++]=128|Ke&63}else{if(ae+3>=ce)break;be[ae++]=240|Ke>>18,be[ae++]=128|Ke>>12&63,be[ae++]=128|Ke>>6&63,be[ae++]=128|Ke&63}}return be[ae]=0,ae-g}function Ue(he,be,ae){return Te(he,re,be,ae)}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function de(he,be){W.set(he,be)}function me(he,be){return he%be>0&&(he+=be-he%be),he}var pe,W,re,Ee,et,_e,Le;function Ge(he){pe=he,e.HEAP8=W=new Int8Array(he),e.HEAP16=Ee=new Int16Array(he),e.HEAP32=et=new Int32Array(he),e.HEAPU8=re=new Uint8Array(he),e.HEAPU16=new Uint16Array(he),e.HEAPU32=new Uint32Array(he),e.HEAPF32=_e=new Float32Array(he),e.HEAPF64=Le=new Float64Array(he)}var Ze=5267040,tt=24128,rt=e.TOTAL_MEMORY||33554432;e.buffer?pe=e.buffer:pe=new ArrayBuffer(rt),rt=pe.byteLength,Ge(pe),et[tt>>2]=Ze;function ut(he){for(;he.length>0;){var be=he.shift();if(typeof be=="function"){be();continue}var ae=be.func;typeof ae=="number"?be.arg===void 0?e.dynCall_v(ae):e.dynCall_vi(ae,be.arg):ae(be.arg===void 0?null:be.arg)}}var vt=[],St=[],st=[],dr=[];function er(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ln(e.preRun.shift());ut(vt)}function Kt(){ut(St)}function Nt(){ut(st)}function Ar(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Pr(e.postRun.shift());ut(dr)}function ln(he){vt.unshift(he)}function Pr(he){dr.unshift(he)}var xr=Math.abs,Vn=Math.ceil,_r=Math.floor,yr=Math.min,un=0,Dr=null;function ci(he){un++,e.monitorRunDependencies&&e.monitorRunDependencies(un)}function Yn(he){if(un--,e.monitorRunDependencies&&e.monitorRunDependencies(un),un==0&&Dr){var be=Dr;Dr=null,be()}}e.preloadedImages={},e.preloadedAudios={};var mn=null,ti="data:application/octet-stream;base64,";function Hn(he){return String.prototype.startsWith?he.startsWith(ti):he.indexOf(ti)===0}var Bn,Zn;mn
vendor: 19,357 bytes, line 4207
4207="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+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE
vendor: 11,896 bytes, line 4207
42074AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/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=";
4207var Vt=24144;function mr(he,be,ae,Be){Oe("Assertion failed: "+se(he)+", at: "+[be?se(be):"unknown filename",ae,Be?se(Be):"unknown function"])}function Rr(){return W.length}function nn(he,be,ae){re.set(re.subarray(be,be+ae),he)}function _i(he){return e.___errno_location&&(et[e.___errno_location()>>2]=he),he}function Me(he){Oe("OOM")}function kt(he){try{var be=new ArrayBuffer(he);return be.byteLength!=he?void 0:(new Int8Array(be).set(W),j(be),Ge(be),1)}catch{}}function $t(he){var be=Rr(),ae=16777216,Be=2147483648-ae;if(he>Be)return!1;for(var g=16777216,ce=Math.max(be,g);ce<he;
4207)ce<=536870912?ce=me(2*ce,ae):ce=Math.min(me((3*ce+2147483648)/4,ae),Be);var xt=kt(ce);return!!xt}var lr=typeof atob=="function"?atob:function(he){var be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ae="",Be,g,ce,xt,Ke,Et,Pt,Ot=0;he=he.replace(/[^A-Za-z0-9\+\/\=]/g,"");do xt=be.indexOf(he.charAt(Ot++)),Ke=be.indexOf(he.charAt(Ot++)),Et=be.indexOf(he.charAt(Ot++)),Pt=be.indexOf(he.charAt(Ot++)),Be=xt<<2|Ke>>4,g=(Ke&15)<<4|Et>>2,ce=(Et&3)<<6|Pt,ae=ae+String.fromCharCode(Be),Et!==64&&(ae=ae+String.fromCharCode(g)),Pt!==64&&(ae=ae+String.fromCharCode(ce));while(Ot<he.length);return ae};function Ye(he){try{for(var be=lr(he),ae=new Uint8Array(be.length),Be=0;Be<be.length;++Be)ae[Be]=be.charCodeAt(Be);return ae}catch{throw new Error("Converting base64 string to bytes failed.")}}function Rt(he){if(Hn(he))return Ye(he.slice(ti.length))}var Ae={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},Gt={b:v,c:w,d:mr,e:_i,f:Rr,g:nn,h:$t,i:Me,o:Vt,p:tt},Tt=function(he,be,ae){"almost asm";var Be=new he.Int8Array(ae),g=new he.Int32Array(ae);new he.Uint8Array(ae),new he.Float32Array(ae);var ce=new he.Float64Array(ae),xt=be.o|0,Ke=be.p|0,Et=he.Math.floor,Pt=he.Math.abs,Ot=he.Math.sqrt,ht=he.Math.pow,Lt=he.Math.cos,Mt=he.Math.sin,Ht=he.Math.tan,Ur=he.Math.acos,Qt=he.Math.asin,en=he.Math.atan,cn=he.Math.atan2,Wr=he.Math.ceil,Jr=he.Math.imul,Vr=he.Math.min,yi=he.Math.max,Xr=he.Math.clz32,pr=be.b,Ie=be.c,Xt=be.d,tn=be.e,$i=be.f,ya=be.g,li=be.h,jn=be.i,Se=24160;function $o(y){return Be=new Int8Array(y),g=new Int32Array(y),ce=new Float64Array(y),ae=y,!0}function $n(y){y=y|0;var _=0;return _=Se,Se=Se+y|0,Se=Se+15&-16,_|0}function Wo(){return Se|0}function Oi(y){y=y|0,Se=y}function ui(y,_){y=y|0,Se=y}function Ii(y,_){y=y|0,_=_|0;var b=0,C=0,B=0;return(y|0)<0?(_=2,_|0):(y|0)>13780509?(_=Qo(15,_)|0,_|0):(b=((y|0)<0)<<31>>31,B=di(y|0,b|0,3,0)|0,C=Ie()|0,b=An(y|0,b|0,1,0)|0,b=di(B|0,C|0,b|0,Ie()|0)|0,b=An(b|0,Ie()|0,1,0)|0,y=Ie()|0,g[_>>2]=b,g[_+4>>2]=y,_=0,_|0)}function Rn(y,_,b,C){return y=y|0,_=_|0,b=b|0,C=C|0,ms(y,_,b,C,0)|0}function ms(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0;if(d=Se,Se=Se+16|0,O=d,!(Wi(y,_,b,C,B)|0))return C=0,Se=d,C|0;do if((b|0)>=0){if((b|0)>13780509){if(M=Qo(15,O)|0,M|0)break;l=O,O=g[l>>2]|0,l=g[l+4>>2]|0}else M=((b|0)<0)<<31>>31,h=di(b|0,M|0,3,0)|0,l=Ie()|0,M=An(b|0,M|0,1,0)|0,M=di(h|0,l|0,M|0,Ie()|0)|0,M=An(M|0,Ie()|0,1,0)|0,l=Ie()|0,g[O>>2]=M,g[O+4>>2]=l,O=M;if(ia(C|0,0,O<<3|0)|0,B|0){ia(B|0,0,O<<2|0)|0,M=Ns(y,_,b,C,B,O,l,0)|0;break}M=oo(O,4)|0,M?(h=Ns(y,_,b,C,M,O,l,0)|0,zr(M),M=h):M=13}else M=2;while(!1);return h=M,Se=d,h|0}function Wi(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0;if(z=Se,Se=Se+16|0,R=z,L=z+8|0,P=R,g[P>>2]=y,g[P+4>>2]=_,(b|0)<0)return L=2,Se=z,L|0;if(M=C,g[M>>2]=y,g[M+4>>2]=_,M=(B|0)!=0,M&&(g[B>>2]=0),Fn(y,_)|0)return L=9,Se=z,L|0;g[L>>2]=0;e:do if((b|0)>=1)if(M)for(m=1,h=0,T=0,P=1,M=y;;){if(!(h|T)){if(M=Sn(M,_,4,L,R)|0,M|0)break e;if(_=R,M=g[_>>2]|0,_=g[_+4>>2]|0,Fn(M,_)|0){M=9;break e}}if(M=Sn(M,_,g[22384+(T<<2)>>2]|0,L,R)|0,M|0)break e;if(_=R,M=g[_>>2]|0,_=g[_+4>>2]|0,y=C+(m<<3)|0,g[y>>2]=M,g[y+4>>2]=_,g[B+(m<<2)>>2]=P,y=h+1|0,O=(y|0)==(P|0),l=T+1|0,d=(l|0)==6,Fn(M,_)|0){M=9;break e}if(P=P+(d&O&1)|0,(P|0)>(b|0)){M=0;break}else m=m+1|0,h=O?0:y,T=O?d?0:l:T}else for(m=1,h=0,T=0,P=1,M=y;;){if(!(h|T)){if(M=Sn(M,_,4,L,R)|0,M|0)break e;if(_=R,M=g[_>>2]|0,_=g[_+4>>2]|0,Fn(M,_)|0){M=9;break e}}if(M=Sn(M,_,g[22384+(T<<2)>>2]|0,L,R)|0,M|0)break e;if(_=R,M=g[_>>2]|0,_=g[_+4>>2]|0,y=C+(m<<3)|0,g[y>>2]=M,g[y+4>>2]=_,y=h+1|0,O=(y|0)==(P|0),l=T+1|0,d=(l|0)==6,Fn(M,_)|0){M=9;break e}if(P=P+(d&O&1)|0,(P|0)>(b|0)){M=0;break}else m=m+1|0,h=O?0:y,T=O?d?0:l:T}else M=0;while(!1);return L=M,Se=z,L|0}function Ns(y,_,b,C,B,M,O,l){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0,M=M|0,O=O|0,l=l|0;var d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0;if(z=Se,Se=Se+16|0,R=z+8|0,L=z,d=To(y|0,_|0,M|0,O|0)|0,m=Ie()|0,T=C+(d<<3)|0,X=T,ee=g[X>>2]|0,X=g[X+4>>2]|0,h=(ee|0)==(y|0)&(X|0)==(_|0),!((ee|0)==0&(X|0)==0|h))do d=An(d|0,m|0,1,0)|0,d=os(d|0,Ie()|0,M|0,O|0)|0,m=Ie()|0,T=C+(d<<3)|0,ee=T,X=g[ee>>2]|0,ee=g[ee+4>>2]|0,h=(X|0)==(y|0)&(ee|0)==(_|0);while(!((X|0)==0&(ee|0)==0|h));if(d=B+(d<<2)|0,h&&(g[d>>2]|0)<=(l|0)||(ee=T,g[ee>>2]=y,g[ee+4>>2]=_,g[d>>2]=l,(l|0)>=(b|0)))return ee=0,Se=z,ee|0;switch(h=l+1|0,g[R>>2]=0,d=Sn(y,_,2,R,L)|0,d|0){case 9:{P=9;break}case 0:{d=L,d=Ns(g[d>>2]|0,g[d+4>>2]|0,b,C,B,M,O,h)|0,d||(P=9);break}}e:do if((P|0)==9){switch(g[R>>2]=0,d=Sn(y,_,3,R,L)|0,d|0){case 9:break;case 0:{if(d=L,d=Ns(g[d>>2]|0,g[d+4>>2]|0,b,C,B,M,O,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=Sn(y,_,1,R,L)|0,d|0){case 9:break;case 0:{if(d=L,d=Ns(g[d>>2]|0,g[d+4>>2]|0,b,C,B,M,O,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=Sn(y,_,5,R,L)|0,d|0){case 9:break;case 0:{if(d=L,d=Ns(g[d>>2]|0,g[d+4>>2]|0,b,C,B,M,O,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=Sn(y,_,4,R,L)|0,d|0){case 9:break;case 0:{if(d=L,d=Ns(g[d>>2]|0,g[d+4>>2]|0,b,C,B,M,O,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=Sn(y,_,6,R,L)|0,d|0){case 9:break;case 0:{if(d=L,d=Ns(g[d>>2]|0,g[d+4>>2]|0,b,C,B,M,O,h)|0,d|0)break e;break}default:break e}return ee=0,Se=z,ee|0}while(!1);return ee=d,Se=z,ee|0}function Sn(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0;if(b>>>0>6)return B=1,B|0;if(T=(g[C>>2]|0)%6|0,g[C>>2]=T,(T|0)>0){M=0;do b=xo(b)|0,M=M+1|0;while((M|0)<(g[C>>2]|0))}if(T=Jt(y|0,_|0,45)|0,Ie()|0,m=T&127,m>>>0>121)return B=5,B|0;d=ns(y,_)|0,M=Jt(y|0,_|0,52)|0,Ie()|0,M=M&15;e:do if(!M)h=8;else{for(;;){if(O=(15-M|0)*3|0,l=Jt(y|0,_|0,O|0)|0,Ie()|0,l=l&7,(l|0)==7){_=5;break}if(L=(zs(M)|0)==0,M=M+-1|0,P=tr(7,0,O|0)|0,_=_&~(Ie()|0),R=tr(g[(L?432:16)+(l*28|0)+(b<<2)>>2]|0,0,O|0)|0,O=Ie()|0,b=g[(L?640:224)+(l*28|0)+(b<<2)>>2]|0,y=R|y&~P,_=O|_,!b){b=0;break e}if(!M){h=8;break e}}return _|0}while(!1);(h|0)==8&&(L=g[848+(m*28|0)+(b<<2)>>2]|0,R=tr(L|0,0,45)|0,y=R|y,_=Ie()|0|_&-1040385,b=g[4272+(m*28|0)+(b<<2)>>2]|0,(L&127|0)==127&&(L=tr(g[848+(m*28|0)+20>>2]|0,0,45)|0,_=Ie()|0|_&-1040385,b=g[4272+(m*28|0)+20>>2]|0,y=wo(L|y,_)|0,_=Ie()|0,g[C>>2]=(g[C>>2]|0)+1)),l=Jt(y|0,_|0,45)|0,Ie()|0,l=l&127;e:do if(Ir(l)|0){t:do if((ns(y,_)|0)==1){if((m|0)!=(l|0))if(Af(l,g[7696+(m*28|0)>>2]|0)|0){y=Za(y,_)|0,O=1,_=Ie()|0;break}else Xt(23313,22416,436,22424);switch(d|0){case 3:{y=wo(y,_)|0,_=Ie()|0,g[C>>2]=(g[C>>2]|0)+1,O=0;break t}case 5:{y=Za(y,_)|0,_=Ie()|0,g[C>>2]=(g[C>>2]|0)+5,O=0;break t}case 0:return L=9,L|0;default:return L=1,L|0}}else O=0;while(!1);if((b|0)>0){M=0;do y=Sa(y,_)|0,_=Ie()|0,M=M+1|0;while((M|0)!=(b|0))}
4207if((m|0)!=(l|0)){if(!(fi(l)|0)){if((O|0)!=0|(ns(y,_)|0)!=5)break;g[C>>2]=(g[C>>2]|0)+1;break}switch(T&127){case 8:case 118:break e}(ns(y,_)|0)!=3&&(g[C>>2]=(g[C>>2]|0)+1)}}else if((b|0)>0){M=0;do y=wo(y,_)|0,_=Ie()|0,M=M+1|0;while((M|0)!=(b|0))}while(!1);return g[C>>2]=((g[C>>2]|0)+b|0)%6|0,L=B,g[L>>2]=y,g[L+4>>2]=_,L=0,L|0}function yl(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0;for(l=Se,Se=Se+16|0,M=l,O=l+8|0,B=(Fn(y,_)|0)==0,B=B?1:2;;){if(g[O>>2]=0,h=(Sn(y,_,B,O,M)|0)==0,d=M,h&((g[d>>2]|0)==(b|0)?(g[d+4>>2]|0)==(C|0):0)){y=4;break}if(B=B+1|0,B>>>0>=7){B=7,y=4;break}}return(y|0)==4?(Se=l,B|0):0}function xe(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0;if(L=Se,Se=Se+16|0,P=L,R=L+8|0,T=P,g[T>>2]=y,g[T+4>>2]=_,!b)return R=C,g[R>>2]=y,g[R+4>>2]=_,R=0,Se=L,R|0;g[R>>2]=0;e:do if(Fn(y,_)|0)y=9;else{if(M=(b|0)>0,M){B=0,T=y;do{if(y=Sn(T,_,4,R,P)|0,y|0)break e;if(_=P,T=g[_>>2]|0,_=g[_+4>>2]|0,B=B+1|0,Fn(T,_)|0){y=9;break e}}while((B|0)<(b|0));if(m=C,g[m>>2]=T,g[m+4>>2]=_,m=b+-1|0,M){h=0,y=1;do{if(B=22384+(h<<2)|0,(h|0)==5)for(O=g[B>>2]|0,M=0,B=y;;){if(y=P,y=Sn(g[y>>2]|0,g[y+4>>2]|0,O,R,P)|0,y|0)break e;if((M|0)!=(m|0))if(d=P,l=g[d>>2]|0,d=g[d+4>>2]|0,y=C+(B<<3)|0,g[y>>2]=l,g[y+4>>2]=d,!(Fn(l,d)|0))y=B+1|0;else{y=9;break e}else y=B;if(M=M+1|0,(M|0)>=(b|0))break;B=y}else for(O=P,d=g[B>>2]|0,l=0,B=y,M=g[O>>2]|0,O=g[O+4>>2]|0;;){if(y=Sn(M,O,d,R,P)|0,y|0)break e;if(O=P,M=g[O>>2]|0,O=g[O+4>>2]|0,y=C+(B<<3)|0,g[y>>2]=M,g[y+4>>2]=O,y=B+1|0,Fn(M,O)|0){y=9;break e}if(l=l+1|0,(l|0)>=(b|0))break;B=y}h=h+1|0}while(h>>>0<6);y=P,O=T,B=g[y>>2]|0,M=_,y=g[y+4>>2]|0}else O=T,B=T,M=_,y=_}else O=C,g[O>>2]=y,g[O+4>>2]=_,O=y,B=y,M=_,y=_;y=(O|0)==(B|0)&(M|0)==(y|0)?0:9}while(!1);return R=y,Se=L,R|0}function Pe(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0;if(l=Se,Se=Se+48|0,B=l+16|0,M=l+8|0,O=l,b|0)return O=15,Se=l,O|0;if(h=y,d=g[h+4>>2]|0,b=M,g[b>>2]=g[h>>2],g[b+4>>2]=d,_s(M,B),_=Jo(B,_,O)|0,!_){if(b=g[M>>2]|0,M=g[y+8>>2]|0,(M|0)>0){B=g[y+12>>2]|0,_=0;do b=(g[B+(_<<3)>>2]|0)+b|0,_=_+1|0;while((_|0)<(M|0))}_=O,B=g[_>>2]|0,_=g[_+4>>2]|0,M=((b|0)<0)<<31>>31,(_|0)<(M|0)|(_|0)==(M|0)&B>>>0<b>>>0?(_=O,g[_>>2]=b,g[_+4>>2]=M,_=M):b=B,d=An(b|0,_|0,12,0)|0,h=Ie()|0,_=O,g[_>>2]=d,g[_+4>>2]=h,_=C,g[_>>2]=d,g[_+4>>2]=h,_=0}return h=_,Se=l,h|0}function $e(y,_,b,C,B,M,O){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0,M=M|0,O=O|0;var l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0,Re=0,He=0,We=0,nt=0,Xe=0,Qe=0,pt=0,Dt=0,Ct=0,zt=0,sr=0,Er=0;if(Dt=Se,Se=Se+64|0,nt=Dt+48|0,Xe=Dt+32|0,Qe=Dt+24|0,we=Dt+8|0,Fe=Dt,d=g[y>>2]|0,(d|0)<=0)return pt=0,Se=Dt,pt|0;for(ge=y+4|0,Re=nt+8|0,He=Xe+8|0,We=we+8|0,l=0,te=0;;){h=g[ge>>2]|0,Z=h+(te<<4)|0,g[nt>>2]=g[Z>>2],g[nt+4>>2]=g[Z+4>>2],g[nt+8>>2]=g[Z+8>>2],g[nt+12>>2]=g[Z+12>>2],(te|0)==(d+-1|0)?(g[Xe>>2]=g[h>>2],g[Xe+4>>2]=g[h+4>>2],g[Xe+8>>2]=g[h+8>>2],g[Xe+12>>2]=g[h+12>>2]):(Z=h+(te+1<<4)|0,g[Xe>>2]=g[Z>>2],g[Xe+4>>2]=g[Z+4>>2],g[Xe+8>>2]=g[Z+8>>2],g[Xe+12>>2]=g[Z+12>>2]),d=ba(nt,Xe,C,Qe)|0;e:do if(d)h=0,l=d;else if(h=Qe,d=g[h>>2]|0,h=g[h+4>>2]|0,(h|0)>0|(h|0)==0&d>>>0>0){ee=0,Z=0;t:for(;;){if(Er=+ce[nt>>3],X=Kr(d|0,h|0,ee|0,Z|0)|0,sr=+(X>>>0)+4294967296*+(Ie()|0),Ct=+(d>>>0)+4294967296*+(h|0),zt=+(ee>>>0)+4294967296*+(Z|0),ce[we>>3]=Er*sr/Ct+ +ce[Xe>>3]*zt/Ct,ce[We>>3]=+ce[Re>>3]*sr/Ct+ +ce[He>>3]*zt/Ct,d=Qa(we,C,Fe)|0,d|0){l=d;break}X=Fe,z=g[X>>2]|0,X=g[X+4>>2]|0,P=To(z|0,X|0,_|0,b|0)|0,m=Ie()|0,d=O+(P<<3)|0,T=d,h=g[T>>2]|0,T=g[T+4>>2]|0;r:do if((h|0)==0&(T|0)==0)oe=d,pt=16;else for(R=0,L=0;;){if((R|0)>(b|0)|(R|0)==(b|0)&L>>>0>_>>>0){l=1;break t}if((h|0)==(z|0)&(T|0)==(X|0))break r;if(d=An(P|0,m|0,1,0)|0,P=os(d|0,Ie()|0,_|0,b|0)|0,m=Ie()|0,L=An(L|0,R|0,1,0)|0,R=Ie()|0,d=O+(P<<3)|0,T=d,h=g[T>>2]|0,T=g[T+4>>2]|0,(h|0)==0&(T|0)==0){oe=d,pt=16;break}}while(!1);if((pt|0)==16&&(pt=0,!((z|0)==0&(X|0)==0))&&(L=oe,g[L>>2]=z,g[L+4>>2]=X,L=M+(g[B>>2]<<3)|0,g[L>>2]=z,g[L+4>>2]=X,L=B,L=An(g[L>>2]|0,g[L+4>>2]|0,1,0)|0,z=Ie()|0,X=B,g[X>>2]=L,g[X+4>>2]=z),ee=An(ee|0,Z|0,1,0)|0,Z=Ie()|0,h=Qe,d=g[h>>2]|0,h=g[h+4>>2]|0,!((h|0)>(Z|0)|(h|0)==(Z|0)&d>>>0>ee>>>0)){h=1;break e}}h=0}else h=1;while(!1);if(te=te+1|0,!h){pt=21;break}if(d=g[y>>2]|0,(te|0)>=(d|0)){l=0,pt=21;break}}return(pt|0)==21?(Se=Dt,l|0):0}function gt(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0,Re=0,He=0,We=0,nt=0,Xe=0,Qe=0,pt=0,Dt=0,Ct=0,zt=0,sr=0;if(sr=Se,Se=Se+112|0,pt=sr+80|0,d=sr+72|0,Dt=sr,Ct=sr+56|0,b|0)return zt=15,Se=sr,zt|0;if(h=y+8|0,zt=Jn((g[h>>2]<<5)+32|0)|0,!zt)return zt=13,Se=sr,zt|0;if(wf(y,zt),Xe=y,Qe=g[Xe+4>>2]|0,b=d,g[b>>2]=g[Xe>>2],g[b+4>>2]=Qe,_s(d,pt),b=Jo(pt,_,Dt)|0,b)Xe=0,Qe=0;else{if(b=g[d>>2]|0,M=g[h>>2]|0,(M|0)>0){O=g[y+12>>2]|0,B=0;do b=(g[O+(B<<3)>>2]|0)+b|0,B=B+1|0;while((B|0)!=(M|0));B=b}else B=b;b=Dt,M=g[b>>2]|0,b=g[b+4>>2]|0,O=((B|0)<0)<<31>>31,(b|0)<(O|0)|(b|0)==(O|0)&M>>>0<B>>>0?(b=Dt,g[b>>2]=B,g[b+4>>2]=O,b=O):B=M,Xe=An(B|0,b|0,12,0)|0,Qe=Ie()|0,b=Dt,g[b>>2]=Xe,g[b+4>>2]=Qe,b=0}if(b|0)return zr(zt),zt=b,Se=sr,zt|0;if(B=oo(Xe,8)|0,!B)return zr(zt),zt=13,Se=sr,zt|0;if(l=oo(Xe,8)|0,!l)return zr(zt),zr(B),zt=13,Se=sr,zt|0;We=pt,g[We>>2]=0,g[We+4>>2]=0,We=y,nt=g[We+4>>2]|0,b=d,g[b>>2]=g[We>>2],g[b+4>>2]=nt,b=$e(d,Xe,Qe,_,pt,B,l)|0;e:do if(b)zr(B),zr(l),zr(zt);else{t:do if((g[h>>2]|0)>0){for(O=y+12|0,M=0;b=$e((g[O>>2]|0)+(M<<3)|0,Xe,Qe,_,pt,B,l)|0,M=M+1|0,!(b|0);)if((M|0)>=(g[h>>2]|0))break t;zr(B),zr(l),zr(zt);break e}while(!1);(Qe|0)>0|(Qe|0)==0&Xe>>>0>0&&ia(l|0,0,Xe<<3|0)|0,nt=pt,We=g[nt+4>>2]|0;
4207t:do if((We|0)>0|(We|0)==0&(g[nt>>2]|0)>>>0>0){ge=B,Re=l,He=B,We=l,nt=B,b=B,oe=B,we=l,Fe=l,B=l;r:for(;;){for(X=0,ee=0,Z=0,te=0,M=0,O=0;;){l=Dt,d=l+56|0;do g[l>>2]=0,l=l+4|0;while((l|0)<(d|0));if(_=ge+(X<<3)|0,h=g[_>>2]|0,_=g[_+4>>2]|0,Wi(h,_,1,Dt,0)|0){l=Dt,d=l+56|0;do g[l>>2]=0,l=l+4|0;while((l|0)<(d|0));l=oo(7,4)|0,l|0&&(Ns(h,_,1,Dt,l,7,0,0)|0,zr(l))}for(z=0;;){L=Dt+(z<<3)|0,R=g[L>>2]|0,L=g[L+4>>2]|0;n:do if((R|0)==0&(L|0)==0)l=M,d=O;else{if(m=To(R|0,L|0,Xe|0,Qe|0)|0,h=Ie()|0,l=C+(m<<3)|0,_=l,d=g[_>>2]|0,_=g[_+4>>2]|0,!((d|0)==0&(_|0)==0)){T=0,P=0;do{if((T|0)>(Qe|0)|(T|0)==(Qe|0)&P>>>0>Xe>>>0)break r;if((d|0)==(R|0)&(_|0)==(L|0)){l=M,d=O;break n}l=An(m|0,h|0,1,0)|0,m=os(l|0,Ie()|0,Xe|0,Qe|0)|0,h=Ie()|0,P=An(P|0,T|0,1,0)|0,T=Ie()|0,l=C+(m<<3)|0,_=l,d=g[_>>2]|0,_=g[_+4>>2]|0}while(!((d|0)==0&(_|0)==0))}(R|0)==0&(L|0)==0?(l=M,d=O):(Oc(R,L,Ct)|0,Yt(y,zt,Ct)|0&&(P=An(M|0,O|0,1,0)|0,O=Ie()|0,T=l,g[T>>2]=R,g[T+4>>2]=L,M=Re+(M<<3)|0,g[M>>2]=R,g[M+4>>2]=L,M=P),l=M,d=O)}while(!1);if(z=z+1|0,z>>>0>=7)break;M=l,O=d}if(X=An(X|0,ee|0,1,0)|0,ee=Ie()|0,Z=An(Z|0,te|0,1,0)|0,te=Ie()|0,O=pt,M=g[O>>2]|0,O=g[O+4>>2]|0,(te|0)<(O|0)|(te|0)==(O|0)&Z>>>0<M>>>0)M=l,O=d;else break}if((O|0)>0|(O|0)==0&M>>>0>0){M=0,O=0;do te=ge+(M<<3)|0,g[te>>2]=0,g[te+4>>2]=0,M=An(M|0,O|0,1,0)|0,O=Ie()|0,te=pt,Z=g[te+4>>2]|0;while((O|0)<(Z|0)|((O|0)==(Z|0)?M>>>0<(g[te>>2]|0)>>>0:0))}if(te=pt,g[te>>2]=l,g[te+4>>2]=d,(d|0)>0|(d|0)==0&l>>>0>0)z=B,X=Fe,ee=nt,Z=we,te=Re,B=oe,Fe=b,we=He,oe=z,b=X,nt=We,We=ee,He=Z,Re=ge,ge=te;else break t}zr(He),zr(We),zr(zt),b=1;break e}else b=l;while(!1);zr(zt),zr(B),zr(b),b=0}while(!1);return zt=b,Se=sr,zt|0}function Wt(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0;if(m=Se,Se=Se+176|0,d=m,(_|0)<1)return Ia(b,0,0),h=0,Se=m,h|0;for(l=y,l=Jt(g[l>>2]|0,g[l+4>>2]|0,52)|0,Ie()|0,Ia(b,(_|0)>6?_:6,l&15),l=0;C=y+(l<<3)|0,C=Lc(g[C>>2]|0,g[C+4>>2]|0,d)|0,!(C|0);){if(C=g[d>>2]|0,(C|0)>0){O=0;do M=d+8+(O<<4)|0,O=O+1|0,C=d+8+(((O|0)%(C|0)|0)<<4)|0,B=wr(b,C,M)|0,B?ss(b,B)|0:Rl(b,M,C)|0,C=g[d>>2]|0;while((O|0)<(C|0))}if(l=l+1|0,(l|0)>=(_|0)){C=0,h=13;break}}return(h|0)==13?(Se=m,C|0):(ra(b),h=C,Se=m,h|0)}function vr(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0;if(M=Se,Se=Se+32|0,C=M,B=M+16|0,y=Wt(y,_,B)|0,y|0)return b=y,Se=M,b|0;if(g[b>>2]=0,g[b+4>>2]=0,g[b+8>>2]=0,y=so(B)|0,y|0)do{_=iA(b)|0;do sA(_,y)|0,O=y+16|0,g[C>>2]=g[O>>2],g[C+4>>2]=g[O+4>>2],g[C+8>>2]=g[O+8>>2],g[C+12>>2]=g[O+12>>2],ss(B,y)|0,y=ur(B,C)|0;while((y|0)!=0);y=so(B)|0}while((y|0)!=0);return ra(B),y=Pl(b)|0,y?(zc(b),O=y,Se=M,O|0):(O=0,Se=M,O|0)}function Ir(y){return y=y|0,y>>>0>121?(y=0,y|0):(y=g[7696+(y*28|0)+16>>2]|0,y|0)}function fi(y){return y=y|0,(y|0)==4|(y|0)==117|0}function Li(y){return y=y|0,g[11120+((g[y>>2]|0)*216|0)+((g[y+4>>2]|0)*72|0)+((g[y+8>>2]|0)*24|0)+(g[y+12>>2]<<3)>>2]|0}function Ji(y){return y=y|0,g[11120+((g[y>>2]|0)*216|0)+((g[y+4>>2]|0)*72|0)+((g[y+8>>2]|0)*24|0)+(g[y+12>>2]<<3)+4>>2]|0}function Qs(y,_){y=y|0,_=_|0,y=7696+(y*28|0)|0,g[_>>2]=g[y>>2],g[_+4>>2]=g[y+4>>2],g[_+8>>2]=g[y+8>>2],g[_+12>>2]=g[y+12>>2]}function Ph(y,_){y=y|0,_=_|0;var b=0,C=0;if(_>>>0>20)return _=-1,_|0;do if((g[11120+(_*216|0)>>
42072]|0)!=(y|0))if((g[11120+(_*216|0)+8>>2]|0)!=(y|0))if((g[11120+(_*216|0)+16>>2]|0)!=(y|0))if((g[11120+(_*216|0)+24>>2]|0)!=(y|0))if((g[11120+(_*216|0)+32>>2]|0)!=(y|0))if((g[11120+(_*216|0)+40>>2]|0)!=(y|0))if((g[11120+(_*216|0)+48>>2]|0)!=(y|0))if((g[11120+(_*216|0)+56>>2]|0)!=(y|0))if((g[11120+(_*216|0)+64>>2]|0)!=(y|0))if((g[11120+(_*216|0)+72>>2]|0)!=(y|0))if((g[11120+(_*216|0)+80>>2]|0)!=(y|0))if((g[11120+(_*216|0)+88>>2]|0)!=(y|0))if((g[11120+(_*216|0)+96>>2]|0)!=(y|0))if((g[11120+(_*216|0)+104>>2]|0)!=(y|0))if((g[11120+(_*216|0)+112>>2]|0)!=(y|0))if((g[11120+(_*216|0)+120>>2]|0)!=(y|0))if((g[11120+(_*216|0)+128>>2]|0)!=(y|0))if((g[11120+(_*216|0)+136>>2]|0)==(y|0))y=2,b=1,C=2;else{if((g[11120+(_*216|0)+144>>2]|0)==(y|0)){y=0,b=2,C=0;break}if((g[11120+(_*216|0)+152>>2]|0)==(y|0)){y=0,b=2,C=1;break}if((g[11120+(_*216|0)+160>>2]|0)==(y|0)){y=0,b=2,C=2;break}if((g[11120+(_*216|0)+168>>2]|0)==(y|0)){y=1,b=2,C=0;break}if((g[11120+(_*216|0)+176>>2]|0)==(y|0)){y=1,b=2,C=1;break}if((g[11120+(_*216|0)+184>>2]|0)==(y|0)){y=1,b=2,C=2;break}if((g[11120+(_*216|0)+192>>2]|0)==(y|0)){y=2,b=2,C=0;break}if((g[11120+(_*216|0)+200>>2]|0)==(y|0)){y=2,b=2,C=1;break}if((g[11120+(_*216|0)+208>>2]|0)==(y|0)){y=2,b=2,C=2;break}else y=-1;return y|0}else y=2,b=1,C=1;else y=2,b=1,C=0;else y=1,b=1,C=2;else y=1,b=1,C=1;else y=1,b=1,C=0;else y=0,b=1,C=2;else y=0,b=1,C=1;else y=0,b=1,C=0;else y=2,b=0,C=2;else y=2,b=0,C=1;else y=2,b=0,C=0;else y=1,b=0,C=2;else y=1,b=0,C=1;else y=1,b=0,C=0;else y=0,b=0,C=2;else y=0,b=0,C=1;else y=0,b=0,C=0;while(!1);return _=g[11120+(_*216|0)+(b*72|0)+(y*24|0)+(C<<3)+4>>2]|0,_|0}function Af(y,_){return y=y|0,_=_|0,(g[7696+(y*28|0)+20>>2]|0)==(_|0)?(_=1,_|0):(_=(g[7696+(y*28|0)+24>>2]|0)==(_|0),_|0)}function va(y,_){return y=y|0,_=_|0,g[848+(y*28|0)+(_<<2)>>2]|0}function vl(y,_){return y=y|0,_=_|0,(g[848+(y*28|0)>>2]|0)==(_|0)?(_=0,_|0):(g[848+(y*28|0)+4>>2]|0)==(_|0)?(_=1,_|0):(g[848+(y*28|0)+8>>2]|0)==(_|0)?(_=2,_|0):(g[848+(y*28|0)+12>>2]|0)==(_|0)?(_=3,_|0):(g[848+(y*28|0)+16>>2]|0)==(_|0)?(_=4,_|0):(g[848+(y*28|0)+20>>2]|0)==(_|0)?(_=5,_|0):((g[848+(y*28|0)+24>>2]|0)==(_|0)?6:7)|0}function bl(){return 122}function Rh(y){y=y|0;var _=0,b=0,C=0;_=0;do tr(_|0,0,45)|0,C=Ie()|0|134225919,b=y+(_<<3)|0,g[b>>2]=-1,g[b+4>>2]=C,_=_+1|0;while((_|0)!=122);return 0}function xl(y){return y=y|0,+ce[y+16>>3]<+ce[y+24>>3]|0}function Us(y,_){y=y|0,_=_|0;var b=0,C=0,B=0;return b=+ce[_>>3],!(b>=+ce[y+8>>3])||!(b<=+ce[y>>3])?(_=0,_|0):(C=+ce[y+16>>3],b=+ce[y+24>>3],B=+ce[_+8>>3],_=B>=b,y=B<=C&1,C<b?_&&(y=1):_||(y=0),_=(y|0)!=0,_|0)}function Jo(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0;L=Se,Se=Se+288|0,m=L+264|0,T=L+96|0,h=L,l=h,d=l+96|0;do g[l>>2]=0,l=l+4|0;while((l|0)<(d|0));return _=El(_,h)|0,_|0?(R=_,Se=L,R|0):(d=h,h=g[d>>2]|0,d=g[d+4>>2]|0,Oc(h,d,m)|0,Lc(h,d,T)|0,O=+nc(m,T+8|0),ce[m>>3]=+ce[y>>3],d=m+8|0,ce[d>>3]=+ce[y+16>>3],ce[T>>3]=+ce[y+8>>3],h=T+8|0,ce[h>>3]=+ce[y+24>>3],B=+nc(m,T),X=+ce[d>>3]-+ce[h>>3],M=+Pt(+X),z=+ce[m>>3]-+ce[T>>3],C=+Pt(+z),!(X==0|z==0)&&(X=+Hc(+M,+C),X=+Wr(+(B*B/+Fl(+(X/+Fl(+M,+C)),3)/(O*(O*2.59807621135)*.8))),ce[xt>>3]=X,P=~~X>>>0,R=+Pt(X)>=1?X>0?~~+Vr(+Et(X/4294967296),4294967295)>>>0:~~+Wr((X-+(~~X>>>0))/4294967296)>>>0:0,(g[xt+4>>2]&2146435072|0)!=2146435072)?(T=(P|0)==0&(R|0)==0,_=b,g[_>>2]=T?1:P,g[_+4>>2]=T?0:R,_=0):_=1,R=_,Se=L,R|0)}function ba(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0;h=Se,Se=Se+288|0,O=h+264|0,l=h+96|0,d=h,B=d,M=B+96|0;do g[B>>2]=0,B=B+4|0;while((B|0)<(M|0));return b=El(b,d)|0,b|0?(C=b,Se=h,C|0):(b=d,B=g[b>>2]|0,b=g[b+4>>2]|0,Oc(B,b,O)|0,Lc(B,b,l)|0,m=+nc(O,l+8|0),m=+Wr(+(+nc(y,_)/(m*2))),ce[xt>>3]=m,b=~~m>>>0,B=+Pt(m)>=1?m>0?~~+Vr(+Et(m/4294967296),4294967295)>>>0:~~+Wr((m-+(~~m>>>0))/4294967296)>>>0:0,(g[xt+4>>2]&2146435072|0)==2146435072?(C=1,Se=h,C|0):(d=(b|0)==0&(B|0)==0,g[C>>2]=d?1:b,g[C+4>>2]=d?0:B,C=0,Se=h,C|0))}function Wa(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0,g[y>>2]=_,g[y+4>>2]=b,g[y+8>>2]=C}function xa(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0;T=_+8|0,g[T>>2]=0,d=+ce[y>>3],O=+Pt(+d),h=+ce[y+8>>3],l=+Pt(+h)/.8660254037844386,O=O+l*.5,b=~~O,y=~~l,O=O-+(b|0),l=l-+(y|0);do if(O<.5)if(O<.3333333333333333)if(g[_>>2]=b,l<(O+1)*.5){g[_+4>>2]=y;break}else{y=y+1|0,g[_+4>>2]=y;break}else if(P=1-O,y=(!(l<P)&1)+y|0,g[_+4>>2]=y,P<=l&l<O*2){b=b+1|0,g[_>>2]=b;break}else{g[_>>2]=b;break}else{if(!(O<.6666666666666666))if(b=b+1|0,g[_>>2]=b,l<O*.5){g[_+4>>2]=y;break}else{y=y+1|0,g[_+4>>2]=y;break}if(l<1-O){if(g[_+4>>2]=y,O*2+-1<l){g[_>>2]=b;break}}else y=y+1|0,g[_+4>>2]=y;
4207b=b+1|0,g[_>>2]=b}while(!1);do if(d<0)if(y&1){m=(y+1|0)/2|0,m=Kr(b|0,((b|0)<0)<<31>>31|0,m|0,((m|0)<0)<<31>>31|0)|0,b=~~(+(b|0)-((+(m>>>0)+4294967296*+(Ie()|0))*2+1)),g[_>>2]=b;break}else{m=(y|0)/2|0,m=Kr(b|0,((b|0)<0)<<31>>31|0,m|0,((m|0)<0)<<31>>31|0)|0,b=~~(+(b|0)-(+(m>>>0)+4294967296*+(Ie()|0))*2),g[_>>2]=b;break}while(!1);m=_+4|0,h<0&&(b=b-((y<<1|1|0)/2|0)|0,g[_>>2]=b,y=0-y|0,g[m>>2]=y),C=y-b|0,(b|0)<0?(B=0-b|0,g[m>>2]=C,g[T>>2]=B,g[_>>2]=0,y=C,b=0):B=0,(y|0)<0&&(b=b-y|0,g[_>>2]=b,B=B-y|0,g[T>>2]=B,g[m>>2]=0,y=0),M=b-B|0,C=y-B|0,(B|0)<0&&(g[_>>2]=M,g[m>>2]=C,g[T>>2]=0,y=C,b=M,B=0),C=(y|0)<(b|0)?y:b,C=(B|0)<(C|0)?B:C,!((C|0)<=0)&&(g[_>>2]=b-C,g[m>>2]=y-C,g[T>>2]=B-C)}function vi(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0;_=g[y>>2]|0,O=y+4|0,b=g[O>>2]|0,(_|0)<0&&(b=b-_|0,g[O>>2]=b,M=y+8|0,g[M>>2]=(g[M>>2]|0)-_,g[y>>2]=0,_=0),(b|0)<0?(_=_-b|0,g[y>>2]=_,M=y+8|0,B=(g[M>>2]|0)-b|0,g[M>>2]=B,g[O>>2]=0,b=0):(B=y+8|0,M=B,B=g[B>>2]|0),(B|0)<0&&(_=_-B|0,g[y>>2]=_,b=b-B|0,g[O>>2]=b,g[M>>2]=0,B=0),C=(b|0)<(_|0)?b:_,C=(B|0)<(C|0)?B:C,!((C|0)<=0)&&(g[y>>2]=_-C,g[O>>2]=b-C,g[M>>2]=B-C)}function Ro(y,_){y=y|0,_=_|0;var b=0,C=0;C=g[y+8>>2]|0,b=+((g[y+4>>2]|0)-C|0),ce[_>>3]=+((g[y>>2]|0)-C|0)-b*.5,ce[_+8>>3]=b*.8660254037844386}function zn(y,_,b){y=y|0,_=_|0,b=b|0,g[b>>2]=(g[_>>2]|0)+(g[y>>2]|0),g[b+4>>2]=(g[_+4>>2]|0)+(g[y+4>>2]|0),g[b+8>>2]=(g[_+8>>2]|0)+(g[y+8>>2]|0)}function hi(y,_,b){y=y|0,_=_|0,b=b|0,g[b>>2]=(g[y>>2]|0)-(g[_>>2]|0),g[b+4>>2]=(g[y+4>>2]|0)-(g[_+4>>2]|0),g[b+8>>2]=(g[y+8>>2]|0)-(g[_+8>>2]|0)}function Ja(y,_){y=y|0,_=_|0;var b=0,C=0;b=Jr(g[y>>2]|0,_)|0,g[y>>2]=b,b=y+4|0,C=Jr(g[b>>2]|0,_)|0,g[b>>2]=C,y=y+8|0,_=Jr(g[y>>2]|0,_)|0,g[y>>2]=_}function wl(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;O=g[y>>2]|0,l=(O|0)<0,C=(g[y+4>>2]|0)-(l?O:0)|0,M=(C|0)<0,B=(M?0-C|0:0)+((g[y+8>>2]|0)-(l?O:0))|0,b=(B|0)<0,y=b?0:B,_=(M?0:C)-(b?B:0)|0,B=(l?0:O)-(M?C:0)-(b?B:0)|0,b=(_|0)<(B|0)?_:B,b=(y|0)<(b|0)?y:b,C=(b|0)>0,y=y-(C?b:0)|0,_=_-(C?b:0)|0;e:do switch(B-(C?b:0)|0){case 0:switch(_|0){case 0:return l=(y|0)==0?0:(y|0)==1?1:7,l|0;case 1:return l=(y|0)==0?2:(y|0)==1?3:7,l|0;default:break e}case 1:switch(_|0){case 0:return l=(y|0)==0?4:(y|0)==1?5:7,l|0;case 1:{if(!y)y=6;else break e;return y|0}default:break e}}while(!1);return l=7,l|0}function Qp(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;O=y+8|0,B=g[O>>2]|0,M=(g[y>>2]|0)-B|0,l=y+4|0,B=(g[l>>2]|0)-B|0;do if(M>>>0>715827881|B>>>0>715827881){if(b=(M|0)>0,b){if((2147483647-M|0)<(M|0)||(2147483647-(M<<1)|0)<(M|0))return l=1,l|0}else if((-2147483648-M|0)>(M|0)||(-2147483648-(M<<1)|0)>(M|0))return l=1,l|0;if(_=M*3|0,(B|0)>0){if((2147483647-B|0)<(B|0))return l=1,l|0}else if((-2147483648-B|0)>(B|0))return l=1,l|0;if(C=B<<1,(M|0)>-1){if((_|-2147483648|0)>=(B|0))return l=1,l|0}else if((_^-2147483648|0)<(B|0))return l=1,l|0;if(b){if((2147483647-M|0)<(C|0))_=1;else{b=C;break}return _|0}else{if((-2147483648-M|0)>(C|0))_=1;else{b=C;break}return _|0}}else b=B<<1,_=M*3|0;while(!1);C=Ki(+(_-B|0)/7)|0,g[y>>2]=C,B=Ki(+(b+M|0)/7)|0,g[l>>2]=B,g[O>>2]=0,b=(B|0)<(C|0),_=b?C:B,b=b?B:C;do if((b|0)<0){if((_|0)>0){if((_|-2147483648|0)<(b|0)&((b|0)!=-2147483648&(2147483647-_|0)>=(b|0)))break;Xt(23313,22444,355,22455)}if((b|0)==-2147483648|(-2147483648-_|0)>(b|0)&&Xt(23313,22444,355,22455),(_|0)>-1){if((_|-2147483648|0)<(b|0))break;Xt(23313,22444,355,22455)}else{if((_^-2147483648|0)>=(b|0))break;Xt(23313,22444,355,22455)}}while(!1);return _=B-C|0,(C|0)<0?(b=0-C|0,g[l>>2]=_,g[O>>2]=b,g[y>>2]=0,C=0):(_=B,b=0),(_|0)<0&&(C=C-_|0,g[y>>2]=C,b=b-_|0,g[O>>2]=b,g[l>>2]=0,_=0),M=C-b|0,B=_-b|0,(b|0)<0?(g[y>>2]=M,g[l>>2]=B,g[O>>2]=0,_=B,B=M,b=0):B=C,C=(_|0)<(B|0)?_:B,C=(b|0)<(C|0)?b:C,(C|0)<=0?(l=0,l|0):(g[y>>2]=B-C,g[l>>2]=_-C,g[O>>2]=b-C,l=0,l|0)}function eA(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;O=y+8|0,B=g[O>>2]|0,M=(g[y>>2]|0)-B|0,l=y+4|0,B=(g[l>>2]|0)-B|0;do if(M>>>0>715827881|B>>>0>715827881){if(b=(M|0)>0,b){if((2147483647-M|0)<(M|0))return l=1,l|0}else if((-2147483648-M|0)>(M|0))return l=1,l|0;if(_=M<<1,(B|0)>0){if((2147483647-B|0)<(B|0)||(2147483647-(B<<1)|0)<(B|0))return l=1,l|0}else if((-2147483648-B|0)>(B|0)||(-2147483648-(B<<1)|0)>(B|0))return l=1,l|0;if(C=B*3|0,b){if((2147483647-_|0)<(B|0))return l=1,l|0}else if((-2147483648-_|0)>(B|0))return l=1,l|0;if((B|0)>-1){if((C|-2147483648|0)<(M|0)){b=C;break}else _=1;return _|0}else{if((C^-2147483648|0)<(M|0))_=1;else{b=C;break}return _|0}}else b=B*3|0,_=M<<1;while(!1);C=Ki(+(_+B|0)/7)|0,g[y>>2]=C,B=Ki(+(b-M|0)/7)|0,g[l>>2]=B,g[O>>2]=0,b=(B|0)<(C|0),_=b?C:B,b=b?B:C;do if((b|0)<0){if((_|0)>0){if((_|-2147483648|0)<(b|0)&((b|0)!=-2147483648&(2147483647-_|0)>=(b|0)))break;Xt(23313,22444,404,22469)}if((b|0)==-2147483648|(-2147483648-_|0)>(b|0)&&Xt(23313,22444,404,22469),(_|0)>-1){if((_|-2147483648|0)<(b|0))break;Xt(23313,22444,404,22469)}else{if((_^-2147483648|0)>=(b|0))break;Xt(23313,22444,404,22469)}}while(!1);return _=B-C|0,(C|0)<0?(b=0-C|0,g[l>>2]=_,g[O>>2]=b,g[y>>2]=0,C=0):(_=B,b=0),(_|0)<0&&(C=C-_|0,g[y>>2]=C,b=b-_|0,g[O>>2]=b,g[l>>2]=0,_=0),M=C-b|0,B=_-b|0,(b|0)<0?(g[y>>2]=M,g[l>>2]=B,g[O>>2]=0,_=B,B=M,b=0):B=C,C=(_|0)<(B|0)?_:B,C=(b|0)<(C|0)?b:C,(C|0)<=0?(l=0,l|0):(g[y>>2]=B-C,g[l>>2]=_-C,g[O>>2]=b-C,l=0,l|0)}function gf(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;O=y+8|0,b=g[O>>2]|0,_=(g[y>>2]|0)-b|0,l=y+4|0,b=(g[l>>2]|0)-b|0,C=Ki(+((_*3|0)-b|0)/7)|0,g[y>>2]=C,_=Ki(+((b<<1)+_|0)/7)|0,g[l>>2]=_,g[O>>2]=0,b=_-C|0,(C|0)<0?(M=0-C|0,g[l>>2]=b,g[O>>2]=M,g[y>>
42072]=0,_=b,C=0,b=M):b=0,(_|0)<0&&(C=C-_|0,g[y>>2]=C,b=b-_|0,g[O>>2]=b,g[l>>2]=0,_=0),M=C-b|0,B=_-b|0,(b|0)<0?(g[y>>2]=M,g[l>>2]=B,g[O>>2]=0,_=B,B=M,b=0):B=C,C=(_|0)<(B|0)?_:B,C=(b|0)<(C|0)?b:C,!((C|0)<=0)&&(g[y>>2]=B-C,g[l>>2]=_-C,g[O>>2]=b-C)}function au(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;O=y+8|0,b=g[O>>2]|0,_=(g[y>>2]|0)-b|0,l=y+4|0,b=(g[l>>2]|0)-b|0,C=Ki(+((_<<1)+b|0)/7)|0,g[y>>2]=C,_=Ki(+((b*3|0)-_|0)/7)|0,g[l>>2]=_,g[O>>2]=0,b=_-C|0,(C|0)<0?(M=0-C|0,g[l>>2]=b,g[O>>2]=M,g[y>>2]=0,_=b,C=0,b=M):b=0,(_|0)<0&&(C=C-_|0,g[y>>2]=C,b=b-_|0,g[O>>2]=b,g[l>>2]=0,_=0),M=C-b|0,B=_-b|0,(b|0)<0?(g[y>>2]=M,g[l>>2]=B,g[O>>2]=0,_=B,B=M,b=0):B=C,C=(_|0)<(B|0)?_:B,C=(b|0)<(C|0)?b:C,!((C|0)<=0)&&(g[y>>2]=B-C,g[l>>2]=_-C,g[O>>2]=b-C)}function Pc(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;_=g[y>>2]|0,O=y+4|0,b=g[O>>2]|0,l=y+8|0,C=g[l>>2]|0,B=b+(_*3|0)|0,g[y>>2]=B,b=C+(b*3|0)|0,g[O>>2]=b,_=(C*3|0)+_|0,g[l>>2]=_,C=b-B|0,(B|0)<0?(_=_-B|0,g[O>>2]=C,g[l>>2]=_,g[y>>2]=0,b=C,C=0):C=B,(b|0)<0&&(C=C-b|0,g[y>>2]=C,_=_-b|0,g[l>>2]=_,g[O>>2]=0,b=0),M=C-_|0,B=b-_|0,(_|0)<0?(g[y>>2]=M,g[O>>2]=B,g[l>>2]=0,C=M,_=0):B=b,b=(B|0)<(C|0)?B:C,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=C-b,g[O>>2]=B-b,g[l>>2]=_-b)}function Xo(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;B=g[y>>2]|0,O=y+4|0,_=g[O>>2]|0,l=y+8|0,b=g[l>>2]|0,C=(_*3|0)+B|0,B=b+(B*3|0)|0,g[y>>2]=B,g[O>>2]=C,_=(b*3|0)+_|0,g[l>>2]=_,b=C-B|0,(B|0)<0?(_=_-B|0,g[O>>2]=b,g[l>>2]=_,g[y>>2]=0,B=0):b=C,(b|0)<0&&(B=B-b|0,g[y>>2]=B,_=_-b|0,g[l>>2]=_,g[O>>2]=0,b=0),M=B-_|0,C=b-_|0,(_|0)<0?(g[y>>2]=M,g[O>>2]=C,g[l>>2]=0,B=M,_=0):C=b,b=(C|0)<(B|0)?C:B,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=B-b,g[O>>2]=C-b,g[l>>2]=_-b)}function mf(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0;(_+-1|0)>>>0>=6||(B=(g[15440+(_*12|0)>>2]|0)+(g[y>>2]|0)|0,g[y>>2]=B,l=y+4|0,C=(g[15440+(_*12|0)+4>>2]|0)+(g[l>>2]|0)|0,g[l>>2]=C,O=y+8|0,_=(g[15440+(_*12|0)+8>>2]|0)+(g[O>>2]|0)|0,g[O>>2]=_,b=C-B|0,(B|0)<0?(_=_-B|0,g[l>>2]=b,g[O>>2]=_,g[y>>2]=0,C=0):(b=C,C=B),(b|0)<0&&(C=C-b|0,g[y>>2]=C,_=_-b|0,g[O>>2]=_,g[l>>2]=0,b=0),M=C-_|0,B=b-_|0,(_|0)<0?(g[y>>2]=M,g[l>>2]=B,g[O>>2]=0,C=M,_=0):B=b,b=(B|0)<(C|0)?B:C,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=C-b,g[l>>2]=B-b,g[O>>2]=_-b))}function _f(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;B=g[y>>2]|0,O=y+4|0,_=g[O>>2]|0,l=y+8|0,b=g[l>>2]|0,C=_+B|0,B=b+B|0,g[y>>2]=B,g[O>>2]=C,_=b+_|0,g[l>>2]=_,b=C-B|0,(B|0)<0?(_=_-B|0,g[O>>2]=b,g[l>>2]=_,g[y>>2]=0,C=0):(b=C,C=B),(b|0)<0&&(C=C-b|0,g[y>>2]=C,_=_-b|0,g[l>>2]=_,g[O>>2]=0,b=0),M=C-_|0,B=b-_|0,(_|0)<0?(g[y>>2]=M,g[O>>2]=B,g[l>>2]=0,C=M,_=0):B=b,b=(B|0)<(C|0)?B:C,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=C-b,g[O>>2]=B-b,g[l>>2]=_-b)}function cu(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;_=g[y>>2]|0,O=y+4|0,C=g[O>>2]|0,l=y+8|0,b=g[l>>2]|0,B=C+_|0,g[y>>2]=B,C=b+C|0,g[O>>2]=C,_=b+_|0,g[l>>2]=_,b=C-B|0,(B|0)<0?(_=_-B|0,g[O>>2]=b,g[l>>2]=_,g[y>>2]=0,C=0):(b=C,C=B),(b|0)<0&&(C=C-b|0,g[y>>2]=C,_=_-b|0,g[l>>2]=_,g[O>>2]=0,b=0),M=C-_|0,B=b-_|0,(_|0)<0?(g[y>>2]=M,g[O>>2]=B,g[l>>2]=0,C=M,_=0):B=b,b=(B|0)<(C|0)?B:C,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=C-b,g[O>>2]=B-b,g[l>>2]=_-b)}function xo(y){switch(y=y|0,y|0){case 1:{y=5;break}case 5:{y=4;break}case 4:{y=6;break}case 6:{y=2;break}case 2:{y=3;break}case 3:{y=1;break}}return y|0}function eo(y){switch(y=y|0,y|0){case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}case 5:{y=1;break}}return y|0}function yf(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;_=g[y>>2]|0,O=y+4|0,b=g[O>>2]|0,l=y+8|0,C=g[l>>2]|0,B=b+(_<<1)|0,g[y>>2]=B,b=C+(b<<1)|0,g[O>>2]=b,_=(C<<1)+_|0,g[l>>2]=_,C=b-B|0,(B|0)<0?(_=_-B|0,g[O>>2]=C,g[l>>2]=_,g[y>>2]=0,b=C,C=0):C=B,(b|0)<0&&(C=C-b|0,g[y>>2]=C,_=_-b|0,g[l>>2]=_,g[O>>2]=0,b=0),M=C-_|0,B=b-_|0,(_|0)<0?(g[y>>2]=M,g[O>>2]=B,g[l>>2]=0,C=M,_=0):B=b,b=(B|0)<(C|0)?B:C,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=C-b,g[O>>2]=B-b,g[l>>2]=_-b)}function zi(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;B=g[y>>2]|0,O=y+4|0,_=g[O>>2]|0,l=y+8|0,b=g[l>>2]|0,C=(_<<1)+B|0,B=b+(B<<1)|0,g[y>>2]=B,g[O>>2]=C,_=(b<<1)+_|0,g[l>>2]=_,b=C-B|0,(B|0)<0?(_=_-B|0,g[O>>2]=b,g[l>>2]=_,g[y>>2]=0,B=0):b=C,(b|0)<0&&(B=B-b|0,g[y>>2]=B,_=_-b|0,g[l>>2]=_,g[O>>
42072]=0,b=0),M=B-_|0,C=b-_|0,(_|0)<0?(g[y>>2]=M,g[O>>2]=C,g[l>>2]=0,B=M,_=0):C=b,b=(C|0)<(B|0)?C:B,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=B-b,g[O>>2]=C-b,g[l>>2]=_-b)}function Cl(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0;return O=(g[y>>2]|0)-(g[_>>2]|0)|0,l=(O|0)<0,C=(g[y+4>>2]|0)-(g[_+4>>2]|0)-(l?O:0)|0,M=(C|0)<0,B=(l?0-O|0:0)+(g[y+8>>2]|0)-(g[_+8>>2]|0)+(M?0-C|0:0)|0,y=(B|0)<0,_=y?0:B,b=(M?0:C)-(y?B:0)|0,B=(l?0:O)-(M?C:0)-(y?B:0)|0,y=(b|0)<(B|0)?b:B,y=(_|0)<(y|0)?_:y,C=(y|0)>0,_=_-(C?y:0)|0,b=b-(C?y:0)|0,y=B-(C?y:0)|0,y=(y|0)>-1?y:0-y|0,b=(b|0)>-1?b:0-b|0,_=(_|0)>-1?_:0-_|0,_=(b|0)>(_|0)?b:_,((y|0)>(_|0)?y:_)|0}function wa(y,_){y=y|0,_=_|0;var b=0;b=g[y+8>>2]|0,g[_>>2]=(g[y>>2]|0)-b,g[_+4>>2]=(g[y+4>>2]|0)-b}function Ca(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0;C=g[y>>2]|0,g[_>>2]=C,B=g[y+4>>2]|0,O=_+4|0,g[O>>2]=B,l=_+8|0,g[l>>2]=0,b=(B|0)<(C|0),y=b?C:B,b=b?B:C;do if((b|0)<0){if((y|0)>0){if((y|-2147483648|0)<(b|0)&((b|0)!=-2147483648&(2147483647-y|0)>=(b|0)))break;return y=1,y|0}if((b|0)==-2147483648|(-2147483648-y|0)>(b|0))return _=1,_|0;if((y|0)>-1){if((y|-2147483648|0)<(b|0))break;return y=1,y|0}else{if((y^-2147483648|0)<(b|0))y=1;else break;return y|0}}while(!1);return y=B-C|0,(C|0)<0?(b=0-C|0,g[O>>2]=y,g[l>>2]=b,g[_>>2]=0,C=0):(y=B,b=0),(y|0)<0&&(C=C-y|0,g[_>>2]=C,b=b-y|0,g[l>>2]=b,g[O>>2]=0,y=0),M=C-b|0,B=y-b|0,(b|0)<0?(g[_>>2]=M,g[O>>2]=B,g[l>>2]=0,y=B,B=M,b=0):B=C,C=(y|0)<(B|0)?y:B,C=(b|0)<(C|0)?b:C,(C|0)<=0?(_=0,_|0):(g[_>>2]=B-C,g[O>>2]=y-C,g[l>>2]=b-C,_=0,_|0)}function Ta(y){y=y|0;var _=0,b=0,C=0,B=0;_=y+8|0,B=g[_>>2]|0,b=B-(g[y>>2]|0)|0,g[y>>2]=b,C=y+4|0,y=(g[C>>2]|0)-B|0,g[C>>2]=y,g[_>>2]=0-(y+b)}function Xa(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;b=g[y>>2]|0,_=0-b|0,g[y>>2]=_,O=y+8|0,g[O>>2]=0,l=y+4|0,C=g[l>>2]|0,B=C+b|0,(b|0)>0?(g[l>>2]=B,g[O>>2]=b,g[y>>2]=0,_=0,C=B):b=0,(C|0)<0?(M=_-C|0,g[y>>2]=M,b=b-C|0,g[O>>2]=b,g[l>>2]=0,B=M-b|0,_=0-b|0,(b|0)<0?(g[y>>2]=B,g[l>>2]=_,g[O>>2]=0,C=_,b=0):(C=0,B=M)):B=_,_=(C|0)<(B|0)?C:B,_=(b|0)<(_|0)?b:_,!((_|0)<=0)&&(g[y>>2]=B-_,g[l>>2]=C-_,g[O>>2]=b-_)}function Ea(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0;if(T=Se,Se=Se+64|0,m=T,l=T+56|0,!(!0&(_&2013265920|0)==134217728&(!0&(C&2013265920|0)==134217728)))return B=5,Se=T,B|0;if((y|0)==(b|0)&(_|0)==(C|0))return g[B>>2]=0,B=0,Se=T,B|0;if(O=Jt(y|0,_|0,52)|0,Ie()|0,O=O&15,h=Jt(b|0,C|0,52)|0,Ie()|0,(O|0)!=(h&15|0))return B=12,Se=T,B|0;if(M=O+-1|0,O>>>0>1){Zo(y,_,M,m)|0,Zo(b,C,M,l)|0,h=m,d=g[h>>2]|0,h=g[h+4>>2]|0;e:do if((d|0)==(g[l>>2]|0)&&(h|0)==(g[l+4>>2]|0)){O=(O^15)*3|0,M=Jt(y|0,_|0,O|0)|0,Ie()|0,M=M&7,O=Jt(b|0,C|0,O|0)|0,Ie()|0,O=O&7;do if((M|0)==0|(O|0)==0)g[B>>2]=1,M=0;else if((M|0)==7)M=5;else{if((M|0)==1|(O|0)==1&&Fn(d,h)|0){M=5;break}if((g[15536+(M<<2)>>2]|0)!=(O|0)&&(g[15568+(M<<2)>>2]|0)!=(O|0))break e;g[B>>2]=1,M=0}while(!1);return B=M,Se=T,B|0}while(!1)}M=m,O=M+56|0;do g[M>>2]=0,M=M+4|0;while((M|0)<(O|0));return Rn(y,_,1,m)|0,_=m,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(C|0))&&(_=m+8|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(C|0)))&&(_=m+16|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(C|0)))&&(_=m+24|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(C|0)))&&(_=m+32|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(C|0)))&&(_=m+40|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(C|0)))?(M=m+48|0,M=((g[M>>2]|0)==(b|0)?(g[M+4>>2]|0)==(C|0):0)&1):M=1,g[B>>2]=M,B=0,Se=T,B|0}function Ka(y,_,b,C,B){return y=y|0,_=_|0,b=b|0,C=C|0,B=B|0,b=yl(y,_,b,C)|0,(b|0)==7?(B=11,B|0):(C=tr(b|0,0,56)|0,_=_&-2130706433|(Ie()|0)|268435456,g[B>>2]=y|C,g[B+4>>2]=_,B=0,B|0)}function qa(y,_,b){return y=y|0,_=_|0,b=b|0,!0&(_&2013265920|0)==268435456?(g[b>>2]=y,g[b+4>>2]=_&-2130706433|134217728,b=0,b|0):(b=6,b|0)}function Ba(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;return B=Se,Se=Se+16|0,C=B,g[C>>2]=0,!0&(_&2013265920|0)==268435456?(M=Jt(y|0,_|0,56)|0,Ie()|0,C=Sn(y,_&-2130706433|134217728,M&7,C,b)|0,Se=B,C|0):(C=6,Se=B,C|0)}function Fh(y,_){y=y|0,_=_|0;var b=0;switch(b=Jt(y|0,_|0,56)|0,Ie()|0,b&7){case 0:case 7:return b=0,b|0}return b=_&-2130706433|134217728,!(!0&(_&2013265920|0)==268435456)||!0&(_&117440512|0)==16777216&(Fn(y,b)|0)!=0?(b=0,b|0):(b=Yo(y,b)|0,b|0)}function Dh(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0;return B=Se,Se=Se+16|0,C=B,!0&(_&2013265920|0)==268435456?(M=_&-2130706433|134217728,O=b,g[O>>2]=y,g[O+4>>2]=M,g[C>>2]=0,_=Jt(y|0,_|0,56)|0,Ie()|0,C=Sn(y,M,_&7,C,b+8|0)|0,Se=B,C|0):(C=6,Se=B,C|0)}function In(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0;return B=(Fn(y,_)|0)==0,_=_&-2130706433,C=b,g[C>>2]=B?y:0,g[C+4>>2]=B?_|285212672:0,C=b+8|0,g[C>>2]=y,g[C+4>>2]=_|301989888,C=b+16|0,g[C>>2]=y,g[C+4>>2]=_|318767104,C=b+24|0,g[C>>2]=y,g[C+4>>2]=_|335544320,C=b+32|0,g[C>>2]=y,g[C+4>>2]=_|352321536,b=b+40|0,g[b>>2]=y,g[b+4>>2]=_|369098752,0}
4207function lu(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0;return O=Se,Se=Se+16|0,B=O,M=_&-2130706433|134217728,!0&(_&2013265920|0)==268435456?(C=Jt(y|0,_|0,56)|0,Ie()|0,C=Co(y,M,C&7)|0,(C|0)==-1?(g[b>>2]=0,M=6,Se=O,M|0):(ec(y,M,B)|0&&Xt(23313,22484,282,22499),_=Jt(y|0,_|0,52)|0,Ie()|0,_=_&15,Fn(y,M)|0?Ko(B,_,C,2,b):fu(B,_,C,2,b),M=0,Se=O,M|0)):(M=6,Se=O,M|0)}function uu(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0;C=Se,Se=Se+16|0,B=C,Oh(y,_,b,B),xa(B,b+4|0),Se=C}function Oh(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0;if(l=Se,Se=Se+16|0,d=l,Lh(y,b,d),M=+Ur(+(1-+ce[d>>3]*.5)),M<1e-16){g[C>>2]=0,g[C+4>>2]=0,g[C+8>>2]=0,g[C+12>>2]=0,Se=l;return}if(d=g[b>>2]|0,B=+ce[15920+(d*24|0)>>3],B=+Nc(B-+Nc(+xf(15600+(d<<4)|0,y))),zs(_)|0?O=+Nc(B+-.3334731722518321):O=B,B=+Ht(+M)/.381966011250105,(_|0)>0){y=0;do B=B*2.6457513110645907,y=y+1|0;while((y|0)!=(_|0))}M=+Lt(+O)*B,ce[C>>3]=M,O=+Mt(+O)*B,ce[C+8>>3]=O,Se=l}function Lh(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;if(M=Se,Se=Se+32|0,B=M,Bf(y,B),g[_>>2]=0,ce[b>>3]=5,C=+Ti(16400,B),C<+ce[b>>3]&&(g[_>>2]=0,ce[b>>3]=C),C=+Ti(16424,B),C<+ce[b>>3]&&(g[_>>2]=1,ce[b>>3]=C),C=+Ti(16448,B),C<+ce[b>>3]&&(g[_>>2]=2,ce[b>>3]=C),C=+Ti(16472,B),C<+ce[b>>3]&&(g[_>>2]=3,ce[b>>3]=C),C=+Ti(16496,B),C<+ce[b>>3]&&(g[_>>2]=4,ce[b>>3]=C),C=+Ti(16520,B),C<+ce[b>>3]&&(g[_>>2]=5,ce[b>>3]=C),C=+Ti(16544,B),C<+ce[b>>3]&&(g[_>>2]=6,ce[b>>3]=C),C=+Ti(16568,B),C<+ce[b>>3]&&(g[_>>2]=7,ce[b>>3]=C),C=+Ti(16592,B),C<+ce[b>>3]&&(g[_>>2]=8,ce[b>>3]=C),C=+Ti(16616,B),C<+ce[b>>3]&&(g[_>>2]=9,ce[b>>3]=C),C=+Ti(16640,B),C<+ce[b>>3]&&(g[_>>2]=10,ce[b>>3]=C),C=+Ti(16664,B),C<+ce[b>>3]&&(g[_>>2]=11,ce[b>>3]=C),C=+Ti(16688,B),C<+ce[b>>3]&&(g[_>>2]=12,ce[b>>3]=C),C=+Ti(16712,B),C<+ce[b>>3]&&(g[_>>2]=13,ce[b>>3]=C),C=+Ti(16736,B),C<+ce[b>>3]&&(g[_>>2]=14,ce[b>>3]=C),C=+Ti(16760,B),C<+ce[b>>3]&&(g[_>>2]=15,ce[b>>3]=C),C=+Ti(16784,B),C<+ce[b>>3]&&(g[_>>2]=16,ce[b>>3]=C),C=+Ti(16808,B),C<+ce[b>>3]&&(g[_>>2]=17,ce[b>>3]=C),C=+Ti(16832,B),C<+ce[b>>3]&&(g[_>>2]=18,ce[b>>3]=C),C=+Ti(16856,B),!(C<+ce[b>>3])){Se=M;return}g[_>>2]=19,ce[b>>3]=C,Se=M}function Rc(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0;if(M=+ta(y),M<1e-16){_=15600+(_<<4)|0,g[B>>2]=g[_>>2],g[B+4>>2]=g[_+4>>2],g[B+8>>2]=g[_+8>>2],g[B+12>>2]=g[_+12>>2];return}if(O=+cn(+ +ce[y+8>>3],+ +ce[y>>3]),(b|0)>0){y=0;do M=M/2.6457513110645907,y=y+1|0;while((y|0)!=(b|0))}C?(M=M/3,b=(zs(b)|0)==0,M=+en(+((b?M:M/2.6457513110645907)*.381966011250105))):(M=+en(+(M*.381966011250105)),zs(b)|0&&(O=+Nc(O+.3334731722518321))),Sl(15600+(_<<4)|0,+Nc(+ce[15920+(_*24|0)>>3]-O),M,B)}function kh(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0;C=Se,Se=Se+16|0,B=C,Ro(y+4|0,B),Rc(B,g[y>>2]|0,_,0,b),Se=C}function Ko(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0,Re=0,He=0,We=0,nt=0,Xe=0,Qe=0,pt=0,Dt=0,Ct=0;if(pt=Se,Se=Se+272|0,M=pt+256|0,Z=pt+240|0,nt=pt,Xe=pt+224|0,Qe=pt+208|0,te=pt+176|0,oe=pt+160|0,we=pt+192|0,Fe=pt+144|0,ge=pt+128|0,Re=pt+112|0,He=pt+96|0,We=pt+80|0,g[M>>2]=_,g[Z>>2]=g[y>>2],g[Z+4>>2]=g[y+4>>2],g[Z+8>>2]=g[y+8>>2],g[Z+12>>2]=g[y+12>>2],qo(Z,M,nt),g[B>>2]=0,Z=C+b+((C|0)==5&1)|0,(Z|0)<=(b|0)){Se=pt;return}d=g[M>>2]|0,h=Xe+4|0,m=te+4|0,T=b+5|0,P=16880+(d<<2)|0,R=16960+(d<<2)|0,L=ge+8|0,z=Re+8|0,X=He+8|0,ee=Qe+4|0,l=b;e:for(;;){O=nt+(((l|0)%5|0)<<4)|0,g[Qe>>2]=g[O>>2],g[Qe+4>>2]=g[O+4>>2],g[Qe+8>>2]=g[O+8>>2],g[Qe+12>>2]=g[O+12>>2];do;while((to(Qe,d,0,1)|0)==2);if((l|0)>(b|0)&(zs(_)|0)!=0){if(g[te>>2]=g[Qe>>2],g[te+4>>2]=g[Qe+4>>2],g[te+8>>2]=g[Qe+8>>2],g[te+12>>2]=g[Qe+12>>2],Ro(h,oe),C=g[te>>2]|0,M=g[17040+(C*80|0)+(g[Xe>>2]<<2)>>2]|0,g[te>>2]=g[18640+(C*80|0)+(M*20|0)>>2],O=g[18640+(C*80|0)+(M*20|0)+16>>2]|0,(O|0)>0){y=0;do _f(m),y=y+1|0;while((y|0)<(O|0))}switch(O=18640+(C*80|0)+(M*20|0)+4|0,g[we>>2]=g[O>>2],g[we+4>>2]=g[O+4>>2],g[we+8>>2]=g[O+8>>2],Ja(we,(g[P>>2]|0)*3|0),zn(m,we,m),vi(m),Ro(m,Fe),Dt=+(g[R>>2]|0),ce[ge>>3]=Dt*3,ce[L>>3]=0,Ct=Dt*-1.5,ce[Re>>3]=Ct,ce[z>>3]=Dt*2.598076211353316,ce[He>>3]=Ct,ce[X>>3]=Dt*-2.598076211353316,g[17040+((g[te>>2]|0)*80|0)+(g[Qe>>2]<<2)>>2]|0){case 1:{y=Re,C=ge;break}case 3:{y=He,C=Re;break}case 2:{y=ge,C=He;break}default:{y=12;break e}}Ef(oe,Fe,C,y,We),Rc(We,g[te>>2]|0,d,1,B+8+(g[B>>2]<<4)|0),g[B>>2]=(g[B>>2]|0)+1}if((l|0)<(T|0)&&(Ro(ee,te),Rc(te,g[Qe>>2]|0,d,1,B+8+(g[B>>2]<<4)|0),g[B>>2]=(g[B>>2]|0)+1),g[Xe>>2]=g[Qe>>2],g[Xe+4>>2]=g[Qe+4>>2],g[Xe+8>>2]=g[Qe+8>>2],g[Xe+12>>2]=g[Qe+12>>2],l=l+1|0,(l|0)>=(Z|0)){y=3;break}}if((y|0)==3){Se=pt;return}else(y|0)==12&&Xt(22522,22569,571,22579)}function qo(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0;d=Se,Se=Se+128|0,C=d+64|0,B=d,M=C,O=20240,l=M+60|0;do g[M>>2]=g[O>>2],M=M+4|0,O=O+4|0;while((M|0)<(l|0));M=B,O=20304,l=M+60|0;do g[M>>2]=g[O>>2],M=M+4|0,O=O+4|0;while((M|0)<(l|0));l=(zs(g[_>>2]|0)|0)==0,C=l?C:B,B=y+4|0,yf(B),zi(B),zs(g[_>>2]|0)|0&&(Xo(B),g[_>>2]=(g[_>>2]|0)+1),g[b>>2]=g[y>>2],_=b+4|0,zn(B,C,_),vi(_),g[b+16>>2]=g[y>>2],_=b+20|0,zn(B,C+12|0,_),vi(_),g[b+32>>2]=g[y>>2],_=b+36|0,zn(B,C+24|0,_),vi(_),g[b+48>>2]=g[y>>2],_=b+52|0,zn(B,C+36|0,_),vi(_),g[b+64>>2]=g[y>>2],b=b+68|0,zn(B,C+48|0,b),vi(b),Se=d}function to(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0;if(L=Se,Se=Se+32|0,P=L+12|0,l=L,R=y+4|0,T=g[16960+(_<<2)>>2]|0,m=(C|0)!=0,T=m?T*3|0:T,B=g[R>>2]|0,h=y+8|0,O=g[h>>2]|0,m){if(M=y+12|0,C=g[M>>2]|0,B=O+B+C|0,(B|0)==(T|0))return R=1,Se=L,R|0;d=M}else d=y+12|0,C=g[d>>2]|0,B=O+B+C|0;if((B|0)<=(T|0))return R=0,Se=L,R|0;do if((C|0)>0){if(C=g[y>>2]|0,(O|0)>0){M=18640+(C*80|0)+60|0,C=y;break}C=18640+(C*80|0)+40|0,b?(Wa(P,T,0,0),hi(R,P,l),cu(l),zn(l,P,R),M=C,C=y):(M=C,C=y)}else M=18640+((g[y>>2]|0)*80|0)+20|0,C=y;while(!1);if(g[C>>2]=g[M>>2],B=M+16|0,(g[B>>2]|0)>0){C=0;do _f(R),C=C+1|0;while((C|0)<(g[B>>2]|0))}return y=M+4|0,g[P>>2]=g[y>>2],g[P+4>>2]=g[y+4>>2],g[P+8>>2]=g[y+8>>2],_=g[16880+(_<<2)>>2]|0,Ja(P,m?_*3|0:_),zn(R,P,R),vi(R),m?C=((g[h>>2]|0)+(g[R>>2]|0)+(g[d>>2]|0)|0)==(T|0)?1:2:C=2,R=C,Se=L,R|0}function Nh(y,_){y=y|0,_=_|0;var b=0;do b=to(y,_,0,1)|0;while((b|0)==2);return b|0}function fu(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0,Re=0,He=0,We=0,nt=0;if(He=Se,Se=Se+240|0,M=He+224|0,we=He+208|0,Fe=He,ge=He+192|0,Re=He+176|0,X=He+160|0,ee=He+144|0,Z=He+128|0,te=He+112|0,oe=He+96|0,g[M>>2]=_,g[we>>2]=g[y>>2],g[we+4>>2]=g[y+4>>2],g[we+8>>2]=g[y+8>>2],g[we+12>>2]=g[y+12>>2],hu(we,M,Fe),g[B>>2]=0,z=C+b+((C|0)==6&1)|0,(z|0)<=(b|0)){Se=He;return}d=g[M>>2]|0,h=b+6|0,m=16960+(d<<2)|0,T=ee+8|0,P=Z+8|0,R=te+8|0,L=ge+4|0,O=0,l=b,C=-1;e:for(;;){if(M=(l|0)%6|0,y=Fe+(M<<4)|0,g[ge>>2]=g[y>>2],g[ge+4>>2]=g[y+4>>2],g[ge+8>>2]=g[y+8>>2],g[ge+12>>2]=g[y+12>>2],y=O,O=to(ge,d,0,1)|0,(l|0)>(b|0)&(zs(_)|0)!=0&&(y|0)!=1&&(g[ge>>2]|0)!=(C|0)){switch(Ro(Fe+(((M+5|0)%6|0)<<4)+4|0,Re),Ro(Fe+(M<<4)+4|0,X),We=+(g[m>>2]|0),ce[ee>>3]=We*3,ce[T>>3]=0,nt=We*-1.5,ce[Z>>3]=nt,ce[P>>3]=We*2.598076211353316,ce[te>>3]=nt,ce[R>>3]=We*-2.598076211353316,M=g[we>>2]|0,g[17040+(M*80|0)+(((C|0)==(M|0)?g[ge>>2]|0:C)<<2)>>2]|0){case 1:{y=Z,C=ee;break}case 3:{y=te,C=Z;break}case 2:{y=ee,C=te;break}default:{y=8;break e}}Ef(Re,X,C,y,oe),!(Vc(Re,oe)|0)&&!(Vc(X,oe)|0)&&(Rc(oe,g[we>>2]|0,d,1,B+8+(g[B>>2]<<4)|0),g[B>>2]=(g[B>>2]|0)+1)}if((l|0)<(h|0)&&(Ro(L,Re),Rc(Re,g[ge>>2]|0,d,1,B+8+(g[B>>2]<<4)|0),g[B>>2]=(g[B>>2]|0)+1),l=l+1|0,(l|0)>=(z|0)){y=3;break}else C=g[ge>>2]|0}if((y|0)==3){Se=He;return}else(y|0)==8&&Xt(22606,22569,736,22651)}
4207function hu(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0;d=Se,Se=Se+160|0,C=d+80|0,B=d,M=C,O=20368,l=M+72|0;do g[M>>2]=g[O>>2],M=M+4|0,O=O+4|0;while((M|0)<(l|0));M=B,O=20448,l=M+72|0;do g[M>>2]=g[O>>2],M=M+4|0,O=O+4|0;while((M|0)<(l|0));l=(zs(g[_>>2]|0)|0)==0,C=l?C:B,B=y+4|0,yf(B),zi(B),zs(g[_>>2]|0)|0&&(Xo(B),g[_>>2]=(g[_>>2]|0)+1),g[b>>2]=g[y>>2],_=b+4|0,zn(B,C,_),vi(_),g[b+16>>2]=g[y>>2],_=b+20|0,zn(B,C+12|0,_),vi(_),g[b+32>>2]=g[y>>2],_=b+36|0,zn(B,C+24|0,_),vi(_),g[b+48>>2]=g[y>>2],_=b+52|0,zn(B,C+36|0,_),vi(_),g[b+64>>2]=g[y>>2],_=b+68|0,zn(B,C+48|0,_),vi(_),g[b+80>>2]=g[y>>2],b=b+84|0,zn(B,C+60|0,b),vi(b),Se=d}function Ya(y,_){return y=y|0,_=_|0,_=Jt(y|0,_|0,52)|0,Ie()|0,_&15|0}function vf(y,_){return y=y|0,_=_|0,_=Jt(y|0,_|0,45)|0,Ie()|0,_&127|0}function Yo(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0;if(!(!0&(_&-16777216|0)==134217728)||(O=Jt(y|0,_|0,45)|0,Ie()|0,O=O&127,O>>>0>121))return _=0,_|0;b=Jt(y|0,_|0,52)|0,Ie()|0,b=b&15;do if(b|0){for(B=1,C=0;;){if(M=Jt(y|0,_|0,(15-B|0)*3|0)|0,Ie()|0,M=M&7,(M|0)!=0&(C^1))if((M|0)==1&(Ir(O)|0)!=0){l=0,C=13;break}else C=1;if((M|0)==7){l=0,C=13;break}if(B>>>0<b>>>0)B=B+1|0;else{C=9;break}}if((C|0)==9){if((b|0)==15)l=1;else break;return l|0}else if((C|0)==13)return l|0}while(!1);for(;;){if(l=Jt(y|0,_|0,(14-b|0)*3|0)|0,Ie()|0,!((l&7|0)==7&!0)){l=0,C=13;break}if(b>>>0<14)b=b+1|0;else{l=1,C=13;break}}return(C|0)==13?l|0:0}function Zo(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0;if(M=Jt(y|0,_|0,52)|0,Ie()|0,M=M&15,b>>>0>15)return C=4,C|0;if((M|0)<(b|0))return C=12,C|0;if((M|0)==(b|0))return g[C>>2]=y,g[C+4>>2]=_,C=0,C|0;if(B=tr(b|0,0,52)|0,B=B|y,y=Ie()|0|_&-15728641,(M|0)>(b|0))do _=tr(7,0,(14-b|0)*3|0)|0,b=b+1|0,B=_|B,y=Ie()|0|y;while((b|0)<(M|0));return g[C>>2]=B,g[C+4>>2]=y,C=0,C|0}function Tl(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0;if(M=Jt(y|0,_|0,52)|0,Ie()|0,M=M&15,!((b|0)<16&(M|0)<=(b|0)))return C=4,C|0;B=b-M|0,b=Jt(y|0,_|0,45)|0,Ie()|0;e:do if(!(Ir(b&127)|0))b=Hs(7,0,B,((B|0)<0)<<31>>31)|0,B=Ie()|0;else{t:do if(M|0){for(b=1;O=tr(7,0,(15-b|0)*3|0)|0,!!((O&y|0)==0&((Ie()|0)&_|0)==0);)if(b>>>0<M>>>0)b=b+1|0;else break t;b=Hs(7,0,B,((B|0)<0)<<31>>31)|0,B=Ie()|0;break e}while(!1);b=Hs(7,0,B,((B|0)<0)<<31>>31)|0,b=di(b|0,Ie()|0,5,0)|0,b=An(b|0,Ie()|0,-5,-1)|0,b=js(b|0,Ie()|0,6,0)|0,b=An(b|0,Ie()|0,1,0)|0,B=Ie()|0}while(!1);return O=C,g[O>>2]=b,g[O+4>>2]=B,O=0,O|0}function Fn(y,_){y=y|0,_=_|0;var b=0,C=0,B=0;if(B=Jt(y|0,_|0,45)|0,Ie()|0,!(Ir(B&127)|0))return B=0,B|0;B=Jt(y|0,_|0,52)|0,Ie()|0,B=B&15;e:do if(!B)b=0;else for(C=1;;){if(b=Jt(y|0,_|0,(15-C|0)*3|0)|0,Ie()|0,b=b&7,b|0)break e;if(C>>>0<B>>>0)C=C+1|0;else{b=0;break}}while(!1);return B=(b|0)==0&1,B|0}function On(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0;if(O=Se,Se=Se+16|0,M=O,Bl(M,y,_,b),_=M,y=g[_>>2]|0,_=g[_+4>>2]|0,(y|0)==0&(_|0)==0)return Se=O,0;B=0,b=0;do l=C+(B<<3)|0,g[l>>2]=y,g[l+4>>2]=_,B=An(B|0,b|0,1,0)|0,b=Ie()|0,mu(M),l=M,y=g[l>>2]|0,_=g[l+4>>2]|0;while(!((y|0)==0&(_|0)==0));return Se=O,0}function du(y,_,b,C){return y=y|0,_=_|0,b=b|0,C=C|0,(C|0)<(b|0)?(b=_,C=y,pr(b|0),C|0):(b=tr(-1,-1,((C-b|0)*3|0)+3|0)|0,C=tr(~b|0,~(Ie()|0)|0,(15-C|0)*3|0)|0,b=~(Ie()|0)&_,C=~C&y,pr(b|0),C|0)}function tA(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0;return B=Jt(y|0,_|0,52)|0,Ie()|0,B=B&15,(b|0)<16&(B|0)<=(b|0)?((B|0)<(b|0)&&(B=tr(-1,-1,((b+-1-B|0)*3|0)+3|0)|0,B=tr(~B|0,~(Ie()|0)|0,(15-b|0)*3|0)|0,_=~(Ie()|0)&_,y=~B&y),B=tr(b|0,0,52)|0,b=_&-15728641|(Ie()|0),g[C>>2]=y|B,g[C+4>>2]=b,C=0,C|0):(C=4,C|0)}function Fc(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0,Re=0;if((b|0)==0&(C|0)==0)return ge=0,ge|0;if(B=y,M=g[B>>2]|0,B=g[B+4>>2]|0,!0&(B&15728640|0)==0){if(!((C|0)>0|(C|0)==0&b>>>0>0)||(ge=_,g[ge>>2]=M,g[ge+4>>2]=B,(b|0)==1&(C|0)==0))return ge=0,ge|0;B=1;do we=y+(B<<3)|0,Fe=g[we+4>>2]|0,ge=_+(B<<3)|0,g[ge>>2]=g[we>>2],g[ge+4>>2]=Fe,B=B+1|0;while(0<(C|0)|(C|0)==0&B>>>0<b>>>0);return B=0,B|0}if(oe=b<<3,Fe=Jn(oe)|0,!Fe)return ge=13,ge|0;if(Oo(Fe|0,y|0,oe|0)|0,we=oo(b,8)|0,!we)return zr(Fe),ge=13,ge|0;e:do if(b|0){t:for(;;){B=Fe,ee=g[B>>2]|0,B=g[B+4>>2]|0,Z=Jt(ee|0,B|0,52)|0,Ie()|0,Z=Z&15,te=Z+-1|0,X=(b|0)>0;r:do if((Z|0)!=0&X){if(R=((b|0)<0)<<31>>31,L=tr(te|0,0,52)|0,z=Ie()|0,te>>>0>15){if(!((ee|0)==0&(B|0)==0)){ge=17;break t}for(M=0;;){if(M=M+1|0,(M|0)>=(b|0))break r;if(C=Fe+(M<<3)|0,z=g[C>>2]|0,C=g[C+4>>2]|0,!((z|0)==0&(C|0)==0)){B=C,ge=17;break t}}}for(M=0,y=ee,C=B;;){if(!((y|0)==0&(C|0)==0)){if(!(!0&(C&117440512|0)==0)){ge=22;break t}if(l=Jt(y|0,C|0,52)|0,Ie()|0,l=l&15,(l|0)<(te|0)){B=12,ge=28;break t}if((l|0)!=(te|0)&&(y=y|L,C=C&-15728641|z,l>>>0>=Z>>>0)){O=te;do P=tr(7,0,(14-O|0)*3|0)|0,O=O+1|0,y=P|y,C=Ie()|0|C;while(O>>>0<l>>>0)}if(O=To(y|0,C|0,b|0,R|0)|0,Ie()|0,h=we+(O<<3)|0,l=h,d=g[l>>2]|0,l=g[l+4>>2]|0,(d|0)==0&(l|0)==0)O=h;else for(P=0;;){if((P|0)>(b|0)){ge=32;break t}if((d|0)==(y|0)&(l&-117440513|0)==(C|0)){m=Jt(d|0,l|0,56)|0,Ie()|0,m=m&7,T=m+1|0,Re=Jt(d|0,l|0,45)|0,Ie()|0;n:do if(!(Ir(Re&127)|0))l=7;else{if(d=Jt(d|0,l|0,52)|0,Ie()|0,d=d&15,!d){l=6;break}for(l=1;;){if(Re=tr(7,0,(15-l|0)*3|0)|0,!((Re&y|0)==0&((Ie()|0)&C|0)==0)){l=7;break n}if(l>>>0<d>>>0)l=l+1|0;else{l=6;break}}}while(!1);
4207if((m+2|0)>>>0>l>>>0){ge=42;break t}Re=tr(T|0,0,56)|0,C=Ie()|0|C&-117440513,T=h,g[T>>2]=0,g[T+4>>2]=0,y=Re|y}else O=(O+1|0)%(b|0)|0;if(h=we+(O<<3)|0,l=h,d=g[l>>2]|0,l=g[l+4>>2]|0,(d|0)==0&(l|0)==0){O=h;break}else P=P+1|0}Re=O,g[Re>>2]=y,g[Re+4>>2]=C}if(M=M+1|0,(M|0)>=(b|0))break r;C=Fe+(M<<3)|0,y=g[C>>2]|0,C=g[C+4>>2]|0}}while(!1);if((b+5|0)>>>0<11){ge=85;break}if(z=oo((b|0)/6|0,8)|0,!z){ge=49;break}r:do if(X){P=0,T=0;do{if(l=we+(P<<3)|0,C=l,M=g[C>>2]|0,C=g[C+4>>2]|0,!((M|0)==0&(C|0)==0)){d=Jt(M|0,C|0,56)|0,Ie()|0,d=d&7,y=d+1|0,h=C&-117440513,Re=Jt(M|0,C|0,45)|0,Ie()|0;n:do if(Ir(Re&127)|0){if(m=Jt(M|0,C|0,52)|0,Ie()|0,m=m&15,m|0)for(O=1;;){if(Re=tr(7,0,(15-O|0)*3|0)|0,!((M&Re|0)==0&(h&(Ie()|0)|0)==0))break n;if(O>>>0<m>>>0)O=O+1|0;else break}C=tr(y|0,0,56)|0,M=C|M,C=Ie()|0|h,y=l,g[y>>2]=M,g[y+4>>2]=C,y=d+2|0}while(!1);(y|0)==7&&(Re=z+(T<<3)|0,g[Re>>2]=M,g[Re+4>>2]=C&-117440513,T=T+1|0)}P=P+1|0}while((P|0)!=(b|0));if(X){if(P=((b|0)<0)<<31>>31,R=tr(te|0,0,52)|0,L=Ie()|0,te>>>0>15){if(!((ee|0)==0&(B|0)==0)){B=4,ge=84;break t}for(B=0;;){if(B=B+1|0,(B|0)>=(b|0)){M=0,B=T;break r}if(Re=Fe+(B<<3)|0,!((g[Re>>2]|0)==0&(g[Re+4>>2]|0)==0)){B=4,ge=84;break t}}}for(m=0,M=0,h=ee;;){do if(!((h|0)==0&(B|0)==0)){if(l=Jt(h|0,B|0,52)|0,Ie()|0,l=l&15,(l|0)<(te|0)){B=12,ge=84;break t}do if((l|0)==(te|0))C=h,l=B;else{if(C=h|R,y=B&-15728641|L,l>>>0<Z>>>0){l=y;break}O=te;do Re=tr(7,0,(14-O|0)*3|0)|0,O=O+1|0,C=Re|C,y=Ie()|0|y;while(O>>>0<l>>>0);l=y}while(!1);for(O=To(C|0,l|0,b|0,P|0)|0,Ie()|0,y=0;;){if((y|0)>(b|0)){ge=77;break t}if(Re=we+(O<<3)|0,d=g[Re+4>>2]|0,(d&-117440513|0)==(l|0)&&(g[Re>>2]|0)==(C|0)){ge=79;break}if(O=(O+1|0)%(b|0)|0,Re=we+(O<<3)|0,(g[Re>>2]|0)==(C|0)&&(g[Re+4>>2]|0)==(l|0))break;y=y+1|0}if((ge|0)==79&&(ge=0,!0&(d&117440512|0)==100663296))break;Re=_+(M<<3)|0,g[Re>>2]=h,g[Re+4>>2]=B,M=M+1|0}while(!1);if(B=m+1|0,(B|0)>=(b|0)){B=T;break r}Re=Fe+(B<<3)|0,m=B,h=g[Re>>2]|0,B=g[Re+4>>2]|0}}else M=0,B=T}else M=0,B=0;while(!1);if(ia(we|0,0,oe|0)|0,Oo(Fe|0,z|0,B<<3|0)|0,zr(z),B)_=_+(M<<3)|0,b=B;else break e}if((ge|0)==17)!0&(B&117440512|0)==0?(B=4,ge=28):ge=22;else if((ge|0)==32)Xt(23313,22674,362,22684);else{if((ge|0)==42)return zr(Fe),zr(we),Re=10,Re|0;if((ge|0)==49)return zr(Fe),zr(we),Re=13,Re|0;if((ge|0)==77)Xt(23313,22674,462,22684);else{if((ge|0)==84)return zr(z),zr(Fe),zr(we),Re=B,Re|0;if((ge|0)==85){Oo(_|0,Fe|0,b<<3|0)|0;break}}}if((ge|0)==22)return zr(Fe),zr(we),Re=5,Re|0;if((ge|0)==28)return zr(Fe),zr(we),Re=B,Re|0}while(!1);return zr(Fe),zr(we),Re=0,Re|0}function Uh(y,_,b,C,B,M,O){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0,M=M|0,O=O|0;var l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0;if(z=Se,Se=Se+16|0,L=z,!((b|0)>0|(b|0)==0&_>>>0>0))return L=0,Se=z,L|0;if((O|0)>=16)return L=12,Se=z,L|0;P=0,R=0,T=0,l=0;e:for(;;){if(h=y+(P<<3)|0,d=g[h>>2]|0,h=g[h+4>>2]|0,m=Jt(d|0,h|0,52)|0,Ie()|0,(m&15|0)>(O|0)){l=12,d=11;break}if(Bl(L,d,h,O),m=L,h=g[m>>2]|0,m=g[m+4>>2]|0,(h|0)==0&(m|0)==0)d=T;else{d=T;do{if(!((l|0)<(M|0)|(l|0)==(M|0)&d>>>0<B>>>0)){d=10;break e}T=C+(d<<3)|0,g[T>>2]=h,g[T+4>>2]=m,d=An(d|0,l|0,1,0)|0,l=Ie()|0,mu(L),T=L,h=g[T>>2]|0,m=g[T+4>>2]|0}while(!((h|0)==0&(m|0)==0))}if(P=An(P|0,R|0,1,0)|0,R=Ie()|0,(R|0)<(b|0)|(R|0)==(b|0)&P>>>0<_>>>0)T=d;else{l=0,d=11;break}}return(d|0)==10?(L=14,Se=z,L|0):(d|0)==11?(Se=z,l|0):0}function rA(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0;P=Se,Se=Se+16|0,T=P;e:do if((b|0)>0|(b|0)==0&_>>>0>0){for(h=0,O=0,M=0,m=0;;){if(d=y+(h<<3)|0,l=g[d>>2]|0,d=g[d+4>>2]|0,!((l|0)==0&(d|0)==0)&&(d=(Tl(l,d,C,T)|0)==0,l=T,O=An(g[l>>2]|0,g[l+4>>2]|0,O|0,M|0)|0,M=Ie()|0,!d)){M=12;break}if(h=An(h|0,m|0,1,0)|0,m=Ie()|0,!((m|0)<(b|0)|(m|0)==(b|0)&h>>>0<_>>>0))break e}return Se=P,M|0}else O=0,M=0;while(!1);return g[B>>2]=O,g[B+4>>2]=M,B=0,Se=P,B|0}function zh(y,_){return y=y|0,_=_|0,_=Jt(y|0,_|0,52)|0,Ie()|0,_&1|0}function ns(y,_){y=y|0,_=_|0;var b=0,C=0,B=0;if(B=Jt(y|0,_|0,52)|0,Ie()|0,B=B&15,!B)return B=0,B|0;for(C=1;;){if(b=Jt(y|0,_|0,(15-C|0)*3|0)|0,Ie()|0,b=b&7,b|0){C=5;break}if(C>>>0<B>>>0)C=C+1|0;else{b=0,C=5;break}}return(C|0)==5?b|0:0}function Sa(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0,d=0;if(d=Jt(y|0,_|0,52)|0,Ie()|0,d=d&15,!d)return l=_,d=y,pr(l|0),d|0;for(l=1,b=0;;){M=(15-l|0)*3|0,C=tr(7,0,M|0)|0,B=Ie()|0,O=Jt(y|0,_|0,M|0)|0,Ie()|0,M=tr(xo(O&7)|0,0,M|0)|0,O=Ie()|0,y=M|y&~C,_=O|_&~B;e:do if(!b)if((M&C|0)==0&(O&B|0)==0)b=0;else if(C=Jt(y|0,_|0,52)|0,Ie()|0,C=C&15,!C)b=1;else{b=1;t:for(;;){switch(O=Jt(y|0,_|0,(15-b|0)*3|0)|0,Ie()|0,O&7){case 1:break t;case 0:break;default:{b=1;break e}}if(b>>>0<C>>>0)b=b+1|0;else{b=1;break e}}for(b=1;;)if(O=(15-b|0)*3|0,B=Jt(y|0,_|0,O|0)|0,Ie()|0,M=tr(7,0,O|0)|0,_=_&~(Ie()|0),O=tr(xo(B&7)|0,0,O|0)|0,y=y&~M|O,_=_|(Ie()|0),b>>>0<C>>>0)b=b+1|0;else{b=1;break}}while(!1);if(l>>>0<d>>>0)l=l+1|0;else break}return pr(_|0),y|0}function wo(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0;if(C=Jt(y|0,_|0,52)|0,Ie()|0,C=C&15,!C)return b=_,C=y,pr(b|0),C|0;for(b=1;M=(15-b|0)*3|0,O=Jt(y|0,_|0,M|0)|0,Ie()|0,B=tr(7,0,M|0)|0,_=_&~(Ie()|0),M=tr(xo(O&7)|0,0,M|0)|0,y=M|y&~B,_=Ie()|0|_,b>>>0<C>>>0;)b=b+1|0;return pr(_|0),y|0}function pu(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0,d=0;if(d=Jt(y|0,_|0,52)|0,Ie()|0,d=d&15,!d)return l=_,d=y,pr(l|0),d|0;for(l=1,b=0;;){M=(15-l|0)*3|0,C=tr(7,0,M|0)|0,B=Ie()|0,O=Jt(y|0,_|0,M|0)|0,Ie()|0,M=tr(eo(O&7)|0,0,M|0)|0,O=Ie()|0,y=M|y&~C,_=O|_&~B;e:do if(!b)if((M&C|0)==0&(O&B|0)==0)b=0;else if(C=Jt(y|0,_|0,52)|0,Ie()|0,C=C&15,!C)b=1;else{b=1;t:for(;;){switch(O=Jt(y|0,_|0,(15-b|0)*3|0)|0,Ie()|0,O&7){case 1:break t;case 0:break;default:{b=1;break e}}if(b>>>0<C>>>0)b=b+1|0;else{b=1;break e}}for(b=1;;)if(B=(15-b|0)*3|0,M=tr(7,0,B|0)|0,O=_&~(Ie()|0),_=Jt(y|0,_|0,B|0)|0,Ie()|0,_=tr(eo(_&7)|0,0,B|0)|0,y=y&~M|_,_=O|(Ie()|0),b>>>0<C>>>0)b=b+1|0;else{b=1;break}}while(!1);if(l>>>0<d>>>0)l=l+1|0;else break}return pr(_|0),y|0}function Za(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0;if(C=Jt(y|0,_|0,52)|0,Ie()|0,C=C&15,!C)return b=_,C=y,pr(b|0),C|0;for(b=1;O=(15-b|0)*3|0,M=tr(7,0,O|0)|0,B=_&~(Ie()|0),_=Jt(y|0,_|0,O|0)|0,Ie()|0,_=tr(eo(_&7)|0,0,O|0)|0,y=_|y&~M,_=Ie()|0|B,b>>>0<C>>>0;)b=b+1|0;return pr(_|0),y|0}function Dc(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0;if(d=Se,Se=Se+64|0,l=d+40|0,C=d+24|0,B=d+12|0,M=d,tr(_|0,0,52)|0,b=Ie()|0|134225919,!_)return(g[y+4>>2]|0)>2||(g[y+8>>2]|0)>2||(g[y+12>>2]|0)>2?(O=0,l=0,pr(O|0),Se=d,l|0):(tr(Li(y)|0,0,45)|0,O=Ie()|0|b,l=-1,pr(O|0),Se=d,l|0);if(g[l>>2]=g[y>>2],g[l+4>>2]=g[y+4>>2],g[l+8>>2]=g[y+8>>2],g[l+12>>2]=g[y+12>>2],O=l+4|0,(_|0)>0)for(y=-1;g[C>>2]=g[O>>2],g[C+4>>2]=g[O+4>>2],g[C+8>>2]=g[O+8>>2],_&1?(gf(O),g[B>>2]=g[O>>2],g[B+4>>2]=g[O+4>>2],g[B+8>>2]=g[O+8>>2],Pc(B)):(au(O),g[B>>2]=g[O>>2],g[B+4>>2]=g[O+4>>2],g[B+8>>2]=g[O+8>>2],Xo(B)),hi(C,B,M),vi(M),m=(15-_|0)*3|0,h=tr(7,0,m|0)|0,b=b&~(Ie()|0),m=tr(wl(M)|0,0,m|0)|0,y=m|y&~h,b=Ie()|0|b,(_|0)>1;)_=_+-1|0;else y=-1;e:do if((g[O>>2]|0)<=2&&(g[l+8>>2]|0)<=2&&(g[l+12>>2]|0)<=2){if(C=Li(l)|0,_=tr(C|0,0,45)|0,_=_|y,y=Ie()|0|b&-1040385,M=Ji(l)|0,!(Ir(C)|0)){if((M|0)<=0)break;for(B=0;;){if(C=Jt(_|0,y|0,52)|0,Ie()|0,C=C&15,C)for(b=1;m=(15-b|0)*3|0,l=Jt(_|0,y|0,m|0)|0,Ie()|0,h=tr(7,0,m|0)|0,y=y&~(Ie()|0),m=tr(xo(l&7)|0,0,m|0)|0,_=_&~h|m,y=y|(Ie()|0),b>>>0<C>>>0;)b=b+1|0;if(B=B+1|0,(B|0)==(M|0))break e}}B=Jt(_|0,y|0,52)|0,Ie()|0,B=B&15;t:do if(B){b=1;r:for(;;){switch(m=Jt(_|0,y|0,(15-b|0)*3|0)|0,Ie()|0,m&7){case 1:break r;case 0:break;default:break t}if(b>>>0<B>>>0)b=b+1|0;else break t}if(Af(C,g[l>>2]|0)|0)for(b=1;
4207l=(15-b|0)*3|0,h=tr(7,0,l|0)|0,m=y&~(Ie()|0),y=Jt(_|0,y|0,l|0)|0,Ie()|0,y=tr(eo(y&7)|0,0,l|0)|0,_=_&~h|y,y=m|(Ie()|0),b>>>0<B>>>0;)b=b+1|0;else for(b=1;m=(15-b|0)*3|0,l=Jt(_|0,y|0,m|0)|0,Ie()|0,h=tr(7,0,m|0)|0,y=y&~(Ie()|0),m=tr(xo(l&7)|0,0,m|0)|0,_=_&~h|m,y=y|(Ie()|0),b>>>0<B>>>0;)b=b+1|0}while(!1);if((M|0)>0){b=0;do _=Sa(_,y)|0,y=Ie()|0,b=b+1|0;while((b|0)!=(M|0))}}else _=0,y=0;while(!1);return h=y,m=_,pr(h|0),Se=d,m|0}function zs(y){return y=y|0,(y|0)%2|0|0}function Qa(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0;return B=Se,Se=Se+16|0,C=B,_>>>0>15?(C=4,Se=B,C|0):(g[y+4>>2]&2146435072|0)==2146435072||(g[y+8+4>>2]&2146435072|0)==2146435072?(C=3,Se=B,C|0):(uu(y,_,C),_=Dc(C,_)|0,C=Ie()|0,g[b>>2]=_,g[b+4>>2]=C,(_|0)==0&(C|0)==0&&Xt(23313,22674,786,22697),C=0,Se=B,C|0)}function Gs(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0;if(B=b+4|0,M=Jt(y|0,_|0,52)|0,Ie()|0,M=M&15,O=Jt(y|0,_|0,45)|0,Ie()|0,C=(M|0)==0,Ir(O&127)|0){if(C)return O=1,O|0;C=1}else{if(C)return O=0,O|0;(g[B>>2]|0)==0&&(g[b+8>>2]|0)==0?C=(g[b+12>>2]|0)!=0&1:C=1}for(b=1;b&1?Pc(B):Xo(B),O=Jt(y|0,_|0,(15-b|0)*3|0)|0,Ie()|0,mf(B,O&7),b>>>0<M>>>0;)b=b+1|0;return C|0}function ec(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0;if(m=Se,Se=Se+16|0,d=m,h=Jt(y|0,_|0,45)|0,Ie()|0,h=h&127,h>>>0>121)return g[b>>2]=0,g[b+4>>2]=0,g[b+8>>2]=0,g[b+12>>2]=0,h=5,Se=m,h|0;e:do if((Ir(h)|0)!=0&&(M=Jt(y|0,_|0,52)|0,Ie()|0,M=M&15,(M|0)!=0)){C=1;t:for(;;){switch(l=Jt(y|0,_|0,(15-C|0)*3|0)|0,Ie()|0,l&7){case 5:break t;case 0:break;default:{C=_;break e}}if(C>>>0<M>>>0)C=C+1|0;else{C=_;break e}}for(B=1,C=_;_=(15-B|0)*3|0,O=tr(7,0,_|0)|0,l=C&~(Ie()|0),C=Jt(y|0,C|0,_|0)|0,Ie()|0,C=tr(eo(C&7)|0,0,_|0)|0,y=y&~O|C,C=l|(Ie()|0),B>>>0<M>>>0;)B=B+1|0}else C=_;while(!1);if(l=7696+(h*28|0)|0,g[b>>2]=g[l>>2],g[b+4>>2]=g[l+4>>2],g[b+8>>2]=g[l+8>>2],g[b+12>>2]=g[l+12>>2],!(Gs(y,C,b)|0))return h=0,Se=m,h|0;if(O=b+4|0,g[d>>2]=g[O>>2],g[d+4>>2]=g[O+4>>2],g[d+8>>2]=g[O+8>>2],M=Jt(y|0,C|0,52)|0,Ie()|0,l=M&15,M&1?(Xo(O),M=l+1|0):M=l,!(Ir(h)|0))C=0;else{e:do if(!l)C=0;else for(_=1;;){if(B=Jt(y|0,C|0,(15-_|0)*3|0)|0,Ie()|0,B=B&7,B|0){C=B;break e}if(_>>>0<l>>>0)_=_+1|0;else{C=0;break}}while(!1);C=(C|0)==4&1}if(!(to(b,M,C,0)|0))(M|0)!=(l|0)&&(g[O>>2]=g[d>>2],g[O+4>>2]=g[d+4>>2],g[O+8>>2]=g[d+8>>2]);else{if(Ir(h)|0)do;while((to(b,M,0,0)|0)!=0);(M|0)!=(l|0)&&au(O)}return h=0,Se=m,h|0}function Oc(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;return M=Se,Se=Se+16|0,C=M,B=ec(y,_,C)|0,B|0?(Se=M,B|0):(B=Jt(y|0,_|0,52)|0,Ie()|0,kh(C,B&15,b),B=0,Se=M,B|0)}function Lc(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0;if(O=Se,Se=Se+16|0,M=O,C=ec(y,_,M)|0,C|0)return M=C,Se=O,M|0;C=Jt(y|0,_|0,45)|0,Ie()|0,C=(Ir(C&127)|0)==0,B=Jt(y|0,_|0,52)|0,Ie()|0,B=B&15;e:do if(!C){if(B|0)for(C=1;;){if(l=tr(7,0,(15-C|0)*3|0)|0,!((l&y|0)==0&((Ie()|0)&_|0)==0))break e;if(C>>>0<B>>>0)C=C+1|0;else break}return Ko(M,B,0,5,b),l=0,Se=O,l|0}while(!1);return fu(M,B,0,6,b),l=0,Se=O,l|0}function tc(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;if(B=Jt(y|0,_|0,45)|0,Ie()|0,!(Ir(B&127)|0))return B=2,g[b>>2]=B,0;if(B=Jt(y|0,_|0,52)|0,Ie()|0,B=B&15,!B)return B=5,g[b>>2]=B,0;for(C=1;;){if(M=tr(7,0,(15-C|0)*3|0)|0,!((M&y|0)==0&((Ie()|0)&_|0)==0)){C=2,y=6;break}if(C>>>0<B>>>0)C=C+1|0;else{C=5,y=6;break}}return(y|0)==6&&(g[b>>2]=C),0}function kc(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0;T=Se,Se=Se+128|0,h=T+112|0,M=T+96|0,m=T,B=Jt(y|0,_|0,52)|0,Ie()|0,l=B&15,g[h>>2]=l,O=Jt(y|0,_|0,45)|0,Ie()|0,O=O&127;e:do if(Ir(O)|0){if(l|0)for(C=1;;){if(d=tr(7,0,(15-C|0)*3|0)|0,!((d&y|0)==0&((Ie()|0)&_|0)==0)){B=0;break e}if(C>>>0<l>>>0)C=C+1|0;else break}if(B&1)B=1;else return d=tr(l+1|0,0,52)|0,m=Ie()|0|_&-15728641,h=tr(7,0,(14-l|0)*3|0)|0,m=kc((d|y)&~h,m&~(Ie()|0),b)|0,Se=T,m|0}else B=0;while(!1);if(C=ec(y,_,M)|0,!C){B?(qo(M,h,m),d=5):(hu(M,h,m),d=6);e:do if(Ir(O)|0)if(!l)y=5;else for(C=1;;){if(O=tr(7,0,(15-C|0)*3|0)|0,!((O&y|0)==0&((Ie()|0)&_|0)==0)){y=2;break e}if(C>>>0<l>>>0)C=C+1|0;else{y=5;break}}else y=2;while(!1);ia(b|0,-1,y<<2|0)|0;e:do if(B)for(M=0;;){if(O=m+(M<<4)|0,Nh(O,g[h>>2]|0)|0,O=g[O>>2]|0,l=g[b>>2]|0,(l|0)==-1|(l|0)==(O|0))C=b;else{B=0;do{if(B=B+1|0,B>>>0>=y>>>0){C=1;break e}C=b+(B<<2)|0,l=g[C>>2]|0}while(!((l|0)==-1|(l|0)==(O|0)))}if(g[C>>2]=O,M=M+1|0,M>>>0>=d>>>0){C=0;break}}else for(M=0;;){if(O=m+(M<<4)|0,to(O,g[h>>2]|0,0,1)|0,O=g[O>>2]|0,l=g[b>>2]|0,(l|0)==-1|(l|0)==(O|0))C=b;else{B=0;do{if(B=B+1|0,B>>>0>=y>>>0){C=1;break e}C=b+(B<<2)|0,l=g[C>>2]|0}while(!((l|0)==-1|(l|0)==(O|0)))}if(g[C>>2]=O,M=M+1|0,M>>>0>=d>>>0){C=0;break}}while(!1)}return m=C,Se=T,m|0}function Au(){return 12}function El(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0,d=0;if(y>>>0>15)return l=4,l|0;if(tr(y|0,0,52)|0,l=Ie()|0|134225919,!y){b=0,C=0;do Ir(C)|0&&(tr(C|0,0,45)|0,O=l|(Ie()|0),y=_+(b<<3)|0,g[y>>2]=-1,g[y+4>>2]=O,b=b+1|0),C=C+1|0;while((C|0)!=122);return b=0,b|0}b=0,O=0;do{if(Ir(O)|0){for(tr(O|0,0,45)|0,C=1,B=-1,M=l|(Ie()|0);d=tr(7,0,(15-C|0)*3|0)|0,B=B&~d,M=M&~(Ie()|0),(C|0)!=(y|0);)C=C+1|0;d=_+(b<<3)|0,g[d>>2]=B,g[d+4>>2]=M,b=b+1|0}O=O+1|0}
4207while((O|0)!=122);return b=0,b|0}function gu(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0;if(Z=Se,Se=Se+16|0,X=Z,ee=Jt(y|0,_|0,52)|0,Ie()|0,ee=ee&15,b>>>0>15)return ee=4,Se=Z,ee|0;if((ee|0)<(b|0))return ee=12,Se=Z,ee|0;if((ee|0)!=(b|0))if(M=tr(b|0,0,52)|0,M=M|y,l=Ie()|0|_&-15728641,(ee|0)>(b|0)){d=b;do z=tr(7,0,(14-d|0)*3|0)|0,d=d+1|0,M=z|M,l=Ie()|0|l;while((d|0)<(ee|0));z=M}else z=M;else z=y,l=_;L=Jt(z|0,l|0,45)|0,Ie()|0;e:do if(Ir(L&127)|0){if(d=Jt(z|0,l|0,52)|0,Ie()|0,d=d&15,d|0)for(M=1;;){if(L=tr(7,0,(15-M|0)*3|0)|0,!((L&z|0)==0&((Ie()|0)&l|0)==0)){h=33;break e}if(M>>>0<d>>>0)M=M+1|0;else break}if(L=C,g[L>>2]=0,g[L+4>>2]=0,(ee|0)>(b|0)){for(L=_&-15728641,R=ee;;){if(P=R,R=R+-1|0,R>>>0>15|(ee|0)<(R|0)){h=19;break}if((ee|0)!=(R|0))if(M=tr(R|0,0,52)|0,M=M|y,d=Ie()|0|L,(ee|0)<(P|0))T=M;else{h=R;do T=tr(7,0,(14-h|0)*3|0)|0,h=h+1|0,M=T|M,d=Ie()|0|d;while((h|0)<(ee|0));T=M}else T=y,d=_;if(m=Jt(T|0,d|0,45)|0,Ie()|0,!(Ir(m&127)|0))M=0;else{m=Jt(T|0,d|0,52)|0,Ie()|0,m=m&15;t:do if(!m)M=0;else for(h=1;;){if(M=Jt(T|0,d|0,(15-h|0)*3|0)|0,Ie()|0,M=M&7,M|0)break t;if(h>>>0<m>>>0)h=h+1|0;else{M=0;break}}while(!1);M=(M|0)==0&1}if(d=Jt(y|0,_|0,(15-P|0)*3|0)|0,Ie()|0,d=d&7,(d|0)==7){B=5,h=42;break}if(M=(M|0)!=0,(d|0)==1&M){B=5,h=42;break}if(T=d+(((d|0)!=0&M)<<31>>31)|0,T|0&&(h=ee-P|0,h=Hs(7,0,h,((h|0)<0)<<31>>31)|0,m=Ie()|0,M?(M=di(h|0,m|0,5,0)|0,M=An(M|0,Ie()|0,-5,-1)|0,M=js(M|0,Ie()|0,6,0)|0,M=An(M|0,Ie()|0,1,0)|0,d=Ie()|0):(M=h,d=m),P=T+-1|0,P=di(h|0,m|0,P|0,((P|0)<0)<<31>>31|0)|0,P=An(M|0,d|0,P|0,Ie()|0)|0,T=Ie()|0,m=C,m=An(P|0,T|0,g[m>>2]|0,g[m+4>>2]|0)|0,T=Ie()|0,P=C,g[P>>2]=m,g[P+4>>2]=T),(R|0)<=(b|0)){h=37;break}}if((h|0)==19)Xt(23313,22674,1099,22710);else if((h|0)==37){O=C,B=g[O+4>>2]|0,O=g[O>>2]|0;break}else if((h|0)==42)return Se=Z,B|0}else B=0,O=0}else h=33;while(!1);e:do if((h|0)==33)if(L=C,g[L>>2]=0,g[L+4>>2]=0,(ee|0)>(b|0)){for(M=ee;;){if(B=Jt(y|0,_|0,(15-M|0)*3|0)|0,Ie()|0,B=B&7,(B|0)==7){B=5;break}if(O=ee-M|0,O=Hs(7,0,O,((O|0)<0)<<31>>31)|0,B=di(O|0,Ie()|0,B|0,0)|0,O=Ie()|0,L=C,O=An(g[L>>2]|0,g[L+4>>2]|0,B|0,O|0)|0,B=Ie()|0,L=C,g[L>>2]=O,g[L+4>>2]=B,M=M+-1|0,(M|0)<=(b|0))break e}return Se=Z,B|0}else B=0,O=0;while(!1);return Tl(z,l,ee,X)|0&&Xt(23313,22674,1063,22725),ee=X,X=g[ee+4>>2]|0,((B|0)>-1|(B|0)==-1&O>>>0>4294967295)&((X|0)>(B|0)|((X|0)==(B|0)?(g[ee>>2]|0)>>>0>O>>>0:0))?(ee=0,Se=Z,ee|0):(Xt(23313,22674,1139,22710),0)}function nA(y,_,b,C,B,M){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0,M=M|0;var O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0;if(T=Se,Se=Se+16|0,O=T,B>>>0>15)return M=4,Se=T,M|0;if(l=Jt(b|0,C|0,52)|0,Ie()|0,l=l&15,(l|0)>(B|0))return M=12,Se=T,M|0;if(Tl(b,C,B,O)|0&&Xt(23313,22674,1063,22725),m=O,h=g[m+4>>2]|0,!(((_|0)>-1|(_|0)==-1&y>>>0>4294967295)&((h|0)>(_|0)|((h|0)==(_|0)?(g[m>>2]|0)>>>0>y>>>0:0))))return M=2,Se=T,M|0;m=B-l|0,B=tr(B|0,0,52)|0,d=Ie()|0|C&-15728641,h=M,g[h>>2]=B|b,g[h+4>>2]=d,h=Jt(b|0,C|0,45)|0,Ie()|0;e:do if(Ir(h&127)|0){if(l|0)for(O=1;;){if(h=tr(7,0,(15-O|0)*3|0)|0,!((h&b|0)==0&((Ie()|0)&C|0)==0))break e;if(O>>>0<l>>>0)O=O+1|0;else break}if((m|0)<1)return M=0,Se=T,M|0;for(h=l^15,C=-1,d=1,O=1;;){l=m-d|0,l=Hs(7,0,l,((l|0)<0)<<31>>31)|0,b=Ie()|0;do if(O)if(O=di(l|0,b|0,5,0)|0,O=An(O|0,Ie()|0,-5,-1)|0,O=js(O|0,Ie()|0,6,0)|0,B=Ie()|0,(_|0)>(B|0)|(_|0)==(B|0)&y>>>0>O>>>0){_=An(y|0,_|0,-1,-1)|0,_=Kr(_|0,Ie()|0,O|0,B|0)|0,O=Ie()|0,P=M,L=g[P>>2]|0,P=g[P+4>>2]|0,z=(h+C|0)*3|0,R=tr(7,0,z|0)|0,P=P&~(Ie()|0),C=js(_|0,O|0,l|0,b|0)|0,y=Ie()|0,B=An(C|0,y|0,2,0)|0,z=tr(B|0,Ie()|0,z|0)|0,P=Ie()|0|P,B=M,g[B>>2]=z|L&~R,g[B+4>>2]=P,y=di(C|0,y|0,l|0,b|0)|0,y=Kr(_|0,O|0,y|0,Ie()|0)|0,O=0,_=Ie()|0;break}else{z=M,R=g[z>>2]|0,z=g[z+4>>2]|0,L=tr(7,0,(h+C|0)*3|0)|0,z=z&~(Ie()|0),O=M,g[O>>2]=R&~L,g[O+4>>2]=z,O=1;break}else R=M,B=g[R>>2]|0,R=g[R+4>>2]|0,C=(h+C|0)*3|0,P=tr(7,0,C|0)|0,R=R&~(Ie()|0),z=js(y|0,_|0,l|0,b|0)|0,O=Ie()|0,C=tr(z|0,O|0,C|0)|0,R=Ie()|0|R,L=M,g[L>>2]=C|B&~P,g[L+4>>2]=R,O=di(z|0,O|0,l|0,b|0)|0,y=Kr(y|0,_|0,O|0,Ie()|0)|0,O=0,_=Ie()|0;while(!1);if((m|0)>(d|0))C=~d,d=d+1|0;else{_=0;break}}return Se=T,_|0}while(!1);if((m|0)<1)return z=0,Se=T,z|0;for(B=l^15,O=1;;)if(L=m-O|0,L=Hs(7,0,L,((L|0)<0)<<31>>31)|0,z=Ie()|0,d=M,b=g[d>>2]|0,d=g[d+4>>2]|0,l=(B-O|0)*3|0,C=tr(7,0,l|0)|0,d=d&~(Ie()|0),P=js(y|0,_|0,L|0,z|0)|0,R=Ie()|0,l=tr(P|0,R|0,l|0)|0,d=Ie()|0|d,h=M,g[h>>2]=l|b&~C,g[h+4>>2]=d,z=di(P|0,R|0,L|0,z|0)|0,y=Kr(y|0,_|0,z|0,Ie()|0)|0,_=Ie()|0,(m|0)<=(O|0)){_=0;break}else O=O+1|0;return Se=T,_|0}function Bl(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0;B=Jt(_|0,b|0,52)|0,Ie()|0,B=B&15,(_|0)==0&(b|0)==0|((C|0)>15|(B|0)>(C|0))?(C=-1,B=-1,_=0,b=0):(M=du(_,b,B+1|0,C)|0,b=(Ie()|0)&-15728641,_=tr(C|0,0,52)|0,_=M|_,b=b|(Ie()|0),M=(Fn(_,b)|0)==0,C=M?-1:C),M=y,g[M>>2]=_,g[M+4>>2]=b,g[y+8>>2]=B,g[y+12>>2]=C}function mu(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0,d=0,h=0;if(b=y,_=g[b>>2]|0,b=g[b+4>>2]|0,!((_|0)==0&(b|0)==0)&&(C=Jt(_|0,b|0,52)|0,Ie()|0,C=C&15,l=tr(1,0,(C^15)*3|0)|0,_=An(l|0,Ie()|0,_|0,b|0)|0,b=Ie()|0,l=y,g[l>>2]=_,g[l+4>>2]=b,l=y+8|0,O=g[l>>2]|0,!((C|0)<(O|0)))){for(d=y+12|0,M=C;;){if((M|0)==(O|0)){C=5;break}if(h=(M|0)==(g[d>>2]|0),B=(15-M|0)*3|0,C=Jt(_|0,b|0,B|0)|0,Ie()|0,C=C&7,h&((C|0)==1&!0)){C=7;break}if(!((C|0)==7&!0)){C=10;break}if(h=tr(1,0,B|0)|0,_=An(_|0,b|0,h|0,Ie()|0)|0,b=Ie()|0,h=y,g[h>>2]=_,g[h+4>>2]=b,(M|0)>(O|0))M=M+-1|0;else{C=10;break}}if((C|0)==5){h=y,g[h>>2]=0,g[h+4>>2]=0,g[l>>2]=-1,g[d>>2]=-1;return}else if((C|0)==7){O=tr(1,0,B|0)|0,O=An(_|0,b|0,O|0,Ie()|0)|0,l=Ie()|0,h=y,g[h>>2]=O,g[h+4>>2]=l,g[d>>2]=M+-1;return}else if((C|0)==10)return}}function Nc(y){y=+y;var _=0;return _=y<0?y+6.283185307179586:y,+(y>=6.283185307179586?_+-6.283185307179586:_)}function rc(y,_){return y=y|0,_=_|0,+Pt(+(+ce[y>>3]-+ce[_>>3]))<17453292519943298e-27?(_=+Pt(+(+ce[y+8>>3]-+ce[_+8>>3]))<17453292519943298e-27,_|0):(_=0,_|0)}function _u(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0;return B=+ce[_>>3],C=+ce[y>>3],M=+Mt(+((B-C)*.5)),b=+Mt(+((+ce[_+8>>3]-+ce[y+8>>3])*.5)),b=M*M+b*(+Lt(+B)*+Lt(+C)*b),+(+cn(+ +Ot(+b),+ +Ot(+(1-b)))*2)}function nc(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0;return B=+ce[_>>3],C=+ce[y>>3],M=+Mt(+((B-C)*.5)),b=+Mt(+((+ce[_+8>>3]-+ce[y+8>>3])*.5)),b=M*M+b*(+Lt(+B)*+Lt(+C)*b),+(+cn(+ +Ot(+b),+ +Ot(+(1-b)))*2*6371.007180918475)}function bf(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0;return B=+ce[_>>3],C=+ce[y>>3],M=+Mt(+((B-C)*.5)),b=+Mt(+((+ce[_+8>>3]-+ce[y+8>>3])*.5)),b=M*M+b*(+Lt(+B)*+Lt(+C)*b),+(+cn(+ +Ot(+b),+ +Ot(+(1-b)))*2*6371.007180918475*1e3)}function xf(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0;return M=+ce[_>>3],C=+Lt(+M),B=+ce[_+8>>3]-+ce[y+8>>3],O=C*+Mt(+B),b=+ce[y>>3],+ +cn(+O,+(+Mt(+M)*+Lt(+b)-+Lt(+B)*(C*+Mt(+b))))}function Sl(y,_,b,C){y=y|0,_=+_,b=+b,C=C|0;var B=0,M=0,O=0,l=0;if(b<1e-16){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];return}M=_<0?_+6.283185307179586:_,M=_>=6.283185307179586?M+-6.283185307179586:M;do if(M<1e-16)_=+ce[y>>3]+b,ce[C>>3]=_,B=C;else{if(B=+Pt(+(M+-3.141592653589793))<1e-16,_=+ce[y>>3],B){_=_-b,ce[C>>3]=_,B=C;break}if(O=+Lt(+b),b=+Mt(+b),_=O*+Mt(+_)+ +Lt(+M)*(b*+Lt(+_)),_=_>1?1:_,_=+Qt(+(_<-1?-1:_)),ce[C>>3]=_,+Pt(+(_+-1.5707963267948966))<1e-16){ce[C>>3]=1.5707963267948966,ce[C+8>>3]=0;return}if(+Pt(+(_+1.5707963267948966))<1e-16){ce[C>>3]=-1.5707963267948966,ce[C+8>>3]=0;return}if(l=+Lt(+_),M=b*+Mt(+M)/l,b=+ce[y>>3],_=(O-+Mt(+_)*+Mt(+b))/+Lt(+b)/l,O=M>1?1:M,_=_>1?1:_,_=+ce[y+8>>3]+ +cn(+(O<-1?-1:O),+(_<-1?-1:_)),_>3.141592653589793)do _=_+-6.283185307179586;while(_>3.141592653589793);if(_<-3.141592653589793)do _=_+6.283185307179586;while(_<-3.141592653589793);ce[C+8>>3]=_;return}while(!1);if(+Pt(+(_+-1.5707963267948966))<1e-16){ce[B>>3]=1.5707963267948966,ce[C+8>>3]=0;return}if(+Pt(+(_+1.5707963267948966))<1e-16){ce[B>>3]=-1.5707963267948966,ce[C+8>>3]=0;return}if(_=+ce[y+8>>3],_>3.141592653589793)do _=_+-6.283185307179586;while(_>3.141592653589793);if(_<-3.141592653589793)do _=_+6.283185307179586;while(_<-3.141592653589793);ce[C+8>>3]=_}function Gh(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(ce[_>>3]=+ce[20528+(y<<3)>>3],_=0,_|0)}function ic(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(ce[_>>3]=+ce[20656+(y<<3)>>3],_=0,_|0)}function Wn(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(ce[_>>3]=+ce[20784+(y<<3)>>3],_=0,_|0)}function yu(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(ce[_>>3]=+ce[20912+(y<<3)>>3],_=0,_|0)}function Qo(y,_){y=y|0,_=_|0;var b=0;return y>>>0>15?(_=4,_|0):(b=Hs(7,0,y,((y|0)<0)<<31>>31)|0,b=di(b|0,Ie()|0,120,0)|0,y=Ie()|0,g[_>>2]=b|2,g[_+4>>2]=y,_=0,_|0)}function ea(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0;return P=+ce[_>>3],m=+ce[y>>3],d=+Mt(+((P-m)*.5)),M=+ce[_+8>>3],h=+ce[y+8>>3],O=+Mt(+((M-h)*.5)),l=+Lt(+m),T=+Lt(+P),O=d*d+O*(T*l*O),O=+cn(+ +Ot(+O),+ +Ot(+(1-O)))*2,d=+ce[b>>3],P=+Mt(+((d-P)*.5)),C=+ce[b+8>>
42073],M=+Mt(+((C-M)*.5)),B=+Lt(+d),M=P*P+M*(T*B*M),M=+cn(+ +Ot(+M),+ +Ot(+(1-M)))*2,d=+Mt(+((m-d)*.5)),C=+Mt(+((h-C)*.5)),C=d*d+C*(l*B*C),C=+cn(+ +Ot(+C),+ +Ot(+(1-C)))*2,B=(O+M+C)*.5,+(+en(+ +Ot(+(+Ht(+(B*.5))*+Ht(+((B-O)*.5))*+Ht(+((B-M)*.5))*+Ht(+((B-C)*.5)))))*4)}function fn(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0;if(l=Se,Se=Se+192|0,M=l+168|0,O=l,B=Oc(y,_,M)|0,B|0)return b=B,Se=l,b|0;if(Lc(y,_,O)|0&&Xt(23313,22742,386,22751),_=g[O>>2]|0,(_|0)>0){if(C=+ea(O+8|0,O+8+(((_|0)!=1&1)<<4)|0,M)+0,(_|0)!=1){y=1;do B=y,y=y+1|0,C=C+ +ea(O+8+(B<<4)|0,O+8+(((y|0)%(_|0)|0)<<4)|0,M);while((y|0)<(_|0))}}else C=0;return ce[b>>3]=C,b=0,Se=l,b|0}function Ln(y,_,b){return y=y|0,_=_|0,b=b|0,y=fn(y,_,b)|0,y|0||(ce[b>>3]=+ce[b>>3]*6371.007180918475*6371.007180918475),y|0}function Vs(y,_,b){return y=y|0,_=_|0,b=b|0,y=fn(y,_,b)|0,y|0||(ce[b>>3]=+ce[b>>3]*6371.007180918475*6371.007180918475*1e3*1e3),y|0}function Il(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0;if(l=Se,Se=Se+176|0,O=l,y=lu(y,_,O)|0,y|0)return O=y,Se=l,O|0;if(ce[b>>3]=0,y=g[O>>2]|0,(y|0)<=1)return O=0,Se=l,O|0;_=y+-1|0,y=0,C=+ce[O+8>>3],B=+ce[O+16>>3],M=0;do y=y+1|0,h=C,C=+ce[O+8+(y<<4)>>3],m=+Mt(+((C-h)*.5)),d=B,B=+ce[O+8+(y<<4)+8>>3],d=+Mt(+((B-d)*.5)),d=m*m+d*(+Lt(+C)*+Lt(+h)*d),M=M+ +cn(+ +Ot(+d),+ +Ot(+(1-d)))*2;while((y|0)<(_|0));return ce[b>>3]=M,O=0,Se=l,O|0}function Uc(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0;if(l=Se,Se=Se+176|0,O=l,y=lu(y,_,O)|0,y|0)return O=y,M=+ce[b>>3],M=M*6371.007180918475,ce[b>>3]=M,Se=l,O|0;if(ce[b>>3]=0,y=g[O>>2]|0,(y|0)<=1)return O=0,M=0,M=M*6371.007180918475,ce[b>>3]=M,Se=l,O|0;_=y+-1|0,y=0,C=+ce[O+8>>3],B=+ce[O+16>>3],M=0;do y=y+1|0,h=C,C=+ce[O+8+(y<<4)>>3],m=+Mt(+((C-h)*.5)),d=B,B=+ce[O+8+(y<<4)+8>>3],d=+Mt(+((B-d)*.5)),d=m*m+d*(+Lt(+h)*+Lt(+C)*d),M=M+ +cn(+ +Ot(+d),+ +Ot(+(1-d)))*2;while((y|0)!=(_|0));return ce[b>>3]=M,O=0,m=M,m=m*6371.007180918475,ce[b>>3]=m,Se=l,O|0}function Ml(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0;if(l=Se,Se=Se+176|0,O=l,y=lu(y,_,O)|0,y|0)return O=y,M=+ce[b>>3],M=M*6371.007180918475,M=M*1e3,ce[b>>3]=M,Se=l,O|0;if(ce[b>>3]=0,y=g[O>>2]|0,(y|0)<=1)return O=0,M=0,M=M*6371.007180918475,M=M*1e3,ce[b>>3]=M,Se=l,O|0;_=y+-1|0,y=0,C=+ce[O+8>>3],B=+ce[O+16>>3],M=0;do y=y+1|0,h=C,C=+ce[O+8+(y<<4)>>3],m=+Mt(+((C-h)*.5)),d=B,B=+ce[O+8+(y<<4)+8>>3],d=+Mt(+((B-d)*.5)),d=m*m+d*(+Lt(+h)*+Lt(+C)*d),M=M+ +cn(+ +Ot(+d),+ +Ot(+(1-d)))*2;while((y|0)!=(_|0));return ce[b>>3]=M,O=0,m=M,m=m*6371.007180918475,m=m*1e3,ce[b>>3]=m,Se=l,O|0}function iA(y){y=y|0;var _=0,b=0,C=0;return _=oo(1,12)|0,_||Xt(22832,22787,49,22845),b=y+4|0,C=g[b>>2]|0,C|0?(C=C+8|0,g[C>>2]=_,g[b>>2]=_,_|0):(g[y>>2]|0&&Xt(22862,22787,61,22885),C=y,g[C>>2]=_,g[b>>2]=_,_|0)}function sA(y,_){y=y|0,_=_|0;var b=0,C=0;return C=Jn(24)|0,C||Xt(22899,22787,78,22913),g[C>>2]=g[_>>2],g[C+4>>2]=g[_+4>>2],g[C+8>>2]=g[_+8>>2],g[C+12>>2]=g[_+12>>2],g[C+16>>2]=0,_=y+4|0,b=g[_>>2]|0,b|0?(g[b+16>>2]=C,g[_>>2]=C,C|0):(g[y>>2]|0&&Xt(22928,22787,82,22913),g[y>>2]=C,g[_>>2]=C,C|0)}function zc(y){y=y|0;var _=0,b=0,C=0,B=0;if(y)for(C=1;;){if(_=g[y>>2]|0,_|0)do{if(b=g[_>>2]|0,b|0)do B=b,b=g[b+16>>2]|0,zr(B);while((b|0)!=0);B=_,_=g[_+8>>2]|0,zr(B)}while((_|0)!=0);if(_=y,y=g[y+8>>2]|0,C||zr(_),y)C=0;else break}}function Pl(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0,Re=0,He=0,We=0,nt=0,Xe=0,Qe=0,pt=0,Dt=0,Ct=0;if(B=y+8|0,g[B>>2]|0)return Ct=1,Ct|0;if(C=g[y>>2]|0,!C)return Ct=0,Ct|0;_=C,b=0;do b=b+1|0,_=g[_+8>>2]|0;while((_|0)!=0);if(b>>>0<2)return Ct=0,Ct|0;pt=Jn(b<<2)|0,pt||Xt(22948,22787,317,22967),Qe=Jn(b<<5)|0,Qe||Xt(22989,22787,321,22967),g[y>>2]=0,Fe=y+4|0,g[Fe>>2]=0,g[B>>2]=0,b=0,Xe=0,we=0,T=0;e:for(;;){if(m=g[C>>2]|0,m){M=0,O=m;do{if(d=+ce[O+8>>3],_=O,O=g[O+16>>2]|0,h=(O|0)==0,B=h?m:O,l=+ce[B+8>>3],+Pt(+(d-l))>3.141592653589793){Ct=14;break}M=M+(l-d)*(+ce[_>>3]+ +ce[B>>3])}while(!h);if((Ct|0)==14){Ct=0,M=0,_=m;do oe=+ce[_+8>>3],nt=_+16|0,We=g[nt>>2]|0,We=(We|0)==0?m:We,te=+ce[We+8>>3],M=M+(+ce[_>>3]+ +ce[We>>3])*((te<0?te+6.283185307179586:te)-(oe<0?oe+6.283185307179586:oe)),_=g[((_|0)==0?C:nt)>>2]|0;while((_|0)!=0)}M>0?(g[pt+(Xe<<2)>>2]=C,Xe=Xe+1|0,B=we,_=T):Ct=19}else Ct=19;if((Ct|0)==19){Ct=0;do if(b){if(_=b+8|0,g[_>>2]|0){Ct=21;break e}if(b=oo(1,12)|0,!b){Ct=23;break e}g[_>>2]=b,B=b+4|0,O=b,_=T}else if(T){B=Fe,O=T+8|0,_=C,b=y;break}else if(g[y>>2]|0){Ct=27;break e}else{B=Fe,O=y,_=C,b=y;break}while(!1);if(g[O>>2]=C,g[B>>2]=C,O=Qe+(we<<5)|0,h=g[C>>2]|0,h){for(m=Qe+(we<<5)+8|0,ce[m>>3]=17976931348623157e292,T=Qe+(we<<5)+24|0,ce[T>>3]=17976931348623157e292,ce[O>>3]=-17976931348623157e292,P=Qe+(we<<5)+16|0,ce[P>>3]=-17976931348623157e292,ee=17976931348623157e292,Z=-17976931348623157e292,B=0,R=h,d=17976931348623157e292,z=17976931348623157e292,X=-17976931348623157e292,l=-17976931348623157e292;M=+ce[R>>3],oe=+ce[R+8>>3],R=g[R+16>>2]|0,L=(R|0)==0,te=+ce[(L?h:R)+8>>3],M<d&&(ce[m>>3]=M,d=M),oe<z&&(ce[T>>3]=oe,z=oe),M>X?ce[O>>3]=M:M=X,oe>l&&(ce[P>>3]=oe,l=oe),ee=oe>0&oe<ee?oe:ee,Z=oe<0&oe>Z?oe:Z,B=B|+Pt(+(oe-te))>3.141592653589793,!L;)X=M;B&&(ce[P>>3]=Z,ce[T>>3]=ee)}else g[O>>2]=0,g[O+4>>2]=0,g[O+8>>2]=0,g[O+12>>2]=0,g[O+16>>2]=0,g[O+20>>2]=0,g[O+24>>2]=0,g[O+28>>2]=0;B=we+1|0}if(nt=C+8|0,C=g[nt>>2]|0,g[nt>>2]=0,C)we=B,T=_;else{Ct=45;break}}if((Ct|0)==21)Xt(22765,22787,35,22799);else if((Ct|0)==23)Xt(22819,22787,37,22799);else if((Ct|0)==27)Xt(22862,22787,61,22885);else if((Ct|0)==45){e:do if((Xe|0)>0){for(nt=(B|0)==0,He=B<<2,We=(y|0)==0,Re=0,_=0;;){if(ge=g[pt+(Re<<2)>>2]|0,nt)Ct=73;else{if(we=Jn(He)|0,!we){Ct=50;break}if(Fe=Jn(He)|0,!Fe){Ct=52;break}t:do if(We)b=0;else{for(B=0,b=0,O=y;C=Qe+(B<<5)|0,Fo(g[O>>2]|0,C,g[ge>>2]|0)|0?(g[we+(b<<2)>>2]=O,g[Fe+(b<<2)>>2]=C,L=b+1|0):L=b,O=g[O+8>>2]|0,O;)B=B+1|0,b=L;if((L|0)>0)if(C=g[we>>2]|0,(L|0)==1)b=C;else for(P=0,R=-1,b=C,T=C;;){for(h=g[T>>2]|0,C=0,O=0;B=g[g[we+(O<<2)>>2]>>2]|0,(B|0)==(h|0)?m=C:m=C+((Fo(B,g[Fe+(O<<2)>>2]|0,g[h>>2]|0)|0)&1)|0,O=O+1|0,(O|0)!=(L|0);)C=m;if(B=(m|0)>(R|0),b=B?T:b,C=P+1|0,(C|0)==(L|0))break t;P=C,R=B?m:R,T=g[we+(C<<2)>>2]|0}else b=0}while(!1);if(zr(we),zr(Fe),b){if(B=b+4|0,C=g[B>>2]|0,C)b=C+8|0;else if(g[b>>2]|0){Ct=70;break}g[b>>2]=ge,g[B>>2]=ge}else Ct=73}if((Ct|0)==73){if(Ct=0,_=g[ge>>2]|0,_|0)do Fe=_,_=g[_+16>>2]|0,zr(Fe);while((_|0)!=0);zr(ge),_=1}if(Re=Re+1|0,(Re|0)>=(Xe|0)){Dt=_;break e}}(Ct|0)==50?Xt(23004,22787,249,23023):(Ct|0)==52?Xt(23042,22787,252,23023):(Ct|0)==70&&Xt(22862,22787,61,22885)}else Dt=0;while(!1);return zr(pt),zr(Qe),Ct=Dt,Ct|0}return 0}function Fo(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0;if(!(Us(_,b)|0)||(_=xl(_)|0,C=+ce[b>>3],B=+ce[b+8>>3],B=_&B<0?B+6.283185307179586:B,y=g[y>>2]|0,!y))return y=0,y|0;if(_){_=0,h=B,b=y;e:for(;;){for(;O=+ce[b>>3],B=+ce[b+8>>3],b=b+16|0,m=g[b>>
42072]|0,m=(m|0)==0?y:m,M=+ce[m>>3],l=+ce[m+8>>3],O>M?(d=O,O=l):(d=M,M=O,O=B,B=l),C=C==M|C==d?C+2220446049250313e-31:C,!!(C<M|C>d);)if(b=g[b>>2]|0,!b){b=22;break e}if(l=O<0?O+6.283185307179586:O,O=B<0?B+6.283185307179586:B,h=l==h|O==h?h+-2220446049250313e-31:h,d=l+(O-l)*((C-M)/(d-M)),(d<0?d+6.283185307179586:d)>h&&(_=_^1),b=g[b>>2]|0,!b){b=22;break}}if((b|0)==22)return _|0}else{_=0,h=B,b=y;e:for(;;){for(;O=+ce[b>>3],B=+ce[b+8>>3],b=b+16|0,m=g[b>>2]|0,m=(m|0)==0?y:m,M=+ce[m>>3],l=+ce[m+8>>3],O>M?(d=O,O=l):(d=M,M=O,O=B,B=l),C=C==M|C==d?C+2220446049250313e-31:C,!!(C<M|C>d);)if(b=g[b>>2]|0,!b){b=22;break e}if(h=O==h|B==h?h+-2220446049250313e-31:h,O+(B-O)*((C-M)/(d-M))>h&&(_=_^1),b=g[b>>2]|0,!b){b=22;break}}if((b|0)==22)return _|0}return 0}function kn(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0;if(Z=Se,Se=Se+32|0,ee=Z+16|0,X=Z,M=Jt(y|0,_|0,52)|0,Ie()|0,M=M&15,R=Jt(b|0,C|0,52)|0,Ie()|0,(M|0)!=(R&15|0))return ee=12,Se=Z,ee|0;if(h=Jt(y|0,_|0,45)|0,Ie()|0,h=h&127,m=Jt(b|0,C|0,45)|0,Ie()|0,m=m&127,h>>>0>121|m>>>0>121)return ee=5,Se=Z,ee|0;if(R=(h|0)!=(m|0),R){if(l=vl(h,m)|0,(l|0)==7)return ee=1,Se=Z,ee|0;
4207d=vl(m,h)|0,(d|0)==7?Xt(23066,23090,161,23100):(L=l,O=d)}else L=0,O=0;T=Ir(h)|0,P=Ir(m)|0,g[ee>>2]=0,g[ee+4>>2]=0,g[ee+8>>2]=0,g[ee+12>>2]=0;do if(L){if(m=g[4272+(h*28|0)+(L<<2)>>2]|0,l=(m|0)>0,P)if(l){h=0,d=b,l=C;do d=pu(d,l)|0,l=Ie()|0,O=eo(O)|0,(O|0)==1&&(O=eo(1)|0),h=h+1|0;while((h|0)!=(m|0));m=O,h=d,d=l}else m=O,h=b,d=C;else if(l){h=0,d=b,l=C;do d=Za(d,l)|0,l=Ie()|0,O=eo(O)|0,h=h+1|0;while((h|0)!=(m|0));m=O,h=d,d=l}else m=O,h=b,d=C;if(Gs(h,d,ee)|0,R||Xt(23115,23090,191,23100),l=(T|0)!=0,O=(P|0)!=0,l&O&&Xt(23142,23090,192,23100),l){if(O=ns(y,_)|0,(O|0)==7){M=5;break}if(Be[21872+(O*7|0)+L>>0]|0){M=1;break}d=g[21040+(O*28|0)+(L<<2)>>2]|0,h=d}else if(O){if(O=ns(h,d)|0,(O|0)==7){M=5;break}if(Be[21872+(O*7|0)+m>>0]|0){M=1;break}h=0,d=g[21040+(m*28|0)+(O<<2)>>2]|0}else h=0,d=0;if((h|d|0)<0)M=5;else{if((d|0)>0){l=ee+4|0,O=0;do cu(l),O=O+1|0;while((O|0)!=(d|0))}if(g[X>>2]=0,g[X+4>>2]=0,g[X+8>>2]=0,mf(X,L),M|0)for(;zs(M)|0?Pc(X):Xo(X),(M|0)>1;)M=M+-1|0;if((h|0)>0){M=0;do cu(X),M=M+1|0;while((M|0)!=(h|0))}z=ee+4|0,zn(z,X,z),vi(z),z=51}}else if(Gs(b,C,ee)|0,(T|0)!=0&(P|0)!=0)if((m|0)!=(h|0)&&Xt(23173,23090,261,23100),O=ns(y,_)|0,M=ns(b,C)|0,(O|0)==7|(M|0)==7)M=5;else if(Be[21872+(O*7|0)+M>>0]|0)M=1;else if(O=g[21040+(O*28|0)+(M<<2)>>2]|0,(O|0)>0){l=ee+4|0,M=0;do cu(l),M=M+1|0;while((M|0)!=(O|0));z=51}else z=51;else z=51;while(!1);return(z|0)==51&&(M=ee+4|0,g[B>>2]=g[M>>2],g[B+4>>2]=g[M+4>>2],g[B+8>>2]=g[M+8>>2],M=0),ee=M,Se=Z,ee|0}function Gc(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0;if(z=Se,Se=Se+48|0,h=z+36|0,O=z+24|0,l=z+12|0,d=z,B=Jt(y|0,_|0,52)|0,Ie()|0,B=B&15,P=Jt(y|0,_|0,45)|0,Ie()|0,P=P&127,P>>>0>121)return C=5,Se=z,C|0;if(m=Ir(P)|0,tr(B|0,0,52)|0,X=Ie()|0|134225919,M=C,g[M>>2]=-1,g[M+4>>2]=X,!B)return B=wl(b)|0,(B|0)==7||(B=va(P,B)|0,(B|0)==127)?(X=1,Se=z,X|0):(R=tr(B|0,0,45)|0,L=Ie()|0,P=C,L=g[P+4>>2]&-1040385|L,X=C,g[X>>2]=g[P>>2]|R,g[X+4>>2]=L,X=0,Se=z,X|0);for(g[h>>2]=g[b>>2],g[h+4>>2]=g[b+4>>2],g[h+8>>2]=g[b+8>>2],b=B;;){if(M=b,b=b+-1|0,g[O>>2]=g[h>>2],g[O+4>>2]=g[h+4>>2],g[O+8>>2]=g[h+8>>
42072],zs(M)|0){if(B=Qp(h)|0,B|0){b=13;break}g[l>>2]=g[h>>2],g[l+4>>2]=g[h+4>>2],g[l+8>>2]=g[h+8>>2],Pc(l)}else{if(B=eA(h)|0,B|0){b=13;break}g[l>>2]=g[h>>2],g[l+4>>2]=g[h+4>>2],g[l+8>>2]=g[h+8>>2],Xo(l)}if(hi(O,l,d),vi(d),B=C,Z=g[B>>2]|0,B=g[B+4>>2]|0,te=(15-M|0)*3|0,ee=tr(7,0,te|0)|0,B=B&~(Ie()|0),te=tr(wl(d)|0,0,te|0)|0,B=Ie()|0|B,X=C,g[X>>2]=te|Z&~ee,g[X+4>>2]=B,(M|0)<=1){b=14;break}}e:do if((b|0)!=13&&(b|0)==14)if((g[h>>2]|0)<=1&&(g[h+4>>2]|0)<=1&&(g[h+8>>2]|0)<=1){b=wl(h)|0,B=va(P,b)|0,(B|0)==127?d=0:d=Ir(B)|0;t:do if(b){if(m){if(B=ns(y,_)|0,(B|0)==7){B=5;break e}if(M=g[21248+(B*28|0)+(b<<2)>>2]|0,(M|0)>0){B=b,b=0;do B=xo(B)|0,b=b+1|0;while((b|0)!=(M|0))}else B=b;if((B|0)==1){B=9;break e}b=va(P,B)|0,(b|0)==127&&Xt(23200,23090,411,23230),Ir(b)|0?Xt(23245,23090,412,23230):(L=b,R=M,T=B)}else L=B,R=0,T=b;if(l=g[4272+(P*28|0)+(T<<2)>>2]|0,(l|0)<=-1&&Xt(23276,23090,419,23230),!d){if((R|0)<0){B=5;break e}if(R|0){M=C,B=0,b=g[M>>2]|0,M=g[M+4>>2]|0;do b=wo(b,M)|0,M=Ie()|0,te=C,g[te>>2]=b,g[te+4>>2]=M,B=B+1|0;while((B|0)<(R|0))}if((l|0)<=0){B=L,b=58;break}for(M=C,B=0,b=g[M>>2]|0,M=g[M+4>>2]|0;;)if(b=wo(b,M)|0,M=Ie()|0,te=C,g[te>>2]=b,g[te+4>>2]=M,B=B+1|0,(B|0)==(l|0)){B=L,b=58;break t}}if(O=vl(L,P)|0,(O|0)==7&&Xt(23066,23090,428,23230),B=C,b=g[B>>2]|0,B=g[B+4>>2]|0,(l|0)>0){M=0;do b=wo(b,B)|0,B=Ie()|0,te=C,g[te>>2]=b,g[te+4>>2]=B,M=M+1|0;while((M|0)!=(l|0))}if(B=ns(b,B)|0,(B|0)==7&&Xt(23313,23090,440,23230),b=fi(L)|0,b=g[(b?21664:21456)+(O*28|0)+(B<<2)>>2]|0,(b|0)<0&&Xt(23313,23090,454,23230),!b)B=L,b=58;else{O=C,B=0,M=g[O>>2]|0,O=g[O+4>>2]|0;do M=Sa(M,O)|0,O=Ie()|0,te=C,g[te>>2]=M,g[te+4>>2]=O,B=B+1|0;while((B|0)<(b|0));B=L,b=58}}else if((m|0)!=0&(d|0)!=0){if(b=ns(y,_)|0,M=C,M=ns(g[M>>2]|0,g[M+4>>2]|0)|0,(b|0)==7|(M|0)==7){B=5;break e}if(M=g[21248+(b*28|0)+(M<<2)>>2]|0,(M|0)<0){B=5;break e}if(!M)b=59;else{l=C,b=0,O=g[l>>2]|0,l=g[l+4>>2]|0;do O=wo(O,l)|0,l=Ie()|0,te=C,g[te>>2]=O,g[te+4>>2]=l,b=b+1|0;while((b|0)<(M|0));b=58}}else b=58;while(!1);if((b|0)==58&&d&&(b=59),(b|0)==59&&(te=C,(ns(g[te>>2]|0,g[te+4>>2]|0)|0)==1)){B=9;break}te=C,ee=g[te>>2]|0,te=g[te+4>>2]&-1040385,Z=tr(B|0,0,45)|0,te=te|(Ie()|0),B=C,g[B>>2]=ee|Z,g[B+4>>2]=te,B=0}else B=1;while(!1);return te=B,Se=z,te|0}function Vh(y,_,b,C,B,M){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0,M=M|0;var O=0,l=0;return l=Se,Se=Se+16|0,O=l,B?y=15:(y=kn(y,_,b,C,O)|0,y||(wa(O,M),y=0)),Se=l,y|0}function Ci(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0;return O=Se,Se=Se+16|0,M=O,C?b=15:(b=Ca(b,M)|0,b||(b=Gc(y,_,M,B)|0)),Se=O,b|0}function or(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0;return d=Se,Se=Se+32|0,O=d+12|0,l=d,M=kn(y,_,y,_,O)|0,M|0?(l=M,Se=d,l|0):(y=kn(y,_,b,C,l)|0,y|0?(l=y,Se=d,l|0):(O=Cl(O,l)|0,l=B,g[l>>2]=O,g[l+4>>2]=((O|0)<0)<<31>>31,l=0,Se=d,l|0))}function Ss(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0;return d=Se,Se=Se+32|0,O=d+12|0,l=d,M=kn(y,_,y,_,O)|0,!M&&(M=kn(y,_,b,C,l)|0,!M)?(C=Cl(O,l)|0,C=An(C|0,((C|0)<0)<<31>>31|0,1,0)|0,O=Ie()|0,l=B,g[l>>2]=C,g[l+4>>2]=O,l=0,Se=d,l|0):(l=M,Se=d,l|0)}function vu(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0,Re=0;if(ge=Se,Se=Se+48|0,O=ge+24|0,l=ge+12|0,Fe=ge,M=kn(y,_,y,_,O)|0,!M&&(M=kn(y,_,b,C,l)|0,!M)){oe=Cl(O,l)|0,we=((oe|0)<0)<<31>>31,g[O>>2]=0,g[O+4>>2]=0,g[O+8>>2]=0,g[l>>2]=0,g[l+4>>2]=0,g[l+8>>2]=0,kn(y,_,y,_,O)|0&&Xt(23313,23090,691,23299),kn(y,_,b,C,l)|0&&Xt(23313,23090,696,23299),Ta(O),Ta(l),oe?(T=g[O>>2]|0,L=+(oe|0),ee=O+4|0,P=g[ee>>2]|0,Z=O+8|0,R=g[Z>>2]|0,te=O,C=T,M=P,b=R,z=+((g[l>>2]|0)-T|0)/L,X=+((g[l+4>>2]|0)-P|0)/L,L=+((g[l+8>>2]|0)-R|0)/L):(M=O+4|0,b=O+8|0,ee=M,Z=b,te=O,C=g[O>>2]|0,M=g[M>>2]|0,b=g[b>>2]|0,z=0,X=0,L=0),g[Fe>>2]=C,R=Fe+4|0,g[R>>2]=M,P=Fe+8|0,g[P>>2]=b;e:do if((oe|0)<0)M=0;else for(m=0,T=0,M=C;;){h=+(T>>>0)+4294967296*+(m|0),Re=z*h+ +(M|0),d=X*h+ +(g[ee>>2]|0),h=L*h+ +(g[Z>>2]|0),b=~~+na(+Re),O=~~+na(+d),M=~~+na(+h),Re=+Pt(+(+(b|0)-Re)),d=+Pt(+(+(O|0)-d)),h=+Pt(+(+(M|0)-h));do if(Re>d&Re>h)b=0-(O+M)|0,C=O;else if(l=0-b|0,d>h){C=l-M|0;break}else{C=O,M=l-O|0;break}while(!1);if(g[Fe>>2]=b,g[R>>2]=C,g[P>>2]=M,Xa(Fe),M=Gc(y,_,Fe,B+(T<<3)|0)|0,M|0)break e;if(!((m|0)<(we|0)|(m|0)==(we|0)&T>>>0<oe>>>0)){M=0;break e}M=An(T|0,m|0,1,0)|0,l=Ie()|0,m=l,T=M,M=g[te>>2]|0}while(!1);return Fe=M,Se=ge,Fe|0}return Fe=M,Se=ge,Fe|0}function Hs(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0;if((b|0)==0&(C|0)==0)return B=0,M=1,pr(B|0),M|0;M=y,B=_,y=1,_=0;do O=(b&1|0)==0&!0,y=di((O?1:M)|0,(O?0:B)|0,y|0,_|0)|0,_=Ie()|0,b=Eo(b|0,C|0,1)|0,C=Ie()|0,M=di(M|0,B|0,M|0,B|0)|0,B=Ie()|0;while(!((b|0)==0&(C|0)==0));return pr(_|0),y|0}function ro(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0;if(!(Us(_,b)|0)||(_=xl(_)|0,C=+ce[b>>3],B=+ce[b+8>>3],B=_&B<0?B+6.283185307179586:B,P=g[y>>2]|0,(P|0)<=0))return P=0,P|0;if(T=g[y+4>>2]|0,_){_=0,m=B,b=-1,y=0;e:for(;;){for(h=y;O=+ce[T+(h<<4)>>3],B=+ce[T+(h<<4)+8>>3],y=(b+2|0)%(P|0)|0,M=+ce[T+(y<<4)>>3],l=+ce[T+(y<<4)+8>>3],O>M?(d=O,O=l):(d=M,M=O,O=B,B=l),C=C==M|C==d?C+2220446049250313e-31:C,!!(C<M|C>d);)if(b=h+1|0,(b|0)>=(P|0)){b=22;break e}else y=h,h=b,b=y;if(l=O<0?O+6.283185307179586:O,O=B<0?B+6.283185307179586:B,m=l==m|O==m?m+-2220446049250313e-31:m,d=l+(O-l)*((C-M)/(d-M)),(d<0?d+6.283185307179586:d)>m&&(_=_^1),y=h+1|0,(y|0)>=(P|0)){b=22;break}else b=h}if((b|0)==22)return _|0}else{_=0,m=B,b=-1,y=0;e:for(;;){for(h=y;O=+ce[T+(h<<4)>>3],B=+ce[T+(h<<4)+8>>3],y=(b+2|0)%(P|0)|0,M=+ce[T+(y<<4)>>3],l=+ce[T+(y<<4)+8>>3],O>M?(d=O,O=l):(d=M,M=O,O=B,B=l),C=C==M|C==d?C+2220446049250313e-31:C,!!(C<M|C>d);)if(b=h+1|0,(b|0)>=(P|0)){b=22;break e}else y=h,h=b,b=y;if(m=O==m|B==m?m+-2220446049250313e-31:m,O+(B-O)*((C-M)/(d-M))>m&&(_=_^1),y=h+1|0,(y|0)>=(P|0)){b=22;break}else b=h}if((b|0)==22)return _|0}return 0}function _s(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0;if(L=g[y>>2]|0,!L){g[_>>2]=0,g[_+4>>2]=0,g[_+8>>2]=0,g[_+12>>2]=0,g[_+16>>2]=0,g[_+20>>2]=0,g[_+24>>2]=0,g[_+28>>2]=0;return}if(z=_+8|0,ce[z>>3]=17976931348623157e292,X=_+24|0,ce[X>>3]=17976931348623157e292,ce[_>>3]=-17976931348623157e292,ee=_+16|0,ce[ee>>3]=-17976931348623157e292,!((L|0)<=0)){for(P=g[y+4>>2]|0,h=17976931348623157e292,m=-17976931348623157e292,T=0,y=-1,M=17976931348623157e292,O=17976931348623157e292,d=-17976931348623157e292,C=-17976931348623157e292,R=0;b=+ce[P+(R<<4)>>3],l=+ce[P+(R<<4)+8>>3],y=y+2|0,B=+ce[P+(((y|0)==(L|0)?0:y)<<4)+8>>3],b<M&&(ce[z>>3]=b,M=b),l<O&&(ce[X>>3]=l,O=l),b>d?ce[_>>3]=b:b=d,l>C&&(ce[ee>>3]=l,C=l),h=l>0&l<h?l:h,m=l<0&l>m?l:m,T=T|+Pt(+(l-B))>3.141592653589793,y=R+1|0,(y|0)!=(L|0);)Z=R,d=b,R=y,y=Z;T&&(ce[ee>>3]=m,ce[X>>3]=h)}}function wf(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0,Fe=0,ge=0;
4207if(L=g[y>>2]|0,L){if(z=_+8|0,ce[z>>3]=17976931348623157e292,X=_+24|0,ce[X>>3]=17976931348623157e292,ce[_>>3]=-17976931348623157e292,ee=_+16|0,ce[ee>>3]=-17976931348623157e292,(L|0)>0){for(B=g[y+4>>2]|0,P=17976931348623157e292,R=-17976931348623157e292,C=0,b=-1,d=17976931348623157e292,h=17976931348623157e292,T=-17976931348623157e292,O=-17976931348623157e292,Z=0;M=+ce[B+(Z<<4)>>3],m=+ce[B+(Z<<4)+8>>3],Fe=b+2|0,l=+ce[B+(((Fe|0)==(L|0)?0:Fe)<<4)+8>>3],M<d&&(ce[z>>3]=M,d=M),m<h&&(ce[X>>3]=m,h=m),M>T?ce[_>>3]=M:M=T,m>O&&(ce[ee>>3]=m,O=m),P=m>0&m<P?m:P,R=m<0&m>R?m:R,C=C|+Pt(+(m-l))>3.141592653589793,b=Z+1|0,(b|0)!=(L|0);)Fe=Z,T=M,Z=b,b=Fe;C&&(ce[ee>>3]=R,ce[X>>3]=P)}}else g[_>>2]=0,g[_+4>>2]=0,g[_+8>>2]=0,g[_+12>>2]=0,g[_+16>>2]=0,g[_+20>>2]=0,g[_+24>>2]=0,g[_+28>>2]=0;if(Fe=y+8|0,b=g[Fe>>2]|0,!((b|0)<=0)){we=y+12|0,oe=0;do if(B=g[we>>2]|0,C=oe,oe=oe+1|0,X=_+(oe<<5)|0,ee=g[B+(C<<3)>>2]|0,ee){if(Z=_+(oe<<5)+8|0,ce[Z>>3]=17976931348623157e292,y=_+(oe<<5)+24|0,ce[y>>3]=17976931348623157e292,ce[X>>3]=-17976931348623157e292,te=_+(oe<<5)+16|0,ce[te>>3]=-17976931348623157e292,(ee|0)>0){for(L=g[B+(C<<3)+4>>2]|0,P=17976931348623157e292,R=-17976931348623157e292,B=0,C=-1,z=0,d=17976931348623157e292,h=17976931348623157e292,m=-17976931348623157e292,O=-17976931348623157e292;M=+ce[L+(z<<4)>>3],T=+ce[L+(z<<4)+8>>3],C=C+2|0,l=+ce[L+(((C|0)==(ee|0)?0:C)<<4)+8>>3],M<d&&(ce[Z>>3]=M,d=M),T<h&&(ce[y>>3]=T,h=T),M>m?ce[X>>3]=M:M=m,T>O&&(ce[te>>3]=T,O=T),P=T>0&T<P?T:P,R=T<0&T>R?T:R,B=B|+Pt(+(T-l))>3.141592653589793,C=z+1|0,(C|0)!=(ee|0);)ge=z,z=C,m=M,C=ge;B&&(ce[te>>3]=R,ce[y>>3]=P)}}else g[X>>2]=0,g[X+4>>2]=0,g[X+8>>2]=0,g[X+12>>2]=0,g[X+16>>2]=0,g[X+20>>2]=0,g[X+24>>2]=0,g[X+28>>2]=0,b=g[Fe>>2]|0;while((oe|0)<(b|0))}}function Yt(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;if(!(ro(y,_,b)|0))return B=0,B|0;if(B=y+8|0,(g[B>>2]|0)<=0)return B=1,B|0;for(C=y+12|0,y=0;;){if(M=y,y=y+1|0,ro((g[C>>2]|0)+(M<<3)|0,_+(y<<5)|0,b)|0){y=0,C=6;break}if((y|0)>=(g[B>>2]|0)){y=1,C=6;break}}return(C|0)==6?y|0:0}function Cf(){return 8}function bu(){return 16}function Tf(){return 168}function no(){return 8}function Is(){return 16}function xu(){return 12}function wu(){return 8}function Ms(y){return y=y|0,+(+((g[y>>2]|0)>>>0)+4294967296*+(g[y+4>>2]|0))}function ta(y){y=y|0;var _=0,b=0;return b=+ce[y>>3],_=+ce[y+8>>3],+ +Ot(+(b*b+_*_))}function Ef(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0;h=+ce[y>>3],d=+ce[_>>3]-h,l=+ce[y+8>>3],O=+ce[_+8>>3]-l,T=+ce[b>>3],M=+ce[C>>3]-T,P=+ce[b+8>>3],m=+ce[C+8>>3]-P,M=(M*(l-P)-(h-T)*m)/(d*m-O*M),ce[B>>3]=h+d*M,ce[B+8>>3]=l+O*M}function Vc(y,_){return y=y|0,_=_|0,+Pt(+(+ce[y>>3]-+ce[_>>3]))<11920928955078125e-23?(_=+Pt(+(+ce[y+8>>3]-+ce[_+8>>3]))<11920928955078125e-23,_|0):(_=0,_|0)}function Ti(y,_){y=y|0,_=_|0;var b=0,C=0,B=0;return B=+ce[y>>3]-+ce[_>>3],C=+ce[y+8>>3]-+ce[_+8>>3],b=+ce[y+16>>3]-+ce[_+16>>3],+(B*B+C*C+b*b)}function Bf(y,_){y=y|0,_=_|0;var b=0,C=0,B=0;b=+ce[y>>3],C=+Lt(+b),b=+Mt(+b),ce[_+16>>3]=b,b=+ce[y+8>>3],B=C*+Lt(+b),ce[_>>3]=B,b=C*+Mt(+b),ce[_+8>>3]=b}function Co(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;if(M=Se,Se=Se+16|0,B=M,C=Fn(y,_)|0,(b+-1|0)>>>0>5||(C=(C|0)!=0,(b|0)==1&C))return B=-1,Se=M,B|0;do if(is(y,_,B)|0)C=-1;else if(C){C=((g[21936+(b<<2)>>2]|0)+5-(g[B>>2]|0)|0)%5|0;break}else{C=((g[21968+(b<<2)>>2]|0)+6-(g[B>>2]|0)|0)%6|0;break}while(!1);return B=C,Se=M,B|0}function is(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0,h=0;if(h=Se,Se=Se+32|0,O=h+16|0,l=h,C=ec(y,_,O)|0,C|0)return b=C,Se=h,b|0;M=vf(y,_)|0,d=ns(y,_)|0,Qs(M,l),C=Ph(M,g[O>>2]|0)|0;e:do if(Ir(M)|0){do switch(M|0){case 4:{y=0;break}case 14:{y=1;break}case 24:{y=2;break}case 38:{y=3;break}case 49:{y=4;break}case 58:{y=5;break}case 63:{y=6;break}case 72:{y=7;break}case 83:{y=8;break}case 97:{y=9;break}case 107:{y=10;break}case 117:{y=11;break}default:{C=1;break e}}while(!1);if(B=g[22e3+(y*24|0)+8>>2]|0,_=g[22e3+(y*24|0)+16>>2]|0,y=g[O>>2]|0,(y|0)!=(g[l>>2]|0)&&(l=fi(M)|0,y=g[O>>
42072]|0,l|(y|0)==(_|0)&&(C=(C+1|0)%6|0)),(d|0)==3&(y|0)==(_|0)){C=(C+5|0)%6|0,B=22;break}(d|0)==5&(y|0)==(B|0)&&(C=(C+1|0)%6|0),B=22}else B=22;while(!1);return(B|0)==22&&(g[b>>2]=C,C=0),b=C,Se=h,b|0}function Hr(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0;if(te=Se,Se=Se+32|0,Z=te+24|0,X=te+20|0,L=te+8|0,R=te+16|0,P=te,d=(Fn(y,_)|0)==0,d=d?6:5,m=Jt(y|0,_|0,52)|0,Ie()|0,m=m&15,d>>>0<=b>>>0)return C=2,Se=te,C|0;T=(m|0)==0,!T&&(z=tr(7,0,(m^15)*3|0)|0,(z&y|0)==0&((Ie()|0)&_|0)==0)?B=b:M=4;e:do if((M|0)==4){if(B=(Fn(y,_)|0)!=0,((B?4:5)|0)<(b|0)||is(y,_,Z)|0||(M=(g[Z>>2]|0)+b|0,B?B=22288+(((M|0)%5|0)<<2)|0:B=22320+(((M|0)%6|0)<<2)|0,z=g[B>>2]|0,(z|0)==7))return C=1,Se=te,C|0;g[X>>2]=0,B=Sn(y,_,z,X,L)|0;do if(!B){if(l=L,h=g[l>>2]|0,l=g[l+4>>2]|0,O=l>>>0<_>>>0|(l|0)==(_|0)&h>>>0<y>>>0,M=O?h:y,O=O?l:_,!T&&(T=tr(7,0,(m^15)*3|0)|0,(h&T|0)==0&(l&(Ie()|0)|0)==0))B=b;else{if(l=(b+-1+d|0)%(d|0)|0,B=Fn(y,_)|0,(l|0)<0&&Xt(23313,23315,245,23324),d=(B|0)!=0,((d?4:5)|0)<(l|0)&&Xt(23313,23315,245,23324),is(y,_,Z)|0&&Xt(23313,23315,245,23324),B=(g[Z>>2]|0)+l|0,d?B=22288+(((B|0)%5|0)<<2)|0:B=22320+(((B|0)%6|0)<<2)|0,l=g[B>>2]|0,(l|0)==7&&Xt(23313,23315,245,23324),g[R>>2]=0,B=Sn(y,_,l,R,P)|0,B|0)break;h=P,d=g[h>>2]|0,h=g[h+4>>2]|0;do if(h>>>0<O>>>0|(h|0)==(O|0)&d>>>0<M>>>0){if(Fn(d,h)|0?M=yl(d,h,y,_)|0:M=g[22384+((((g[R>>2]|0)+(g[22352+(l<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,B=Fn(d,h)|0,(M+-1|0)>>>0>5){B=-1,M=d,O=h;break}if(B=(B|0)!=0,(M|0)==1&B){B=-1,M=d,O=h;break}do if(is(d,h,Z)|0)B=-1;else if(B){B=((g[21936+(M<<2)>>2]|0)+5-(g[Z>>2]|0)|0)%5|0;break}else{B=((g[21968+(M<<2)>>2]|0)+6-(g[Z>>2]|0)|0)%6|0;break}while(!1);M=d,O=h}else B=b;while(!1);l=L,h=g[l>>2]|0,l=g[l+4>>2]|0}if((M|0)==(h|0)&(O|0)==(l|0)){if(d=(Fn(h,l)|0)!=0,d?y=yl(h,l,y,_)|0:y=g[22384+((((g[X>>2]|0)+(g[22352+(z<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,B=Fn(h,l)|0,(y+-1|0)>>>0<=5&&(ee=(B|0)!=0,!((y|0)==1&ee)))do if(is(h,l,Z)|0)B=-1;else if(ee){B=((g[21936+(y<<2)>>2]|0)+5-(g[Z>>2]|0)|0)%5|0;break}else{B=((g[21968+(y<<2)>>2]|0)+6-(g[Z>>2]|0)|0)%6|0;break}while(!1);else B=-1;B=B+1|0,B=(B|0)==6|d&(B|0)==5?0:B}_=O,y=M;break e}while(!1);return C=B,Se=te,C|0}while(!1);return ee=tr(B|0,0,56)|0,Z=Ie()|0|_&-2130706433|536870912,g[C>>2]=ee|y,g[C+4>>2]=Z,C=0,Se=te,C|0}function Do(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;return M=(Fn(y,_)|0)==0,C=Hr(y,_,0,b)|0,B=(C|0)==0,M?!B||(C=Hr(y,_,1,b+8|0)|0,C|0)||(C=Hr(y,_,2,b+16|0)|0,C|0)||(C=Hr(y,_,3,b+24|0)|0,C|0)||(C=Hr(y,_,4,b+32|0)|0,C)?(M=C,M|0):Hr(y,_,5,b+40|0)|0:!B||(C=Hr(y,_,1,b+8|0)|0,C|0)||(C=Hr(y,_,2,b+16|0)|0,C|0)||(C=Hr(y,_,3,b+24|0)|0,C|0)||(C=Hr(y,_,4,b+32|0)|0,C|0)?(M=C,M|0):(M=b+40|0,g[M>>2]=0,g[M+4>>2]=0,M=0,M|0)}function io(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0,l=0,d=0;return d=Se,Se=Se+192|0,B=d,M=d+168|0,O=Jt(y|0,_|0,56)|0,Ie()|0,O=O&7,l=_&-2130706433|134217728,C=ec(y,l,M)|0,C|0?(l=C,Se=d,l|0):(_=Jt(y|0,_|0,52)|0,Ie()|0,_=_&15,Fn(y,l)|0?Ko(M,_,O,1,B):fu(M,_,O,1,B),l=B+8|0,g[b>>2]=g[l>>2],g[b+4>>2]=g[l+4>>2],g[b+8>>2]=g[l+8>>2],g[b+12>>2]=g[l+12>>2],l=0,Se=d,l|0)}function Xi(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0;return B=Se,Se=Se+16|0,b=B,!(!0&(_&2013265920|0)==536870912)||(C=_&-2130706433|134217728,!(Yo(y,C)|0))?(C=0,Se=B,C|0):(M=Jt(y|0,_|0,56)|0,Ie()|0,M=(Hr(y,C,M&7,b)|0)==0,C=b,C=M&((g[C>>2]|0)==(y|0)?(g[C+4>>2]|0)==(_|0):0)&1,Se=B,C|0)}function Ia(y,_,b){y=y|0,_=_|0,b=b|0;var C=0;(_|0)>0?(C=oo(_,4)|0,g[y>>2]=C,C||Xt(23337,23360,40,23374)):g[y>>2]=0,g[y+4>>2]=_,g[y+8>>2]=0,g[y+12>>2]=b}function ra(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0;B=y+4|0,M=y+12|0,O=y+8|0;e:for(;;){for(b=g[B>>2]|0,_=0;;){if((_|0)>=(b|0))break e;if(C=g[y>>2]|0,l=g[C+(_<<2)>>2]|0,!l)_=_+1|0;else break}_=C+(~~(+Pt(+(+ht(10,+ +(15-(g[M>>2]|0)|0))*(+ce[l>>3]+ +ce[l+8>>3])))%+(b|0))>>>0<<2)|0,b=g[_>>2]|0;t:do if(b|0){if(C=l+32|0,(b|0)==(l|0))g[_>>2]=g[C>>2];else{if(b=b+32|0,_=g[b>>2]|0,!_)break;for(;(_|0)!=(l|0);)if(b=_+32|0,_=g[b>>2]|0,!_)break t;g[b>>2]=g[C>>2]}zr(l),g[O>>2]=(g[O>>2]|0)+-1}while(!1)}zr(g[y>>2]|0)}function so(y){y=y|0;var _=0,b=0,C=0;for(C=g[y+4>>2]|0,b=0;;){if((b|0)>=(C|0)){_=0,b=4;break}if(_=g[(g[y>>2]|0)+(b<<2)>>2]|0,!_)b=b+1|0;else{b=4;break}}return(b|0)==4?_|0:0}function ss(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0;if(b=~~(+Pt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+ce[_>>3]+ +ce[_+8>>3])))%+(g[y+4>>2]|0))>>>0,b=(g[y>>2]|0)+(b<<2)|0,C=g[b>>2]|0,!C)return M=1,M|0;M=_+32|0;do if((C|0)!=(_|0)){if(b=g[C+32>>2]|0,!b)return M=1,M|0;for(B=b;;){if((B|0)==(_|0)){B=8;break}if(b=g[B+32>>2]|0,b)C=B,B=b;else{b=1,B=10;break}}if((B|0)==8){g[C+32>>2]=g[M>>2];break}else if((B|0)==10)return b|0}else g[b>>2]=g[M>>2];while(!1);return zr(_),M=y+8|0,g[M>>2]=(g[M>>2]|0)+-1,M=0,M|0}
4207function Rl(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0;M=Jn(40)|0,M||Xt(23390,23360,98,23403),g[M>>2]=g[_>>2],g[M+4>>2]=g[_+4>>2],g[M+8>>2]=g[_+8>>2],g[M+12>>2]=g[_+12>>2],B=M+16|0,g[B>>2]=g[b>>2],g[B+4>>2]=g[b+4>>2],g[B+8>>2]=g[b+8>>2],g[B+12>>2]=g[b+12>>2],g[M+32>>2]=0,B=~~(+Pt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+ce[_>>3]+ +ce[_+8>>3])))%+(g[y+4>>2]|0))>>>0,B=(g[y>>2]|0)+(B<<2)|0,C=g[B>>2]|0;do if(!C)g[B>>2]=M;else{for(;!(rc(C,_)|0&&rc(C+16|0,b)|0);)if(B=g[C+32>>2]|0,C=(B|0)==0?C:B,!(g[C+32>>2]|0)){O=10;break}if((O|0)==10){g[C+32>>2]=M;break}return zr(M),O=C,O|0}while(!1);return O=y+8|0,g[O>>2]=(g[O>>2]|0)+1,O=M,O|0}function wr(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0;if(B=~~(+Pt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+ce[_>>3]+ +ce[_+8>>3])))%+(g[y+4>>2]|0))>>>0,B=g[(g[y>>2]|0)+(B<<2)>>2]|0,!B)return b=0,b|0;if(!b){for(y=B;;){if(rc(y,_)|0){C=10;break}if(y=g[y+32>>2]|0,!y){y=0,C=10;break}}if((C|0)==10)return y|0}for(y=B;;){if(rc(y,_)|0&&rc(y+16|0,b)|0){C=10;break}if(y=g[y+32>>2]|0,!y){y=0,C=10;break}}return(C|0)==10?y|0:0}function ur(y,_){y=y|0,_=_|0;var b=0;if(b=~~(+Pt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+ce[_>>3]+ +ce[_+8>>3])))%+(g[y+4>>2]|0))>>>0,y=g[(g[y>>2]|0)+(b<<2)>>2]|0,!y)return b=0,b|0;for(;;){if(rc(y,_)|0){_=5;break}if(y=g[y+32>>2]|0,!y){y=0,_=5;break}}return(_|0)==5?y|0:0}function Cu(){return 23424}function fs(y){return y=+y,+ +sa(+y)}function Ki(y){return y=+y,~~+fs(y)|0}function Jn(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0,z=0,X=0,ee=0,Z=0,te=0,oe=0,we=0;we=Se,Se=Se+16|0,P=we;do if(y>>>0<245){if(h=y>>>0<11?16:y+11&-8,y=h>>>3,T=g[5857]|0,b=T>>>y,b&3|0)return _=(b&1^1)+y|0,y=23468+(_<<1<<2)|0,b=y+8|0,C=g[b>>2]|0,B=C+8|0,M=g[B>>2]|0,(M|0)==(y|0)?g[5857]=T&~(1<<_):(g[M+12>>2]=y,g[b>>2]=M),oe=_<<3,g[C+4>>2]=oe|3,oe=C+oe+4|0,g[oe>>2]=g[oe>>2]|1,oe=B,Se=we,oe|0;if(m=g[5859]|0,h>>>0>m>>>0){if(b|0)return _=2<<y,_=b<<y&(_|0-_),_=(_&0-_)+-1|0,l=_>>>12&16,_=_>>>l,b=_>>>5&8,_=_>>>b,M=_>>>2&4,_=_>>>M,y=_>>>1&2,_=_>>>y,C=_>>>1&1,C=(b|l|M|y|C)+(_>>>C)|0,_=23468+(C<<1<<2)|0,y=_+8|0,M=g[y>>2]|0,l=M+8|0,b=g[l>>2]|0,(b|0)==(_|0)?(y=T&~(1<<C),g[5857]=y):(g[b+12>>2]=_,g[y>>2]=b,y=T),oe=C<<3,O=oe-h|0,g[M+4>>2]=h|3,B=M+h|0,g[B+4>>2]=O|1,g[M+oe>>2]=O,m|0&&(C=g[5862]|0,_=m>>>3,b=23468+(_<<1<<2)|0,_=1<<_,y&_?(y=b+8|0,_=g[y>>2]|0):(g[5857]=y|_,_=b,y=b+8|0),g[y>>2]=C,g[_+12>>2]=C,g[C+8>>2]=_,g[C+12>>2]=b),g[5859]=O,g[5862]=B,oe=l,Se=we,oe|0;if(M=g[5858]|0,M){for(b=(M&0-M)+-1|0,B=b>>>12&16,b=b>>>B,C=b>>>5&8,b=b>>>C,O=b>>>2&4,b=b>>>O,l=b>>>1&2,b=b>>>l,d=b>>>1&1,d=g[23732+((C|B|O|l|d)+(b>>>d)<<2)>>2]|0,b=d,l=d,d=(g[d+4>>2]&-8)-h|0;y=g[b+16>>2]|0,!(!y&&(y=g[b+20>>2]|0,!y));)O=(g[y+4>>2]&-8)-h|0,B=O>>>0<d>>>0,b=y,l=B?y:l,d=B?O:d;if(O=l+h|0,O>>>0>l>>>0){B=g[l+24>>2]|0,_=g[l+12>>2]|0;do if((_|0)==(l|0)){if(y=l+20|0,_=g[y>>2]|0,!_&&(y=l+16|0,_=g[y>>2]|0,!_)){b=0;break}for(;;)if(C=_+20|0,b=g[C>>2]|0,b)_=b,y=C;else if(C=_+16|0,b=g[C>>2]|0,b)_=b,y=C;else break;g[y>>2]=0,b=_}else b=g[l+8>>2]|0,g[b+12>>2]=_,g[_+8>>2]=b,b=_;while(!1);do if(B|0){if(_=g[l+28>>2]|0,y=23732+(_<<2)|0,(l|0)==(g[y>>2]|0)){if(g[y>>2]=b,!b){g[5858]=M&~(1<<_);break}}else if(oe=B+16|0,g[((g[oe>>2]|0)==(l|0)?oe:B+20|0)>>2]=b,!b)break;g[b+24>>2]=B,_=g[l+16>>2]|0,_|0&&(g[b+16>>2]=_,g[_+24>>2]=b),_=g[l+20>>2]|0,_|0&&(g[b+20>>2]=_,g[_+24>>2]=b)}while(!1);return d>>>0<16?(oe=d+h|0,g[l+4>>2]=oe|3,oe=l+oe+4|0,g[oe>>2]=g[oe>>2]|1):(g[l+4>>2]=h|3,g[O+4>>2]=d|1,g[O+d>>2]=d,m|0&&(C=g[5862]|0,_=m>>>3,b=23468+(_<<1<<2)|0,_=1<<_,_&T?(y=b+8|0,_=g[y>>2]|0):(g[5857]=_|T,_=b,y=b+8|0),g[y>>2]=C,g[_+12>>2]=C,g[C+8>>2]=_,g[C+12>>2]=b),g[5859]=d,g[5862]=O),oe=l+8|0,Se=we,oe|0}else T=h}else T=h}else T=h}else if(y>>>0<=4294967231)if(y=y+11|0,h=y&-8,C=g[5858]|0,C){B=0-h|0,y=y>>>8,y?h>>>0>16777215?d=31:(T=(y+1048320|0)>>>16&8,z=y<<T,l=(z+520192|0)>>>16&4,z=z<<l,d=(z+245760|0)>>>16&2,d=14-(l|T|d)+(z<<d>>>15)|0,d=h>>>(d+7|0)&1|d<<1):d=0,b=g[23732+(d<<2)>>2]|0;e:do if(!b)b=0,y=0,z=61;else for(y=0,l=h<<((d|0)==31?0:25-(d>>>1)|0),M=0;;){if(O=(g[b+4>>2]&-8)-h|0,O>>>0<B>>>0)if(O)y=b,B=O;else{y=b,B=0,z=65;break e}if(z=g[b+20>>2]|0,b=g[b+16+(l>>>31<<2)>>2]|0,M=(z|0)==0|(z|0)==(b|0)?M:z,b)l=l<<1;else{b=M,z=61;break}}while(!1);if((z|0)==61){if((b|0)==0&(y|0)==0){if(y=2<<d,y=(y|0-y)&C,!y){T=h;break}T=(y&0-y)+-1|0,O=T>>>12&16,T=T>>>O,M=T>>>5&8,T=T>>>M,l=T>>>2&4,T=T>>>l,d=T>>>1&2,T=T>>>d,b=T>>>1&1,y=0,b=g[23732+((M|O|l|d|b)+(T>>>b)<<2)>>2]|0}b?z=65:(l=y,O=B)}if((z|0)==65)for(M=b;;)if(T=(g[M+4>>2]&-8)-h|0,b=T>>>0<B>>>0,B=b?T:B,y=b?M:y,b=g[M+16>>2]|0,b||(b=g[M+20>>2]|0),b)M=b;else{l=y,O=B;break}if((l|0)!=0&&O>>>0<((g[5859]|0)-h|0)>>>0&&(m=l+h|0,m>>>0>l>>>0)){M=g[l+24>>2]|0,_=g[l+12>>2]|0;do if((_|0)==(l|0)){if(y=l+20|0,_=g[y>>2]|0,!_&&(y=l+16|0,_=g[y>>2]|0,!_)){_=0;break}for(;;)if(B=_+20|0,b=g[B>>2]|0,b)_=b,y=B;else if(B=_+16|0,b=g[B>>2]|0,b)_=b,y=B;else break;g[y>>2]=0}else oe=g[l+8>>2]|0,g[oe+12>>2]=_,g[_+8>>2]=oe;while(!1);do if(M){if(y=g[l+28>>2]|0,b=23732+(y<<2)|0,(l|0)==(g[b>>2]|0)){if(g[b>>2]=_,!_){C=C&~(1<<y),g[5858]=C;break}}else if(oe=M+16|0,g[((g[oe>>2]|0)==(l|0)?oe:M+20|0)>>2]=_,!_)break;g[_+24>>2]=M,y=g[l+16>>2]|0,y|0&&(g[_+16>>2]=y,g[y+24>>2]=_),y=g[l+20>>2]|0,y&&(g[_+20>>2]=y,g[y+24>>2]=_)}while(!1);e:do if(O>>>0<16)oe=O+h|0,g[l+4>>2]=oe|3,oe=l+oe+4|0,g[oe>>2]=g[oe>>2]|1;else{if(g[l+4>>2]=h|3,g[m+4>>2]=O|1,g[m+O>>2]=O,_=O>>>3,O>>>0<256){b=23468+(_<<1<<2)|0,y=g[5857]|0,_=1<<_,y&_?(y=b+8|0,_=g[y>>2]|0):(g[5857]=y|_,_=b,y=b+8|0),g[y>>2]=m,g[_+12>>2]=m,g[m+8>>2]=_,g[m+12>>2]=b;break}if(_=O>>>8,_?O>>>0>16777215?b=31:(te=(_+1048320|0)>>>16&8,oe=_<<te,Z=(oe+520192|0)>>>16&4,oe=oe<<Z,b=(oe+245760|0)>>>16&2,b=14-(Z|te|b)+(oe<<b>>>15)|0,b=O>>>(b+7|0)&1|b<<1):b=0,_=23732+(b<<2)|0,g[m+28>>2]=b,y=m+16|0,g[y+4>>2]=0,g[y>>2]=0,y=1<<b,!(C&y)){g[5858]=C|y,g[_>>2]=m,g[m+24>>2]=_,g[m+12>>2]=m,g[m+8>>2]=m;break}_=g[_>>2]|0;
4207t:do if((g[_+4>>2]&-8|0)!=(O|0)){for(C=O<<((b|0)==31?0:25-(b>>>1)|0);b=_+16+(C>>>31<<2)|0,y=g[b>>2]|0,!!y;)if((g[y+4>>2]&-8|0)==(O|0)){_=y;break t}else C=C<<1,_=y;g[b>>2]=m,g[m+24>>2]=_,g[m+12>>2]=m,g[m+8>>2]=m;break e}while(!1);te=_+8|0,oe=g[te>>2]|0,g[oe+12>>2]=m,g[te>>2]=m,g[m+8>>2]=oe,g[m+12>>2]=_,g[m+24>>2]=0}while(!1);return oe=l+8|0,Se=we,oe|0}else T=h}else T=h;else T=-1;while(!1);if(b=g[5859]|0,b>>>0>=T>>>0)return _=b-T|0,y=g[5862]|0,_>>>0>15?(oe=y+T|0,g[5862]=oe,g[5859]=_,g[oe+4>>2]=_|1,g[y+b>>2]=_,g[y+4>>2]=T|3):(g[5859]=0,g[5862]=0,g[y+4>>2]=b|3,oe=y+b+4|0,g[oe>>2]=g[oe>>2]|1),oe=y+8|0,Se=we,oe|0;if(O=g[5860]|0,O>>>0>T>>>0)return Z=O-T|0,g[5860]=Z,oe=g[5863]|0,te=oe+T|0,g[5863]=te,g[te+4>>2]=Z|1,g[oe+4>>2]=T|3,oe=oe+8|0,Se=we,oe|0;if(g[5975]|0?y=g[5977]|0:(g[5977]=4096,g[5976]=4096,g[5978]=-1,g[5979]=-1,g[5980]=0,g[5968]=0,g[5975]=P&-16^1431655768,y=4096),l=T+48|0,d=T+47|0,M=y+d|0,B=0-y|0,h=M&B,h>>>0<=T>>>0||(y=g[5967]|0,y|0&&(m=g[5965]|0,P=m+h|0,P>>>0<=m>>>0|P>>>0>y>>>0)))return oe=0,Se=we,oe|0;e:do if(g[5968]&4)_=0,z=143;else{b=g[5863]|0;t:do if(b){for(C=23876;P=g[C>>2]|0,!(P>>>0<=b>>>0&&(P+(g[C+4>>2]|0)|0)>>>0>b>>>0);)if(y=g[C+8>>2]|0,y)C=y;else{z=128;break t}if(_=M-O&B,_>>>0<2147483647)if(y=ys(_|0)|0,(y|0)==((g[C>>2]|0)+(g[C+4>>2]|0)|0)){if((y|0)!=-1){O=_,M=y,z=145;break e}}else C=y,z=136;else _=0}else z=128;while(!1);do if((z|0)==128)if(b=ys(0)|0,(b|0)!=-1&&(_=b,R=g[5976]|0,L=R+-1|0,_=((L&_|0)==0?0:(L+_&0-R)-_|0)+h|0,R=g[5965]|0,L=_+R|0,_>>>0>T>>>0&_>>>0<2147483647)){if(P=g[5967]|0,P|0&&L>>>0<=R>>>0|L>>>0>P>>>0){_=0;break}if(y=ys(_|0)|0,(y|0)==(b|0)){O=_,M=b,z=145;break e}else C=y,z=136}else _=0;while(!1);do if((z|0)==136){if(b=0-_|0,!(l>>>0>_>>>0&(_>>>0<2147483647&(C|0)!=-1)))if((C|0)==-1){_=0;break}else{O=_,M=C,z=145;break e}if(y=g[5977]|0,y=d-_+y&0-y,y>>>0>=2147483647){O=_,M=C,z=145;break e}if((ys(y|0)|0)==-1){ys(b|0)|0,_=0;break}else{O=y+_|0,M=C,z=145;break e}}while(!1);g[5968]=g[5968]|4,z=143}while(!1);if((z|0)==143&&h>>>0<2147483647&&(Z=ys(h|0)|0,L=ys(0)|0,X=L-Z|0,ee=X>>>0>(T+40|0)>>>0,!((Z|0)==-1|ee^1|Z>>>0<L>>>0&((Z|0)!=-1&(L|0)!=-1)^1))&&(O=ee?X:_,M=Z,z=145),(z|0)==145){_=(g[5965]|0)+O|0,g[5965]=_,_>>>0>(g[5966]|0)>>>0&&(g[5966]=_),d=g[5863]|0;e:do if(d){for(_=23876;;){if(y=g[_>>2]|0,b=g[_+4>>2]|0,(M|0)==(y+b|0)){z=154;break}if(C=g[_+8>>2]|0,C)_=C;else break}if((z|0)==154&&(te=_+4|0,(g[_+12>>2]&8|0)==0)&&M>>>0>d>>>0&y>>>0<=d>>>0){g[te>>
42072]=b+O,oe=(g[5860]|0)+O|0,Z=d+8|0,Z=(Z&7|0)==0?0:0-Z&7,te=d+Z|0,Z=oe-Z|0,g[5863]=te,g[5860]=Z,g[te+4>>2]=Z|1,g[d+oe+4>>2]=40,g[5864]=g[5979];break}for(M>>>0<(g[5861]|0)>>>0&&(g[5861]=M),b=M+O|0,_=23876;;){if((g[_>>2]|0)==(b|0)){z=162;break}if(y=g[_+8>>2]|0,y)_=y;else break}if((z|0)==162&&(g[_+12>>2]&8|0)==0){g[_>>2]=M,m=_+4|0,g[m>>2]=(g[m>>2]|0)+O,m=M+8|0,m=M+((m&7|0)==0?0:0-m&7)|0,_=b+8|0,_=b+((_&7|0)==0?0:0-_&7)|0,h=m+T|0,l=_-m-T|0,g[m+4>>2]=T|3;t:do if((d|0)==(_|0))oe=(g[5860]|0)+l|0,g[5860]=oe,g[5863]=h,g[h+4>>2]=oe|1;else{if((g[5862]|0)==(_|0)){oe=(g[5859]|0)+l|0,g[5859]=oe,g[5862]=h,g[h+4>>2]=oe|1,g[h+oe>>2]=oe;break}if(y=g[_+4>>2]|0,(y&3|0)==1){O=y&-8,C=y>>>3;r:do if(y>>>0<256)if(y=g[_+8>>2]|0,b=g[_+12>>2]|0,(b|0)==(y|0)){g[5857]=g[5857]&~(1<<C);break}else{g[y+12>>2]=b,g[b+8>>2]=y;break}else{M=g[_+24>>2]|0,y=g[_+12>>2]|0;do if((y|0)==(_|0)){if(b=_+16|0,C=b+4|0,y=g[C>>2]|0,y)b=C;else if(y=g[b>>2]|0,!y){y=0;break}for(;;)if(B=y+20|0,C=g[B>>2]|0,C)y=C,b=B;else if(B=y+16|0,C=g[B>>2]|0,C)y=C,b=B;else break;g[b>>2]=0}else oe=g[_+8>>2]|0,g[oe+12>>2]=y,g[y+8>>2]=oe;while(!1);if(!M)break;b=g[_+28>>2]|0,C=23732+(b<<2)|0;do if((g[C>>2]|0)!=(_|0)){if(oe=M+16|0,g[((g[oe>>2]|0)==(_|0)?oe:M+20|0)>>2]=y,!y)break r}else{if(g[C>>2]=y,y|0)break;g[5858]=g[5858]&~(1<<b);break r}while(!1);if(g[y+24>>2]=M,b=_+16|0,C=g[b>>2]|0,C|0&&(g[y+16>>2]=C,g[C+24>>2]=y),b=g[b+4>>2]|0,!b)break;g[y+20>>2]=b,g[b+24>>2]=y}while(!1);_=_+O|0,B=O+l|0}else B=l;if(_=_+4|0,g[_>>2]=g[_>>2]&-2,g[h+4>>2]=B|1,g[h+B>>2]=B,_=B>>>3,B>>>0<256){b=23468+(_<<1<<2)|0,y=g[5857]|0,_=1<<_,y&_?(y=b+8|0,_=g[y>>2]|0):(g[5857]=y|_,_=b,y=b+8|0),g[y>>2]=h,g[_+12>>2]=h,g[h+8>>2]=_,g[h+12>>2]=b;break}_=B>>>8;do if(!_)C=0;else{if(B>>>0>16777215){C=31;break}te=(_+1048320|0)>>>16&8,oe=_<<te,Z=(oe+520192|0)>>>16&4,oe=oe<<Z,C=(oe+245760|0)>>>16&2,C=14-(Z|te|C)+(oe<<C>>>15)|0,C=B>>>(C+7|0)&1|C<<1}while(!1);if(_=23732+(C<<2)|0,g[h+28>>2]=C,y=h+16|0,g[y+4>>2]=0,g[y>>2]=0,y=g[5858]|0,b=1<<C,!(y&b)){g[5858]=y|b,g[_>>2]=h,g[h+24>>2]=_,g[h+12>>2]=h,g[h+8>>2]=h;break}_=g[_>>2]|0;r:do if((g[_+4>>2]&-8|0)!=(B|0)){for(C=B<<((C|0)==31?0:25-(C>>>1)|0);b=_+16+(C>>>31<<2)|0,y=g[b>>2]|0,!!y;)if((g[y+4>>2]&-8|0)==(B|0)){_=y;break r}else C=C<<1,_=y;g[b>>2]=h,g[h+24>>2]=_,g[h+12>>2]=h,g[h+8>>2]=h;break t}while(!1);te=_+8|0,oe=g[te>>2]|0,g[oe+12>>2]=h,g[te>>2]=h,g[h+8>>2]=oe,g[h+12>>2]=_,g[h+24>>2]=0}while(!1);return oe=m+8|0,Se=we,oe|0}for(_=23876;y=g[_>>2]|0,!(y>>>0<=d>>>0&&(oe=y+(g[_+4>>2]|0)|0,oe>>>0>d>>>0));)_=g[_+8>>2]|0;B=oe+-47|0,y=B+8|0,y=B+((y&7|0)==0?0:0-y&7)|0,B=d+16|0,y=y>>>0<B>>>
42070?d:y,_=y+8|0,b=O+-40|0,Z=M+8|0,Z=(Z&7|0)==0?0:0-Z&7,te=M+Z|0,Z=b-Z|0,g[5863]=te,g[5860]=Z,g[te+4>>2]=Z|1,g[M+b+4>>2]=40,g[5864]=g[5979],b=y+4|0,g[b>>2]=27,g[_>>2]=g[5969],g[_+4>>2]=g[5970],g[_+8>>2]=g[5971],g[_+12>>2]=g[5972],g[5969]=M,g[5970]=O,g[5972]=0,g[5971]=_,_=y+24|0;do te=_,_=_+4|0,g[_>>2]=7;while((te+8|0)>>>0<oe>>>0);if((y|0)!=(d|0)){if(M=y-d|0,g[b>>2]=g[b>>2]&-2,g[d+4>>2]=M|1,g[y>>2]=M,_=M>>>3,M>>>0<256){b=23468+(_<<1<<2)|0,y=g[5857]|0,_=1<<_,y&_?(y=b+8|0,_=g[y>>2]|0):(g[5857]=y|_,_=b,y=b+8|0),g[y>>2]=d,g[_+12>>2]=d,g[d+8>>2]=_,g[d+12>>2]=b;break}if(_=M>>>8,_?M>>>0>16777215?C=31:(te=(_+1048320|0)>>>16&8,oe=_<<te,Z=(oe+520192|0)>>>16&4,oe=oe<<Z,C=(oe+245760|0)>>>16&2,C=14-(Z|te|C)+(oe<<C>>>15)|0,C=M>>>(C+7|0)&1|C<<1):C=0,b=23732+(C<<2)|0,g[d+28>>2]=C,g[d+20>>2]=0,g[B>>2]=0,_=g[5858]|0,y=1<<C,!(_&y)){g[5858]=_|y,g[b>>2]=d,g[d+24>>2]=b,g[d+12>>2]=d,g[d+8>>2]=d;break}_=g[b>>2]|0;t:do if((g[_+4>>2]&-8|0)!=(M|0)){for(C=M<<((C|0)==31?0:25-(C>>>1)|0);b=_+16+(C>>>31<<2)|0,y=g[b>>2]|0,!!y;)if((g[y+4>>2]&-8|0)==(M|0)){_=y;break t}else C=C<<1,_=y;g[b>>2]=d,g[d+24>>2]=_,g[d+12>>2]=d,g[d+8>>2]=d;break e}while(!1);te=_+8|0,oe=g[te>>2]|0,g[oe+12>>2]=d,g[te>>2]=d,g[d+8>>2]=oe,g[d+12>>2]=_,g[d+24>>2]=0}}else oe=g[5861]|0,(oe|0)==0|M>>>0<oe>>>0&&(g[5861]=M),g[5969]=M,g[5970]=O,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,oe=O+-40|0,Z=M+8|0,Z=(Z&7|0)==0?0:0-
4207Z&7,te=M+Z|0,Z=oe-Z|0,g[5863]=te,g[5860]=Z,g[te+4>>2]=Z|1,g[M+oe+4>>2]=40,g[5864]=g[5979];while(!1);if(_=g[5860]|0,_>>>0>T>>>0)return Z=_-T|0,g[5860]=Z,oe=g[5863]|0,te=oe+T|0,g[5863]=te,g[te+4>>2]=Z|1,g[oe+4>>2]=T|3,oe=oe+8|0,Se=we,oe|0}return oe=Cu()|0,g[oe>>2]=12,oe=0,Se=we,oe|0}function zr(y){y=y|0;var _=0,b=0,C=0,B=0,M=0,O=0,l=0,d=0;if(y){b=y+-8|0,B=g[5861]|0,y=g[y+-4>>2]|0,_=y&-8,d=b+_|0;do if(y&1)l=b,O=b;else{if(C=g[b>>2]|0,!(y&3)||(O=b+(0-C)|0,M=C+_|0,O>>>0<B>>>0))return;if((g[5862]|0)==(O|0)){if(y=d+4|0,_=g[y>>2]|0,(_&3|0)!=3){l=O,_=M;break}g[5859]=M,g[y>>2]=_&-2,g[O+4>>2]=M|1,g[O+M>>2]=M;return}if(b=C>>>3,C>>>0<256)if(y=g[O+8>>2]|0,_=g[O+12>>2]|0,(_|0)==(y|0)){g[5857]=g[5857]&~(1<<b),l=O,_=M;break}else{g[y+12>>2]=_,g[_+8>>2]=y,l=O,_=M;break}B=g[O+24>>2]|0,y=g[O+12>>2]|0;do if((y|0)==(O|0)){if(_=O+16|0,b=_+4|0,y=g[b>>2]|0,y)_=b;else if(y=g[_>>2]|0,!y){y=0;break}for(;;)if(C=y+20|0,b=g[C>>2]|0,b)y=b,_=C;else if(C=y+16|0,b=g[C>>2]|0,b)y=b,_=C;else break;g[_>>2]=0}else l=g[O+8>>2]|0,g[l+12>>2]=y,g[y+8>>2]=l;while(!1);if(B){if(_=g[O+28>>2]|0,b=23732+(_<<2)|0,(g[b>>2]|0)==(O|0)){if(g[b>>2]=y,!y){g[5858]=g[5858]&~(1<<_),l=O,_=M;break}}else if(l=B+16|0,g[((g[l>>2]|0)==(O|0)?l:B+20|0)>>2]=y,!y){l=O,_=M;break}g[y+24>>2]=B,_=O+16|0,b=g[_>>2]|0,b|0&&(g[y+16>>2]=b,g[b+24>>2]=y),_=g[_+4>>2]|0,_?(g[y+20>>2]=_,g[_+24>>2]=y,l=O,_=M):(l=O,_=M)}else l=O,_=M}while(!1);if(!(O>>>0>=d>>>0)&&(y=d+4|0,C=g[y>>2]|0,!!(C&1))){if(C&2)g[y>>2]=C&-2,g[l+4>>2]=_|1,g[O+_>>2]=_,B=_;else{if((g[5863]|0)==(d|0)){if(d=(g[5860]|0)+_|0,g[5860]=d,g[5863]=l,g[l+4>>2]=d|1,(l|0)!=(g[5862]|0))return;g[5862]=0,g[5859]=0;return}if((g[5862]|0)==(d|0)){d=(g[5859]|0)+_|0,g[5859]=d,g[5862]=O,g[l+4>>2]=d|1,g[O+d>>2]=d;return}B=(C&-8)+_|0,b=C>>>3;do if(C>>>0<256)if(_=g[d+8>>2]|0,y=g[d+12>>2]|0,(y|0)==(_|0)){g[5857]=g[5857]&~(1<<b);break}else{g[_+12>>2]=y,g[y+8>>2]=_;break}else{M=g[d+24>>2]|0,y=g[d+12>>2]|0;do if((y|0)==(d|0)){if(_=d+16|0,b=_+4|0,y=g[b>>2]|0,y)_=b;else if(y=g[_>>2]|0,!y){b=0;break}for(;;)if(C=y+20|0,b=g[C>>2]|0,b)y=b,_=C;else if(C=y+16|0,b=g[C>>2]|0,b)y=b,_=C;else break;g[_>>2]=0,b=y}else b=g[d+8>>2]|0,g[b+12>>2]=y,g[y+8>>2]=b,b=y;while(!1);if(M|0){if(y=g[d+28>>2]|0,_=23732+(y<<2)|0,(g[_>>2]|0)==(d|0)){if(g[_>>2]=b,!b){g[5858]=g[5858]&~(1<<y);break}}else if(C=M+16|0,g[((g[C>>2]|0)==(d|0)?C:M+20|0)>>2]=b,!b)break;g[b+24>>2]=M,y=d+16|0,_=g[y>>2]|0,_|0&&(g[b+16>>2]=_,g[_+24>>2]=b),y=g[y+4>>2]|0,y|0&&(g[b+20>>2]=y,g[y+24>>2]=b)}}while(!1);if(g[l+4>>2]=B|1,g[O+B>>2]=B,(l|0)==(g[5862]|0)){g[5859]=B;return}}if(y=B>>>3,B>>>0<256){b=23468+(y<<1<<2)|0,_=g[5857]|0,y=1<<y,_&y?(_=b+8|0,y=g[_>>2]|0):(g[5857]=_|y,y=b,_=b+8|0),g[_>>2]=l,g[y+12>>2]=l,g[l+8>>2]=y,g[l+12>>2]=b;return}y=B>>>8,y?B>>>0>16777215?C=31:(O=(y+1048320|0)>>>16&8,d=y<<O,M=(d+520192|0)>>>16&4,d=d<<M,C=(d+245760|0)>>>16&2,C=14-(M|O|C)+(d<<C>>>15)|0,C=B>>>(C+7|0)&1|C<<1):C=0,y=23732+(C<<2)|0,g[l+28>>2]=C,g[l+20>>2]=0,g[l+16>>2]=0,_=g[5858]|0,b=1<<C;e:do if(!(_&b))g[5858]=_|b,g[y>>2]=l,g[l+24>>2]=y,g[l+12>>2]=l,g[l+8>>2]=l;else{y=g[y>>2]|0;t:do if((g[y+4>>2]&-8|0)!=(B|0)){for(C=B<<((C|0)==31?0:25-(C>>>1)|0);b=y+16+(C>>>31<<2)|0,_=g[b>>2]|0,!!_;)if((g[_+4>>2]&-8|0)==(B|0)){y=_;break t}else C=C<<1,y=_;g[b>>2]=l,g[l+24>>2]=y,g[l+12>>2]=l,g[l+8>>2]=l;break e}while(!1);O=y+8|0,d=g[O>>2]|0,g[d+12>>2]=l,g[O>>2]=l,g[l+8>>2]=d,g[l+12>>2]=y,g[l+24>>2]=0}while(!1);if(d=(g[5865]|0)+-1|0,g[5865]=d,!(d|0)){for(y=23884;y=g[y>>2]|0,y;)y=y+8|0;g[5865]=-1}}}}function oo(y,_){y=y|0,_=_|0;var b=0;return y?(b=Jr(_,y)|0,(_|y)>>>0>65535&&(b=((b>>>0)/(y>>>0)|0|0)==(_|0)?b:-1)):b=0,y=Jn(b)|0,!y||!(g[y+-4>>2]&3)||ia(y|0,0,b|0)|0,y|0}function An(y,_,b,C){return y=y|0,_=_|0,b=b|0,C=C|0,b=y+b>>>0,pr(_+C+(b>>>0<y>>>0|0)>>>0|0),b|0|0}function Kr(y,_,b,C){return y=y|0,_=_|0,b=b|0,C=C|0,C=_-C-(b>>>0>y>>>0|0)>>>0,pr(C|0),y-b>>>0|0|0}function ki(y){return y=y|0,(y?31-(Xr(y^y-1)|0)|0:32)|0}function Tu(y,_,b,C,B){y=y|0,_=_|0,b=b|0,C=C|0,B=B|0;var M=0,O=0,l=0,d=0,h=0,m=0,T=0,P=0,R=0,L=0;if(m=y,d=_,h=d,O=b,P=C,l=P,!h)return M=(B|0)!=0,l?M?(g[B>>2]=y|0,g[B+4>>2]=_&0,P=0,B=0,pr(P|0),B|0):(P=0,B=0,pr(P|0),B|0):(M&&(g[B>>2]=(m>>>0)%(O>>>0),g[B+4>>2]=0),P=0,B=(m>>>0)/(O>>>0)>>>0,pr(P|0),B|0);M=(l|0)==0;do if(O){if(!M){if(M=(Xr(l|0)|0)-(Xr(h|0)|0)|0,M>>>0<=31){T=M+1|0,l=31-M|0,_=M-31>>31,O=T,y=m>>>(T>>>0)&_|h<<l,_=h>>>(T>>>0)&_,M=0,l=m<<l;break}return B?(g[B>>2]=y|0,g[B+4>>2]=d|_&0,P=0,B=0,pr(P|0),B|0):(P=0,B=0,pr(P|0),B|0)}if(M=O-1|0,M&O|0){l=(Xr(O|0)|0)+33-(Xr(h|0)|0)|0,L=64-l|0,T=32-l|0,d=T>>31,R=l-32|0,_=R>>31,O=l,y=T-1>>31&h>>>(R>>>0)|(h<<T|m>>
4207>(l>>>0))&_,_=_&h>>>(l>>>0),M=m<<L&d,l=(h<<L|m>>>(R>>>0))&d|m<<T&l-33>>31;break}return B|0&&(g[B>>2]=M&m,g[B+4>>2]=0),(O|0)==1?(R=d|_&0,L=y|0|0,pr(R|0),L|0):(L=ki(O|0)|0,R=h>>>(L>>>0)|0,L=h<<32-L|m>>>(L>>>0)|0,pr(R|0),L|0)}else{if(M)return B|0&&(g[B>>2]=(h>>>0)%(O>>>0),g[B+4>>2]=0),R=0,L=(h>>>0)/(O>>>0)>>>0,pr(R|0),L|0;if(!m)return B|0&&(g[B>>2]=0,g[B+4>>2]=(h>>>0)%(l>>>0)),R=0,L=(h>>>0)/(l>>>0)>>>0,pr(R|0),L|0;if(M=l-1|0,!(M&l))return B|0&&(g[B>>2]=y|0,g[B+4>>2]=M&h|_&0),R=0,L=h>>>((ki(l|0)|0)>>>0),pr(R|0),L|0;if(M=(Xr(l|0)|0)-(Xr(h|0)|0)|0,M>>>0<=30){_=M+1|0,l=31-M|0,O=_,y=h<<l|m>>>(_>>>0),_=h>>>(_>>>0),M=0,l=m<<l;break}return B?(g[B>>2]=y|0,g[B+4>>2]=d|_&0,R=0,L=0,pr(R|0),L|0):(R=0,L=0,pr(R|0),L|0)}while(!1);if(!O)h=l,d=0,l=0;else{T=b|0|0,m=P|C&0,h=An(T|0,m|0,-1,-1)|0,b=Ie()|0,d=l,l=0;do C=d,d=M>>>31|d<<1,M=l|M<<1,C=y<<1|C>>>31|0,P=y>>>31|_<<1|0,Kr(h|0,b|0,C|0,P|0)|0,L=Ie()|0,R=L>>31|((L|0)<0?-1:0)<<1,l=R&1,y=Kr(C|0,P|0,R&T|0,(((L|0)<0?-1:0)>>31|((L|0)<0?-1:0)<<1)&m|0)|0,_=Ie()|0,O=O-1|0;while((O|0)!=0);h=d,d=0}return O=0,B|0&&(g[B>>2]=y,g[B+4>>2]=_),R=(M|0)>>>31|(h|O)<<1|(O<<1|M>>>31)&0|d,L=(M<<1|0)&-2|l,pr(R|0),L|0}function js(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0;return h=_>>31|((_|0)<0?-1:0)<<1,d=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,M=C>>31|((C|0)<0?-1:0)<<1,B=((C|0)<0?-1:0)>>31|((C|0)<0?-1:0)<<1,l=Kr(h^y|0,d^_|0,h|0,d|0)|0,O=Ie()|0,y=M^h,_=B^d,Kr((Tu(l,O,Kr(M^b|0,B^C|0,M|0,B|0)|0,Ie()|0,0)|0)^y|0,(Ie()|0)^_|0,y|0,_|0)|0}function Sf(y,_){y=y|0,_=_|0;var b=0,C=0,B=0,M=0;return M=y&65535,B=_&65535,b=Jr(B,M)|0,C=y>>>16,y=(b>>>16)+(Jr(B,C)|0)|0,B=_>>>16,_=Jr(B,M)|0,pr((y>>>16)+(Jr(B,C)|0)+(((y&65535)+_|0)>>>16)|0),y+_<<16|b&65535|0|0}function di(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0;return B=y,M=b,b=Sf(B,M)|0,y=Ie()|0,pr((Jr(_,M)|0)+(Jr(C,B)|0)+y|y&0|0),b|0|0|0}function os(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0,O=0,l=0,d=0,h=0;return B=Se,Se=Se+16|0,l=B|0,O=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,h=C>>31|((C|0)<0?-1:0)<<1,d=((C|0)<0?-1:0)>>31|((C|0)<0?-1:0)<<1,y=Kr(O^y|0,M^_|0,O|0,M|0)|0,_=Ie()|0,Tu(y,_,Kr(h^b|0,d^C|0,h|0,d|0)|0,Ie()|0,l)|0,C=Kr(g[l>>2]^O|0,g[l+4>>2]^M|0,O|0,M|0)|0,b=Ie()|0,Se=B,pr(b|0),C|0}function To(y,_,b,C){y=y|0,_=_|0,b=b|0,C=C|0;var B=0,M=0;return M=Se,Se=Se+16|0,B=M|0,Tu(y,_,b,C,B)|0,Se=M,pr(g[B+4>>2]|0),g[B>>2]|0|0}function Eo(y,_,b){return y=y|0,_=_|0,b=b|0,(b|0)<32?(pr(_>>b|0),y>>>b|(_&(1<<b)-1)<<32-b):(pr(((_|0)<0?-1:0)|0),_>>b-32|0)}function Jt(y,_,b){return y=y|0,_=_|0,b=b|0,(b|0)<32?(pr(_>>>b|0),y>>>b|(_&(1<<b)-1)<<32-b):(pr(0),_>>>b-32|0)}function tr(y,_,b){return y=y|0,_=_|0,b=b|0,(b|0)<32?(pr(_<<b|(y&(1<<b)-1<<32-b)>>>32-b|0),y<<b):(pr(y<<b-32|0),0)}function Hc(y,_){return y=+y,_=+_,y!=y?+_:_!=_?+y:+yi(+y,+_)}function Fl(y,_){return y=+y,_=+_,y!=y?+_:_!=_?+y:+Vr(+y,+_)}function na(y){return y=+y,y>=0?+Et(y+.5):+Wr(y-.5)}function Oo(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0;if((b|0)>=8192)return ya(y|0,_|0,b|0)|0,y|0;if(M=y|0,B=y+b|0,(y&3)==(_&3)){for(;y&3;){if(!b)return M|0;Be[y>>0]=Be[_>>0]|0,y=y+1|0,_=_+1|0,b=b-1|0}for(b=B&-4|0,C=b-64|0;(y|0)<=(C|0);)g[y>>2]=g[_>>2],g[y+4>>2]=g[_+4>>2],g[y+8>>2]=g[_+8>>2],g[y+12>>2]=g[_+12>>2],g[y+16>>2]=g[_+16>>2],g[y+20>>2]=g[_+20>>2],g[y+24>>2]=g[_+24>>2],g[y+28>>2]=g[_+28>>2],g[y+32>>2]=g[_+32>>2],g[y+36>>2]=g[_+36>>2],g[y+40>>2]=g[_+40>>2],g[y+44>>2]=g[_+44>>2],g[y+48>>2]=g[_+48>>2],g[y+52>>2]=g[_+52>>2],g[y+56>>2]=g[_+56>>2],g[y+60>>2]=g[_+60>>2],y=y+64|0,_=_+64|0;for(;(y|0)<(b|0);)g[y>>2]=g[_>>2],y=y+4|0,_=_+4|0}else for(b=B-4|0;(y|0)<(b|0);)Be[y>>0]=Be[_>>0]|0,Be[y+1>>0]=Be[_+1>>0]|0,Be[y+2>>0]=Be[_+2>>0]|0,Be[y+3>>0]=Be[_+3>>0]|0,y=y+4|0,_=_+4|0;for(;(y|0)<(B|0);)Be[y>>0]=Be[_>>0]|0,y=y+1|0,_=_+1|0;return M|0}function ia(y,_,b){y=y|0,_=_|0,b=b|0;var C=0,B=0,M=0,O=0;if(M=y+b|0,_=_&255,(b|0)>=67){for(;y&3;)Be[y>>0]=_,y=y+1|0;for(C=M&-4|0,O=_|_<<8|_<<16|_<<24,B=C-64|0;(y|0)<=(B|0);)g[y>>2]=O,g[y+4>>2]=O,g[y+8>>2]=O,g[y+12>>2]=O,g[y+16>>2]=O,g[y+20>>2]=O,g[y+24>>2]=O,g[y+28>>2]=O,g[y+32>>2]=O,g[y+36>>2]=O,g[y+40>>2]=O,g[y+44>>2]=O,g[y+48>>2]=O,g[y+52>>2]=O,g[y+56>>2]=O,g[y+60>>2]=O,y=y+64|0;for(;(y|0)<(C|0);)g[y>>2]=O,y=y+4|0}for(;(y|0)<(M|0);)Be[y>>0]=_,y=y+1|0;return M-b|0}function sa(y){return y=+y,y>=0?+Et(y+.5):+Wr(y-.5)}function ys(y){y=y|0;var _=0,b=0,C=0;return C=$i()|0,b=g[Ke>>2]|0,_=b+y|0,(y|0)>0&(_|0)<(b|0)|(_|0)<0?(jn(_|0)|0,tn(12),-1):(_|0)>(C|0)&&!(li(_|0)|0)?(tn(12),-1):(g[Ke>>2]=_,b|0)}return{___divdi3:js,___muldi3:di,___remdi3:os,___uremdi3:To,_areNeighborCells:Ea,_bitshift64Ashr:Eo,_bitshift64Lshr:Jt,_bitshift64Shl:tr,_calloc:oo,_cellAreaKm2:Ln,_cellAreaM2:Vs,_cellAreaRads2:fn,_cellToBoundary:Lc,_cellToCenterChild:tA,_cellToChildPos:gu,_cellToChildren:On,_cellToChildrenSize:Tl,_cellToLatLng:Oc,_cellToLocalIj:Vh,_cellToParent:Zo,_cellToVertex:Hr,_cellToVertexes:Do,_cellsToDirectedEdge:Ka,_cellsToLinkedMultiPolygon:vr,_childPosToCell:nA,_compactCells:Fc,_destroyLinkedMultiPolygon:zc,_directedEdgeToBoundary:lu,_directedEdgeToCells:Dh,_edgeLengthKm:Uc,_edgeLengthM:Ml,_edgeLengthRads:Il,_emscripten_replace_memory:$o,_free:zr,_getBaseCellNumber:vf,_getDirectedEdgeDestination:Ba,_getDirectedEdgeOrigin:qa,_getHexagonAreaAvgKm2:Gh,_getHexagonAreaAvgM2:ic,_getHexagonEdgeLengthAvgKm:Wn,_getHexagonEdgeLengthAvgM:yu,_getIcosahedronFaces:kc,_getNumCells:Qo,_getPentagons:El,_getRes0Cells:Rh,_getResolution:Ya,_greatCircleDistanceKm:nc,_greatCircleDistanceM:bf,_greatCircleDistanceRads:_u,_gridDisk:Rn,_gridDiskDistances:ms,_gridDistance:or,_gridPathCells:vu,_gridPathCellsSize:Ss,_gridRingUnsafe:xe,_i64Add:An,_i64Subtract:Kr,_isPentagon:Fn,_isResClassIII:zh,_isValidCell:Yo,_isValidDirectedEdge:Fh,_isValidVertex:Xi,_latLngToCell:Qa,_llvm_maxnum_f64:Hc,_llvm_minnum_f64:Fl,_llvm_round_f64:na,_localIjToCell:Ci,_malloc:Jn,_maxFaceCount:tc,_maxGridDiskSize:Ii,_maxPolygonToCellsSize:Pe,_memcpy:Oo,_memset:ia,_originToDirectedEdges:In,_pentagonCount:Au,_polygonToCells:gt,_readInt64AsDoubleFromPointer:Ms,_res0CellCount:bl,_round:sa,_sbrk:ys,_sizeOfCellBoundary:Tf,_sizeOfCoordIJ:wu,_sizeOfGeoLoop:no,_sizeOfGeoPolygon:Is,_sizeOfH3Index:Cf,_sizeOfLatLng:bu,_sizeOfLinkedGeoPolygon:xu,_uncompactCells:Uh,_uncompactCellsSize:rA,_vertexToLatLng:io,establishStackSpace:ui,stackAlloc:$n,stackRestore:Oi,stackSave:Wo}
4207}(Ae,Gt,pe);e.___divdi3=Tt.___divdi3,e.___muldi3=Tt.___muldi3,e.___remdi3=Tt.___remdi3,e.___uremdi3=Tt.___uremdi3,e._areNeighborCells=Tt._areNeighborCells,e._bitshift64Ashr=Tt._bitshift64Ashr,e._bitshift64Lshr=Tt._bitshift64Lshr,e._bitshift64Shl=Tt._bitshift64Shl,e._calloc=Tt._calloc,e._cellAreaKm2=Tt._cellAreaKm2,e._cellAreaM2=Tt._cellAreaM2,e._cellAreaRads2=Tt._cellAreaRads2,e._cellToBoundary=Tt._cellToBoundary,e._cellToCenterChild=Tt._cellToCenterChild,e._cellToChildPos=Tt._cellToChildPos,e._cellToChildren=Tt._cellToChildren,e._cellToChildrenSize=Tt._cellToChildrenSize,e._cellToLatLng=Tt._cellToLatLng,e._cellToLocalIj=Tt._cellToLocalIj,e._cellToParent=Tt._cellToParent,e._cellToVertex=Tt._cellToVertex,e._cellToVertexes=Tt._cellToVertexes,e._cellsToDirectedEdge=Tt._cellsToDirectedEdge,e._cellsToLinkedMultiPolygon=Tt._cellsToLinkedMultiPolygon,e._childPosToCell=Tt._childPosToCell,e._compactCells=Tt._compactCells,e._destroyLinkedMultiPolygon=Tt._destroyLinkedMultiPolygon,e._directedEdgeToBoundary=Tt._directedEdgeToBoundary,e._directedEdgeToCells=Tt._directedEdgeToCells,e._edgeLengthKm=Tt._edgeLengthKm,e._edgeLengthM=Tt._edgeLengthM,e._edgeLengthRads=Tt._edgeLengthRads;var j=e._emscripten_replace_memory=Tt._emscripten_replace_memory;e._free=Tt._free,e._getBaseCellNumber=Tt._getBaseCellNumber,e._getDirectedEdgeDestination=Tt._getDirectedEdgeDestination,e._getDirectedEdgeOrigin=Tt._getDirectedEdgeOrigin,e._getHexagonAreaAvgKm2=Tt._getHexagonAreaAvgKm2,e._getHexagonAreaAvgM2=Tt._getHexagonAreaAvgM2,e._getHexagonEdgeLengthAvgKm=Tt._getHexagonEdgeLengthAvgKm,e._getHexagonEdgeLengthAvgM=Tt._getHexagonEdgeLengthAvgM,e._getIcosahedronFaces=Tt._getIcosahedronFaces,e._getNumCells=Tt._getNumCells,e._getPentagons=Tt._getPentagons,e._getRes0Cells=Tt._getRes0Cells,e._getResolution=Tt._getResolution,e._greatCircleDistanceKm=Tt._greatCircleDistanceKm,e._greatCircleDistanceM=Tt._greatCircleDistanceM,e._greatCircleDistanceRads=Tt._greatCircleDistanceRads,e._gridDisk=Tt._gridDisk,e._gridDiskDistances=Tt._gridDiskDistances,e._gridDistance=Tt._gridDistance,e._gridPathCells=Tt._gridPathCells,e._gridPathCellsSize=Tt._gridPathCellsSize,e._gridRingUnsafe=Tt._gridRingUnsafe,e._i64Add=Tt._i64Add,e._i64Subtract=Tt._i64Subtract,e._isPentagon=Tt._isPentagon,e._isResClassIII=Tt._isResClassIII,e._isValidCell=Tt._isValidCell,e._isValidDirectedEdge=Tt._isValidDirectedEdge,e._isValidVertex=Tt._isValidVertex,e._latLngToCell=Tt._latLngToCell,e._llvm_maxnum_f64=Tt._llvm_maxnum_f64,e._llvm_minnum_f64=Tt._llvm_minnum_f64,e._llvm_round_f64=Tt._llvm_round_f64,e._localIjToCell=Tt._localIjToCell,e._malloc=Tt._malloc,e._maxFaceCount=Tt._maxFaceCount,e._maxGridDiskSize=Tt._maxGridDiskSize,e._maxPolygonToCellsSize=Tt._maxPolygonToCellsSize,e._memcpy=Tt._memcpy,e._memset=Tt._memset,e._originToDirectedEdges=Tt._originToDirectedEdges,e._pentagonCount=Tt._pentagonCount,e._polygonToCells=Tt._polygonToCells,e._readInt64AsDoubleFromPointer=Tt._readInt64AsDoubleFromPointer,e._res0CellCount=Tt._res0CellCount,e._round=Tt._round,e._sbrk=Tt._sbrk,e._sizeOfCellBoundary=Tt._sizeOfCellBoundary,e._sizeOfCoordIJ=Tt._sizeOfCoordIJ,e._sizeOfGeoLoop=Tt._sizeOfGeoLoop,e._sizeOfGeoPolygon=Tt._sizeOfGeoPolygon,e._sizeOfH3Index=Tt._sizeOfH3Index,e._sizeOfLatLng=Tt._sizeOfLatLng,e._sizeOfLinkedGeoPolygon=Tt._sizeOfLinkedGeoPolygon,e._uncompactCells=Tt._uncompactCells,e._uncompactCellsSize=Tt._uncompactCellsSize,e._vertexToLatLng=Tt._vertexToLatLng,e.establishStackSpace=Tt.establishStackSpace;var bt=e.stackAlloc=Tt.stackAlloc,Bt=e.stackRestore=Tt.stackRestore,Ce=e.stackSave=Tt.stackSave;if(e.asm=Tt,e.cwrap=J,e.setValue=F,e.getValue=N,mn){Hn(mn)||(mn=s(mn));{ci();var Je=function(he){he.byteLength&&(he=new Uint8Array(he)),re.set(he,S),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,Yn()},lt=function(){o(mn,Je,function(){throw"could not load memory initializer "+mn})},Y=Rt(mn);if(Y)Je(Y.buffer);else if(e.memoryInitializerRequest){var ne=function(){var he=e.memoryInitializerRequest,be=he.response;if(he.status!==200&&he.status!==0){var ae=Rt(e.memoryInitializerRequestURL);if(ae)be=ae.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+he.status+", retrying "+mn),lt();return}}Je(be)};e.memoryInitializerRequest.response?setTimeout(ne,0):e.memoryInitializerRequest.addEventListener("load",ne)}else lt()}}var le;Dr=function he(){le||ve(),le||(Dr=he)};function ve(he){if(un>0||(er(),un>0))return;function be(){le||(le=!0,!U&&(Kt(),Nt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Ar()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),be()},1)):be()}e.run=ve;function Oe(he){throw e.onAbort&&e.onAbort(he),he+="",c(he),f(he),U=!0,"abort("+he+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Oe,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return ve(),r}(typeof Nr=="object"?Nr:{}),_n="number",an=_n,kA=_n,dn=_n,pn=_n,ho=_n,Fr=_n,mde=[["sizeOfH3Index",_n],["sizeOfLatLng",_n],["sizeOfCellBoundary",_n],["sizeOfGeoLoop",_n],["sizeOfGeoPolygon",_n],["sizeOfLinkedGeoPolygon",_n],["sizeOfCoordIJ",_n],["readInt64AsDoubleFromPointer",_n],["isValidCell",kA,[dn,pn]],["latLngToCell",an,[_n,_n,ho,Fr]],["cellToLatLng",an,[dn,pn,Fr]],["cellToBoundary",an,[dn,pn,Fr]],["maxGridDiskSize",an,[_n,Fr]],["gridDisk",an,[dn,pn,_n,Fr]],["gridDiskDistances",an,[dn,pn,_n,Fr,Fr]],["gridRingUnsafe",an,[dn,pn,_n,Fr]],["maxPolygonToCellsSize",an,[Fr,ho,_n,Fr]],["polygonToCells",an,[Fr,ho,_n,Fr]],["cellsToLinkedMultiPolygon",an,[Fr,_n,Fr]],["destroyLinkedMultiPolygon",null,[Fr]],["compactCells",an,[Fr,Fr,_n,_n]],["uncompactCells",an,[Fr,_n,_n,Fr,_n,ho]],["uncompactCellsSize",an,[Fr,_n,_n,ho,Fr]],["isPentagon",kA,[dn,pn]],["isResClassIII",kA,[dn,pn]],["getBaseCellNumber",_n,[dn,pn]],["getResolution",_n,[dn,pn]],["maxFaceCount",an,[dn,pn,Fr]],["getIcosahedronFaces",an,[dn,pn,Fr]],["cellToParent",an,[dn,pn,ho,Fr]],["cellToChildren",an,[dn,pn,ho,Fr]],["cellToCenterChild",an,[dn,pn,ho,Fr]],["cellToChildrenSize",an,[dn,pn,ho,Fr]],["cellToChildPos",an,[dn,pn,ho,Fr]],["childPosToCell",an,[_n,_n,dn,pn,ho,Fr]],["areNeighborCells",an,[dn,pn,dn,pn,Fr]],["cellsToDirectedEdge",an,[dn,pn,dn,pn,Fr]],["getDirectedEdgeOrigin",an,[dn,pn,Fr]],["getDirectedEdgeDestination",an,[dn,pn,Fr]],["isValidDirectedEdge",kA,[dn,pn]],["directedEdgeToCells",an,[dn,pn,Fr]],["originToDirectedEdges",an,[dn,pn,Fr]],["directedEdgeToBoundary",an,[dn,pn,Fr]],["gridDistance",an,[dn,pn,dn,pn,Fr]],["gridPathCells",an,[dn,pn,dn,pn,Fr]],["gridPathCellsSize",an,[dn,pn,dn,pn,Fr]],["cellToLocalIj",an,[dn,pn,dn,pn,_n,Fr]],["localIjToCell",an,[dn,pn,Fr,_n,Fr]],["getHexagonAreaAvgM2",an,[ho,Fr]],["getHexagonAreaAvgKm2",an,[ho,Fr]],["getHexagonEdgeLengthAvgM",an,[ho,Fr]],["getHexagonEdgeLengthAvgKm",an,[ho,Fr]],["greatCircleDistanceM",_n,[Fr,Fr]],["greatCircleDistanceKm",_n,[Fr,Fr]],["greatCircleDistanceRads",_n,[Fr,Fr]],["cellAreaM2",an,[dn,pn,Fr]],["cellAreaKm2",an,[dn,pn,Fr]],["cellAreaRads2",an,[dn,pn,Fr]],["edgeLengthM",an,[dn,pn,Fr]],["edgeLengthKm",an,[dn,pn,Fr]],["edgeLengthRads",an,[dn,pn,Fr]],["getNumCells",an,[ho,Fr]],["getRes0Cells",an,[Fr]],["res0CellCount",_n],["getPentagons",an,[_n,Fr]],["pentagonCount",_n],["cellToVertex",an,[dn,pn,_n,Fr]],["cellToVertexes",an,[dn,pn,Fr]],["vertexToLatLng",an,[dn,pn,Fr]],["isValidVertex",kA,[dn,pn]]],_de=0,yde=1,vde=2,bde=3,X6=4,xde=5,wde=6,Cde=7,Tde=8,Ede=9,Bde=10,Sde=11,Ide=12,Mde=13,Pde=14,Rde=15,Zs={};Zs[_de]="Success";Zs[yde]="The operation failed but a more specific error is not available";Zs[vde]="Argument was outside of acceptable range";Zs[bde]="Latitude or longitude arguments were outside of acceptable range";Zs[X6]="Resolution argument was outside of acceptable range";
4207Zs[xde]="Cell argument was not valid";Zs[wde]="Directed edge argument was not valid";Zs[Cde]="Undirected edge argument was not valid";Zs[Tde]="Vertex argument was not valid";Zs[Ede]="Pentagon distortion was encountered";Zs[Bde]="Duplicate input";Zs[Sde]="Cell arguments were not neighbors";Zs[Ide]="Cell arguments had incompatible resolutions";Zs[Mde]="Memory allocation failed";Zs[Pde]="Bounds of provided memory were insufficient";Zs[Rde]="Mode or flags argument was not valid";var MC=1e3,K6=1001,q6=1002,ky={};ky[MC]="Unknown unit";ky[K6]="Array length out of bounds";ky[q6]="Got unexpected null value for H3 index";var Fde="Unknown error";function Y6(r,e,t){var n=t&&"value"in t,i=new Error((r[e]||Fde)+" (code: "+e+(n?", value: "+t.value:"")+")");return i.code=e,i}function Z6(r,e){var t=arguments.length===2?{value:e}:{};return Y6(Zs,r,t)}function Ny(r,e){var t=arguments.length===2?{value:e}:{};return Y6(ky,r,t)}function _o(r){if(r!==0)throw Z6(r)}var oi={};mde.forEach(function(e){oi[e[0]]=Nr.cwrap.apply(Nr,e)});var pp=16,Up=4,KP=4,pl=8,PC=8,rf=oi.sizeOfH3Index(),RC=oi.sizeOfLatLng(),Dde=oi.sizeOfCellBoundary(),Ode=oi.sizeOfGeoPolygon(),Ag=oi.sizeOfGeoLoop(),Lde=oi.sizeOfLinkedGeoPolygon();oi.sizeOfCoordIJ();var Ep={m:"m",m2:"m2",km:"km",km2:"km2",rads:"rads",rads2:"rads2"};function Q6(r){if(typeof r!="number"||r<0||r>15||Math.floor(r)!==r)throw Z6(X6,r);return r}function e8(r){if(!r)throw Ny(q6);return r}var kde=Math.pow(2,32)-1;function t8(r){if(r>kde)throw Ny(K6,r);return r}var Nde=/[^0-9a-fA-F]/;function Bc(r){if(Array.isArray(r)&&r.length===2&&Number.isInteger(r[0])&&Number.isInteger(r[1]))return r;if(typeof r!="string"||Nde.test(r))return[0,0];var e=parseInt(r.substring(0,r.length-8),pp),t=parseInt(r.substring(r.length-8),pp);return[t,e]}function qP(r){if(r>=0)return r.toString(pp);r=r&2147483647;var e=r8(8,r.toString(pp)),t=(parseInt(e[0],pp)+8).toString(pp);return e=t+e.substring(1),e}function Ude(r,e){return qP(e)+r8(8,qP(r))}function r8(r,e){for(var t=r-e.length,n="",i=0;i<t;i++)n+="0";return n=n+e,n}function YP(r,e,t){for(var n=r.length,i=Nr._calloc(n,RC),s=t?1:0,o=t?0:1,c=0;c<n*2;c+=2)Nr.HEAPF64.set([r[c/2][s],r[c/2][o]].map(a8),i/pl+c);return Nr.HEAPU32.set([n,i],e/Up),e}function zde(r,e){var t=r.length-1,n=Nr._calloc(Ode),i=0,s=i+Ag,o=s+Up;YP(r[0],n+i,e);var c;if(t>0){c=Nr._calloc(t,Ag);for(var f=0;f<t;f++)YP(r[f+1],c+Ag*f,e)}return Nr.setValue(n+s,t,"i32"),Nr.setValue(n+o,c,"i32"),n}function Gde(r){var e=0,t=e+Ag,n=t+Up,i=Up;Nr._free(Nr.getValue(r+e+i,"i8*"));var s=Nr.getValue(r+t,"i32");if(s>0){for(var o=Nr.getValue(r+n,"i32"),c=0;c<s;c++)Nr._free(Nr.getValue(o+Ag*c+i,"i8*"));Nr._free(o)}Nr._free(r)}function FC(r,e){e===void 0&&(e=0);var t=Nr.getValue(r+rf*e,"i32"),n=Nr.getValue(r+rf*e+Up,"i32");return n?Ude(t,n):null}function n8(r,e){return e===void 0&&(e=0),Nr.getValue(r+pl*e,"double")}function DC(r){return oi.readInt64AsDoubleFromPointer(r)}function Vde(r,e,t){Nr.HEAPU32.set(Bc(r),e/Up+2*t)}function OC(r,e){for(var t=[],n=0;n<e;n++){var i=FC(r,n);i!==null&&t.push(i)}return t}function Hde(r,e){for(var t=e.length,n=0;n<t;n++)Vde(e[n],r,n)}function j_(r){return tpe(Nr.getValue(r,"double"))}function i8(r){return[j_(r),j_(r+pl)]}function s8(r){return[j_(r+pl),j_(r)]}function jde(r,e,t){for(var n=Nr.getValue(r,"i32"),i=r+pl,s=[],o=e?s8:i8,c=0;c<n*2;c+=2)s.push(o(i+pl*c));return t&&s.push(s[0]),s}function $de(r,e){for(var t=[],n=s8,i,s,o,c;r;){for(t.push(i=[]),s=Nr.getValue(r,"i8*");s;){for(i.push(o=[]),c=Nr.getValue(s,"i8*");c;)o.push(n(c)),c=Nr.getValue(c+pl*2,"i8*");o.push(o[0]),s=Nr.getValue(s+KP*2,"i8*")}r=Nr.getValue(r+KP*2,"i8*")}return t}function Wde(r){var e=Bc(r),t=e[0],n=e[1];return!!oi.isPentagon(t,n)}function $_(r){var e=Bc(r),t=e[0],n=e[1];return oi.isValidCell(t,n)?oi.getResolution(t,n):-1}function LC(r,e,t){var n=Nr._malloc(RC);Nr.HEAPF64.set([r,e].map(a8),n/pl);var i=Nr._malloc(rf);try{return _o(oi.latLngToCell(n,t,i)),e8(FC(i))}finally{Nr._free(i),Nr._free(n)}}function kC(r){var e=Nr._malloc(RC),t=Bc(r),n=t[0],i=t[1];try{return _o(oi.cellToLatLng(n,i,e)),i8(e)}finally{Nr._free(e)}}function o8(r,e){var t=Nr._malloc(Dde),n=Bc(r),i=n[0],s=n[1];try{return _o(oi.cellToBoundary(i,s,t)),jde(t,e,e)}finally{Nr._free(t)}}function Jde(r,e){var t=Bc(r),n=t[0],i=t[1],s=Nr._malloc(rf);try{return _o(oi.cellToParent(n,i,e,s)),e8(FC(s))}finally{Nr._free(s)}}function Xde(r,e){var t=Bc(r),n=t[0],i=t[1],s=Nr._malloc(PC);try{_o(oi.maxGridDiskSize(e,s));var o=t8(DC(s)),c=Nr._calloc(o,rf);try{return _o(oi.gridDisk(n,i,e,c)),OC(c,o)}finally{Nr._free(c)}}finally{Nr._free(s)}}function Kde(r,e,t){if(Q6(e),t=!!t,r.length===0||r[0].length===0)return[];var n=typeof r[0][0]=="number"?[r]:r,i=zde(n,t),s=Nr._malloc(PC);try{_o(oi.maxPolygonToCellsSize(i,e,0,s));var o=t8(DC(s)),c=Nr._calloc(o,rf);try{return _o(oi.polygonToCells(i,e,0,c)),OC(c,o)}finally{Nr._free(c)}}finally{Nr._free(s),Gde(i)}}function qde(r,e){if(!r||!r.length)return[];var t=r.length,n=Nr._calloc(t,rf);Hde(n,r);var i=Nr._calloc(Lde);try{return _o(oi.cellsToLinkedMultiPolygon(n,t,i)),$de(i,e)}finally{oi.destroyLinkedMultiPolygon(i),Nr._free(i),Nr._free(n)}}function Yde(r){var e=Bc(r),t=e[0],n=e[1],i=6,s=Nr._calloc(i,rf);
4207try{return _o(oi.originToDirectedEdges(t,n,s)),OC(s,i)}finally{Nr._free(s)}}function Zde(r,e){var t=Bc(r),n=t[0],i=t[1],s=Bc(e),o=s[0],c=s[1],f=Nr._malloc(PC);try{return _o(oi.gridDistance(n,i,o,c,f)),DC(f)}finally{Nr._free(f)}}function Qde(r,e){var t=Bc(r),n=t[0],i=t[1],s=Nr._malloc(pl);try{switch(e){case Ep.m:_o(oi.edgeLengthM(n,i,s));break;case Ep.km:_o(oi.edgeLengthKm(n,i,s));break;case Ep.rads:_o(oi.edgeLengthRads(n,i,s));break;default:throw Ny(MC,e)}return n8(s)}finally{Nr._free(s)}}function epe(r,e){Q6(r);var t=Nr._malloc(pl);try{switch(e){case Ep.m:_o(oi.getHexagonEdgeLengthAvgM(r,t));break;case Ep.km:_o(oi.getHexagonEdgeLengthAvgKm(r,t));break;default:throw Ny(MC,e)}return n8(t)}finally{Nr._free(t)}}function a8(r){return r*Math.PI/180}function tpe(r){return r*180/Math.PI}function NC(r,e){e=e===void 0?r[0][0]:e;for(const t of r){const n=t[0]-e;n>180?t[0]-=360:n<-180&&(t[0]+=360)}}function rpe(r,e,t){const[n,i]=kC(r),s=e.length;NC(e,i);const o=e[0]===e[s-1]?s-1:s;for(let c=0;c<o;c++)e[c][0]=Cc(i,e[c][0],t),e[c][1]=Cc(n,e[c][1],t)}function npe(r,e,t){const n=r(e,t),[i,s]=kC(n);return[s,i]}function ZP(r,e=1){const t=o8(r,!0);return e!==1?rpe(r,t,e):NC(t),t}function ipe(r){const e=new Float64Array(r.length*2);let t=0;for(const n of r)e[t++]=n[0],e[t++]=n[1];return e}const spe=10;function ope(r,e){let t;return r==null?t=e:typeof r=="object"?t={...r,coverage:e}:t={getHexagon:r,coverage:e},t}const ape={...hf.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:r=>r.hexagon},extruded:!0};class _l extends Bs{initializeState(){_l._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:e}){return this._shouldUseHighPrecision()?e.propsOrDataChanged:e.somethingChanged}updateState({props:e,changeFlags:t}){if(e.highPrecision!==!0&&(t.dataChanged||t.updateTriggersChanged&&t.updateTriggersChanged.getHexagon)){const n=this._calculateH3DataProps();this.setState(n)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let e=-1,t=!1,n=!1;const{iterable:i,objectInfo:s}=gl(this.props.data);for(const o of i){s.index++;const c=this.props.getHexagon(o,s),f=$_(c);if(e<0){if(e=f,!this.props.highPrecision)break}else if(e!==f){n=!0;break}if(Wde(c)){t=!0;break}}return{resolution:e,edgeLengthKM:e>=0?epe(e,"km"):0,hasMultipleRes:n,hasPentagon:t}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){const{resolution:e,hasPentagon:t,hasMultipleRes:n}=this.state,{viewport:i}=this.context;return!!i?.resolution||n||t||e>=0&&e<=5}return this.props.highPrecision}_updateVertices(e){if(this._shouldUseHighPrecision())return;const{resolution:t,edgeLengthKM:n,centerHex:i}=this.state;if(t<0)return;const s=this.props.centerHexagon||LC(e.latitude,e.longitude,t);if(i===s)return;if(i)try{if(Zde(i,s)*n<spe)return}catch{}const{unitsPerMeter:o}=e.distanceScales;let c=ZP(s);const[f,A]=kC(s),[v,w]=e.projectFlat([A,f]);c=c.map(S=>{const F=e.projectFlat(S);return[(F[0]-v)/o[0],(F[1]-w)/o[1]]}),this.setState({centerHex:s,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){const{elevationScale:e,material:t,coverage:n,extruded:i,wireframe:s,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:A,lineWidthMinPixels:v,lineWidthMaxPixels:w,getFillColor:S,getElevation:F,getLineColor:N,getLineWidth:U,transitions:$,updateTriggers:G}=this.props;return{elevationScale:e,extruded:i,coverage:n,wireframe:s,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:A,lineWidthMinPixels:v,lineWidthMaxPixels:w,material:t,getElevation:F,getFillColor:S,getLineColor:N,getLineWidth:U,transitions:$,updateTriggers:{getFillColor:G.getFillColor,getElevation:G.getElevation,getLineColor:G.getLineColor,getLineWidth:G.getLineWidth}}}_renderPolygonLayer(){const{data:e,getHexagon:t,updateTriggers:n,coverage:i}=this.props,s=this.getSubLayerClass("hexagon-cell-hifi",hf),o=this._getForwardProps();return o.updateTriggers.getPolygon=ope(n.getHexagon,i),new s(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(c,f)=>{const A=t(c,f);return ipe(ZP(A,i))}})}_renderColumnLayer(){const{data:e,getHexagon:t,updateTriggers:n}=this.props,i=this.getSubLayerClass("hexagon-cell",ml),s=this._getForwardProps();return s.updateTriggers.getPosition=n.getHexagon,new i(s,this.get
4207SubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:s.updateTriggers}),{data:e,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:npe.bind(null,t)})}}_l.defaultProps=ape;_l.layerName="H3HexagonLayer";_l._checkH3Lib=()=>{};const cpe={getHexagons:{type:"accessor",value:r=>r.hexagons}};class Uy extends df{initializeState(){_l._checkH3Lib()}updateState({props:e,changeFlags:t}){if(t.dataChanged||t.updateTriggersChanged&&t.updateTriggersChanged.getHexagons){const{data:n,getHexagons:i}=e,s=[],{iterable:o,objectInfo:c}=gl(n);for(const f of o){c.index++;const A=i(f,c),v=qde(A,!0);for(const w of v){for(const S of w)NC(S);s.push(this.getSubLayerRow({polygon:w},f,c.index))}}this.setState({polygons:s})}}indexToBounds(){const{getElevation:e,getFillColor:t,getLineColor:n,getLineWidth:i}=this.props;return{data:this.state.polygons,getPolygon:s=>s.polygon,getElevation:this.getSubLayerAccessor(e),getFillColor:this.getSubLayerAccessor(t),getLineColor:this.getSubLayerAccessor(n),getLineWidth:this.getSubLayerAccessor(i)}}}Uy.layerName="H3ClusterLayer";Uy.defaultProps=cpe;const f1=Math.PI/180,g0=new Float32Array(16),QP=new Float32Array(12);function eR(r,e,t){const n=e[0]*f1,i=e[1]*f1,s=e[2]*f1,o=Math.sin(s),c=Math.sin(n),f=Math.sin(i),A=Math.cos(s),v=Math.cos(n),w=Math.cos(i),S=t[0],F=t[1],N=t[2];r[0]=S*w*v,r[1]=S*f*v,r[2]=S*-c,r[3]=F*(-f*A+w*c*o),r[4]=F*(w*A+f*c*o),r[5]=F*v*o,r[6]=N*(f*o+w*c*A),r[7]=N*(-w*o+f*c*A),r[8]=N*v*A}function tR(r){return r[0]=r[0],r[1]=r[1],r[2]=r[2],r[3]=r[4],r[4]=r[5],r[5]=r[6],r[6]=r[8],r[7]=r[9],r[8]=r[10],r[9]=r[12],r[10]=r[13],r[11]=r[14],r.subarray(0,12)}const c8={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(r,{startRow:e,endRow:t}){const{data:n,getOrientation:i,getScale:s,getTranslation:o,getTransformMatrix:c}=this.props,f=Array.isArray(c),A=f&&c.length===16,v=Array.isArray(s),w=Array.isArray(i),S=Array.isArray(o),F=A||!f&&!!c(n[0]);F?r.constant=A:r.constant=w&&v&&S;const N=r.value;if(r.constant){let U;F?(g0.set(c),U=tR(g0)):(U=QP,eR(U,i,s),U.set(o,9)),r.value=new Float32Array(U)}else{let U=e*r.size;const{iterable:$,objectInfo:G}=gl(n,e,t);for(const H of $){G.index++;let J;if(F)g0.set(A?c:c(H,G)),J=tR(g0);else{J=QP;const ue=w?i:i(H,G),q=v?s:s(H,G);eR(J,ue,q),J.set(S?o:o(H,G),9)}N[U++]=J[0],N[U++]=J[1],N[U++]=J[2],N[U++]=J[3],N[U++]=J[4],N[U++]=J[5],N[U++]=J[6],N[U++]=J[7],N[U++]=J[8],N[U++]=J[9],N[U++]=J[10],N[U++]=J[11]}}}};function l8(r,e){return e===Qr.CARTESIAN||e===Qr.METER_OFFSETS||e===Qr.DEFAULT&&!r.isGeospatial}const rR=`uniform simpleMeshUniforms {
4208  float sizeScale;
4209  bool composeModelMatrix;
4210  bool hasTexture;
4211  bool flatShading;
4212} simpleMesh;
4213`,lpe={name:"simpleMesh",vs:rR,fs:rR,uniformTypes:{sizeScale:"f32",composeModelMatrix:"f32",hasTexture:"f32",flatShading:"f32"}},upe=`#version 300 es
4214#define SHADER_NAME simple-mesh-layer-vs
4215in vec3 positions;
4216in vec3 normals;
4217in vec3 colors;
4218in vec2 texCoords;
4219in vec3 instancePositions;
4220in vec3 instancePositions64Low;
4221in vec4 instanceColors;
4222in vec3 instancePickingColors;
4223in vec3 instanceModelMatrixCol0;
4224in vec3 instanceModelMatrixCol1;
4225in vec3 instanceModelMatrixCol2;
4226in vec3 instanceTranslation;
4227out vec2 vTexCoord;
4228out vec3 cameraPosition;
4229out vec3 normals_commonspace;
4230out vec4 position_commonspace;
4231out vec4 vColor;
4232void main(void) {
4233geometry.worldPosition = instancePositions;
4234geometry.uv = texCoords;
4235geometry.pickingColor = instancePickingColors;
4236vTexCoord = texCoords;
4237cameraPosition = project.cameraPosition;
4238vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
4239mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
4240vec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale + instanceTranslation;
4241if (simpleMesh.composeModelMatrix) {
4242DECKGL_FILTER_SIZE(pos, geometry);
4243normals_commonspace = project_normal(instanceModelMatrix * normals);
4244geometry.worldPosition += pos;
4245gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);
4246geometry.position = position_commonspace;
4247}
4248else {
4249pos = project_size(pos);
4250DECKGL_FILTER_SIZE(pos, geometry);
4251gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);
4252geometry.position = position_commonspace;
4253normals_commonspace = project_normal(instanceModelMatrix * normals);
4254}
4255geometry.normal = normals_commonspace;
4256DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
4257DECKGL_FILTER_COLOR(vColor, geometry);
4258}
4259`,fpe=`#version 300 es
4260#define SHADER_NAME simple-mesh-layer-fs
4261precision highp float;
4262uniform sampler2D sampler;
4263in vec2 vTexCoord;
4264in vec3 cameraPosition;
4265in vec3 normals_commonspace;
4266in vec4 position_commonspace;
4267in vec4 vColor;
4268out vec4 fragColor;
4269void main(void) {
4270geometry.uv = vTexCoord;
4271vec3 normal;
4272if (simpleMesh.flatShading) {
4273normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
4274} else {
4275normal = normals_commonspace;
4276}
4277vec4 color = simpleMesh.hasTexture ? texture(sampler, vTexCoord) : vColor;
4278DECKGL_FILTER_COLOR(color, geometry);
4279vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
4280fragColor = vec4(lightColor, color.a * layer.opacity);
4281}
4282`;function hpe(r){switch(r.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 u8(r){let e=1/0,t=1/0,n=1/0,i=-1/0,s=-1/0,o=-1/0;const c=r.POSITION?r.POSITION.value:[],f=c&&c.length;for(let A=0;A<f;A+=3){const v=c[A],w=c[A+1],S=c[A+2];e=v<e?v:e,t=w<t?w:t,n=S<n?S:n,i=v>i?v:i,s=w>s?w:s,o=S>o?S:o}return[[e,t,n],[i,s,o]]}function dpe(r,e,t){const n=hpe(e.value),i=t||ppe(e);return{name:r,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:i}}function ppe(r){const e={};return"byteOffset"in r&&(e.byteOffset=r.byteOffset.toString(10)),"byteStride"in r&&(e.byteStride=r.byteStride.toString(10)),"normalized"in r&&(e.normalized=r.normalized.toString()),e}function h1(r){const e=r.positions||r.POSITION;Yr.assert(e,'no "postions" or "POSITION" attribute in mesh');const t=e.value.length/e.size;let n=r.COLOR_0||r.colors;
vendor: 4,592 bytes, line 4282
4282n||(n={size:3,value:new Float32Array(t*3).fill(1)});let i=r.NORMAL||r.normals;i||(i={size:3,value:new Float32Array(t*3).fill(0)});let s=r.TEXCOORD_0||r.texCoords;return s||(s={size:2,value:new Float32Array(t*2).fill(0)}),{positions:e,colors:n,normals:i,texCoords:s}}function nR(r){return r instanceof Ys?(r.attributes=h1(r.attributes),r):r.attributes?new Ys({...r,topology:"triangle-list",attributes:h1(r.attributes)}):new Ys({topology:"triangle-list",attributes:h1(r)})}const Ape=[0,0,0,255],gpe={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:r=>r.position},getColor:{type:"accessor",value:Ape},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}};class Ah extends Es{getShaders(){return super.getShaders({vs:upe,fs:fpe,modules:[Ls,Tw,_a,lpe]})}getBounds(){if(this.props._instanced)return super.getBounds();let e=this.state.positionBounds;if(e)return e;const{mesh:t}=this.props;if(!t)return null;if(e=t.header?.boundingBox,!e){const{attributes:n}=nR(t);n.POSITION=n.POSITION||n.positions,e=u8(n)}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:c8}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(e){super.updateState(e);const{props:t,oldProps:n,changeFlags:i}=e;if(t.mesh!==n.mesh||i.extensionsChanged){if(this.state.positionBounds=null,this.state.model?.destroy(),t.mesh){this.state.model=this.getModel(t.mesh);const s=t.mesh.attributes||t.mesh;this.setState({hasNormals:!!(s.NORMAL||s.normals)})}this.getAttributeManager().invalidateAll()}t.texture!==n.texture&&t.texture instanceof si&&this.setTexture(t.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}){const{model:t}=this.state;if(!t)return;const{viewport:n,renderPass:i}=this.context,{sizeScale:s,coordinateSystem:o,_instanced:c}=this.props,f={sizeScale:s,composeModelMatrix:!c||l8(n,o),flatShading:!this.state.hasNormals};t.shaderInputs.setProps({simpleMesh:f}),t.draw(i)}get isLoaded(){return!!(this.state?.model&&super.isLoaded)}getModel(e){const t=new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:nR(e),isInstanced:!0}),{texture:n}=this.props,{emptyTexture:i}=this.state,s={sampler:n||i,hasTexture:!!n};return t.shaderInputs.setProps({simpleMesh:s}),t}setTexture(e){const{emptyTexture:t,model:n}=this.state;if(n){const i={sampler:e||t,hasTexture:!!e};n.shaderInputs.setProps({simpleMesh:i})}}}Ah.defaultProps=gpe;Ah.layerName="SimpleMeshLayer";var _c;(function(r){r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.ONE=1]="ONE",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.LINEAR=9729]="LINEAR",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(_c||(_c={}));function f8(r,e,t,n){const i={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};i.defines.USE_TEX_LOD=1;const{imageBasedLightingEnvironment:s}=n;return s&&(i.bindings.pbr_diffuseEnvSampler=s.diffuseEnvSampler.texture,i.bindings.pbr_specularEnvSampler=s.specularEnvSampler.texture,i.bindings.pbr_BrdfLUT=s.brdfLutTexture.texture,i.uniforms.scaleIBLAmbient=[1,1]),n?.pbrDebug&&(i.defines.PBR_DEBUG=1,i.uniforms.scaleDiffBaseMR=[0,0,0,0],i.uniforms.scaleFGDSpec=[0,0,0,0]),t.NORMAL&&(i.defines.HAS_NORMALS=1),t.TANGENT&&n?.useTangents&&(i.defines.HAS_TANGENTS=1),t.TEXCOORD_0&&(i.defines.HAS_UV=1),n?.imageBasedLightingEnvironment&&(i.defines.USE_IBL=1),n?.lights&&(i.defines.USE_LIGHTS=1),e&&mpe(r,e,i),i}function mpe(r,e,t){if(t.uniforms.unlit=!!e.unlit,e.pbrMetallicRoughness&&_pe(r,e.pbrMetallicRoughness,t),e.normalTexture){gg(r,e.normalTexture,"pbr_normalSampler","HAS_
4282NORMALMAP",t);const{scale:n=1}=e.normalTexture;t.uniforms.normalScale=n}if(e.occlusionTexture){gg(r,e.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",t);const{strength:n=1}=e.occlusionTexture;t.uniforms.occlusionStrength=n}switch(e.emissiveTexture&&(gg(r,e.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",t),t.uniforms.emissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode){case"MASK":const{alphaCutoff:n=.5}=e;t.defines.ALPHA_CUTOFF=1,t.uniforms.alphaCutoff=n;break;case"BLEND":Zt.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),t.parameters.blendColorOperation="add",t.parameters.blendColorSrcFactor="src-alpha",t.parameters.blendColorDstFactor="one-minus-src-alpha",t.parameters.blendAlphaOperation="add",t.parameters.blendAlphaSrcFactor="one",t.parameters.blendAlphaDstFactor="one-minus-src-alpha",t.glParameters.blend=!0,t.glParameters.blendEquation=_c.FUNC_ADD,t.glParameters.blendFunc=[_c.SRC_ALPHA,_c.ONE_MINUS_SRC_ALPHA,_c.ONE,_c.ONE_MINUS_SRC_ALPHA];break}}function _pe(r,e,t){e.baseColorTexture&&gg(r,e.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",t),t.uniforms.baseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&gg(r,e.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",t);const{metallicFactor:n=1,roughnessFactor:i=1}=e;t.uniforms.metallicRoughnessValues=[n,i]}function gg(r,e,t,n=null,i){const s=e?.texture?.sampler?.parameters||{},o=e.texture.source.image;let c,f={};o.compressed?(c=o,f={[_c.TEXTURE_MIN_FILTER]:o.data.length>1?_c.LINEAR_MIPMAP_NEAREST:_c.LINEAR}):c={data:o};const A=r.createTexture({id:e.uniformName||e.id,parameters:{...s,...f},pixelStore:{[_c.UNPACK_FLIP_Y_WEBGL]:!1},...c});i.bindings[t]=A,n&&(i.defines[n]=1),i.generatedTextures.push(A)}var iR,sR,oR,aR,cR,lR,uR,fR;(function(r){r[r.NONE=0]="NONE",r[r.BASISLZ=1]="BASISLZ",r[r.ZSTD=2]="ZSTD",r[r.ZLIB=3]="ZLIB"})(iR||(iR={})),function(r){r[r.BASICFORMAT=0]="BASICFORMAT"}(sR||(sR={})),function(r){r[r.UNSPECIFIED=0]="UNSPECIFIED",r[r.ETC1S=163]="ETC1S",r[r.UASTC=166]="UASTC"}(oR||(oR={})),function(r){r[r.UNSPECIFIED=0]="UNSPECIFIED",r[r.SRGB=1]="SRGB"}(aR||(aR={})),function(r){r[r.UNSPECIFIED=0]="UNSPECIFIED",r[r.LINEAR=1]="LINEAR",r[r.SRGB=2]="SRGB",r[r.ITU=3]="ITU",r[r.NTSC=4]="NTSC",r[r.SLOG=5]="SLOG",r[r.SLOG2=6]="SLOG2"}(cR||(cR={})),function(r){r[r.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",r[r.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(lR||(lR={})),function(r){r[r.RGB=0]="RGB",r[r.RRR=3]="RRR",r[r.GGG=4]="GGG",r[r.AAA=15]="AAA"}(uR||(uR={})),function(r){r[r.RGB=0]="RGB",r[r.RGBA=3]="RGBA",r[r.RRR=4]="RRR",r[r.RRRG=5]="RRRG"}(fR||(fR={}));const ype={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},vpe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};class bpe{name;startTime=0;playing=!0;speed=1;channels=[];constructor(e){Object.assign(this,e)}animate(e){if(!this.playing)return;const n=(e/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:i,target:s,path:o})=>{Spe(n,i,s,o),Cpe(s,s._node)})}}class xpe{animations;constructor(e){this.animations=e.animations.map((t,n)=>{const i=t.name||`Animation-${n}`,s=t.samplers.map(({input:c,interpolation:f="LINEAR",output:A})=>({input:hR(e.accessors[c]),interpolation:f,output:hR(e.accessors[A])})),o=t.channels.map(({sampler:c,target:f})=>({sampler:s[c],target:e.nodes[f.node],path:f.path}));return new bpe({name:i,channels:o})})}animate(e){this.setTime(e)}setTime(e){this.animations.forEach(t=>t.animate(e))}getAnimations(){return this.animations}}function hR(r){if(!r._animation){const e=vpe[r.componentType],t=ype[r.type],n=t*r.count,{buffer:i,byteOffset:s}=r.bufferView.data,o=new e(i,s+(r.byteOffset||0),n);if(t===1)r._animation=Array.from(o);else{const c=[];for(let f=0;f<o.length;f+=t)c.push(Array.from(o.slice(f,f+t)));r._animation=c}}return r._animation}const wpe=new vn;function Cpe(r,e){if(e.matrix.identity(),r.translation&&e.matrix.translate(r.translation),r.rotation){const t=wpe.fromQuaternion(r.rotation);e.matrix.multiplyRight(t)}r.scale&&e.matrix.scale(r.scale)}const d1=new vg;function Tpe(r,e,t,n,i){if(e==="rotation"){d1.slerp({start:t,target:n,ratio:i});for(let s=0;s<d1.length;s++)r[e][s]=d1[s]}else for(let s=0;s<t.length;s++)r[e][s]=i*n[s]+(1-i)*t[s]}function Epe(r,e,{p0:t,outTangent0:n,inTangent1:i,p1:s,tDiff:o,ratio:c}){for(let f=0;f<r[e].length;f++){const A=n[f]*o,v=i[f]*o;r[e][f]=(2*Math.pow(c,3)-3*Math.pow(c,2)+1)*t[f]+(Math.pow(c,3)-2*Math.pow(c,2)+c)*A+(-2*Math.pow(c,3)+3*Math.pow(c,2))*s[f]+(Math.pow(c,3)-Math.pow(c,2))*v}}function Bpe(r,e,t){for(let n=0;n<t.length;n++)r[e][n]=t[n]}function Spe(r,{input:e,interpolation:t,output:n},i,s){const o=e[e.length-1],c=r%o,f=e.findIndex(S=>S>=c),A=Math.max(0,f-1);if(!Array.isArray(i[s]))switch(s){case"translation":i[s]=[0,0,0];break;case"rotation":i[s]=[0,0,0,1];break;case"scale":i[s]=[1,1,1];break;default:Zt.warn(`Bad animation path ${s}`)()}const v=e[A],w=e[f];switch(t){case"STEP":Bpe(i,s,n[A]);break;case"LINEAR":if(w>v){const S=(c-v)/(w-v);Tpe(i,s,n[A],n[f],S)}break;case"CUBICSPLINE":if(w>
4282v){const S=(c-v)/(w-v),F=w-v,N=n[3*A+1],U=n[3*A+2],$=n[3*f+0],G=n[3*f+1];Epe(i,s,{p0:N,outTangent0:U,inTangent1:$,p1:G,tDiff:F,ratio:S})}break;default:Zt.warn(`Interpolation ${t} not supported`)();break}}const Ipe=`
4283layout(0) positions: vec4; // in vec4 POSITION;
4284
4285  #ifdef HAS_NORMALS
4286    in vec4 normals; // in vec4 NORMAL;
4287  #endif
4288
4289  #ifdef HAS_TANGENTS
4290    in vec4 TANGENT;
4291  #endif
4292
4293  #ifdef HAS_UV
4294    // in vec2 TEXCOORD_0;
4295    in vec2 texCoords;
4296  #endif
4297
4298@vertex
4299  void main(void) {
4300    vec4 _NORMAL = vec4(0.);
4301    vec4 _TANGENT = vec4(0.);
4302    vec2 _TEXCOORD_0 = vec2(0.);
4303
4304    #ifdef HAS_NORMALS
4305      _NORMAL = normals;
4306    #endif
4307
4308    #ifdef HAS_TANGENTS
4309      _TANGENT = TANGENT;
4310    #endif
4311
4312    #ifdef HAS_UV
4313      _TEXCOORD_0 = texCoords;
4314    #endif
4315
4316    pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
4317    gl_Position = u_MVPMatrix * positions;
4318  }
4319
4320@fragment
4321  out vec4 fragmentColor;
4322
4323  void main(void) {
4324    vec3 pos = pbr_vPosition;
4325    fragmentColor = pbr_filterColor(vec4(1.0));
4326  }
4327`,Mpe=`#version 300 es
4328
4329  // in vec4 POSITION;
4330  in vec4 positions;
4331
4332  #ifdef HAS_NORMALS
4333    // in vec4 NORMAL;
4334    in vec4 normals;
4335  #endif
4336
4337  #ifdef HAS_TANGENTS
4338    in vec4 TANGENT;
4339  #endif
4340
4341  #ifdef HAS_UV
4342    // in vec2 TEXCOORD_0;
4343    in vec2 texCoords;
4344  #endif
4345
4346  void main(void) {
4347    vec4 _NORMAL = vec4(0.);
4348    vec4 _TANGENT = vec4(0.);
4349    vec2 _TEXCOORD_0 = vec2(0.);
4350
4351    #ifdef HAS_NORMALS
4352      _NORMAL = normals;
4353    #endif
4354
4355    #ifdef HAS_TANGENTS
4356      _TANGENT = TANGENT;
4357    #endif
4358
4359    #ifdef HAS_UV
4360      _TEXCOORD_0 = texCoords;
4361    #endif
4362
4363    pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
4364    gl_Position = pbrProjection.modelViewProjectionMatrix * positions;
4365  }
4366`,Ppe=`#version 300 es
4367  out vec4 fragmentColor;
4368
4369  void main(void) {
4370    vec3 pos = pbr_vPosition;
4371    fragmentColor = pbr_filterColor(vec4(1.0));
4372  }
4373`;function Rpe(r,e){const{id:t,geometry:n,material:i,vertexCount:s,materialOptions:o,modelOptions:c}=e,f=f8(r,i,n.attributes,o);Zt.info(4,"createGLTFModel defines: ",f.defines)();const A=[],v={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},w={id:t,source:Ipe,vs:Mpe,fs:Ppe,geometry:n,topology:n.topology,vertexCount:s,modules:[Ew],...c,defines:{...f.defines,...c.defines},parameters:{...v,...f.parameters,...c.parameters}},S=new Di(r,w),{camera:F,...N}={...f.uniforms,...c.uniforms,...f.bindings,...c.bindings};return S.shaderInputs.setProps({pbrMaterial:N,pbrProjection:{camera:F}}),new I2({managedResources:A,model:S})}var Kf;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(Kf||(Kf={}));function Fpe(r){switch(r){case Kf.POINTS:return"point-list";case Kf.LINES:return"line-list";case Kf.LINE_STRIP:return"line-strip";case Kf.TRIANGLES:return"triangle-list";case Kf.TRIANGLE_STRIP:return"triangle-strip";default:throw new Error(String(r))}}const Dpe={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1};class Ope{device;options;gltf;constructor(e,t={}){this.device=e,this.options={...Dpe,...t}}instantiate(e){return this.gltf=_x(e),(this.gltf.scenes||[]).map(n=>this.createScene(n))}createAnimator(){return Array.isArray(this.gltf.animations)?new xpe(this.gltf):null}createScene(e){const n=(e.nodes||[]).map(s=>this.createNode(s));return new yp({id:e.name||e.id,children:n})}createNode(e){if(!e._node){const i=(e.children||[]).map(o=>this.createNode(o));e.mesh&&i.push(this.createMesh(e.mesh));const s=new yp({id:e.name||e.id,children:i});if(e.matrix)s.setMatrix(e.matrix);else{if(s.matrix.identity(),e.translation&&s.matrix.translate(e.translation),e.rotation){const o=new vn().fromQuaternion(e.rotation);s.matrix.multiplyRight(o)}e.scale&&s.matrix.scale(e.scale)}e._node=s}const t=this.gltf.nodes.find(n=>n.id===e.id);return t._node=e._node,e._node}createMesh(e){if(!e._mesh){const n=(e.primitives||[]).map((s,o)=>
vendor: 17,939 bytes, line 4373
4373this.createPrimitive(s,o,e)),i=new yp({id:e.name||e.id,children:n});e._mesh=i}return e._mesh}createPrimitive(e,t,n){const i=e.name||`${n.name||n.id}-primitive-${t}`,s=Fpe(e.mode||4),o=e.indices?e.indices.count:this.getVertexCount(e.attributes),c=Rpe(this.device,{id:i,geometry:this.createGeometry(i,e,s),material:e.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:o});return c.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],c}getVertexCount(e){throw new Error("getVertexCount not implemented")}createGeometry(e,t,n){const i={};for(const[s,o]of Object.entries(t.attributes)){const{components:c,size:f,value:A}=o;i[s]={size:f??c,value:A}}return new Ys({id:e,topology:n,indices:t.indices.value,attributes:i})}createBuffer(e,t){e.bufferView||(e.bufferView={});const{bufferView:n}=e;return n.lumaBuffers||(n.lumaBuffers={}),n.lumaBuffers[t]||(n.lumaBuffers[t]=this.device.createBuffer({id:`from-${n.id}`,data:n.data||e.value})),n.lumaBuffers[t]}createSampler(e){return e}needsPOT(){return!1}}function _x(r){if(ArrayBuffer.isView(r)||r instanceof ArrayBuffer||r instanceof ImageBitmap)return r;if(Array.isArray(r))return r.map(_x);if(r&&typeof r=="object"){const e={};for(const t in r)e[t]=_x(r[t]);return e}return r}function Lpe(r,e,t){const n=new Ope(r,t),i=n.instantiate(e),s=n.createAnimator();return{scenes:i,animator:s}}function Aa(r,e){if(!r)throw new Error(e||"assert failed: gltf")}const h8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},d8={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},dR=["SCALAR","VEC2","VEC3","VEC4"],kpe=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Npe=new Map(kpe),Upe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},zpe={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Gpe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function p8(r){return dR[r-1]||dR[0]}function UC(r){const e=Npe.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function zC(r,e){const t=Gpe[r.componentType],n=Upe[r.type],i=zpe[r.componentType],s=r.count*n,o=r.count*n*i;Aa(o>=0&&o<=e.byteLength);const c=d8[r.componentType],f=h8[r.type];return{ArrayType:t,length:s,byteLength:o,componentByteSize:c,numberOfComponentsInElement:f}}function Vpe(r,e,t){const n=r.bufferViews[t];Aa(n);const i=n.buffer,s=e[i];Aa(s);const o=(n.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,o,n.byteLength)}function Hpe(r,e,t){const n=typeof t=="number"?r.accessors?.[t]:t;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(t)}`);const i=r.bufferViews?.[n.bufferView||0];if(!i)throw new Error(`No gltf buffer view for accessor ${i}`);const{arrayBuffer:s,byteOffset:o}=e[i.buffer],c=(o||0)+(n.byteOffset||0)+(i.byteOffset||0),{ArrayType:f,length:A,componentByteSize:v,numberOfComponentsInElement:w}=zC(n,i),S=v*w,F=i.byteStride||S;if(typeof i.byteStride>"u"||i.byteStride===S)return new f(s,c,A);const N=new f(A);for(let U=0;U<n.count;U++){const $=new f(s,c+U*F,w);N.set($,U*w)}return N}function jpe(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}let yo=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||jpe(),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){const t=this.getUsedExtensions().find(i=>i===e),n=this.getRequiredExtensions().find(i=>i===e);return typeof t=="string"||typeof n=="string"}getExtension(e){const t=this.getUsedExtensions().find(i=>i===e),n=this.json.extensions||{};return t?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}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,t){if(typeof t=="object")return t;const n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){e=this.getBufferView(e);const t=e.buffer,n=this.gltf.buffers[t];Aa(n);const i=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,e.byteLength)}getTypedArrayForAccessor(e){const t=this.getAccessor(e);return Hpe(this.gltf.json,this.gltf.buffers,t)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(i,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){const i=e.extensions||{};i[t]=n}removeObjectExtension(e,t){const n=e?.extensions||{};if(n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const i=this.json.extensionsRemoved;i.includes(t)||i.push(t)}delete n[t]}addExtension(e,t={}){return Aa(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return Aa(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const t=this.json.extensionsRemoved;t.includes(e)||t.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){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];const i={mesh:t};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:n,material:i,mode:s=4}=e,c={primitives:[{attributes:this._addAttributes(t),mode:s}]};if(n){const f=this._addIndices(n);c.primitives[0].indices=f}return Number.isFinite(i)&&(c.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(c),this.json.meshes.length-1}addPointCloud(e){const n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,t){const n=Py(e),i=t||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:i};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e,t=0,n=this.byteLength){const i=e.byteLength;Aa(Number.isFinite(i)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const s={buffer:t,byteOffset:n,byteLength:i};return this.byteLength+=su(i,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(s),this.json.bufferViews.length-1}addAccessor(e,t){const n={bufferView:e,type:p8(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const n=this.addBufferView(e);let i={min:t.min,max:t.max};(!i.min||!i.max)&&(i=this._getAccessorMinMax(e,t.size));const s={size:t.size,componentType:UC(e),count:Math.round(e.length/t.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(s,t))}addTexture(e){const{imageIndex:t}=e,n={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(n),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=[];const e=this.byteLength,t=new ArrayBuffer(e),n=new Uint8Array(t);let i=0;for(const s of this.sourceBuffers||[])i=D6(s,n,i);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=e:this.json.buffers=[{byteLength:e}],this.gltf.binary=t,this.sourceBuffers=[t]}_removeStringFromArray(e,t){let n=!0;for(;n;){const i=e.indexOf(t);i>-1?e.splice(i,1):n=!1}}_addAttributes(e={}){const t={};for(const n in e){const i=e[n],s=this._getGltfAttributeName(n),o=this.addBinaryBuffer(i.value,i);t[s]=o}return t}_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,t){const n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];const i=e.subarray(0,t);for(const s of i)n.min.push(s),n.max.push(s);for(let s=t;s<e.length;s+=t)for(let o=0;o<t;o++)n.min[0+o]=Math.min(n.min[0+o],e[s+o]),n.max[0+o]=Math.max(n.max[0+o],e[s+o]);return n}};function pR(r){return(r%1+1)%1}const A8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},$pe={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},g8={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function GC(r,e){return g8[e]*A8[r]}function zy(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;const i=r.getTypedArrayForBufferView(e),s=Gy(i,"SCALAR",t,n+1);return s instanceof BigInt64Array||s instanceof BigUint64Array?null:s}function Gy(r,e,t,n=1){const i=A8[e],s=$pe[t],o=g8[t],c=n*i,f=c*o;let A=r.buffer,v=r.byteOffset;return v%o!==0&&(A=new Uint8Array(A).slice(v,v+f).buffer,v=0),new s(A,v,c)}function VC(r,e,t){const n=`TEXCOORD_${e.texCoord||0}`,i=t.attributes[n],s=r.getTypedArrayForAccessor(i),o=r.gltf.json,c=e.index,f=o.textures?.[c]?.source;if(typeof f<"u"){const A=o.images?.[f]?.mimeType,v=r.gltf.images?.[f];if(v&&typeof v.width<"u"){const w=[];for(let S=0;S<s.length;S+=2){const F=Wpe(v,A,s,S,e.channels);w.push(F)}return w}}return[]}function m8(r,e,t,n,i){if(!t?.length)return;const s=[];for(const v of t){let w=n.findIndex(S=>S===v);w===-1&&(w=n.push(v)-1),s.push(w)}const o=new Uint32Array(s),c=r.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,f=r.addBufferView(o,c,0),A=r.addAccessor(f,{size:1,componentType:UC(o),count:o.length});i.attributes[e]=A}function Wpe(r,e,t,n,i=[0]){const s={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=t[n],c=t[n+1];let f=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(f=4);const A=Jpe(o,c,r,f);let v=0;for(const w of i){const S=typeof w=="number"?Object.values(s)[w]:s[w],F=A+S.offset,N=xC(r);if(N.data.length<=F)throw new Error(`${N.data.length} <= ${F}`);const U=N.data[F];v|=U<<S.shift}return v}function Jpe(r,e,t,n=1){const i=t.width,s=pR(r)*(i-1),o=Math.round(s),c=t.height,f=pR(e)*(c-1),A=Math.round(f),v=t.components?t.components:n;return(A*i+o)*v}function _8(r,e,t,n,i){const s=[];for(let o=0;o<e;o++){const c=t[o],f=t[o+1]-t[o];if(f+c>n)break;const A=c/i,v=f/i;s.push(r.slice(A,A+v))}return s}function y8(r,e,t){const n=[];for(let i=0;i<e;i++){const s=i*t;n.push(r.slice(s,s+t))}return n}function v8(r,e,t,n){if(t)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){const i=[],s=new TextDecoder("utf8");let o=0;for(let c=0;c<r;c++){const f=n[c+1]-n[c];if(f+o<=e.length){const A=e.subarray(o,f+o),v=s.decode(A);i.push(v),o+=f}}return i}return[]}const b8="EXT_mesh_features",Xpe=b8;async function Kpe(r,e){const t=new yo(r);qpe(t,e)}function qpe(r,e){const t=r.gltf.json;if(t.meshes)for(const n of t.meshes)for(const i of n.primitives)Ype(r,i,e)}function Ype(r,e,t){if(!t?.gltf?.loadBuffers)return;const i=e.extensions?.[b8]?.featureIds;if(i)for(const s of i){let o;if(typeof s.attribute<"u"){const c=`_FEATURE_ID_${s.attribute}`,f=e.attributes[c];o=r.getTypedArrayForAccessor(f)}else typeof s.texture<"u"&&t?.gltf?.loadImages?o=VC(r,s.texture,e):o=[];s.data=o}}const Zpe=Object.freeze(Object.defineProperty({__proto__:null,decode:Kpe,name:Xpe},Symbol.toStringTag,{value:"Module"})),HC="EXT_structural_metadata",Qpe=HC;async function eAe(r,e){const t=new yo(r);tAe(t,e)}function tAe(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(HC);t&&(e.gltf?.loadImages&&rAe(r,t),nAe(r,t))}function rAe(r,e){const t=e.propertyTextures,n=r.gltf.json;if(t&&n.meshes)for(const i of n.meshes)for(const s of i.primitives)sAe(r,t,s,e)}function nAe(r,e){const t=e.schema;if(!t)return;const n=t.classes,i=e.propertyTables;if(n&&i)for(const s in n){const o=iAe(i,s);o&&aAe(r,t,o)}}function iAe(r,e){for(const t of r)if(t.class===e)return t;return null}function sAe(r,e,t,n){if(!e)return;const s=t.extensions?.[HC]?.propertyTextures;if(s)for(const o of s){const c=e[o];oAe(r,c,t,n)}}function oAe(r,e,t,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);const i=e.class;for(const s in e.properties){const o=`${i}_${s}`,c=e.properties?.[s];if(!c)continue;c.data||(c.data=[]);const f=c.data,A=VC(r,c,t);A!==null&&(m8(r,o,A,f,t),c.data=f,n.dataAttributeNames.push(o))}}function aAe(r,e,t){const n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],c=t.properties?.[s];if(c){const f=cAe(r,e,o,i,c);c.data=f}}}function cAe(r,e,t,n,i){let s=[];const o=i.values,c=r.getTypedArrayForBufferView(o),f=lAe(r,t,i,n),A=uAe(r,i,n);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{s=fAe(t,n,c,f);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${t.type}`);case"STRING":{s=v8(n,c,f,A);break}case"ENUM":{s=hAe(e,t,n,c,f);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return s}function lAe(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?zy(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function uAe(r,e,t){return typeof e.stringOffsets<"u"?zy(r,e.stringOffsets,e.stringOffsetType||"UINT32",t):null}function fAe(r,e,t,n){const i=r.array,s=r.count,o=GC(r.type,r.componentType),c=t.byteLength/o;let f;return r.componentType?f=Gy(t,r.type,r.componentType,c):f=t,i?n?_8(f,e,n,t.length,o):s?y8(f,e,s):[]:f}function hAe(r,e,t,n,i){const s=e.enumType;if(!s)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");const o=r.enums?.[s];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${s}`);const c=o.valueType||"UINT16",f=GC(e.type,c),A=n.byteLength/f;let v=Gy(n,e.type,c,A);if(v||(v=n),e.array){if(i)return dAe({valuesData:v,numberOfElements:t,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:f,enumEntry:o});const w=e.count;return w?pAe(v,t,w,o):[]}return jC(v,0,t,o)}function dAe(r){const{valuesData:e,numberOfElements:t,arrayOffsets:n,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=r,c=[];for(let f=0;f<t;f++){const A=n[f],v=n[f+1]-n[f];if(v+A>i)break;const w=A/s,S=v/s,F=jC(e,w,S,o);c.push(F)}return c}function pAe(r,e,t,n){const i=[];for(let s=0;s<e;s++){const o=t*s,c=jC(r,o,t,n);i.push(c)}return i}function jC(r,e,t,n){const i=[];for(let s=0;s<t;s++)if(r instanceof BigInt64Array||r instanceof BigUint64Array)i.push("");else{const o=r[e+s],c=AAe(n,o);c?i.push(c.name):i.push("")}return i}function AAe(r,e){for(const t of r.values)if(t.value===e)return t;return null}const gAe=Object.freeze(Object.defineProperty({__proto__:null,decode:eAe,name:Qpe},Symbol.toStringTag,{value:"Module"})),x8="EXT_feature_metadata",mAe=x8;async function _Ae(r,e){const t=new yo(r);yAe(t,e)}function yAe(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(x8);t&&(e.gltf?.loadImages&&vAe(r,t),bAe(r,t))}function vAe(r,e){const t=e.schema;if(!t)return;const n=t.classes,{featureTextures:i}=e;if(n&&i)for(const s in n){const o=n[s],c=wAe(i,s);c&&TAe(r,c,o)}}function bAe(r,e){const t=e.schema;if(!t)return;const n=t.classes,i=e.featureTables;if(n&&i)for(const s in n){const o=xAe(i,s);o&&CAe(r,t,o)}}function xAe(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function wAe(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function CAe(r,e,t){if(!t.class)return;const n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with 
4373name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],c=t.properties?.[s];if(c){const f=EAe(r,e,o,i,c);c.data=f}}}function TAe(r,e,t){const n=e.class;for(const i in t.properties){const s=e?.properties?.[i];if(s){const o=PAe(r,s,n);s.data=o}}}function EAe(r,e,t,n,i){let s=[];const o=i.bufferView,c=r.getTypedArrayForBufferView(o),f=BAe(r,t,i,n),A=SAe(r,t,i,n);return t.type==="STRING"||t.componentType==="STRING"?s=v8(n,c,f,A):IAe(t)&&(s=MAe(t,n,c,f)),s}function BAe(r,e,t,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof t.arrayOffsetBufferView<"u"?zy(r,t.arrayOffsetBufferView,t.offsetType||"UINT32",n):null}function SAe(r,e,t,n){return typeof t.stringOffsetBufferView<"u"?zy(r,t.stringOffsetBufferView,t.offsetType||"UINT32",n):null}function IAe(r){const e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(r.type)||typeof r.componentType<"u"&&e.includes(r.componentType)}function MAe(r,e,t,n){const i=r.type==="ARRAY",s=r.componentCount,o="SCALAR",c=r.componentType||r.type,f=GC(o,c),A=t.byteLength/f,v=Gy(t,o,c,A);return i?n?_8(v,e,n,t.length,f):s?y8(v,e,s):[]:v}function PAe(r,e,t){const n=r.gltf.json;if(!n.meshes)return[];const i=[];for(const s of n.meshes)for(const o of s.primitives)RAe(r,t,e,i,o);return i}function RAe(r,e,t,n,i){const s={channels:t.channels,...t.texture},o=VC(r,s,i);o&&m8(r,e,o,n,i)}const FAe=Object.freeze(Object.defineProperty({__proto__:null,decode:_Ae,name:mAe},Symbol.toStringTag,{value:"Module"})),DAe="4.2.4",OAe="4.2.4",W_={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"};let AR;async function gR(r){Sue(r.modules);const e=Iue("basis");return e||(AR||=LAe(r),await AR)}async function LAe(r){let e=null,t=null;return[e,t]=await Promise.all([await ch(W_.TRANSCODER,"textures",r),await ch(W_.TRANSCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await kAe(e,t)}function kAe(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r(t).then(i=>{const{BasisFile:s,initializeBasis:o}=i;o(),n({BasisFile:s})})})}let p1;async function mR(r){const e=r.modules||{};return e.basisEncoder?e.basisEncoder:(p1=p1||NAe(r),await p1)}async function NAe(r){let e=null,t=null;return[e,t]=await Promise.all([await ch(W_.ENCODER,"textures",r),await ch(W_.ENCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await UAe(e,t)}function UAe(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r(t).then(i=>{const{BasisFile:s,KTX2File:o,initializeBasis:c,BasisEncoder:f}=i;c(),n({BasisFile:s,KTX2File:o,BasisEncoder:f})})})}const Od={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_ASTC_4X4_KHR:37808},zAe=["","WEBKIT_","MOZ_"],_R={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"};let m0=null;function GAe(r){if(!m0){r=r||VAe()||void 0,m0=new Set;for(const e of zAe)for(const t in _R)if(r&&r.getExtension(`${e}${t}`)){const n=_R[t];m0.add(n)}}return m0}function VAe(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}const ua=[171,75,84,88,32,50,48,187,13,10,26,10];function HAe(r){const e=new Uint8Array(r);return!(e.byteLength<ua.length||e[0]!==ua[0]||e[1]!==ua[1]||e[2]!==ua[2]||e[3]!==ua[3]||e[4]!==ua[4]||e[5]!==ua[5]||e[6]!==ua[6]||e[7]!==ua[7]||e[8]!==ua[8]||e[9]!==ua[9]||e[10]!==ua[10]||e[11]!==ua[11])}const jAe={etc1:{basisFormat:0,compressed:!0,format:Od.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Od.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Od.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:Od.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Od.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Od.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 $Ae(r,e){if(e.basis.containerFormat==="auto"){if(HAe(r)){const n=await mR(e);return yR(n.KTX2File,r,e)}const{BasisFile:t}=await gR(e);return A1(t,r,e)}switch(e.basis.module){case"encoder":const t=await mR(e);switch(e.basis.containerFormat){case"ktx2":return yR(t.KTX2File,r,e);case"basis":default:return A1(t.BasisFile,r,e)}case"transcoder":default:const{BasisFile:n}=await gR(e);return A1(n,r,e)}}function A1(r,e,t){const n=new r(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");const i=n.getNumImages(),s=[];for(let o=0;o<i;o++){const c=n.getNumLevels(o),f=[];for(let A=0;A<c;A++)f.push(WAe(n,o,A,t));s.push(f)}return s}finally{n.close(),n.delete()}}function WAe(r,e,t,n){const i=r.getImageWidth(e,t),s=r.getImageHeight(e,t),o=r.getHasAlpha(),{compressed:c,format:f,basisFormat:A}=w8(n,o),v=r.getImageTranscodedSizeInBytes(e,t,A),w=new Uint8Array(v);if(!r.transcodeImage(w,e,t,A,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:s,data:w,compressed:c,format:f,hasAlpha:o}}function yR(r,e,t){const n=new r(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");const i=n.getLevels(),s=[];for(let o=0;o<i;o++){s.push(JAe(n,o,t));break}return[s]}finally{n.close(),n.delete()}}function JAe(r,e,t){const{alphaFlag:n,height:i,width:s}=r.getImageLevelInfo(e,0,0),{compressed:o,format:c,basisFormat:f}=w8(t,n),A=r.getImageTranscodedSizeInBytes(e,0,0,f),v=new Uint8Array(A);if(!r.transcodeImage(v,e,0,0,f,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:s,height:i,data:v,compressed:o,levelSize:A,hasAlpha:n,format:c}}function w8(r,e){let t=r&&r.basis&&r.basis.format;return t==="auto"&&(t=$C()),typeof t=="object"&&(t=e?t.alpha:t.noAlpha),t=t.toLowerCase(),jAe[t]}function $C(){const r=GAe();return r.has("astc")?"astc-4x4":r.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}
vendor: 5,468 bytes, line 4373
4373:r.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:r.has("etc1")?"etc1":r.has("etc2")?"etc2":"rgb565"}const XAe={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:OAe,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"}}},C8={...XAe,parse:$Ae},zp=!0,vR=1735152710,WC=12,J_=8,KAe=1313821514,qAe=5130562,YAe=0,ZAe=0,QAe=1;function ege(r,e=0){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))}`}function tge(r,e=0,t={}){const n=new DataView(r),{magic:i=vR}=t,s=n.getUint32(e,!1);return s===i||s===vR}function rge(r,e,t=0,n={}){const i=new DataView(e),s=ege(i,t+0),o=i.getUint32(t+4,zp),c=i.getUint32(t+8,zp);switch(Object.assign(r,{header:{byteOffset:t,byteLength:c,hasBinChunk:!1},type:s,version:o,json:{},binChunks:[]}),t+=WC,r.version){case 1:return nge(r,i,t);case 2:return ige(r,i,t,n={});default:throw new Error(`Invalid GLB version ${r.version}. Only supports version 1 and 2.`)}}function nge(r,e,t){Ai(r.header.byteLength>WC+J_);const n=e.getUint32(t+0,zp),i=e.getUint32(t+4,zp);return t+=J_,Ai(i===YAe),yx(r,e,t,n),t+=n,t+=vx(r,e,t,r.header.byteLength),t}function ige(r,e,t,n){return Ai(r.header.byteLength>WC+J_),sge(r,e,t,n),t+r.header.byteLength}function sge(r,e,t,n){for(;t+8<=r.header.byteLength;){const i=e.getUint32(t+0,zp),s=e.getUint32(t+4,zp);switch(t+=J_,s){case KAe:yx(r,e,t,i);break;case qAe:vx(r,e,t,i);break;case ZAe:n.strict||yx(r,e,t,i);break;case QAe:n.strict||vx(r,e,t,i);break}t+=su(i,4)}return t}function yx(r,e,t,n){const i=new Uint8Array(e.buffer,t,n),o=new TextDecoder("utf8").decode(i);return r.json=JSON.parse(o),su(n,4)}function vx(r,e,t,n){return r.header.hasBinChunk=!0,r.binChunks.push({byteOffset:t,byteLength:n,arrayBuffer:e.buffer}),su(n,4)}function T8(r,e){if(r.startsWith("data:")||r.startsWith("http:")||r.startsWith("https:"))return r;const n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${r}`);return n.substr(0,n.lastIndexOf("/")+1)+r}const oge="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9
4373LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+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",ag
vendor: 10,663 bytes, line 4373
4373e="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",
vendor: 30,240 bytes, line 4373
4373cge=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]),lge=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]),uge={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},fge={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function hge(r,e,t,n,i,s="NONE"){const o=await dge();gge(o,o.exports[fge[i]],r,e,t,n,o.exports[uge[s||"NONE"]])}let g1;async function dge(){return g1||(g1=pge()),g1}async function pge(){let r=oge;WebAssembly.validate(cge)&&(r=age,console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(Age(r),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function Age(r){const e=new Uint8Array(r.length);for(let n=0;n<r.length;++n){const i=r.charCodeAt(n);e[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let t=0;for(let n=0;n<r.length;++n)e[t++]=e[n]<60?lge[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,t)}function gge(r,e,t,n,i,s,o){const c=r.exports.sbrk,f=n+3&-4,A=c(f*i),v=c(s.length),w=new Uint8Array(r.exports.memory.buffer);w.set(s,v);const S=e(A,n,i,v,s.length);if(S===0&&o&&o(A,f,i),t.set(w.subarray(A,A+n*i)),c(A-c(0)),S!==0)throw new Error(`Malformed buffer data: ${S}`)}const X_="EXT_meshopt_compression",mge=X_;async function _ge(r,e){const t=new yo(r);if(!e?.gltf?.decompressMeshes||!e.gltf?.loadBuffers)return;const n=[];for(const i of r.json.bufferViews||[])n.push(yge(t,i));await Promise.all(n),t.removeExtension(X_)}async function yge(r,e){const t=r.getObjectExtension(e,X_);if(t){const{byteOffset:n=0,byteLength:i=0,byteStride:s,count:o,mode:c,filter:f="NONE",buffer:A}=t,v=r.gltf.buffers[A],w=new Uint8Array(v.arrayBuffer,v.byteOffset+n,i),S=new Uint8Array(r.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await hge(S,o,s,w,c,f),r.removeObjectExtension(e,X_)}}const vge=Object.freeze(Object.defineProperty({__proto__:null,decode:_ge,name:mge},Symbol.toStringTag,{value:"Module"})),ep="EXT_texture_webp",bge=ep;function xge(r,e){const t=new yo(r);if(!G6("image/webp")){if(t.getRequiredExtensions().includes(ep))throw new Error(`gltf: Required extension ${ep} not supported by browser`);return}const{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,ep);s&&(i.source=s.source),t.removeObjectExtension(i,ep)}t.removeExtension(ep)}const wge=Object.freeze(Object.defineProperty({__proto__:null,name:bge,preprocess:xge},Symbol.toStringTag,{value:"Module"})),t_="KHR_texture_basisu",Cge=t_;function Tge(r,e){const t=new yo(r),{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,t_);s&&(i.source=s.source,t.removeObjectExtension(i,t_))}t.removeExtension(t_)}const Ege=Object.freeze(Object.defineProperty({__proto__:null,name:Cge,preprocess:Tge},Symbol.toStringTag,{value:"Module"})),Bge="4.2.4",Sge={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:Bge,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 Ige(r,e,t){const n=E8(e.metadata),i=[],s=Mge(e.attributes);for(const o in r){const c=r[o],f=bR(o,c,s[o]);i.push(f)}if(t){const o=bR("indices",t);i.push(o)}return{fields:i,metadata:n}}function Mge(r){const e={};for(const t in r){const n=r[t];e[n.name||"undefined"]=n}return e}function bR(r,e,t){const n=t?E8(t.metadata):void 0;return dpe(r,e,n)}function E8(r){Object.entries(r);const e={};for(const t in r)e[`${t}.string`]=JSON.stringify(r[t]);return e}const xR={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Pge={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Rge=4;class Fge{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,t={}){const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const i=this.decoder.GetEncodedGeometryType(n),s=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(i){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,s);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!s.ptr){const S=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(S)}const c=this._getDracoLoaderData(s,i,t),f=this._getMeshData(s,c,t),A=u8(f.attributes),v=Ige(f.attributes,c,f.indices);return{loader:"draco",loaderData:c,header:{vertexCount:s.num_points(),boundingBox:A},...f,schema:v}}finally{this.draco.destroy(n),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,t,n){const i=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:i,attributes:s}}_getDracoAttributes(e,t){const n={};for(let i=0;i<e.num_attributes();i++){const s=this.decoder.GetAttribute(e,i),o=this._getAttributeMetadata(e,i);n[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:i,metadata:o};const c=this._getQuantizationTransform(s,t);c&&(n[s.unique_id()].quantization_transform=c);const f=this._getOctahedronTransform(s,t);f&&(n[s.unique_id()].octahedron_transform=f)}return n}_getMeshData(e,t,n){const i=this._getMeshAttributes(t,e,n);if(!i.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:i,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:i,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:i}}_getMeshAttributes(e,t,n){const i={};for(const s of Object.values(e.attributes)){const o=this._deduceAttributeName(s,n);s.name=o;const c=this._getAttributeValues(t,s);if(c){const{value:f,size:A}=c;i[o]={value:f,size:A,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}}return i}_getTriangleListIndices(e){const n=e.num_faces()*3,i=n*Rge,s=this.draco._malloc(i);try{return this.decoder.GetTrianglesUInt32Array(e,i,s),new Uint32Array(this.draco.HEAPF32.buffer,s,n).slice()}finally{this.draco._free(s)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),Lge(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const n=Pge[t.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${t.data_type}`),null;const i=t.num_components,o=e.num_points()*i,c=o*n.BYTES_PER_ELEMENT,f=Dge(this.draco,n);let A;const v=this.draco._malloc(c);try{const w=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,w,f,c,v),A=new n(this.draco.HEAPF32.buffer,v,o).slice()}finally{this.draco._free(v)}return{value:A,size:i}}_deduceAttributeName(e,t){const n=e.unique_id;for(const[o,c]of Object.entries(t.extraAttributes||{}))if(c===n)return o;const i=e.attribute_type;for(const o in xR)if(this.draco[o]===i)return xR[o];const s=t.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},n=this.metadataQuerier.NumEntries(e);for(let i=0;i<n;i++){const s=this.metadataQuerier.GetEntryName(e,i);t[s]=this._getDracoMetadataField(e,s)}return t}_getDracoMetadataField(e,t){const n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);const i=Oge(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:i}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:n=[]}=e,i=[...t,...n];for(const s of i)this.decoder.SkipAttributeTransform(this.draco[s])}_getQuantizationTransform(e,t){const{quantizedAttributes:n=[]}=t,i=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){const o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(c=>o.min_value(c))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:n=[]}=t,i=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){const o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}}function Dge(r,e){switch(e){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32;default:return r.DT_INVALID}}function Oge(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function Lge(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}const kge="1.5.6",Nge="1.4.1",m1=`https://www.gstatic.com/draco/versioned/decoders/${kge}`,Ho={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},_1={[Ho.DECODER]:`${m1}/${Ho.DECODER}`,[Ho.DECODER_WASM]:`${m1}/${Ho.DECODER_WASM}`,[Ho.FALLBACK_DECODER]:`${m1}/${Ho.FALLBACK_DECODER}`,[Ho.ENCODER]:`https://raw.githubusercontent.com/google/draco/${Nge}/javascript/${Ho.ENCODER}`};let y1;async function Uge(r){const e=r.modules||{};return e.draco3d?y1||=e.draco3d.createDecoderModule({}).then(t=>({draco:t})):y1||=zge(r),await y1}async function zge(r){let e,t;switch(r.draco&&r.draco.decoderType){case"js":e=await ch(_1[Ho.FALLBACK_DECODER],"draco",r,Ho.FALLBACK_DECODER);break;case"wasm":default:[e,t]=await Promise.all([await ch(_1[Ho.DECODER],"draco",r,Ho.DECODER),await ch(_1[Ho.DECODER_WASM],"draco",r,Ho.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await Gge(e,t)}function Gge(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r({...t,onModuleLoaded:i=>n({draco:i})})})}const JC={...Sge,parse:Vge};async function Vge(r,e){const{draco:t}=await Uge(e),n=new Fge(t);try{return n.parseSync(r,e?.draco)}finally{n.destroy()}}function Hge(r){const e={};for(const t in r){const n=r[t];if(t!=="indices"){const i=B8(n);e[t]=i}}return e}function B8(r){const{buffer:e,size:t,count:n}=jge(r);return{value:e,size:t,byteOffset:0,count:n,type:p8(t),componentType:UC(e)}}function jge(r){let e=r,t=1,n=0;return r&&r.value&&(e=r.value,t=r.size||1),e&&(ArrayBuffer.isView(e)||(e=$ge(e,Float32Array)),n=e.length/t),{buffer:e,size:t,count:n}}function $ge(r,e,t=!1){return r?Array.isArray(r)?new e(r):t&&!(r instanceof e)?new e(r):r:null}const nf="KHR_draco_mesh_compression",Wge=nf;function Jge(r,e,t){const n=new yo(r);for(const i of S8(n))n.getObjectExtension(i,nf)}async function Xge(r,e,t){if(!e?.gltf?.decompressMeshes)return;const n=new yo(r),i=[];for(const s of S8(n))n.getObjectExtension(s,nf)&&i.push(qge(n,s,e,t));await Promise.all(i),n.removeExtension(nf)}function Kge(r,e={}){const t=new yo(r);for(const n of t.json.meshes||[])Yge(n),t.addRequiredExtension(nf)}async function qge(r,e,t,n){const i=r.getObjectExtension(e,nf);if(!i)return;const s=r.getTypedArrayForBufferView(i.bufferView),o=Kg(s.buffer,s.byteOffset),c={...t};delete c["3d-tiles"];const f=await Bh(o,JC,c,n),A=Hge(f.attributes);for(const[v,w]of Object.entries(A))if(v in e.attributes){const S=e.attributes[v],F=r.getAccessor(S);F?.min&&F?.max&&(w.min=F.min,w.max=F.max)}e.attributes=A,f.indices&&(e.indices=B8(f.indices)),r.removeObjectExtension(e,nf),Zge(e)}function Yge(r,e,t=4,n,i){if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const s=n.DracoWriter.encodeSync({attributes:r}),o=i?.parseSync?.({attributes:r}),c=n._addFauxAttributes(o.attributes),f=n.addBufferView(s);return{primitives:[{attributes:c,mode:t,extensions:{[nf]:{bufferView:f,attributes:c}}}]}}function Zge(r){if(!r.attributes&&Object.keys(r.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*S8(r){for(const e of r.json.meshes||[])for(const t of e.primitives)yield t}const Qge=Object.freeze(Object.defineProperty({__proto__:null,decode:Xge,encode:Kge,name:Wge,preprocess:Jge},Symbol.toStringTag,{value:"Module"})),Vy="KHR_texture_transform",eme=Vy,_0=new dt,tme=new gi,rme=new gi;async function nme(r,e){if(!new yo(r).hasExtension(Vy)||!e.gltf?.loadBuffers)return;const i=r.json.materials||[];for(let s=0;s<i.length;s++)ime(s,r)}function ime(r,e){const t=e.json.materials?.[r],n=[t?.pbrMetallicRoughness?.baseColorTexture,t?.emissiveTexture,t?.normalTexture,t?.occlusionTexture,t?.pbrMetallicRoughness?.metallicRoughnessTexture],i=[];for(const s of n)s&&s?.extensions?.[Vy]&&sme(e,r,s,i)}function sme(r,e,t,n){const i=ome(t,n);if(!i)return;const s=r.json.meshes||[];for(const o of s)for(const c of o.primitives){const f=c.material;Number.isFinite(f)&&e===f&&ame(r,c,i)}}function ome(r,e){const t=r.extensions?.[Vy],{texCoord:n=0}=r,{texCoord:i=n}=t;if(!(e.findIndex(([o,c])=>o===n&&c===i)!==-1)){const o=ume(t);return n!==i&&(r.texCoord=i),e.push([n,i]),{originalTexCoord:n,texCoord:i,matrix:o}}return null}function ame(r,e,t){const{originalTexCoord:n,texCoord:i,matrix:s}=t,o=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){const c=r.json.accessors?.[o];if(c&&c.bufferView){const f=r.json.bufferViews?.[c.bufferView];if(f){const{arrayBuffer:A,byteOffset:v}=r.buffers[f.buffer],w=(v||0)+(c.byteOffset||0)+(f.byteOffset||0),{ArrayType:S,length:F}=zC(c,f),N=d8[c.componentType],U=h8[c.type],$=f.byteStride||N*U,G=new Float32Array(F);for(let H=0;H<c.count;H++){const J=new S(A,w+H*$,2);_0.set(J[0],J[1],1),_0.transformByMatrix3(s),G.set([_0[0],_0[1]],H*U)}n===i?cme(c,f,r.buffers,G):lme(i,c,e,r,G)}}}}function cme(r,e,t,n){r.componentType=5126,t.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),e.buffer=t.length-1,e.byteLength=n.buffer.byteLength,e.byteOffset=0,delete e.byteStride}function lme(r,e,t,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});const s=n.json.bufferViews;if(!s)return;s.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});const o=n.json.accessors;o&&(o.push({bufferView:s?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),t.attributes[`TEXCOORD_${r}`]=o.length-1)}function ume(r){const{offset:e=[0,0],rotation:t=0,scale:n=[1,1]}=r,i=new gi().set(1,0,0,0,1,0,e[0],e[1],1),s=tme.set(Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0,0,0,1),o=rme.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}const fme=Object.freeze(Object.defineProperty({__proto__:null,decode:nme,name:eme},Symbol.toStringTag,{value:"Module"})),eh="KHR_lights_punctual",hme=eh;async function dme(r){const e=new yo(r),{json:t}=e,n=e.getExtension(eh);n&&(e.json.lights=n.lights,e.removeExtension(eh));for(const i of t.nodes||[]){const s=e.getObjectExtension(i,eh);s&&(i.light=s.light),e.removeObjectExtension(i,eh)}}async function pme(r){const e=new yo(r),{json:t}=e;if(t.lights){const n=e.addExtension(eh);Aa(!n.lights),n.lights=t.lights,delete t.lights}if(e.json.lights){for(const n of e.json.lights){const i=n.node;e.addObjectExtension(i,eh,n)}delete e.json.lights}}const Ame=Object.freeze(Object.defineProperty({__proto__:null,decode:dme,encode:pme,name:hme},Symbol.toStringTag,{value:"Module"})),Rg="KHR_materials_unlit",gme=Rg;async function mme(r){const e=new yo(r),{json:t}=e;for(const n of t.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),e.removeObjectExtension(n,Rg);e.removeExtension(Rg)}function _me(r){const e=new yo(r),{json:t}=e;if(e.materials)for(const n of t.materials||[])n.unlit&&(delete n.unlit,e.addObjectExtension(n,Rg,{}),e.addExtension(Rg))}const yme=Object.freeze(Object.defineProperty({__proto__:null,decode:mme,encode:_me,name:gme},Symbol.toStringTag,{value:"Module"})),YA="KHR_techniques_webgl",vme=YA;async function bme(r){const e=new yo(r),{json:t}=e,n=e.getExtension(YA);if(n){const i=wme(n,e);for(const s of t.materials||[]){const o=e.getObjectExtension(s,YA);o&&(s.technique=Object.assign({},o,i[o.technique]),s.technique.values=Cme(s.technique,e)),e.removeObjectExtension(s,YA)}e.removeExtension(YA)}}async function xme(r,e){}function wme(r,e){const{programs:t=[],shaders:n=[],techniques:i=[]}=r,s=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=s.decode(e.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),t.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),i.forEach(o=>{o.program=t[o.program]}),i}function Cme(r,e){const t=Object.assign({},r.values);return Object.keys(r.uniforms||{}).forEach(n=>{r.uniforms[n].value&&!(n in t)&&(t[n]=r.uniforms[n].value)}),Object.keys(t).forEach(n=>{typeof t[n]=="object"&&t[n].index!==void 0&&(t[n].texture=e.getTexture(t[n].index))}),t}const Tme=Object.freeze(Object.defineProperty({__proto__:null,decode:bme,encode:xme,name:vme},Symbol.toStringTag,{value:"Module"})),I8=[gAe,Zpe,vge,wge,Ege,Qge,Ame,yme,Tme,fme,FAe];function Eme(r,e={},t){const n=I8.filter(i=>M8(i.name,e));for(const i of n)i.preprocess?.(r,e,t)}async function Bme(r,e={},t){const n=I8.filter(i=>M8(i.name,e));for(const i of n)await i.decode?.(r,e,t)}function M8(r,e){const t=e?.gltf?.excludeExtensions||{};return!(r in t&&!t[r])}const v1="KHR_binary_glTF";function Sme(r){const e=new yo(r),{json:t}=e;for(const n of t.images||[]){const i=e.getObjectExtension(n,v1);i&&Object.assign(n,i),e.removeObjectExtension(n,v1)}t.buffers&&t.buffers[0]&&delete t.buffers[0].uri,e.removeExtension(v1)}const wR={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Ime={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};let Mme=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(e,t){this.json=e.json;const n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!t.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(n),this._convertTopLevelObjectsToArrays(n),Sme(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_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(const t in wR)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const n=e[t];if(!(!n||Array.isArray(n))){e[t]=[];for(const i in n){const s=n[i];s.id=s.id||i;const o=e[t].length;e[t].push(s),this.idToIndexMap[t][i]=o}}}_convertObjectIdsToArrayIndices(e){for(const t in wR)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:n,indices:i,material:s}=t;for(const o in n)n[o]=this._convertIdToIndex(n[o],"accessor");i&&(t.indices=this._convertIdToIndex(i,"accessor")),s&&(t.material=this._convertIdToIndex(s,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(t=>this._convertIdToIndex(t,"node"))),e.meshes&&(e.meshes=e.meshes.map(t=>this._convertIdToIndex(t,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(t=>this._convertIdToIndex(t,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn(`gltf v1: json doesn't contain attribute ${t}`),e[t]=[]);for(const n of e[t])for(const i in n){const s=n[i],o=this._convertIdToIndex(s,i);n[i]=o}}_convertIdToIndex(e,t){const n=Ime[t];if(n in this.idToIndexMap){const i=this.idToIndexMap[n][e];if(!Number.isFinite(i))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return i}return e}_updateObjects(e){for(const t of this.json.buffers)delete t.type}_updateMaterial(e){for(const t of e.materials){t.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const n=t.values?.tex||t.values?.texture2d_0||t.values?.diffuseTex,i=e.textures.findIndex(s=>s.id===n);i!==-1&&(t.pbrMetallicRoughness.baseColorTexture={index:i})}}};function Pme(r,e={}){return new Mme().normalize(r,e)}async function Rme(r,e,t=0,n,i){return Fme(r,e,t,n),Pme(r,{normalize:n?.gltf?.normalize}),Eme(r,n,i),n?.gltf?.loadBuffers&&r.json.buffers&&await Dme(r,n,i),n?.gltf?.loadImages&&await Ome(r,n,i),await Bme(r,n,i),r}function Fme(r,e,t,n){if(n.uri&&(r.baseUri=n.uri),e instanceof ArrayBuffer&&!tge(e,t,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")r.json=F6(e);else if(e instanceof ArrayBuffer){const o={};t=rge(o,e,t,n.glb),Aa(o.type==="glTF",`Invalid GLB magic string ${o.type}`),r._glb=o,r.json=o.json}else Aa(!1,"GLTF: must be ArrayBuffer or string");const i=r.json.buffers||[];if(r.buffers=new Array(i.length).fill(null),r._glb&&r._glb.header.hasBinChunk){const{binChunks:o}=r._glb;r.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}const s=r.json.images||[];r.images=new Array(s.length).fill({})}async function Dme(r,e,t){const n=r.json.buffers||[];for(let i=0;i<n.length;++i){const s=n[i];if(s.uri){const{fetch:o}=t;Aa(o);const c=T8(s.uri,e),A=await(await t?.fetch?.(c))?.arrayBuffer?.();r.buffers[i]={arrayBuffer:A,byteOffset:0,byteLength:A.byteLength},delete s.uri}else r.buffers[i]===null&&(r.buffers[i]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}async function Ome(r,e,t){const n=Lme(r),i=r.json.images||[],s=[];for(const o of n)s.push(kme(r,i[o],o,e,t));return await Promise.all(s)}function Lme(r){const e=new Set,t=r.json.textures||[];for(const n of t)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function kme(r,e,t,n,i){let s;if(e.uri&&!e.hasOwnProperty("bufferView")){const c=T8(e.uri,n),{fetch:f}=i;s=await(await f(c)).arrayBuffer(),e.bufferView={data:s}}if(Number.isFinite(e.bufferView)){const c=Vpe(r.json,r.buffers,e.bufferView);s=Kg(c.buffer,c.byteOffset,c.byteLength)}Aa(s,"glTF image has no data");let o=await Bh(s,[Pg,C8],{...n,mimeType:e.mimeType,basis:n.basis||{format:$C()}},i);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),r.images=r.images||[],r.images[t]=o}const bx={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:DAe,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:Nme,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function Nme(r,e={},t){e={...bx.options,...e},e.gltf={...bx.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await Rme({},r,n,e,t)}const Ume={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},zme={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Da={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},Gme={magFilter:Da.TEXTURE_MAG_FILTER,minFilter:Da.TEXTURE_MIN_FILTER,wrapS:Da.TEXTURE_WRAP_S,wrapT:Da.TEXTURE_WRAP_T},Vme={[Da.TEXTURE_MAG_FILTER]:Da.LINEAR,[Da.TEXTURE_MIN_FILTER]:Da.NEAREST_MIPMAP_LINEAR,[Da.TEXTURE_WRAP_S]:Da.REPEAT,[Da.TEXTURE_WRAP_T]:Da.REPEAT};function Hme(){return{id:"default-sampler",parameters:Vme}}function jme(r){return zme[r]}function $me(r){return Ume[r]}let Wme=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(e,t={}){const{json:n,buffers:i=[],images:s=[]}=e,{baseUri:o=""}=e;return Aa(n),this.baseUri=o,this.buffers=i,this.images=s,this.jsonUnprocessed=n,this.json=this._resolveTree(e.json,t),this.json}_resolveTree(e,t={}){const n={...e};return this.json=n,e.bufferViews&&(n.bufferViews=e.bufferViews.map((i,s)=>this._resolveBufferView(i,s))),e.images&&(n.images=e.images.map((i,s)=>this._resolveImage(i,s))),e.samplers&&(n.samplers=e.samplers.map((i,s)=>this._resolveSampler(i,s))),e.textures&&(n.textures=e.textures.map((i,s)=>this._resolveTexture(i,s))),e.accessors&&(n.accessors=e.accessors.map((i,s)=>this._resolveAccessor(i,s))),e.materials&&(n.materials=e.materials.map((i,s)=>this._resolveMaterial(i,s))),e.meshes&&(n.meshes=e.meshes.map((i,s)=>this._resolveMesh(i,s))),e.nodes&&(n.nodes=e.nodes.map((i,s)=>this._resolveNode(i,s)),n.nodes=n.nodes.map((i,s)=>this._resolveNodeChildren(i))),e.skins&&(n.skins=e.skins.map((i,s)=>this._resolveSkin(i,s))),e.scenes&&(n.scenes=e.scenes.map((i,s)=>this._resolveScene(i,s))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}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,t){if(typeof t=="object")return t;const n=e&&e[t];return n||console.warn(`glTF file error: Could not find ${e}[${t}]`),n}_resolveScene(e,t){return{...e,id:e.id||`scene-${t}`,nodes:(e.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(e,t){const n={...e,id:e?.id||`node-${t}`};return e.mesh!==void 0&&(n.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(n.camera=this.getCamera(e.camera)),e.skin!==void 0&&(n.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(n.mesh=e.meshes.reduce((i,s)=>{const o=this.getMesh(s);return i.id=o.id,i.primitives=i.primitives.concat(o.primitives),i},{primitives:[]})),n}_resolveNodeChildren(e){return e.children&&(e.children=e.children.map(t=>this.getNode(t))),e}_resolveSkin(e,t){const n=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${t}`,inverseBindMatrices:n}}_resolveMesh(e,t){const n={...e,id:e.id||`mesh-${t}`,primitives:[]};return e.primitives&&(n.primitives=e.primitives.map(i=>{const s={...i,attributes:{},indices:void 0,material:void 0},o=i.attributes;for(const c in o)s.attributes[c]=this.getAccessor(o[c]);return i.indices!==void 0&&(s.indices=this.getAccessor(i.indices)),i.material!==void 0&&(s.material=this.getMaterial(i.material)),s})),n}_resolveMaterial(e,t){const n={...e,id:e.id||`material-${t}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};const i=n.pbrMetallicRoughness;i.baseColorTexture&&(i.baseColorTexture={...i.baseColorTexture},i.baseColorTexture.texture=this.getTexture(i.baseColorTexture.index)),i.metallicRoughnessTexture&&(i.metallicRoughnessTexture={...i.metallicRoughnessTexture},i.metallicRoughnessTexture.texture=this.getTexture(i.metallicRoughnessTexture.index))}return n}_resolveAccessor(e,t){const n=jme(e.componentType),i=$me(e.type),s=n*i,o={...e,id:e.id||`accessor-${t}`,bytesPerComponent:n,components:i,bytesPerElement:s,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(o.bufferView=this.getBufferView(e.bufferView)),o.bufferView){const c=o.bufferView.buffer,{ArrayType:f,byteLength:A}=zC(o,o.bufferView),v=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+c.byteOffset;let w=c.arrayBuffer.slice(v,v+A);o.bufferView.byteStride&&(w=this._getValueFromInterleavedBuffer(c,v,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new f(w)}return o}_getValueFromInterleavedBuffer(e,t,n,i,s){const o=new Uint8Array(s*i);for(let c=0;c<s;c++){const f=t+c*n;o.set(new Uint8Array(e.arrayBuffer.slice(f,f+i)),c*i)}return o.buffer}_resolveTexture(e,t){return{...e,id:e.id||`texture-${t}
4373`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):Hme(),source:typeof e.source=="number"?this.getImage(e.source):void 0}}_resolveSampler(e,t){const n={id:e.id||`sampler-${t}`,...e,parameters:{}};for(const i in n){const s=this._enumSamplerParameter(i);s!==void 0&&(n.parameters[s]=n[i])}return n}_enumSamplerParameter(e){return Gme[e]}_resolveImage(e,t){const n={...e,id:e.id||`image-${t}`,image:null,bufferView:e.bufferView!==void 0?this.getBufferView(e.bufferView):void 0},i=this.images[t];return i&&(n.image=i),n}_resolveBufferView(e,t){const n=e.buffer,i=this.buffers[n].arrayBuffer;let s=this.buffers[n].byteOffset||0;return e.byteOffset&&(s+=e.byteOffset),{id:`bufferView-${t}`,...e,buffer:this.buffers[n],data:new Uint8Array(i,s,e.byteLength)}}_resolveCamera(e,t){const n={...e,id:e.id||`camera-${t}`};return n.perspective,n.orthographic,n}};function Jme(r,e){return new Wme().postProcess(r,e)}async function Xme(r){const e=[];return r.scenes.forEach(t=>{t.traverse(n=>{Object.values(n.model.uniforms).forEach(i=>{i.loaded===!1&&e.push(i)})})}),await Kme(()=>e.some(t=>!t.loaded))}async function Kme(r){for(;r();)await new Promise(e=>requestAnimationFrame(e))}const CR=`uniform scenegraphUniforms {
4374  float sizeScale;
4375  float sizeMinPixels;
4376  float sizeMaxPixels;
4377  mat4 sceneModelMatrix;
4378  bool composeModelMatrix;
4379} scenegraph;
4380`,qme={name:"scenegraph",vs:CR,fs:CR,uniformTypes:{sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",sceneModelMatrix:"mat4x4<f32>",composeModelMatrix:"f32"}},Yme=`#version 300 es
4381#define SHADER_NAME scenegraph-layer-vertex-shader
4382in vec3 instancePositions;
4383in vec3 instancePositions64Low;
4384in vec4 instanceColors;
4385in vec3 instancePickingColors;
4386in vec3 instanceModelMatrixCol0;
4387in vec3 instanceModelMatrixCol1;
4388in vec3 instanceModelMatrixCol2;
4389in vec3 instanceTranslation;
4390in vec3 positions;
4391#ifdef HAS_UV
4392in vec2 texCoords;
4393#endif
4394#ifdef LIGHTING_PBR
4395#ifdef HAS_NORMALS
4396in vec3 normals;
4397#endif
4398#endif
4399out vec4 vColor;
4400#ifndef LIGHTING_PBR
4401#ifdef HAS_UV
4402out vec2 vTEXCOORD_0;
4403#endif
4404#endif
4405void main(void) {
4406#if defined(HAS_UV) && !defined(LIGHTING_PBR)
4407vTEXCOORD_0 = texCoords;
4408geometry.uv = texCoords;
4409#endif
4410geometry.worldPosition = instancePositions;
4411geometry.pickingColor = instancePickingColors;
4412mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
4413vec3 normal = vec3(0.0, 0.0, 1.0);
4414#ifdef LIGHTING_PBR
4415#ifdef HAS_NORMALS
4416normal = instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(normals, 0.0)).xyz;
4417#endif
4418#endif
4419float originalSize = project_size_to_pixel(scenegraph.sizeScale);
4420float clampedSize = clamp(originalSize, scenegraph.sizeMinPixels, scenegraph.sizeMaxPixels);
4421vec3 pos = (instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(positions, 1.0)).xyz) * scenegraph.sizeScale * (clampedSize / originalSize) + instanceTranslation;
4422if(scenegraph.composeModelMatrix) {
4423DECKGL_FILTER_SIZE(pos, geometry);
4424geometry.normal = project_normal(normal);
4425geometry.worldPosition += pos;
4426gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
4427}
4428else {
4429pos = project_size(pos);
4430DECKGL_FILTER_SIZE(pos, geometry);
4431gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position);
4432geometry.normal = project_normal(normal);
4433}
4434DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
4435#ifdef LIGHTING_PBR
4436pbr_vPosition = geometry.position.xyz;
4437#ifdef HAS_NORMALS
4438pbr_vNormal = geometry.normal;
4439#endif
4440#ifdef HAS_UV
4441pbr_vUV = texCoords;
4442#else
4443pbr_vUV = vec2(0., 0.);
4444#endif
4445geometry.uv = pbr_vUV;
4446#endif
4447vColor = instanceColors;
4448DECKGL_FILTER_COLOR(vColor, geometry);
4449}
4450`,Zme=`#version 300 es
4451#define SHADER_NAME scenegraph-layer-fragment-shader
4452in vec4 vColor;
4453out vec4 fragColor;
4454#ifndef LIGHTING_PBR
4455#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)
4456in vec2 vTEXCOORD_0;
4457uniform sampler2D pbr_baseColorSampler;
4458#endif
4459#endif
4460void main(void) {
4461#ifdef LIGHTING_PBR
4462fragColor = vColor * pbr_filterColor(vec4(0));
4463geometry.uv = pbr_vUV;
4464#else
4465#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)
4466fragColor = vColor * texture(pbr_baseColorSampler, vTEXCOORD_0);
4467geometry.uv = vTEXCOORD_0;
4468#else
4469fragColor = vColor;
4470#endif
4471#endif
4472fragColor.a *= layer.opacity;
4473DECKGL_FILTER_COLOR(fragColor, geometry);
4474}
4475`,P8=[255,255,255,255],Qme={scenegraph:{type:"object",value:null,async:!0},getScene:r=>r&&r.scenes?typeof r.scene=="object"?r.scene:r.scenes[r.scene||0]:r,getAnimator:r=>r&&r.animator,_animations:null,sizeScale:{type:"number",value:1,min:0}
vendor: 4,835 bytes, lines 4475-4515
4475,sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},getPosition:{type:"accessor",value:r=>r.position},getColor:{type:"accessor",value:P8},_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:[bx]};class Qg extends Es{getShaders(){const e={};let t;this.props._lighting==="pbr"?(t=Ew,e.LIGHTING_PBR=1):t={name:"pbrMaterial"};const n=[Ls,_a,qme,t];return super.getShaders({defines:e,vs:Yme,fs:Zme,modules:n})}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:P8,transition:!0},instanceModelMatrix:c8})}updateState(e){super.updateState(e);const{props:t,oldProps:n}=e;t.scenegraph!==n.scenegraph?this._updateScenegraph():t._animations!==n._animations&&this._applyAnimationsProp(this.state.animator,t._animations)}finalizeState(e){super.finalizeState(e),this.state.scenegraph?.destroy()}get isLoaded(){return!!(this.state?.scenegraph&&super.isLoaded)}_updateScenegraph(){const e=this.props,{device:t}=this.context;let n=null;if(e.scenegraph instanceof T_)n={scenes:[e.scenegraph]};else if(e.scenegraph&&typeof e.scenegraph=="object"){const c=e.scenegraph,f=c.json?Jme(c):c,A=Lpe(t,f,this._getModelOptions());n={gltf:f,...A},Xme(A).then(()=>{this.setNeedsRedraw()}).catch(v=>{this.raiseError(v,"loading glTF")})}const i={layer:this,device:this.context.device},s=e.getScene(n,i),o=e.getAnimator(n,i);if(s instanceof yp){this.state.scenegraph?.destroy(),this._applyAnimationsProp(o,e._animations);const c=[];s.traverse(f=>{f instanceof I2&&c.push(f.model)}),this.setState({scenegraph:s,animator:o,models:c}),this.getAttributeManager().invalidateAll()}else s!==null&&Yr.warn("invalid scenegraph:",s)()}_applyAnimationsProp(e,t){if(!e||!t)return;const n=e.getAnimations();Object.keys(t).sort().forEach(i=>{const s=t[i];if(i==="*")n.forEach(o=>{Object.assign(o,s)});else if(Number.isFinite(Number(i))){const o=Number(i);o>=0&&o<n.length?Object.assign(n[o],s):Yr.warn(`animation ${i} not found`)()}else{const o=n.find(({name:c})=>c===i);o?Object.assign(o,s):Yr.warn(`animation ${i} not found`)()}})}_getModelOptions(){const{_imageBasedLightingEnvironment:e}=this.props;let t;return e&&(typeof e=="function"?t=e({gl:this.context.gl,layer:this}):t=e),{imageBasedLightingEnvironment:t,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());const{viewport:t,renderPass:n}=this.context,{sizeScale:i,sizeMinPixels:s,sizeMaxPixels:o,coordinateSystem:c}=this.props,f=this.getNumInstances();this.state.scenegraph.traverse((A,{worldMatrix:v})=>{if(A instanceof I2){const{model:w}=A;w.setInstanceCount(f);const S={camera:w.uniforms.cameraPosition},F={sizeScale:i,sizeMinPixels:s,sizeMaxPixels:o,composeModelMatrix:l8(t,c),sceneModelMatrix:v};w.shaderInputs.setProps({pbrProjection:S,scenegraph:F}),w.draw(n)}})}}Qg.defaultProps=Qme;Qg.layerName="ScenegraphLayer";const e0e=Object.freeze(Object.defineProperty({__proto__:null,ScenegraphLayer:Qg,SimpleMeshLayer:Ah},Symbol.toStringTag,{value:"Module"})),TR=`uniform meshUniforms {
4476  bool pickFeatureIds;
4477} mesh;
4478`,t0e={name:"mesh",vs:TR,fs:TR,uniformTypes:{pickFeatureIds:"f32"}},r0e=`#version 300 es
4479#define SHADER_NAME simple-mesh-layer-vs
4480in vec3 positions;
4481in vec3 normals;
4482in vec3 colors;
4483in vec2 texCoords;
4484in vec4 uvRegions;
4485in vec3 featureIdsPickingColors;
4486in vec4 instanceColors;
4487in vec3 instancePickingColors;
4488in vec3 instanceModelMatrixCol0;
4489in vec3 instanceModelMatrixCol1;
4490in vec3 instanceModelMatrixCol2;
4491out vec2 vTexCoord;
4492out vec3 cameraPosition;
4493out vec3 normals_commonspace;
4494out vec4 position_commonspace;
4495out vec4 vColor;
4496vec2 applyUVRegion(vec2 uv) {
4497#ifdef HAS_UV_REGIONS
4498return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
4499#else
4500return uv;
4501#endif
4502}
4503void main(void) {
4504vec2 uv = applyUVRegion(texCoords);
4505geometry.uv = uv;
4506if (mesh.pickFeatureIds) {
4507geometry.pickingColor = featureIdsPickingColors;
4508} else {
4509geometry.pickingColor = instancePickingColors;
4510}
4511mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
4512vTexCoord = uv;
4513cameraPosition = project.cameraPosition;
4514vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
4515vec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale;
4516vec3 projectedPosition = project_position(positions);
4517position_commonspace = vec4(projectedPosition, 1.0);
4518gl_Position = project_common_position_to_clipspace(position_commonspace);
4519geometry.position = position_commonspace;
4520normals_commonspace = project_normal(instanceModelMatrix * normals);
4521geometry.normal = normals_commonspace;
4522DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
4523#ifdef MODULE_PBRMATERIAL
4524pbr_vPosition = geometry.position.xyz;
4525#ifdef HAS_NORMALS
4526pbr_vNormal = geometry.normal;
4527#endif
4528#ifdef HAS_UV
4529pbr_vUV = uv;
4530#else
4531pbr_vUV = vec2(0., 0.);
4532#endif
4533geometry.uv = pbr_vUV;
4534#endif
4535DECKGL_FILTER_COLOR(vColor, geometry);
4536}
4537`,n0e=`#version 300 es
4538#define SHADER_NAME simple-mesh-layer-fs
4539precision highp float;
4540uniform sampler2D sampler;
4541in vec2 vTexCoord;
4542in vec3 cameraPosition;
4543in vec3 normals_commonspace;
4544in vec4 position_commonspace;
4545in vec4 vColor;
4546out vec4 fragColor;
4547void main(void) {
4548#ifdef MODULE_PBRMATERIAL
4549fragColor = vColor * pbr_filterColor(vec4(0));
4550geometry.uv = pbr_vUV;
4551fragColor.a *= layer.opacity;
4552#else
4553geometry.uv = vTexCoord;
4554vec3 normal;
4555if (simpleMesh.flatShading) {
4556normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
4557} else {
4558normal = normals_commonspace;
4559}
4560vec4 color = simpleMesh.hasTexture ? texture(sampler, vTexCoord) : vColor;
4561vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
4562fragColor = vec4(lightColor, color.a * layer.opacity);
4563#endif
4564DECKGL_FILTER_COLOR(fragColor, geometry);
4565}
4566`;function i0e(r){const e=r.positions||r.POSITION,t=e.value.length/e.size;r.COLOR_0||r.colors||(r.colors={size:4,value:new Uint8Array(t*4).fill(255),normalized:!0})}const s0e={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}};class XC extends Ah{getShaders(){const e=super.getShaders();return e.modules.push(Ew,t0e),{...e,vs:r0e,fs:n0e}}initializeState(){const{featureIds:e}=this.props;super.initializeState();const t=this.getAttributeManager();e&&t.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(e){super.updateState(e);const{props:t,oldProps:n}=e;t.pbrMaterial!==n.pbrMaterial&&this.updatePbrMaterialUniforms(t.pbrMaterial)}draw(e){const{featureIds:t}=this.props,{model:n}=this.state;if(!n)return;const i={pickFeatureIds:!!t},s={camera:n.uniforms.cameraPosition};n.shaderInputs.setProps({pbrProjection:s,mesh:i}),super.draw(e)}getModel(e){const{id:t}=this.props,n=this.parseMaterial(this.props.pbrMaterial,e);this.setState({parsedPBRMaterial:n});const i=this.getShaders();return i0e(e.attributes),new Di(this.context.device,{...this.getShaders(),id:t,geometry:e,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...i.defines,...n?.defines,HAS_UV_REGIONS:e.attributes.uvRegions?1:0},parameters:n?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(e){const{model:t}=this.state;if(t){const{mesh:n}=this.props,i=this.parseMaterial(e,n);this.setState({parsedPBRMaterial:i});const{pbr_baseColorSampler:s}=i.bindings,{emptyTexture:o}=this.state,c={sampler:s||o,hasTexture:!!s},{camera:f,...A}={...i.bindings,...i.uniforms};t.shaderInputs.setProps({simpleMesh:c,pbrMaterial:A})}}parseMaterial(e,t){const n=!!(e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture);return f8(this.context.device,{unlit:n,...e},{NORMAL:t.attributes.normals,TEXCOORD_0:t.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(e){const t=this.props.featureIds,n=new Uint8ClampedArray(t.length*e.size),i=[];for(let s=0;s<t.length;s++)this.encodePickingColor(t[s],i),n[s*3]=i[0],n[s*3+1]=i[1],n[s*3+2]=i[2];e.value=n}finalizeState(e){super.finalizeState(e),this.state.parsedPBRMaterial?.generatedTextures.forEach(t=>t.destroy()),this.setState({parsedPBRMaterial:null})}}XC.layerName="MeshLayer";XC.defaultProps=s0e;const o0e=6378137,a0e=6378137,c0e=6356752314245179e-9;function Hy(r){return r}new dt;function l0e(r,e=[],t=Hy){return"longitude"in r?(e[0]=t(r.longitude),e[1]=t(r.latitude),e[2]=r.height):"x"in r?(e[0]=t(r.x),e[1]=t(r.y),e[2]=r.z):(e[0]=t(r[0]),e[1]=t(r[1]),e[2]=r[2]),e}function u0e(r,e=[]){return l0e(r,e,Ts._cartographicRadians?Hy:_H)}function f0e(r,e,t=Hy){return"longitude"in e?(e.longitude=t(r[0]),e.latitude=t(r[1]),e.height=r[2]):"x"in e?(e.x=t(r[0]),e.y=t(r[1]),e.z=r[2]):(e[0]=t(r[0]),e[1]=t(r[1]),e[2]=r[2]),e}function h0e(r,e){return f0e(r,e,Ts._cartographicRadians?Hy:yH)}const ER=1e-14,d0e=new dt,BR={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"}},b1={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},NA={east:new dt,north:new dt,up:new dt,west:new dt,south:new dt,down:new dt},p0e=new dt,A0e=new dt,g0e=new dt;function SR(r,e,t,n,i,s){const o=BR[e]&&BR[e][t];mc(o&&(!n||n===o));let c,f,A;const v=d0e.copy(i);if(ma(v.x,0,ER)&&ma(v.y,0,ER)){const S=Math.sign(v.z);c=p0e.fromArray(b1[e]),e!=="east"&&e!=="west"&&c.scale(S),f=A0e.fromArray(b1[t]),t!=="east"&&t!=="west"&&f.scale(S),A=g0e.fromArray(b1[n]),n!=="east"&&n!=="west"&&A.scale(S)}else{const{up:S,east:F,north:N}=NA;F.set(-v.y,v.x,0).normalize(),r.geodeticSurfaceNormal(v,S),N.copy(S).cross(F);const{down:U,west:$,south:G}=NA;U.copy(S).scale(-1),$.copy(F).scale(-1),G.copy(N).scale(-1),c=NA[e],f=NA[t],A=NA[n]}return s[0]=c.x,s[1]=c.y,s[2]=c.z,s[3]=0,s[4]=f.x,s[5]=f.y,s[6]=f.z,s[7]=0,s[8]=A.x,s[9]=A.y,s[10]=A.z,s[11]=0,s[12]=v.x,s[13]=v.y,s[14]=v.z,s[15]=1,s}
vendor: 15,555 bytes, line 4566
4566const Ld=new dt,m0e=new dt,_0e=new dt;function y0e(r,e,t=[]){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:s}=e;Ld.from(r);const o=Ld.x,c=Ld.y,f=Ld.z,A=n.x,v=n.y,w=n.z,S=o*o*A*A,F=c*c*v*v,N=f*f*w*w,U=S+F+N,$=Math.sqrt(1/U);if(!Number.isFinite($))return;const G=m0e;if(G.copy(r).scale($),U<s)return G.to(t);const H=i.x,J=i.y,ue=i.z,q=_0e;q.set(G.x*H*2,G.y*J*2,G.z*ue*2);let se=(1-$)*Ld.len()/(.5*q.len()),Te=0,Ue,de,me,pe;do{se-=Te,Ue=1/(1+se*H),de=1/(1+se*J),me=1/(1+se*ue);const W=Ue*Ue,re=de*de,Ee=me*me,et=W*Ue,_e=re*de,Le=Ee*me;pe=S*W+F*re+N*Ee-1;const Ze=-2*(S*et*H+F*_e*J+N*Le*ue);Te=pe/Ze}while(Math.abs(pe)>Nj);return Ld.scale([Ue,de,me]).to(t)}const y0=new dt,IR=new dt,v0e=new dt,uc=new dt,b0e=new dt,v0=new dt;class wi{constructor(e=0,t=0,n=0){this.centerToleranceSquared=kj,mc(e>=0),mc(t>=0),mc(n>=0),this.radii=new dt(e,t,n),this.radiiSquared=new dt(e*e,t*t,n*n),this.radiiToTheFourth=new dt(e*e*e*e,t*t*t*t,n*n*n*n),this.oneOverRadii=new dt(e===0?0:1/e,t===0?0:1/t,n===0?0:1/n),this.oneOverRadiiSquared=new dt(e===0?0:1/(e*e),t===0?0:1/(t*t),n===0?0:1/(n*n)),this.minimumRadius=Math.min(e,t,n),this.maximumRadius=Math.max(e,t,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||!!(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,t=[0,0,0]){const n=IR,i=v0e,[,,s]=e;this.geodeticSurfaceNormalCartographic(e,n),i.copy(this.radiiSquared).scale(n);const o=Math.sqrt(n.dot(i));return i.scale(1/o),n.scale(s),i.add(n),i.to(t)}cartesianToCartographic(e,t=[0,0,0]){v0.from(e);const n=this.scaleToGeodeticSurface(v0,uc);if(!n)return;const i=this.geodeticSurfaceNormal(n,IR),s=b0e;s.copy(v0).subtract(n);const o=Math.atan2(i.y,i.x),c=Math.asin(i.z),f=Math.sign(vw(s,v0))*y4(s);return h0e([o,c,f],t)}eastNorthUpToFixedFrame(e,t=new vn){return SR(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,n,i,s=new vn){return SR(this,e,t,n,i,s)}geocentricSurfaceNormal(e,t=[0,0,0]){return y0.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const n=u0e(e),i=n[0],s=n[1],o=Math.cos(s);return y0.set(o*Math.cos(i),o*Math.sin(i),Math.sin(s)).normalize(),y0.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return y0.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return y0e(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){uc.from(e);const n=uc.x,i=uc.y,s=uc.z,o=this.oneOverRadiiSquared,c=1/Math.sqrt(n*n*o.x+i*i*o.y+s*s*o.z);return uc.multiplyScalar(c).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return uc.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return uc.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,n=[0,0,0]){mc(ma(this.radii.x,this.radii.y,M4)),mc(this.radii.z>0),uc.from(e);const i=uc.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-t))return uc.set(0,0,i).to(n)}}wi.WGS84=new wi(o0e,a0e,c0e);class x0e{item;previous;next;constructor(e,t,n){this.item=e,this.previous=t,this.next=n}}class w0e{head=null;tail=null;_length=0;get length(){return this._length}add(e){const t=new x0e(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t}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,t){e!==t&&(this.remove(t),this._insert(e,t))}_insert(e,t){const n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,++this._length}}class C0e{_list;_sentinel;_trimTiles;constructor(){this._list=new w0e,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){const t=e._cacheNode;t&&this._list.splice(this._sentinel,t)}add(e,t,n){t._cacheNode||(t._cacheNode=this._list.add(t),n&&n(e,t))}unloadTile(e,t,n){const i=t._cacheNode;i&&(this._list.remove(i),t._cacheNode=null,n&&n(e,t))}unloadTiles(e,t){const n=this._trimTiles;this._trimTiles=!1;const i=this._list,s=e.maximumMemoryUsage*1024*1024,o=this._sentinel;let c=i.head;for(;c!==o&&(e.gpuMemoryUsageInBytes>s||n);){const f=c.item;c=c.next,this.unloadTile(e,f,t)}}trim(){this._trimTiles=!0}}function T0e(r,e){Ai(r),Ai(e);const{rtcCenter:t,gltfUpAxis:n}=e,{computedTransform:i,boundingVolume:{center:s}}=r;let o=new vn(i);switch(t&&o.translate(t),n){case"Z":break;case"Y":const w=new vn().rotateX(Math.PI/2);o=o.multiplyRight(w);break;case"X":const S=new vn().rotateY(-Math.PI/2);o=o.multiplyRight(S);break}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const c=new dt(s);e.cartesianModelMatrix=o,e.cartesianOrigin=c;const f=wi.WGS84.cartesianToCartographic(c,new dt),v=wi.WGS84.eastNorthUpToFixedFrame(c).invert();e.cartographicModelMatrix=v.multiplyRight(o),e.cartographicOrigin=f,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}const MR=new dt,x1=new dt,xx=new pa([new gc,new gc,new gc,new gc,new gc,new gc]);function E0e(r,e){const{cameraDirection:t,cameraUp:n,height:i}=r,{metersPerUnit:s}=r.distanceScales,o=r_(r,r.center),c=wi.WGS84.eastNorthUpToFixedFrame(o),f=r.unprojectPosition(r.cameraPosition),A=wi.WGS84.cartographicToCartesian(f,new dt),v=new dt(c.transformAsVector(new dt(t).scale(s))).normalize(),w=new dt(c.transformAsVector(new dt(n).scale(s))).normalize();S0e(r);const S=r.constructor,{longitude:F,latitude:N,width:U,bearing:$,zoom:G}=r,H=new S({longitude:F,latitude:N,height:i,width:U,bearing:$,zoom:G,pitch:0});return{camera:{position:A,direction:v,up:w},viewport:r,topDownViewport:H,height:i,cullingVolume:xx,frameNumber:e,sseDenominator:1.15}}function B0e(r,e,t){if(t===0||r.length<=t)return[r,[]];const n=[],{longitude:i,latitude:s}=e.viewport;for(const[A,v]of r.entries()){const[w,S]=v.header.mbs,F=Math.abs(i-w),N=Math.abs(s-S),U=Math.sqrt(N*N+F*F);n.push([A,U])}const o=n.sort((A,v)=>A[1]-v[1]),c=[];for(let A=0;A<t;A++)c.push(r[o[A][0]]);const f=[];for(let A=t;A<o.length;A++)f.push(r[o[A][0]]);return[c,f]}function S0e(r){const e=r.getFrustumPlanes(),t=PR(e.near,r.cameraPosition),n=r_(r,t),i=r_(r,r.cameraPosition,x1);let s=0;xx.planes[s++].fromPointNormal(n,MR.copy(n).subtract(i));for(const o in e){if(o==="near")continue;const c=e[o],f=PR(c,t,x1),A=r_(r,f,x1);xx.planes[s++].fromPointNormal(A,MR.copy(n).subtract(A))}}function PR(r,e,t=new dt){const n=r.normal.dot(e);return t.copy(r.normal).scale(r.distance-n).add(e),t}function r_(r,e,t=new dt){const n=r.unprojectPosition(e);return wi.WGS84.cartographicToCartesian(n,t)}const I0e=6378137,M0e=6378137,wx=6356752314245179e-9,Ap=new dt;function P0e(r,e){if(r instanceof Zg){const{halfAxes:t}=r,n=F0e(t);return Math.log2(wx/(n+e[2]))}else if(r instanceof Yg){const{radius:t}=r;return Math.log2(wx/(t+e[2]))}else if(r.width&&r.height){const{width:t,height:n}=r,i=Math.log2(I0e/t),s=Math.log2(M0e/n);return(i+s)/2}return 1}function R8(r,e,t){wi.WGS84.cartographicToCartesian([r.xmax,r.ymax,r.zmax],Ap);const n=Math.sqrt(Math.pow(Ap[0]-t[0],2)+Math.pow(Ap[1]-t[1],2)+Math.pow(Ap[2]-t[2],2));return Math.log2(wx/(n+e[2]))}function R0e(r,e,t){const[n,i,s,o]=r;return R8({xmax:s,ymax:o,zmax:0},e,t)}function F0e(r){r.getColumn(0,Ap);const e=r.getColumn(1),t=r.getColumn(2);return Ap.add(e).add(t).len()}const fa={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5};var Tc;(function(r){r[r.ADD=1]="ADD",r[r.REPLACE=2]="REPLACE"})(Tc||(Tc={}));var Yl;(function(r){r.EMPTY="empty",r.SCENEGRAPH="scenegraph",r.POINTCLOUD="pointcloud",r.MESH="mesh"})(Yl||(Yl={}));var Go;(function(r){r.I3S="I3S",r.TILES3D="TILES3D"})(Go||(Go={}));var Gp;(function(r){r.GEOMETRIC_ERROR="geometricError",r.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(Gp||(Gp={}));const D0e={USE_OPTIMIZATION:1};function F8(r){return r!=null}const mo=new dt,n_=new dt,O0e=new dt,L0e=new dt,Hf=new dt,RR=new dt,FR=new dt,DR=new dt;function w1(r,e,t){if(Ai(r,"3D Tile: boundingVolume must be defined"),r.box)return D8(r.box,e,t);if(r.region)return U0e(r.region);if(r.sphere)return N0e(r.sphere,e,t);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function k0e(r,e){if(r.box)return z0e(e);if(r.region){const[t,n,i,s,o,c]=r.region;return[[Ac(t),Ac(n),o],[Ac(i),Ac(s),c]]}if(r.sphere)return G0e(e);throw new Error("Unkown boundingVolume type")}function D8(r,e,t){const n=new dt(r[0],r[1],r[2]);e.transform(n,n);let i=[];if(r.length===10){const A=r.slice(3,6),v=new vg;v.fromArray(r,6);const w=new dt([1,0,0]),S=new dt([0,1,0]),F=new dt([0,0,1]);w.transformByQuaternion(v),w.scale(A[0]),S.transformByQuaternion(v),S.scale(A[1]),F.transformByQuaternion(v),F.scale(A[2]),i=[...w.toArray(),...S.toArray(),...F.toArray()]}else i=[...r.slice(3,6),...r.slice(6,9),...r.slice(9,12)];const s=e.transformAsVector(i.slice(0,3)),o=e.transformAsVector(i.slice(3,6)),c=e.transformAsVector(i.slice(6,9)),f=new gi([s[0],s[1],s[2],o[0],o[1],o[2],c[0],c[1],c[2]]);return F8(t)?(t.center=n,t.halfAxes=f,t):new Zg(n,f)}function N0e(r,e,t){const n=new dt(r[0],r[1],r[2]);e.transform(n,n);const i=e.getScale(n_),s=Math.max(Math.max(i[0],i[1]),i[2]),o=r[3]*s;return F8(t)?(t.center=n,t.radius=o,t):new Yg(n,o)}function U0e(r){const[e,t,n,i,s,o]=r,c=wi.WGS84.cartographicToCartesian([Ac(e),Ac(i),s],O0e),f=wi.WGS84.cartographicToCartesian([Ac(n),Ac(t),o],L0e),A=new dt().addVectors(c,f).multiplyByScalar(.5);return wi.WGS84.cartesianToCartographic(A,Hf),wi.WGS84.cartographicToCartesian([Ac(n),Hf[1],Hf[2]],RR),wi.WGS84.cartographicToCartesian([Hf[0],Ac(i),Hf[2]],FR),wi.WGS84.cartographicToCartesian([Hf[0],Hf[1],o],DR),D8([...A,...RR.subtract(A),...FR.subtract(A),...DR.subtract(A)],new vn)}function z0e(r){const e=O8(),{halfAxes:t}=r,n=new dt(t.getColumn(0)),i=new dt(t.getColumn(1)),s=new dt(t.getColumn(2));for(let o=0;o<2;o++){for(let c=0;c<2;c++){for(let f=0;f<2;f++)mo.copy(r.center),mo.add(n),mo.add(i),mo.add(s),L8(e,mo),s.negate();i.negate()}n.negate()}return e}function G0e(r){const e=O8(),{center:t,radius:n}=r,i=wi.WGS84.scaleToGeodeticSurface(t,mo);let s;i?s=wi.WGS84.geodeticSurfaceNormal(i):s=new dt(0,0,1);let o=new dt(s[2],-s[1],0);o.len()>0?o.normalize():o=new dt(0,1,0);const c=o.clone().cross(s);for(const f of[o,c,s]){n_.copy(f).scale(n);for(let A=0;A<2;A++)mo.copy(t),mo.add(n_),L8(e,mo),n_.negate()}return e}function O8(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function L8(r,e){wi.WGS84.cartesianToCartographic(e,mo),r[0][0]=Math.min(r[0][0],mo[0]),r[0][1]=Math.min(r[0][1],mo[1]),r[0][2]=Math.min(r[0][2],mo[2]),r[1][0]=Math.max(r[1][0],mo[0]),r[1][1]=Math.max(r[1][1],mo[1]),r[1][2]=Math.max(r[1][2],mo[2])}new dt;new dt;new vn;new dt;new dt;new dt;function V0e(r,e){const t=r*e;return 1-Math.exp(-(t*t))}function H0e(r,e){if(r.dynamicScreenSpaceError&&r.dynamicScreenSpaceErrorComputedDensity){const t=r.dynamicScreenSpaceErrorComputedDensity,n=r.dynamicScreenSpaceErrorFactor;return V0e(e,t)*n}return 0}function j0e(r,e,t){const n=r.tileset,i=r.parent&&r.parent.lodMetricValue||r.lodMetricValue,s=t?i:r.lodMetricValue;if(s===0)return 0;const o=Math.max(r._distanceToCamera,1e-7),{height:c,sseDenominator:f}=e,{viewDistanceScale:A}=n.options;let v=s*c*(A||1)/(o*f);return v-=H0e(n,o),v}const C1=new dt,OR=new dt,Uu=new dt,LR=new dt,$0e=new dt,T1=new vn,kR=new vn;function W0e(r,e){if(r.lodMetricValue===0||isNaN(r.lodMetricValue))return"DIG";const t=2*k8(r,e);return t<2?"OUT":!r.header.children||t<=r.lodMetricValue?"DRAW":r.header.children?"DIG":"OUT"}function k8(r,e){const{topDownViewport:t}=e,n=r.header.mbs[1],i=r.header.mbs[0],s=r.header.mbs[2],o=r.header.mbs[3],c=[...r.boundingVolume.center],f=t.unprojectPosition(t.cameraPosition);wi.WGS84.cartographicToCartesian(f,C1),OR.copy(C1).subtract(c).normalize(),wi.WGS84.eastNorthUpToFixedFrame(c,T1),kR.copy(T1).invert(),Uu.copy(C1).transform(kR);const A=Math.sqrt(Uu[0]*Uu[0]+Uu[1]*Uu[1]),v=A*A/Uu[2];LR.copy([Uu[0],Uu[1],v]);const S=LR.transform(T1).subtract(c).normalize(),N=OR.cross(S).normalize().scale(o).add(c),U=wi.WGS84.cartesianToCartographic(N),$=t.project([i,n,s]),G=t.project(U);return $0e.copy($).subtract(G).magnitude()}function J0e(r){return{assetGltfUpAxis:r.asset&&r.asset.gltfUpAxis||"Y"}}class NR{_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 Ai(e<this._array.length),this._array[e]}set(e,t){Ai(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}delete(e){const t=this._map.get(e);t>=0&&(this._array.splice(t,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){const t=this.length++;this._array[t]=e,this._map.set(e,t)}}pop(){const e=this._array[--this.length];return this._map.delete(e),e}reserve(e){Ai(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){Ai(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)}}const X0e={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class jy{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new NR;_emptyTraversalStack=new NR;_frameNumber=null;traversalFinished(e){return!0}constructor(e){this.options={...X0e,...e}}traverse(e,t,n){this.root=e,this.options={...this.options,...n},this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){const n=this._traversalStack;for(e._selectionDepth=1,n.push(e);n.length>0;){const s=n.pop();let o=!1;this.canTraverse(s,t)&&(this.updateChildTiles(s,t),o=this.updateAndPushChildren(s,t,n,s.hasRenderContent?s._selectionDepth+1:s._selectionDepth));const c=s.parent,f=!!(!c||c._shouldRefine),A=!o;s.hasRenderContent?s.refine===Tc.ADD?(this.loadTile(s,t),this.selectTile(s,t)):s.refine===Tc.REPLACE&&(this.loadTile(s,t),A&&this.selectTile(s,t)):(this.emptyTiles[s.id]=s,this.loadTile(s,t),A&&this.selectTile(s,t)),this.touchTile(s,t),s._shouldRefine=o&&f}const i=new Date().getTime();(this.traversalFinished(t)||i-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=i,this.options.onTraversalEnd(t))}updateChildTiles(e,t){const n=e.children;for(const i of n)this.updateTile(i,t)}updateAndPushChildren(e,t,n,i){const{loadSiblings:s,skipLevelOfDetail:o}=this.options,c=e.children;c.sort(this.compareDistanceToCamera.bind(this));const f=e.refine===Tc.REPLACE&&e.hasRenderContent&&!o;let A=!1,v=!0;for(const w of c)if(w._selectionDepth=i,w.isVisibleAndInRequestVolume?(n.find(w)&&n.delete(w),n.push(w),A=!0):(f||s)&&(this.loadTile(w,t),this.touchTile(w,t)),f){let S;if(w._inRequestVolume?w.hasRenderContent?S=w.contentAvailable:S=this.executeEmptyTraversal(w,t):S=!1,v=v&&S,!v)return!1}return A||(v=!1),v}updateTile(e,t){this.updateTileVisibility(e,t)}selectTile(e,t){this.shouldSelectTile(e)&&(e._selectedFrame=t.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,t){this.shouldLoadTile(e)&&(e._requestedFrame=t.frameNumber,e._priority=e._getPri
4566ority(),this.requestedTiles[e.id]=e)}touchTile(e,t){e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber}canTraverse(e,t,n=!1,i=!1){return e.hasChildren?e.hasTilesetContent?!e.contentExpired:!i&&!e.isVisibleAndInRequestVolume?!1:this.shouldRefine(e,t,n):!1}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,t,n=!1){let i=e._screenSpaceError;return n&&(i=e.getScreenSpaceError(t,!0)),i>e.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(e,t){const n=[];if(this.options.viewportTraversersMap)for(const i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===t.viewport.id&&n.push(i);else n.push(t.viewport.id);e.updateVisibility(t,n)}compareDistanceToCamera(e,t){return e._distanceToCamera-t._distanceToCamera}anyChildrenVisible(e,t){let n=!1;for(const i of e.children)i.updateVisibility(t),n=n||i.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(e,t){let n=!0;const i=this._emptyTraversalStack;for(i.push(e);i.length>0;){const s=i.pop(),o=!s.hasRenderContent&&this.canTraverse(s,t,!1,!1),c=!s.hasRenderContent&&s.children.length===0;if(!o&&!s.contentAvailable&&!c&&(n=!1),this.updateTile(s,t),s.isVisibleAndInRequestVolume||(this.loadTile(s,t),this.touchTile(s,t)),o){const f=s.children;for(const A of f)i.push(A)}}return n}}const UR=new dt;function K0e(r){return r!=null}class Cx{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=fa.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new vn;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new jy({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new vn;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(e,t,n,i=""){this.header=t,this.tileset=e,this.id=i||t.id,this.url=t.url,this.parent=n,this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this._initializeLodMetric(t),this._initializeTransforms(t),this._initializeBoundingVolumes(t),this._initializeContent(t),this._initializeRenderingState(t),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===fa.READY||this.hasEmptyContent}
vendor: 19,058 bytes, line 4566
4566get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===fa.UNLOADED}get contentExpired(){return this.contentState===fa.EXPIRED}get contentFailed(){return this.contentState===fa.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=k0e(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(e,t){switch(this.tileset.type){case Go.I3S:return k8(this,e);case Go.TILES3D:return j0e(this,e,t);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){const e=this.tileset._traverser,{skipLevelOfDetail:t}=e.options,n=this.refine===Tc.ADD||t;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===fa.UNLOADED)return-1;const i=this.parent,o=i&&(!n||this._screenSpaceError===0||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,c=e.root?e.root._screenSpaceError:0;return Math.max(c-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=fa.LOADING;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=fa.UNLOADED,!1;try{const n=this.tileset.getTileUrl(this.contentUrl),i=this.tileset.loader,s={...this.tileset.loadOptions,[i.id]:{...this.tileset.loadOptions[i.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(i.id)}};return this.content=await Wp(n,i,s),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=fa.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=fa.FAILED,n}finally{t.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=fa.UNLOADED,!0}updateVisibility(e,t){if(this._frameNumber===e.frameNumber)return;const n=this.parent,i=n?n._visibilityPlaneMask:pa.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const s=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(s)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,i),this._visible=this._visibilityPlaneMask!==pa.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=t}visibility(e,t){const{cullingVolume:n}=e,{boundingVolume:i}=this;return n.computeVisibilityWithPlaneMask(i,t)}contentVisibility(){return!0}distanceToTile(e){const t=this.boundingVolume;return Math.sqrt(Math.max(t.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth({camera:e}){const t=this.boundingVolume;return UR.subVectors(t.center,e.position),e.direction.dot(UR)}insideViewerRequestVolume(e){const t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(K0e(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){const e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=fa.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 vn(e.transform):new vn;const t=this.parent,n=this.tileset,i=t&&t.computedTransform?t.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new vn(i).multiplyRight(this.transform);const s=t&&t._initialTransform?t._initialTransform.clone():new vn;this._initialTransform=new vn(s).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=fa.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=pa.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||Tc.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}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(e){this.boundingVolume=w1(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=w1(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=w1(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(e=new vn){const t=e.clone().multiplyRight(this.transform);t.equals(this.computedTransform)||(this.computedTransform=t,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 J0e(this.tileset.tileset)}}}class q0e extends jy{compareDistanceToCamera(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,t){if(super.updateTileVisibility(e,t),!e.isVisibleAndInRequestVolume)return;const n=e.children.length>0;if(e.hasTilesetContent&&n){const o=e.children[0];this.updateTileVisibility(o,t),e._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(e,t)){e._visible=!1;return}const i=e.refine===Tc.REPLACE,s=e._optimChildrenWithinParent===D0e.USE_OPTIMIZATION;if(i&&s&&n&&!this.anyChildrenVisible(e,t)){e._visible=!1;return}}meetsScreenSpaceErrorEarly(e,t){const{parent:n}=e;return!n||n.hasTilesetContent||n.refine!==Tc.ADD?!1:!this.shouldRefine(e,t,!0)}}class Y0e{frameNumberMap=new Map;register(e,t){const n=this.frameNumberMap.get(e)||new Map,i=n.get(t)||0;n.set(t,i+1),this.frameNumberMap.set(e,n)}deregister(e,t){const n=this.frameNumberMap.get(e);if(!n)return;const i=n.get(t)||1;n.set(t,i-1)}isZero(e,t){return(this.frameNumberMap.get(e)?.get(t)||0)===0}}const E1={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"};class Z0e{_statusMap;pendingTilesRegister=new Y0e;constructor(){this._statusMap={}}add(e,t,n,i){if(!this._statusMap[t]){const{frameNumber:s,viewport:{id:o}}=i;this._statusMap[t]={request:e,callback:n,key:t,frameState:i,status:E1.REQUESTED},this.pendingTilesRegister.register(o,s),e().then(c=>{this._statusMap[t].status=E1.COMPLETED;const{frameNumber:f,viewport:{id:A}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(A,f),this._statusMap[t].callback(c,i)}).catch(c=>{this._statusMap[t].status=E1.ERROR;const{frameNumber:f,viewport:{id:A}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(A,f),n(c)})}}update(e,t){if(this._statusMap[e]){const{frameNumber:n,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,n);const{frameNumber:s,viewport:{id:o}}=t;this.pendingTilesRegister.register(o,s),this._statusMap[e].frameState=t}}find(e){return this._statusMap[e]}hasPendingTiles(e,t){return!this.pendingTilesRegister.isZero(e,t)}}class Q0e extends jy{_tileManager;constructor(e){super(e),this._tileManager=new Z0e}traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}shouldRefine(e,t){return e._lodJudge=W0e(e,t),e._lodJudge==="DIG"}updateChildTiles(e,t){const n=e.header.children||[],i=e.children,s=e.tileset;for(const o of n){const c=`${o.id}-${t.viewport.id}`,f=i&&i.find(A=>A.id===c);if(f)f&&this.updateTile(f,t);else{let A=()=>this._loadTile(o.id,s);this._tileManager.find(c)?this._tileManager.update(c,t):(s.tileset.nodePages&&(A=()=>s.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(A,c,w=>this._onTileLoad(w,e,c),t))}}return!1}async _loadTile(e,t){const{loader:n}=t,i=t.getTileUrl(`${t.url}/nodes/${e}`),s={...t.loadOptions,i3s:{...t.loadOptions.i3s,isTileHeader:!0}};return await Wp(i,n,s)}_onTileLoad(e,t,n){const i=new Cx(t.tileset,e,t,n);t.children.push(i);const s=this._tileManager.find(i.id).frameState;this.updateTile(i,s),this._frameNumber===s.frameNumber&&(this.traversalFinished(s)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(i,s)}}const e_e={description:"",ellipsoid:wi.WGS84,modelMatrix:new vn,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:r=>r,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},b0="Tiles In Tileset(s)",B1="Tiles In Memory",zR="Tiles In View",GR="Tiles To Render",VR="Tiles Loaded",S1="Tiles Loading",HR="Tiles Unloaded",jR="Failed Tile Loads",$R="Points/Vertices",I1="Tile Memory Use",WR="Maximum Screen Space Error";class t_e{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 C0e;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(e,t){this.options={...e_e,...t},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||L6(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 O6({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 YL({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 n=e;return this.queryParams.length&&(n=`${e}${e.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(e){return 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(t=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),t(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;const t=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const n=[];for(const i of t){const s=i.id;this._needTraverse(s)?n.push(s):this.traverseCounter--}for(const i of t){const s=i.id;if(this.roots[s]||(this.roots[s]=this._initializeTileHeaders(this.tileset,null)),!n.includes(s))continue;const o=E0e(i,this._frameNumber);this._traverser.traverse(this.roots[s],o,this.options)}}_needTraverse(e){let t=e;return this.options.viewportTraversersMap&&(t=this.options.viewportTraversersMap[e]),t===e}_onTraversalEnd(e){const t=e.viewport.id;this.frameStateData[t]||(this.frameStateData[t]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const n=this.frameStateData[t],i=Object.values(this._traverser.selectedTiles),[s,o]=B0e(i,e,this.options.maximumTilesSelected);n.selectedTiles=s;for(const c of o)c.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const e in this.frameStateData){const t=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(t.selectedTiles),this._requestedTiles=this._requestedTiles.concat(t._requestedTiles),this._emptyTiles=this._emptyTiles.concat(t._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,t){if(e.length!==t.length)return!0;const n=new Set(e.map(o=>o.id)),i=new Set(t.map(o=>o.id));let s=e.filter(o=>!i.has(o.id)).length>0;return s=s||t.filter(o=>!n.has(o.id)).length>0,s}_loadTiles(){for(const e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,t)=>e._unloadTile(t))}_updateStats(){let e=0,t=0;for(const n of this.selectedTiles)n.contentAvailable&&n.content&&(e++,n.content.pointCount?t+=n.content.pointCount:t+=n.content.vertexCount);this.stats.get(zR).count=this.selectedTiles.length,this.stats.get(GR).count=e,this.stats.get($R).count=t,this.stats.get(WR).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(e){this.type===Go.I3S&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===Go.TILES3D&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===Go.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){const e=this.tileset.fullExtent;if(e){const{xmin:n,xmax:i,ymin:s,ymax:o,zmin:c,zmax:f}=e;this.cartographicCenter=new dt(n+(i-n)/2,s+(o-s)/2,c+(f-c)/2),this.cartesianCenter=new dt,wi.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=R8(e,this.cartographicCenter,this.cartesianCenter);return}const t=this.tileset.store?.extent;if(t){const[n,i,s,o]=t;this.cartographicCenter=new dt(n+(s-n)/2,i+(o-i)/2,0),this.cartesianCenter=new dt,wi.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=R0e(t,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new dt,this.zoom=1}calculateViewPropsTiles3D(){const e=this.root,{center:t}=e.boundingVolume;if(!t){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new dt,this.zoom=1;return}t[0]!==0||t[1]!==0||t[2]!==0?(this.cartographicCenter=new dt,wi.WGS84.cartesianToCartographic(t,this.cartographicCenter)):this.cartographicCenter=new dt(0,0,-wi.WGS84.radii[0]),this.cartesianCenter=t,this.zoom=P0e(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(b0),this.stats.get(S1),this.stats.get(B1),this.stats.get(zR),this.stats.get(GR),this.stats.get(VR),this.stats.get(HR),this.stats.get(jR),this.stats.get($R),this.stats.get(I1,"memory"),this.stats.get(WR)}_initializeTileHeaders(e,t){const n=new Cx(this,e.root,t);if(t&&(t.children.push(n),n.depth=t.depth+1),this.type===Go.TILES3D){const i=[];for(i.push(n);i.length>0;){const s=i.pop();this.stats.get(b0).incrementCount();const o=s.header.children||[];for(const c of o){const f=new Cx(this,c,s);if(f.contentUrl?.includes("?session=")){const v=new URL(f.contentUrl).searchParams.get("session");v&&(this._queryParams.session=v)}s.children.push(f),f.depth=s.depth+1,i.push(f)}}}return n}_initializeTraverser(){let e;switch(this.type){case Go.TILES3D:e=q0e;break;case Go.I3S:e=Q0e;break;default:e=jy}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let t;try{this._onStartTileLoading(),t=await e.loadContent()}catch(n){this._onTileLoadError(e,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(e,t)}}_onTileLoadError(e,t){this.stats.get(jR).incrementCount();const n=t.message||t.toString(),i=e.url;console.error(`A 3D tile failed to load: ${e.url} ${n}
4566`),this.options.onTileError(e,n,i)}_onTileLoad(e,t){if(t){if(this.type===Go.I3S){const n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(b0).reset(),this.stats.get(b0).addCount(n)}e&&e.content&&T0e(e,e.content),this.updateContentTypes(e),this._addTileToCache(e),this.options.onTileLoad(e)}}updateContentTypes(e){if(this.type===Go.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}else if(this.type===Go.TILES3D){const{extensionsRemoved:t=[]}=e.content?.gltf||{};t.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),t.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),t.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(S1).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(S1).decrementCount()}_addTileToCache(e){this._cache.add(this,e,t=>t._updateCacheStats(e))}_updateCacheStats(e){this.stats.get(VR).incrementCount(),this.stats.get(B1).incrementCount(),this.gpuMemoryUsageInBytes+=e.gpuMemoryUsageInBytes||0,this.stats.get(I1).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.gpuMemoryUsageInBytes||0,this.stats.get(B1).decrementCount(),this.stats.get(HR).incrementCount(),this.stats.get(I1).count=this.gpuMemoryUsageInBytes,this.options.onT
vendor: 36,575 bytes, line 4566
4566ileUnload(e),e.unloadContent()}_destroy(){const e=[];for(this.root&&e.push(this.root);e.length>0;){const t=e.pop();for(const n of t.children)e.push(n);this._destroyTile(t)}this.root=null}_destroySubtree(e){const t=e,n=[];for(n.push(t);n.length>0;){e=n.pop();for(const i of e.children)n.push(i);e!==t&&this._destroyTile(e)}t.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(e.queryString){const t=new URLSearchParams(e.queryString),n=Object.fromEntries(t.entries());this._queryParams={...this._queryParams,...n}}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)}}const N8="4.2.4",UA={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GLTF:"glTF"};function U8(r,e,t){Ai(r instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(r,e,t);return n.decode(i)}function r_e(r,e=0){const t=new DataView(r);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))}`}const n_e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ps={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Un={...n_e,...ps},M1={[ps.DOUBLE]:Float64Array,[ps.FLOAT]:Float32Array,[ps.UNSIGNED_SHORT]:Uint16Array,[ps.UNSIGNED_INT]:Uint32Array,[ps.UNSIGNED_BYTE]:Uint8Array,[ps.BYTE]:Int8Array,[ps.SHORT]:Int16Array,[ps.INT]:Int32Array},i_e={DOUBLE:ps.DOUBLE,FLOAT:ps.FLOAT,UNSIGNED_SHORT:ps.UNSIGNED_SHORT,UNSIGNED_INT:ps.UNSIGNED_INT,UNSIGNED_BYTE:ps.UNSIGNED_BYTE,BYTE:ps.BYTE,SHORT:ps.SHORT,INT:ps.INT},P1="Failed to convert GL type";class ll{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in M1)if(M1[t]===e)return t;throw new Error(P1)}static fromName(e){const t=i_e[e];if(!t)throw new Error(P1);return t}static getArrayType(e){switch(e){case ps.UNSIGNED_SHORT_5_6_5:case ps.UNSIGNED_SHORT_4_4_4_4:case ps.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const t=M1[e];if(!t)throw new Error(P1);return t}}static getByteSize(e){return ll.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return!!ll.getArrayType(e)}static createTypedArray(e,t,n=0,i){i===void 0&&(i=(t.byteLength-n)/ll.getByteSize(e));const s=ll.getArrayType(e);return new s(t,n,i)}}function s_e(r,e){if(!r)throw new Error(`math.gl assertion failed. ${e}`)}function o_e(r,e=[0,0,0]){const t=r>>11&31,n=r>>5&63,i=r&31;return e[0]=t<<3,e[1]=n<<2,e[2]=i<<3,e}new yw;new dt;new yw;new yw;function JR(r,e=255){return Kl(r,0,e)/e*2-1}function XR(r){return r<0?-1:1}function a_e(r,e,t,n){if(s_e(n),r<0||r>t||e<0||e>t)throw new Error(`x and y must be unsigned normalized integers between 0 and ${t}`);if(n.x=JR(r,t),n.y=JR(e,t),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const i=n.x;n.x=(1-Math.abs(n.y))*XR(i),n.y=(1-Math.abs(i))*XR(n.y)}return n.normalize()}function c_e(r,e,t){return a_e(r,e,255,t)}class KC{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(e,t){this.json=e,this.buffer=t}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t=Un.UNSIGNED_INT,n=1){const i=this.json[e];return i&&Number.isFinite(i.byteOffset)?this._getTypedArrayFromBinary(e,t,n,1,i.byteOffset):i}getPropertyArray(e,t,n){const i=this.json[e];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(t=ll.fromName(i.componentType)),this._getTypedArrayFromBinary(e,t,n,this.featuresLength,i.byteOffset)):this._getTypedArrayFromArray(e,t,i)}getProperty(e,t,n,i,s){const o=this.json[e];if(!o)return o;const c=this.getPropertyArray(e,t,n);if(n===1)return c[i];for(let f=0;f<n;++f)s[f]=c[n*i+f];return s}_getTypedArrayFromBinary(e,t,n,i,s){const o=this._cachedTypedArrays;let c=o[e];return c||(c=ll.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+s,i*n),o[e]=c),c}_getTypedArrayFromArray(e,t,n){const i=this._cachedTypedArrays;let s=i[e];return s||(s=ll.createTypedArray(t,n),i[e]=s),s}}const l_e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},u_e={SCALAR:(r,e)=>r[e],VEC2:(r,e)=>[r[2*e+0],r[2*e+1]],VEC3:(r,e)=>[r[3*e+0],r[3*e+1],r[3*e+2]],VEC4:(r,e)=>[r[4*e+0],r[4*e+1],r[4*e+2],r[4*e+3]],MAT2:(r,e)=>[r[4*e+0],r[4*e+1],r[4*e+2],r[4*e+3]],MAT3:(r,e)=>[r[9*e+0],r[9*e+1],r[9*e+2],r[9*e+3],r[9*e+4],r[9*e+5],r[9*e+6],r[9*e+7],r[9*e+8]],MAT4:(r,e)=>[r[16*e+0],r[16*e+1],r[16*e+2],r[16*e+3],r[16*e+4],r[16*e+5],r[16*e+6],r[16*e+7],r[16*e+8],r[16*e+9],r[16*e+10],r[16*e+11],r[16*e+12],r[16*e+13],r[16*e+14],r[16*e+15]]},f_e={SCALAR:(r,e,t)=>{e[t]=r},VEC2:(r,e,t)=>{e[2*t+0]=r[0],e[2*t+1]=r[1]},VEC3:(r,e,t)=>{e[3*t+0]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2]},VEC4:(r,e,t)=>{e[4*t+0]=r[0],e[4*t+1]=r[1],e[4*t+2]=r[2],e[4*t+3]=r[3]},MAT2:(r,e,t)=>{e[4*t+0]=r[0],e[4*t+1]=r[1],e[4*t+2]=r[2],e[4*t+3]=r[3]},MAT3:(r,e,t)=>{e[9*t+0]=r[0],e[9*t+1]=r[1],e[9*t+2]=r[2],e[9*t+3]=r[3],e[9*t+4]=r[4],e[9*t+5]=r[5],e[9*t+6]=r[6],e[9*t+7]=r[7],e[9*t+8]=r[8],e[9*t+9]=r[9]},MAT4:(r,e,t)=>{e[16*t+0]=r[0],e[16*t+1]=r[1],e[16*t+2]=r[2],e[16*t+3]=r[3],e[16*t+4]=r[4],e[16*t+5]=r[5],e[16*t+6]=r[6],e[16*t+7]=r[7],e[16*t+8]=r[8],e[16*t+9]=r[9],e[16*t+10]=r[10],e[16*t+11]=r[11],e[16*t+12]=r[12],e[16*t+13]=r[13],e[16*t+14]=r[14],e[16*t+15]=r[15]}};function h_e(r,e,t,n){const{componentType:i}=r;Ai(r.componentType);const s=typeof i=="string"?ll.fromName(i):i,o=l_e[r.type],c=u_e[r.type],f=f_e[r.type];return t+=r.byteOffset,{values:ll.createTypedArray(s,e,t,o*n),type:s,size:o,unpacker:c,packer:f}}const al=r=>r!==void 0;function d_e(r,e,t){if(!e)return null;let n=r.getExtension("3DTILES_batch_table_hierarchy");const i=e.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?p_e(n,t):null}function p_e(r,e){let t,n,i;const s=r.instancesLength,o=r.classes;let c=r.classIds,f=r.parentCounts,A=r.parentIds,v=s;al(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,s));let w;if(al(f))for(al(f.byteOffset)&&(f.componentType=defaultValue(f.componentType,GL.UNSIGNED_SHORT),f.type=AttributeType.SCALAR,i=getBinaryAccessor(f),f=i.createArrayBufferView(e.buffer,e.byteOffset+f.byteOffset,s)),w=new Uint16Array(s),v=0,t=0;t<s;++t)w[t]=v,v+=f[t];al(A)&&al(A.byteOffset)&&(A.componentType=defaultValue(A.componentType,GL.UNSIGNED_SHORT),A.type=AttributeType.SCALAR,i=getBinaryAccessor(A),A=i.createArrayBufferView(e.buffer,e.byteOffset+A.byteOffset,v));const S=o.length;for(t=0;t<S;++t){const $=o[t].length,G=o[t].instances,H=getBinaryProperties($,G,e);o[t].instances=combine(H,G)}const F=new Array(S).fill(0),N=new Uint16Array(s);for(t=0;t<s;++t)n=c[t],N[t]=F[n],++F[n];const U={classes:o,classIds:c,classIndexes:N,parentCounts:f,parentIndexes:w,parentIds:A};return m_e(U),U}function zA(r,e,t){if(!r)return;const n=r.parentCounts;return r.parentIds?t(r,e):n>0?A_e(r,e,t):g_e(r,e,t)}function A_e(r,e,t){const n=r.classIds,i=r.parentCounts,s=r.parentIds,o=r.parentIndexes,c=n.length,f=scratchVisited;f.length=Math.max(f.length,c);const A=++marker,v=scratchStack;for(v.length=0,v.push(e);v.length>0;){if(e=v.pop(),f[e]===A)continue;f[e]=A;const w=t(r,e);if(al(w))return w;const S=i[e],F=o[e];for(let N=0;N<S;++N){const U=s[F+N];U!==e&&v.push(U)}}return null}function g_e(r,e,t){let n=!0;for(;n;){const i=t(r,e);if(al(i))return i;const s=r.parentIds[e];n=s!==e,e=s}throw new Error("traverseHierarchySingleParent")}function m_e(r){const t=r.classIds.length;for(let n=0;n<t;++n)z8(r,n,stack)}function z8(r,e,t){const n=r.parentCounts,i=r.parentIds,s=r.parentIndexes,c=r.classIds.length;if(!al(i))return;assert(e<c,`Parent index ${e} exceeds the total number of instances: ${c}`),assert(t.indexOf(e)===-1,"Circular dependency detected in the batch table hierarchy."),t.push(e);const f=al(n)?n[e]:1,A=al(n)?s[e]:e;for(let v=0;v<f;++v){const w=i[A+v];w!==e&&z8(r,w,t)}t.pop(e)}function zo(r){return r!=null}const x0=(r,e)=>r,__e={HIERARCHY:!0,extensions:!0,extras:!0};class G8{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(e,t,n,i={}){Ai(n>=0),this.json=e||{},this.binary=t,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(const s in this.json)__e[s]||(this._properties[s]=this.json[s]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=d_e(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,t){if(this._checkBatchId(e),Ai(typeof t=="string",t),this._hierarchy){const n=zA(this._hierarchy,e,(i,s)=>{const o=i.classIds[s];return i.classes[o].name===t});return zo(n)}return!1}isExactClass(e,t){return Ai(typeof t=="string",t),this.getExactClassName(e)===t}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){const t=this._hierarchy.classIds[e];return this._hierarchy.classes[t].name}}hasProperty(e,t){return this._checkBatchId(e),Ai(typeof t=="string",t),zo(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),t=zo(t)?t:[],t.length=0;const n=Object.keys(this._properties);return t.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}getProperty(e,t){if(this._checkBatchId(e),Ai(typeof t=="string",t),this._binaryProperties){const i=this._binaryProperties[t];if(zo(i))return this._getBinaryProperty(i,e)}const n=this._properties[t];if(zo(n))return x0(n[e]);if(this._hierarchy){const i=this._getHierarchyProperty(e,t);if(zo(i))return i}}setProperty(e,t,n){const i=this.featureCount;if(this._checkBatchId(e),Ai(typeof t=="string",t),this._binaryProperties){const o=this._binaryProperties[t];if(o){this._setBinaryProperty(o,e,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,e,t,n))return;let s=this._properties[t];zo(s)||(this._properties[t]=new Array(i),s=this._properties[t]),s[e]=x0(n)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,t){return e.unpack(e.typedArray,t)}_setBinaryProperty(e,t,n){e.pack(n,e.typedArray,t)}_initializeBinaryProperties(){let e=null;for(const t in this._properties){const n=this._properties[t],i=this._initializeBinaryProperty(t,n);i&&(e=e||{},e[t]=i)}return e}_initializeBinaryProperty(e,t){if("byteOffset"in t){const n=t;Ai(this.binary,`Property ${e} requires a batch table binary.`),Ai(n.type,`Property ${e} requires a type.`);const i=h_e(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:i.values,componentCount:i.size,unpack:i.unpacker,pack:i.packer}}return null}_hasPropertyInHierarchy(e,t){if(!this._hierarchy)return!1;const n=zA(this._hierarchy,e,(i,s)=>{const o=i.classIds[s],c=i.classes[o].instances;return zo(c[t])});return zo(n)}_getPropertyNamesInHierarchy(e,t){zA(this._hierarchy,e,(n,i)=>{const s=n.classIds[i],o=n.classes[s].instances;for(const c in o)o.hasOwnProperty(c)&&t.indexOf(c)===-1&&t.push(c)})}_getHierarchyProperty(e,t){return zA(this._hierarchy,e,(n,i)=>{const s=n.classIds[i],o=n.classes[s],c=n.classIndexes[i],f=o.instances[t];return zo(f)?zo(f.typedArray)?this._getBinaryProperty(f,c):x0(f[c]):null})}_setHierarchyProperty(e,t,n,i){const s=zA(this._hierarchy,t,(o,c)=>{const f=o.classIds[c],A=o.classes[f],v=o.classIndexes[c],w=A.instances[n];return zo(w)?(Ai(c===t,`Inherited property "${n}" is read-only.`),zo(w.typedArray)?this._setBinaryProperty(w,v,i):w[v]=x0(i),!0):!1});return zo(s)}}const R1=4;function $y(r,e,t=0){const n=new DataView(e);if(r.magic=n.getUint32(t,!0),t+=R1,r.version=n.getUint32(t,!0),t+=R1,r.byteLength=n.getUint32(t,!0),t+=R1,r.version!==1)throw new Error(`3D Tile Version ${r.version} not supported`);return t}const kd=4,KR="b3dm tile in legacy format.";function qC(r,e,t){const n=new DataView(e);let i;r.header=r.header||{};let s=n.getUint32(t,!0);t+=kd;let o=n.getUint32(t,!0);t+=kd;let c=n.getUint32(t,!0);t+=kd;let f=n.getUint32(t,!0);return t+=kd,c>=570425344?(t-=kd*2,i=s,c=o,f=0,s=0,o=0,console.warn(KR)):f>=570425344&&(t-=kd,i=c,c=s,f=o,s=0,o=0,console.warn(KR)),r.header.featureTableJsonByteLength=s,r.header.featureTableBinaryByteLength=o,r.header.batchTableJsonByteLength=c,r.header.batchTableBinaryByteLength=f,r.header.batchLength=i,t}function YC(r,e,t,n){return t=y_e(r,e,t),t=v_e(r,e,t),t}function y_e(r,e,t,n){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:s,batchLength:o}=r.header||{};if(r.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){const c=U8(e,t,i);r.featureTableJson=JSON.parse(c)}return t+=i||0,r.featureTableBinary=new Uint8Array(e,t,s),t+=s||0,t}function v_e(r,e,t,n){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:s}=r.header||{};if(i&&i>0){const o=U8(e,t,i);r.batchTableJson=JSON.parse(o),t+=i,s&&s>0&&(r.batchTableBinary=new Uint8Array(e,t,s),r.batchTableBinary=new Uint8Array(r.batchTableBinary),t+=s)}return t}function V8(r,e,t){if(!e&&(!r||!r.batchIds||!t))return null;const{batchIds:n,isRGB565:i,pointCount:s=0}=r;if(n&&t){const o=new Uint8ClampedArray(s*3);for(let c=0;c<s;c++){const f=n[c],v=t.getProperty(f,"dimensions").map(w=>w*255);o[c*3]=v[0],o[c*3+1]=v[1],o[c*3+2]=v[2]}return{type:Un.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(e&&i){const o=new Uint8ClampedArray(s*3);for(let c=0;c<s;c++){const f=o_e(e[c]);o[c*3]=f[0],o[c*3+1]=f[1],o[c*3+2]=f[2]}return{type:Un.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return e&&e.length===s*3?{type:Un.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:Un.UNSIGNED_BYTE,value:e||new Uint8ClampedArray,size:4,normalized:!0}}const qR=new dt;function b_e(r,e){if(!e)return null;if(r.isOctEncoded16P){const t=new Float32Array((r.pointsLength||0)*3);for(let n=0;n<(r.pointsLength||0);n++)c_e(e[n*2],e[n*2+1],qR),qR.toArray(t,n*3);return{type:Un.FLOAT,size:2,value:t}}return{type:Un.FLOAT,size:2,value:e}}function x_e(r,e,t){return r.isQuantized?t["3d-tiles"]&&t["3d-tiles"].decodeQuantizedPositions?(r.isQuantized=!1,w_e(r,e)):{type:Un.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}function w_e(r,e){const t=new dt,n=new Float32Array(r.pointCount*3);for(let i=0;i<r.pointCount;i++)t.set(e[i*3],e[i*3+1],e[i*3+2]).scale(1/r.quantizedRange).multiply(r.quantizedVolumeScale).add(r.quantizedVolumeOffset).toArray(n,i*3);return n}async function C_e(r,e,t,n,i){t=$y(r,e,t),t=qC(r,e,t),t=YC(r,e,t),T_e(r);const{featureTable:s,batchTable:o}=E_e(r);return await P_e(r,s,o,n,i),B_e(r,s,n),S_e(r,s,o),I_e(r,s),t}function T_e(r){r.attributes={positions:null,colors:null,normals:null,batchIds:null},r.isQuantized=!1,r.isTranslucent=!1,r.isRGB565=!1,r.isOctEncoded16P=!1}function E_e(r){const e=new KC(r.featureTableJson,r.featureTableBinary),t=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(t))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=t,r.featuresLength=t,r.pointsLength=t,r.pointCount=t,r.rtcCenter=e.getGlobalProperty("RTC_CENTER",Un.FLOAT,3);const n=M_e(r,e);return{featureTable:e,batchTable:n}}function B_e(r,e,t){if(r.attributes=r.attributes||{positions:null,colors:null,normals:null,batchIds:null},!r.attributes.positions){if(e.hasProperty("POSITION"))r.attributes.positions=e.getPropertyArray("POSITION",Un.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){const n=e.getPropertyArray("POSITION_QUANTIZED",Un.UNSIGNED_SHORT,3);if(r.isQuantized=!0,r.quantizedRange=65535,r.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Un.FLOAT,3),!r.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(r.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Un.FLOAT,3),!r.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");r.attributes.positions=x_e(r,n,t)}}if(!r.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function S_e(r,e,t){if(r.attributes=r.attributes||{positions:null,colors:null,normals:null,batchIds:null},!r.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",Un.UNSIGNED_BYTE,4),r.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",Un.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",Un.UNSIGNED_SHORT,1),r.isRGB565=!0),r.attributes.colors=V8(r,n,t)}e.hasProperty("CONSTANT_RGBA")&&(r.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",Un.UNSIGNED_BYTE,4))}function I_e(r,e){if(r.attributes=r.attributes||{positions:null,colors:null,normals:null,batchIds:null},!r.attributes.normals){let t=null;e.hasProperty("NORMAL")?t=e.getPropertyArray("NORMAL",Un.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(t=e.getPropertyArray("NORMAL_OCT16P",Un.UNSIGNED_BYTE,2),r.isOctEncoded16P=!0),r.attributes.normals=b_e(r,t)}}function M_e(r,e){let t=null;if(!r.batchIds&&e.hasProperty("BATCH_ID")&&(r.batchIds=e.getPropertyArray("BATCH_ID",Un.UNSIGNED_SHORT,1),r.batchIds)){const n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:i,batchTableBinary:s}=r;t=new G8(i,s,n)}return t}async function P_e(r,e,t,n,i){let s,o,c;const f=r.batchTableJson&&r.batchTableJson.extensions&&r.batchTableJson.extensions["3DTILES_draco_point_compression"];f&&(c=f.properties);const A=e.getExtension("3DTILES_draco_point_compression");if(A){o=A.properties;const w=A.byteOffset,S=A.byteLength;if(!o||!Number.isFinite(w)||!S)throw new Error("Draco properties, byteOffset, and byteLength must be defined");s=(r.featureTableBinary||[]).slice(w,w+S),r.hasPositions=Number.isFinite(o.POSITION),r.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),r.hasNormals=Number.isFinite(o.NORMAL),r.hasBatchIds=Number.isFinite(o.BATCH_ID),r.isTranslucent=Number.isFinite(o.RGBA)}if(!s)return!0;const v={buffer:s,properties:{...o,...c},batchTableProperties:c};return await R_e(r,v,n,i)}async function R_e(r,e,t,n){if(!n)return;const i={...t,draco:{...t?.draco,extraAttributes:e.batchTableProperties||{}}};delete i["3d-tiles"];const s=await Bh(e.buffer,JC,i,n),o=s.attributes.POSITION&&s.attributes.POSITION.value,c=s.attributes.COLOR_0&&s.attributes.COLOR_0.value,f=s.attributes.NORMAL&&s.attributes.NORMAL.value,A=s.attributes.BATCH_ID&&s.attributes.BATCH_ID.value,v=o&&s.attributes.POSITION.value.quantization,w=f&&s.attributes.NORMAL.value.quantization;if(v){const F=s.POSITION.data.quantization,N=F.range;r.quantizedVolumeScale=new dt(N,N,N),r.quantizedVolumeOffset=new dt(F.minValues),r.quantizedRange=(1<<F.quantizationBits)-1,r.isQuantizedDraco=!0}w&&(r.octEncodedRange=(1<<s.NORMAL.data.quantization.quantizationBits)-1,r.isOctEncodedDraco=!0);const S={};if(e.batchTableProperties)for(const F of Object.keys(e.batchTableProperties))s.attributes[F]&&s.attributes[F].value&&(S[F.toLowerCase()]=s.attributes[F].value);r.attributes={positions:o,colors:V8(r,c,void 0),normals:f,batchIds:A,...S}}function ga(r,e){if(!r)throw new Error(e||"assert failed: gltf")}const H8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},j8={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},F_e=1.33,YR=["SCALAR","VEC2","VEC3","VEC4"],D_e=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],O_e=new Map(D_e),L_e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},k_e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},N_e={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function $8(r){return YR[r-1]||YR[0]}function ZC(r){const e=O_e.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function QC(r,e){const t=N_e[r.componentType],n=L_e[r.type],i=k_e[r.componentType],s=r.count*n,o=r.count*n*i;ga(o>=0&&o<=e.byteLength);const c=j8[r.componentType],f=H8[r.type];return{ArrayType:t,length:s,byteLength:o,componentByteSize:c,numberOfComponentsInElement:f}}function W8(r){let{images:e,bufferViews:t}=r;e=e||[],t=t||[];const n=e.map(o=>o.bufferView);t=t.filter(o=>!n.includes(o));const i=t.reduce((o,c)=>o+c.byteLength,0),s=e.reduce((o,c)=>{const{width:f,height:A}=c.image;return o+f*A},0);return i+Math.ceil(4*s*F_e)}function U_e(r,e,t){const n=r.bufferViews[t];ga(n);const i=n.buffer,s=e[i];ga(s);const o=(n.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,o,n.byteLength)}function z_e(r,e,t){const n=typeof t=="number"?r.accessors?.[t]:t;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(t)}`);const i=r.bufferViews?.[n.bufferView||0];if(!i)throw new Error(`No gltf buffer view for accessor ${i}`);const{arrayBuffer:s,byteOffset:o}=e[i.buffer],c=(o||0)+(n.byteOffset||0)+(i.byteOffset||0),{ArrayType:f,length:A,componentByteSize:v,numberOfComponentsInElement:w}=QC(n,i),S=v*w,F=i.byteStride||S;if(typeof i.byteStride>"u"||i.byteStride===S)return new f(s,c,A);const N=new f(A);for(let U=0;U<n.count;U++){const $=new f(s,c+U*F,w);N.set($,U*w)}return N}function G_e(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}class vo{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||G_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){const t=this.getUsedExtensions().find(i=>i===e),n=this.getRequiredExtensions().find(i=>i===e);return typeof t=="string"||typeof n=="string"}getExtension(e){const t=this.getUsedExtensions().find(i=>i===e),n=this.json.extensions||{};return t?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}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,t){if(typeof t=="object")return t;const n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){e=this.getBufferView(e);const t=e.buffer,n=this.gltf.buffers[t];ga(n);const i=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,e.byteLength)}getTypedArrayForAccessor(e){const t=this.getAccessor(e);return z_e(this.gltf.json,this.gltf.buffers,t)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(i,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){const i=e.extensions||{};i[t]=n}removeObjectExtension(e,t){const n=e?.extensions||{};if(n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const i=this.json.extensionsRemoved;i.includes(t)||i.push(t)}delete n[t]}addExtension(e,t={}){return ga(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return ga(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const t=this.json.extensionsRemoved;t.includes(e)||t.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){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];const i={mesh:t};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:n,material:i,mode:s=4}=e,c={primitives:[{attributes:this._addAttributes(t),mode:s}]};if(n){const f=this._addIndices(n);c.primitives[0].indices=f}return Number.isFinite(i)&&(c.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(c),this.json.meshes.length-1}addPointCloud(e){const n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,t){const n=Py(e),i=t||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:i};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e,t=0,n=this.byteLength){const i=e.byteLength;ga(Number.isFinite(i)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const s={buffer:t,byteOffset:n,byteLength:i};return this.byteLength+=su(i,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(s),this.json.bufferViews.length-1}addAccessor(e,t){const n={bufferView:e,type:$8(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const n=this.addBufferView(e);let i={min:t.min,max:t.max};(!i.min||!i.max)&&(i=this._getAccessorMinMax(e,t.size));const s={size:t.size,componentType:ZC(e),count:Math.round(e.length/t.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(s,t))}addTexture(e){const{imageIndex:t}=e,n={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(n),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=[];const e=this.byteLength,t=new ArrayBuffer(e),n=new Uint8Array(t);let i=0;for(const s of this.sourceBuffers||[])i=D6(s,n,i);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=e:this.json.buffers=[{byteLength:e}],this.gltf.binary=t,this.sourceBuffers=[t]}_removeStringFromArray(e,t){let n=!0;for(;n;){const i=e.indexOf(t);i>-1?e.splice(i,1):n=!1}}_addAttributes(e={}){const t={};for(const n in e){const i=e[n],s=this._getGltfAttributeName(n),o=this.addBinaryBuffer(i.value,i);t[s]=o}return t}_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,t){const n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];const i=e.subarray(0,t);for(const s of i)n.min.push(s),n.max.push(s);for(let s=t;s<e.length;s+=t)for(let o=0;o<t;o++)n.min[0+o]=Math.min(n.min[0+o],e[s+o]),n.max[0+o]=Math.max(n.max[0+o],e[s+o]);return n}}function ZR(r){return(r%1+1)%1}const J8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},V_e={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},X8={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function eT(r,e){return X8[e]*J8[r]}function Wy(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;const i=r.getTypedArrayForBufferView(e),s=Jy(i,"SCALAR",t,n+1);return s instanceof BigInt64Array||s instanceof BigUint64Array?null:s}function Jy(r,e,t,n=1){const i=J8[e],s=V_e[t],o=X8[t],c=n*i,f=c*o;let A=r.buffer,v=r.byteOffset;return v%o!==0&&(A=new Uint8Array(A).slice(v,v+f).buffer,v=0),new s(A,v,c)}function tT(r,e,t){const n=`TEXCOORD_${e.texCoord||0}`,i=t.attributes[n],s=r.getTypedArrayForAccessor(i),o=r.gltf.json,c=e.index,f=o.textures?.[c]?.source;if(typeof f<"u"){const A=o.images?.[f]?.mimeType,v=r.gltf.images?.[f];if(v&&typeof v.width<"u"){const w=[];for(let S=0;S<s.length;S+=2){const F=H_e(v,A,s,S,e.channels);w.push(F)}return w}}return[]}function K8(r,e,t,n,i){if(!t?.length)return;const s=[];for(const v of t){let w=n.findIndex(S=>S===v);w===-1&&(w=n.push(v)-1),s.push(w)}const o=new Uint32Array(s),c=r.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,f=r.addBufferView(o,c,0),A=r.addAccessor(f,{size:1,componentType:ZC(o),count:o.length});i.attributes[e]=A}function H_e(r,e,t,n,i=[0]){const s={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=t[n],c=t[n+1];let f=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(f=4);const A=j_e(o,c,r,f);let v=0;for(const w of i){const S=typeof w=="number"?Object.values(s)[w]:s[w],F=A+S.offset,N=xC(r);if(N.data.length<=F)throw new Error(`${N.data.length} <= ${F}`);const U=N.data[F];v|=U<<S.shift}return v}function j_e(r,e,t,n=1){const i=t.width,s=ZR(r)*(i-1),o=Math.round(s),c=t.height,f=ZR(e)*(c-1),A=Math.round(f),v=t.components?t.components:n;return(A*i+o)*v}function q8(r,e,t,n,i){const s=[];for(let o=0;o<e;o++){const c=t[o],f=t[o+1]-t[o];if(f+c>n)break;const A=c/i,v=f/i;s.push(r.slice(A,A+v))}return s}function Y8(r,e,t){const n=[];for(let i=0;i<e;i++){const s=i*t;n.push(r.slice(s,s+t))}return n}function Z8(r,e,t,n){if(t)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){const i=[],s=new TextDecoder("utf8");let o=0;for(let c=0;c<r;c++){const f=n[c+1]-n[c];if(f+o<=e.length){const A=e.subarray(o,f+o),v=s.decode(A);i.push(v),o+=f}}return i}return[]}const Q8="EXT_mesh_features",$_e=Q8;async function W_e(r,e){const t=new vo(r);J_e(t,e)}function J_e(r,e){const t=r.gltf.json;if(t.meshes)for(const n of t.meshes)for(const i of n.primitives)X_e(r,i,e)}function X_e(r,e,t){if(!t?.gltf?.loadBuffers)return;const i=e.extensions?.[Q8]?.featureIds;if(i)for(const s of i){let o;if(typeof s.attribute<"u"){const c=`_FEATURE_ID_${s.attribute}`,f=e.attributes[c];o=r.getTypedArrayForAccessor(f)}else typeof s.texture<"u"&&t?.gltf?.loadImages?o=tT(r,s.texture,e):o=[];s.data=o}}const K_e=Object.freeze(Object.defineProperty({__proto__:null,decode:W_e,name:$_e},Symbol.toStringTag,{value:"Module"})),rT="EXT_structural_metadata",q_e=rT;async function Y_e(r,e){const t=new vo(r);Z_e(t,e)}function Z_e(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(rT);t&&(e.gltf?.loadImages&&Q_e(r,t),eye(r,t))}function Q_e(r,e){const t=e.propertyTextures,n=r.gltf.json;if(t&&n.meshes)for(const i of n.meshes)for(const s of i.primitives)rye(r,t,s,e)}function eye(r,e){const t=e.schema;if(!t)return;const n=t.classes,i=e.propertyTables;if(n&&i)for(const s in n){const o=tye(i,s);o&&iye(r,t,o)}}function tye(r,e){for(const t of r)if(t.class===e)return t;return null}function rye(r,e,t,n){if(!e)return;const s=t.extensions?.[rT]?.propertyTextures;if(s)for(const o of s){const c=e[o];nye(r,c,t,n)}}function nye(r,e,t,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);const i=e.class;for(const s in e.properties){const o=`${i}_${s}`,c=e.properties?.[s];if(!c)continue;c.data||(c.data=[]);const f=c.data,A=tT(r,c,t);A!==null&&(K8(r,o,A,f,t),c.data=f,n.dataAttributeNames.push(o))}}function iye(r,e,t){const n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],c=t.properties?.[s];if(c){const f=sye(r,e,o,i,c);c.data=f}}}function sye(r,e,t,n,i){let s=[];const o=i.values,c=r.getTypedArrayForBufferView(o),f=oye(r,t,i,n),A=aye(r,i,n);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{s=cye(t,n,c,f);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${t.type}`);case"STRING":{s=Z8(n,c,f,A);break}case"ENUM":{s=lye(e,t,n,c,f);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return s}function oye(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?Wy(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function aye(r,e,t){return typeof e.stringOffsets<"u"?Wy(r,e.stringOffsets,e.stringOffsetType||"UINT32",t):null}function cye(r,e,t,n){const i=r.array,s=r.count,o=eT(r.type,r.componentType),c=t.byteLength/o;let f;return r.componentType?f=Jy(t,r.type,r.componentType,c):f=t,i?n?q8(f,e,n,t.length,o):s?Y8(f,e,s):[]:f}function lye(r,e,t,n,i){const s=e.enumType;if(!s)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");const o=r.enums?.[s];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${s}`);const c=o.valueType||"UINT16",f=eT(e.type,c),A=n.byteLength/f;let v=Jy(n,e.type,c,A);if(v||(v=n),e.array){if(i)return uye({valuesData:v,numberOfElements:t,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:f,enumEntry:o});const w=e.count;return w?fye(v,t,w,o):[]}return nT(v,0,t,o)}function uye(r){const{valuesData:e,numberOfElements:t,arrayOffsets:n,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=r,c=[];for(let f=0;f<t;f++){const A=n[f],v=n[f+1]-n[f];if(v+A>i)break;const w=A/s,S=v/s,F=nT(e,w,S,o);c.push(F)}return c}function fye(r,e,t,n){const i=[];for(let s=0;s<e;s++){const o=t*s,c=nT(r,o,t,n);i.push(c)}return i}function nT(r,e,t,n){const i=[];for(let s=0;s<t;s++)if(r instanceof BigInt64Array||r instanceof BigUint64Array)i.push("");else{const o=r[e+s],c=hye(n,o);c?i.push(c.name):i.push("")}return i}function hye(r,e){for(const t of r.values)if(t.value===e)return t;return null}const dye=Object.freeze(Object.defineProperty({__proto__:null,decode:Y_e,name:q_e},Symbol.toStringTag,{value:"Module"})),eN="EXT_feature_metadata",pye=eN;async function Aye(r,e){const t=new vo(r);gye(t,e)}function gye(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(eN);t&&(e.gltf?.loadImages&&mye(r,t),_ye(r,t))}function mye(r,e){const t=e.schema;if(!t)return;const n=t.classes,{featureTextures:i}=e;if(n&&i)for(const s in n){const o=n[s],c=vye(i,s);c&&xye(r,c,o)}}function _ye(r,e){const t=e.schema;if(!t)return;const n=t.classes,i=e.featureTables;if(n&&i)for(const s in n){const o=yye(i,s);o&&bye(r,t,o)}}function yye(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function vye(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function bye(r,e,t){if(!t.class)return;const n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with 
4566name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],c=t.properties?.[s];if(c){const f=wye(r,e,o,i,c);c.data=f}}}function xye(r,e,t){const n=e.class;for(const i in t.properties){const s=e?.properties?.[i];if(s){const o=Sye(r,s,n);s.data=o}}}function wye(r,e,t,n,i){let s=[];const o=i.bufferView,c=r.getTypedArrayForBufferView(o),f=Cye(r,t,i,n),A=Tye(r,t,i,n);return t.type==="STRING"||t.componentType==="STRING"?s=Z8(n,c,f,A):Eye(t)&&(s=Bye(t,n,c,f)),s}function Cye(r,e,t,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof t.arrayOffsetBufferView<"u"?Wy(r,t.arrayOffsetBufferView,t.offsetType||"UINT32",n):null}function Tye(r,e,t,n){return typeof t.stringOffsetBufferView<"u"?Wy(r,t.stringOffsetBufferView,t.offsetType||"UINT32",n):null}function Eye(r){const e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(r.type)||typeof r.componentType<"u"&&e.includes(r.componentType)}function Bye(r,e,t,n){const i=r.type==="ARRAY",s=r.componentCount,o="SCALAR",c=r.componentType||r.type,f=eT(o,c),A=t.byteLength/f,v=Jy(t,o,c,A);return i?n?q8(v,e,n,t.length,f):s?Y8(v,e,s):[]:v}function Sye(r,e,t){const n=r.gltf.json;if(!n.meshes)return[];const i=[];for(const s of n.meshes)for(const o of s.primitives)Iye(r,t,e,i,o);return i}function Iye(r,e,t,n,i){const s={channels:t.channels,...t.texture},o=tT(r,s,i);o&&K8(r,e,o,n,i)}const Mye=Object.freeze(Object.defineProperty({__proto__:null,decode:Aye,name:pye},Symbol.toStringTag,{value:"Module"})),Pye="4.2.4",Vp=!0,QR=1735152710,iT=12,K_=8,Rye=1313821514,Fye=5130562,Dye=0,Oye=0,Lye=1;function kye(r,e=0){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))}`}function Nye(r,e=0,t={}){const n=new DataView(r),{magic:i=QR}=t,s=n.getUint32(e,!1);return s===i||s===QR}function Uye(r,e,t=0,n={}){const i=new DataView(e),s=kye(i,t+0),o=i.getUint32(t+4,Vp),c=i.getUint32(t+8,Vp);switch(Object.assign(r,{header:{byteOffset:t,byteLength:c,hasBinChunk:!1},type:s,version:o,json:{},binChunks:[]}),t+=iT,r.version){case 1:return zye(r,i,t);case 2:return Gye(r,i,t,n={});default:throw new Error(`Invalid GLB version ${r.version}. Only supports version 1 and 2.`)}}function zye(r,e,t){Ai(r.header.byteLength>iT+K_);const n=e.getUint32(t+0,Vp),i=e.getUint32(t+4,Vp);return t+=K_,Ai(i===Dye),Tx(r,e,t,n),t+=n,t+=Ex(r,e,t,r.header.byteLength),t}function Gye(r,e,t,n){return Ai(r.header.byteLength>iT+K_),Vye(r,e,t,n),t+r.header.byteLength}function Vye(r,e,t,n){for(;t+8<=r.header.byteLength;){const i=e.getUint32(t+0,Vp),s=e.getUint32(t+4,Vp);switch(t+=K_,s){case Rye:Tx(r,e,t,i);break;case Fye:Ex(r,e,t,i);break;case Oye:n.strict||Tx(r,e,t,i);break;case Lye:n.strict||Ex(r,e,t,i);break}t+=su(i,4)}return t}function Tx(r,e,t,n){const i=new Uint8Array(e.buffer,t,n),o=new TextDecoder("utf8").decode(i);return r.json=JSON.parse(o),su(n,4)}function Ex(r,e,t,n){return r.header.hasBinChunk=!0,r.binChunks.push({byteOffset:t,byteLength:n,arrayBuffer:e.buffer}),su(n,4)}function tN(r,e){if(r.startsWith("data:")||r.startsWith("http:")||r.startsWith("https:"))return r;const n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${r}`);return n.substr(0,n.lastIndexOf("/")+1)+r}
4566const Hye="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIA
4566LAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/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",jy
vendor: 10,663 bytes, line 4566
4566e="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",
vendor: 22,055 bytes, line 4566
4566$ye=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]),Wye=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]),Jye={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Xye={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Kye(r,e,t,n,i,s="NONE"){const o=await qye();Qye(o,o.exports[Xye[i]],r,e,t,n,o.exports[Jye[s||"NONE"]])}let F1;async function qye(){return F1||(F1=Yye()),F1}async function Yye(){let r=Hye;WebAssembly.validate($ye)&&(r=jye,console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(Zye(r),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function Zye(r){const e=new Uint8Array(r.length);for(let n=0;n<r.length;++n){const i=r.charCodeAt(n);e[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let t=0;for(let n=0;n<r.length;++n)e[t++]=e[n]<60?Wye[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,t)}function Qye(r,e,t,n,i,s,o){const c=r.exports.sbrk,f=n+3&-4,A=c(f*i),v=c(s.length),w=new Uint8Array(r.exports.memory.buffer);w.set(s,v);const S=e(A,n,i,v,s.length);if(S===0&&o&&o(A,f,i),t.set(w.subarray(A,A+n*i)),c(A-c(0)),S!==0)throw new Error(`Malformed buffer data: ${S}`)}const q_="EXT_meshopt_compression",eve=q_;async function tve(r,e){const t=new vo(r);if(!e?.gltf?.decompressMeshes||!e.gltf?.loadBuffers)return;const n=[];for(const i of r.json.bufferViews||[])n.push(rve(t,i));await Promise.all(n),t.removeExtension(q_)}async function rve(r,e){const t=r.getObjectExtension(e,q_);if(t){const{byteOffset:n=0,byteLength:i=0,byteStride:s,count:o,mode:c,filter:f="NONE",buffer:A}=t,v=r.gltf.buffers[A],w=new Uint8Array(v.arrayBuffer,v.byteOffset+n,i),S=new Uint8Array(r.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await Kye(S,o,s,w,c,f),r.removeObjectExtension(e,q_)}}const nve=Object.freeze(Object.defineProperty({__proto__:null,decode:tve,name:eve},Symbol.toStringTag,{value:"Module"})),tp="EXT_texture_webp",ive=tp;function sve(r,e){const t=new vo(r);if(!G6("image/webp")){if(t.getRequiredExtensions().includes(tp))throw new Error(`gltf: Required extension ${tp} not supported by browser`);return}const{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,tp);s&&(i.source=s.source),t.removeObjectExtension(i,tp)}t.removeExtension(tp)}const ove=Object.freeze(Object.defineProperty({__proto__:null,name:ive,preprocess:sve},Symbol.toStringTag,{value:"Module"})),i_="KHR_texture_basisu",ave=i_;function cve(r,e){const t=new vo(r),{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,i_);s&&(i.source=s.source,t.removeObjectExtension(i,i_))}t.removeExtension(i_)}const lve=Object.freeze(Object.defineProperty({__proto__:null,name:ave,preprocess:cve},Symbol.toStringTag,{value:"Module"}));function uve(r){const e={};for(const t in r){const n=r[t];if(t!=="indices"){const i=rN(n);e[t]=i}}return e}function rN(r){const{buffer:e,size:t,count:n}=fve(r);return{value:e,size:t,byteOffset:0,count:n,type:$8(t),componentType:ZC(e)}}function fve(r){let e=r,t=1,n=0;return r&&r.value&&(e=r.value,t=r.size||1),e&&(ArrayBuffer.isView(e)||(e=hve(e,Float32Array)),n=e.length/t),{buffer:e,size:t,count:n}}function hve(r,e,t=!1){return r?Array.isArray(r)?new e(r):t&&!(r instanceof e)?new e(r):r:null}const sf="KHR_draco_mesh_compression",dve=sf;function pve(r,e,t){const n=new vo(r);for(const i of nN(n))n.getObjectExtension(i,sf)}async function Ave(r,e,t){if(!e?.gltf?.decompressMeshes)return;const n=new vo(r),i=[];for(const s of nN(n))n.getObjectExtension(s,sf)&&i.push(mve(n,s,e,t));await Promise.all(i),n.removeExtension(sf)}function gve(r,e={}){const t=new vo(r);for(const n of t.json.meshes||[])_ve(n),t.addRequiredExtension(sf)}async function mve(r,e,t,n){const i=r.getObjectExtension(e,sf);if(!i)return;const s=r.getTypedArrayForBufferView(i.bufferView),o=Kg(s.buffer,s.byteOffset),c={...t};delete c["3d-tiles"];const f=await Bh(o,JC,c,n),A=uve(f.attributes);for(const[v,w]of Object.entries(A))if(v in e.attributes){const S=e.attributes[v],F=r.getAccessor(S);F?.min&&F?.max&&(w.min=F.min,w.max=F.max)}e.attributes=A,f.indices&&(e.indices=rN(f.indices)),r.removeObjectExtension(e,sf),yve(e)}function _ve(r,e,t=4,n,i){if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const s=n.DracoWriter.encodeSync({attributes:r}),o=i?.parseSync?.({attributes:r}),c=n._addFauxAttributes(o.attributes),f=n.addBufferView(s);return{primitives:[{attributes:c,mode:t,extensions:{[sf]:{bufferView:f,attributes:c}}}]}}function yve(r){if(!r.attributes&&Object.keys(r.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*nN(r){for(const e of r.json.meshes||[])for(const t of e.primitives)yield t}const vve=Object.freeze(Object.defineProperty({__proto__:null,decode:Ave,encode:gve,name:dve,preprocess:pve},Symbol.toStringTag,{value:"Module"})),Xy="KHR_texture_transform",bve=Xy,w0=new dt,xve=new gi,wve=new gi;async function Cve(r,e){if(!new vo(r).hasExtension(Xy)||!e.gltf?.loadBuffers)return;const i=r.json.materials||[];for(let s=0;s<i.length;s++)Tve(s,r)}function Tve(r,e){const t=e.json.materials?.[r],n=[t?.pbrMetallicRoughness?.baseColorTexture,t?.emissiveTexture,t?.normalTexture,t?.occlusionTexture,t?.pbrMetallicRoughness?.metallicRoughnessTexture],i=[];for(const s of n)s&&s?.extensions?.[Xy]&&Eve(e,r,s,i)}function Eve(r,e,t,n){const i=Bve(t,n);if(!i)return;const s=r.json.meshes||[];for(const o of s)for(const c of o.primitives){const f=c.material;Number.isFinite(f)&&e===f&&Sve(r,c,i)}}function Bve(r,e){const t=r.extensions?.[Xy],{texCoord:n=0}=r,{texCoord:i=n}=t;if(!(e.findIndex(([o,c])=>o===n&&c===i)!==-1)){const o=Pve(t);return n!==i&&(r.texCoord=i),e.push([n,i]),{originalTexCoord:n,texCoord:i,matrix:o}}return null}function Sve(r,e,t){const{originalTexCoord:n,texCoord:i,matrix:s}=t,o=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){const c=r.json.accessors?.[o];if(c&&c.bufferView){const f=r.json.bufferViews?.[c.bufferView];if(f){const{arrayBuffer:A,byteOffset:v}=r.buffers[f.buffer],w=(v||0)+(c.byteOffset||0)+(f.byteOffset||0),{ArrayType:S,length:F}=QC(c,f),N=j8[c.componentType],U=H8[c.type],$=f.byteStride||N*U,G=new Float32Array(F);for(let H=0;H<c.count;H++){const J=new S(A,w+H*$,2);w0.set(J[0],J[1],1),w0.transformByMatrix3(s),G.set([w0[0],w0[1]],H*U)}n===i?Ive(c,f,r.buffers,G):Mve(i,c,e,r,G)}}}}function Ive(r,e,t,n){r.componentType=5126,t.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),e.buffer=t.length-1,e.byteLength=n.buffer.byteLength,e.byteOffset=0,delete e.byteStride}function Mve(r,e,t,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});const s=n.json.bufferViews;if(!s)return;s.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});const o=n.json.accessors;o&&(o.push({bufferView:s?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),t.attributes[`TEXCOORD_${r}`]=o.length-1)}function Pve(r){const{offset:e=[0,0],rotation:t=0,scale:n=[1,1]}=r,i=new gi().set(1,0,0,0,1,0,e[0],e[1],1),s=xve.set(Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0,0,0,1),o=wve.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}const Rve=Object.freeze(Object.defineProperty({__proto__:null,decode:Cve,name:bve},Symbol.toStringTag,{value:"Module"})),th="KHR_lights_punctual",Fve=th;async function Dve(r){const e=new vo(r),{json:t}=e,n=e.getExtension(th);n&&(e.json.lights=n.lights,e.removeExtension(th));for(const i of t.nodes||[]){const s=e.getObjectExtension(i,th);s&&(i.light=s.light),e.removeObjectExtension(i,th)}}async function Ove(r){const e=new vo(r),{json:t}=e;if(t.lights){const n=e.addExtension(th);ga(!n.lights),n.lights=t.lights,delete t.lights}if(e.json.lights){for(const n of e.json.lights){const i=n.node;e.addObjectExtension(i,th,n)}delete e.json.lights}}const Lve=Object.freeze(Object.defineProperty({__proto__:null,decode:Dve,encode:Ove,name:Fve},Symbol.toStringTag,{value:"Module"})),Fg="KHR_materials_unlit",kve=Fg;async function Nve(r){const e=new vo(r),{json:t}=e;for(const n of t.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),e.removeObjectExtension(n,Fg);e.removeExtension(Fg)}function Uve(r){const e=new vo(r),{json:t}=e;if(e.materials)for(const n of t.materials||[])n.unlit&&(delete n.unlit,e.addObjectExtension(n,Fg,{}),e.addExtension(Fg))}const zve=Object.freeze(Object.defineProperty({__proto__:null,decode:Nve,encode:Uve,name:kve},Symbol.toStringTag,{value:"Module"})),ZA="KHR_techniques_webgl",Gve=ZA;async function Vve(r){const e=new vo(r),{json:t}=e,n=e.getExtension(ZA);if(n){const i=jve(n,e);for(const s of t.materials||[]){const o=e.getObjectExtension(s,ZA);o&&(s.technique=Object.assign({},o,i[o.technique]),s.technique.values=$ve(s.technique,e)),e.removeObjectExtension(s,ZA)}e.removeExtension(ZA)}}async function Hve(r,e){}function jve(r,e){const{programs:t=[],shaders:n=[],techniques:i=[]}=r,s=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=s.decode(e.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),t.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),i.forEach(o=>{o.program=t[o.program]}),i}function $ve(r,e){const t=Object.assign({},r.values);return Object.keys(r.uniforms||{}).forEach(n=>{r.uniforms[n].value&&!(n in t)&&(t[n]=r.uniforms[n].value)}),Object.keys(t).forEach(n=>{typeof t[n]=="object"&&t[n].index!==void 0&&(t[n].texture=e.getTexture(t[n].index))}),t}const Wve=Object.freeze(Object.defineProperty({__proto__:null,decode:Vve,encode:Hve,name:Gve},Symbol.toStringTag,{value:"Module"})),iN=[dye,K_e,nve,ove,lve,vve,Lve,zve,Wve,Rve,Mye];function Jve(r,e={},t){const n=iN.filter(i=>sN(i.name,e));for(const i of n)i.preprocess?.(r,e,t)}async function Xve(r,e={},t){const n=iN.filter(i=>sN(i.name,e));for(const i of n)await i.decode?.(r,e,t)}function sN(r,e){const t=e?.gltf?.excludeExtensions||{};return!(r in t&&!t[r])}const D1="KHR_binary_glTF";function Kve(r){const e=new vo(r),{json:t}=e;for(const n of t.images||[]){const i=e.getObjectExtension(n,D1);i&&Object.assign(n,i),e.removeObjectExtension(n,D1)}t.buffers&&t.buffers[0]&&delete t.buffers[0].uri,e.removeExtension(D1)}const eF={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},qve={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class Yve{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(e,t){this.json=e.json;const n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!t.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(n),this._convertTopLevelObjectsToArrays(n),Kve(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_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(const t in eF)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const n=e[t];if(!(!n||Array.isArray(n))){e[t]=[];for(const i in n){const s=n[i];s.id=s.id||i;const o=e[t].length;e[t].push(s),this.idToIndexMap[t][i]=o}}}_convertObjectIdsToArrayIndices(e){for(const t in eF)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:n,indices:i,material:s}=t;for(const o in n)n[o]=this._convertIdToIndex(n[o],"accessor");i&&(t.indices=this._convertIdToIndex(i,"accessor")),s&&(t.material=this._convertIdToIndex(s,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(t=>this._convertIdToIndex(t,"node"))),e.meshes&&(e.meshes=e.meshes.map(t=>this._convertIdToIndex(t,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(t=>this._convertIdToIndex(t,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn(`gltf v1: json doesn't contain attribute ${t}`),e[t]=[]);for(const n of e[t])for(const i in n){const s=n[i],o=this._convertIdToIndex(s,i);n[i]=o}}_convertIdToIndex(e,t){const n=qve[t];if(n in this.idToIndexMap){const i=this.idToIndexMap[n][e];if(!Number.isFinite(i))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return i}return e}_updateObjects(e){for(const t of this.json.buffers)delete t.type}_updateMaterial(e){for(const t of e.materials){t.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const n=t.values?.tex||t.values?.texture2d_0||t.values?.diffuseTex,i=e.textures.findIndex(s=>s.id===n);i!==-1&&(t.pbrMetallicRoughness.baseColorTexture={index:i})}}}function Zve(r,e={}){return new Yve().normalize(r,e)}async function Qve(r,e,t=0,n,i){return ebe(r,e,t,n),Zve(r,{normalize:n?.gltf?.normalize}),Jve(r,n,i),n?.gltf?.loadBuffers&&r.json.buffers&&await tbe(r,n,i),n?.gltf?.loadImages&&await rbe(r,n,i),await Xve(r,n,i),r}function ebe(r,e,t,n){if(n.uri&&(r.baseUri=n.uri),e instanceof ArrayBuffer&&!Nye(e,t,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")r.json=F6(e);else if(e instanceof ArrayBuffer){const o={};t=Uye(o,e,t,n.glb),ga(o.type==="glTF",`Invalid GLB magic string ${o.type}`),r._glb=o,r.json=o.json}else ga(!1,"GLTF: must be ArrayBuffer or string");const i=r.json.buffers||[];if(r.buffers=new Array(i.length).fill(null),r._glb&&r._glb.header.hasBinChunk){const{binChunks:o}=r._glb;r.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}const s=r.json.images||[];r.images=new Array(s.length).fill({})}async function tbe(r,e,t){const n=r.json.buffers||[];for(let i=0;i<n.length;++i){const s=n[i];if(s.uri){const{fetch:o}=t;ga(o);const c=tN(s.uri,e),A=await(await t?.fetch?.(c))?.arrayBuffer?.();r.buffers[i]={arrayBuffer:A,byteOffset:0,byteLength:A.byteLength},delete s.uri}else r.buffers[i]===null&&(r.buffers[i]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}async function rbe(r,e,t){const n=nbe(r),i=r.json.images||[],s=[];for(const o of n)s.push(ibe(r,i[o],o,e,t));return await Promise.all(s)}function nbe(r){const e=new Set,t=r.json.textures||[];for(const n of t)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function ibe(r,e,t,n,i){let s;if(e.uri&&!e.hasOwnProperty("bufferView")){const c=tN(e.uri,n),{fetch:f}=i;s=await(await f(c)).arrayBuffer(),e.bufferView={data:s}}if(Number.isFinite(e.bufferView)){const c=U_e(r.json,r.buffers,e.bufferView);s=Kg(c.buffer,c.byteOffset,c.byteLength)}ga(s,"glTF image has no data");let o=await Bh(s,[Pg,C8],{...n,mimeType:e.mimeType,basis:n.basis||{format:$C()}},i);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),r.images=r.images||[],r.images[t]=o}const Y_={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:Pye,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:sbe,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function sbe(r,e={},t){e={...Y_.options,...e},e.gltf={...Y_.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await Qve({},r,n,e,t)}const obe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},abe={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Oa={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},cbe={magFilter:Oa.TEXTURE_MAG_FILTER,minFilter:Oa.TEXTURE_MIN_FILTER,wrapS:Oa.TEXTURE_WRAP_S,wrapT:Oa.TEXTURE_WRAP_T},lbe={[Oa.TEXTURE_MAG_FILTER]:Oa.LINEAR,[Oa.TEXTURE_MIN_FILTER]:Oa.NEAREST_MIPMAP_LINEAR,[Oa.TEXTURE_WRAP_S]:Oa.REPEAT,[Oa.TEXTURE_WRAP_T]:Oa.REPEAT};function ube(){return{id:"default-sampler",parameters:lbe}}function fbe(r){return abe[r]}function hbe(r){return obe[r]}class dbe{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(e,t={}){const{json:n,buffers:i=[],images:s=[]}=e,{baseUri:o=""}=e;return ga(n),this.baseUri=o,this.buffers=i,this.images=s,this.jsonUnprocessed=n,this.json=this._resolveTree(e.json,t),this.json}_resolveTree(e,t={}){const n={...e};return this.json=n,e.bufferViews&&(n.bufferViews=e.bufferViews.map((i,s)=>this._resolveBufferView(i,s))),e.images&&(n.images=e.images.map((i,s)=>this._resolveImage(i,s))),e.samplers&&(n.samplers=e.samplers.map((i,s)=>this._resolveSampler(i,s))),e.textures&&(n.textures=e.textures.map((i,s)=>this._resolveTexture(i,s))),e.accessors&&(n.accessors=e.accessors.map((i,s)=>this._resolveAccessor(i,s))),e.materials&&(n.materials=e.materials.map((i,s)=>this._resolveMaterial(i,s))),e.meshes&&(n.meshes=e.meshes.map((i,s)=>this._resolveMesh(i,s))),e.nodes&&(n.nodes=e.nodes.map((i,s)=>this._resolveNode(i,s)),n.nodes=n.nodes.map((i,s)=>this._resolveNodeChildren(i))),e.skins&&(n.skins=e.skins.map((i,s)=>this._resolveSkin(i,s))),e.scenes&&(n.scenes=e.scenes.map((i,s)=>this._resolveScene(i,s))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}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,t){if(typeof t=="object")return t;const n=e&&e[t];return n||console.warn(`glTF file error: Could not find ${e}[${t}]`),n}_resolveScene(e,t){return{...e,id:e.id||`scene-${t}`,nodes:(e.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(e,t){const n={...e,id:e?.id||`node-${t}`};return e.mesh!==void 0&&(n.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(n.camera=this.getCamera(e.camera)),e.skin!==void 0&&(n.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(n.mesh=e.meshes.reduce((i,s)=>{const o=this.getMesh(s);return i.id=o.id,i.primitives=i.primitives.concat(o.primitives),i},{primitives:[]})),n}_resolveNodeChildren(e){return e.children&&(e.children=e.children.map(t=>this.getNode(t))),e}_resolveSkin(e,t){const n=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${t}`,inverseBindMatrices:n}}_resolveMesh(e,t){const n={...e,id:e.id||`mesh-${t}`,primitives:[]};return e.primitives&&(n.primitives=e.primitives.map(i=>{const s={...i,attributes:{},indices:void 0,material:void 0},o=i.attributes;for(const c in o)s.attributes[c]=this.getAccessor(o[c]);return i.indices!==void 0&&(s.indices=this.getAccessor(i.indices)),i.material!==void 0&&(s.material=this.getMaterial(i.material)),s})),n}_resolveMaterial(e,t){const n={...e,id:e.id||`material-${t}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};const i=n.pbrMetallicRoughness;i.baseColorTexture&&(i.baseColorTexture={...i.baseColorTexture},i.baseColorTexture.texture=this.getTexture(i.baseColorTexture.index)),i.metallicRoughnessTexture&&(i.metallicRoughnessTexture={...i.metallicRoughnessTexture},i.metallicRoughnessTexture.texture=this.getTexture(i.metallicRoughnessTexture.index))}return n}_resolveAccessor(e,t){const n=fbe(e.componentType),i=hbe(e.type),s=n*i,o={...e,id:e.id||`accessor-${t}`,bytesPerComponent:n,components:i,bytesPerElement:s,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(o.bufferView=this.getBufferView(e.bufferView)),o.bufferView){const c=o.bufferView.buffer,{ArrayType:f,byteLength:A}=QC(o,o.bufferView),v=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+c.byteOffset;let w=c.arrayBuffer.slice(v,v+A);o.bufferView.byteStride&&(w=this._getValueFromInterleavedBuffer(c,v,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new f(w)}return o}_getValueFromInterleavedBuffer(e,t,n,i,s){const o=new Uint8Array(s*i);for(let c=0;c<s;c++){const f=t+c*n;o.set(new Uint8Array(e.arrayBuffer.slice(f,f+i)),c*i)}return o.buffer}_resolveTexture(e,t){return{...e,id:e.id||`texture-${t}
4566`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):ube(),source:typeof e.source=="number"?this.getImage(e.source):void 0}}_resolveSampler(e,t){const n={id:e.id||`sampler-${t}`,...e,parameters:{}};for(const i in n){const s=this._enumSamplerParameter(i);s!==void 0&&(n.parameters[s]=n[i])}return n}_enumSamplerParameter(e){return cbe[e]}_resolveImage(e,t){const n={...e,id:e.id||`image-${t}`,image:null,bufferView:e.bufferView!==void 0?this.getBufferView(e.bufferView):void 0},i=this.images[t];return i&&(n.image=i),n}_resolveBufferView(e,t){const n=e.buffer,i=this.buffers[n].arrayBuffer;let s=this.buffers[n].byteOffset||0;return e.byteOffset&&(s+=e.byteOffset),{id:`bufferView-${t}`,...e,buffer:this.buffers[n],data:new Uint8Array(i,s,e.byteLength)}}_resolveCamera(e,t){const n={...e,id:e.id||`camera-${t}`};return n.perspective,n.orthographic,n}}function oN(r,e){return new dbe().postProcess(r,e)}const Bx={URI:0,EMBEDDED:1};function aN(r,e,t,n){r.rotateYtoZ=!0;const i=(r.byteOffset||0)+(r.byteLength||0)-t;if(i===0)throw new Error("glTF byte length must be greater than 0.");return r.gltfUpAxis=n?.["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",r.gltfArrayBuffer=Kg(e,t,i),r.gltfByteOffset=0,r.gltfByteLength=i,t%4===0||console.warn(`${r.type}: embedded glb is not aligned to a 4-byte boundary.`),(r.byteOffset||0)+(r.byteLength||0)}async function cN(r,e,t,n){const i=t?.["3d-tiles"]||{};if(pbe(r,e),i.loadGLTF){if(!n)return;if(r.gltfUrl){const{fetch:s}=n,o=await s(r.gltfUrl,t);r.gltfArrayBuffer=await o.arrayBuffer(),r.gltfByteOffset=0}if(r.gltfArrayBuffer){const s=await Bh(r.gltfArrayBuffer,Y_,t,n);r.gltf=oN(s),r.gpuMemoryUsageInBytes=W8(r.gltf),delete r.gltfArrayBuffer,delete r.gltfByteOffset,delete r.gltfByteLength}}}function pbe(r,e,t){switch(e){case Bx.URI:if(r.gltfArrayBuffer){const n=new Uint8Array(r.gltfArrayBuffer,r.gltfByteOffset),s=new TextDecoder().decode(n);r.gltfUrl=s.replace(/[\s\0]+$/,"")}delete r.gltfArrayBuffer,delete r.gltfByteOffset,delete r.gltfByteLength;break;case Bx.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Abe(r,e,t,n,i){t=gbe(r,e,t,n),await cN(r,Bx.EMBEDDED,n,i);const s=r?.gltf?.extensions;return s&&s.CESIUM_RTC&&(r.rtcCenter=s.CESIUM_RTC.center),t}function gbe(r,e,t,n,i){t=$y(r,e,t),t=qC(r,e,t),t=YC(r,e,t),t=aN(r,e,t,n);const s=new KC(r.featureTableJson,r.featureTableBinary);return r.rtcCenter=s.getGlobalProperty("RTC_CENTER",Un.FLOAT,3),t}async function mbe(r,e,t,n,i){return t=_be(r,e,t,n),await cN(r,r.gltfFormat||0,n,i),t}function _be(r,e,t,n,i){if(t=$y(r,e,t),r.version!==1)throw new Error(`Instanced 3D Model version ${r.version} is not supported`);t=qC(r,e,t);const s=new DataView(e);if(r.gltfFormat=s.getUint32(t,!0),t+=4,t=YC(r,e,t),t=aN(r,e,t,n),!r?.header?.featureTableJsonByteLength||r.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new KC(r.featureTableJson,r.featureTableBinary),c=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");r.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),r.rtcCenter=o.getGlobalProperty("RTC_CENTER",Un.FLOAT,3);const f=new G8(r.batchTableJson,r.batchTableBinary,c);return ybe(r,o,f,c),t}function ybe(r,e,t,n){const i=new Array(n),s=new dt;new dt,new dt,new dt;const o=new gi,c=new vg,f=new dt,A={},v=new vn,w=[],S=[],F=[],N=[];for(let U=0;U<n;U++){let $;if(e.hasProperty("POSITION"))$=e.getProperty("POSITION",Un.FLOAT,3,U,s);else if(e.hasProperty("POSITION_QUANTIZED")){$=e.getProperty("POSITION_QUANTIZED",Un.UNSIGNED_SHORT,3,U,s);const se=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Un.FLOAT,3);if(!se)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const Te=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Un.FLOAT,3);if(!Te)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const Ue=65535;for(let de=0;de<3;de++)$[de]=$[de]/Ue*Te[de]+se[de]}if(!$)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");if(s.copy($),A.translation=s,r.normalUp=e.getProperty("NORMAL_UP",Un.FLOAT,3,U,w),r.normalRight=e.getProperty("NORMAL_RIGHT",Un.FLOAT,3,U,S),r.normalUp){if
vendor: 2,014 bytes, line 4566
4566(!r.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");r.hasCustomOrientation=!0}else{if(r.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",Un.UNSIGNED_SHORT,2,U,w),r.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",Un.UNSIGNED_SHORT,2,U,S),r.octNormalUp)throw r.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");r.eastNorthUp?(wi.WGS84.eastNorthUpToFixedFrame(s,v),v.getRotationMatrix3(o)):o.identity()}c.fromMatrix3(o),A.rotation=c,f.set(1,1,1);const G=e.getProperty("SCALE",Un.FLOAT,1,U,F);Number.isFinite(G)&&f.multiplyByScalar(G);const H=e.getProperty("SCALE_NON_UNIFORM",Un.FLOAT,3,U,w);H&&f.scale(H),A.scale=f;let J=e.getProperty("BATCH_ID",Un.UNSIGNED_SHORT,1,U,N);J===void 0&&(J=U);const ue=new vn().fromQuaternion(A.rotation);v.identity(),v.translate(A.translation),v.multiplyRight(ue),v.scale(A.scale);const q=v.clone();i[U]={modelMatrix:q,batchId:J}}r.instances=i}async function vbe(r,e,t,n,i,s){t=$y(r,e,t);const o=new DataView(e);for(r.tilesLength=o.getUint32(t,!0),t+=4,r.tiles=[];r.tiles.length<r.tilesLength&&(r.byteLength||0)-t>12;){const c={shape:"tile3d"};r.tiles.push(c),t=await s(e,t,n,i,c)}return t}async function bbe(r,e,t,n){if(r.rotateYtoZ=!0,r.gltfUpAxis=t?.["3d-tiles"]?.assetGltfUpAxis?t["3d-tiles"].assetGltfUpAxis:"Y",t?.["3d-tiles"]?.loadGLTF){if(!n)return e.byteLength;const i=await Bh(e,Y_,t,n);r.gltf=oN(i),r.gpuMemoryUsageInBytes=W8(r.gltf)}else r.gltfArrayBuffer=e;return e.byteLength}async function lN(r,e=0,t,n,i={shape:"tile3d"}){switch(i.byteOffset=e,i.type=r_e(r,e),i.type){case UA.COMPOSITE:return await vbe(i,r,e,t,n,lN);case UA.BATCHED_3D_MODEL:return await Abe(i,r,e,t,n);case UA.GLTF:return await bbe(i,r,t,n);case UA.INSTANCED_3D_MODEL:return await mbe(i,r,e,t,n);case UA.POINT_CLOUD:return await C_e(i,r,e,t,n);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}const xbe=1952609651,wbe=1;
vendor: 5,843 bytes, line 4566
4566async function Cbe(r,e,t){if(new Uint32Array(r.slice(0,4))[0]!==xbe)throw new Error("Wrong subtree file magic number");if(new Uint32Array(r.slice(4,8))[0]!==wbe)throw new Error("Wrong subtree file verson, must be 1");const s=tF(r.slice(8,16)),o=new Uint8Array(r,24,s),f=new TextDecoder("utf8").decode(o),A=JSON.parse(f),v=tF(r.slice(16,24));let w=new ArrayBuffer(0);if(v&&(w=r.slice(24+s)),await C0(A,A.tileAvailability,w,t),Array.isArray(A.contentAvailability))for(const S of A.contentAvailability)await C0(A,S,w,t);else await C0(A,A.contentAvailability,w,t);return await C0(A,A.childSubtreeAvailability,w,t),A}async function C0(r,e,t,n){const i=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if(typeof i!="number")return;const s=r.bufferViews[i],o=r.buffers[s.buffer];if(!n?.baseUrl)throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(o.uri){const f=`${n?.baseUrl||""}/${o.uri}`,v=await(await n.fetch(f)).arrayBuffer();e.explicitBitstream=new Uint8Array(v,s.byteOffset,s.byteLength);return}const c=r.buffers.slice(0,s.buffer).reduce((f,A)=>f+A.byteLength,0);e.explicitBitstream=new Uint8Array(t.slice(c,c+o.byteLength),s.byteOffset,s.byteLength)}function tF(r){const e=new DataView(r),t=e.getUint32(0,!0),n=e.getUint32(4,!0);return t+2**32*n}const uN={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:N8,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Cbe,options:{}};var Ua=null;try{Ua=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 ai(r,e,t){this.low=r|0,this.high=e|0,this.unsigned=!!t}ai.prototype.__isLong__;Object.defineProperty(ai.prototype,"__isLong__",{value:!0});function bo(r){return(r&&r.__isLong__)===!0}function rF(r){var e=Math.clz32(r&-r);return r?31-e:e}ai.isLong=bo;var nF={},iF={};function Sh(r,e){var t,n,i;return e?(r>>>=0,(i=0<=r&&r<256)&&(n=iF[r],n)?n:(t=Gn(r,0,!0),i&&(iF[r]=t),t)):(r|=0,(i=-128<=r&&r<128)&&(n=nF[r],n)?n:(t=Gn(r,r<0?-1:0,!1),i&&(nF[r]=t),t))}ai.fromInt=Sh;function za(r,e){if(isNaN(r))return e?Zl:wc;if(e){if(r<0)return Zl;if(r>=fN)return pN}else{if(r<=-oF)return jo;if(r+1>=oF)return dN}return r<0?za(-r,e).neg():Gn(r%Hp|0,r/Hp|0,e)}ai.fromNumber=za;function Gn(r,e,t){return new ai(r,e,t)}ai.fromBits=Gn;var Z_=Math.pow;function sT(r,e,t){if(r.length===0)throw Error("empty string");if(typeof e=="number"?(t=e,e=!1):e=!!e,r==="NaN"||r==="Infinity"||r==="+Infinity"||r==="-Infinity")return e?Zl:wc;if(t=t||10,t<2||36<t)throw RangeError("radix");var n;if((n=r.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return sT(r.substring(1),e,t).neg();for(var i=za(Z_(t,8)),s=wc,o=0;o<r.length;o+=8){var c=Math.min(8,r.length-o),f=parseInt(r.substring(o,o+c),t);if(c<8){var A=za(Z_(t,c));s=s.mul(A).add(za(f))}else s=s.mul(i),s=s.add(za(f))}return s.unsigned=e,s}ai.fromString=sT;function Mc(r,e){return typeof r=="number"?za(r,e):typeof r=="string"?sT(r,e):Gn(r.low,r.high,typeof e=="boolean"?e:r.unsigned)}ai.fromValue=Mc;var sF=65536,Tbe=1<<24,Hp=sF*sF,fN=Hp*Hp,oF=fN/2,aF=Sh(Tbe),wc=Sh(0);ai.ZERO=wc;var Zl=Sh(0,!0);ai.UZERO=Zl;var gp=Sh(1);ai.ONE=gp;var hN=Sh(1,!0);ai.UONE=hN;var Sx=Sh(-1);ai.NEG_ONE=Sx;var dN=Gn(-1,2147483647,!1);ai.MAX_VALUE=dN;var pN=Gn(-1,-1,!0);ai.MAX_UNSIGNED_VALUE=pN;var jo=Gn(0,-2147483648,!1);ai.MIN_VALUE=jo;var rr=ai.prototype;rr.toInt=function(){return this.unsigned?this.low>>>0:this.low};rr.toNumber=function(){return this.unsigned?(this.high>>>0)*Hp+(this.low>>>0):this.high*Hp+(this.low>>>0)};rr.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(jo)){var t=za(e),n=this.div(t),i=n.mul(t).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=za(Z_(e,6),this.unsigned),o=this,c="";;){var f=o.div(s),A=o.sub(f.mul(s)).toInt()>>>0,v=A.toString(e);if(o=f,o.isZero())return v+c;for(;v.length<6;)v="0"+v;c=""+v+c}};rr.getHighBits=function(){return this.high};rr.getHighBitsUnsigned=function(){return this.high>>>0};rr.getLowBits=function(){return this.low};rr.getLowBitsUnsigned=function(){return this.low>>>0};rr.getNumBitsAbs=function(){if(this.isNegative())return this.eq(jo)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,t=31;t>0&&(e&1<<t)==0;t--);return this.high!=0?t+33:t+1};rr.isZero=function(){return this.high===0&&this.low===0};rr.eqz=rr.isZero;rr.isNegative=function(){return!this.unsigned&&this.high<0};rr.isPositive=function(){return this.unsigned||this.high>=0};rr.isOdd=function(){return(this.low&1)===1};rr.isEven=function(){return(this.low&1)===0};rr.equals=function(e){return bo(e)||(e=Mc(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};rr.eq=rr.equals;rr.notEquals=function(e){return!this.eq(e)};rr.neq=rr.notEquals;rr.ne=rr.notEquals;rr.lessThan=function(e){return this.comp(e)<0}
vendor: 5,521 bytes, line 4566
4566;rr.lt=rr.lessThan;rr.lessThanOrEqual=function(e){return this.comp(e)<=0};rr.lte=rr.lessThanOrEqual;rr.le=rr.lessThanOrEqual;rr.greaterThan=function(e){return this.comp(e)>0};rr.gt=rr.greaterThan;rr.greaterThanOrEqual=function(e){return this.comp(e)>=0};rr.gte=rr.greaterThanOrEqual;rr.ge=rr.greaterThanOrEqual;rr.compare=function(e){if(bo(e)||(e=Mc(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?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};rr.comp=rr.compare;rr.negate=function(){return!this.unsigned&&this.eq(jo)?jo:this.not().add(gp)};rr.neg=rr.negate;rr.add=function(e){bo(e)||(e=Mc(e));var t=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,c=e.high&65535,f=e.low>>>16,A=e.low&65535,v=0,w=0,S=0,F=0;return F+=s+A,S+=F>>>16,F&=65535,S+=i+f,w+=S>>>16,S&=65535,w+=n+c,v+=w>>>16,w&=65535,v+=t+o,v&=65535,Gn(S<<16|F,v<<16|w,this.unsigned)};rr.subtract=function(e){return bo(e)||(e=Mc(e)),this.add(e.neg())};rr.sub=rr.subtract;rr.multiply=function(e){if(this.isZero())return this;if(bo(e)||(e=Mc(e)),Ua){var t=Ua.mul(this.low,this.high,e.low,e.high);return Gn(t,Ua.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?Zl:wc;if(this.eq(jo))return e.isOdd()?jo:wc;if(e.eq(jo))return this.isOdd()?jo:wc;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(aF)&&e.lt(aF))return za(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,c=e.high>>>16,f=e.high&65535,A=e.low>>>16,v=e.low&65535,w=0,S=0,F=0,N=0;return N+=o*v,F+=N>>>16,N&=65535,F+=s*v,S+=F>>>16,F&=65535,F+=o*A,S+=F>>>16,F&=65535,S+=i*v,w+=S>>>16,S&=65535,S+=s*A,w+=S>>>16,S&=65535,S+=o*f,w+=S>>>16,S&=65535,w+=n*v+i*A+s*f+o*c,w&=65535,Gn(F<<16|N,w<<16|S,this.unsigned)};rr.mul=rr.multiply;rr.divide=function(e){if(bo(e)||(e=Mc(e)),e.isZero())throw Error("division by zero");if(Ua){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var t=(this.unsigned?Ua.div_u:Ua.div_s)(this.low,this.high,e.low,e.high);return Gn(t,Ua.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Zl:wc;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Zl;if(e.gt(this.shru(1)))return hN;s=Zl}else{if(this.eq(jo)){if(e.eq(gp)||e.eq(Sx))return jo;if(e.eq(jo))return gp;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(wc)?e.isNegative()?gp:Sx:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else if(e.eq(jo))return this.unsigned?Zl:wc;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();s=wc}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),f=c<=48?1:Z_(2,c-48),A=za(n),v=A.mul(e);v.isNegative()||v.gt(i);)n-=f,A=za(n,this.unsigned),v=A.mul(e);A.isZero()&&(A=gp),s=s.add(A),i=i.sub(v)}return s};rr.div=rr.divide;rr.modulo=function(e){if(bo(e)||(e=Mc(e)),Ua){var t=(this.unsigned?Ua.rem_u:Ua.rem_s)(this.low,this.high,e.low,e.high);return Gn(t,Ua.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};rr.mod=rr.modulo;rr.rem=rr.modulo;rr.not=function(){return Gn(~this.low,~this.high,this.unsigned)};rr.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};rr.clz=rr.countLeadingZeros;rr.countTrailingZeros=function(){return this.low?rF(this.low):rF(this.high)+32};rr.ctz=rr.countTrailingZeros;rr.and=function(e){return bo(e)||(e=Mc(e)),Gn(this.low&e.low,this.high&e.high,this.unsigned)};rr.or=function(e){return bo(e)||(e=Mc(e)),Gn(this.low|e.low,this.high|e.high,this.unsigned)};rr.xor=function(e){return bo(e)||(e=Mc(e)),Gn(this.low^e.low,this.high^e.high,this.unsigned)};rr.shiftLeft=function(e){return bo(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Gn(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Gn(0,this.low<<e-32,this.unsigned)};rr.shl=rr.shiftLeft;rr.shiftRight=function(e){return bo(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Gn(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Gn(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};rr.shr=rr.shiftRight;rr.shiftRightUnsigned=function(e){return bo(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Gn(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?Gn(this.high,0,this.unsigned):Gn(this.high>>>e-32,0,this.unsigned)};rr.shru=rr.shiftRightUnsigned;rr.shr_u=rr.shiftRightUnsigned;rr.rotateLeft=function(e){var t;return bo(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?Gn(this.high,this.low,this.unsigned):e<32?(t=32-e,Gn(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(e-=32,t=32-e,Gn(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))};rr.rotl=rr.rotateLeft;rr.rotateRight=function(e){var t;return bo(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?Gn(this.high,this.low,this.unsigned):e<32?(t=32-e,Gn(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(e-=32,t=32-e,Gn(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))};rr.rotr=rr.rotateRight;rr.toSigned=function(){return this.unsigned?Gn(this.low,this.high,!1):this};rr.toUnsigned=function(){return this.unsigned?this:Gn(this.low,this.high,!0)};rr.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};rr.toBytesLE=function(){var e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>
vendor: 6,412 bytes, line 4566
4566>8&255,e>>>16&255,e>>>24]};rr.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,t>>>24,t>>>16&255,t>>>8&255,t&255]};ai.fromBytes=function(e,t,n){return n?ai.fromBytesLE(e,t):ai.fromBytesBE(e,t)};ai.fromBytesLE=function(e,t){return new ai(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)};ai.fromBytesBE=function(e,t){return new ai(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};const Ebe=16;function AN(r){r==="X"&&(r="");const e=r.padEnd(Ebe,"0");return ai.fromString(e,!0,16)}function Bbe(r){if(r.isZero())return"X";let e=r.countTrailingZeros();const t=e%4;e=(e-t)/4;const n=e;e*=4;const s=r.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-s.length).join("0")+s}function Sbe(r,e){const t=Ibe(r).shiftRightUnsigned(2);return r.add(ai.fromNumber(2*e+1-4).multiply(t))}function Ibe(r){return r.and(r.not().add(1))}const Mbe=3,Pbe=30,Rbe=2*Pbe+1,cF=180/Math.PI;function Fbe(r){if(r.length===0)throw new Error(`Invalid Hilbert quad key ${r}`);const e=r.split("/"),t=parseInt(e[0],10),n=e[1],i=n.length;let s=0;const o=[0,0];for(let c=i-1;c>=0;c--){s=i-c;const f=n[c];let A=0,v=0;f==="1"?v=1:f==="2"?(A=1,v=1):f==="3"&&(A=1);const w=Math.pow(2,s-1);Obe(w,o,A,v),o[0]+=w*A,o[1]+=w*v}if(t%2===1){const c=o[0];o[0]=o[1],o[1]=c}return{face:t,ij:o,level:s}}function Dbe(r){if(r.isZero())return"";let e=r.toString(2);for(;e.length<Mbe+Rbe;)e="0"+e;const t=e.lastIndexOf("1"),n=e.substring(0,3),i=e.substring(3,t),s=i.length/2,o=ai.fromString(n,!0,2).toString(10);let c="";if(s!==0)for(c=ai.fromString(i,!0,2).toString(4);c.length<s;)c="0"+c;return`${o}/${c}`}function gN(r,e,t){const n=1<<e;return[(r[0]+t[0])/n,(r[1]+t[1])/n]}function lF(r){return r>=.5?1/3*(4*r*r-1):1/3*(1-4*(1-r)*(1-r))}function mN(r){return[lF(r[0]),lF(r[1])]}function _N(r,[e,t]){switch(r){case 0:return[1,e,t];case 1:return[-e,1,t];case 2:return[-e,-t,1];case 3:return[-1,-t,-e];case 4:return[t,-1,-e];case 5:return[t,e,-1];default:throw new Error("Invalid face")}}function yN([r,e,t]){const n=Math.atan2(t,Math.sqrt(r*r+e*e));return[Math.atan2(e,r)*cF,n*cF]}function Obe(r,e,t,n){if(n===0){t===1&&(e[0]=r-1-e[0],e[1]=r-1-e[1]);const i=e[0];e[0]=e[1],e[1]=i}}function Lbe(r){const e=gN(r.ij,r.level,[.5,.5]),t=mN(e),n=_N(r.face,t);return yN(n)}const kbe=100;function uF(r){const{face:e,ij:t,level:n}=r,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(kbe*Math.pow(2,-n))),o=new Float64Array(4*s*2+2);let c=0,f=0;for(let A=0;A<4;A++){const v=i[A].slice(0),w=i[A+1],S=(w[0]-v[0])/s,F=(w[1]-v[1])/s;for(let N=0;N<s;N++){v[0]+=S,v[1]+=F;const U=gN(t,n,v),$=mN(U),G=_N(e,$),H=yN(G);Math.abs(H[1])>89.999&&(H[0]=f);const J=H[0]-f;H[0]+=J>180?-360:J<-180?360:0,o[c++]=H[0],o[c++]=H[1],f=H[0]}}return o[c++]=o[0],o[c++]=o[1],o}function oT(r){const e=Nbe(r);return Fbe(e)}function Nbe(r){if(r.indexOf("/")>0)return r;const e=AN(r);return Dbe(e)}function Ube(r){const e=oT(r);return Lbe(e)}function zbe(r){let e;if(r.face===2||r.face===5){let t=null,n=0;for(let i=0;i<4;i++){const s=`${r.face}/${i}`,o=oT(s),c=uF(o);(typeof t>"u"||t===null)&&(t=new Float64Array(4*c.length)),t.set(c,n),n+=c.length}e=fF(t)}else{const t=uF(r);e=fF(t)}return e}function fF(r){if(r.length%2!==0)throw new Error("Invalid corners");const e=[],t=[];for(let n=0;n<r.length;n+=2)e.push(r[n]),t.push(r[n+1]);return e.sort((n,i)=>n-i),t.sort((n,i)=>n-i),{west:e[0],east:e[e.length-1],north:t[t.length-1],south:t[0]}}function Gbe(r,e){const t=e?.minimumHeight||0,n=e?.maximumHeight||0,i=oT(r),s=zbe(i),o=s.west,c=s.south,f=s.east,A=s.north,v=[];return v.push(new dt(o,A,t)),v.push(new dt(f,A,t)),v.push(new dt(f,c,t)),v.push(new dt(o,c,t)),v.push(new dt(o,A,n)),v.push(new dt(f,A,n)),v.push(new dt(f,c,n)),v.push(new dt(o,c,n)),v}function vN(r){const e=r.token,t={minimumHeight:r.minimumHeight,maximumHeight:r.maximumHeight},n=Gbe(e,t),i=Ube(e),s=i[0],o=i[1],c=wi.WGS84.cartographicToCartesian([s,o,t.maximumHeight]),f=new dt(c[0],c[1],c[2]);n.push(f);const A=H6(n);return[...A.center,...A.halfAxes]}const Vbe=4,Hbe=8,jbe={QUADTREE:Vbe,OCTREE:Hbe};function $be(r,e,t){if(r?.box){const n=AN(r.s2VolumeInfo.token),i=Sbe(n,e),s=Bbe(i),o={...r.s2VolumeInfo};switch(o.token=s,t){case"OCTREE":const A=r.s2VolumeInfo,v=A.maximumHeight-A.minimumHeight,w=v/2,S=A.minimumHeight+v/2;A.minimumHeight=S-w,A.maximumHeight=S+w;break}return{box:vN(o),s2VolumeInfo:o}}}async function bN(r){const{implicitOptions:e,parentData:t={mortonIndex:0,x:0,y:0,z:0},childIndex:n=0,s2VolumeBox:i,loaderOptions:s}=r;let{subtree:o,level:c=0,globalData:f={level:0,mortonIndex:0,x:0,y:0,z:0}}=r;const{subdivisionScheme:A,subtreeLevels:v,maximumLevel:w,contentUrlTemplate:S,subtreesUriTemplate:F,basePath:N}=e,U={children:[],lodMetricValue:0,contentUrl:""};if(!w)return JL.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${S} won't be loaded...`),U;const $=c+f.level;if($>w)return U;const G=jbe[A],H=Math.log2(G),J=n&1,ue=n>>1&1,q=n>>2&1,se=(G**c-1)/(G-1);let Te=jf(t.mortonIndex,n,H),Ue=se+Te,de=jf(t.x,J,1),me=jf(t.y,ue,1),pe=jf(t.z,q,1),W=!1;c>=v&&(W=O1(o.childSubtreeAvailability,Te));const re=jf(f.x,de,c),Ee=jf(f.y,me,c),et=jf(f.z,pe,c);if(W){const tt=`${N}/${F}`,rt=Ix(tt,$,re,Ee,et);o=await Wp(rt,uN,s),f={mortonIndex:Te,x:de,y:me,z:pe,level:c},Te=0,Ue=0,de=0,me=0,pe=0,c=0}if(!O1(o.tileAvailability,Ue))return U;O1(o.contentAvailability,Ue)&&(U.contentUrl=Ix(S,$,re,Ee,et));const Ge=c+1,Ze={mortonIndex:Te,x:de,y:me,z:pe};for(let tt=0;tt<G;tt++){const rt=$be(i,tt,A),ut=await bN({subtree:o,implicitOptions:e,loaderOptions:s,parentData:Ze,childIndex:tt,level:Ge,globalData:{...f},s2VolumeBox:rt});if(ut.contentUrl||ut.children.length){const vt=$+1,st=Wbe(ut,vt,{childTileX:de,childTileY:me,childTileZ:pe},e,i);U.children.push(st)}}return U}function O1(r,e){let t;return Array.isArray(r)?(t=r[0],r.length>1&&JL.once('Not supported extension "3DTILES_multiple_contents" has been detected')):t=r,"constant"in t?!!t.constant:t.explicitBitstream?Kbe(e,t.explicitBitstream):!1}function Wbe(r,e,t,n,i){const{basePath:s,refine:o,getRefine:c,lodMetricType:f,getTileType:A,rootLodMetricValue:v,rootBoundingVolume:w}=n,S=r.contentUrl&&r.contentUrl.replace(`${s}/`,""),F=v/2**e,N=i?.box?{box:i.box}:w,U=Jbe(e,N,t);return{children:r.children,contentUrl:r.contentUrl,content:{uri:S},id:r.contentUrl,refine:c(o),type:A(r),lodMetricType:f,lodMetricValue:F,geometricError:F,transform:r.transform,boun
4566dingVolume:U}}function Jbe(r,e,t){if(e.region){const{childTileX:n,childTileY:i,childTileZ:s}=t,[o,c,f,A,v,w]=e.region,S=2**r,F=(f-o)/S,N=(A-c)/S,U=(w-v)/S,[$,G]=[o+F*n,o+F*(n+1)],[H,J]=[c+N*i,c+N*(i+1)],[ue,q]=[v+U*s,v+U*(s+1)];return{region:[$,H,G,J,ue,q]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function jf(r,e,t){return(r<<t)+e}function Ix(r,e,t,n,i){const s=Xbe({level:e,x:t,y:n,z:i});return r.replace(/{level}|{x}|{y}|{z}/gi,o=>s[o])}function Xbe(r){const e={};for(const t in r)e[`{${t}}`]=r[t];return e}function Kbe(r,e){const t=Math.floor(r/8),n=r%8;return(e[t]>>n&1)===1}function aT(r,e=""){if(!e)return Yl.EMPTY;const n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return Yl.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Yl.SCENEGRAPH;default:return n||Yl.EMPTY}}function cT(r){switch(r){case"REPLACE":case"replace":return Tc.REPLACE;case"ADD":case"add":return Tc.ADD;default:return r}}function Mx(r,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){const n=new URL(r,`${e}/`);return decodeURI(n.toString())}else if(r.startsWith("/"))return r;return Wue(e,r)}function hF(r,e){if(!r)return null;let t;if(r.content){const i=r.content.uri||r.content?.url;typeof i<"u"&&(t=Mx(i,e))}return{...r,id:t,contentUrl:t,lodMetricType:Gp.GEOMETRIC_ERROR,lodMetricValue:r.geometricError,transformMatrix:r.transform,type:aT(r,t),refine:cT(r.refine)}}async function qbe(r,e,t){let n=null;const i=pF(r.root);i&&r.root?n=await dF(r.root,r,e,i,t):n=hF(r.root,e);const s=[];for(s.push(n);s.length>0;){const o=s.pop()||{},c=o.children||[],f=[];for(const A of c){const v=pF(A);let w;v?w=await dF(A,r,e,v,t):w=hF(A,e),w&&(f.push(w),s.push(w))}o.children=f}return n}async function dF(r,e,t,n,i){const{subdivisionScheme:s,maximumLevel:o,availableLevels:c,subtreeLevels:f,subtrees:{uri:A}}=n,v=Ix(A,0,0,0,0),w=Mx(v,t),S=await Wp(w,uN,i),F=r.content?.uri,N=F?Mx(F,t):"",U=e?.root?.refine,$=r.geometricError,G=r.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(G){const q={box:vN(G),s2VolumeInfo:G};r.boundingVolume=q}const H=r.boundingVolume,J={contentUrlTemplate:N,subtreesUriTemplate:A,subdivisionScheme:s,subtreeLevels:f,maximumLevel:Number.isFinite(c)?c-1:o,refine:U,basePath:t,lodMetricType:Gp.GEOMETRIC_ERROR,rootLodMetricValue:$,rootBoundingVolume:H,getTileType:aT,getRefine:cT};return await Ybe(r,t,S,J,i)}async function Ybe(r,e,t,n,i){if(!r)return null;const{children:s,contentUrl:o}=await bN({subtree:t,implicitOptions:n,loaderOptions:i});let c,f=null;return o&&(c=o,f={uri:o.replace(`${e}/`,"")}),{...r,id:c,contentUrl:c,lodMetricType:Gp.GEOMETRIC_ERROR,lodMetricValue:r.geometricError,transformMatrix:r.transform,type:aT(r,c),refine:cT(r.refine),content:f||r.content,children:s}}function pF(r){return r?.extensions?.["3DTILES_implicit_tiling"]||r?.implicitTiling}const xN={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:N8,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:Zbe,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Zbe(r,e={},t){const n=e["3d-tiles"]||{};let i;return n.isTileset==="auto"?i=t?.url&&t.url.indexOf(".json")!==-1:i=n.isTileset,i?Qbe(r,e,t):e1e(r,e,t)}async function Qbe(r,e,t){const n=JSON.parse(new TextDecoder().decode(r)),i=t?.url||"",s=t1e(i),o=await qbe(n,s,e||{});return{...n,shape:"tileset3d",loader:xN,url:i,queryString:t?.queryString||"",basePath:s,root:o||n.root,type:Go.TILES3D,lodMetricType:Gp.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function e1e(r,e,t){const n={content:{shape:"tile3d",featureIds:null}};return await lN(r,0,e,t,n.content),n.content}function t1e(r){return L6(r)}var L1={},AF;function pf(){return AF||(AF=1,function(r){var e=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function t(s,o){return Object.prototype.hasOwnProperty.call(s,o)}r.assign=function(s){for(var o=Array.prototype.slice.call(arguments,1);o.length;){var c=o.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var f in c)t(c,f)&&(s[f]=c[f])}}return s},r.shrinkBuf=function(s,o){return s.length===o?s:s.subarray?s.subarray(0,o):(s.length=o,s)};var n={arraySet:function(s,o,c,f,A){if(o.subarray&&s.subarray){s.set(o.subarray(c,c+f),A);return}for(var v=0;v<f;v++)s[A+v]=o[c+v]},flattenChunks:function(s){var o,c,f,A,v,w;
vendor: 7,097 bytes, line 4566
4566for(f=0,o=0,c=s.length;o<c;o++)f+=s[o].length;for(w=new Uint8Array(f),A=0,o=0,c=s.length;o<c;o++)v=s[o],w.set(v,A),A+=v.length;return w}},i={arraySet:function(s,o,c,f,A){for(var v=0;v<f;v++)s[A+v]=o[c+v]},flattenChunks:function(s){return[].concat.apply([],s)}};r.setTyped=function(s){s?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,i))},r.setTyped(e)}(L1)),L1}var Nd={},fc={},$f={},gF;function r1e(){if(gF)return $f;gF=1;var r=pf(),e=4,t=0,n=1,i=2;function s(Me){for(var kt=Me.length;--kt>=0;)Me[kt]=0}var o=0,c=1,f=2,A=3,v=258,w=29,S=256,F=S+1+w,N=30,U=19,$=2*F+1,G=15,H=16,J=7,ue=256,q=16,se=17,Te=18,Ue=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],de=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],me=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],pe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W=512,re=new Array((F+2)*2);s(re);var Ee=new Array(N*2);s(Ee);var et=new Array(W);s(et);var _e=new Array(v-A+1);s(_e);var Le=new Array(w);s(Le);var Ge=new Array(N);s(Ge);function Ze(Me,kt,$t,lr,Ye){this.static_tree=Me,this.extra_bits=kt,this.extra_base=$t,this.elems=lr,this.max_length=Ye,this.has_stree=Me&&Me.length}var tt,rt,ut;function vt(Me,kt){this.dyn_tree=Me,this.max_code=0,this.stat_desc=kt}function St(Me){return Me<256?et[Me]:et[256+(Me>>>7)]}function st(Me,kt){Me.pending_buf[Me.pending++]=kt&255,Me.pending_buf[Me.pending++]=kt>>>8&255}function dr(Me,kt,$t){Me.bi_valid>H-$t?(Me.bi_buf|=kt<<Me.bi_valid&65535,st(Me,Me.bi_buf),Me.bi_buf=kt>>H-Me.bi_valid,Me.bi_valid+=$t-H):(Me.bi_buf|=kt<<Me.bi_valid&65535,Me.bi_valid+=$t)}function er(Me,kt,$t){dr(Me,$t[kt*2],$t[kt*2+1])}function Kt(Me,kt){var $t=0;do $t|=Me&1,Me>>>=1,$t<<=1;while(--kt>0);return $t>>>1}function Nt(Me){Me.bi_valid===16?(st(Me,Me.bi_buf),Me.bi_buf=0,Me.bi_valid=0):Me.bi_valid>=8&&(Me.pending_buf[Me.pending++]=Me.bi_buf&255,Me.bi_buf>>=8,Me.bi_valid-=8)}function Ar(Me,kt){var $t=kt.dyn_tree,lr=kt.max_code,Ye=kt.stat_desc.static_tree,Rt=kt.stat_desc.has_stree,Ae=kt.stat_desc.extra_bits,Gt=kt.stat_desc.extra_base,Tt=kt.stat_desc.max_length,j,bt,Bt,Ce,Je,lt,Y=0;for(Ce=0;Ce<=G;Ce++)Me.bl_count[Ce]=0;for($t[Me.heap[Me.heap_max]*2+1]=0,j=Me.heap_max+1;j<$;j++)bt=Me.heap[j],Ce=$t[$t[bt*2+1]*2+1]+1,Ce>Tt&&(Ce=Tt,Y++),$t[bt*2+1]=Ce,!(bt>lr)&&(Me.bl_count[Ce]++,Je=0,bt>=Gt&&(Je=Ae[bt-Gt]),lt=$t[bt*2],Me.opt_len+=lt*(Ce+Je),Rt&&(Me.static_len+=lt*(Ye[bt*2+1]+Je)));if(Y!==0){do{for(Ce=Tt-1;Me.bl_count[Ce]===0;)Ce--;Me.bl_count[Ce]--,Me.bl_count[Ce+1]+=2,Me.bl_count[Tt]--,Y-=2}while(Y>0);for(Ce=Tt;Ce!==0;Ce--)for(bt=Me.bl_count[Ce];bt!==0;)Bt=Me.heap[--j],!(Bt>lr)&&($t[Bt*2+1]!==Ce&&(Me.opt_len+=(Ce-$t[Bt*2+1])*$t[Bt*2],$t[Bt*2+1]=Ce),bt--)}}function ln(Me,kt,$t){var lr=new Array(G+1),Ye=0,Rt,Ae;for(Rt=1;Rt<=G;Rt++)lr[Rt]=Ye=Ye+$t[Rt-1]<<1;for(Ae=0;Ae<=kt;Ae++){var Gt=Me[Ae*2+1];Gt!==0&&(Me[Ae*2]=Kt(lr[Gt]++,Gt))}}function Pr(){var Me,kt,$t,lr,Ye,Rt=new Array(G+1);for($t=0,lr=0;lr<w-1;lr++)for(Le[lr]=$t,Me=0;Me<1<<Ue[lr];Me++)_e[$t++]=lr;for(_e[$t-1]=lr,Ye=0,lr=0;lr<16;lr++)for(Ge[lr]=Ye,Me=0;Me<1<<de[lr];Me++)et[Ye++]=lr;for(Ye>>=7;lr<N;lr++)for(Ge[lr]=Ye<<7,Me=0;Me<1<<de[lr]-7;Me++)et[256+Ye++]=lr;for(kt=0;kt<=G;kt++)Rt[kt]=0;for(Me=0;Me<=143;)re[Me*2+1]=8,Me++,Rt[8]++;for(;Me<=255;)re[Me*2+1]=9,Me++,Rt[9]++;for(;Me<=279;)re[Me*2+1]=7,Me++,Rt[7]++;for(;Me<=287;)re[Me*2+1]=8,Me++,Rt[8]++;for(ln(re,F+1,Rt),Me=0;Me<N;Me++)Ee[Me*2+1]=5,Ee[Me*2]=Kt(Me,5);tt=new Ze(re,Ue,S+1,F,G),rt=new Ze(Ee,de,0,N,G),ut=new Ze(new Array(0),me,0,U,J)}function xr(Me){var kt;for(kt=0;kt<F;kt++)Me.dyn_ltree[kt*2]=0;for(kt=0;kt<N;kt++)Me.dyn_dtree[kt*2]=0;for(kt=0;kt<U;kt++)Me.bl_tree[kt*2]=0;Me.dyn_ltree[ue*2]=1,Me.opt_len=Me.static_len=0,Me.last_lit=Me.matches=0}function Vn(Me){Me.bi_valid>8?st(Me,Me.bi_buf):Me.bi_valid>0&&(Me.pending_buf[Me.pending++]=Me.bi_buf),Me.bi_buf=0,Me.bi_valid=0}function _r(Me,kt,$t,lr){Vn(Me),st(Me,$t),st(Me,~$t),r.arraySet(Me.pending_buf,Me.window,kt,$t,Me.pending),Me.pending+=$t}function yr(Me,kt,$t,lr){var Ye=kt*2,Rt=$t*2;return Me[Ye]<Me[Rt]||Me[Ye]===Me[Rt]&&lr[kt]<=lr[$t]}function un(Me,kt,$t){for(var lr=Me.heap[$t],Ye=$t<<1;Ye<=Me.heap_len&&(Ye<Me.heap_len&&yr(kt,Me.heap[Ye+1],Me.heap[Ye],Me.depth)&&Ye++,!yr(kt,lr,Me.heap[Ye],Me.depth));)Me.heap[$t]=Me.heap[Ye],$t=Ye,Ye<<=1;Me.heap[$t]=lr}function Dr(Me,kt,$t){var lr,Ye,Rt=0,Ae,Gt;if(Me.last_lit!==0)do lr=Me.pending_buf[Me.d_buf+Rt*2]<<8|Me.pending_buf[Me.d_buf+Rt*2+1],Ye=Me.pending_buf[Me.l_buf+Rt],Rt++,lr===0?er(Me,Ye,kt):(Ae=_e[Ye],er(Me,Ae+S+1,kt),Gt=Ue[Ae],Gt!==0&&(Ye-=Le[Ae],dr(Me,Ye,Gt)),lr--,Ae=St(lr),er(Me,Ae,$t),Gt=de[Ae],Gt!==0&&(lr-=Ge[Ae],dr(Me,lr,Gt)));while(Rt<Me.last_lit);er(Me,ue,kt)}function ci(Me,kt){var $t=kt.dyn_tree,lr=kt.stat_desc.static_tree,Ye=kt.stat_desc.has_stree,Rt=kt.stat_desc.elems,Ae,Gt,Tt=-1,j;for(Me.heap_len=0,Me.heap_max=$,Ae=0;Ae<Rt;Ae++)$t[Ae*2]!==0?(Me.heap[++Me.heap_len]=Tt=Ae,Me.depth[Ae]=0):$t[Ae*2+1]=0;for(;Me.heap_len<2;)j=Me.heap[++Me.heap_len]=Tt<2?++Tt:0,$t[j*2]=1,Me.depth[j]=0,Me.opt_len--,Ye&&(Me.static_len-=lr[j*2+1]);for(kt.max_code=Tt,Ae=Me.heap_len>>1;Ae>=1;Ae--)un(Me,$t,Ae);j=Rt;do Ae=Me.heap[1],Me.heap[1]=Me.heap[Me.heap_len--],un(Me,$t,1),Gt=Me.heap[1],Me.heap[--Me.heap_max]=Ae,Me.heap[--Me.heap_max]=Gt,$t[j*2]=$t[Ae*2]+$t[Gt*2],Me.depth[j]=(Me.depth[Ae]>=Me.depth[Gt]?Me.depth[Ae]:Me.depth[Gt])+1,$t[Ae*2+1]=$t[Gt*2+1]=j,Me.heap[1]=j++,un(Me,$t,1);while(Me.heap_len>=2);Me.heap[--Me.heap_max]=Me.heap[1],Ar(Me,kt),ln($t,Tt,Me.bl_count)}function Yn(Me,kt,$t){var lr,Ye=-1,Rt,Ae=kt[0*2+1],Gt=0,Tt=7,j=4;for(Ae===0&&(Tt=138,j=3),kt[($t+1)*2+1]=65535,lr=0;lr<=$t;lr++)Rt=Ae,Ae=kt[(lr+1)*2+1],!(++Gt<Tt&&Rt===Ae)&&(Gt<j?Me.bl_tree[Rt*2]+=Gt:Rt!==0?(Rt!==Ye&&Me.bl_tree[Rt*2]++,Me.bl_tree[q*2]++):Gt<=10?Me.bl_tree[se*2]++:Me.bl_tree[Te*2]++,Gt=0,Ye=Rt,Ae===0?(Tt=138,j=3):Rt===Ae?(Tt=6,j=3):(Tt=7,j=4))}function mn(Me,kt,$t){var lr,Ye=-1,Rt,Ae=kt[0*2+1],Gt=0,Tt=7,j=4;for(Ae===0&&(Tt=138,j=3),lr=0;lr<=$t;lr++)if(Rt=Ae,Ae=kt[(lr+1)*2+1],!(++Gt<Tt&&Rt===Ae)){if(Gt<j)do er(Me,Rt,Me.bl_tree);while(--Gt!==0);else Rt!==0?(Rt!==Ye&&(er(Me,Rt,Me.bl_tree),Gt--),er(Me,q,Me.bl_tree),dr(Me,Gt-3,2)):Gt<=10?(er(Me,se,Me.bl_tree),dr(Me,Gt-3,3)):(er(Me,Te,Me.bl_tree),dr(Me,Gt-11,7));Gt=0,Ye=Rt,Ae===0?(Tt=138,j=3):Rt===Ae?(Tt=6,j=3):(Tt=7,j=4)}}function ti(Me){var kt;for(Yn(Me,Me.dyn_ltree,Me.l_desc.max_code),Yn(Me,Me.dyn_dtree,Me.d_desc.max_code),ci(Me,Me.bl_desc),kt=U-1;kt>=3&&Me.bl_tree[pe[kt]*2+1]===0;kt--);return Me.opt_len+=3*(kt+1)+5+5+4,kt}function Hn(Me,kt,$t,lr){var Ye;for(dr(Me,kt-257,5),dr(Me,$t-1,5),dr(Me,lr-4,4),Ye=0;Ye<lr;Ye++)dr(Me,Me.bl_tree[pe[Ye]*2+1],3);mn(Me,Me.dyn_ltree,kt-1),mn(Me,Me.dyn_dtree,$t-1)}function Bn(Me){var kt=4093624447,$t;for($t=0;$t<=31;$t++,kt>>>=1)if(kt&1&&Me.dyn_ltree[$t*2]!==0)return t;if(Me.dyn_ltree[9*2]!==0||Me.dyn_ltree[10*2]!==0||Me.dyn_ltree[13*2]!==0)return n;for($t=32;$t<S;$t++)if(Me.dyn_ltree[$t*2]!==0)return n;return t}var Zn=!1;function Vt(Me){Zn||(Pr(),Zn=!0),Me.l_desc=new vt(Me.dyn_ltree,tt),Me.d_desc=new vt(Me.dyn_dtree,rt),Me.bl_desc=new vt(Me.bl_tree,ut),Me.bi_buf=0,Me.b
vendor: 7,355 bytes, line 4566
4566i_valid=0,xr(Me)}function mr(Me,kt,$t,lr){dr(Me,(o<<1)+(lr?1:0),3),_r(Me,kt,$t)}function Rr(Me){dr(Me,c<<1,3),er(Me,ue,re),Nt(Me)}function nn(Me,kt,$t,lr){var Ye,Rt,Ae=0;Me.level>0?(Me.strm.data_type===i&&(Me.strm.data_type=Bn(Me)),ci(Me,Me.l_desc),ci(Me,Me.d_desc),Ae=ti(Me),Ye=Me.opt_len+3+7>>>3,Rt=Me.static_len+3+7>>>3,Rt<=Ye&&(Ye=Rt)):Ye=Rt=$t+5,$t+4<=Ye&&kt!==-1?mr(Me,kt,$t,lr):Me.strategy===e||Rt===Ye?(dr(Me,(c<<1)+(lr?1:0),3),Dr(Me,re,Ee)):(dr(Me,(f<<1)+(lr?1:0),3),Hn(Me,Me.l_desc.max_code+1,Me.d_desc.max_code+1,Ae+1),Dr(Me,Me.dyn_ltree,Me.dyn_dtree)),xr(Me),lr&&Vn(Me)}function _i(Me,kt,$t){return Me.pending_buf[Me.d_buf+Me.last_lit*2]=kt>>>8&255,Me.pending_buf[Me.d_buf+Me.last_lit*2+1]=kt&255,Me.pending_buf[Me.l_buf+Me.last_lit]=$t&255,Me.last_lit++,kt===0?Me.dyn_ltree[$t*2]++:(Me.matches++,kt--,Me.dyn_ltree[(_e[$t]+S+1)*2]++,Me.dyn_dtree[St(kt)*2]++),Me.last_lit===Me.lit_bufsize-1}return $f._tr_init=Vt,$f._tr_stored_block=mr,$f._tr_flush_block=nn,$f._tr_tally=_i,$f._tr_align=Rr,$f}var k1,mF;function wN(){if(mF)return k1;mF=1;function r(e,t,n,i){for(var s=e&65535|0,o=e>>>16&65535|0,c=0;n!==0;){c=n>2e3?2e3:n,n-=c;do s=s+t[i++]|0,o=o+s|0;while(--c);s%=65521,o%=65521}return s|o<<16|0}return k1=r,k1}var N1,_F;function CN(){if(_F)return N1;_F=1;function r(){for(var n,i=[],s=0;s<256;s++){n=s;for(var o=0;o<8;o++)n=n&1?3988292384^n>>>1:n>>>1;i[s]=n}return i}var e=r();function t(n,i,s,o){var c=e,f=o+s;n^=-1;for(var A=o;A<f;A++)n=n>>>8^c[(n^i[A])&255];return n^-1}return N1=t,N1}var U1,yF;function lT(){return yF||(yF=1,U1={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}),U1}var vF;function n1e(){if(vF)return fc;vF=1;var r=pf(),e=r1e(),t=wN(),n=CN(),i=lT(),s=0,o=1,c=3,f=4,A=5,v=0,w=1,S=-2,F=-3,N=-5,U=-1,$=1,G=2,H=3,J=4,ue=0,q=2,se=8,Te=9,Ue=15,de=8,me=29,pe=256,W=pe+1+me,re=30,Ee=19,et=2*W+1,_e=15,Le=3,Ge=258,Ze=Ge+Le+1,tt=32,rt=42,ut=69,vt=73,St=91,st=103,dr=113,er=666,Kt=1,Nt=2,Ar=3,ln=4,Pr=3;function xr(j,bt){return j.msg=i[bt],bt}function Vn(j){return(j<<1)-(j>4?9:0)}function _r(j){for(var bt=j.length;--bt>=0;)j[bt]=0}function yr(j){var bt=j.state,Bt=bt.pending;Bt>j.avail_out&&(Bt=j.avail_out),Bt!==0&&(r.arraySet(j.output,bt.pending_buf,bt.pending_out,Bt,j.next_out),j.next_out+=Bt,bt.pending_out+=Bt,j.total_out+=Bt,j.avail_out-=Bt,bt.pending-=Bt,bt.pending===0&&(bt.pending_out=0))}function un(j,bt){e._tr_flush_block(j,j.block_start>=0?j.block_start:-1,j.strstart-j.block_start,bt),j.block_start=j.strstart,yr(j.strm)}function Dr(j,bt){j.pending_buf[j.pending++]=bt}function ci(j,bt){j.pending_buf[j.pending++]=bt>>>8&255,j.pending_buf[j.pending++]=bt&255}function Yn(j,bt,Bt,Ce){var Je=j.avail_in;return Je>Ce&&(Je=Ce),Je===0?0:(j.avail_in-=Je,r.arraySet(bt,j.input,j.next_in,Je,Bt),j.state.wrap===1?j.adler=t(j.adler,bt,Je,Bt):j.state.wrap===2&&(j.adler=n(j.adler,bt,Je,Bt)),j.next_in+=Je,j.total_in+=Je,Je)}function mn(j,bt){var Bt=j.max_chain_length,Ce=j.strstart,Je,lt,Y=j.prev_length,ne=j.nice_match,le=j.strstart>j.w_size-Ze?j.strstart-(j.w_size-Ze):0,ve=j.window,Oe=j.w_mask,he=j.prev,be=j.strstart+Ge,ae=ve[Ce+Y-1],Be=ve[Ce+Y];j.prev_length>=j.good_match&&(Bt>>=2),ne>j.lookahead&&(ne=j.lookahead);do if(Je=bt,!(ve[Je+Y]!==Be||ve[Je+Y-1]!==ae||ve[Je]!==ve[Ce]||ve[++Je]!==ve[Ce+1])){Ce+=2,Je++;do;while(ve[++Ce]===ve[++Je]&&ve[++Ce]===ve[++Je]&&ve[++Ce]===ve[++Je]&&ve[++Ce]===ve[++Je]&&ve[++Ce]===ve[++Je]&&ve[++Ce]===ve[++Je]&&ve[++Ce]===ve[++Je]&&ve[++Ce]===ve[++Je]&&Ce<be);if(lt=Ge-(be-Ce),Ce=be-Ge,lt>Y){if(j.match_start=bt,Y=lt,lt>=ne)break;ae=ve[Ce+Y-1],Be=ve[Ce+Y]}}while((bt=he[bt&Oe])>le&&--Bt!==0);return Y<=j.lookahead?Y:j.lookahead}function ti(j){var bt=j.w_size,Bt,Ce,Je,lt,Y;do{if(lt=j.window_size-j.lookahead-j.strstart,j.strstart>=bt+(bt-Ze)){r.arraySet(j.window,j.window,bt,bt,0),j.match_start-=bt,j.strstart-=bt,j.block_start-=bt,Ce=j.hash_size,Bt=Ce;do Je=j.head[--Bt],j.head[Bt]=Je>=bt?Je-bt:0;while(--Ce);Ce=bt,Bt=Ce;do Je=j.prev[--Bt],j.prev[Bt]=Je>=bt?Je-bt:0;while(--Ce);lt+=bt}if(j.strm.avail_in===0)break;if(Ce=Yn(j.strm,j.window,j.strstart+j.lookahead,lt),j.lookahead+=Ce,j.lookahead+j.insert>=Le)for(Y=j.strstart-j.insert,j.ins_h=j.window[Y],j.ins_h=(j.ins_h<<j.hash_shift^j.window[Y+1])&j.hash_mask;j.insert&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[Y+Le-1])&j.hash_mask,j.prev[Y&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=Y,Y++,j.insert--,!(j.lookahead+j.insert<Le)););}while(j.lookahead<Ze&&j.strm.avail_in!==0)}function Hn(j,bt){var Bt=65535;for(Bt>j.pending_buf_size-5&&(Bt=j.pending_buf_size-5);;){if(j.lookahead<=1){if(ti(j),j.lookahead===0&&bt===s)return Kt;if(j.lookahead===0)break}j.strstart+=j.lookahead,j.lookahead=0;var Ce=j.block_start+Bt;if((j.strstart===0||j.strstart>=Ce)&&(j.lookahead=j.strstart-Ce,j.strstart=Ce,un(j,!1),j.strm.avail_out===0)||j.strstart-j.block_start>=j.w_size-Ze&&(un(j,!1),j.strm.avail_out===0))return Kt}return j.insert=0,bt===f?(un(j,!0),j.strm.avail_out===0?Ar:ln):(j.strstart>j.block_start&&(un(j,!1),j.strm.avail_out===0),Kt)}function Bn(j,bt){for(var Bt,Ce;;){if(j.lookahead<Ze){if(ti(j),j.lookahead<Ze&&bt===s)return Kt;if(j.lookahead===0)break}if(Bt=0,j.lookahead>=Le&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+Le-1])&j.hash_mask,Bt=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),Bt!==0&&j.strstart-Bt<=j.w_size-Ze&&(j.match_length=mn(j,Bt)),j.match_length>=Le)if(Ce=e._tr_tally(j,j.strstart-j.match_start,j.match_length-Le),j.lookahead-=j.match_length,j.match_length<=j.max_lazy_match&&j.lookahead>=Le){j.match_length--;do j.strstart++,j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+Le-1])&j.hash_mask,Bt=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart;while(--j.match_length!==0);j.strstart++}else j.strstart+=j.match_length,j.match_length=0,j.ins_h=j.window[j.strstart],j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+1])&j.hash_mask;else Ce=e._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++;if(Ce&&(un(j,!1),j.strm.avail_out===0))return Kt}return j.insert=j.strstart<Le-1?j.strstart:Le-1,bt===f?(un(j,!0),j.strm.avail_out===0?Ar:ln):j.last_lit&&(un(j,!1),j.strm.avail_out===0)?Kt:Nt}function Zn(j,bt){for(var Bt,Ce,Je;;){if(j.lookahead<Ze){if(ti(j),j.lookahead<Ze&&bt===s)return Kt;if(j.lookahead===0)break}if(Bt=0,j.lookahead>=Le&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+Le-1])&j.hash_mask,Bt=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),j.prev_length=j.match_length,j.prev_match=j.match_start,j.match_length=Le-1,Bt!==0&&j.prev_length<j.max_lazy_match&&j.strstart-Bt<=j.w_size-Ze&&(j.match_length=mn(j,Bt),j.match_length<=5&&(j.strategy===$||j.match_length===Le&&j.strstart-j.match_start>4096)&&(j.match_length=Le-1)),j.prev_length>=Le&&j.match_length<=j.prev_length){Je=j.strstart+j.lookahead-Le,Ce=e._tr_tally(j,j.strstart-1-j.prev_match,j.prev_length-Le),j.lookahead-=j.prev_length-1,j.prev_length-=2;do++j.strstart<=Je&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+Le-1])&j.hash_mask,Bt=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart);while(--j.prev_length!==0);if(j.match_available=0,j.match_length=Le-1,j.strstart++,Ce&&(un(j,!1),j.strm.avail_out===0))return Kt}else if(j.match_available){if(Ce=e._tr_tally(j,0,j.window[j.strstart-1]),Ce&&un(j,
vendor: 5,813 bytes, line 4566
4566!1),j.strstart++,j.lookahead--,j.strm.avail_out===0)return Kt}else j.match_available=1,j.strstart++,j.lookahead--}return j.match_available&&(Ce=e._tr_tally(j,0,j.window[j.strstart-1]),j.match_available=0),j.insert=j.strstart<Le-1?j.strstart:Le-1,bt===f?(un(j,!0),j.strm.avail_out===0?Ar:ln):j.last_lit&&(un(j,!1),j.strm.avail_out===0)?Kt:Nt}function Vt(j,bt){for(var Bt,Ce,Je,lt,Y=j.window;;){if(j.lookahead<=Ge){if(ti(j),j.lookahead<=Ge&&bt===s)return Kt;if(j.lookahead===0)break}if(j.match_length=0,j.lookahead>=Le&&j.strstart>0&&(Je=j.strstart-1,Ce=Y[Je],Ce===Y[++Je]&&Ce===Y[++Je]&&Ce===Y[++Je])){lt=j.strstart+Ge;do;while(Ce===Y[++Je]&&Ce===Y[++Je]&&Ce===Y[++Je]&&Ce===Y[++Je]&&Ce===Y[++Je]&&Ce===Y[++Je]&&Ce===Y[++Je]&&Ce===Y[++Je]&&Je<lt);j.match_length=Ge-(lt-Je),j.match_length>j.lookahead&&(j.match_length=j.lookahead)}if(j.match_length>=Le?(Bt=e._tr_tally(j,1,j.match_length-Le),j.lookahead-=j.match_length,j.strstart+=j.match_length,j.match_length=0):(Bt=e._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++),Bt&&(un(j,!1),j.strm.avail_out===0))return Kt}return j.insert=0,bt===f?(un(j,!0),j.strm.avail_out===0?Ar:ln):j.last_lit&&(un(j,!1),j.strm.avail_out===0)?Kt:Nt}function mr(j,bt){for(var Bt;;){if(j.lookahead===0&&(ti(j),j.lookahead===0)){if(bt===s)return Kt;break}if(j.match_length=0,Bt=e._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++,Bt&&(un(j,!1),j.strm.avail_out===0))return Kt}return j.insert=0,bt===f?(un(j,!0),j.strm.avail_out===0?Ar:ln):j.last_lit&&(un(j,!1),j.strm.avail_out===0)?Kt:Nt}function Rr(j,bt,Bt,Ce,Je){this.good_length=j,this.max_lazy=bt,this.nice_length=Bt,this.max_chain=Ce,this.func=Je}var nn;nn=[new Rr(0,0,0,0,Hn),new Rr(4,4,8,4,Bn),new Rr(4,5,16,8,Bn),new Rr(4,6,32,32,Bn),new Rr(4,4,16,16,Zn),new Rr(8,16,32,32,Zn),new Rr(8,16,128,128,Zn),new Rr(8,32,128,256,Zn),new Rr(32,128,258,1024,Zn),new Rr(32,258,258,4096,Zn)];function _i(j){j.window_size=2*j.w_size,_r(j.head),j.max_lazy_match=nn[j.level].max_lazy,j.good_match=nn[j.level].good_length,j.nice_match=nn[j.level].nice_length,j.max_chain_length=nn[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=Le-1,j.match_available=0,j.ins_h=0}function Me(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=se,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(et*2),this.dyn_dtree=new r.Buf16((2*re+1)*2),this.bl_tree=new r.Buf16((2*Ee+1)*2),_r(this.dyn_ltree),_r(this.dyn_dtree),_r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(_e+1),this.heap=new r.Buf16(2*W+1),_r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*W+1),_r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function kt(j){var bt;return!j||!j.state?xr(j,S):(j.total_in=j.total_out=0,j.data_type=q,bt=j.state,bt.pending=0,bt.pending_out=0,bt.wrap<0&&(bt.wrap=-bt.wrap),bt.status=bt.wrap?rt:dr,j.adler=bt.wrap===2?0:1,bt.last_flush=s,e._tr_init(bt),v)}function $t(j){var bt=kt(j);return bt===v&&_i(j.state),bt}function lr(j,bt){return!j||!j.state||j.state.wrap!==2?S:(j.state.gzhead=bt,v)}function Ye(j,bt,Bt,Ce,Je,lt){if(!j)return S;var Y=1;if(bt===U&&(bt=6),Ce<0?(Y=0,Ce=-Ce):Ce>15&&(Y=2,Ce-=16),Je<1||Je>Te||Bt!==se||Ce<8||Ce>15||bt<0||bt>9||lt<0||lt>J)return xr(j,S);Ce===8&&(Ce=9);var ne=new Me;return j.state=ne,ne.strm=j,ne.wrap=Y,ne.gzhead=null,ne.w_bits=Ce,ne.w_size=1<<ne.w_bits,ne.w_mask=ne.w_size-1,ne.hash_bits=Je+7,ne.hash_size=1<<ne.hash_bits,ne.hash_mask=ne.hash_size-1,ne.hash_shift=~~((ne.hash_bits+Le-1)/Le),ne.window=new r.Buf8(ne.w_size*2),ne.head=new r.Buf16(ne.hash_size),ne.prev=new r.Buf16(ne.w_size),ne.lit_bufsize=1<<Je+6,ne.pending_buf_size=ne.lit_bufsize*4,ne.pending_buf=new r.Buf8(ne.pending_buf_size),ne.d_buf=1*ne.lit_bufsize,ne.l_buf=3*ne.lit_bufsize,ne.level=bt,ne.strategy=lt,ne.method=Bt,$t(j)}function Rt(j,bt){return Ye(j,bt,se,Ue,de,ue)}function Ae(j,bt){var Bt,Ce,Je,lt;if(!j||!j.state||bt>A||bt<0)return j?xr(j,S):S;if(Ce=j.state,!j.output||!j.input&&j.avail_in!==0||Ce.status===er&&bt!==f)return xr(j,j.avail_out===0?N:S);if(Ce.strm=j,Bt=Ce.last_flush,Ce.last_flush=bt,Ce.status===rt)if(Ce.wrap===2)j.adler=0,Dr(Ce,31),Dr(Ce,139),Dr(Ce,8),Ce.gzhead?(Dr(Ce,(Ce.gzhead.text?1:0)+(Ce.gzhead.hcrc?2:0)+(Ce.gzhead.extra?4:0)+(Ce.gzhead.name?8:0)+(Ce.gzhead.comment?16:0)),Dr(Ce,Ce.gzhead.time&255),Dr(Ce,Ce.gzhead.time>>8&255),Dr(Ce,Ce.gzhead.time>>16&255),Dr(Ce,Ce.gzhead.time>>24&255),Dr(Ce,Ce.level===9?2:Ce.strategy>=G||Ce.level<2?4:0),Dr(Ce,Ce.gzhead.os&255),Ce.gzhead.extra&&Ce.gzhead.extra.length&&(Dr(Ce,Ce.gzhead.extra.length&255),Dr(Ce,Ce.gzhead.extra.length>>8&255)),Ce.gzhead.hcrc&&(j.adler=n(j.adler,Ce.pending_buf,Ce.pending,0)),Ce.gzindex=0,Ce.status=ut):(Dr(Ce,0),Dr(Ce,0),Dr(Ce,0),Dr(Ce,0),Dr(Ce,0),Dr(Ce,Ce.level===9?2:Ce.strategy>=G||Ce.level<2?4:0),Dr(Ce,Pr),Ce.status=dr);else{var Y=se+(Ce.w_bits-8<<4)<<8,ne=-1;Ce.strategy>=G||Ce.level<2?ne=0:Ce.level<6?ne=1:Ce.level===6?ne=2:ne=3,Y|=ne<<6,Ce.strstart!==0&&(Y|=tt),Y+=31-Y%31,Ce.status=dr,ci(Ce,Y),Ce.strstart!==0&&(ci(Ce,j.adler>>>16),ci(Ce,j.adler&65535)),j.adler=1}if(Ce.status===ut)if(Ce.gzhead.extra){for(Je=Ce.pending;
vendor: 7,011 bytes, line 4566
4566Ce.gzindex<(Ce.gzhead.extra.length&65535)&&!(Ce.pending===Ce.pending_buf_size&&(Ce.gzhead.hcrc&&Ce.pending>Je&&(j.adler=n(j.adler,Ce.pending_buf,Ce.pending-Je,Je)),yr(j),Je=Ce.pending,Ce.pending===Ce.pending_buf_size));)Dr(Ce,Ce.gzhead.extra[Ce.gzindex]&255),Ce.gzindex++;Ce.gzhead.hcrc&&Ce.pending>Je&&(j.adler=n(j.adler,Ce.pending_buf,Ce.pending-Je,Je)),Ce.gzindex===Ce.gzhead.extra.length&&(Ce.gzindex=0,Ce.status=vt)}else Ce.status=vt;if(Ce.status===vt)if(Ce.gzhead.name){Je=Ce.pending;do{if(Ce.pending===Ce.pending_buf_size&&(Ce.gzhead.hcrc&&Ce.pending>Je&&(j.adler=n(j.adler,Ce.pending_buf,Ce.pending-Je,Je)),yr(j),Je=Ce.pending,Ce.pending===Ce.pending_buf_size)){lt=1;break}Ce.gzindex<Ce.gzhead.name.length?lt=Ce.gzhead.name.charCodeAt(Ce.gzindex++)&255:lt=0,Dr(Ce,lt)}while(lt!==0);Ce.gzhead.hcrc&&Ce.pending>Je&&(j.adler=n(j.adler,Ce.pending_buf,Ce.pending-Je,Je)),lt===0&&(Ce.gzindex=0,Ce.status=St)}else Ce.status=St;if(Ce.status===St)if(Ce.gzhead.comment){Je=Ce.pending;do{if(Ce.pending===Ce.pending_buf_size&&(Ce.gzhead.hcrc&&Ce.pending>Je&&(j.adler=n(j.adler,Ce.pending_buf,Ce.pending-Je,Je)),yr(j),Je=Ce.pending,Ce.pending===Ce.pending_buf_size)){lt=1;break}Ce.gzindex<Ce.gzhead.comment.length?lt=Ce.gzhead.comment.charCodeAt(Ce.gzindex++)&255:lt=0,Dr(Ce,lt)}while(lt!==0);Ce.gzhead.hcrc&&Ce.pending>Je&&(j.adler=n(j.adler,Ce.pending_buf,Ce.pending-Je,Je)),lt===0&&(Ce.status=st)}else Ce.status=st;if(Ce.status===st&&(Ce.gzhead.hcrc?(Ce.pending+2>Ce.pending_buf_size&&yr(j),Ce.pending+2<=Ce.pending_buf_size&&(Dr(Ce,j.adler&255),Dr(Ce,j.adler>>8&255),j.adler=0,Ce.status=dr)):Ce.status=dr),Ce.pending!==0){if(yr(j),j.avail_out===0)return Ce.last_flush=-1,v}else if(j.avail_in===0&&Vn(bt)<=Vn(Bt)&&bt!==f)return xr(j,N);if(Ce.status===er&&j.avail_in!==0)return xr(j,N);if(j.avail_in!==0||Ce.lookahead!==0||bt!==s&&Ce.status!==er){var le=Ce.strategy===G?mr(Ce,bt):Ce.strategy===H?Vt(Ce,bt):nn[Ce.level].func(Ce,bt);if((le===Ar||le===ln)&&(Ce.status=er),le===Kt||le===Ar)return j.avail_out===0&&(Ce.last_flush=-1),v;if(le===Nt&&(bt===o?e._tr_align(Ce):bt!==A&&(e._tr_stored_block(Ce,0,0,!1),bt===c&&(_r(Ce.head),Ce.lookahead===0&&(Ce.strstart=0,Ce.block_start=0,Ce.insert=0))),yr(j),j.avail_out===0))return Ce.last_flush=-1,v}return bt!==f?v:Ce.wrap<=0?w:(Ce.wrap===2?(Dr(Ce,j.adler&255),Dr(Ce,j.adler>>8&255),Dr(Ce,j.adler>>16&255),Dr(Ce,j.adler>>24&255),Dr(Ce,j.total_in&255),Dr(Ce,j.total_in>>8&255),Dr(Ce,j.total_in>>16&255),Dr(Ce,j.total_in>>24&255)):(ci(Ce,j.adler>>>16),ci(Ce,j.adler&65535)),yr(j),Ce.wrap>0&&(Ce.wrap=-Ce.wrap),Ce.pending!==0?v:w)}function Gt(j){var bt;return!j||!j.state?S:(bt=j.state.status,bt!==rt&&bt!==ut&&bt!==vt&&bt!==St&&bt!==st&&bt!==dr&&bt!==er?xr(j,S):(j.state=null,bt===dr?xr(j,F):v))}function Tt(j,bt){var Bt=bt.length,Ce,Je,lt,Y,ne,le,ve,Oe;if(!j||!j.state||(Ce=j.state,Y=Ce.wrap,Y===2||Y===1&&Ce.status!==rt||Ce.lookahead))return S;for(Y===1&&(j.adler=t(j.adler,bt,Bt,0)),Ce.wrap=0,Bt>=Ce.w_size&&(Y===0&&(_r(Ce.head),Ce.strstart=0,Ce.block_start=0,Ce.insert=0),Oe=new r.Buf8(Ce.w_size),r.arraySet(Oe,bt,Bt-Ce.w_size,Ce.w_size,0),bt=Oe,Bt=Ce.w_size),ne=j.avail_in,le=j.next_in,ve=j.input,j.avail_in=Bt,j.next_in=0,j.input=bt,ti(Ce);Ce.lookahead>=Le;){Je=Ce.strstart,lt=Ce.lookahead-(Le-1);do Ce.ins_h=(Ce.ins_h<<Ce.hash_shift^Ce.window[Je+Le-1])&Ce.hash_mask,Ce.prev[Je&Ce.w_mask]=Ce.head[Ce.ins_h],Ce.head[Ce.ins_h]=Je,Je++;while(--lt);Ce.strstart=Je,Ce.lookahead=Le-1,ti(Ce)}return Ce.strstart+=Ce.lookahead,Ce.block_start=Ce.strstart,Ce.insert=Ce.lookahead,Ce.lookahead=0,Ce.match_length=Ce.prev_length=Le-1,Ce.match_available=0,j.next_in=le,j.input=ve,j.avail_in=ne,Ce.wrap=Y,v}return fc.deflateInit=Rt,fc.deflateInit2=Ye,fc.deflateReset=$t,fc.deflateResetKeep=kt,fc.deflateSetHeader=lr,fc.deflate=Ae,fc.deflateEnd=Gt,fc.deflateSetDictionary=Tt,fc.deflateInfo="pako deflate (from Nodeca project)",fc}var Wf={},bF;function TN(){if(bF)return Wf;bF=1;var r=pf(),e=!0,t=!0;try{String.fromCharCode.apply(null,[0])}catch{e=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{t=!1}for(var n=new r.Buf8(256),i=0;i<256;i++)n[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;n[254]=n[254]=1,Wf.string2buf=function(o){var c,f,A,v,w,S=o.length,F=0;for(v=0;v<S;v++)f=o.charCodeAt(v),(f&64512)===55296&&v+1<S&&(A=o.charCodeAt(v+1),(A&64512)===56320&&(f=65536+(f-55296<<10)+(A-56320),v++)),F+=f<128?1:f<2048?2:f<65536?3:4;for(c=new r.Buf8(F),w=0,v=0;w<F;v++)f=o.charCodeAt(v),(f&64512)===55296&&v+1<S&&(A=o.charCodeAt(v+1),(A&64512)===56320&&(f=65536+(f-55296<<10)+(A-56320),v++)),f<128?c[w++]=f:f<2048?(c[w++]=192|f>>>6,c[w++]=128|f&63):f<65536?(c[w++]=224|f>>>12,c[w++]=128|f>>>6&63,c[w++]=128|f&63):(c[w++]=240|f>>>18,c[w++]=128|f>>>12&63,c[w++]=128|f>>>6&63,c[w++]=128|f&63);return c};function s(o,c){if(c<65534&&(o.subarray&&t||!o.subarray&&e))return String.fromCharCode.apply(null,r.shrinkBuf(o,c));for(var f="",A=0;A<c;A++)f+=String.fromCharCode(o[A]);return f}return Wf.buf2binstring=function(o){return s(o,o.length)},Wf.binstring2buf=function(o){for(var c=new r.Buf8(o.length),f=0,A=c.length;f<A;f++)c[f]=o.charCodeAt(f);return c},Wf.buf2string=function(o,c){var f,A,v,w,S=c||o.length,F=new Array(S*2);for(A=0,f=0;f<S;){if(v=o[f++],v<128){F[A++]=v;continue}if(w=n[v],w>4){F[A++]=65533,f+=w-1;continue}for(v&=w===2?31:w===3?15:7;w>1&&f<S;)v=v<<6|o[f++]&63,w--;if(w>1){F[A++]=65533;continue}v<65536?F[A++]=v:(v-=65536,F[A++]=55296|v>>10&1023,F[A++]=56320|v&1023)}return s(F,A)},Wf.utf8border=function(o,c){var f;for(c=c||o.length,c>o.length&&(c=o.length),f=c-1;f>=0&&(o[f]&192)===128;)f--;return f<0||f===0?c:f+n[o[f]]>c?f:c},Wf}var z1,xF;function EN(){if(xF)return z1;xF=1;function r(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}return z1=r,z1}var wF;function i1e(){if(wF)return Nd;wF=1;var r=n1e(),e=pf(),t=TN(),n=lT(),i=EN(),s=Object.prototype.toString,o=0,c=4,f=0,A=1,v=2,w=-1,S=0,F=8;function N(H){if(!(this instanceof N))return new N(H);this.options=e.assign({level:w,method:F,chunkSize:16384,windowBits:15,memLevel:8,strategy:S,to:""},H||{});var J=this.options;J.raw&&J.windowBits>0?J.windowBits=-J.windowBits:J.gzip&&J.windowBits>0&&J.windowBits<16&&(J.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var ue=r.deflateInit2(this.strm,J.level,J.method,J.windowBits,J.memLevel,J.strategy);if(ue!==f)throw new Error(n[ue]);if(J.header&&r.deflateSetHeader(this.strm,J.header),J.dictionary){var q;if(typeof J.dictionary=="string"?q=t.string2buf(J.dictionary):s.call(J.dictionary)==="[object ArrayBuffer]"?q=new Uint8Array(J.dictionary):q=J.dictionary,ue=r.deflateSetDictionary(this.strm,q),ue!==f)throw new Error(n[ue]);this._dict_set=!0}}N.prototype.push=function(H,J){var ue=this.strm,q=this.options.chunkSize,se,Te;if(this.ended)return!1;Te=J===~~J?J:J===!0?c:o,typeof H=="string"?ue.input=t.string2buf(H):s.call(H)==="[object ArrayBuffer]"?ue.
vendor: 17,697 bytes, line 4566
4566input=new Uint8Array(H):ue.input=H,ue.next_in=0,ue.avail_in=ue.input.length;do{if(ue.avail_out===0&&(ue.output=new e.Buf8(q),ue.next_out=0,ue.avail_out=q),se=r.deflate(ue,Te),se!==A&&se!==f)return this.onEnd(se),this.ended=!0,!1;(ue.avail_out===0||ue.avail_in===0&&(Te===c||Te===v))&&(this.options.to==="string"?this.onData(t.buf2binstring(e.shrinkBuf(ue.output,ue.next_out))):this.onData(e.shrinkBuf(ue.output,ue.next_out)))}while((ue.avail_in>0||ue.avail_out===0)&&se!==A);return Te===c?(se=r.deflateEnd(this.strm),this.onEnd(se),this.ended=!0,se===f):(Te===v&&(this.onEnd(f),ue.avail_out=0),!0)},N.prototype.onData=function(H){this.chunks.push(H)},N.prototype.onEnd=function(H){H===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=H,this.msg=this.strm.msg};function U(H,J){var ue=new N(J);if(ue.push(H,!0),ue.err)throw ue.msg||n[ue.err];return ue.result}function $(H,J){return J=J||{},J.raw=!0,U(H,J)}function G(H,J){return J=J||{},J.gzip=!0,U(H,J)}return Nd.Deflate=N,Nd.deflate=U,Nd.deflateRaw=$,Nd.gzip=G,Nd}var Ud={},Fa={},G1,CF;function s1e(){if(CF)return G1;CF=1;var r=30,e=12;return G1=function(n,i){var s,o,c,f,A,v,w,S,F,N,U,$,G,H,J,ue,q,se,Te,Ue,de,me,pe,W,re;s=n.state,o=n.next_in,W=n.input,c=o+(n.avail_in-5),f=n.next_out,re=n.output,A=f-(i-n.avail_out),v=f+(n.avail_out-257),w=s.dmax,S=s.wsize,F=s.whave,N=s.wnext,U=s.window,$=s.hold,G=s.bits,H=s.lencode,J=s.distcode,ue=(1<<s.lenbits)-1,q=(1<<s.distbits)-1;e:do{G<15&&($+=W[o++]<<G,G+=8,$+=W[o++]<<G,G+=8),se=H[$&ue];t:for(;;){if(Te=se>>>24,$>>>=Te,G-=Te,Te=se>>>16&255,Te===0)re[f++]=se&65535;else if(Te&16){Ue=se&65535,Te&=15,Te&&(G<Te&&($+=W[o++]<<G,G+=8),Ue+=$&(1<<Te)-1,$>>>=Te,G-=Te),G<15&&($+=W[o++]<<G,G+=8,$+=W[o++]<<G,G+=8),se=J[$&q];r:for(;;){if(Te=se>>>24,$>>>=Te,G-=Te,Te=se>>>16&255,Te&16){if(de=se&65535,Te&=15,G<Te&&($+=W[o++]<<G,G+=8,G<Te&&($+=W[o++]<<G,G+=8)),de+=$&(1<<Te)-1,de>w){n.msg="invalid distance too far back",s.mode=r;break e}if($>>>=Te,G-=Te,Te=f-A,de>Te){if(Te=de-Te,Te>F&&s.sane){n.msg="invalid distance too far back",s.mode=r;break e}if(me=0,pe=U,N===0){if(me+=S-Te,Te<Ue){Ue-=Te;do re[f++]=U[me++];while(--Te);me=f-de,pe=re}}else if(N<Te){if(me+=S+N-Te,Te-=N,Te<Ue){Ue-=Te;do re[f++]=U[me++];while(--Te);if(me=0,N<Ue){Te=N,Ue-=Te;do re[f++]=U[me++];while(--Te);me=f-de,pe=re}}}else if(me+=N-Te,Te<Ue){Ue-=Te;do re[f++]=U[me++];while(--Te);me=f-de,pe=re}for(;Ue>2;)re[f++]=pe[me++],re[f++]=pe[me++],re[f++]=pe[me++],Ue-=3;Ue&&(re[f++]=pe[me++],Ue>1&&(re[f++]=pe[me++]))}else{me=f-de;do re[f++]=re[me++],re[f++]=re[me++],re[f++]=re[me++],Ue-=3;while(Ue>2);Ue&&(re[f++]=re[me++],Ue>1&&(re[f++]=re[me++]))}}else if((Te&64)===0){se=J[(se&65535)+($&(1<<Te)-1)];continue r}else{n.msg="invalid distance code",s.mode=r;break e}break}}else if((Te&64)===0){se=H[(se&65535)+($&(1<<Te)-1)];continue t}else if(Te&32){s.mode=e;break e}else{n.msg="invalid literal/length code",s.mode=r;break e}break}}while(o<c&&f<v);Ue=G>>3,o-=Ue,G-=Ue<<3,$&=(1<<G)-1,n.next_in=o,n.next_out=f,n.avail_in=o<c?5+(c-o):5-(o-c),n.avail_out=f<v?257+(v-f):257-(f-v),s.hold=$,s.bits=G},G1}var V1,TF;function o1e(){if(TF)return V1;TF=1;var r=pf(),e=15,t=852,n=592,i=0,s=1,o=2,c=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],f=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],A=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],v=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];return V1=function(S,F,N,U,$,G,H,J){var ue=J.bits,q=0,se=0,Te=0,Ue=0,de=0,me=0,pe=0,W=0,re=0,Ee=0,et,_e,Le,Ge,Ze,tt=null,rt=0,ut,vt=new r.Buf16(e+1),St=new r.Buf16(e+1),st=null,dr=0,er,Kt,Nt;for(q=0;q<=e;q++)vt[q]=0;for(se=0;se<U;se++)vt[F[N+se]]++;for(de=ue,Ue=e;Ue>=1&&vt[Ue]===0;Ue--);if(de>Ue&&(de=Ue),Ue===0)return $[G++]=1<<24|64<<16|0,$[G++]=1<<24|64<<16|0,J.bits=1,0;for(Te=1;Te<Ue&&vt[Te]===0;Te++);for(de<Te&&(de=Te),W=1,q=1;q<=e;q++)if(W<<=1,W-=vt[q],W<0)return-1;if(W>0&&(S===i||Ue!==1))return-1;for(St[1]=0,q=1;q<e;q++)St[q+1]=St[q]+vt[q];for(se=0;se<U;se++)F[N+se]!==0&&(H[St[F[N+se]]++]=se);if(S===i?(tt=st=H,ut=19):S===s?(tt=c,rt-=257,st=f,dr-=257,ut=256):(tt=A,st=v,ut=-1),Ee=0,se=0,q=Te,Ze=G,me=de,pe=0,Le=-1,re=1<<de,Ge=re-1,S===s&&re>t||S===o&&re>n)return 1;for(;;){er=q-pe,H[se]<ut?(Kt=0,Nt=H[se]):H[se]>ut?(Kt=st[dr+H[se]],Nt=tt[rt+H[se]]):(Kt=96,Nt=0),et=1<<q-pe,_e=1<<me,Te=_e;do _e-=et,$[Ze+(Ee>>pe)+_e]=er<<24|Kt<<16|Nt|0;while(_e!==0);for(et=1<<q-1;Ee&et;)et>>=1;if(et!==0?(Ee&=et-1,Ee+=et):Ee=0,se++,--vt[q]===0){if(q===Ue)break;q=F[N+H[se]]}if(q>de&&(Ee&Ge)!==Le){for(pe===0&&(pe=de),Ze+=Te,me=q-pe,W=1<<me;me+pe<Ue&&(W-=vt[me+pe],!(W<=0));)me++,W<<=1;if(re+=1<<me,S===s&&re>t||S===o&&re>n)return 1;Le=Ee&Ge,$[Le]=de<<24|me<<16|Ze-G|0}}return Ee!==0&&($[Ze+Ee]=q-pe<<24|64<<16|0),J.bits=de,0},V1}var EF;function a1e(){if(EF)return Fa;EF=1;var r=pf(),e=wN(),t=CN(),n=s1e(),i=o1e(),s=0,o=1,c=2,f=4,A=5,v=6,w=0,S=1,F=2,N=-2,U=-3,$=-4,G=-5,H=8,J=1,ue=2,q=3,se=4,Te=5,Ue=6,de=7,me=8,pe=9,W=10,re=11,Ee=12,et=13,_e=14,Le=15,Ge=16,Ze=17,tt=18,rt=19,ut=20,vt=21,St=22,st=23,dr=24,er=25,Kt=26,Nt=27,Ar=28,ln=29,Pr=30,xr=31,Vn=32,_r=852,yr=592,un=15,Dr=un;function ci(Ye){return(Ye>>>24&255)+(Ye>>>8&65280)+((Ye&65280)<<8)+((Ye&255)<<24)}function Yn(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function mn(Ye){var Rt;return!Ye||!Ye.state?N:(Rt=Ye.state,Ye.total_in=Ye.total_out=Rt.total=0,Ye.msg="",Rt.wrap&&(Ye.adler=Rt.wrap&1),Rt.mode=J,Rt.last=0,Rt.havedict=0,Rt.dmax=32768,Rt.head=null,Rt.hold=0,Rt.bits=0,Rt.lencode=Rt.lendyn=new r.Buf32(_r),Rt.distcode=Rt.distdyn=new r.Buf32(yr),Rt.sane=1,Rt.back=-1,w)}function ti(Ye){var Rt;return!Ye||!Ye.state?N:(Rt=Ye.state,Rt.wsize=0,Rt.whave=0,Rt.wnext=0,mn(Ye))}function Hn(Ye,Rt){var Ae,Gt;return!Ye||!Ye.state||(Gt=Ye.state,Rt<0?(Ae=0,Rt=-Rt):(Ae=(Rt>>4)+1,Rt<48&&(Rt&=15)),Rt&&(Rt<8||Rt>15))?N:(Gt.window!==null&&Gt.wbits!==Rt&&(Gt.window=null),Gt.wrap=Ae,Gt.wbits=Rt,ti(Ye))}function Bn(Ye,Rt){var Ae,Gt;return Ye?(Gt=new Yn,Ye.state=Gt,Gt.window=null,Ae=Hn(Ye,Rt),Ae!==w&&(Ye.state=null),Ae):N}function Zn(Ye){return Bn(Ye,Dr)}var Vt=!0,mr,Rr;function nn(Ye){if(Vt){var Rt;for(mr=new r.Buf32(512),Rr=new r.Buf32(32),Rt=0;Rt<144;)Ye.lens[Rt++]=8;for(;Rt<256;)Ye.lens[Rt++]=9;for(;Rt<280;)Ye.lens[Rt++]=7;for(;Rt<288;)Ye.lens[Rt++]=8;for(i(o,Ye.lens,0,288,mr,0,Ye.work,{bits:9}),Rt=0;Rt<32;)Ye.lens[Rt++]=5;i(c,Ye.lens,0,32,Rr,0,Ye.work,{bits:5}),Vt=!1}Ye.lencode=mr,Ye.lenbits=9,Ye.distcode=Rr,Ye.distbits=5}function _i(Ye,Rt,Ae,Gt){var Tt,j=Ye.state;return j.window===null&&(j.wsize=1<<j.wbits,j.wnext=0,j.whave=0,j.window=new r.Buf8(j.wsize)),Gt>=j.wsize?(r.arraySet(j.window,Rt,Ae-j.wsize,j.wsize,0),j.wnext=0,j.whave=j.wsize):(Tt=j.wsize-j.wnext,Tt>Gt&&(Tt=Gt),r.arraySet(j.window,Rt,Ae-Gt,Tt,j.wnext),Gt-=Tt,Gt?(r.arraySet(j.window,Rt,Ae-Gt,Gt,0),j.wnext=Gt,j.whave=j.wsize):(j.wnext+=Tt,j.wnext===j.wsize&&(j.wnext=0),j.whave<j.wsize&&(j.whave+=Tt))),0}function Me(Ye,Rt){var Ae,Gt,Tt,j,bt,Bt,Ce,Je,lt,Y,ne,le,ve,Oe,he=0,be,ae,Be,g,ce,xt,Ke,Et,Pt=new r.Buf8(4),Ot,ht,Lt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Ye||!Ye.state||!Ye.output||!Ye.input&&Ye.avail_in!==0)return N;Ae=Ye.state,Ae.mode===Ee&&(Ae.mode=et),bt=Ye.next_out,Tt=Ye.output,Ce=Ye.avail_out,j=Ye.next_in,Gt=Ye.input,Bt=Ye.avail_in,Je=Ae.hold,lt=Ae.bits,Y=Bt,ne=Ce,Et=w;e:for(;;)switch(Ae.mode){case J:if(Ae.wrap===0){Ae.mode=et;break}for(;lt<16;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(Ae.wrap&2&&Je===35615){Ae.check=0,Pt[0]=Je&255,Pt[1]=Je>>>8&255,Ae.check=t(Ae.check,Pt,2,0),Je=0,lt=0,Ae.mode=ue;break}if(Ae.flags=0,Ae.head&&(Ae.head.done=!1),!(Ae.wrap&1)||(((Je&255)<<8)+(Je>>8))%31){Ye.msg="incorrect header check",Ae.mode=Pr;break}if((Je&15)!==H){Ye.msg="unknown compression method",Ae.mode=Pr;break}if(Je>>>=4,lt-=4,Ke=(Je&15)+8,Ae.wbits===0)Ae.wbits=Ke;else if(Ke>Ae.wbits){Ye.msg="invalid window size",Ae.mode=Pr;break}Ae.dmax=1<<Ke,Ye.adler=Ae.check=1,Ae.mode=Je&512?W:Ee,Je=0,lt=0;break;case ue:for(;lt<16;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(Ae.flags=Je,(Ae.flags&255)!==H){Ye.msg="unknown compression method",Ae.mode=Pr;break}if(Ae.flags&57344){Ye.msg="unknown header flags set",Ae.mode=Pr;break}Ae.head&&(Ae.head.text=Je>>8&1),Ae.flags&512&&(Pt[0]=Je&255,Pt[1]=Je>>>8&255,Ae.check=t(Ae.check,Pt,2,0)),Je=0,lt=0,Ae.mode=q;case q:for(;lt<32;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Ae.head&&(Ae.head.time=Je),Ae.flags&512&&(Pt[0]=Je&255,Pt[1]=Je>>>8&255,Pt[2]=Je>>>16&255,Pt[3]=Je>>>24&255,Ae.check=t(Ae.check,Pt,4,0)),Je=0,lt=0,Ae.mode=se;case se:for(;lt<16;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Ae.head&&(Ae.head.xflags=Je&255,Ae.head.os=Je>>8),Ae.flags&512&&(Pt[0]=Je&255,Pt[1]=Je>>>8&255,Ae.check=t(Ae.check,Pt,2,0)),Je=0,lt=0,Ae.mode=Te;case Te:if(Ae.flags&1024){for(;lt<16;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Ae.length=Je,Ae.head&&(Ae.head.extra_len=Je),Ae.flags&512&&(Pt[0]=Je&255,Pt[1]=Je>>>8&255,Ae.check=t(Ae.check,Pt,2,0)),Je=0,lt=0}else Ae.head&&(Ae.head.extra=null);Ae.mode=Ue;case Ue:if(Ae.flags&1024&&(le=Ae.length,le>Bt&&(le=Bt),le&&(Ae.head&&(Ke=Ae.head.extra_len-Ae.length,Ae.head.extra||(Ae.head.extra=new Array(Ae.head.extra_len)),r.arraySet(Ae.head.extra,Gt,j,le,Ke)),Ae.flags&512&&(Ae.check=t(Ae.check,Gt,le,j)),Bt-=le,j+=le,Ae.length-=le),Ae.length))break e;Ae.length=0,Ae.mode=de;case de:if(Ae.flags&2048){if(Bt===0)break e;le=0;do Ke=Gt[j+le++],Ae.head&&Ke&&Ae.length<65536&&(Ae.head.name+=String.fromCharCode(Ke));while(Ke&&le<Bt);if(Ae.flags&512&&(Ae.check=t(Ae.check,Gt,le,j)),Bt-=le,j+=le,Ke)break e}else Ae.head&&(Ae.head.name=null);Ae.length=0,Ae.mode=me;case me:if(Ae.flags&4096){if(Bt===0)break e;le=0;do Ke=Gt[j+le++],Ae.head&&Ke&&Ae.length<65536&&(Ae.head.comment+=String.fromCharCode(Ke));while(Ke&&le<Bt);if(Ae.flags&512&&(Ae.check=t(Ae.check,Gt,le,j)),Bt-=le,j+=le,Ke)break e}else Ae.head&&(Ae.head.comment=null);Ae.mode=pe;case pe:if(Ae.flags&512){for(;lt<16;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(Je!==(Ae.check&65535)){Ye.msg="header crc mismatch",Ae.mode=Pr;break}Je=0,lt=0}Ae.head&&(Ae.head.hcrc=Ae.flags>>9&1,Ae.head.done=!0),Ye.adler=Ae.check=0,Ae.mode=Ee;break;case W:for(;lt<32;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Ye.adler=Ae.check=ci(Je),Je=0,lt=0,Ae.mode=re;case re:if(Ae.havedict===0)return Ye.next_out=bt,Ye.avail_out=Ce,Ye.next_in=j,Ye.avail_in=Bt,Ae.hold=Je,Ae.bits=lt,F;Ye.adler=Ae.check=1,Ae.mode=Ee;case Ee:if(Rt===A||Rt===v)break e;case et:if(Ae.last){Je>>>=lt&7,lt-=lt&7,Ae.mode=Nt;break}for(;lt<3;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}switch(Ae.last=Je&1,Je>>>=1,lt-=1,Je&3){case 0:Ae.mode=_e;break;case 1:if(nn(Ae),Ae.mode=ut,Rt===v){Je>>>=2,lt-=2;break e}break;case 2:Ae.mode=Ze;break;case 3:Ye.msg="invalid block type",Ae.mode=Pr}Je>>>=2,lt-=2;break;case _e:for(Je>>>=lt&7,lt-=lt&7;lt<32;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if((Je&65535)!==(Je>>>16^65535)){Ye.msg="invalid stored block lengths",Ae.mode=Pr;break}if(Ae.length=Je&65535,Je=0,lt=0,Ae.mode=Le,Rt===v)break e;case Le:Ae.mode=Ge;case Ge:if(le=Ae.length,le){if(le>Bt&&(le=Bt),le>Ce&&(le=Ce),le===0)break e;r.arraySet(Tt,Gt,j,le,bt),Bt-=le,j+=le,Ce-=le,bt+=le,Ae.length-=le;break}Ae.mode=Ee;break;case Ze:for(;lt<14;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(Ae.nlen=(Je&31)+257,Je>>>=5,lt-=5,Ae.ndist=(Je&31)+1,Je>>>=5,lt-=5,Ae.ncode=(Je&15)+4,Je>>>=4,lt-=4,Ae.nlen>286||Ae.ndist>30){Ye.msg="too many length or distance symbols",Ae.mode=Pr;break}Ae.have=0,Ae.mode=tt;case tt:for(;Ae.have<Ae.ncode;){for(;lt<3;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Ae.lens[Lt[Ae.have++]]=Je&7,Je>>>=3,lt-=3}for(;Ae.have<19;)Ae.lens[Lt[Ae.have++]]=0;if(Ae.lencode=Ae.lendyn,Ae.lenbits=7,Ot={bits:Ae.lenbits},Et=i(s,Ae.lens,0,19,Ae.lencode,0,Ae.work,Ot),Ae.lenbits=Ot.bits,Et){Ye.msg="invalid code lengths set",Ae.mode=Pr;break}Ae.have=0,Ae.mode=rt;case rt:for(;Ae.have<Ae.nlen+Ae.ndist;){for(;he=Ae.lencode[Je&(1<<Ae.lenbits)-1],be=he>>>24,ae=he>>>16&255,Be=he&65535,!(be<=lt);){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(Be<16)Je>>>=be,lt-=be,Ae.lens[Ae.have++]=Be;else{if(Be===16){for(ht=be+2;lt<ht;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(Je>>>=be,lt-=be,Ae.have===0){Ye.msg="invalid bit length repeat",Ae.mode=Pr;break}Ke=Ae.lens[Ae.have-1],le=3+(Je&3),Je>>>=2,lt-=2}else if(Be===17){for(ht=be+3;lt<ht;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Je>>>=be,lt-=be,Ke=0,le=3+(Je&7),Je>>>=3,lt-=3}else{for(ht=be+7;lt<ht;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Je>>>=be,lt-=be,Ke=0,le=11+(Je&127),Je>>>=7,lt-=7}if(Ae.have+le>Ae.nlen+Ae.ndist){Ye.msg="invalid bit length repeat",Ae.mode=Pr;break}for(;le--;)Ae.lens[Ae.have++]=Ke}}if(Ae.mode===Pr)break;if(Ae.lens[256]===0){Ye.msg="invalid code -- missing end-of-block",Ae.mode=Pr;break}if(Ae.lenbits=9,Ot={bits:Ae.lenbits},Et=i(o,Ae.lens,0,Ae.nlen,Ae.lencode,0,Ae.work,Ot),Ae.lenbits=Ot.bits,Et){Ye.msg="invalid literal/lengths set",Ae.mode=Pr;break}if(Ae.distbits=6,Ae.distcode=Ae.distdyn,Ot={bits:Ae.distbits},Et=i(c,Ae.lens,Ae.nlen,Ae.ndist,Ae.distcode,0,Ae.work,Ot),Ae.distbits=Ot.bits,Et){Ye.msg="invalid distances set",Ae.mode=Pr;break}if(Ae.mode=ut,Rt===v)break e;case ut:Ae.mode=vt;case vt:if(Bt>=6&&Ce>=258){Ye.next_out=bt,Ye.avail_out=Ce,Ye.next_in=j,Ye.avail_in=Bt,Ae.hold=Je,Ae.bits=lt,n(Ye,ne),bt=Ye.next_out,Tt=Ye.output,Ce=Ye.avail_out,j=Ye.next_in,Gt=Ye.input,Bt=Ye.avail_in,Je=Ae.hold,lt=Ae.bits,Ae.mode===Ee&&(Ae.back=-1);break}for(Ae.back=0;he=Ae.lencode[Je&(1<<Ae.lenbits)-1],be=he>>>24,ae=he>>>16&255,Be=he&65535,!(be<=lt);){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(ae&&(ae&240)===0){for(g=be,ce=ae,xt=Be;he=Ae.lencode[xt+((Je&(1<<g+ce)-1)>>g)],be=he>>>24,ae=he>>>16&255,Be=he&65535,!(g+be<=lt);){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Je>>>=g,lt-=g,Ae.back+=g}if(Je>>>=be,lt-=be,Ae.back+=be,Ae.length=Be,ae===0){Ae.mode=Kt;break}if(ae&32){Ae.back=-1,Ae.mode=Ee;break}if(ae&64){Ye.msg="invalid literal/length code",Ae.mode=Pr;break}Ae.extra=ae&15,Ae.mode=St;case St:if(Ae.extra){for(ht=Ae.extra;lt<ht;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Ae.length+=Je&(1<<Ae.extra)-1,Je>>>=Ae.extra,lt-=Ae.extra,Ae.back+=Ae.extra}Ae.was=Ae.length,Ae.mode=st;case st:for(;he=Ae.distcode[Je&(1<<Ae.distbits)-1],be=he>>>24,ae=he>>>16&255,Be=he&65535,!(be<=lt);){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if((ae&240)===0){for(g=be,ce=ae,xt=Be;he=Ae.distcode[xt+((Je&(1<<g+ce)-1)>>g)],be=he>>>24,ae=he>>>16&255,Be=he&65535,!(g+be<=lt);){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Je>>>=g,lt-=g,Ae.back+=g}if(Je>>>=be,lt-=be,Ae.back+=be,ae&64){Ye.msg="invalid distance code",Ae.mode=Pr;break}Ae.offset=Be,Ae.extra=ae&15,Ae.mode=dr;case dr:if(Ae.extra){for(ht=Ae.extra;lt<ht;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}Ae.offset+=Je&(1<<Ae.extra)-1,Je>>>=Ae.extra,lt-=Ae.extra,Ae.back+=Ae.extra}if(Ae.offset>Ae.dmax){Ye.msg="invalid distance too far back",Ae.mode=Pr;break}Ae.mode=er;case er:if(Ce===0)break e;if(le=ne-Ce,Ae.offset>le){if(le=Ae.offset-le,le>Ae.whave&&Ae.sane){Ye.msg="invalid distance too far back",Ae.mode=Pr;break}le>Ae.wnext?(le-=Ae.wnext,ve=Ae.wsize-le):ve=Ae.wnext-le,le>Ae.length&&(le=Ae.length),Oe=Ae.window}else Oe=Tt,ve=bt-Ae.offset,le=Ae.length;le>Ce&&(le=Ce),Ce-=le,Ae.length-=le;do Tt[bt++]=Oe[ve++];while(--le);Ae.length===0&&(Ae.mode=vt);break;case Kt:if(Ce===0)break e;Tt[bt++]=Ae.length,Ce--,Ae.mode=vt;break;case Nt:if(Ae.wrap){for(;lt<32;){if(Bt===0)break e;Bt--,Je|=Gt[j++]<<lt,lt+=8}if(ne-=Ce,Ye.total_out+=ne,Ae.total+=ne,ne&&(Ye.adler=Ae.check=Ae.flags?t(Ae.check,Tt,ne,bt-ne):e(Ae.check,Tt,ne,bt-ne)),ne=Ce,(Ae.flags?Je:ci(Je))!==Ae.check){Ye.msg="incorrect data check",Ae.mode=Pr;break}Je=0,lt=0}Ae.mode=Ar;case Ar:if(Ae.wrap&&Ae.flags){for(;lt<32;){if(Bt===0)break e;Bt--,Je+=Gt[j++]<<lt,lt+=8}if(Je!==(Ae.total&4294967295)){Ye.msg="incorrect length check",Ae.mode=Pr;break}Je=0,lt=0}Ae.mode=ln;case ln:Et=S;break e;case Pr:Et=U;break e;case xr:return $;case Vn:default:return N}return Ye.next_out=bt,Ye.avail_out=Ce,Ye.next_in=j,Ye.avail_in=Bt,Ae.hold=Je,Ae.bits=lt,(Ae.wsize||ne!==Ye.avail_out&&Ae.mode<Pr&&(Ae.mode<Nt||Rt!==f))&&_i(Ye,Ye.output,Ye.next_out,ne-Ye.avail_out),Y-=Ye.avail_in,ne-=Ye.avail_out,Ye.total_in+=Y,Ye.total_out+=ne,Ae.total+=ne,Ae.wrap&&ne&&(Ye.adler=Ae.check=Ae.flags?t(Ae.check,Tt,ne,Ye.next_out-ne):e(Ae.check,Tt,ne,Ye.next_out-ne)),Ye.data_type=Ae.bits+(Ae.last?64:0)+(Ae.mode===Ee?128:0)+(Ae.mode===ut||Ae.mode===Le?256:0),(Y===0&&ne===0||Rt===f)&&Et===w&&(Et=G),Et}function kt(Ye){if(!Ye||!Ye.state)return N;var Rt=Ye.state;return Rt.window&&(Rt.window=null),Ye.state=null,w}function $t(Ye,Rt){var Ae;return!Ye||!Ye.state||(Ae=Ye.state,(Ae.wrap&2)===0)?N:(Ae.head=Rt,Rt.done=!1,w)}function lr(Ye,Rt){var Ae=Rt.length,Gt,Tt,j;return!Ye||!Ye.state||(Gt=Ye.state,Gt.wrap!==0&&Gt.mode!==re)?N:Gt.mode===re&&(Tt=1,Tt=e(Tt,Rt,Ae,0),Tt!==Gt.check)?U:(j=_i(Ye,Rt,Ae,Ae),j?(Gt.mode=xr,$):(Gt.havedict=1,w))}return Fa.inflateReset=ti,Fa.inflateReset2=Hn,Fa.inflateResetKeep=mn,Fa.inflateInit=Zn,Fa.inflateInit2=Bn,Fa.inflate=Me,Fa.inflateEnd=kt,Fa.inflateGetHeader=$t,Fa.inflateSetDictionary=lr,Fa.inflateInfo="pako inflate (from Nodeca project)",Fa}var H1,BF;
4566function BN(){return BF||(BF=1,H1={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}),H1}var j1,SF;function c1e(){if(SF)return j1;SF=1;function r(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}return j1=r,j1}var IF;function l1e(){if(IF)return Ud;IF=1;var r=a1e(),e=pf(),t=TN(),n=BN(),i=lT(),s=EN(),o=c1e(),c=Object.prototype.toString;function f(w){if(!(this instanceof f))return new f(w);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},w||{});var S=this.options;S.raw&&S.windowBits>=0&&S.windowBits<16&&(S.windowBits=-S.windowBits,S.windowBits===0&&(S.windowBits=-15)),S.windowBits>=0&&S.windowBits<16&&!(w&&w.windowBits)&&(S.windowBits+=32),S.windowBits>15&&S.windowBits<48&&(S.windowBits&15)===0&&(S.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var F=r.inflateInit2(this.strm,S.windowBits);if(F!==n.Z_OK)throw new Error(i[F]);if(this.header=new o,r.inflateGetHeader(this.strm,this.header),S.dictionary&&(typeof S.dictionary=="string"?S.dictionary=t.string2buf(S.dictionary):c.call(S.dictionary)==="[object ArrayBuffer]"&&(S.dictionary=new Uint8Array(S.dictionary)),S.raw&&(F=r.inflateSetDictionary(this.strm,S.dictionary),F!==n.Z_OK)))throw new Error(i[F])}f.prototype.push=function(w,S){var F=this.strm,N=this.options.chunkSize,U=this.options.dictionary,$,G,H,J,ue,q=!1;if(this.ended)return!1;G=S===~~S?S:S===!0?n.Z_FINISH:n.Z_NO_FLUSH,typeof w=="string"?F.input=t.binstring2buf(w):c.call(w)==="[object ArrayBuffer]"?F.input=new Uint8Array(w):F.input=w,F.next_in=0,F.avail_in=F.input.length;do{if(F.avail_out===0&&(F.output=new e.Buf8(N),F.next_out=0,F.avail_out=N),$=r.inflate(F,n.Z_NO_FLUSH),$===n.Z_NEED_DICT&&U&&($=r.inflateSetDictionary(this.strm,U)),$===n.Z_BUF_ERROR&&q===!0&&($=n.Z_OK,q=!1),$!==n.Z_STREAM_END&&$!==n.Z_OK)return this.onEnd($),this.ended=!0,!1;F.next_out&&(F.avail_out===0||$===n.Z_STREAM_END||F.avail_in===0&&(G===n.Z_FINISH||G===n.Z_SYNC_FLUSH))&&(this.options.to==="string"?(H=t.utf8border(F.output,F.next_out),J=F.next_out-H,ue=t.buf2string(F.output,H),F.next_out=J,F.avail_out=N-J,J&&e.arraySet(F.output,F.output,H,J,0),this.onData(ue)):this.onData(e.shrinkBuf(F.output,F.next_out))),F.avail_in===0&&F.avail_out===0&&(q=!0)}while((F.avail_in>0||F.avail_out===0)&&$!==n.Z_STREAM_END);return $===n.Z_STREAM_END&&(G=n.Z_FINISH),G===n.Z_FINISH?($=r.inflateEnd(this.strm),this.onEnd($),this.ended=!0,$===n.Z_OK):(G===n.Z_SYNC_FLUSH&&(this.onEnd(n.Z_OK),F.avail_out=0),!0)},f.prototype.onData=function(w){this.chunks.push(w)},f.prototype.onEnd=function(w){w===n.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg};function A(w,S){var F=new f(S);if(F.push(w,!0),F.err)throw F.msg||i[F.err];return F.result}function v(w,S){return S=S||{},S.raw=!0,A(w,S)}return Ud.Inflate=f,Ud.inflate=A,Ud.inflateRaw=v,Ud.ungzip=A,Ud}var $1,MF;function u1e(){if(MF)return $1;MF=1;var r=pf().assign,e=i1e(),t=l1e(),n=BN(),i={};return r(i,e,t,n),$1=i,$1}var f1e=u1e();const zd=_h(f1e),PF=[0],h1e={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:xN,onTilesetLoad:{type:"function",value:r=>{}},onTileLoad:{type:"function",value:r=>{}},onTileUnload:{type:"function",value:r=>{}},onTileError:{type:"function",value:(r,e,t)=>{}},_getMeshColor:{type:"function",value:r=>[255,255,255]}};class uT extends Bs{initializeState(){"onTileLoadFail"in this.props&&Yr.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return!!(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:t,changeFlags:n}){if(e.data&&e.data!==t.data&&this._loadTileset(e.data),n.viewportChanged){const{activeViewports:i}=this.state;Object.keys(i).length&&(this._updateTileset(i),this.state.lastUpdatedViewports=i,this.state.activeViewports={})}if(n.propsChanged){const{layerMap:i}=this.state;for(const s in i)i[s].needsUpdate=!0}}activateViewport(e){const{activeViewports:t,lastUpdatedViewports:n}=this.state;this.internalState.viewport=e,t[e.id]=e;const i=n?.[e.id];(!i||!e.equals(i))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:t}){const n=t&&t.props.tile;return e.picked&&(e.object=n),e.sourceTile=n,e}filterSubLayer({layer:e,viewport:t}){const{tile:n}=e.props,{id:i}=t;return n.selected&&n.viewportIds.includes(i)}_updateAutoHighlight(e){const t=e.sourceTile,n=this.state.layerMap[t?.id];n&&n.layer&&n.layer.updateAutoHighlight(e)}async _loadTileset(e){const{loadOptions:t={}}=this.props,n=this.props.loader||this.props.loaders,i=Array.isArray(n)?n[0]:n,s={loadOptions:{...t}};let o=e;if(i.preload){const A=await i.preload(e,t);A.url&&(o=A.url),A.headers&&(s.loadOptions.fetch={...s.loadOptions.fetch,headers:A.headers}),Object.assign(s,A)}const c=await Wp(o,i,s.loadOptions),f=new t_e(c,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...s});this.setState({tileset3d:f,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(f)}_onTileLoad(e){const{lastUpdatedViewports:t}=this.state;this.props.onTileLoad(e),this._updateTileset(t),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;const{tileset3d:t}=this.state,{timeline:n}=this.context,i=Object.keys(e).length;!n||!i||!t||t.selectTiles(Object.values(e)).then(s=>{this.state.frameNumber!==s&&this.setState({frameNumber:s})})}_getSubLayer(e,t){if(!e.content)return null;switch(e.type){case Yl.POINTCLOUD:return this._makePointCloudLayer(e,t);case Yl.SCENEGRAPH:return this._make3DModelLayer(e);case Yl.MESH:return this._makeSimpleMeshLayer(e,t);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,t){const{attributes:n,pointCount:i,constantRGBA:s,cartographicOrigin:o,modelMatrix:c}=e.content,{positions:f,normals:A,colors:v}=n;if(!f)return null;const w=t&&t.props.data||{header:{vertexCount:i},attributes:{POSITION:f,NORMAL:A,COLOR_0:v}},{pointSize:S,getPointColor:F}=this.props,N=this.getSubLayerClass("pointcloud",$g);return new N({pointSize:S}
vendor: 1,784 bytes, line 4566
4566,this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:w,coordinateSystem:Qr.METER_OFFSETS,coordinateOrigin:o,modelMatrix:c,getColor:s||F,_offset:0})}_make3DModelLayer(e){const{gltf:t,instances:n,cartographicOrigin:i,modelMatrix:s}=e.content,o=this.getSubLayerClass("scenegraph",Qg);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:n||PF,scenegraph:t,coordinateSystem:Qr.METER_OFFSETS,coordinateOrigin:i,modelMatrix:s,getTransformMatrix:c=>c.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,t){const n=e.content,{attributes:i,indices:s,modelMatrix:o,cartographicOrigin:c,coordinateSystem:f=Qr.METER_OFFSETS,material:A,featureIds:v}=n,{_getMeshColor:w}=this.props,S=t&&t.props.mesh||new Ys({topology:"triangle-list",attributes:d1e(i),indices:s}),F=this.getSubLayerClass("mesh",XC);return new F(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:S,data:PF,getColor:w(e),pbrMaterial:A,modelMatrix:o,coordinateOrigin:c,coordinateSystem:f,featureIds:v,_offset:0})}renderLayers(){const{tileset3d:e,layerMap:t}=this.state;return e?e.tiles.map(n=>{const i=t[n.id]=t[n.id]||{tile:n};let{layer:s}=i;return n.selected&&(s?i.needsUpdate&&(s=this._getSubLayer(n,s),i.needsUpdate=!1):s=this._getSubLayer(n)),i.layer=s,s}).filter(Boolean):null}}uT.defaultProps=h1e;uT.layerName="Tile3DLayer";function d1e(r){const e={};return e.positions={...r.positions,value:new Float32Array(r.positions.value)},r.normals&&(e.normals=r.normals),r.texCoords&&(e.texCoords=r.texCoords),r.colors&&(e.colors=r.colors),r.uvRegions&&(e.uvRegions=r.uvRegions),e}const p1e="4.2.4",SN={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:p1e,w
4566orker:!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}}};({...SN});const RF=[1],A1e={...ou.defaultProps,elevationData:H_,texture:{...H_,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:[SN]};function FF(r){return Array.isArray(r)?r.join(";"):r||""}class fT extends Bs{updateState({props:e,oldProps:t}){const n=e.elevationData!==t.elevationData;if(n){const{elevationData:s}=e,o=s&&(Array.isArray(s)||s.includes("{x}")&&s.includes("{y}"));this.setState({isTiled:o})}const i=n||e.meshMaxError!==t.meshMaxError||e.elevationDecoder!==t.elevationDecoder||e.bounds!==t.bounds;if(!this.state.isTiled&&i){const s=this.loadTerrain(e);this.setState({terrain:s})}e.workerUrl&&Yr.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:e,bounds:t,elevationDecoder:n,meshMaxError:i,signal:s}){if(!e)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?i*2:0,...o?.terrain,bounds:t,meshMaxError:i,elevationDecoder:n}};const{fetch:c}=this.props;return c(e,{propName:"elevationData",layer:this,loadOptions:o,signal:s})}getTiledTerrainData(e){const{elevationData:t,fetch:n,texture:i,elevationDecoder:s,meshMaxError:o}=this.props,{viewport:c}=this.context,f=ph(t,e),A=i&&ph(i,e),{signal:v}=e;let w=[0,0],S=[0,0];if(c.isGeospatial){const $=e.bbox;w=c.projectFlat([$.west,$.south]),S=c.projectFlat([$.east,$.north])}else{const $=e.bbox;w=[$.left,$.bottom],S=[$.right,$.top]}const F=[w[0],w[1],S[0],S[1]],N=this.loadTerrain({elevationData:f,bounds:F,elevationDecoder:s,meshMaxError:o,signal:v}),U=A?n(A,{propName:"texture",layer:this,loaders:[],signal:v}).catch($=>null):Promise.resolve(null);return Promise.all([N,U])}renderSubLayers(e){const t=this.getSubLayerClass("mesh",Ah),{color:n,wireframe:i,material:s}=this.props,{data:o}=e;if(!o)return null;const[c,f]=o;return new t(e,{data:RF,mesh:c,texture:f,_instanced:!1,coordinateSystem:Qr.CARTESIAN,getPosition:A=>[0,0,0],getColor:n,wireframe:i,material:s})}onViewportLoad(e){if(!e)return;const{zRange:t}=this.state,n=e.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(f=>f[2]));if(n.length===0)return;const i=Math.min(...n.map(o=>o[0])),s=Math.max(...n.map(o=>o[1]));(!t||i<t[0]||s>t[1])&&this.setState({zRange:[i,s]})}renderLayers(){const{color:e,material:t,elevationData:n,texture:i,wireframe:s,meshMaxError:o,elevationDecoder:c,tileSize:f,maxZoom:A,minZoom:v,extent:w,maxRequests:S,onTileLoad:F,onTileUnload:N,onTileError:U,maxCacheSize:$,maxCacheByteSize:G,refinementStrategy:H}=this.props;if(this.state.isTiled)return new ou(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:FF(n),texture:FF(i),meshMaxError:o,elevationDecoder:c}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:f,maxZoom:A,minZoom:v,extent:w,maxRequests:S,onTileLoad:F,onTileUnload:N,onTileError:U,maxCacheSize:$,maxCacheByteSize:G,refinementStrategy:H});if(!n)return null;const J=this.getSubLayerClass("mesh",Ah);return new J(this.getSubLayerProps({id:"mesh"}),{data:RF,mesh:this.state.terrain,texture:i,_instanced:!1,getPosition:ue=>[0,0,0],getColor:e,material:t,wireframe:s})}}fT.defaultProps=A1e;fT.layerName="TerrainLayer";const g1e={clipBounds:[0,0,1,1],clipByInstance:void 0},IN=`
4567uniform clipUniforms {
4568  vec4 bounds;
4569} clip;
4570
4571bool clip_isInBounds(vec2 position) {
4572  return position.x >= clip.bounds[0] && position.y >= clip.bounds[1] && position.x < clip.bounds[2] && position.y < clip.bounds[3];
4573}
4574`,m1e={name:"clip",vs:IN,uniformTypes:{bounds:"vec4<f32>"}},_1e={"vs:#decl":`
4575out float clip_isVisible;
4576`,"vs:DECKGL_FILTER_GL_POSITION":`
4577  clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
4578`,"fs:#decl":`
4579in float clip_isVisible;
4580`,"fs:DECKGL_FILTER_COLOR":`
4581  if (clip_isVisible < 0.5) discard;
4582`},y1e={name:"clip",fs:IN,uniformTypes:{bounds:"vec4<f32>"}},v1e={"vs:#decl":`
4583out vec2 clip_commonPosition;
4584`,"vs:DECKGL_FILTER_GL_POSITION":`
4585  clip_commonPosition = geometry.position.xy;
4586`,"fs:#decl":`
4587in vec2 clip_commonPosition;
4588`,"fs:DECKGL_FILTER_COLOR":`
4589  if (!clip_isInBounds(clip_commonPosition)) discard;
4590`};class Ky extends _y{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=!!this.props.clipByInstance),this.state.clipByInstance=e,e?{modules:[m1e],inject:_1e}:{modules:[y1e],inject:v1e}}draw(){const{clipBounds:e}=this.props,t={};if(this.state.clipByInstance)t.bounds=e;else{const n=this.projectPosition([e[0],e[1],0]),i=this.projectPosition([e[2],e[3],0]);t.bounds=[Math.min(n[0],i[0]),Math.min(n[1],i[1]),Math.max(n[0],i[0]),Math.max(n[1],i[1])]}this.setShaderModuleProps({clip:t})}}Ky.defaultProps=g1e;Ky.extensionName="ClipExtension";const b1e=`
4591in float collisionPriorities;
4592
4593uniform sampler2D collision_texture;
4594
4595uniform collisionUniforms {
4596  bool sort;
4597  bool enabled;
4598} collision;
4599
4600vec2 collision_getCoords(vec4 position) {
4601  vec4 collision_clipspace = project_common_position_to_clipspace(position);
4602  return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
4603}
4604
4605float collision_match(vec2 tex, vec3 pickingColor) {
4606  vec4 collision_pickingColor = texture(collision_texture, tex);
4607  float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
4608  float e = 0.001;
4609  return step(delta, e);
4610}
4611
4612float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
4613  if (!collision.enabled) {
4614    return 1.0;
4615  }
4616
4617  // Visibility test, sample area of 5x5 pixels in order to fade in/out.
4618  // Due to the locality, the lookups will be cached
4619  // This reduces the flicker present when objects are shown/hidden
4620  const int N = 2;
4621  float accumulator = 0.0;
4622  vec2 step = vec2(1.0 / project.viewportSize);
4623
4624  const float floatN = float(N);
4625  vec2 delta = -floatN * step;
4626  for(int i = -N; i <= N; i++) {
4627    delta.x = -step.x * floatN;
4628    for(int j = -N; j <= N; j++) {
4629      accumulator += collision_match(texCoords + delta, pickingColor);
4630      delta.x += step.x;
4631    }
4632    delta.y += step.y;
4633  }
4634
4635  float W = 2.0 * floatN + 1.0;
4636  return pow(accumulator / (W * W), 2.2);
4637}
4638`,x1e={"vs:#decl":`
4639  float collision_fade = 1.0;
4640`,"vs:DECKGL_FILTER_GL_POSITION":`
4641  if (collision.sort) {
4642    float collisionPriority = collisionPriorities;
4643    position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000
4644  }
4645
4646  if (collision.enabled) {
4647    vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
4648    vec2 collision_texCoords = collision_getCoords(collision_common_position);
4649    collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
4650    if (collision_fade < 0.0001) {
4651      // Position outside clip space bounds to discard
4652      position = vec4(0.0, 0.0, 2.0, 1.0);
4653    }
4654  }
4655  `,"vs:DECKGL_FILTER_COLOR":`
4656  color.a *= collision_fade;
4657  `},w1e=r=>{if(!r||!("dummyCollisionMap"in r))return{};const{enabled:e,collisionFBO:t,drawToCollisionMap:n,dummyCollisionMap:i}=r;return{enabled:e&&!n,sort:!!n,collision_texture:!n&&t?t.colorAttachments[0]:i}},C1e={name:"collision",dependencies:[hy],vs:b1e,inject:x1e,getUniforms:w1e,uniformTypes:{sort:"i32",enabled:"i32"}};class T1e extends dy{renderCollisionMap(e,t){const i=[0,0,0,0],s=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:i,scissorRect:s,target:e,pass:"collision"})}getLayerParameters(e,t,n){return{...e.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}getShaderModuleProps(){return{collision:{drawToCollisionMap:!0},picking:{isActive:1,isAttribute:!1},lighting:{enabled:!1}}}}const W1=2;class E1e{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}setup(e){this.context=e;const{device:t}=e;this.dummyCollisionMap=t.createTexture({width:1,height:1}),this.collisionFilterPass=new T1e(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:n,viewports:i,onViewportActive:s,views:o,isPicking:c,preRenderStats:f={}}){const{device:A}=this.context;if(c)return;const v=t.filter(({props:{visible:$,collisionEnabled:G}})=>$&&G);if(v.length===0){this.channels={};return}const w=e?.filter($=>$.useInPicking&&f[$.id]),S=f["mask-effect"]?.didRender,F=this._groupByCollisionGroup(A,v),N=i[0],U=!this.lastViewport||!this.lastViewport.equals(N)||S;for(const $ in F){const G=this.collisionFBOs[$],H=F[$],[J,ue]=A.canvasContext.getPixelSize();G.resize({width:J/W1,height:ue/W1}),this._render(H,{effects:w,layerFilter:n,onViewportActive:s,views:o,viewport:N,viewportChanged:U})}}_render(e,{effects:t,layerFilter:n,onViewportActive:i,views:s,viewport:o,viewportChanged:c}){const{collisionGroup:f}=e,A=this.channels[f];if(!A)return;const v=c||e===A||!rs(A.layers,e.layers,1)||e.layerBounds.some((w,S)=>!ma(w,A.layerBounds[S]))||e.allLayersLoaded!==A.allLayersLoaded||e.layers.some(w=>w.props.transitions);if(this.channels[f]=e,v){this.lastViewport=o;const w=this.collisionFBOs[f];this.collisionFilterPass.renderCollisionMap(w,{pass:"collision-filter",isPicking:!0,layers:e.layers,effects:t,layerFilter:n,viewports:o?[o]:[],onViewportActive:i,views:s,shaderModuleProps:{collision:{enabled:!0,dummyCollisionMap:this.dummyCollisionMap},project:{devicePixelRatio:w.device.canvasContext.getDevicePixelRatio()/W1}}})}}_groupByCollisionGroup(e,t){const n={};for(const i of t){const s=i.props.collisionGroup;let o=n[s];o||(o={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},n[s]=o),o.layers.push(i),o.layerBounds.push(i.getBounds()),i.isLoaded||(o.allLayersLoaded=!1)}for(const i of Object.keys(n))this.collisionFBOs[i]||this.createFBO(e,i),this.channels[i]||(this.channels[i]=n[i]);for(const i of Object.keys(this.collisionFBOs))n[i]||this.destroyFBO(i);return n}getShaderModuleProps(e){const{collisionGroup:t,collisionEnabled:n}=e.props,{collisionFBOs:i,dummyCollisionMap:s}=this,o=i[t];return{collision:{enabled:n&&!!o,collisionFBO:o,dummyCollisionMap:s}}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(const e of Object.keys(this.collisionFBOs))this.destroyFBO(e);this.collisionFBOs={},this.lastViewport=void 0}createFBO(e,t){const{width:n,height:i}=e.gl.canvas,s=e.createTexture({format:"rgba8unorm",width:n,height:i,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),o=e.createTexture({format:"depth16unorm",width:n,height:i,mipmaps:!1});
4657this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:n,height:i,colorAttachments:[s],depthStencilAttachment:o})}destroyFBO(e){const t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}}const B1e={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}};class hT extends _y{getShaders(){return{modules:[C1e]}}draw({shaderModuleProps:e}){e.collision?.drawToCollisionMap&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(e,t){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new E1e),this.getAttributeManager().add({collisionPriorities:{size:1,stepMode:"dynamic",accessor:"getCollisionPriority"}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}}hT.defaultProps=B1e;hT.extensionName="CollisionFilterExtension";function Px(r,e){const t=e?.globalFeatureId;return t!==void 0?S1e(r,t):I1e(r,e?.type)}function S1e(r,e){const t=MN(r);for(const n of t){let i=0,s=n.featureIds.value[0];for(let o=0;o<n.featureIds.value.length;o++){const c=n.featureIds.value[o];if(c!==s){if(e===n.globalFeatureIds.value[i])return Q_(n,i,o);i=o,s=c}}if(e===n.globalFeatureIds.value[i])return Q_(n,i,n.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function I1e(r,e){const t=MN(r);return P1e(t)}function M1e(r,e,t){switch(r.type){case"Point":return O1e(r,e,t);case"LineString":return D1e(r,e,t);case"Polygon":return PN(r,e,t);default:const n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function MN(r,e){const t=[];return r.points&&(r.points.type="Point",t.push(r.points)),r.lines&&(r.lines.type="LineString",t.push(r.lines)),r.polygons&&(r.polygons.type="Polygon",t.push(r.polygons)),t}function P1e(r){const e=[];for(const t of r){if(t.featureIds.value.length===0)continue;let n=0,i=t.featureIds.value[0];for(let s=0;s<t.featureIds.value.length;s++){const o=t.featureIds.value[s];o!==i&&(e.push(Q_(t,n,s)),n=s,i=o)}e.push(Q_(t,n,t.featureIds.value.length))}return e}function Q_(r,e,t){const n=M1e(r,e,t),i=F1e(r,e),s=R1e(r,e);return{type:"Feature",geometry:n,properties:i,...s}}function R1e(r,e=0,t){return r.fields&&r.fields[r.featureIds.value[e]]}function F1e(r,e=0,t){const n=Object.assign({},r.properties[r.featureIds.value[e]]);for(const i in r.numericProps)n[i]=r.numericProps[i].value[e];return n}function PN(r,e=-1/0,t=1/0){const{positions:n}=r,i=r.polygonIndices.value.filter(f=>f>=e&&f<=t),s=r.primitivePolygonIndices.value.filter(f=>f>=e&&f<=t);if(!(i.length>2)){const f=[];for(let A=0;A<s.length-1;A++){const v=s[A],w=s[A+1],S=ey(n,v,w);f.push(S)}return{type:"Polygon",coordinates:f}}const c=[];for(let f=0;f<i.length-1;f++){const A=i[f],v=i[f+1],w=PN(r,A,v).coordinates;c.push(w)}return{type:"MultiPolygon",coordinates:c}}function D1e(r,e=-1/0,t=1/0){const{positions:n}=r,i=r.pathIndices.value.filter(c=>c>=e&&c<=t);if(!(i.length>2))return{type:"LineString",coordinates:ey(n,i[0],i[1])};const o=[];for(let c=0;c<i.length-1;c++){const f=ey(n,i[c],i[c+1]);o.push(f)}return{type:"MultiLineString",coordinates:o}}function O1e(r,e,t){const{positions:n}=r,i=ey(n,e,t);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function ey(r,e,t){e=e||0,t=t||r.value.length/r.size;const n=[];for(let i=e;i<t;i++){const s=Array();for(let o=i*r.size;o<(i+1)*r.size;o++)s.push(Number(r.value[o]));n.push(s)}return n}var T0={};var DF;function L1e(){return DF||(DF=1,T0.read=function(r,e,t,n,i){var s,o,c=i*8-n-1,f=(1<<c)-1,A=f>>1,v=-7,w=t?i-1:0,S=t?-1:1,F=r[e+w];for(w+=S,s=F&(1<<-v)-1,F>>=-v,v+=c;v>0;s=s*256+r[e+w],w+=S,v-=8);for(o=s&(1<<-v)-1,s>>=-v,v+=n;v>0;o=o*256+r[e+w],w+=S,v-=8);if(s===0)s=1-A;else{if(s===f)return o?NaN:(F?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-A}return(F?-1:1)*o*Math.pow(2,s-n)},T0.write=function(r,e,t,n,i,s){var o,c,f,A=s*8-i-1,v=(1<<A)-1,w=v>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,F=n?0:s-1,N=n?1:-1,U=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=v):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+w>=1?e+=S/f:e+=S*Math.pow(2,1-w),e*f>=2&&(o++,f/=2),o+w>=v?(c=0,o=v):o+w>=1?(c=(e*f-1)*Math.pow(2,i),o=o+w):(c=e*Math.pow(2,w-1)*Math.pow(2,i),o=0));i>=8;r[t+F]=c&255,F+=N,c/=256,i-=8);for(o=o<<i|c,A+=i;A>0;r[t+F]=o&255,F+=N,o/=256,A-=8);r[t+F-N]|=U*128}),T0}var J1,OF;function k1e(){if(OF)return J1;OF=1,J1=e;var r=L1e();function e(W){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(W)?W:new 
vendor: 6,282 bytes, line 4657
4657Uint8Array(W||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var t=65536*65536,n=1/t,i=12,s=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");e.prototype={destroy:function(){this.buf=null},readFields:function(W,re,Ee){for(Ee=Ee||this.length;this.pos<Ee;){var et=this.readVarint(),_e=et>>3,Le=this.pos;this.type=et&7,W(_e,re,this),this.pos===Le&&this.skip(et)}return re},readMessage:function(W,re){return this.readFields(W,re,this.readVarint()+this.pos)},readFixed32:function(){var W=se(this.buf,this.pos);return this.pos+=4,W},readSFixed32:function(){var W=Ue(this.buf,this.pos);return this.pos+=4,W},readFixed64:function(){var W=se(this.buf,this.pos)+se(this.buf,this.pos+4)*t;return this.pos+=8,W},readSFixed64:function(){var W=se(this.buf,this.pos)+Ue(this.buf,this.pos+4)*t;return this.pos+=8,W},readFloat:function(){var W=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,W},readDouble:function(){var W=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,W},readVarint:function(W){var re=this.buf,Ee,et;return et=re[this.pos++],Ee=et&127,et<128||(et=re[this.pos++],Ee|=(et&127)<<7,et<128)||(et=re[this.pos++],Ee|=(et&127)<<14,et<128)||(et=re[this.pos++],Ee|=(et&127)<<21,et<128)?Ee:(et=re[this.pos],Ee|=(et&15)<<28,o(Ee,W,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var W=this.readVarint();return W%2===1?(W+1)/-2:W/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var W=this.readVarint()+this.pos,re=this.pos;return this.pos=W,W-re>=i&&s?me(this.buf,re,W):de(this.buf,re,W)},readBytes:function(){var W=this.readVarint()+this.pos,re=this.buf.subarray(this.pos,W);return this.pos=W,re},readPackedVarint:function(W,re){if(this.type!==e.Bytes)return W.push(this.readVarint(re));var Ee=c(this);for(W=W||[];this.pos<Ee;)W.push(this.readVarint(re));return W},readPackedSVarint:function(W){if(this.type!==e.Bytes)return W.push(this.readSVarint());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readSVarint());return W},readPackedBoolean:function(W){if(this.type!==e.Bytes)return W.push(this.readBoolean());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readBoolean());return W},readPackedFloat:function(W){if(this.type!==e.Bytes)return W.push(this.readFloat());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readFloat());return W},readPackedDouble:function(W){if(this.type!==e.Bytes)return W.push(this.readDouble());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readDouble());return W},readPackedFixed32:function(W){if(this.type!==e.Bytes)return W.push(this.readFixed32());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readFixed32());return W},readPackedSFixed32:function(W){if(this.type!==e.Bytes)return W.push(this.readSFixed32());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readSFixed32());return W},readPackedFixed64:function(W){if(this.type!==e.Bytes)return W.push(this.readFixed64());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readFixed64());return W},readPackedSFixed64:function(W){if(this.type!==e.Bytes)return W.push(this.readSFixed64());var re=c(this);for(W=W||[];this.pos<re;)W.push(this.readSFixed64());return W},skip:function(W){var re=W&7;if(re===e.Varint)for(;this.buf[this.pos++]>127;);else if(re===e.Bytes)this.pos=this.readVarint()+this.pos;else if(re===e.Fixed32)this.pos+=4;else if(re===e.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+re)},writeTag:function(W,re){this.writeVarint(W<<3|re)},realloc:function(W){for(var re=this.length||16;re<this.pos+W;)re*=2;if(re!==this.length){var Ee=new Uint8Array(re);Ee.set(this.buf),this.buf=Ee,this.length=re}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(W){this.realloc(4),Te(this.buf,W,this.pos),this.pos+=4},writeSFixed32:function(W){this.realloc(4),Te(this.buf,W,this.pos),this.pos+=4},writeFixed64:function(W){this.realloc(8),Te(this.buf,W&-1,this.pos),Te(this.buf,Math.floor(W*n),this.pos+4),this.pos+=8},writeSFixed64:function(W){this.realloc(8),Te(this.buf,W&-1,this.pos),Te(this.buf,Math.floor(W*n),this.pos+4),this.pos+=8},writeVarint:function(W){if(W=+W||0,W>268435455||W<0){A(W,this);return}this.realloc(4),this.buf[this.pos++]=W&127|(W>127?128:0),!(W<=127)&&(this.buf[this.pos++]=(W>>>=7)&127|(W>127?128:0),!(W<=127)&&(this.buf[this.pos++]=(W>>>=7)&127|(W>127?128:0),!(W<=127)&&(this.buf[this.pos++]=W>>>7&127)))},writeSVarint:function(W){this.writeVarint(W<0?-W*2-1:W*2)},writeBoolean:function(W){this.writeVarint(!!W)},writeString:function(W){W=String(W),this.realloc(W.length*4),this.pos++;var re=this.pos;this.pos=pe(this.buf,W,this.pos);var Ee=this.pos-re;Ee>=128&&S(re,Ee,this),this.pos=re-1,this.writeVarint(Ee),this.pos+=Ee},writeFloat:function(W){this.realloc(4),r.write(this.buf,W,this.pos,!0,23,4),this.pos+=4},writeDouble:function(W){this.realloc(8),r.write(this.buf,W,this.pos,!0,52,8),this.pos+=8},writeBytes:function(W){var re=W.length;this.writeVarint(re),this.realloc(re);for(var Ee=0;Ee<re;Ee++)this.buf[this.pos++]=W[Ee]},writeRawMessage:function(W,re){this.pos++;var Ee=this.pos;W(re,this);var et=this.pos-Ee;et>=128&&S(Ee,et,this),this.pos=Ee-1,this.writeVarint(et),this.pos+=et},writeMessage:function(W,re,Ee){this.writeTag(W,e.Bytes),this.writeRawMessage(re,Ee)},writePackedVarint:function(W,re){re.length&&this.writeMessage(W,F,re)},writePackedSVarint:function(W,re){re.length&&this.writeMessage(W,N,re)},writePackedBoolean:function(W,re){re.length&&this.writeMessage(W,G,re)},writePackedFloat:function(W,re){re.length&&this.writeMessage(W,U,re)},writePackedDouble:function(W,re){re.length&&this.writeMessage(W,$,re)},writePackedFixed32:function(W,re){re.length&&this.writeMessage(W,H,re)},writePackedSFixed32:function(W,re){re.length&&this.writeMessage(W,J,re)},writePackedFixed64:function(W,re){re.length&&this.writeMessage(W,ue,re)},writePackedSFixed64:function(W,re){re.length&&this.writeMessage(W,q,re)},writeBytesField:function(W,re){this.writeTag(W,e.Bytes),this.writeBytes(re)},writeFixed32Field:function(W,re){this.writeTag(W,e.Fixed32),this.writeFixed32(re)},writeSFixed32Field:function(W,re){this.writeTag(W,e.Fixed32),this.writeSFixed32(re)},writeFixed64Field:function(W,re){this.writeTag(W,e.Fixed64),this.writeFixed64
vendor: 4,982 bytes, line 4657
4657(re)},writeSFixed64Field:function(W,re){this.writeTag(W,e.Fixed64),this.writeSFixed64(re)},writeVarintField:function(W,re){this.writeTag(W,e.Varint),this.writeVarint(re)},writeSVarintField:function(W,re){this.writeTag(W,e.Varint),this.writeSVarint(re)},writeStringField:function(W,re){this.writeTag(W,e.Bytes),this.writeString(re)},writeFloatField:function(W,re){this.writeTag(W,e.Fixed32),this.writeFloat(re)},writeDoubleField:function(W,re){this.writeTag(W,e.Fixed64),this.writeDouble(re)},writeBooleanField:function(W,re){this.writeVarintField(W,!!re)}};function o(W,re,Ee){var et=Ee.buf,_e,Le;if(Le=et[Ee.pos++],_e=(Le&112)>>4,Le<128||(Le=et[Ee.pos++],_e|=(Le&127)<<3,Le<128)||(Le=et[Ee.pos++],_e|=(Le&127)<<10,Le<128)||(Le=et[Ee.pos++],_e|=(Le&127)<<17,Le<128)||(Le=et[Ee.pos++],_e|=(Le&127)<<24,Le<128)||(Le=et[Ee.pos++],_e|=(Le&1)<<31,Le<128))return f(W,_e,re);throw new Error("Expected varint not more than 10 bytes")}function c(W){return W.type===e.Bytes?W.readVarint()+W.pos:W.pos+1}function f(W,re,Ee){return Ee?re*4294967296+(W>>>0):(re>>>0)*4294967296+(W>>>0)}function A(W,re){var Ee,et;if(W>=0?(Ee=W%4294967296|0,et=W/4294967296|0):(Ee=~(-W%4294967296),et=~(-W/4294967296),Ee^4294967295?Ee=Ee+1|0:(Ee=0,et=et+1|0)),W>=18446744073709552e3||W<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");re.realloc(10),v(Ee,et,re),w(et,re)}function v(W,re,Ee){Ee.buf[Ee.pos++]=W&127|128,W>>>=7,Ee.buf[Ee.pos++]=W&127|128,W>>>=7,Ee.buf[Ee.pos++]=W&127|128,W>>>=7,Ee.buf[Ee.pos++]=W&127|128,W>>>=7,Ee.buf[Ee.pos]=W&127}function w(W,re){var Ee=(W&7)<<4;re.buf[re.pos++]|=Ee|((W>>>=3)?128:0),W&&(re.buf[re.pos++]=W&127|((W>>>=7)?128:0),W&&(re.buf[re.pos++]=W&127|((W>>>=7)?128:0),W&&(re.buf[re.pos++]=W&127|((W>>>=7)?128:0),W&&(re.buf[re.pos++]=W&127|((W>>>=7)?128:0),W&&(re.buf[re.pos++]=W&127)))))}function S(W,re,Ee){var et=re<=16383?1:re<=2097151?2:re<=268435455?3:Math.floor(Math.log(re)/(Math.LN2*7));Ee.realloc(et);for(var _e=Ee.pos-1;_e>=W;_e--)Ee.buf[_e+et]=Ee.buf[_e]}function F(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeVarint(W[Ee])}function N(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeSVarint(W[Ee])}function U(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeFloat(W[Ee])}function $(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeDouble(W[Ee])}function G(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeBoolean(W[Ee])}function H(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeFixed32(W[Ee])}function J(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeSFixed32(W[Ee])}function ue(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeFixed64(W[Ee])}function q(W,re){for(var Ee=0;Ee<W.length;Ee++)re.writeSFixed64(W[Ee])}function se(W,re){return(W[re]|W[re+1]<<8|W[re+2]<<16)+W[re+3]*16777216}function Te(W,re,Ee){W[Ee]=re,W[Ee+1]=re>>>8,W[Ee+2]=re>>>16,W[Ee+3]=re>>>24}function Ue(W,re){return(W[re]|W[re+1]<<8|W[re+2]<<16)+(W[re+3]<<24)}function de(W,re,Ee){for(var et="",_e=re;_e<Ee;){var Le=W[_e],Ge=null,Ze=Le>239?4:Le>223?3:Le>191?2:1;if(_e+Ze>Ee)break;var tt,rt,ut;Ze===1?Le<128&&(Ge=Le):Ze===2?(tt=W[_e+1],(tt&192)===128&&(Ge=(Le&31)<<6|tt&63,Ge<=127&&(Ge=null))):Ze===3?(tt=W[_e+1],rt=W[_e+2],(tt&192)===128&&(rt&192)===128&&(Ge=(Le&15)<<12|(tt&63)<<6|rt&63,(Ge<=2047||Ge>=55296&&Ge<=57343)&&(Ge=null))):Ze===4&&(tt=W[_e+1],rt=W[_e+2],ut=W[_e+3],(tt&192)===128&&(rt&192)===128&&(ut&192)===128&&(Ge=(Le&15)<<18|(tt&63)<<12|(rt&63)<<6|ut&63,(Ge<=65535||Ge>=1114112)&&(Ge=null))),Ge===null?(Ge=65533,Ze=1):Ge>65535&&(Ge-=65536,et+=String.fromCharCode(Ge>>>10&1023|55296),Ge=56320|Ge&1023),et+=String.fromCharCode(Ge),_e+=Ze}return et}function me(W,re,Ee){return s.decode(W.subarray(re,Ee))}function pe(W,re,Ee){for(var et=0,_e,Le;et<re.length;et++){if(_e=re.charCodeAt(et),_e>55295&&_e<57344)if(Le)if(_e<56320){W[Ee++]=239,W[Ee++]=191,W[Ee++]=189,Le=_e;continue}else _e=Le-55296<<10|_e-56320|65536,Le=null;else{_e>56319||et+1===re.length?(W[Ee++]=239,W[Ee++]=191,W[Ee++]=189):Le=_e;continue}else Le&&(W[Ee++]=239,W[Ee++]=191,W[Ee++]=189,Le=null);_e<128?W[Ee++]=_e:(_e<2048?W[Ee++]=_e>>6|192:(_e<65536?W[Ee++]=_e>>12|224:(W[Ee++]=_e>>18|240,W[Ee++]=_e>>12&63|128),W[Ee++]=_e>>6&63|128),W[Ee++]=_e&63|128)}return Ee}return J1}var N1e=k1e();const U1e=_h(N1e),z1e="4.2.4",RN={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:z1e,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}}};({...RN});const G1e={Point:FN,MultiPoint:V1e,LineString:DN,MultiLineString:H1e,Polygon:ON,MultiPolygon:j1e};function FN([r,e],[t,n],i){const s=Cc(t[0],n[0],r),o=Cc(t[1],n[1],e);return i.unprojectFlat([s,o])}function dT(r,e,t){return r.map(n=>FN(n,e,t))}function V1e(r,e,t){return dT(r,e,t)}function DN(r,e,t){return dT(r,e,t)}function H1e(r,e,t){return r.map(n=>DN(n,e,t))}function ON(r,e,t){return r.map(n=>dT(n,e,t))}function j1e(r,e,t){return r.map(n=>ON(n,e,t))}
4657function $1e(r,e,t){const n=t.projectFlat([e.west,e.north]),i=t.projectFlat([e.east,e.south]),s=[n,i];return{...r,coordinates:G1e[r.type](r.coordinates,s,t)}}const W1e=["points","lines","polygons"];function J1e(r,e,t,n){for(const i of W1e){const s=r[i]&&X1e(r[i],e,t,n);if(s>=0)return s}return-1}function X1e(r,e,t,n){const i=r.featureIds.value;if(!i.length)return-1;let s=0,o=i[i.length-1]+1;if(n){const f=K1e(r,n);if(f)s=f[0],o=f[1]+1;else return-1}let c=-1;if(e in r.numericProps){const f=r.numericProps[e].value.findIndex((A,v)=>A===t&&i[v]>=s&&i[v]<o);return f>=0?r.globalFeatureIds.value[f]:-1}else e?c=LF(r.properties,f=>f[e]===t,s,o):r.fields&&(c=LF(r.fields,f=>f.id===t,s,o));return c>=0?q1e(r,c):-1}function K1e(r,e){if(!r.__layers){const t={},{properties:n}=r;for(let i=0;i<n.length;i++){const{layerName:s}=n[i];s&&(t[s]?t[s][1]=i:t[s]=[i,i])}r.__layers=t}return r.__layers[e]}function q1e(r,e){if(!r.__ids){const t=[],n=r.featureIds.value,i=r.globalFeatureIds.value;for(let s=0;s<n.length;s++)t[n[s]]=i[s];r.__ids=t}return r.__ids[e]}function LF(r,e,t,n){for(let i=t;i<n;i++)if(e(r[i],i))return i;return-1}const X1=512,Y1e={...iu.defaultProps,data:H_,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[RN],binary:!0};class Xp extends ou{initializeState(){super.initializeState();const 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!!(this.state?.data&&super.isLoaded)}updateState({props:e,oldProps:t,context:n,changeFlags:i}){i.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:e,oldProps:t,context:n,changeFlags:i}),this._setWGS84PropertyForTiles());const{highlightColor:s}=e;s!==t.highlightColor&&Array.isArray(s)&&this.setState({highlightColor:s})}async _updateTileData(){let e=this.props.data,t=null;if(typeof e=="string"&&!nde(e)){const{onDataLoad:n,fetch:i}=this.props;this.setState({data:null,tileJSON:null});try{t=await i(e,{propName:"data",layer:this,loaders:[]})}catch(s){this.raiseError(s,"loading TileJSON"),e=null}n&&n(t,{propName:"data",layer:this})}else e&&typeof e=="object"&&"tilejson"in e&&(t=e);t&&(e=t.tiles),this.setState({data:e,tileJSON:t})}_getTilesetOptions(){const e=super._getTilesetOptions(),t=this.state.tileJSON,{minZoom:n,maxZoom:i}=this.props;return t&&(Number.isFinite(t.minzoom)&&t.minzoom>n&&(e.minZoom=t.minzoom),Number.isFinite(t.maxzoom)&&(!Number.isFinite(i)||t.maxzoom<i)&&(e.maxZoom=t.maxzoom)),e}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(e){const{data:t,binary:n}=this.state,{index:i,signal:s}=e,o=ph(t,e);if(!o)return Promise.reject("Invalid URL");let c=this.getLoadOptions();const{fetch:f}=this.props;return c={...c,mimeType:"application/x-protobuf",mvt:{...c?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:i},gis:n?{format:"binary"}:{}},f(o,{propName:"data",layer:this,loadOptions:c,signal:s})}renderSubLayers(e){const{x:t,y:n,z:i}=e.tile.index,s=Math.pow(2,i),o=X1/s,c=-o,f=X1*t/s,A=X1*(1-n/s),v=new vn().scale([o,c,1]);e.autoHighlight=!1,this.context.viewport.resolution||(e.modelMatrix=v,e.coordinateOrigin=[f,A,0],e.coordinateSystem=Qr.CARTESIAN,e.extensions=[...e.extensions||[],new Ky]);const w=super.renderSubLayers(e);return this.state.binary&&!(w instanceof iu)&&Yr.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),w}_updateAutoHighlight(e){const{uniqueIdProperty:t}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:i}=this.state,s=e.object;let o=null,c=null;s&&(o=K1(s,t),c=kF(s));let{highlightColor:f}=this.props;typeof f=="function"&&(f=f(e)),(n!==o||i!==c)&&this.setState({highlightColor:f,hoveredFeatureId:o,hoveredFeatureLayerName:c})}_isWGS84(){return!!this.context.viewport.resolution}getPickingInfo(e){const t=super.getPickingInfo(e);if(this.state.binary&&t.index!==-1){const{data:n}=e.sourceLayer.props;t.object=Px(n,{globalFeatureId:t.index})}return t.object&&!this._isWGS84()&&(t.object=UF(t.object,t.tile.bbox,this.context.viewport)),t}getSubLayerPropsByTile(e){return{highlightedObjectIndex:this.getHighlightedObjectIndex(e),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(e){const{hoveredFeatureId:t,hoveredFeatureLayerName:n,binary:i}=this.state,{uniqueIdProperty:s,highlightedFeatureId:o}=this.props,c=e.content,f=NF(o);if(!(NF(t)||f))return-1;const v=f?o:t;return Array.isArray(c)?c.findIndex(w=>{const S=K1(w,s)===v,F=f||kF(w)===n;return S&&F}):c&&i?J1e(c,s,v,f?"":n):-1}_pickObjects(e){const{deck:t,viewport:n}=this.context,i=n.width,s=n.height,o=n.x,c=n.y,f=[this.id];return t.pickObjects({x:o,y:c,width:i,height:s,layerIds:f,maxObjects:e})}getRenderedFeatures(e=null){const t=this._pickObjects(e),n=new Set,i=[];for(const s of t){const o=K1(s.object,this.props.uniqueIdProperty);
4657o===void 0?i.push(s.object):n.has(o)||(n.add(o),i.push(s.object))}return i}_setWGS84PropertyForTiles(){const e="dataInWGS84";this.state.tileset.selectedTiles.forEach(n=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{get:()=>{if(!n.content)return null;if(this.state.binary&&Array.isArray(n.content)&&!n.content.length)return[];const{bbox:i}=n;if(n._contentWGS84===void 0&&ide(i)){const s=this.state.binary?Px(n.content):n.content;n._contentWGS84=s.map(o=>UF(o,i,this.context.viewport))}return n._contentWGS84}})})}}Xp.layerName="MVTLayer";Xp.defaultProps=Y1e;function K1(r,e){if(r.properties&&e)return r.properties[e];if("id"in r)return r.id}function kF(r){return r.properties?.layerName||null}function NF(r){return r!=null&&r!==""}function UF(r,e,t){const n={...r,geometry:{type:r.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>$1e(r.geometry,e,t).coordinates}),n}const zF="0123456789bcdefghjkmnpqrstuvwxyz",LN={};for(let r=0;r<zF.length;r++)LN[zF.charAt(r)]=r;const Z1e=-90,Q1e=90,e2e=-180,t2e=180;function r2e(r){let e=!0,t=Q1e,n=Z1e,i=t2e,s=e2e,o,c=0;for(let f=0,A=r.length;f<A;f++){const v=r[f].toLowerCase();c=LN[v];for(let w=4;w>=0;w--){const S=c>>w&1;e?(o=(i+s)/2,S===1?s=o:i=o):(o=(t+n)/2,S===1?n=o:t=o),e=!e}}return[n,s,t,i]}function n2e(r){const[e,t,n,i]=r2e(r);return[i,n,i,e,t,e,t,n,i,n]}const i2e={getGeohash:{type:"accessor",value:r=>r.geohash}};class qy extends df{indexToBounds(){const{data:e,getGeohash:t}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,i)=>n2e(t(n,i))}}}qy.layerName="GeohashLayer";qy.defaultProps=i2e;const s2e=Object.freeze(Object.defineProperty({__proto__:null,GeohashLayer:qy,GreatCircleLayer:TC,H3ClusterLayer:Uy,H3HexagonLayer:_l,MVTLayer:Xp,QuadkeyLayer:Fy,S2Layer:Ry,TerrainLayer:fT,Tile3DLayer:uT,TileLayer:ou,TripsLayer:Ly,_GeoCellLayer:df,_Tile2DHeader:V6,_Tileset2D:Oy,_WMSLayer:CC,_getURLFromTemplate:ph},Symbol.toStringTag,{value:"Module"}));function o2e({pointCount:r,getBinId:e}){const t=new Map;for(let n=0;n<r;n++){const i=e(n);if(i===null)continue;let s=t.get(String(i));s?s.points.push(n):(s={id:i,index:t.size,points:[n]},t.set(String(i),s))}return Array.from(t.values())}function a2e({bins:r,dimensions:e,target:t}){const n=r.length*e;(!t||t.length<n)&&(t=new Float32Array(n));for(let i=0;i<r.length;i++){const{id:s}=r[i];Array.isArray(s)?t.set(s,i*e):t[i]=s}return t}const c2e=r=>r.length,kN=(r,e)=>{let t=0;for(const n of r)t+=e(n);return t},l2e=(r,e)=>r.length===0?NaN:kN(r,e)/r.length,u2e=(r,e)=>{let t=1/0;for(const n of r){const i=e(n);i<t&&(t=i)}return t},f2e=(r,e)=>{let t=-1/0;for(const n of r){const i=e(n);i>t&&(t=i)}return t},h2e={COUNT:c2e,SUM:kN,MEAN:l2e,MIN:u2e,MAX:f2e};function d2e({bins:r,getValue:e,operation:t,target:n}){(!n||n.length<r.length)&&(n=new Float32Array(r.length));let i=1/0,s=-1/0;for(let o=0;o<r.length;o++){const{points:c}=r[o];n[o]=t(c,e),n[o]<i&&(i=n[o]),n[o]>s&&(s=n[o])}return{value:n,domain:[i,s]}}function GF(r,e,t){const n={};for(const s of r.sources||[]){const o=e[s];if(o)n[s]=p2e(o);else throw new Error(`Cannot find attribute ${s}`)}const i={};return s=>{for(const o in n)i[o]=n[o](s);return r.getValue(i,s,t)}}function p2e(r){const e=r.value,{offset:t=0,stride:n,size:i}=r.getAccessor(),s=e.BYTES_PER_ELEMENT,o=t/s,c=n?n/s:i;if(i===1)return r.isConstant?()=>e[0]:A=>{const v=o+c*A;return e[v]};let f;return r.isConstant?(f=Array.from(e),()=>f):(f=new Array(i),A=>{const v=o+c*A;for(let w=0;w<i;w++)f[w]=e[v+w];return f})}class Kp{constructor(e){this.bins=[],this.binIds=null,this.results=[],this.dimensions=e.dimensions,this.channelCount=e.getValue.length,this.props={...e,binOptions:{},pointCount:0,operations:[],customOperations:[],attributes:{}},this.needsUpdate=!0,this.setProps(e)}destroy(){}get binCount(){return this.bins.length}setProps(e){const t=this.props;if(e.binOptions&&(rs(e.binOptions,t.binOptions,2)||this.setNeedsUpdate()),e.operations)for(let n=0;n<this.channelCount;n++)e.operations[n]!==t.operations[n]&&this.setNeedsUpdate(n);if(e.customOperations)for(let n=0;n<this.channelCount;n++)!!e.customOperations[n]!=!!t.customOperations[n]&&this.setNeedsUpdate(n);e.pointCount!==void 0&&e.pointCount!==t.pointCount&&this.setNeedsUpdate(),e.attributes&&(e.attributes={...t.attributes,...e.attributes}),Object.assign(this.props,e)}setNeedsUpdate(e){e===void 0?this.needsUpdate=!0:this.needsUpdate!==!0&&(this.needsUpdate=this.needsUpdate||[],this.needsUpdate[e]=!0)}update(){if(this.needsUpdate===!0){this.bins=o2e({pointCount:this.props.pointCount,getBinId:GF(this.props.getBin,this.props.attributes,this.props.binOptions)});const e=a2e({bins:this.bins,dimensions:this.dimensions,target:this.binIds?.value});this.binIds={value:e,type:"float32",size:this.dimensions}}for(let e=0;e<this.channelCount;e++)if(this.needsUpdate===!0||this.needsUpdate[e]){const t=this.props.customOperations[e]||h2e[this.props.operations[e]],{value:n,domain:i}=d2e({bins:this.bins,getValue:GF(this.props.getValue[e],this.props.attributes,void 0),operation:t,target:this.results[e]?.value});this.results[e]={value:n,domain:i,type:"float32",size:1},this.props.onUpdate?.({channel:e})}this.needsUpdate=!1}preDraw(){}getBins(){return this.binIds}getResult(e){return this.results[e]}getResultDomain(e){return this.results[e]?.domain??[1/0,-1/0]}getBin(e){const t=this.bins[e];if(!t)return null;const n=new Array(this.channelCount);for(let i=0;i<n.length;i++){const s=this.results[i];n[i]=s?.value[e]}return{id:t.id,value:n,count:t.points.length,pointIndices:t.points}}}function NN(r,e,t){return r.createFramebuffer({width:e,height:t,colorAttachments:[r.createTexture({width:e,height:t,format:"rgba32float",mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest"}})]})}const A2e=`uniform binSorterUniforms {
4658  ivec4 binIdRange;
4659  ivec2 targetSize;
4660} binSorter;
4661`,g2e={name:"binSorter",vs:A2e,uniformTypes:{binIdRange:"vec4<i32>",targetSize:"vec2<i32>"}},UN=[1,2,4,8],VF=3e38,m2e={SUM:0,MEAN:0,MIN:0,MAX:0,COUNT:0},s_=1024;class _2e{constructor(e,t){this.binsFBO=null,this.device=e,this.model=v2e(e,t)}get texture(){return this.binsFBO?this.binsFBO.colorAttachments[0].texture:null}destroy(){this.model.destroy(),this.binsFBO?.colorAttachments[0].texture.destroy(),this.binsFBO?.destroy()}getBinValues(e){if(!this.binsFBO)return null;const t=e%s_,n=Math.floor(e/s_),i=this.device.readPixelsToArrayWebGL(this.binsFBO,{sourceX:t,sourceY:n,sourceWidth:1,sourceHeight:1}).buffer;return new Float32Array(i)}setDimensions(e,t){const n=s_,i=Math.ceil(e/n);this.binsFBO?this.binsFBO.height<i&&this.binsFBO.resize({width:n,height:i}):this.binsFBO=NN(this.device,n,i);const s={binIdRange:[t[0][0],t[0][1],t[1]?.[0]||0,t[1]?.[1]||0],targetSize:[this.binsFBO.width,this.binsFBO.height]};this.model.shaderInputs.setProps({binSorter:s})}setModelProps(e){const t=this.model;e.attributes&&t.setAttributes(e.attributes),e.constantAttributes&&t.setConstantAttributes(e.constantAttributes),e.vertexCount!==void 0&&t.setVertexCount(e.vertexCount),e.shaderModuleProps&&t.shaderInputs.setProps(e.shaderModuleProps)}update(e){if(!this.binsFBO)return;const t=y2e(e);this._updateBins("SUM",t.SUM+t.MEAN),this._updateBins("MIN",t.MIN),this._updateBins("MAX",t.MAX)}_updateBins(e,t){if(t===0)return;t|=UN[3];const n=this.model,i=this.binsFBO,s=e==="MAX"?-VF:e==="MIN"?VF:0,o=this.device.beginRenderPass({id:`gpu-aggregation-${e}`,framebuffer:i,parameters:{viewport:[0,0,i.width,i.height],colorMask:t},clearColor:[s,s,s,0],clearDepth:!1,clearStencil:!1});n.setParameters({blend:!0,blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one",blendColorOperation:e==="MAX"?"max":e==="MIN"?"min":"add",blendAlphaOperation:"add"}),n.draw(o),o.end()}}function y2e(r){const e={...m2e};for(let t=0;t<r.length;t++){const n=r[t];n&&(e[n]+=UN[t])}return e}function v2e(r,e){let t=e.vs;e.dimensions===2&&(t+=`
4662void getBin(out int binId) {
4663  ivec2 binId2;
4664  getBin(binId2);
4665  if (binId2.x < binSorter.binIdRange.x || binId2.x >= binSorter.binIdRange.y) {
4666    binId = -1;
4667  } else {
4668    binId = (binId2.y - binSorter.binIdRange.z) * (binSorter.binIdRange.y - binSorter.binIdRange.x) + binId2.x;
4669  }
4670}
4671`);const n=`#version 300 es
4672#define SHADER_NAME gpu-aggregation-sort-bins-vertex
4673
4674${t}
4675
4676out vec3 v_Value;
4677
4678void main() {
4679  int binIndex;
4680  getBin(binIndex);
4681  binIndex = binIndex - binSorter.binIdRange.x;
4682  if (binIndex < 0) {
4683    gl_Position = vec4(0.);
4684    return;
4685  }
4686  int row = binIndex / binSorter.targetSize.x;
4687  int col = binIndex - row * binSorter.targetSize.x;
4688  vec2 position = (vec2(col, row) + 0.5) / vec2(binSorter.targetSize) * 2.0 - 1.0;
4689  gl_Position = vec4(position, 0.0, 1.0);
4690  gl_PointSize = 1.0;
4691
4692#if NUM_CHANNELS == 3
4693  getValue(v_Value);
4694#elif NUM_CHANNELS == 2
4695  getValue(v_Value.xy);
4696#else
4697  getValue(v_Value.x);
4698#endif
4699}
4700`,i=`#version 300 es
4701#define SHADER_NAME gpu-aggregation-sort-bins-fragment
4702
4703precision highp float;
4704
4705in vec3 v_Value;
4706out vec4 fragColor;
4707
4708void main() {
4709  fragColor.xyz = v_Value;
4710
4711  #ifdef MODULE_GEOMETRY
4712  geometry.uv = vec2(0.);
4713  DECKGL_FILTER_COLOR(fragColor, geometry);
4714  #endif
4715
4716  fragColor.w = 1.0;
4717}
4718`;return new Di(r,{bufferLayout:e.bufferLayout,modules:[...e.modules||[],g2e],defines:{...e.defines,NON_INSTANCED_MODEL:1,NUM_CHANNELS:e.channelCount},isInstanced:!1,vs:n,fs:i,topology:"point-list",disableWarnings:!0})}const b2e=`uniform aggregatorTransformUniforms {
4719  ivec4 binIdRange;
4720  bvec3 isCount;
4721  bvec3 isMean;
4722  float naN;
4723} aggregatorTransform;
4724`,x2e={name:"aggregatorTransform",vs:b2e,uniformTypes:{binIdRange:"vec4<i32>",isCount:"vec3<f32>",isMean:"vec3<f32>"}};class w2e{constructor(e,t){this.binBuffer=null,this.valueBuffer=null,this._domains=null,this.device=e,this.channelCount=t.channelCount,this.transform=C2e(e,t),this.domainFBO=NN(e,2,1)}destroy(){this.transform.destroy(),this.binBuffer?.destroy(),this.valueBuffer?.destroy(),this.domainFBO.colorAttachments[0].texture.destroy(),this.domainFBO.destroy()}get domains(){if(!this._domains){const e=this.device.readPixelsToArrayWebGL(this.domainFBO).buffer,t=new Float32Array(e);this._domains=[[-t[4],t[0]],[-t[5],t[1]],[-t[6],t[2]]].slice(0,this.channelCount)}
4724return this._domains}setDimensions(e,t){const{model:n,transformFeedback:i}=this.transform;n.setVertexCount(e);const s={binIdRange:[t[0][0],t[0][1],t[1]?.[0]||0,t[1]?.[1]||0]};n.shaderInputs.setProps({aggregatorTransform:s});const o=e*t.length*4;(!this.binBuffer||this.binBuffer.byteLength<o)&&(this.binBuffer?.destroy(),this.binBuffer=this.device.createBuffer({byteLength:o}),i.setBuffer("binIds",this.binBuffer));const c=e*this.channelCount*4;(!this.valueBuffer||this.valueBuffer.byteLength<c)&&(this.valueBuffer?.destroy(),this.valueBuffer=this.device.createBuffer({byteLength:c}),i.setBuffer("values",this.valueBuffer))}update(e,t){if(!e)return;const n=this.transform,i=this.domainFBO,s=[0,1,2].map(f=>t[f]==="COUNT"?1:0),o=[0,1,2].map(f=>t[f]==="MEAN"?1:0),c={isCount:s,isMean:o,bins:e};n.model.shaderInputs.setProps({aggregatorTransform:c}),n.run({id:"gpu-aggregation-domain",framebuffer:i,parameters:{viewport:[0,0,2,1]},clearColor:[-3e38,-3e38,-3e38,0],clearDepth:!1,clearStencil:!1}),this._domains=null}}function C2e(r,e){const t=`#version 300 es
4725#define SHADER_NAME gpu-aggregation-domain-vertex
4726
4727uniform sampler2D bins;
4728
4729#if NUM_DIMS == 1
4730out float binIds;
4731#else
4732out vec2 binIds;
4733#endif
4734
4735#if NUM_CHANNELS == 1
4736flat out float values;
4737#elif NUM_CHANNELS == 2
4738flat out vec2 values;
4739#else
4740flat out vec3 values;
4741#endif
4742
4743const float NAN = intBitsToFloat(-1);
4744
4745void main() {
4746  int row = gl_VertexID / SAMPLER_WIDTH;
4747  int col = gl_VertexID - row * SAMPLER_WIDTH;
4748  vec4 weights = texelFetch(bins, ivec2(col, row), 0);
4749  vec3 value3 = mix(
4750    mix(weights.rgb, vec3(weights.a), aggregatorTransform.isCount),
4751    weights.rgb / max(weights.a, 1.0),
4752    aggregatorTransform.isMean
4753  );
4754  if (weights.a == 0.0) {
4755    value3 = vec3(NAN);
4756  }
4757
4758#if NUM_DIMS == 1
4759  binIds = float(gl_VertexID + aggregatorTransform.binIdRange.x);
4760#else
4761  int y = gl_VertexID / (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x);
4762  int x = gl_VertexID - y * (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x);
4763  binIds.y = float(y + aggregatorTransform.binIdRange.z);
4764  binIds.x = float(x + aggregatorTransform.binIdRange.x);
4765#endif
4766
4767#if NUM_CHANNELS == 3
4768  values = value3;
4769#elif NUM_CHANNELS == 2
4770  values = value3.xy;
4771#else
4772  values = value3.x;
4773#endif
4774
4775  gl_Position = vec4(0., 0., 0., 1.);
4776  // This model renders into a 2x1 texture to obtain min and max simultaneously.
4777  // See comments in fragment shader
4778  gl_PointSize = 2.0;
4779}
4780`,n=`#version 300 es
4781#define SHADER_NAME gpu-aggregation-domain-fragment
4782
4783precision highp float;
4784
4785#if NUM_CHANNELS == 1
4786flat in float values;
4787#elif NUM_CHANNELS == 2
4788flat in vec2 values;
4789#else
4790flat in vec3 values;
4791#endif
4792
4793out vec4 fragColor;
4794
4795void main() {
4796  vec3 value3;
4797#if NUM_CHANNELS == 3
4798  value3 = values;
4799#elif NUM_CHANNELS == 2
4800  value3.xy = values;
4801#else
4802  value3.x = values;
4803#endif
4804  if (isnan(value3.x)) discard;
4805  // This shader renders into a 2x1 texture with blending=max
4806  // The left pixel yields the max value of each channel
4807  // The right pixel yields the min value of each channel
4808  if (gl_FragCoord.x < 1.0) {
4809    fragColor = vec4(value3, 1.0);
4810  } else {
4811    fragColor = vec4(-value3, 1.0);
4812  }
4813}
4814`;return new fh(r,{vs:t,fs:n,topology:"point-list",modules:[x2e],parameters:{blend:!0,blendColorSrcFactor:"one",blendColorDstFactor:"one",blendColorOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one",blendAlphaOperation:"max"},defines:{NUM_DIMS:e.dimensions,NUM_CHANNELS:e.channelCount,SAMPLER_WIDTH:s_},varyings:["binIds","values"],disableWarnings:!0})}class Ga{static isSupported(e){return e.features.has("float32-renderable-webgl")&&e.features.has("texture-blend-float-webgl")}constructor(e,t){this.binCount=0,this.binIds=null,this.results=[],this.device=e,this.dimensions=t.dimensions,this.channelCount=t.channelCount,this.props={...t,pointCount:0,binIdRange:[[0,0]],operations:[],attributes:{},binOptions:{}},this.needsUpdate=new Array(this.channelCount).fill(!0),this.binSorter=new _2e(e,t),this.aggregationTransform=new w2e(e,t),this.setProps(t)}getBins(){const e=this.aggregationTransform.binBuffer;return e?(this.binIds?.buffer!==e&&(this.binIds={buffer:e,type:"float32",size:this.dimensions}),this.binIds):null}getResult(e){const t=this.aggregationTransform.valueBuffer;return!t||e>=this.channelCount?null:(this.results[e]?.buffer!==t&&(this.results[e]={buffer:t,type:"float32",size:1,stride:this.channelCount*4,offset:e*4}),this.results[e])}getResultDomain(e){return this.aggregationTransform.domains[e]}getBin(e){if(e<0||e>=this.binCount)return null;const{binIdRange:t}=this.props;let n;if(this.dimensions===1)n=[e+t[0][0]];else{const[[c,f],[A]]=t,v=f-c;n=[e%v+c,Math.floor(e/v)+A]}const i=this.binSorter.getBinValues(e);if(!i)return null;const s=i[3],o=[];for(let c=0;c<this.channelCount;c++){const f=this.props.operations[c];f==="COUNT"?o[c]=s:s===0?o[c]=NaN:o[c]=f==="MEAN"?i[c]/s:i[c]}
4814return{id:n,value:o,count:s}}destroy(){this.binSorter.destroy(),this.aggregationTransform.destroy()}setProps(e){const t=this.props;if("binIdRange"in e&&!rs(e.binIdRange,t.binIdRange,2)){const n=e.binIdRange;if(Yr.assert(n.length===this.dimensions),this.dimensions===1){const[[i,s]]=n;this.binCount=s-i}else{const[[i,s],[o,c]]=n;this.binCount=(s-i)*(c-o)}this.binSorter.setDimensions(this.binCount,n),this.aggregationTransform.setDimensions(this.binCount,n),this.setNeedsUpdate()}if(e.operations)for(let n=0;n<this.channelCount;n++)e.operations[n]!==t.operations[n]&&this.setNeedsUpdate(n);if(e.pointCount!==void 0&&e.pointCount!==t.pointCount&&(this.binSorter.setModelProps({vertexCount:e.pointCount}),this.setNeedsUpdate()),e.binOptions&&(rs(e.binOptions,t.binOptions,2)||this.setNeedsUpdate(),this.binSorter.model.shaderInputs.setProps({binOptions:e.binOptions})),e.attributes){const n={},i={};for(const s of Object.values(e.attributes))for(const[o,c]of Object.entries(s.getValue()))ArrayBuffer.isView(c)?i[o]=c:c&&(n[o]=c);this.binSorter.setModelProps({attributes:n,constantAttributes:i})}e.shaderModuleProps&&this.binSorter.setModelProps({shaderModuleProps:e.shaderModuleProps}),Object.assign(this.props,e)}setNeedsUpdate(e){e===void 0?this.needsUpdate.fill(!0):this.needsUpdate[e]=!0}update(){}preDraw(){if(!this.needsUpdate.some(Boolean))return;const{operations:e}=this.props,t=this.needsUpdate.map((n,i)=>n?e[i]:null);this.binSorter.update(t),this.aggregationTransform.update(this.binSorter.texture,e);for(let n=0;n<this.channelCount;n++)this.needsUpdate[n]&&(this.needsUpdate[n]=!1,this.props.onUpdate?.({channel:n}))}}let qp=class extends Bs{get isDrawable(){return!0}initializeState(){this.getAttributeManager().remove(["instancePickingColors"])}updateState(e){super.updateState(e);const t=this.getAggregatorType();if(e.changeFlags.extensionsChanged||this.state.aggregatorType!==t){this.state.aggregator?.destroy();const n=this.createAggregator(t);return n.setProps({attributes:this.getAttributeManager()?.attributes}),this.setState({aggregator:n,aggregatorType:t}),!0}return!1}finalizeState(e){super.finalizeState(e),this.state.aggregator.destroy()}updateAttributes(e){const{aggregator:t}=this.state;t.setProps({attributes:e});for(const n in e)this.onAttributeChange(n);t.update()}draw({shaderModuleProps:e}){const{aggregator:t}=this.state;t.setProps({shaderModuleProps:e}),t.preDraw()}_getAttributeManager(){return new gy(this.context.device,{id:this.props.id,stats:this.context.stats})}};qp.layerName="AggregationLayer";const Yy=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function zN(r,e=!1,t=Float32Array){let n;if(Number.isFinite(r[0]))n=new t(r);else{n=new t(r.length*4);let i=0;for(let s=0;s<r.length;s++){const o=r[s];n[i++]=o[0],n[i++]=o[1],n[i++]=o[2],n[i++]=Number.isFinite(o[3])?o[3]:255}}if(e)for(let i=0;i<n.length;i++)n[i]/=255;return n}const ty={linear:"linear",quantile:"nearest",quantize:"nearest",ordinal:"nearest"};function pT(r,e){r.setSampler({minFilter:ty[e],magFilter:ty[e]})}function AT(r,e,t="linear"){const n=zN(e,!1,Uint8Array);return r.createTexture({format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:ty[t],magFilter:ty[t],addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},data:n,width:n.length/4,height:1})}const T2e=`#version 300 es
4815#define SHADER_NAME screen-grid-layer-vertex-shader
4816#define RANGE_COUNT 6
4817in vec2 positions;
4818in vec2 instancePositions;
4819in float instanceWeights;
4820in vec3 instancePickingColors;
4821uniform sampler2D colorRange;
4822out vec4 vColor;
4823vec4 interp(float value, vec2 domain, sampler2D range) {
4824float r = (value - domain.x) / (domain.y - domain.x);
4825return texture(range, vec2(r, 0.5));
4826}
4827void main(void) {
4828if (isnan(instanceWeights)) {
4829gl_Position = vec4(0.);
4830return;
4831}
4832vec2 pos = instancePositions * screenGrid.gridSizeClipspace + positions * screenGrid.cellSizeClipspace;
4833pos.x = pos.x - 1.0;
4834pos.y = 1.0 - pos.y;
4835gl_Position = vec4(pos, 0., 1.);
4836vColor = interp(instanceWeights, screenGrid.colorDomain, colorRange);
4837vColor.a *= layer.opacity;
4838picking_setPickingColor(instancePickingColors);
4839}
4840`,E2e=`#version 300 es
4841#define SHADER_NAME screen-grid-layer-fragment-shader
4842precision highp float;
4843in vec4 vColor;
4844out vec4 fragColor;
4845void main(void) {
4846fragColor = vColor;
4847DECKGL_FILTER_COLOR(fragColor, geometry);
4848}
4849`,B2e=`uniform screenGridUniforms {
4850  vec2 cellSizeClipspace;
4851  vec2 gridSizeClipspace;
4852  vec2 colorDomain;
4853} screenGrid;
4854`,S2e={name:"screenGrid",vs:B2e,uniformTypes:{cellSizeClipspace:"vec2<f32>",gridSizeClipspace:"vec2<f32>",colorDomain:"vec2<f32>"}};
4854class GN extends Es{getShaders(){return super.getShaders({vs:T2e,fs:E2e,modules:[_a,S2e]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceWeights:{size:1,type:"float32",accessor:"getWeight"}}),this.state.model=this._getModel()}updateState(e){super.updateState(e);const{props:t,oldProps:n,changeFlags:i}=e,s=this.state.model;if(n.colorRange!==t.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=AT(this.context.device,t.colorRange,t.colorScaleType);const o={colorRange:this.state.colorTexture};s.shaderInputs.setProps({screenGrid:o})}else n.colorScaleType!==t.colorScaleType&&pT(this.state.colorTexture,t.colorScaleType);if(n.cellMarginPixels!==t.cellMarginPixels||n.cellSizePixels!==t.cellSizePixels||i.viewportChanged){const{width:o,height:c}=this.context.viewport,{cellSizePixels:f,cellMarginPixels:A}=this.props,v=Math.max(f-A,0),w={gridSizeClipspace:[f/o*2,f/c*2],cellSizeClipspace:[v/o*2,v/c*2]};s.shaderInputs.setProps({screenGrid:w})}}finalizeState(e){super.finalizeState(e),this.state.colorTexture?.destroy()}draw({uniforms:e}){const t=this.props.colorDomain(),n=this.state.model,i={colorDomain:t};n.shaderInputs.setProps({screenGrid:i}),n.draw(this.context.renderPass)}_getModel(){return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ys({topology:"triangle-strip",attributes:{positions:{value:new Float32Array([0,0,1,0,0,1,1,1]),size:2}}}),isInstanced:!0})}}GN.layerName="ScreenGridCellLayer";const I2e=`uniform binOptionsUniforms {
4855  float cellSizePixels;
4856} binOptions;
4857`,M2e={name:"binOptions",vs:I2e,uniformTypes:{cellSizePixels:"f32"}},P2e={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0},colorRange:Yy,colorScaleType:"linear",getPosition:{type:"accessor",value:r=>r.position},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"};class gT extends qp{getAggregatorType(){return this.props.gpuAggregation&&Ga.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){return e==="cpu"||!Ga.isSupported(this.context.device)?new Kp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:t},n,i)=>{const s=this.context.viewport,o=s.project(t),c=i.cellSizePixels;return o[0]<0||o[0]>=s.width||o[1]<0||o[1]>=s.height?null:[Math.floor(o[0]/c),Math.floor(o[1]/c)]}},getValue:[{sources:["counts"],getValue:({counts:t})=>t}]}):new Ga(this.context.device,{dimensions:2,channelCount:1,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,M2e],vs:`
4858  in vec3 positions;
4859  in vec3 positions64Low;
4860  in float counts;
4861  
4862  void getBin(out ivec2 binId) {
4863    vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
4864    vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
4865    vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
4866    binId = ivec2(gridCoords);
4867  }
4868  void getValue(out float weight) {
4869    weight = counts;
4870  }
4871  `})})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},counts:{size:1,accessor:"getWeight"}})}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){const t=super.updateState(e),{props:n,oldProps:i,changeFlags:s}=e,{cellSizePixels:o,aggregation:c}=n;if(t||s.dataChanged||s.updateTriggersChanged||s.viewportChanged||c!==i.aggregation||o!==i.cellSizePixels){const{width:f,height:A}=this.context.viewport,{aggregator:v}=this.state;v instanceof Ga&&v.setProps({binIdRange:[[0,Math.ceil(f/o)],[0,Math.ceil(A/o)]]}),v.setProps({pointCount:this.getNumInstances(),operations:[c],binOptions:{cellSizePixels:o}})}return s.viewportChanged&&this.state.aggregator.setNeedsUpdate(),t}onAttributeChange(e){const{aggregator:t}=this.state;switch(e){case"positions":t.setNeedsUpdate();break;
4871case"counts":t.setNeedsUpdate(0);break}}renderLayers(){const{aggregator:e}=this.state,t=this.getSubLayerClass("cells",GN),n=e.getBins(),i=e.getResult(0);return new t(this.props,this.getSubLayerProps({id:"cell-layer"}),{data:{length:e.binCount,attributes:{getBin:n,getWeight:i}},dataComparator:(s,o)=>s.length===o.length,updateTriggers:{getBin:[n],getWeight:[i]},parameters:{depthWriteEnabled:!1,...this.props.parameters},colorDomain:()=>this.props.colorDomain||e.getResultDomain(0),extensions:[]})}getPickingInfo(e){const t=e.info,{index:n}=t;if(n>=0){const i=this.state.aggregator.getBin(n);let s;i&&(s={col:i.id[0],row:i.id[1],value:i.value[0],count:i.count},i.pointIndices&&(s.pointIndices=i.pointIndices,s.points=Array.isArray(this.props.data)?i.pointIndices.map(o=>this.props.data[o]):[])),t.object=s}return t}}gT.layerName="ScreenGridLayer";gT.defaultProps=P2e;class ry{constructor(e,t){this.props={scaleType:"linear",lowerPercentile:0,upperPercentile:100},this.domain=null,this.cutoff=null,this.input=e,this.inputLength=t,this.attribute=e}getScalePercentile(){if(!this._percentile){const e=HF(this.input,this.inputLength);this._percentile=F2e(e)}return this._percentile}getScaleOrdinal(){if(!this._ordinal){const e=HF(this.input,this.inputLength);this._ordinal=R2e(e)}return this._ordinal}getCutoff({scaleType:e,lowerPercentile:t,upperPercentile:n}){if(e==="quantile")return[t,n-1];if(t>0||n<100){const{domain:i}=this.getScalePercentile();let s=i[Math.floor(t)-1]??-1/0,o=i[Math.floor(n)-1]??1/0;if(e==="ordinal"){const{domain:c}=this.getScaleOrdinal();s=c.findIndex(f=>f>=s),o=c.findIndex(f=>f>o)-1,o===-2&&(o=c.length-1)}return[s,o]}return null}update(e){const t=this.props;if(e.scaleType!==t.scaleType)switch(e.scaleType){case"quantile":{const{attribute:n}=this.getScalePercentile();this.attribute=n,this.domain=[0,99];break}case"ordinal":{const{attribute:n,domain:i}=this.getScaleOrdinal();this.attribute=n,this.domain=[0,i.length-1];break}default:this.attribute=this.input,this.domain=null}return(e.scaleType!==t.scaleType||e.lowerPercentile!==t.lowerPercentile||e.upperPercentile!==t.upperPercentile)&&(this.cutoff=this.getCutoff(e)),this.props=e,this}}function R2e(r){const e=new Set;for(const i of r)Number.isFinite(i)&&e.add(i);const t=Array.from(e).sort(),n=new Map;for(let i=0;i<t.length;i++)n.set(t[i],i);return{attribute:{value:r.map(i=>Number.isFinite(i)?n.get(i):NaN),type:"float32",size:1},domain:t}}function F2e(r,e=100){const t=Array.from(r).filter(Number.isFinite).sort(D2e);let n=0;const i=Math.max(1,e),s=new Array(i-1);for(;++n<i;)s[n-1]=O2e(t,n/i);return{attribute:{value:r.map(o=>Number.isFinite(o)?L2e(s,o):NaN),type:"float32",size:1},domain:s}}function HF(r,e){const t=(r.stride??4)/4,n=(r.offset??0)/4;let i=r.value;if(!i){const o=r.buffer?.readSyncWebGL(0,t*4*e);o&&(i=new Float32Array(o.buffer),r.value=i)}if(t===1)return i.subarray(0,e);const s=new Float32Array(e);for(let o=0;o<e;o++)s[o]=i[o*t+n];return s}function D2e(r,e){return r-e}function O2e(r,e){const t=r.length;if(e<=0||t<2)return r[0];if(e>=1)return r[t-1];const n=(t-1)*e,i=Math.floor(n),s=r[i],o=r[i+1];return s+(o-s)*(n-i)}function L2e(r,e){let t=0,n=r.length;for(;t<n;){const i=t+n>>>1;r[i]>e?n=i:t=i+1}return t}function mT({dataBounds:r,getBinId:e,padding:t=0}){const n=[r[0],r[1],[r[0][0],r[1][1]],[r[1][0],r[0][1]]].map(f=>e(f)),i=Math.min(...n.map(f=>
4871f[0]))-t,s=Math.min(...n.map(f=>f[1]))-t,o=Math.max(...n.map(f=>f[0]))+t+1,c=Math.max(...n.map(f=>f[1]))+t+1;return[[i,o],[s,c]]}const VN=Math.PI/3,Zy=2*Math.sin(VN),Qy=1.5,k2e=Array.from({length:6},(r,e)=>{const t=e*VN;return[Math.sin(t),-Math.cos(t)]});function q1([r,e],t){let n=Math.round(e=e/t/Qy),i=Math.round(r=r/t/Zy-(n&1)/2);const s=e-n;if(Math.abs(s)*3>1){const o=r-i,c=i+(r<i?-1:1)/2,f=n+(e<n?-1:1),A=r-c,v=e-f;o*o+s*s>A*A+v*v&&(i=c+(n&1?1:-1)/2,n=f)}return[i,n]}const N2e=`
4872const vec2 DIST = vec2(${Zy}, ${Qy});
4873
4874ivec2 pointToHexbin(vec2 p, float radius) {
4875  p /= radius * DIST;
4876  float pj = round(p.y);
4877  float pjm2 = mod(pj, 2.0);
4878  p.x -= pjm2 * 0.5;
4879  float pi = round(p.x);
4880  vec2 d1 = p - vec2(pi, pj);
4881
4882  if (abs(d1.y) * 3. > 1.) {
4883    vec2 v2 = step(0.0, d1) - 0.5;
4884    v2.y *= 2.0;
4885    vec2 d2 = d1 - v2;
4886    if (dot(d1, d1) > dot(d2, d2)) {
4887      pi += v2.x + pjm2 - 0.5;
4888      pj += v2.y;
4889    }
4890  }
4891  return ivec2(pi, pj);
4892}
4893`;function jF([r,e],t){return[(r+(e&1)/2)*t*Zy,e*t*Qy]}const U2e=`
4894const vec2 DIST = vec2(${Zy}, ${Qy});
4895
4896vec2 hexbinCentroid(vec2 binId, float radius) {
4897  binId.x += fract(binId.y * 0.5);
4898  return binId * DIST * radius;
4899}
4900`,z2e=`#version 300 es
4901#define SHADER_NAME hexagon-cell-layer-vertex-shader
4902in vec3 positions;
4903in vec3 normals;
4904in vec2 instancePositions;
4905in float instanceElevationValues;
4906in float instanceColorValues;
4907in vec3 instancePickingColors;
4908uniform sampler2D colorRange;
4909out vec4 vColor;
4910${U2e}
4911float interp(float value, vec2 domain, vec2 range) {
4912float r = min(max((value - domain.x) / (domain.y - domain.x), 0.), 1.);
4913return mix(range.x, range.y, r);
4914}
4915vec4 interp(float value, vec2 domain, sampler2D range) {
4916float r = (value - domain.x) / (domain.y - domain.x);
4917return texture(range, vec2(r, 0.5));
4918}
4919void main(void) {
4920geometry.pickingColor = instancePickingColors;
4921if (isnan(instanceColorValues) ||
4922instanceColorValues < hexagon.colorDomain.z ||
4923instanceColorValues > hexagon.colorDomain.w ||
4924instanceElevationValues < hexagon.elevationDomain.z ||
4925instanceElevationValues > hexagon.elevationDomain.w
4926) {
4927gl_Position = vec4(0.);
4928return;
4929}
4930vec2 commonPosition = hexbinCentroid(instancePositions, column.radius) + (hexagon.originCommon - project.commonOrigin.xy);
4931commonPosition += positions.xy * column.radius * column.coverage;
4932geometry.position = vec4(commonPosition, 0.0, 1.0);
4933geometry.normal = project_normal(normals);
4934float elevation = 0.0;
4935if (column.extruded) {
4936elevation = interp(instanceElevationValues, hexagon.elevationDomain.xy, hexagon.elevationRange);
4937elevation = project_size(elevation);
4938geometry.position.z = (positions.z + 1.0) / 2.0 * elevation;
4939}
4940gl_Position = project_common_position_to_clipspace(geometry.position);
4941DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
4942vColor = interp(instanceColorValues, hexagon.colorDomain.xy, colorRange);
4943vColor.a *= layer.opacity;
4944if (column.extruded) {
4945vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
4946}
4947DECKGL_FILTER_COLOR(vColor, geometry);
4948}
4949`,G2e=`uniform hexagonUniforms {
4950  vec4 colorDomain;
4951  vec4 elevationDomain;
4952  vec2 elevationRange;
4953  vec2 originCommon;
4954} hexagon;
4955`,V2e={name:"hexagon",vs:G2e,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>"}};class HN extends ml{getShaders(){const e=super.getShaders();return e.modules.push(V2e),{...e,vs:z2e}}initializeState(){super.initializeState();const e=this.getAttributeManager();e.remove(["instanceElevations","instanceFillColors","instanceLineColors","instanceStrokeWidths"]),e.addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceColorValues:{size:1,type:"float32",accessor:"getColorValue"},instanceElevationValues:{size:1,type:"float32",accessor:"getElevationValue"}})}updateState(e){super.updateState(e);const{props:t,oldProps:n}=e,i=this.state.fillModel;if(n.colorRange!==t.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=AT(this.context.device,t.colorRange,t.colorScaleType);const s={colorRange:this.state.colorTexture};i.shaderInputs.setProps({hexagon:s})}else n.colorScaleType!==t.colorScaleType&&pT(this.state.colorTexture,t.colorScaleType)}finalizeState(e){super.finalizeState(e),this.state.colorTexture?.destroy()}draw({uniforms:e}){const{radius:t,hexOriginCommon:n,elevationRange:i,elevationScale:s,extruded:o,coverage:c,colorDomain:f,elevationDomain:A}=this.props,v=this.props.colorCutoff||[-1/0,1/0],w=this.props.elevationCutoff||[-1/0,1/0],S=this.state.fillModel;S.vertexArray.indexBuffer&&S.setIndexBuffer(null),S.setVertexCount(this.state.fillVertexCount);const F={colorDomain:[Math.max(f[0],v[0]),Math.min(f[1],v[1]),Math.max(f[0]-1,v[0]),Math.min(f[1]+1,v[1])],elevationDomain:[Math.max(A[0],w[0]),Math.min(A[1],w[1]),Math.max(A[0]-1,w[0]),Math.min(A[1]+1,w[1])],elevationRange:[i[0]*s,i[1]*s],originCommon:n};S.shaderInputs.setProps({column:{extruded:o,coverage:c,radius:t},hexagon:F}),S.draw(this.context.renderPass)}}HN.layerName="HexagonCellLayer";const H2e=`uniform binOptionsUniforms {
4956  vec2 hexOriginCommon;
4957  float radiusCommon;
4958} binOptions;
4959`,j2e={name:"binOptions",vs:H2e,uniformTypes:{hexOriginCommon:"vec2<f32>",radiusCommon:"f32"}};function $F(){}const $2e={gpuAggregation:!0,colorDomain:null,colorRange:Yy,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:$F,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScaleType:"linear",onSetElevationDomain:$F,radius:{type:"number",min:1,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:r=>r.position},hexagonAggregator:{type:"function",optional:!0,value:null},extruded:!1,material:!0};class _T extends qp{getAggregatorType(){const{gpuAggregation:e,hexagonAggregator:t,getColorValue:n,getElevationValue:i}=this.props;return e&&(t||n||i)?(Yr.warn("Features not supported by GPU aggregation, falling back to CPU")(),"cpu"):e&&Ga.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){if(e==="cpu"){const{hexagonAggregator:t,radius:n}=this.props;return new Kp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:i},s,o)=>
4959{if(t)return t(i,n);const f=this.state.aggregatorViewport.projectPosition(i),{radiusCommon:A,hexOriginCommon:v}=o;return q1([f[0]-v[0],f[1]-v[1]],A)}},getValue:[{sources:["colorWeights"],getValue:({colorWeights:i})=>i},{sources:["elevationWeights"],getValue:({elevationWeights:i})=>i}]})}return new Ga(this.context.device,{dimensions:2,channelCount:2,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,j2e],vs:`
4960  in vec3 positions;
4961  in vec3 positions64Low;
4962  in float colorWeights;
4963  in float elevationWeights;
4964  
4965  ${N2e}
4966
4967  void getBin(out ivec2 binId) {
4968    vec3 positionCommon = project_position(positions, positions64Low);
4969    binId = pointToHexbin(positionCommon.xy, binOptions.radiusCommon);
4970  }
4971  void getValue(out vec2 value) {
4972    value = vec2(colorWeights, elevationWeights);
4973  }
4974  `})})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},colorWeights:{size:1,accessor:"getColorWeight"},elevationWeights:{size:1,accessor:"getElevationWeight"}})}updateState(e){const t=super.updateState(e),{props:n,oldProps:i,changeFlags:s}=e,{aggregator:o}=this.state;if((s.dataChanged||!this.state.dataAsArray)&&(n.getColorValue||n.getElevationValue)&&(this.state.dataAsArray=Array.from(gl(n.data).iterable)),t||s.dataChanged||n.radius!==i.radius||n.getColorValue!==i.getColorValue||n.getElevationValue!==i.getElevationValue||n.colorAggregation!==i.colorAggregation||n.elevationAggregation!==i.elevationAggregation){this._updateBinOptions();const{radiusCommon:c,hexOriginCommon:f,binIdRange:A,dataAsArray:v}=this.state;if(o.setProps({binIdRange:A,pointCount:this.getNumInstances(),operations:[n.colorAggregation,n.elevationAggregation],binOptions:{radiusCommon:c,hexOriginCommon:f},onUpdate:this._onAggregationUpdate.bind(this)}),v){const{getColorValue:w,getElevationValue:S}=this.props;o.setProps({customOperations:[w&&(F=>w(F.map(N=>v[N]),{indices:F,data:n.data})),S&&(F=>S(F.map(N=>v[N]),{indices:F,data:n.data}))]})}}return s.updateTriggersChanged&&s.updateTriggersChanged.getColorValue&&o.setNeedsUpdate(0),s.updateTriggersChanged&&s.updateTriggersChanged.getElevationValue&&o.setNeedsUpdate(1),t}_updateBinOptions(){const e=this.getBounds();let t=1,n=[0,0],i=[[0,1],[0,1]],s=this.context.viewport;if(e&&Number.isFinite(e[0][0])){let o=[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2];const{radius:c}=this.props,{unitsPerMeter:f}=s.getDistanceScales(o);t=f[0]*c;const A=q1(s.projectFlat(o),t);o=s.unprojectFlat(jF(A,t));const v=s.constructor;s=s.isGeospatial?new v({longitude:o[0],latitude:o[1],zoom:12}):new ru({position:[o[0],o[1],0],zoom:12}),n=[Math.fround(s.center[0]),Math.fround(s.center[1])],i=mT({dataBounds:e,getBinId:w=>{const S=s.projectFlat(w);return S[0]-=n[0],S[1]-=n[1],q1(S,t)},padding:1})}this.setState({radiusCommon:t,hexOriginCommon:n,binIdRange:i,aggregatorViewport:s})}draw(e){e.shaderModuleProps.project&&(e.shaderModuleProps.project.viewport=this.state.aggregatorViewport),super.draw(e)}_onAggregationUpdate({channel:e}){const t=this.getCurrentLayer().props,{aggregator:n}=this.state;if(e===0){const i=n.getResult(0);this.setState({colors:new ry(i,n.binCount)}),t.onSetColorDomain(n.getResultDomain(0))}else if(e===1){const i=n.getResult(1);this.setState({elevations:new ry(i,n.binCount)}),t.onSetElevationDomain(n.getResultDomain(1))}}onAttributeChange(e){const{aggregator:t}=this.state;switch(e){case"positions":t.setNeedsUpdate(),this._updateBinOptions();const{radiusCommon:n,hexOriginCommon:i,binIdRange:s}=this.state;t.setProps({binIdRange:s,binOptions:{radiusCommon:n,hexOriginCommon:i}});break;case"colorWeights":t.setNeedsUpdate(0);break;case"elevationWeights":t.setNeedsUpdate(1);break}}renderLayers(){const{aggregator:e,radiusCommon:t,hexOriginCommon:n}=this.state,{elevationScale:i,colorRange:s,elevationRange:o,extruded:c,coverage:f,material:A,transitions:v,colorScaleType:w,lowerPercentile:S,upperPercentile:F,colorDomain:N,elevationScaleType:U,elevationLowerPercentile:$,elevationUpperPercentile:G,elevationDomain:H}=this.props,J=this.getSubLayerClass("cells",HN),ue=e.getBins(),q=this.state.colors?.update({scaleType:w,lowerPercentile:S,upperPercentile:F}),se=this.state.elevations?.update({scaleType:U,lowerPercentile:$,upperPercentile:G});return!q||!se?null:new J(this.getSubLayerProps({id:"cells"}),{data:{length:e.binCount,attributes:{getBin:ue,getColorValue:q.attribute,getElevationValue:se.attribute}},dataComparator:(Te,Ue)=>Te.length===Ue.length,updateTriggers:{getBin:[ue],getColorValue:[q.attribute],getElevationValue:[se.attribute]},diskResolution:6,vertices:k2e,radius:t,hexOriginCommon:n,elevationScale:i,colorRange:s,colorScaleType:w,elevationRange:o,extruded:c,coverage:f,material:A,colorDomain:q.domain||N||e.getResultDomain(0),elevationDomain:se.domain||H||e.getResultDomain(1),colorCutoff:q.cutoff,elevationCutoff:se.cutoff,transitions:v&&{getFillColor:v.getColorValue||v.getColorWeight,getElevation:v.getElevationValue||v.getElevationWeight},extensions:[]})}getPickingInfo(e){const t=e.info,{index:n}=t;if(n>=0){const i=this.state.aggregator.getBin(n);let s;if(i){const o=jF(i.id,this.state.radiusCommon),c=this.context.viewport.unprojectFlat(o);s={col:i.id[0],row:i.id[1],position:c,colorValue:i.value[0],elevationValue:i.value[1],count:i.count},i.pointIndices&&(s.pointIndices=i.pointIndices,s.points=Array.isArray(this.props.data)?i.pointIndices.map(f=>this.props.data[f]):[])}t.object=s}return t}}_T.layerName="HexagonLayer";_T.defaultProps=$2e;const cr=.5,Cr=1/6,wt={N:[0,cr],E:[cr,0],S:[0,-cr],W:[-cr,0],NE:[cr,cr],NW:[-cr,cr],SE:[cr,-cr],SW:[-cr,-cr]},Gd=[wt.W,wt.SW,wt.S],Vd=[wt.S,wt.SE,wt.E],Hd=[wt.E,wt.NE,wt.N],jd=[wt.NW,wt.W,wt.N],$d=[[-cr,Cr],[-cr,-Cr],[-Cr,-cr],[Cr,-cr]],Wd=[[-Cr,-cr],[Cr,-cr],[cr,-Cr],[cr,Cr]],Jd=[[cr,-Cr],[cr,Cr],[Cr,cr],[-Cr,cr]],Xd=[[-cr,Cr],[-cr,-Cr],[Cr,cr],[-Cr,cr]],WF=[wt.W,wt.SW,wt.SE,wt.E],JF=[wt.S,wt.SE,wt.NE,wt.N],XF=[wt.NW,wt.W,wt.E,wt.NE],KF=[wt.NW,wt.SW,wt.S,wt.N],qF=[[-cr,Cr],[-cr,-Cr],[cr,-Cr],[cr,Cr]],YF=[[-Cr,-cr],[Cr,-cr],[Cr,cr],[-Cr,cr]],W2e=[wt.NW,
4974wt.SW,wt.SE,wt.NE],ZF=[wt.NW,wt.SW,wt.SE,wt.E,wt.N],QF=[wt.W,wt.SW,wt.SE,wt.NE,wt.N],eD=[wt.NW,wt.W,wt.S,wt.SE,wt.NE],tD=[wt.NW,wt.SW,wt.S,wt.E,wt.NE],rD=[wt.NW,wt.W,[cr,-Cr],[cr,Cr],wt.N],nD=[[-Cr,-cr],[Cr,-cr],wt.E,wt.NE,wt.N],iD=[[-cr,Cr],[-cr,-Cr],wt.S,wt.SE,wt.E],sD=[wt.W,wt.SW,wt.S,[Cr,cr],[-Cr,cr]],oD=[wt.NW,wt.W,[-Cr,-cr],[Cr,-cr],wt.N],aD=[[-cr,Cr],[-cr,-Cr],wt.E,wt.NE,wt.N],cD=[wt.S,wt.SE,wt.E,[Cr,cr],[-Cr,cr]],lD=[wt.W,wt.SW,wt.S,[cr,-Cr],[cr,Cr]],uD=[wt.W,wt.SW,wt.SE,wt.E,[Cr,cr],[-Cr,cr]],fD=[[-cr,Cr],[-cr,-Cr],wt.S,wt.SE,wt.NE,wt.N],hD=[wt.NW,wt.W,[-Cr,-cr],[Cr,-cr],wt.E,wt.NE],dD=[wt.NW,wt.SW,wt.S,[cr,-Cr],[cr,Cr],wt.N],Kd=[wt.W,wt.SW,wt.S,wt.E,wt.NE,wt.N],qd=[wt.NW,wt.W,wt.S,wt.SE,wt.E,wt.N],E0=[[-cr,Cr],[-cr,-Cr],[-Cr,-cr],[Cr,-cr],wt.E,wt.NE,wt.N],B0=[wt.W,wt.SW,wt.S,[cr,-Cr],[cr,Cr],[Cr,cr],[-Cr,cr]],S0=[wt.NW,wt.W,[-Cr,-cr],[Cr,-cr],[cr,-Cr],[cr,Cr],wt.N],I0=[[-cr,Cr],[-cr,-Cr],wt.S,wt.SE,wt.E,[Cr,cr],[-Cr,cr]],pD=[[-cr,Cr],[-cr,-Cr],[-Cr,-cr],[Cr,-cr],[cr,-Cr],[cr,Cr],[Cr,cr],[-Cr,cr]],J2e={0:[],1:[[wt.W,wt.S]],2:[[wt.S,wt.E]],3:[[wt.W,wt.E]],4:[[wt.N,wt.E]],5:{0:[[wt.W,wt.S],[wt.N,wt.E]],1:[[wt.W,wt.N],[wt.S,wt.E]]},6:[[wt.N,wt.S]],7:[[wt.W,wt.N]],8:[[wt.W,wt.N]],9:[[wt.N,wt.S]],10:{0:[[wt.W,wt.N],[wt.S,wt.E]],1:[[wt.W,wt.S],[wt.N,wt.E]]},11:[[wt.N,wt.E]],12:[[wt.W,wt.E]],13:[[wt.S,wt.E]],14:[[wt.W,wt.S]],15:[]};function fr(r){return parseInt(r,4)}const X2e={[fr("0000")]:[],[fr("2222")]:[],[fr("2221")]:[Gd],[fr("2212")]:[Vd],[fr("2122")]:[Hd],[fr("1222")]:[jd],[fr("0001")]:[Gd],[fr("0010")]:[Vd],[fr("0100")]:[Hd],[fr("1000")]:[jd],[fr("2220")]:[$d],[fr("2202")]:[Wd],[fr("2022")]:[Jd],[fr("0222")]:[Xd],[fr("0002")]:[$d],[fr("0020")]:[Wd],[fr("0200")]:[Jd],[fr("2000")]:[Xd],[fr("0011")]:[WF],[fr("0110")]:[JF],[fr("1100")]:[XF],[fr("1001")]:[KF],[fr("2211")]:[WF],[fr("2112")]:[JF],[fr("1122")]:[XF],[fr("1221")]:[KF],[fr("2200")]:[qF],[fr("2002")]:[YF],[fr("0022")]:[qF],[fr("0220")]:[YF],[fr("1111")]:[W2e],[fr("1211")]:[ZF],[fr("2111")]:[QF],[fr("1112")]:[eD],[fr("1121")]:[tD],[fr("1011")]:[ZF],[fr("0111")]:[QF],[fr("1110")]:[eD],[fr("1101")]:[tD],[fr("1200")]:[rD],[fr("0120")]:[nD],[fr("0012")]:[iD],[fr("2001")]:[sD],[fr("1022")]:[rD],[fr("2102")]:[nD],[fr("2210")]:[iD],[fr("0221")]:[sD],[fr("1002")]:[oD],[fr("2100")]:[aD],[fr("0210")]:[cD],[fr("0021")]:[lD],[fr("1220")]:[oD],[fr("0122")]:[aD],[fr("2012")]:[cD],[fr("2201")]:[lD],[fr("0211")]:[uD],[fr("2110")]:[fD],[fr("1102")]:[hD],[fr("1021")]:[dD],[fr("2011")]:[uD],[fr("0112")]:[fD],[fr("1120")]:[hD],[fr("1201")]:[dD],[fr("2101")]:[Kd],[fr("0121")]:[Kd],[fr("1012")]:[qd],[fr("1210")]:[qd],[fr("0101")]:{0:[Gd,Hd],1:[Kd],2:[Kd]},[fr("1010")]:{0:[jd,Vd],1:[qd],2:[qd]},[fr("2121")]:{0:[Kd],1:[Kd],2:[Gd,Hd]},[fr("1212")]:{0:[qd],1:[qd],2:[jd,Vd]},[fr("2120")]:{0:[E0],1:[E0],2:[$d,Hd]},[fr("2021")]:{0:[B0],1:[B0],2:[Gd,Jd]},[fr("1202")]:{0:[S0],1:[S0],2:[jd,Wd]},[fr("0212")]:{0:[I0],1:[I0],2:[Vd,Xd]},[fr("0102")]:{0:[$d,Hd],1:[E0],2:[E0]},[fr("0201")]:{0:[Gd,Jd],1:[B0],2:[B0]},[fr("1020")]:{0:[jd,Wd],1:[S0],2:[S0]},[fr("2010")]:{0:[Vd,Xd],1:[I0],2:[I0]},[fr("2020")]:{0:[Xd,Wd],1:[pD],2:[$d,Jd]},[fr("0202")]:{0:[Jd,$d],1:[pD],2:[Xd,Wd]}};function GA(r,e){return Number.isNaN(r)?0:Array.isArray(e)?r<e[0]?0:r<e[1]?1:2:r>=e?1:0}function K2e(r){const{x:e,y:t,xRange:n,yRange:i,getValue:s,threshold:o}=r,c=e<n[0],f=e>=n[1]-1,A=t<i[0],v=t>=i[1]-1,w=c||f||A||v;let S=0,F,N,U,$;if(c||v)U=0;else{const J=s(e,t+1);U=GA(J,o),S+=J}if(f||v)$=0;else{const J=s(e+1,t+1);$=GA(J,o),S+=J}if(f||A)N=0;else{const J=s(e+1,t);N=GA(J,o),S+=J}if(c||A)F=0;else{const J=s(e,t);F=GA(J,o),S+=J}let G=-1;Number.isFinite(o)&&(G=U<<3|$<<2|N<<1|F),Array.isArray(o)&&(G=U<<6|$<<4|N<<2|F);let H=0;return w||(H=GA(S/4,o)),{code:G,meanCode:H}}function q2e(r){const{x:e,y:t,z:n,code:i,meanCode:s}=r;let o=X2e[i];Array.isArray(o)||(o=o[s]);const c=e+1,f=t+1,A=[];return o.forEach(v=>{const w=[];v.forEach(S=>{const F=c+S[0],N=f+S[1];w.push([F,N,n])}),A.push(w)}),A}function Y2e(r){const{x:e,y:t,z:n,code:i,meanCode:s}=r;let o=J2e[i];Array.isArray(o)||(o=o[s]);const c=e+1,f=t+1,A=[];return o.forEach(v=>{v.forEach(w=>{const S=c+w[0],F=f+w[1];A.push([S,F,n])})}),A}function Z2e({contours:r,getValue:e,xRange:t,yRange:n}){const i=[],s=[];let o=0,c=0;for(let f=0;f<r.length;f++){const A=r[f],v=A.zIndex??f,{threshold:w}=A;for(let S=t[0]-1;S<t[1];S++)for(let F=n[0]-1;F<n[1];F++){const{code:N,meanCode:U}=K2e({getValue:e,threshold:w,x:S,y:F,xRange:t,yRange:n}),$={x:S,y:F,z:v,code:N,meanCode:U};if(Array.isArray(w)){const G=q2e($);for(const H of G)s[c++]={vertices:H,contour:A}}else{const G=Y2e($);G.length>0&&(i[o++]={vertices:G,contour:A})}}}return{lines:i,polygons:s}}
4974function Q2e(r){const{aggregator:e,binIdRange:t,channel:n}=r;if(e instanceof Ga){const i=e.getResult(n)?.buffer;if(i){const s=new Float32Array(i.readSyncWebGL().buffer);return exe(s,t)}}if(e instanceof Kp){const i=e.getResult(n)?.value,s=e.getBins()?.value;if(s&&i)return txe(i,s,e.binCount)}return null}function exe(r,e){const[[t,n],[i,s]]=e,o=n-t,c=s-i;return(f,A)=>(f-=t,A-=i,f<0||f>=o||A<0||A>=c?NaN:r[A*o+f])}function txe(r,e,t){const n={};for(let i=0;i<t;i++){const s=e[i*2],o=e[i*2+1];n[s]=n[s]||{},n[s][o]=r[i]}return(i,s)=>n[i]?.[s]??NaN}const rxe=`uniform binOptionsUniforms {
4975  vec2 cellOriginCommon;
4976  vec2 cellSizeCommon;
4977} binOptions;
4978`,nxe={name:"binOptions",vs:rxe,uniformTypes:{cellOriginCommon:"vec2<f32>",cellSizeCommon:"vec2<f32>"}},AD=[255,255,255,255],ixe=1,sxe={cellSize:{type:"number",min:1,value:1e3},gridOrigin:{type:"array",compare:!0,value:[0,0]},getPosition:{type:"accessor",value:r=>r.position},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM",contours:{type:"object",value:[{threshold:1}],optional:!0,compare:3},zOffset:.005};let yT=class extends qp{getAggregatorType(){return this.props.gpuAggregation&&Ga.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){return e==="cpu"?new Kp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:t},n,i)=>{const o=this.state.aggregatorViewport.projectPosition(t),{cellSizeCommon:c,cellOriginCommon:f}=i;return[Math.floor((o[0]-f[0])/c[0]),Math.floor((o[1]-f[1])/c[1])]}},getValue:[{sources:["counts"],getValue:({counts:t})=>t}],onUpdate:this._onAggregationUpdate.bind(this)}):new Ga(this.context.device,{dimensions:2,channelCount:1,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,nxe],vs:`
4979  in vec3 positions;
4980  in vec3 positions64Low;
4981  in float counts;
4982
4983  void getBin(out ivec2 binId) {
4984    vec3 positionCommon = project_position(positions, positions64Low);
4985    vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon);
4986    binId = ivec2(gridCoords);
4987  }
4988  void getValue(out float value) {
4989    value = counts;
4990  }
4991  `}),onUpdate:this._onAggregationUpdate.bind(this)})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},counts:{size:1,accessor:"getWeight"}})}updateState(e){const t=super.updateState(e),{props:n,oldProps:i,changeFlags:s}=e,{aggregator:o}=this.state;if(t||s.dataChanged||n.cellSize!==i.cellSize||!rs(n.gridOrigin,i.gridOrigin,1)||n.aggregation!==i.aggregation){this._updateBinOptions();const{cellSizeCommon:c,cellOriginCommon:f,binIdRange:A}=this.state;o.setProps({binIdRange:A,pointCount:this.getNumInstances(),operations:[n.aggregation],binOptions:{cellSizeCommon:c,cellOriginCommon:f}})}return rs(i.contours,n.contours,2)||this.setState({contourData:null}),t}_updateBinOptions(){const e=this.getBounds(),t=[1,1];let n=[0,0],i=[[0,1],[0,1]],s=this.context.viewport;if(e&&Number.isFinite(e[0][0])){let o=[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2];const{cellSize:c,gridOrigin:f}=this.props,{unitsPerMeter:A}=s.getDistanceScales(o);t[0]=A[0]*c,t[1]=A[1]*c;const v=s.projectFlat(o);n=[Math.floor((v[0]-f[0])/t[0])*t[0]+f[0],Math.floor((v[1]-f[1])/t[1])*t[1]+f[1]],o=s.unprojectFlat(n);const w=s.constructor;s=s.isGeospatial?new w({longitude:o[0],latitude:o[1],zoom:12}):new ru({position:[o[0],o[1],0],zoom:12}),n=[Math.fround(s.center[0]),Math.fround(s.center[1])],i=mT({dataBounds:e,getBinId:S=>{const F=s.projectFlat(S);return[Math.floor((F[0]-n[0])/t[0]),Math.floor((F[1]-n[1])/t[1])]}})}this.setState({cellSizeCommon:t,cellOriginCommon:n,binIdRange:i,aggregatorViewport:s})}draw(e){e.shaderModuleProps.project&&(e.shaderModuleProps.project.viewport=this.state.aggregatorViewport),super.draw(e)}_onAggregationUpdate(){const{aggregator:e,binIdRange:t}=this.state;this.setState({aggregatedValueReader:Q2e({aggregator:e,binIdRange:t,channel:0}),contourData:null})}_getContours(){const{aggregatedValueReader:e}=this.state;if(!e)return null;if(!this.state.contourData){const{binIdRange:t}=this.state,{contours:n}=this.props,i=Z2e({contours:n,getValue:e,xRange:t[0],yRange:t[1]});this.state.contourData=i}return this.state.contourData}onAttributeChange(e){const{aggregator:t}=this.state;switch(e){case"positions":t.setNeedsUpdate(),this._updateBinOptions();const{cellSizeCommon:n,cellOriginCommon:i,binIdRange:s}=this.state;t.setProps({binIdRange:s,binOptions:{cellSizeCommon:n,cellOriginCommon:i}});break;
4991case"counts":t.setNeedsUpdate(0);break}}renderLayers(){const e=this._getContours();if(!e)return null;const{lines:t,polygons:n}=e,{zOffset:i}=this.props,{cellOriginCommon:s,cellSizeCommon:o}=this.state,c=this.getSubLayerClass("lines",uf),f=this.getSubLayerClass("bands",ff),A=new vn().translate([s[0],s[1],0]).scale([o[0],o[1],i]),v=t&&t.length>0&&new c(this.getSubLayerProps({id:"lines"}),{data:t,coordinateSystem:Qr.CARTESIAN,modelMatrix:A,getPath:S=>S.vertices,getColor:S=>S.contour.color??AD,getWidth:S=>S.contour.strokeWidth??ixe,widthUnits:"pixels"}),w=n&&n.length>0&&new f(this.getSubLayerProps({id:"bands"}),{data:n,coordinateSystem:Qr.CARTESIAN,modelMatrix:A,getPolygon:S=>S.vertices,getFillColor:S=>S.contour.color??AD});return[v,w]}getPickingInfo(e){const t=e.info,{object:n}=t;return n&&(t.object={contour:n.contour}),t}};yT.layerName="ContourLayer";yT.defaultProps=sxe;const oxe=`#version 300 es
4992#define SHADER_NAME grid-cell-layer-vertex-shader
4993in vec3 positions;
4994in vec3 normals;
4995in vec2 instancePositions;
4996in float instanceElevationValues;
4997in float instanceColorValues;
4998in vec3 instancePickingColors;
4999uniform sampler2D colorRange;
5000out vec4 vColor;
5001float interp(float value, vec2 domain, vec2 range) {
5002float r = min(max((value - domain.x) / (domain.y - domain.x), 0.), 1.);
5003return mix(range.x, range.y, r);
5004}
5005vec4 interp(float value, vec2 domain, sampler2D range) {
5006float r = (value - domain.x) / (domain.y - domain.x);
5007return texture(range, vec2(r, 0.5));
5008}
5009void main(void) {
5010geometry.pickingColor = instancePickingColors;
5011if (isnan(instanceColorValues) ||
5012instanceColorValues < grid.colorDomain.z ||
5013instanceColorValues > grid.colorDomain.w ||
5014instanceElevationValues < grid.elevationDomain.z ||
5015instanceElevationValues > grid.elevationDomain.w
5016) {
5017gl_Position = vec4(0.);
5018return;
5019}
5020vec2 commonPosition = (instancePositions + (positions.xy + 1.0) / 2.0 * column.coverage) * grid.sizeCommon + grid.originCommon - project.commonOrigin.xy;
5021geometry.position = vec4(commonPosition, 0.0, 1.0);
5022geometry.normal = project_normal(normals);
5023float elevation = 0.0;
5024if (column.extruded) {
5025elevation = interp(instanceElevationValues, grid.elevationDomain.xy, grid.elevationRange);
5026elevation = project_size(elevation);
5027geometry.position.z = (positions.z + 1.0) / 2.0 * elevation;
5028}
5029gl_Position = project_common_position_to_clipspace(geometry.position);
5030DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
5031vColor = interp(instanceColorValues, grid.colorDomain.xy, colorRange);
5032vColor.a *= layer.opacity;
5033if (column.extruded) {
5034vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
5035}
5036DECKGL_FILTER_COLOR(vColor, geometry);
5037}
5038`,axe=`uniform gridUniforms {
5039  vec4 colorDomain;
5040  vec4 elevationDomain;
5041  vec2 elevationRange;
5042  vec2 originCommon;
5043  vec2 sizeCommon;
5044} grid;
5045`,cxe={name:"grid",vs:axe,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>",sizeCommon:"vec2<f32>"}};class jN extends ml{getShaders(){const e=super.getShaders();return e.modules.push(cxe),{...e,vs:oxe}}initializeState(){super.initializeState();const e=this.getAttributeManager();e.remove(["instanceElevations","instanceFillColors","instanceLineColors","instanceStrokeWidths"]),e.addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceColorValues:{size:1,type:"float32",accessor:"getColorValue"},instanceElevationValues:{size:1,type:"float32",accessor:"getElevationValue"}})}updateState(e){super.updateState(e);const{props:t,oldProps:n}=e,i=this.state.fillModel;if(n.colorRange!==t.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=AT(this.context.device,t.colorRange,t.colorScaleType);const s={colorRange:this.state.colorTexture};i.shaderInputs.setProps({grid:s})}else n.colorScaleType!==t.colorScaleType&&pT(this.state.colorTexture,t.colorScaleType)}finalizeState(e){super.finalizeState(e),this.state.colorTexture?.destroy()}_updateGeometry(){const e=new sL;this.state.fillModel.setGeometry(e)}draw({uniforms:e}){const{cellOriginCommon:t,cellSizeCommon:n,elevationRange:i,elevationScale:s,extruded:o,coverage:c,colorDomain:f,elevationDomain:A}=this.props,v=this.props.colorCutoff||[-1/0,1/0],w=this.props.elevationCutoff||[-1/0,1/0],S=this.state.fillModel,F={colorDomain:[Math.max(f[0],v[0]),Math.min(f[1],v[1]),Math.max(f[0]-1,v[0]),Math.min(f[1]+1,v[1])],elevationDomain:[Math.max(A[0],w[0]),Math.min(A[1],w[1]),Math.max(A[0]-1,w[0]),Math.min(A[1]+1,w[1])],elevationRange:[i[0]*s,i[1]*s],originCommon:t,sizeCommon:n};S.shaderInputs.setProps({column:{extruded:o,coverage:c},grid:F}),S.draw(this.context.renderPass)}}jN.layerName="GridCellLayer";const lxe=`uniform binOptionsUniforms {
5046  vec2 cellOriginCommon;
5047  vec2 cellSizeCommon;
5048} binOptions;
5049`,uxe={name:"binOptions",vs:lxe,uniformTypes:{cellOriginCommon:"vec2<f32>",cellSizeCommon:"vec2<f32>"}};function gD(){}const fxe={gpuAggregation:!0,colorDomain:null,colorRange:Yy,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:gD,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScaleType:"linear",onSetElevationDomain:gD,cellSize:{type:"number",min:0,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:r=>r.position},gridAggregator:{type:"function",optional:!0,value:null},extruded:!1,material:!0};class vT extends qp{getAggregatorType(){const{gpuAggregation:e,gridAggregator:t,getColorValue:n,getElevationValue:i}=this.props;return e&&(t||n||i)?(Yr.warn("Features not supported by GPU aggregation, falling back to CPU")(),"cpu"):e&&Ga.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){if(e==="cpu"){const{gridAggregator:t,cellSize:n}=this.props;return new Kp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:i},s,o)=>
5049{if(t)return t(i,n);const f=this.state.aggregatorViewport.projectPosition(i),{cellSizeCommon:A,cellOriginCommon:v}=o;return[Math.floor((f[0]-v[0])/A[0]),Math.floor((f[1]-v[1])/A[1])]}},getValue:[{sources:["colorWeights"],getValue:({colorWeights:i})=>i},{sources:["elevationWeights"],getValue:({elevationWeights:i})=>i}]})}return new Ga(this.context.device,{dimensions:2,channelCount:2,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,uxe],vs:`
5050  in vec3 positions;
5051  in vec3 positions64Low;
5052  in float colorWeights;
5053  in float elevationWeights;
5054
5055  void getBin(out ivec2 binId) {
5056    vec3 positionCommon = project_position(positions, positions64Low);
5057    vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon);
5058    binId = ivec2(gridCoords);
5059  }
5060  void getValue(out vec2 value) {
5061    value = vec2(colorWeights, elevationWeights);
5062  }
5063  `})})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},colorWeights:{size:1,accessor:"getColorWeight"},elevationWeights:{size:1,accessor:"getElevationWeight"}})}updateState(e){const t=super.updateState(e),{props:n,oldProps:i,changeFlags:s}=e,{aggregator:o}=this.state;if((s.dataChanged||!this.state.dataAsArray)&&(n.getColorValue||n.getElevationValue)&&(this.state.dataAsArray=Array.from(gl(n.data).iterable)),t||s.dataChanged||n.cellSize!==i.cellSize||n.getColorValue!==i.getColorValue||n.getElevationValue!==i.getElevationValue||n.colorAggregation!==i.colorAggregation||n.elevationAggregation!==i.elevationAggregation){this._updateBinOptions();const{cellSizeCommon:c,cellOriginCommon:f,binIdRange:A,dataAsArray:v}=this.state;if(o.setProps({binIdRange:A,pointCount:this.getNumInstances(),operations:[n.colorAggregation,n.elevationAggregation],binOptions:{cellSizeCommon:c,cellOriginCommon:f},onUpdate:this._onAggregationUpdate.bind(this)}),v){const{getColorValue:w,getElevationValue:S}=this.props;o.setProps({customOperations:[w&&(F=>w(F.map(N=>v[N]),{indices:F,data:n.data})),S&&(F=>S(F.map(N=>v[N]),{indices:F,data:n.data}))]})}}return s.updateTriggersChanged&&s.updateTriggersChanged.getColorValue&&o.setNeedsUpdate(0),s.updateTriggersChanged&&s.updateTriggersChanged.getElevationValue&&o.setNeedsUpdate(1),t}_updateBinOptions(){const e=this.getBounds(),t=[1,1];let n=[0,0],i=[[0,1],[0,1]],s=this.context.viewport;if(e&&Number.isFinite(e[0][0])){let o=[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2];const{cellSize:c}=this.props,{unitsPerMeter:f}=s.getDistanceScales(o);t[0]=f[0]*c,t[1]=f[1]*c;const A=s.projectFlat(o);n=[Math.floor(A[0]/t[0])*t[0],Math.floor(A[1]/t[1])*t[1]],o=s.unprojectFlat(n);const v=s.constructor;s=s.isGeospatial?new v({longitude:o[0],latitude:o[1],zoom:12}):new ru({position:[o[0],o[1],0],zoom:12}),n=[Math.fround(s.center[0]),Math.fround(s.center[1])],i=mT({dataBounds:e,getBinId:w=>{const S=s.projectFlat(w);return[Math.floor((S[0]-n[0])/t[0]),Math.floor((S[1]-n[1])/t[1])]}})}this.setState({cellSizeCommon:t,cellOriginCommon:n,binIdRange:i,aggregatorViewport:s})}draw(e){e.shaderModuleProps.project&&(e.shaderModuleProps.project.viewport=this.state.aggregatorViewport),super.draw(e)}_onAggregationUpdate({channel:e}){const t=this.getCurrentLayer().props,{aggregator:n}=this.state;if(e===0){const i=n.getResult(0);this.setState({colors:new ry(i,n.binCount)}),t.onSetColorDomain(n.getResultDomain(0))}else if(e===1){const i=n.getResult(1);this.setState({elevations:new ry(i,n.binCount)}),t.onSetElevationDomain(n.getResultDomain(1))}}onAttributeChange(e){const{aggregator:t}=this.state;switch(e){case"positions":t.setNeedsUpdate(),this._updateBinOptions();const{cellSizeCommon:n,cellOriginCommon:i,binIdRange:s}=this.state;t.setProps({binIdRange:s,binOptions:{cellSizeCommon:n,cellOriginCommon:i}});break;case"colorWeights":t.setNeedsUpdate(0);break;case"elevationWeights":t.setNeedsUpdate(1);break}}renderLayers(){const{aggregator:e,cellOriginCommon:t,cellSizeCommon:n}=this.state,{elevationScale:i,colorRange:s,elevationRange:o,extruded:c,coverage:f,material:A,transitions:v,colorScaleType:w,lowerPercentile:S,upperPercentile:F,colorDomain:N,elevationScaleType:U,elevationLowerPercentile:$,elevationUpperPercentile:G,elevationDomain:H}=this.props,J=this.getSubLayerClass("cells",jN),ue=e.getBins(),q=this.state.colors?.update({scaleType:w,lowerPercentile:S,upperPercentile:F}),se=this.state.elevations?.update({scaleType:U,lowerPercentile:$,upperPercentile:G});return!q||!se?null:new J(this.getSubLayerProps({id:"cells"}),{data:{length:e.binCount,attributes:{getBin:ue,getColorValue:q.attribute,getElevationValue:se.attribute}},dataComparator:(Te,Ue)=>Te.length===Ue.length,updateTriggers:{getBin:[ue],getColorValue:[q.attribute],getElevationValue:[se.attribute]},cellOriginCommon:t,cellSizeCommon:n,elevationScale:i,colorRange:s,colorScaleType:w,elevationRange:o,extruded:c,coverage:f,material:A,colorDomain:q.domain||N||e.getResultDomain(0),elevationDomain:se.domain||H||e.getResultDomain(1),colorCutoff:q.cutoff,elevationCutoff:se.cutoff,transitions:v&&{getFillColor:v.getColorValue||v.getColorWeight,getElevation:v.getElevationValue||v.getElevationWeight},extensions:[]})}getPickingInfo(e){const t=e.info,{index:n}=t;if(n>=0){const i=this.state.aggregator.getBin(n);let s;i&&(s={col:i.id[0],row:i.id[1],colorValue:i.value[0],elevationValue:i.value[1],count:i.count},i.pointIndices&&(s.pointIndices=i.pointIndices,s.points=Array.isArray(this.props.data)?i.pointIndices.map(o=>this.props.data[o]):[])),t.object=s}return t}}vT.layerName="GridLayer";vT.defaultProps=fxe;function hxe(r){const e=r.map(c=>c[0]),t=r.map(c=>c[1]),n=Math.min.apply(null,e),i=Math.max.apply(null,e),s=Math.min.apply(null,t),o=Math.max.apply(null,t);return[n,s,i,o]}function dxe(r,e){return e[0]>=r[0]&&e[2]<=r[2]&&e[1]>=r[1]&&e[3]<=r[3]}const mD=new Float32Array(12);function _D(r,e=2){let t=0;for(const n of r)for(let i=0;i<e;i++)mD[t++]=n[i]||0;return mD}function pxe(r,e,t){const[n,i,s,o]=r,c=s-n,f=o-i;let A=c,v=f;c/f<e/t?A=e/t*f:v=t/e*c,A<e&&(A=e,v=t);const w=(s+n)/2,S=(o+i)/2;return[w-A/2,S-v/2,w+A/2,S+v/2]}function Axe(r,e){const[t,n,i,s]=e;return[(r[0]-t)/(i-t),(r[1]-n)/(s-n)]}const gxe=`#version 300 es
5064#define SHADER_NAME heatp-map-layer-vertex-shader
5065uniform sampler2D maxTexture;
5066in vec3 positions;
5067in vec2 texCoords;
5068out vec2 vTexCoords;
5069out float vIntensityMin;
5070out float vIntensityMax;
5071void main(void) {
5072gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
5073vTexCoords = texCoords;
5074vec4 maxTexture = texture(maxTexture, vec2(0.5));
5075float maxValue = triangle.aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
5076float minValue = maxValue * triangle.threshold;
5077if (triangle.colorDomain[1] > 0.) {
5078maxValue = triangle.colorDomain[1];
5079minValue = triangle.colorDomain[0];
5080}
5081vIntensityMax = triangle.intensity / maxValue;
5082vIntensityMin = triangle.intensity / minValue;
5083}
5084`,mxe=`#version 300 es
5085#define SHADER_NAME triangle-layer-fragment-shader
5086precision highp float;
5087uniform sampler2D weightsTexture;
5088uniform sampler2D colorTexture;
5089in vec2 vTexCoords;
5090in float vIntensityMin;
5091in float vIntensityMax;
5092out vec4 fragColor;
5093vec4 getLinearColor(float value) {
5094float factor = clamp(value * vIntensityMax, 0., 1.);
5095vec4 color = texture(colorTexture, vec2(factor, 0.5));
5096color.a *= min(value * vIntensityMin, 1.0);
5097return color;
5098}
5099void main(void) {
5100vec4 weights = texture(weightsTexture, vTexCoords);
5101float weight = weights.r;
5102if (triangle.aggregationMode > 0.5) {
5103weight /= max(1.0, weights.a);
5104}
5105if (weight <= 0.) {
5106discard;
5107}
5108vec4 linearColor = getLinearColor(weight);
5109linearColor.a *= layer.opacity;
5110fragColor = linearColor;
5111}
5112`,yD=`uniform triangleUniforms {
5113  float aggregationMode;
5114  vec2 colorDomain;
5115  float intensity;
5116  float threshold;
5117} triangle;
5118`,_xe={name:"triangle",vs:yD,fs:yD,uniformTypes:{aggregationMode:"f32",colorDomain:"vec2<f32>",intensity:"f32",threshold:"f32"}};class $N extends Es{getShaders(){return super.getShaders({vs:gxe,fs:mxe,modules:[Ls,_xe]})}initializeState({device:e}){this.setState({model:this._getModel(e)})}_getModel(e){const{vertexCount:t,data:n}=this.props;return new Di(e,{...this.getShaders(),id:this.props.id,attributes:n.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-strip",vertexCount:t})}draw(){const{model:e}=this.state,{aggregationMode:t,colorDomain:n,intensity:i,threshold:s,colorTexture:o,maxTexture:c,weightsTexture:f}=this.props,A={aggregationMode:t,colorDomain:n,intensity:i,threshold:s,colorTexture:o,maxTexture:c,weightsTexture:f};e.shaderInputs.setProps({triangle:A}),e.draw(this.context.renderPass)}}$N.layerName="TriangleLayer";function yxe(r,e){const t={};for(const n in r)e.includes(n)||(t[n]=r[n]);return t}class WN extends Bs{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:yxe(this.constructor._propTypes,e.data.props),dimensions:e})}updateState(e){super.updateState(e);const{changeFlags:t}=e;if(t.extensionsChanged){const n=this.getShaders({});n&&n.defines&&(n.defines.NON_INSTANCED_MODEL=1),this.updateShaders(n)}this._updateAttributes()}updateAttributes(e){this.setState({changedAttributes:e})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){const{viewport:e,mousePosition:t,device:n}=this.context;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:t,picking:{isActive:0},devicePixelRatio:n.canvasContext.cssToDeviceRatio()})}updateShaders(e){}isAggregationDirty(e,t={}){const{props:n,oldProps:i,changeFlags:s}=e,{compareAll:o=!1,dimension:c}=t,{ignoreProps:f}=this.state,{props:A,accessors:v=[]}=c,{updateTriggersChanged:w}=s;if(s.dataChanged)return!0;if(w){if(w.all)return!0;for(const S of v)if(w[S])return!0}if(o)return s.extensionsChanged?!0:Nw({oldProps:i,newProps:n,ignoreProps:f,propTypes:this.constructor._propTypes});for(const S of A)if(n[S]!==i[S])return!0;return!1}isAttributeChanged(e){const{changedAttributes:t}=this.state;return e?t&&t[e]!==void 0:!vxe(t)}_getAttributeManager(){return new gy(this.context.device,{id:this.props.id,stats:this.context.stats})}}WN.layerName="AggregationLayer";function vxe(r){let e=!0;for(const t in r){e=!1;break}return e}const vD=`#version 300 es
5119in vec3 positions;
5120in vec3 positions64Low;
5121in float weights;
5122out vec4 weightsTexture;
5123void main()
5124{
5125weightsTexture = vec4(weights * weight.weightsScale, 0., 0., 1.);
5126float radiusTexels = project_pixel_size(weight.radiusPixels) * weight.textureWidth / (weight.commonBounds.z - weight.commonBounds.x);
5127gl_PointSize = radiusTexels * 2.;
5128vec3 commonPosition = project_position(positions, positions64Low);
5129gl_Position.xy = (commonPosition.xy - weight.commonBounds.xy) / (weight.commonBounds.zw - weight.commonBounds.xy) ;
5130gl_Position.xy = (gl_Position.xy * 2.) - (1.);
5131gl_Position.w = 1.0;
5132}
5133`,bD=`#version 300 es
5134in vec4 weightsTexture;
5135out vec4 fragColor;
5136float gaussianKDE(float u){
5137return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
5138}
5139void main()
5140{
5141float dist = length(gl_PointCoord - vec2(0.5, 0.5));
5142if (dist > 0.5) {
5143discard;
5144}
5145fragColor = weightsTexture * gaussianKDE(2. * dist);
5146DECKGL_FILTER_COLOR(fragColor, geometry);
5147}
5148`,bxe=`#version 300 es
5149uniform sampler2D inTexture;
5150out vec4 outTexture;
5151void main()
5152{
5153int yIndex = gl_VertexID / int(maxWeight.textureSize);
5154int xIndex = gl_VertexID - (yIndex * int(maxWeight.textureSize));
5155vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / maxWeight.textureSize;
5156outTexture = texture(inTexture, uv);
5157gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
5158gl_PointSize = 1.0;
5159}
5160`,xxe=`#version 300 es
5161in vec4 outTexture;
5162out vec4 fragColor;
5163void main() {
5164fragColor = outTexture;
5165fragColor.g = outTexture.r / max(1.0, outTexture.a);
5166}
5167`,wxe=`uniform weightUniforms {
5168  vec4 commonBounds;
5169  float radiusPixels;
5170  float textureWidth;
5171  float weightsScale;
5172} weight;
5173`,Cxe={name:"weight",vs:wxe,uniformTypes:{commonBounds:"vec4<f32>",radiusPixels:"f32",textureWidth:"f32",weightsScale:"f32"}},Txe={name:"maxWeight",vs:`uniform maxWeightUniforms {
5174  float textureSize;
5175} maxWeight;
5176`,uniformTypes:{textureSize:"f32"}},Exe=2,Y1={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},xD=[0,0],Bxe={SUM:0,MEAN:1},Sxe={getPosition:{type:"accessor",value:r=>r.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50}
5176,colorRange:Yy,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}},Ixe=["float32-renderable-webgl","texture-blend-float-webgl"],Mxe={data:{props:["radiusPixels"]}};class bT extends WN{getShaders(e){let t=[Ls];return e.modules&&(t=[...t,...e.modules]),super.getShaders({...e,modules:t})}initializeState(){super.initializeAggregationLayer(Mxe),this.setState({colorDomain:xD}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){const{props:t,oldProps:n}=e,i=this._getChangeFlags(e);(i.dataChanged||i.viewportChanged)&&(i.boundsChanged=this._updateBounds(i.dataChanged),this._updateTextureRenderingBounds()),i.dataChanged||i.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):i.viewportZoomChanged&&this._debouncedUpdateWeightmap(),t.colorRange!==n.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){const{weightsTexture:e,triPositionBuffer:t,triTexCoordBuffer:n,maxWeightsTexture:i,colorTexture:s,colorDomain:o}=this.state,{updateTriggers:c,intensity:f,threshold:A,aggregation:v}=this.props,w=this.getSubLayerClass("triangle",$N);return new w(this.getSubLayerProps({id:"triangle-layer",updateTriggers:c}),{coordinateSystem:Qr.DEFAULT,data:{attributes:{positions:t,texCoords:n}},vertexCount:4,maxTexture:i,colorTexture:s,aggregationMode:Bxe[v]||0,weightsTexture:e,intensity:f,threshold:A,colorDomain:o})}finalizeState(e){super.finalizeState(e);const{weightsTransform:t,weightsTexture:n,maxWeightTransform:i,maxWeightsTexture:s,triPositionBuffer:o,triTexCoordBuffer:c,colorTexture:f,updateTimer:A}=this.state;t?.destroy(),n?.destroy(),i?.destroy(),s?.destroy(),o?.destroy(),c?.destroy(),f?.destroy(),A&&clearTimeout(A)}_getAttributeManager(){return new gy(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){const t={},{dimensions:n}=this.state;t.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:n.data})&&"aggregation is dirty",t.viewportChanged=e.changeFlags.viewportChanged;const{zoom:i}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==i)&&(t.viewportZoomChanged=!0),t}_createTextures(){const{textureSize:e,format:t}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...Y1,width:e,height:e,format:t}),maxWeightsTexture:this.context.device.createTexture({...Y1,width:1,height:1,format:t})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){const{device:e}=this.context,{weightsTextureSize:t}=this.props,n=Math.min(t,e.limits.maxTextureDimension2D),i=Ixe.every(c=>e.features.has(c)),s=i?"rgba32float":"rgba8unorm",o=i?1:1/255;this.setState({textureSize:n,format:s,weightsScale:o}),i||Yr.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:t}=this.state;const{weightsTexture:n}=this.state,i=this.getAttributeManager();t?.destroy(),t=new n3(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:i.getBufferLayouts(),vertexCount:1,targetTexture:n,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e,modules:[...e.modules,Cxe]}),this.setState({weightsTransform:t})}_setupResources(){this._createTextures();const{device:e}=this.context,{textureSize:t,weightsTexture:n,maxWeightsTexture:i}=this.state,s=this.getShaders({vs:vD,fs:bD});this._createWeightsTransform(s);const o=this.getShaders({vs:bxe,fs:xxe,modules:[Txe]}),c=new n3(e,{id:`${this.id}-max-weights-transform`,targetTexture:i,...o,vertexCount:t*t,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}}),f={inTexture:n,textureSize:t};c.model.shaderInputs.setProps({maxWeight:f}),this.setState({weightsTexture:n,maxWeightsTexture:i,maxWeightTransform:c,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:vD,fs:bD,...e})}_updateMaxWeightValue(){const{maxWeightTransform:e}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){const{viewport:t}=this.context,n=[t.unproject([0,0]),t.unproject([t.width,0]),t.unproject([0,t.height]),t.unproject([t.width,t.height])].map(c=>c.map(Math.fround)),i=hxe(n),s={visibleWorldBounds:i,viewportCorners:n};let o=!1;if(e||!this.state.worldBounds||!dxe(this.state.worldBounds,i)){const c=this._worldToCommonBounds(i),f=this._commonToWorldBounds(c);this.props.coordinateSystem===Qr.LNGLAT&&(f[1]=Math.max(f[1],-85.051129),f[3]=Math.min(f[3],85.051129),f[0]=Math.max(f[0],-360),f[2]=Math.min(f[2],360));const A=this._worldToCommonBounds(f);s.worldBounds=f,s.normalizedCommonBounds=A,o=!0}return this.setState(s),o}_updateTextureRenderingBounds(){const{triPositionBuffer:e,triTexCoordBuffer:t,normalizedCommonBounds:n,viewportCorners:i}=this.state,{viewport:s}=this.context;e.write(_D(i,3));const o=i.map(c=>Axe(s.projectPosition(c),n));t.write(_D(o,2))}_updateColorTexture(e){const{colorRange:t}=e.props;let{colorTexture:n}=this.state;const i=zN(t,!1,Uint8Array);n&&n?.width===t.length?n.setTexture2DData({data:i}):(n?.destroy(),n=this.context.device.createTexture({...Y1,data:i,width:t.length,height:1})),this.setState({colorTexture:n})}_updateWeightmap(){const{radiusPixels:e,colorDomain:t,aggregation:n}=this.props,{worldBounds:i,textureSize:s,weightsScale:o,weightsTexture:c}=this.state,f=this.state.weightsTransform;
5176this.state.isWeightMapDirty=!1;const A=this._worldToCommonBounds(i,{useLayerCoordinateSystem:!0});if(t&&n==="SUM"){const{viewport:J}=this.context,ue=J.distanceScales.metersPerUnit[2]*(A[2]-A[0])/s;this.state.colorDomain=t.map(q=>q*ue*o)}else this.state.colorDomain=t||xD;const w=this.getAttributeManager().getAttributes(),S=this.getModuleSettings();this._setModelAttributes(f.model,w),f.model.setVertexCount(this.getNumInstances());const F={radiusPixels:e,commonBounds:A,textureWidth:s,weightsScale:o,weightsTexture:c},{viewport:N,devicePixelRatio:U,coordinateSystem:$,coordinateOrigin:G}=S,{modelMatrix:H}=this.props;f.model.shaderInputs.setProps({project:{viewport:N,devicePixelRatio:U,modelMatrix:H,coordinateSystem:$,coordinateOrigin:G},weight:F}),f.run({parameters:{viewport:[0,0,s,s]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:t}=this.state;const{debounceTimeout:n}=this.props;e?(t=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(t),t=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),n)),this.setState({updateTimer:t})}_worldToCommonBounds(e,t={}){const{useLayerCoordinateSystem:n=!1}=t,[i,s,o,c]=e,{viewport:f}=this.context,{textureSize:A}=this.state,{coordinateSystem:v}=this.props,w=n&&(v===Qr.LNGLAT_OFFSETS||v===Qr.METER_OFFSETS),S=w?f.projectPosition(this.props.coordinateOrigin):[0,0],F=A*Exe/f.scale;let N,U;return n&&!w?(N=this.projectPosition([i,s,0]),U=this.projectPosition([o,c,0])):(N=f.projectPosition([i,s,0]),U=f.projectPosition([o,c,0])),pxe([N[0]-S[0],N[1]-S[1],U[0]-S[0],U[1]-S[1]],F,F)}_commonToWorldBounds(e){const[t,n,i,s]=e,{viewport:o}=this.context,c=o.unprojectPosition([t,n]),f=o.unprojectPosition([i,s]);return c.slice(0,2).concat(f.slice(0,2))}}bT.layerName="HeatmapLayer";bT.defaultProps=Sxe;const Pxe=Object.freeze(Object.defineProperty({__proto__:null,CPUAggregator:Kp,ContourLayer:yT,GridLayer:vT,HeatmapLayer:bT,HexagonLayer:_T,ScreenGridLayer:gT,WebGLAggregator:Ga,_AggregationLayer:qp},Symbol.toStringTag,{value:"Module"}));var VA={},Z1,wD;function Rxe(){if(wD)return Z1;wD=1;var r=Math.PI/180,e=180/Math.PI;function t(H){var J=i(H[0]+1,H[2]),ue=i(H[0],H[2]),q=s(H[1]+1,H[2]),se=s(H[1],H[2]);return[ue,q,J,se]}function n(H){var J=t(H),ue={type:"Polygon",coordinates:[[[J[0],J[1]],[J[0],J[3]],[J[2],J[3]],[J[2],J[1]],[J[0],J[1]]]]};return ue}function i(H,J){return H/Math.pow(2,J)*360-180}function s(H,J){var ue=Math.PI-2*Math.PI*H/Math.pow(2,J);return e*Math.atan(.5*(Math.exp(ue)-Math.exp(-ue)))}function o(H,J,ue){var q=G(H,J,ue);return q[0]=Math.floor(q[0]),q[1]=Math.floor(q[1]),q}function c(H){return[[H[0]*2,H[1]*2,H[2]+1],[H[0]*2+1,H[1]*2,H[2]+1],[H[0]*2+1,H[1]*2+1,H[2]+1],[H[0]*2,H[1]*2+1,H[2]+1]]}function f(H){return H[0]%2===0&&H[1]%2===0?[H[0]/2,H[1]/2,H[2]-1]:H[0]%2===0&&!H[1]%2===0?[H[0]/2,(H[1]-1)/2,H[2]-1]:!H[0]%2===0&&H[1]%2===0?[(H[0]-1)/2,H[1]/2,H[2]-1]:[(H[0]-1)/2,(H[1]-1)/2,H[2]-1]}function A(H){return c(f(H))}function v(H,J){for(var ue=A(H),q=0;q<ue.length;q++)if(!w(J,ue[q]))return!1;return!0}function w(H,J){for(var ue=0;ue<H.length;ue++)if(S(H[ue],J))return!0;return!1}function S(H,J){return H[0]===J[0]&&H[1]===J[1]&&H[2]===J[2]}function F(H){for(var J="",ue=H[2];ue>0;ue--){var q=0,se=1<<ue-1;(H[0]&se)!==0&&q++,(H[1]&se)!==0&&(q+=2),J+=q.toString()}return J}function N(H){for(var J=0,ue=0,q=H.length,se=q;se>0;se--){var Te=1<<se-1;switch(H[q-se]){case"0":break;case"1":J|=Te;break;case"2":ue|=Te;break;case"3":J|=Te,ue|=Te;break}}return[J,ue,q]}function U(H){var J=o(H[0],H[1],32),ue=o(H[2],H[3],32),q=[J[0],J[1],ue[0],ue[1]],se=$(q);if(se===0)return[0,0,0];var Te=q[0]>>>32-se,Ue=q[1]>>>32-se;return[Te,Ue,se]}function $(H){for(var J=28,ue=0;ue<J;ue++){var q=1<<32-(ue+1);if((H[0]&q)!=(H[2]&q)||(H[1]&q)!=(H[3]&q))return ue}return J}function G(H,J,ue){var q=Math.sin(J*r),se=Math.pow(2,ue),Te=se*(H/360+.5),Ue=se*(.5-.25*Math.log((1+q)/(1-q))/Math.PI);return[Te,Ue,ue]}return Z1={tileToGeoJSON:n,tileToBBOX:t,getChildren:c,getParent:f,getSiblings:A,hasTile:w,hasSiblings:v,tilesEqual:S,tileToQuadkey:F,quadkeyToT
5176ile:N,pointToTile:o,bboxToTile:U,pointToTileFraction:G},Z1}var CD;function Fxe(){if(CD)return VA;CD=1;var r=Rxe();VA.geojson=function(v,w){return{type:"FeatureCollection",features:t(v,w).map(e)}};function e(v){return{type:"Feature",geometry:r.tileToGeoJSON(v),properties:{}}}VA.tiles=t,VA.indexes=function(v,w){return t(v,w).map(r.tileToQuadkey)};function t(v,w){var S,F,N=v.coordinates,U=w.max_zoom,$={},G=[];if(v.type==="Point")return[r.pointToTile(N[0],N[1],U)];if(v.type==="MultiPoint")for(S=0;S<N.length;S++)F=r.pointToTile(N[S][0],N[S][1],U),$[f(F[0],F[1],F[2])]=!0;else if(v.type==="LineString")o($,N,U);else if(v.type==="MultiLineString")for(S=0;S<N.length;S++)o($,N[S],U);else if(v.type==="Polygon")i($,G,N,U);else if(v.type==="MultiPolygon")for(S=0;S<N.length;S++)i($,G,N[S],U);else throw new Error("Geometry type not implemented");if(w.min_zoom!==U){var H=G.length;for(c($,G),S=0;S<H;S++){var J=G[S];$[f(J[0],J[1],J[2])]=!0}return n($,G,w)}return c($,G),G}function n(v,w,S){for(var F=[],N=S.max_zoom;N>S.min_zoom;N--){for(var U={},$=[],G=0;G<w.length;G++){var H=w[G];if(H[0]%2===0&&H[1]%2===0){var J=f(H[0]+1,H[1],N),ue=f(H[0],H[1]+1,N),q=f(H[0]+1,H[1]+1,N);if(v[J]&&v[ue]&&v[q]){v[f(H[0],H[1],H[2])]=!1,v[J]=!1,v[ue]=!1,v[q]=!1;var se=[H[0]/2,H[1]/2,N-1];N-1===S.min_zoom?F.push(se):(U[f(H[0]/2,H[1]/2,N-1)]=!0,$.push(se))}}}for(G=0;G<w.length;G++)H=w[G],v[f(H[0],H[1],H[2])]&&F.push(H);v=U,w=$}return F}function i(v,w,S,F){for(var N=[],U=0;U<S.length;U++){var $=[];o(v,S[U],F,$);for(var G=0,H=$.length,J=H-1;G<H;J=G++){var ue=(G+1)%H,q=$[G][1];(q>$[J][1]||q>$[ue][1])&&(q<$[J][1]||q<$[ue][1])&&q!==$[ue][1]&&N.push($[G])}}for(N.sort(s),U=0;U<N.length;U+=2){q=N[U][1];for(var se=N[U][0]+1;se<N[U+1][0];se++){var Te=f(se,q,F);v[Te]||w.push([se,q,F])}}}function s(v,w){return v[1]-w[1]||v[0]-w[0]}function o(v,w,S,F){for(var N,U,$=0;$<w.length-1;$++){var G=r.pointToTileFraction(w[$][0],w[$][1],S),H=r.pointToTileFraction(w[$+1][0],w[$+1][1],S),J=G[0],ue=G[1],q=H[0],se=H[1],Te=q-J,Ue=se-ue;if(!(Ue===0&&Te===0)){var de=Te>0?1:-1,me=Ue>0?1:-1,pe=Math.floor(J),W=Math.floor(ue),re=Te===0?1/0:Math.abs(((Te>0?1:0)+pe-J)/Te),Ee=Ue===0?1/0:Math.abs(((Ue>0?1:0)+W-ue)/Ue),et=Math.abs(de/Te),_e=Math.abs(me/Ue);for((pe!==N||W!==U)&&(v[f(pe,W,S)]=!0,F&&W!==U&&F.push([pe,W]),N=pe,U=W);re<1||Ee<1;)re<Ee?(re+=et,pe+=de):(Ee+=_e,W+=me),v[f(pe,W,S)]=!0,F&&W!==U&&F.push([pe,W]),N=pe,U=W}}F&&W===F[0][1]&&F.pop()}function c(v,w){for(var S=Object.keys(v),F=0;F<S.length;F++)w.push(A(+S[F]))}function f(v,w,S){var F=2*(1<<S);return(F*w+v)*32+S}function A(v){var w=v%32,S=2*(1<<w),F=(v-w)/32,N=F%S,U=(F-N)/S%S;return[N,U,w]}return VA}Fxe();const JN=[0x5555555555555555n,0x3333333333333333n,0x0f0f0f0f0f0f0f0fn,0x00ff00ff00ff00ffn,0x0000ffff0000ffffn,0x00000000ffffffffn],XN=[0n,1n,2n,4n,8n,16n];function Dxe(r){return BigInt(`0x${r}`)}function Rx(r){return r.toString(16)}function Oxe(r){if(r.z<0||r.z>26)throw new Error("Wrong zoom");const e=BigInt(r.z);let t=BigInt(r.x)<<32n-e,n=BigInt(r.y)<<32n-e;for(let s=0;s<5;s++){const o=XN[5-s],c=JN[4-s];t=(t|t<<o)&c,n=(n|n<<o)&c}return 0x4000000000000000n|1n<<59n|e<<52n|(t|n<<1n)>>12n|0xfffffffffffffn>>e*2n}function KN(r){const e=r>>59n&7n,t=r>>57n&3n,n=r>>52n&0x1fn,i=(r&0xfffffffffffffn)<<12n;if(e!==1n&&t!==0n)throw new Error("Wrong mode");let s=i,o=i>>1n;for(let c=0;c<6;c++){const f=XN[c],A=JN[c];s=(s|s>>f)&A,o=(o|o>>f)&A}return s=s>>32n-n,o=o>>32n-n,{z:Number(n),x:Number(s),y:Number(o)}}function xT(r){return r>>52n&0x1fn}function qN(r){const e=xT(r)-1n;return r&~(0x1fn<<52n)|e<<52n|0xfffffffffffffn>>e*2n}function gh(r,e){Yr.assert(r,e)}function Lxe(r,e){const{properties:t,numericProps:n}=r;return new Proxy(t[e]||{},{get(i,s){return s in n?n[s].value[e]:i[s]},has(i,s){return s in n||s in i},ownKeys(i){return[...Object.keys(n),...Reflect.ownKeys(i)]},getOwnPropertyDescriptor(i,s){return{enumerable:!0,configurable:!0}}})}function ev(r,e){return`https://unpkg.com/@deck.gl/carto@${e}/dist/${r}-worker.js`}const mg=new Uint16Array,Q1={positions:{value:new Float32Array,size:2},properties:[],numericProps:{},featureIds:{value:mg,size:1},globalFeatureIds:{value:mg,size:1}};function YN(){return{shape:"binary-feature-collection",points:{type:"Point",...Q1},lines:{type:"LineString",pathIndices:{value:mg,size:1},...Q1},polygons:{type:"Polygon",polygonIndices:{value:mg,size:1},primitivePolygonIndices:{value:mg,size:1},...Q1}}}function wT(r,e,t,n,i,s=2){return{type:"Point",positions:{value:new Float32Array(r),size:s},featureIds:{value:new Uint16Array(e),size:1},globalFeatureIds:{value:new Uint32Array(t),size:1},numericProps:n,properties:i}}function ZN(r,e){const t={};return e&&Object.keys(e).forEach(n=>{t[n]={value:new Float32Array(r),size:1}}),t}function QN(r,e,t,n){Object.keys(r).forEach(i=>
5176{e[i].value[n]=r[i].value[t]})}function kxe(r,e,t,n=[],i,s){if(!r.content)return!1;r.userData||(r.userData={});const o=e.get(t)?.[0];if(o){if(n.every(f=>f.name in o))return!1;e.clear()}const c={};for(const f of r.content){let A=f.id;const v=typeof i=="function"?i(f,{}):i;for(let U=0;U<t-1;U++)A=qN(A);const w=Number(A);if(!(w in c)){c[w]={id:A,count:0,position:[0,0]};for(const{name:U,aggregation:$}of n)$==="any"?c[w][U]=f.properties[U]:c[w][U]=0}const S=c[w].count;c[w].count+=typeof s=="function"?s(f,{}):s;const F=c[w].count,N=F-S;c[w].position[0]=(S*c[w].position[0]+N*v[0])/F,c[w].position[1]=(S*c[w].position[1]+N*v[1])/F;for(const{name:U,aggregation:$}of n){const G=c[w][U],H=f.properties[U];$==="average"?c[w][U]=(S*G+N*H)/F:$==="count"||$==="sum"?c[w][U]=G+H:$==="max"?c[w][U]=Math.max(G,H):$==="min"&&(c[w][U]=Math.min(G,H))}}return e.set(t,Object.values(c)),!0}function Nxe(r){const e=[],t=["any","average","count","min","max","sum"];for(const n of Object.keys(r.content[0].properties)){let i=n.split("_").pop().toLowerCase();t.includes(i)||(Yr.warn(`No valid aggregation present in ${n} property`)(),i="any"),e.push({name:n,aggregation:i})}return e}function Uxe(r,e){const t={};for(const{name:n,aggregation:i}of e)if(t[n]={min:1/0,max:-1/0},i!=="any")for(const s of r)t[n].min=Math.min(t[n].min,s[n]),t[n].max=Math.max(t[n].max,s[n]);return t}function zxe(r){const e=new Float32Array(r.length*2),t=new Uint16Array(r.length);for(let n=0;n<r.length;n++)e.set(r[n].position,2*n),t[n]=n;return{...YN(),points:wT(e,t,t,{},r)}}const Yp=512;class CT extends Oy{getTileIndices(e){return super.getTileIndices(e).map(Oxe).map(t=>({q:t,i:Rx(t)}))}getTileId({q:e,i:t}){return t||Rx(e)}getTileMetadata({q:e}){return super.getTileMetadata(KN(e))}getTileZoom({q:e}){return Number(xT(e))}getParentIndex({q:e}){return{q:qN(e)}}}const TD=512;function eU(r){const{x:e,y:t,z:n}=KN(r),i=TD/(1<<n);return[e*i,TD-t*i,i]}function Gxe(r,e){const[t,n,i]=eU(r);return[[t,n],[t+e*i,n-e*i]]}function tU(r,e=1){const[t,n]=Gxe(r,e),[i,s]=hl(t),[o,c]=hl(n);return[o,s,o,c,i,c,i,s,o,s]}const M0=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),ED=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);ED&&parseFloat(ED[1]);function Vxe(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function Hxe(...r){return jxe(r)}function jxe(r){const e=r.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),t=e.reduce((s,o)=>s+o.byteLength,0),n=new Uint8Array(t);let i=0;for(const s of e)n.set(s,i),i+=s.byteLength;return n.buffer}async function $xe(r){const e=[];for await(const t of r)e.push(t);return Hxe(...e)}function Wxe(r){return r&&typeof r=="object"&&r.isBuffer}function P0(r){if(Wxe(r))return r;if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r))return r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);if(typeof r=="string"){const e=r;return new TextEncoder().encode(e).buffer}if(r&&typeof r=="object"&&r._toArrayBuffer)return r._toArrayBuffer();throw new Error("toArrayBuffer")}function R0(r){return e=>new Promise((t,n)=>r(e,(i,s)=>i?n(i):t(s)))}class Jxe{constructor(e){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(e={}){Vxe(e)}async compress(e){return await this.preload(),this.compressSync(e)}async decompress(e,t){return await this.preload(),this.decompressSync(e,t)}compressSync(e){throw new Error(`${this.name}: sync compression not supported`)}decompressSync(e,t){throw new Error(`${this.name}: sync decompression not supported`)}async*compressBatches(e){const t=await this.concatenate(e);yield this.compress(t)}async*decompressBatches(e){const t=await this.concatenate(e);yield this.decompress(t)}concatenate(e){return $xe(e)}improveError(e){return e.message.includes(this.name)||(e.message=`${this.name} ${e.message}`),e}}class Xxe extends Jxe{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(e={}){super(e),this.options=e}async compress(e){if(!M0&&this.options.deflate?.useZlib){const t=this.options.deflate?.gzip?await R0(Fu.gzip)(e):await R0(Fu.deflate)(e);return P0(t)}return this.compressSync(e)}async decompress(e){if(!M0&&this.options.deflate?.useZlib){const t=this.options.deflate?.gzip?await R0(Fu.gunzip)(e):await R0(Fu.inflate)(e);return P0(t)}return this.decompressSync(e)}compressSync(e){if(!M0&&this.options.deflate?.useZlib){const s=this.options.deflate?.gzip?Fu.gzipSync(e):Fu.deflateSync(e);return P0(s)}const t=this.options?.deflate||{},n=new Uint8Array(e);return(this.options?.raw?zd.deflateRaw:zd.deflate)(n,t).buffer}decompressSync(e){if(!M0&&this.options.deflate?.useZlib){const s=this.options.deflate?.gzip?Fu.gunzipSync(e):Fu.inflateSync(e);return P0(s)}const t=this.options?.deflate||{},n=new Uint8Array(e);return(this.options?.raw?zd.inflateRaw:zd.inflate)(n,t).buffer}async*compressBatches(e){const t=this.options?.deflate||{},n=new zd.Deflate(t);yield*this.transformBatches(n,e)}async*decompressBatches(e){const t=this.options?.deflate||{},n=new zd.Inflate(t);yield*this.transformBatches(n,e)}async*transformBatches(e,t){e.onData=this._onData.bind(this),e.onEnd=this._onEnd.bind(this);for await(const s of t){const o=new Uint8Array(s);if(!e.push(o,!1))throw new Error(`${this._getError()}write`);yield*this._getChunks()}const n=new Uint8Array(0);e.push(n,!0),yield*this._getChunks()}_onData(e){this._chunks.push(e)}_onEnd(e){if(e!==0)throw new Error(this._getError(e)+this._chunks.length)}_getChunks(){const e=this._chunks;return this._chunks=[],e}_getError(e=0){const t={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};return`${this.name}: ${t[e]}`}}class Kxe extends Xxe{name="gzip";extensions=["gz","gzip"];contentEncodings=["gzip","x-gzip"];isSupported=!0;constructor(e){super({...e,deflate:{...e?.gzip,gzip:!0}})}}function tv(r,e,t,n){const i=e.type===2?e.readVarint()+e.pos:e.pos+1,s=e.buf.buffer.slice(e.pos,i);if(n?.compression==="gzip"){const c=new Kxe().decompressSync(s);t.value=new r(c)}else t.value=new r(s);return e.pos=i,t.value}class TT{static read(e,t){return e.readFields(TT._readField,{key:"",value:null},t)}static _readField(e,t,n){e===1?t.key=n.readString():e===2&&(t.value=n.readString())}}class Ih{static read(e,t){return e.readFields(Ih._readField,{},t)}static _readField(e,t,n){if(e===1){const{key:i,value:s}=TT.read(n,n.readVarint()+n.pos);t[i]=s}}}class em{static read(e,t){const{value:n,size:i}=e.readFields(em._readField,{value:[],size:0},t);return{value:n,size:i}}static _readField(e,t,n){e===1?tv(Float64Array,n,t):e===2&&(t.size=n.readVarint(!0))}}class La{static read(e,t){const{value:n,size:i}=e.readFields(La._readField,{value:[],size:0},t);return{value:new Uint32Array(n),size:i}}static _readField(e,t,n){e===1?n.readPackedVarint(t.value):e===2&&(t.size=n.readVarint(!0))}}class tm{static read(e,t){return e.readFields(tm._readField,{id:0},t)}static _readField(e,t,n){e===1&&(t.id=n.readVarint())}}class ET{static read(e,t){return e.readFields(ET._readField,{value:[]},t)}static _readField(e,t,n){e===1&&tv(Float64Array,n,t)}}class Mh{static read(e,t){return e.readFields(Mh._readField,{key:"",value:null},t)}static _readField(e,t,n){e===1?t.key=n.readString():e===2&&(t.value=ET.read(n,n.readVarint()+n.pos))}}class BT{static read(e,t){return e.readFields(BT._readField,{positions:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},t)}static _readField(e,t,n){if(e===1)t.positions=em.read(n,n.readVarint()+n.pos);else if(e===2)t.globalFeatureIds=La.read(n,n.readVarint()+n.pos);else if(e===3)t.featureIds=La.read(n,n.readVarint()+n.pos);else if(e===4)t.properties.push(Ih.read(n,n.readVarint()+n.pos));else if(e===5){const i=Mh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}else e===6&&t.fields.push(tm.read(n,n.readVarint()+n.pos))}}class ST{static read(e,t){return e.readFields(ST._readField,{positions:null,pathIndices:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},t)}static _readField(e,t,n){if(e===1)t.positions=em.read(n,n.readVarint()+n.pos);else if(e===2)t.pathIndices=La.read(n,n.readVarint()+n.pos);else if(e===3)t.globalFeatureIds=La.read(n,n.readVarint()+n.pos);else if(e===4)t.featureIds=La.read(n,n.readVarint()+n.pos);else if(e===5)t.properties.push(Ih.read(n,n.readVarint()+n.pos));else if(e===6){const i=Mh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}else e===7&&t.fields.push(tm.read(n,n.readVarint()+n.pos))}}class IT{static read(e,t){return e.readFields(IT._readField,{positions:null,polygonIndices:null,globalFeatureIds:null,featureIds:null,primitivePolygonIndices:null,triangles:null,properties:[],numericProps:{},fields:[]},t)}static _readField(e,t,n){if(e===1)t.positions=em.read(n,n.readVarint()+n.pos);else if(e===2)t.polygonIndices=La.read(n,n.readVarint()+n.pos);else if(e===3)t.globalFeatureIds=La.read(n,n.readVarint()+n.pos);else if(e===4)t.featureIds=La.read(n,n.readVarint()+n.pos);else if(e===5)t.primitivePolygonIndices=La.read(n,n.readVarint()+n.pos);else if(e===6)t.triangles=La.read(n,n.readVarint()+n.pos);else if(e===7)t.properties.push(Ih.read(n,n.readVarint()+n.pos));else if(e===8){const i=Mh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}else e===9&&t.fields.push(tm.read(n,n.readVarint()+n.pos))}}let qxe=class rU{static read(e,t){return e.readFields(rU._readField,{points:null,lines:null,polygons:null},t)}static _readField(e,t,n){e===1?t.points=BT.read(n,n.readVarint()+n.pos):e===2?t.lines=ST.read(n,n.readVarint()+n.pos):e===3&&(t.polygons=IT.read(n,n.readVarint()+n.pos))}};class MT{static read(e,t){return e.readFields(MT._readField,{value:[]},t)}static _readField(e,t,n){e===1&&tv(BigUint64Array,n,t)}}class PT{static read(e,t){return e.readFields(PT._readField,{indices:null,properties:[],numericProps:{}},t)}static _readField(e,t,n){if(e===1)t.indices=MT.read(n,n.readVarint()+n.pos);else if(e===2)t.properties.push(Ih.read(n,n.readVarint()+n.pos));else if(e===3){const i=Mh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}}}let Yxe=class nU{static read(e,t){return e.readFields(nU._readField,{scheme:0,cells:null},t)}static _readField(e,t,n){e===1?t.scheme=n.readVarint():e===2&&(t.cells=PT.read(n,n.readVarint()+n.pos))}};function rv(r,e){const t=new U1e(r);return e.read(t)}function Zxe(r){const{cells:e,scheme:t}=r,n=e.indices.value.length,i=[];for(let s=0;s<n;s++){const o=t==="h3"?Rx(e.indices.value[s]):e.indices.value[s],c={...e.properties[s]};for(const f of Object.keys(e.numericProps))c[f]=e.numericProps[f].value[s];i.push({id:o,properties:c})}return i}const iU="9.1.14",sU="cartoSpatialTile",Qxe={cartoSpatialTile:{scheme:"quadbin",workerUrl:ev(sU,iU)}},oU={name:"CARTO Spatial Tile",version:iU,id:sU,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.c
5176arto-spatial-tile"],category:"geometry",parse:async(r,e)=>BD(r,e),parseSync:BD,worker:!0,options:Qxe};function BD(r,e){if(!r)return null;const t=rv(r,Yxe),{cells:n}=t,i=e?.cartoSpatialTile?.scheme;return Zxe({cells:n,scheme:i})}function Zp(r,e,t=0){if(!r)return e;if(!e)return r;if(t>10)return e;const n={...r};for(const i in e){const s=e[i];s===r||s===e||(typeof s=="object"&&s!==null?n[i]=Zp(r[i],s,t+1):n[i]=s)}return n}function ewe(r,e){const t={};for(const{geoid:n,...i}of e.properties)n in t?Yr.warn("Duplicate geoid key in boundary mapping, using first occurance")():t[n]=i;for(const n of["points","lines","polygons"]){const i=r[n];if(i.positions.value.length===0)continue;i.properties=i.properties.map(({geoid:A})=>t[A]);const{positions:s,globalFeatureIds:o}=i;let c=null;n==="lines"&&(c=i.pathIndices.value),n==="polygons"&&(c=i.polygonIndices.value);const f=s.value.length/s.size;for(const A in e.numericProps){const v=e.numericProps[A].value,w=v.constructor,S=new w(f);if(i.numericProps[A]={value:S,size:1},c)for(let F=0;F<c.length-1;F++){const N=c[F],U=c[F+1],$=o.value[N];S.fill(v[$],N,U)}else for(let F=0;F<f;F++){const N=o.value[F];S[F]=v[N]}}}return r}const mh={type:"object",value:null,validate:(r,e)=>e.optional&&r===null||typeof r=="object"&&Array.isArray(r.tiles)&&r.tiles.every(t=>typeof t=="string"),equal:(r,e)=>rs(r,e,2),async:!0};Ug([oU]);const aU={data:mh,clusterLevel:{type:"number",value:5,min:1},getPosition:{type:"accessor",value:({id:r})=>tU(r,.5).slice(2,4)},getWeight:{type:"accessor",value:1},refinementStrategy:"no-overlap",tileSize:Yp};class RT extends ou{initializeState(){super.initializeState(),this.state.aggregationCache=new WeakMap}renderLayers(){const e=this.state.tileset?.tiles.filter(S=>S.isLoaded&&S.content&&this.state.tileset.isTileVisible(S));if(!e?.length)return null;e.sort((S,F)=>F.zoom-S.zoom);const{zoom:t}=this.context.viewport,{clusterLevel:n,getPosition:i,getWeight:s}=this.props,{aggregationCache:o}=this.state,c=Nxe(e[0]),f=[];let A=!1;for(const S of e){const F=Math.round(t-S.zoom),N=Math.round(n)-F;let U=o.get(S.content);U||(U=new Map,o.set(S.content,U));const $=kxe(S,U,N,c,i,s);A||(A=$),f.push(...U.get(N))}f.sort((S,F)=>Number(F.count-S.count));const v=f?.map(S=>S.id);if(A||(A=!rs(v,this.state.clusterIds,1)),this.setState({clusterIds:v}),A){const S=Uxe(f,c),F=zxe(f);F.points.attributes={stats:S},this.setState({data:F})}const w={...this.props,id:"clusters",data:this.state.data,dataComparator:(S,F)=>{const N=S?.points?.properties?.map($=>$.id),U=F?.points?.properties?.map($=>$.id);return rs(N,U,1)}};return new iu(this.getSubLayerProps(w))}getPickingInfo(e){const t=e.info;if(t.index!==-1){const{data:n}=e.sourceLayer.props;t.object=Px(n,{globalFeatureId:t.index})}return t}_updateAutoHighlight(e){for(const t of this.getSubLayers())t.updateAutoHighlight(e)}filterSubLayer(){return!0}}RT.layerName="ClusterGeoJsonLayer";RT.defaultProps=aU;class FT extends Bs{getLoadOptions(){const e=this.props.data;return Zp(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${e.accessToken}`}},cartoSpatialTile:{scheme:"quadbin"}})}renderLayers(){const e=this.props.data;if(!e)return null;const{tiles:t,maxresolution:n}=e;return[new RT(this.props,{id:`cluster-geojson-layer-${this.props.id}`,data:t,TilesetClass:CT,maxZoom:n,loadOptions:this.getLoadOptions()})]}}FT.layerName="ClusterTileLayer";FT.defaultProps=aU;const SD=85.051128;function cU({west:r,north:e,east:t,south:n},i,s=1){const f=[[e,t],[n,t],[n,r],[e,r]].map(w=>LC(w[0],w[1],i)).map(w=>Math.max(...Yde(w).map(S=>Qde(S,Ep.rads)))*180/Math.PI),A=Math.max(...f)*s,v=Math.min(180,A/Math.cos((e+n)/2*Math.PI/180));return{north:Math.min(e+A,SD),east:t+v,south:Math.max(n-A,-SD),west:r-v}}function lU({west:r,north:e,east:t,south:n},i){const s=Math.abs(t-r);if(s>180){const c=Math.ceil(s/180);let f=[];for(let A=0;A<c;A++){const v=r+A*180,w=Math.min(v+179.9999999,t);f=f.concat(lU({west:v,north:e,east:w,south:n},i))}return[...new Set(f)]}return Kde([[e,t],[n,t],[n,r],[e,r],[e,t]],i)}function twe(r){const e=o8(r),t=e.map(A=>A[0]),n=e.map(A=>A[1]),i=Math.min(...n),s=Math.min(...t),o=Math.max(...n),c=Math.max(...t);return cU({west:i,south:s,east:o,north:c},$_(r),.12)}const rwe=2;function Fx(r,e){const t=Math.log2(e/512),n=2/3*(r.zoom-t),i=Math.log(1/Math.cos(Math.PI*r.latitude/180));return Math.max(0,Math.floor(n+i-rwe))}class nwe extends Oy{getTileIndices({viewport:e,minZoom:t,maxZoom:n}){if(e.latitude===void 0)return[];const[i,s,o,c]=e.getBounds(),{tileSize:f}=this.opts;let A=Fx(e,f),v;if(typeof t=="number"&&Number.isFinite(t)&&A<t)return[];if(typeof n=="number"&&Number.isFinite(n)&&A>n){A=n;const w=LC(e.latitude,e.longitude,n);v=Xde(w,1)}else{const w=cU({west:i,north:c,east:o,south:s},A);v=lU(w,A)}return v.map(w=>({i:w}))}getTileId({i:e}){return e}getTileMetadata({i:e}){return{bbox:twe(e)}}getTileZoom({i:e}){return $_(e)}getParentIndex(e){const t=$_(e.i);return{i:Jde(e.i,t-1)}}}Ug([oU]);function iwe(r){return r!=null&&r!==""}const swe={tileSize:Yp};
5176class nv extends ou{_updateAutoHighlight(e){const{hoveredFeatureId:t}=this.state,n=e.object;let i=null;if(n&&(i=n.id),t!==i){let{highlightColor:s}=this.props;typeof s=="function"&&(s=s(e)),this.setState({highlightColor:s,hoveredFeatureId:i})}}getSubLayerPropsByTile(e){return{highlightedObjectIndex:this.getHighlightedObjectIndex(e),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(e){const{hoveredFeatureId:t}=this.state,n=e.content;return!iwe(t)||!Array.isArray(n)||!this._featureInTile(e,t)?-1:n.findIndex(s=>s.id===t)}_featureInTile(e,t){const n=this.state.tileset,i=n.getTileZoom(e.index),s=e.index.q?"q":"i";let o={[s]:t},c=n.getTileZoom(o);for(;!(c<=i);)o=n.getParentIndex(o),c=n.getTileZoom(o);return o[s]===e.index[s]}}nv.layerName="SpatialIndexTileLayer";nv.defaultProps=swe;const owe=r=>{const{data:e}=r,{index:t}=r.tile;return!e||!e.length?null:new _l(r,{getHexagon:n=>n.id,centerHexagon:t,highPrecision:!0})},awe={data:mh,tileSize:Yp};class DT extends Bs{initializeState(){_l._checkH3Lib()}getLoadOptions(){const e=this.props.data;return Zp(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${e.accessToken}`}},cartoSpatialTile:{scheme:"h3"}})}renderLayers(){const e=this.props.data;if(!e)return null;const{tiles:t}=e;let{minresolution:n,maxresolution:i}=e;this.props.minZoom&&(n=Math.max(n,Fx({zoom:this.props.minZoom,latitude:0},this.props.tileSize))),this.props.maxZoom&&(i=Math.min(i,Fx({zoom:this.props.maxZoom,latitude:0},this.props.tileSize)));const s=this.getSubLayerClass("spatial-index-tile",nv);return new s(this.props,{id:`h3-tile-layer-${this.props.id}`,data:t,TilesetClass:nwe,renderSubLayers:owe,minZoom:n,maxZoom:i,loadOptions:this.getLoadOptions()})}}DT.layerName="H3TileLayer";DT.defaultProps=awe;const cwe=`uniform heatmapUniforms {
5177  vec2 colorDomain;
5178  vec2 delta;
5179  float intensity;
5180  float opacity;
5181  float radiusPixels;
5182} heatmap;
5183
5184uniform sampler2D colorTexture;
5185
5186vec3 colorGradient(float value) {
5187  return texture(colorTexture, vec2(value, 0.5)).rgb;
5188}
5189
5190const vec3 SHIFT = vec3(1.0, 256.0, 256.0 * 256.0);
5191const float MAX_VAL = SHIFT.z * 255.0;
5192const float SCALE = MAX_VAL / 8.0;
5193vec4 pack(float value) {
5194  return vec4(mod(vec3(value, floor(value / SHIFT.yz)), 256.0), 255.0) / 255.0;
5195}
5196float unpack(vec3 color) {
5197  return 255.0 * dot(color, SHIFT);
5198}
5199
5200vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
5201  bool firstPass = (heatmap.delta.y < 0.5);
5202  float accumulator = 0.0;
5203
5204  // Controls quality of heatmap, larger values increase quality at expense of performance
5205  float SUPPORT = clamp(heatmap.radiusPixels / 2.0, 8.0, 32.0);
5206
5207  // Gaussian normalization parameters
5208  float sigma = SUPPORT / 3.0;
5209  float a = -0.5 / (sigma * sigma);
5210  float w0 = 0.3989422804014327 / sigma; // 1D normalization
5211  for (float t = -SUPPORT; t <= SUPPORT; t++) {
5212    vec2 percent = (t * heatmap.delta - 0.5) / SUPPORT;
5213    vec2 delta = percent * heatmap.radiusPixels / texSize;
5214    vec4 offsetColor = texture(source, texCoord + delta);
5215
5216    // Unpack float
5217    float value = unpack(offsetColor.rgb);
5218
5219    // Gaussian
5220    float weight = w0 * exp(a * t * t);
5221    
5222    accumulator += value * weight;
5223  }
5224
5225  if (firstPass) {
5226    return pack(accumulator);
5227  }
5228
5229  // Undo scaling to obtain normalized density
5230  float density = 10.0 * heatmap.intensity * accumulator / SCALE;
5231 
5232  // Domain also in normalized density units
5233  vec2 domain = heatmap.colorDomain;
5234
5235  // Apply domain
5236  float f = (density - domain[0]) / (domain[1] - domain[0]);
5237
5238  // sqrt/log scaling??
5239  // float f = (log(density) - log(domain[0] + 1.0)) / (log(domain[1] + 1.0) - log(domain[0] + 1.0));
5240  // f = sqrt(f);
5241
5242  // Color map
5243  vec4 color = vec4(0.0);
5244  color.rgb = colorGradient(f);
5245
5246  color.a = smoothstep(0.0, 0.1, f);
5247  color.a = pow(color.a, 1.0 / 2.2);
5248  color.a *= heatmap.opacity;
5249
5250  return color;
5251}
5252`,lwe={name:"heatmap",uniformPropTypes:{colorDomain:{value:[0,1]},delta:{value:[0,1]},intensity:{value:1,min:.1,max:10},opacity:{value:1,min:0,max:1},radiusPixels:{value:20,min:0,softMax:100}},uniformTypes:{colorDomain:"vec2<f32>",delta:"vec2<f32>
5252",intensity:"f32",opacity:"f32",radiusPixels:"f32"},getUniforms:r=>{if(!r)return{};const{colorDomain:e=[0,1],colorTexture:t,delta:n=[1,0],intensity:i=1,opacity:s=1,radiusPixels:o=20}=r;return{colorDomain:e,colorTexture:t,delta:n,intensity:i,opacity:s,radiusPixels:o}},fs:cwe,passes:[{sampler:!0,uniforms:{delta:[1,0]}},{sampler:!0,uniforms:{delta:[0,1]}}]},uwe={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function Dx(r){for(;r.parent&&!r.applyPostProcess;)r=r.parent;return r}class uU extends Es{initializeState(){this.id=`draw-callback-${Dx(this).props.id}`}_drawLayer(){Dx(this).applyPostProcess()}}uU.layerName="DrawCallbackLayer";function fU(r){var e;return e=class extends r{draw(n){const{shaderModuleProps:i}=n,{picking:s}=i,o=Dx(this);s.isActive||o.enableRTT(n),super.draw(n),s.isActive||o.disableRTT()}},e.layerName=`RTT-${r.layerName}`,e}function hU(r,e){var t;return t=class extends r{initializeState(i){super.initializeState(i),this._createTextures(),this.internalState.postProcess=new nX(e,this.props),this.internalState.postProcess.setup(i)}updateState(i){super.updateState(i),this.internalState.postProcess.setProps(this.props)}renderLayers(){let i=super.renderLayers();return i?(i=Array.isArray(i)?i:[i],[...i,new uU]):null}_createTextures(){const{device:i}=this.context;this.internalState.renderBuffers=[0,1].map(s=>i.createFramebuffer({id:`layer-fbo-${s}`,colorAttachments:[i.createTexture(uwe)],depthStencilAttachment:"depth16unorm"}))}_resizeBuffers(i){const{shaderModuleProps:s}=i,{viewport:o}=this.context,{devicePixelRatio:c}=s.project,f=c*o.width,A=c*o.height;this.internalState.renderBuffers.forEach(v=>v.resize({width:f,height:A}))}enableRTT(i){this._resizeBuffers(i),this.internalState.originalRenderPass=this.context.renderPass;const[s]=this.internalState.renderBuffers;this.internalState.internalRenderPass=this.context.device.beginRenderPass({framebuffer:s,parameters:{viewport:[0,0,s.width,s.height]},clearColor:this.internalState.renderInProgress?!1:[0,0,0,0]}),this.internalState.renderInProgress=!0,this.context.renderPass=this.internalState.internalRenderPass}disableRTT(){this.internalState.internalRenderPass.end(),this.context.renderPass=this.internalState.originalRenderPass}applyPostProcess(){if(!this.internalState.renderInProgress)return;const[i,s]=this.internalState.renderBuffers,{framebuffer:o}=this.context.renderPass.props;this.internalState.postProcess.postRender({inputBuffer:i,swapBuffer:s,target:o}),this.internalState.renderInProgress=!1}_finalize(){this.internalState.renderBuffers.forEach(i=>{i.destroy()}),this.internalState.renderBuffers=null,this.internalState.postProcess.cleanup()}},t.layerName=`PostProcess${r.layerName}`,t}const fwe=`vec4 copy_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
5253  return color;
5254}
5255`,hwe={name:"copy",fs:fwe,getUniforms:()=>({}),passes:[{filter:!0}]},dwe={getQuadbin:{type:"accessor",value:r=>r.quadbin}};class OT extends df{indexToBounds(){const{data:e,extruded:t,getQuadbin:n}=this.props,i=t?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(s,o)=>tU(n(s,o),i),updateTriggers:{getPolygon:i}}}}OT.layerName="QuadbinLayer";OT.defaultProps=dwe;const pwe=r=>{const{data:e}=r;if(!e||!e.length)return null;const t=typeof e[0].id=="bigint";return new OT(r,{getQuadbin:t?n=>n.id:n=>Dxe(n.id)})},Awe={data:mh,tileSize:Yp};class iv extends Bs{getLoadOptions(){const e=this.props.data;return Zp(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${e.accessToken}`}},cartoSpatialTile:{scheme:"quadbin"}})}renderLayers(){const e=this.props.data;if(!e)return null;const{tiles:t,maxresolution:n}=e,i=this.getSubLayerClass("spatial-index-tile",nv);return new i(this.props,{id:`quadbin-tile-layer-${this.props.id}`,data:t,TilesetClass:CT,renderSubLayers:pwe,maxZoom:n,loadOptions:this.getLoadOptions()})}}iv.layerName="QuadbinTileLayer";iv.defaultProps=Awe;const gwe=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]],mwe={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function dU(r){const e=Number(xT(r));return Math.pow(4,e)}function _we(r){const e=new Uint8Array(r.length*4);let t=0;for(let n=0;n<r.length;n++){const i=r[n];e[t++]=i[0],e[t++]=i[1],e[t++]=i[2],e[t++]=Number.isFinite(i[3])?i[3]:255}return e}const ywe=`uniform densityUniforms {
5256  float factor;
5257} density;
5258`,vwe={name:"density",vs:ywe,uniformTypes:{factor:"f32"}};class pU extends fU(ff){getShaders(e){const t=super.getShaders(e);return t.inject={"vs:#main-end":`
5259      // Value from getWeight accessor
5260  float weight = elevations;
5261
5262  // Keep "power" delivered to screen constant when tiles update
5263  // by outputting normalized density
5264  weight *= density.factor;
5265
5266  // Pack float into 3 channels to pass to heatmap shader
5267  // SCALE value important, as we don't want to saturate
5268  // but also want enough definition to avoid banding
5269  const vec3 SHIFT = vec3(1.0, 256.0, 256.0 * 256.0);
5270  const float MAX_VAL = SHIFT.z * 255.0;
5271  const float SCALE = MAX_VAL / 8.0;
5272  weight *= SCALE;
5273  weight = clamp(weight, 0.0, MAX_VAL);
5274  vColor = vec4(mod(vec3(weight, floor(weight / SHIFT.yz)), 256.0), 255.0) / 255.0;
5275`},t.modules=[...t.modules,vwe],t}draw(e){const t=this.props.data[0],n=this.props.elevationScale,i={factor:dU(t.id)/n};for(const s of this.state.models)s.shaderInputs.setProps({density:i});super.draw(e)}}pU.layerName="RTTSolidPolygonLayer";const bwe=hU(iv,lwe),xwe={data:mh,getWeight:{type:"accessor",value:1},onMaxDensityChange:{type:"function",optional:!0,value:null},colorDomain:{type:"array",value:[0,1]},colorRange:gwe,intensity:{type:"number",value:1},radiusPixels:{type:"number",min:0,max:100,value:20}};class LT extends Bs{initializeState(){this.state={isLoaded:!1,tiles:new Set,viewportChanged:!1}}shouldUpdateState({changeFlags:e}){const{viewportChanged:t}=e;return this.setState({viewportChanged:t}),e.somethingChanged}updateState(e){const{props:t,oldProps:n}=e;super.updateState(e),t.colorRange!==n.colorRange&&this._updateColorTexture(e)}renderLayers(){const{data:e,getWeight:t,colorDomain:n,intensity:i,radiusPixels:s,_subLayerProps:o,updateTriggers:c,onMaxDensityChange:f,onViewportLoad:A,onTileLoad:v,onTileUnload:w,...S}=this.props,F={...o,cell:{...o?.cell,_subLayerProps:{...o?.cell?._subLayerProps,fill:{...o?.cell?._subLayerProps?.fill,type:pU}}}};let N=0,U=0;const $=[...this.state.tiles].filter(q=>q.content),G=$.filter(q=>q.isVisible),H=G.length?G:$;for(const q of H){const se=q.content[0],Te=dU(se.id);U=Math.max(q.userData.maxWeight*Te,U),N=Math.max(q.zoom,N)}const J=this.context.viewport.zoom-N;return U=U*Math.pow(2,J),typeof f=="function"&&f(U),new bwe(S,this.getSubLayerProps({id:"heatmap",data:e,getFillColor:0,getElevation:t,elevationScale:U,colorDomain:n,radiusPixels:s,intensity:i,_subLayerProps:F,refinementStrategy:"no-overlap",colorTexture:this.state.colorTexture,extruded:!1,stroked:!1,updateTriggers:{getElevation:c.getWeight},onViewportLoad:q=>{this.setState({isLoaded:!0}),typeof A=="function"&&A(q)},onTileLoad:q=>{let se=-1/0;if(typeof t!="function")se=t;else if(q.content)for(const Te of q.content)se=Math.max(t(Te,{}),se);q.userData={maxWeight:se},this.state.tiles.add(q),typeof v=="function"&&v(q)},onTileUnload:q=>{this.state.tiles.delete(q),typeof w=="function"&&w(q)},transitions:{elevationScale:{type:"spring",stiffness:.3,damping:.5}}}))}_updateColorTexture(e){const{colorRange:t}=e.props;let{colorTexture:n}=this.state;const i=_we(t);n&&n?.width===t.length?n.setTexture2DData({data:i}):(n?.destroy(),n=this.context.device.createTexture({...mwe,data:i,width:t.length,height:1})),this.setState({colorTexture:n})}}LT.layerName="HeatmapTileLayer";LT.defaultProps=xwe;const[ID,MD,PD,RD]=[0,1,2,3];class AU extends Jg{getShaders(){const e=super.getShaders();let t=e.vs;return t=t.replaceAll("textBackground.padding.","_padding."),t=t.replace("void main(void) {",`void main(void) {
5276  vec4 _padding = textBackground.padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);`),{...e,vs:t}}}AU.layerName="EnhancedTextBackgroundLayer";class gU extends Eh{filterSubLayer({layer:e,renderPass:t}){const n=e.id.includes("primary-background");return t==="collision"?n:!n}}gU.layerName="EnhancedTextLayer";const wwe={...Eh.defaultProps,getRadius:{type:"accessor",value:1},radiusScale:{type:"number",min:0,value:1}};class sv extends Bs{calculatePixelOffset(e){const{getTextAnchor:t,getAlignmentBaseline:n,getRadius:i,getSecondaryText:s,radiusScale:o,secondarySizeScale:c,sizeScale:f}=this.props,A=t==="middle"?0:t==="start"?1:-1,v=n==="center"?0:n==="bottom"?1:-1,w=f/4,S=f*(1+1/4),F=.6*(1-v)*f;let N=e?F:0;t==="middle"&&n==="top"&&s&&(N-=F,N-=c,N+=f);const U=1+1/4;return typeof i=="function"?($,G)=>{const H=(G?i($,G):1)*o*U;return[A*(H+w),v*(H+S)+N]}:[A*(i*o*U+w),v*(i*o*U+S)+N]}calculateBackgroundPadding(){const{getTextAnchor:e,getAlignmentBaseline:t,sizeScale:n}=this.props,i=12*n,s=3*n,o=[0,0,0,0];return t==="top"?o[MD]=s:t==="bottom"?o[RD]=s:(o[MD]=.5*s,o[RD]=.5*s),e==="start"?o[ID]=i:e==="end"?o[PD]=i:(o[ID]=.5*i,o[PD]=.5*i),o}renderTextLayer(e,{updateTriggers:t={},...n}){const{data:i,characterSet:s,fontFamily:o,fontSettings:c,fontWeight:f,outlineColor:A,outlineWidth:v,sizeScale:w,radiusScale:S,getAlignmentBaseline:F,getColor:N,getPosition:U,getTextAnchor:$,updateTriggers:G}=this.props;if(w<2){const H=this.parent?.props?.textSizeScale?"textSizeScale":"sizeScale";
5276Yr.warn(`${H} has small value (${w}). Note getTextSize is not supported on PointLabelLayer`)()}return new gU(this.getSubLayerProps({id:e,data:i,characterSet:s,fontFamily:o,fontSettings:c,fontWeight:f,outlineColor:A,outlineWidth:v,sizeScale:w,getAlignmentBaseline:F,getColor:N,getPosition:U,getTextAnchor:$,updateTriggers:{...G,...t,getPixelOffset:[G.getRadius,G.getTextAnchor,G.getAlignmentBaseline,S,w]}}),{getSize:1,_subLayerProps:{background:{type:AU}}},n)}renderLayers(){const{getText:e,getSecondaryColor:t,getSecondaryText:n,secondaryOutlineColor:i,secondarySizeScale:s,updateTriggers:o}=this.props,c=this.calculatePixelOffset(!1),f=this.calculateBackgroundPadding();return[this.renderTextLayer(`${o.getText}-primary`,{backgroundPadding:f,getText:e,getPixelOffset:c,background:!0}),!!n&&this.renderTextLayer(`${o.getSecondaryText}-secondary`,{getText:n,getPixelOffset:this.calculatePixelOffset(!0),getAlignmentBaseline:"top",...t&&{getColor:t},...s&&{sizeScale:s},...i&&{outlineColor:i}})]}}sv.layerName="PointLabelLayer";sv.defaultProps=wwe;const Cwe=`#version 300 es
5277#define SHADER_NAME raster-layer-vertex-shader
5278in vec3 positions;
5279in vec3 normals;
5280in float instanceElevations;
5281in vec4 instanceFillColors;
5282in vec4 instanceLineColors;
5283in vec3 instancePickingColors;
5284out vec4 vColor;
5285#ifdef FLAT_SHADING
5286out vec4 position_commonspace;
5287#endif
5288void main(void) {
5289vec2 tileOrigin = column.offset.xy;
5290float scale = column.widthScale;
5291int yIndex = - (gl_InstanceID / BLOCK_WIDTH);
5292int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH);
5293vec2 cellCenter = scale * vec2(float(xIndex) + 0.5, float(yIndex) - 0.5);
5294vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;
5295float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
5296float cellWidth = column.coverage * scale;
5297geometry.position = vec4(tileOrigin, 0.0, 1.0);
5298if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
5299geometry.position.xyz -= project.commonOrigin;
5300}
5301geometry.position.xy += cellCenter;
5302float elevation = 0.0;
5303float strokeOffsetRatio = 1.0;
5304if (column.extruded) {
5305elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;
5306} else if (column.stroked) {
5307float halfOffset = project_pixel_size(column.widthScale) / cellWidth;
5308if (column.isStroke) {
5309strokeOffsetRatio -= sign(positions.z) * halfOffset;
5310} else {
5311strokeOffsetRatio -= halfOffset;
5312}
5313}
5314geometry.pickingColor = instancePickingColors;
5315vec2 base = positions.xy * scale * strokeOffsetRatio * column.coverage * shouldRender;
5316vec3 cell = vec3(base, project_size(elevation));
5317DECKGL_FILTER_SIZE(cell, geometry);
5318geometry.position.xyz += cell;
5319gl_Position = project_common_position_to_clipspace(geometry.position);
5320geometry.normal = project_normal(normals);
5321DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
5322if (column.extruded && !column.isStroke) {
5323#ifdef FLAT_SHADING
5324position_commonspace = geometry.position;
5325vColor = vec4(color.rgb, color.a * layer.opacity);
5326#else
5327vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
5328vColor = vec4(lightColor, color.a * layer.opacity);
5329#endif
5330} else {
5331vColor = vec4(color.rgb, color.a * layer.opacity);
5332}
5333DECKGL_FILTER_COLOR(vColor, geometry);
5334}
5335`,Twe={...ml.defaultProps,extruded:!1,diskResolution:4,vertices:[[-.5,-.5],[.5,-.5],[.5,.5],[-.5,.5]]};class mU extends fU(ml){getShaders(){const e=super.getShaders(),t=this.props.data,n=t.data.blockSize??Math.sqrt(t.length);return{...e,defines:{...e.defines,BLOCK_WIDTH:n},vs:Cwe}}initializeState(){this.getAttributeManager().addInstanced({instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:[255,255,255,255]}})}}mU.layerName="RasterColumnLayer";function Ewe(r,e){return r.data===e.data&&r.length===e.length}class kT extends Bs{renderLayers(){const{data:e,getElevation:t,getFillColor:n,getLineColor:i,getLineWidth:s,tileIndex:o,updateTriggers:c}=this.props;if(!e||!o)return null;
5335const f=e.blockSize??0,[A,v,w]=eU(o),S=[A,v],F=w/f,N=this.getSubLayerClass("column",mU),{highlightedObjectIndex:U,highlightColor:$}=this.state;return new N(this.props,this.getSubLayerProps({id:"cell",updateTriggers:c,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(i),getLineWidth:this.getSubLayerAccessor(s)}),{data:{data:e,length:f*f},dataComparator:Ewe,offset:S,lineWidthScale:F,highlightedObjectIndex:U,highlightColor:$,parameters:{blendColorSrcFactor:"one",blendAlphaSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaDstFactor:"zero",blendColorOperation:"add",blendAlphaOperation:"add"}})}getSubLayerAccessor(e){return typeof e!="function"?super.getSubLayerAccessor(e):(t,n)=>{const{data:i,index:s}=n,o=i.data,c=Lxe(o.cells,s);return e({properties:c},n)}}getPickingInfo(e){const t=super.getPickingInfo(e);return t.index!==-1&&(t.object=this.getSubLayerAccessor(n=>n)(void 0,{data:this.props,index:t.index})),t}_updateAutoHighlight(e){const{highlightedObjectIndex:t}=this.state;let n=-1;if(e.index!==-1&&(n=e.index),t!==n){let{highlightColor:i}=this.props;typeof i=="function"&&(i=i(e)),this.setState({highlightColor:i,highlightedObjectIndex:n})}}}kT.layerName="RasterLayer";kT.defaultProps=Twe;const Bwe={uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:BigUint64Array,int8:
5335Int8Array,int16:Int16Array,int32:Int32Array,int64:BigInt64Array,float32:Float32Array,float64:Float64Array};class NT{static read(e,t){return e.readFields(NT._readField,{name:"",type:"",data:null},t)}static _readField(e,t,n){if(e===1)t.name=n.readString();else if(e===2)t.type=n.readString();else if(e===3){const i=Bwe[t.type];if(!i)throw Error(`Invalid data type: ${t.type}`);t.data={};const{compression:s}=Ox;tv(i,n,t.data,{compression:s})}}}let Ox=class _U{static read(e,t){return e.readFields(_U._readField,{blockSize:0,bands:[]},t)}static _readField(e,t,n){e===1?t.blockSize=n.readVarint():e===2&&t.bands.push(NT.read(n,n.readVarint()+n.pos))}};const yU="9.1.14",vU="cartoRasterTile",Swe={cartoRasterTile:{metadata:null,workerUrl:ev(vU,yU)}},Iwe={name:"CARTO Raster Tile",version:yU,id:vU,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-raster-tile"],category:"geometry",parse:async(r,e)=>FD(r,e),parseSync:FD,worker:!0,options:Swe};function FD(r,e){const t=e?.cartoRasterTile?.metadata;if(!r||!t)return null;Ox.compression=t.compression;const n=rv(r,Ox),{bands:i,blockSize:s}=n,o={};for(let c=0;c<i.length;c++){const{name:f,data:A}=i[c];o[f]=A}return{blockSize:s,cells:{numericProps:o,properties:[]}}}Ug([Iwe]);const Mwe=r=>{const e=r.tile?.index?.q;return e?new kT(r,{tileIndex:e}):null},Pwe={data:mh,refinementStrategy:"no-overlap",tileSize:Yp};class Rwe extends hU(ou,hwe){filterSubLayer(e){const{tile:t}=e.layer.props;return t?super.filterSubLayer(e):!0}}class UT extends Bs{getLoadOptions(){const e=this.props.data;return Zp(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${e.accessToken}`}}})}renderLayers(){const e=this.props.data;if(!e)return null;const{tiles:t,minzoom:n,maxzoom:i,raster_metadata:s}=e,o=this.getSubLayerClass("tile",Rwe),c=this.getLoadOptions();return new o(this.props,{id:`raster-tile-layer-${this.props.id}`,data:t,TilesetClass:CT,renderSubLayers:Mwe,minZoom:n,maxZoom:i,loadOptions:{...c,cartoRasterTile:{...c?.cartoRasterTile,metadata:s}}})}}UT.layerName="RasterTileLayer";UT.defaultProps=Pwe;class zT{static read(e,t){return e.readFields(zT._readField,{properties:[],numericProps:{}},t)}static _readField(e,t,n){if(e===1)t.properties.push(Ih.read(n,n.readVarint()+n.pos));else if(e===2){const i=Mh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}}}const bU="9.1.14",xU="cartoPropertiesTile",Fwe={cartoPropertiesTile:{workerUrl:ev(xU,bU)}},Dwe={name:"CARTO Properties Tile",version:bU,id:xU,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-properties-tile"],category:"geometry",worker:!0,parse:async(r,e)=>DD(r),parseSync:DD,options:Fwe};function DD(r,e){return r?rv(r,zT):null}const wU="9.1.14",CU="cartoVectorTile",Owe={cartoVectorTile:{workerUrl:ev(CU,wU)}},Lwe={name:"CARTO Vector Tile",version:wU,id:CU,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-vector-tile"],category:"geometry",parse:async(r,e)=>OD(r),parseSync:OD,worker:!0,options:Owe};function kwe(r,e,{startPosition:t,endPosition:n,indices:i}){const s=r.positions.size,o=t*s,c=n*s,f=r.positions.value.subarray(o,c),A=i.slice(1).map(w=>w-t),v=y6(f,A,s);for(let w=0,S=v.length;w<S;++w)e.push(t+v[w])}function Nwe(r){const{polygonIndices:e,primitivePolygonIndices:t}=r,n=[];let i=0;for(let s=0;s<e.value.length-1;s++){const o=e.value[s],c=e.value[s+1],f=t.value.indexOf(c),A=t.value.subarray(i,f);i=f,kwe(r,n,{startPosition:o,endPosition:c,indices:A})}r.triangles={value:new Uint32Array(n),size:1}}function OD(r,e){if(!r)return null;const t=rv(r,qxe);return t.polygons&&!t.polygons.triangles&&Nwe(t.polygons),t}function Uwe(r,e){const t=e?e in r.numericProps:!1,n=new Map;for(let v=0;v<r.pathIndices.value.length-1;v++){const w=r.pathIndices.value[v],S=r.featureIds.value[w];let F;e===void 0?F=S:t?F=r.numericProps[e].value[w]:r.properties[S]&&e in r.properties[S]?F=r.properties[S][e]:F=void 0;const N=Wwe(r,v);(!n.has(F)||N>n.get(F).length)&&n.set(F,{index:v,length:N})}const i=[],s=[],o=[],c=[],f=ZN(n.size,r.numericProps);let A=0;for(const[v,{index:w}]of n){const S=Jwe(r,w);i.push(...S);const F=r.pathIndices.value[w],N=r.featureIds.value[F];o.push(A),s.push(r.properties[N]),c.push(r.globalFeatureIds.value[F]),QN(r.numericProps,f,F,A),A++}return wT(i,o,c,f,s)}function zwe(r,e,t){const{west:n,south:i,east:s,north:o}=e,f=(s-n)*(o-i)*1e-4,A=[],v=[],w=[],S=[],F=ZN(r.polygonIndices.value.length-1,r.numericProps);let N=0,U=0;const{extruded:$}=t;for(let G=0;G<r.polygonIndices.value.length-1;G++){const H=r.polygonIndices.value[G],J=r.polygonIndices.value[G+1];if(Gwe(r,G)<f)continue;const ue=jwe(r,G);let q=-1,se=[0,0],Te=!1;for(;U<r.triangles.value.length;){const de=r.triangles.value[U];if(de>=J)break;if(Te){U+=3;continue}const me=r.triangles.value[U+1],pe=r.triangles.value[U+2],W=r.positions.value.subarray(de*r.positions.size,de*r.positions.size+r.positions.size),re=r.positions.value.subarray(me*r.positions.size,me*r.positions.size+r.positions.size),Ee=r.positions.value.subarray(pe*r.positions.size,pe*r.positions.size+r.positions.size);if(Hwe(ue,W,re,Ee))Te=!0;else{const et=TU(W,re,Ee);et>q&&(q=et,se=[(W[0]+re[0]+Ee[0])/3,(W[1]+re[1]+Ee[1])/3])}U+=3}const Ue=Te?ue:se;if(Vwe(Ue,e)){A.push(...Ue);const de=r.featureIds.value[H];if($){const me=t.getElevation(void 0,{data:r,index:de});A.push(me*t.elevationScale)}v.push(r.properties[de]),w.push(N),S.push(r.globalFeatureIds.value[H]),QN(r.numericProps,F,H,N),N++}}
5335return r.numericProps&&Object.keys(F).forEach(G=>{F[G].value=F[G].value.slice(0,N)}),wT(A,w,S,F,v,$?3:2)}function Gwe(r,e){const{positions:{value:t,size:n},polygonIndices:{value:i},triangles:{value:s}}=r,o=i[e],c=i[e+1];let f=0,A=0;for(;A<s.length&&!(s[A]>=o);)A+=3;for(;A<s.length;){const v=s[A];if(v>=c)break;const w=s[A+1],S=s[A+2],F=t.subarray(v*n,v*n+n),N=t.subarray(w*n,w*n+n),U=t.subarray(S*n,S*n+n);f+=TU(F,N,U),A+=3}return f}function Vwe([r,e],{west:t,east:n,south:i,north:s}){return r>=t&&r<n&&e>=i&&e<s}function Hwe(r,e,t,n){const i=Math.abs((t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1]))/2,s=Math.abs((e[0]-r[0])*(t[1]-r[1])-(t[0]-r[0])*(e[1]-r[1]))/2,o=Math.abs((t[0]-r[0])*(n[1]-r[1])-(n[0]-r[0])*(t[1]-r[1]))/2,c=Math.abs((n[0]-r[0])*(e[1]-r[1])-(e[0]-r[0])*(n[1]-r[1]))/2;return Math.abs(i-(s+o+c))<1e-10}function TU([r,e],[t,n],[i,s]){return Math.abs((r*(n-s)+t*(s-e)+i*(e-n))/2)}function jwe(r,e){const{positions:{value:t,size:n}}=r,i=n*r.polygonIndices.value[e],s=n*r.polygonIndices.value[e+1];let o=1/0,c=1/0,f=-1/0,A=-1/0;for(let v=i;v<s;v+=n){const[w,S]=t.subarray(v,v+2);o=Math.min(o,w),c=Math.min(c,S),f=Math.max(f,w),A=Math.max(A,S)}return[(o+f)/2,(c+A)/2]}function $we(r,e){const{positions:{value:t}}=r,[n,i,s,o]=t.subarray(e,e+4);return Math.sqrt(Math.pow(s-n,2)+Math.pow(o-i,2))}function Wwe(r,e){const{positions:{size:t}}=r,n=t*r.pathIndices.value[e],i=t*r.pathIndices.value[e+1];let s=0;for(let o=n;o<i;o+=t)s+=$we(r,o);return s}function Jwe(r,e){const{positions:{value:t},pathIndices:{value:n}}=r,i=n[e]*2,o=(n[e+1]*2-i)/2;if(o===2){const[f,A,v,w]=t.subarray(i,i+4);return[(f+v)/2,(A+w)/2]}const c=i+Math.floor(o/2)*2;return[t[c],t[c+1]]}Ug([Dwe,Lwe]);const Xwe={...Xp.defaultProps,autoLabels:!1,data:mh,dataComparator:mh.equal,tileSize:Yp};class GT extends Xp{constructor(...e){super(...e)}initializeState(){super.initializeState(),this.setState({binary:!0})}updateState(e){const{props:t}=e;if(t.data){super.updateState(e);const i=new URL(t.data.tiles[0]).searchParams.get("formatTiles")==="mvt";this.setState({mvt:i})}}getLoadOptions(){const e=this.props.data;return Zp(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${e.accessToken}`}},gis:{format:"binary"}})}async getTileData(e){const t=this.props.data,{tiles:n,properties_tiles:i}=t,s=ph(n,e);if(!s)return Promise.reject("Invalid URL");const o=this.getLoadOptions(),{fetch:c}=this.props,{signal:f}=e,A=c(s,{propName:"data",layer:this,loadOptions:o,signal:f});if(!i)return await A;const v=ph(i,e);if(!v)return Promise.reject("Invalid properties URL");const w=c(v,{propName:"data",layer:this,loadOptions:o,signal:f}),[S,F]=await Promise.all([A,w]);return S?F?ewe(S,F):S:null}renderSubLayers(e){if(e.data===null)return null;const t=e.tile.bbox,n=[],i={"points-text":{type:sv,...e?._subLayerProps?.["points-text"],extensions:[new hT,...e.extensions||[],...e?._subLayerProps?.["points-text"]?.extensions||[]]}};if(this.state.mvt)n.push(super.renderSubLayers(e));else{const{west:s,south:o,east:c,north:f}=t,A=[new Ky,...e.extensions||[]],v={clipBounds:[s,o,c,f]},w=F=>({[F]:{...v,...e?._subLayerProps?.[F],extensions:[...A,...e?._subLayerProps?.[F]?.extensions||[]]}}),S={...e,data:{...e.data,tileBbox:t},autoHighlight:!1,_subLayerProps:{...e._subLayerProps,...i,...w("polygons-fill"),...w("polygons-stroke"),...w("linestrings")}};n.push(new iu(S))}if(n[0]&&e.autoLabels){const s=YN();e.data.lines&&e.data.lines.positions.value.length>0&&(s.points=Uwe(e.data.lines,typeof e.autoLabels=="object"?e.autoLabels.uniqueIdProperty:void 0)),e.data.polygons&&e.data.polygons.positions.value.length>0&&(s.points=zwe(e.data.polygons,t,e)),n.push(n[0].clone({id:`${e.id}-labels`,data:s,pickable:!1,autoHighlight:!1}))}return n}renderLayers(){const e=super.renderLayers();if(!this.props.autoLabels)return e;const t=e.flat().filter(Boolean);return t.sort((n,i)=>{const s=n.id.includes("labels"),o=i.id.includes("labels");return s&&!o?1:!s&&o?-1:0}),t.map(n=>n.id.includes("labels")?n.clone({highlightedObjectIndex:-1}):n)}_isWGS84(){return this.state.mvt?super._isWGS84():!0}}GT.layerName="VectorTileLayer";GT.defaultProps=Xwe;var Pn
vendor: 1,823 bytes, line 5335
5335={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]}
vendor: 16,436 bytes, line 5335
5335,PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},
5335Kwe={2:["#ffc6c4","#672044"],3:["#ffc6c4","#cc607d","#672044"],4:["#ffc6c4","#e38191","#ad466c","#672044"],5:["#ffc6c4","#ee919b","#cc607d","#9e3963","#672044"],6:["#ffc6c4","#f29ca3","#da7489","#b95073","#93345d","#672044"],7:["#ffc6c4","#f4a3a8","#e38191","#cc607d","#ad466c","#8b3058","#672044"],tags:["quantitative"]},qwe={2:["#fbe6c5","#70284a"],3:["#fbe6c5","#dc7176","#70284a"],4:["#fbe6c5","#ee8a82","#c8586c","#70284a"],5:["#fbe6c5","#f2a28a","#dc7176","#b24b65","#70284a"],6:["#fbe6c5","#f4b191","#e7807d","#d06270","#a44360","#70284a"],7:["#fbe6c5","#f5ba98","#ee8a82","#dc7176","#c8586c","#9c3f5d","#70284a"],tags:["quantitative"]},Ywe={2:["#f6d2a9","#b13f64"],3:["#f6d2a9","#ea8171","#b13f64"],4:["#f6d2a9","#f19c7c","#dd686c","#b13f64"],5:["#f6d2a9","#f3aa84","#ea8171","#d55d6a","#b13f64"],6:["#f6d2a9","#f4b28a","#ef9177","#e3726d","#cf5669","#b13f64"],7:["#f6d2a9","#f5b78e","#f19c7c","#ea8171","#dd686c","#ca5268","#b13f64"],tags:["quantitative"]},Zwe={2:["#ecda9a","#ee4d5a"],3:["#ecda9a","#f7945d","#ee4d5a"],4:["#ecda9a","#f3ad6a","#f97b57","#ee4d5a"],5:["#ecda9a","#f1b973","#f7945d","#f86f56","#ee4d5a"],6:["#ecda9a","#f0c079","#f5a363","#f98558","#f76856","#ee4d5a"],7:["#ecda9a","#efc47e","#f3ad6a","#f7945d","#f97b57","#f66356","#ee4d5a"],tags:["quantitative"]},Qwe={2:["#fde0c5","#eb4a40"],3:["#fde0c5","#f59e72","#eb4a40"],4:["#fde0c5","#f8b58b","#f2855d","#eb4a40"],5:["#fde0c5","#f9c098","#f59e72","#f17854","#eb4a40"],6:["#fde0c5","#fac7a1","#f7ac80","#f38f65","#f0704f","#eb4a40"],7:["#fde0c5","#facba6","#f8b58b","#f59e72","#f2855d","#ef6a4c","#eb4a40"],tags:["quantitative"]},eCe={2:["#fef6b5","#e15383"],3:["#fef6b5","#ffa679","#e15383"],4:["#fef6b5","#ffc285","#fa8a76","#e15383"],5:["#fef6b5","#ffd08e","#ffa679","#f67b77","#e15383"],6:["#fef6b5","#ffd795","#ffb77f","#fd9576","#f37378","#e15383"],7:["#fef6b5","#ffdd9a","#ffc285","#ffa679","#fa8a76","#f16d7a","#e15383"],tags:["quantitative"]},tCe={2:["#e4f1e1","#0d585f"],3:["#e4f1e1","#63a6a0","#0d585f"],4:["#e4f1e1","#89c0b6","#448c8a","#0d585f"],5:["#E4F1E1","#9CCDC1","#63A6A0","#337F7F","#0D585F"],6:["#e4f1e1","#abd4c7","#7ab5ad","#509693","#2c7778","#0d585f"],7:["#e4f1e1","#b4d9cc","#89c0b6","#63a6a0","#448c8a","#287274","#0d585f"],tags:["quantitative"]},rCe={2:["#c4e6c3","#1d4f60"],3:["#c4e6c3","#4da284","#1d4f60"],4:["#c4e6c3","#6dbc90","#36877a","#1d4f60"],5:["#c4e6c3","#80c799","#4da284","#2d7974","#1d4f60"],6:["#c4e6c3","#8dce9f","#5fb28b","#3e927e","#297071","#1d4f60"],7:["#c4e6c3","#96d2a4","#6dbc90","#4da284","#36877a","#266b6e","#1d4f60"],tags:["quantitative"]},nCe={2:["#d2fbd4","#123f5a"],3:["#d2fbd4","#559c9e","#123f5a"],4:["#d2fbd4","#7bbcb0","#3a7c89","#123f5a"],5:["#d2fbd4","#8eccb9","#559c9e","#2b6c7f","#123f5a"],6:["#d2fbd4","#9cd5be","#6cafa9","#458892","#266377","#123f5a"],7:["#d2fbd4","#a5dbc2","#7bbcb0","#559c9e","#3a7c89","#235d72","#123f5a"],tags:["quantitative"]},iCe={2:["#d3f2a3","#074050"],3:["#d3f2a3","#4c9b82","#074050"],4:["#d3f2a3","#6cc08b","#217a79","#074050"],5:["#d3f2a3","#82d091","#4c9b82","#19696f","#074050"],6:["#d3f2a3","#8fda94","#60b187","#35877d","#145f69","#074050"],7:["#d3f2a3","#97e196","#6cc08b","#4c9b82","#217a79","#105965","#074050"],tags:["quantitative"]},sCe={2:["#245668","#EDEF5D"],3:["#245668","#39AB7E","#EDEF5D"],4:["#245668","#0D8F81","#6EC574","#EDEF5D"],5:["#245668","#04817E","#39AB7E","#8BD16D","#EDEF5D"],6:["#245668","#09787C","#1D9A81","#58BB79","#9DD869","#EDEF5D"],7:["#245668","#0F7279","#0D8F81","#39AB7E","#6EC574","#A9DC67","#EDEF5D"],tags:["aggregation"]},oCe={2:["#f7feae","#045275"],3:["#f7feae","#46aea0","#045275"],4:["#f7feae","#7ccba2","#089099","#045275"],5:["#f7feae","#9bd8a4","#46aea0","#058092","#045275"],6:["#f7feae","#ace1a4","#68bfa1","#2a9c9c","#02778e","#045275"],7:["#f7feae","#b7e6a5","#7ccba2","#46aea0","#089099","#00718b","#045275"],tags:["quantitative"]},aCe={2:["#d1eeea","#2a5674"],3:["#d1eeea","#68abb8","#2a5674"],4:["#d1eeea","#85c4c9","#4f90a6","#2a5674"],5:["#d1eeea","#96d0d1","#68abb8","#45829b","#2a5674"],6:["#d1eeea","#a1d7d6","#79bbc3","#599bae","#3f7994","#2a5674"],7:["#d1eeea","#a8dbd9","#85c4c9","#68abb8","#4f90a6","#3b738f","#2a5674"],tags:["quantitative"]},cCe={2:["#b0f2bc","#257d98"],3:["#b0f2bc","#4cc8a3","#257d98"],4:["#b0f2bc","#67dba5","#38b2a3","#257d98"],5:["#b0f2bc","#77e2a8","#4cc8a3","#31a6a2","#257d98"],6:["#b0f2bc","#82e6aa","#5bd4a4","#3fbba3","#2e9ea1","#257d98"],7:["#b0f2bc","#89e8ac","#67dba5","#4cc8a3","#38b2a3","#2c98a0","#257d98"],tags:["quantitative"]},lCe={2:["#f3e0f7","#63589f"],3:["#f3e0f7","#b998dd","#63589f"],4:["#f3e0f7","#d1afe8","#9f82ce","#63589f"],5:["#f3e0f7","#dbbaed","#b998dd","#9178c4","#63589f"],6:["#f3e0f7","#e0c2ef","#c8a5e4","#aa8bd4","#8871be","#63589f"],7:["#f3e0f7","#e4c7f1","#d1afe8","#b998dd","#9f82ce","#826dba","#63589f"],tags:["quantitative"]},uCe={2:["#f9ddda","#573b88"],3:["#f9ddda","#ce78b3","#573b88"],4:["#f9ddda","#e597b9","#ad5fad","#573b88"],5:["#f9ddda","#eda8bd","#ce78b3","#9955a8","#573b88"],6:["#f9ddda","#f0b2c1","#dd8ab6","#bb69b0","#8c4fa4","#573b88"],7:["#f9ddda","#f2b9c4","#e597b9","#ce78b3","#ad5fad","#834ba0","#573b88"],tags:["quantitative"]},fCe={2:["#f3e79b","#5c53a5"],3:["#f3e79b","#eb7f86","#5c53a5"],4:["#f3e79b","#f8a07e","#ce6693","#5c53a5"],5:["#f3e79b","#fab27f","#eb7f86","#b95e9a","#5c53a5"],6:["#f3e79b","#fabc82","#f59280","#dc6f8e","#ab5b9e","#5c53a5"],7:["#f3e79b","#fac484","#f8a07e","#eb7f86","#ce6693","#a059a0","#5c53a5"],tags:["quantitative"]},hCe={2:["#f3cbd3","#6c2167"],3:["#f3cbd3","#ca699d","#6c2167"],4:["#f3cbd3","#dd88ac","#b14d8e","#6c2167"],5:["#f3cbd3","#e498b4","#ca699d","#a24186","#6c2167"],6:["#f3cbd3","#e7a2b9","#d67ba5","#bc5894","#983a81","#6c2167"],7:["#f3cbd3","#eaa9bd","#dd88ac","#ca699d","#b14d8e","#91357d","#6c2167"],tags:["quantitative"]},dCe={2:["#fcde9c","#7c1d6f"],3:["#fcde9c","#e34f6f","#7c1d6f"],4:["#fcde9c","#f0746e","#dc3977","#7c1d6f"],5:["#fcde9c","#f58670","#e34f6f","#d72d7c","#7c1d6f"],6:["#fcde9c","#f89872","#ec666d","#df4273","#c5287b","#7c1d6f"],7:["#fcde9c","#faa476","#f0746e","#e34f6f","#dc3977","#b9257a","#7c1d6f"],tags:["quantitative"]},pCe={2:["#4b2991","#edd9a3"],3:["#4b2991","#ea4f88","#edd9a3"],4:["#4b2991","#c0369d","#fa7876","#edd9a3"],5:["#4b2991","#a52fa2","#ea4f88","#fa9074","#edd9a3"],6:["#4b2991","#932da3","#d43f96","#f7667c","#f89f77","#edd9a3"],7:["#4b2991","#872ca2","#c0369d","#ea4f88","#fa7876","#f6a97a","#edd9a3"],tags:["aggregation"]},ACe={2:["#ede5cf","#541f3f"],3:["#ede5cf","#c1766f","#541f3f"],4:["#ede5cf","#d39c83","#a65461","#541f3f"],5:["#ede5cf","#daaf91","#c1766f","#95455a","#541f3f"],6:["#ede5cf","#ddba9b","#cd8c7a","#b26166","#8a3c56","#541f3f"],7:["#ede5cf","#e0c2a2","#d39c83","#c1766f","#a65461","#813753","#541f3f"],tags:["quantitative"]},gCe={2:["#929b4f","#db8195"],3:["#a3ad62","#fdfbe4","#df91a3"],4:["#929b4f","#d9dbaf","#f3d1ca","#db8195"],5:["#879043","#c1c68c","#fdfbe4","#ebb4b8","#d8758b"],6:["#7f883b","#b0b874","#e3e4be","#f6ddd1","#e4a0ac","#d66d85"],7:["#798234","#a3ad62","#d0d3a2","#fdfbe4","#f0c6c3","#df91a3","#d46780"],tags:["diverging"]},mCe={2:["#3d5941","#ca562c"],3:["#3d5941","#f6edbd","#ca562c"],4:["#3d5941","#b5b991","#edbb8a","#ca562c"],5:["#3d5941","#96a07c","#f6edbd","#e6a272","#ca562c"],6:["#3d5941","#839170","#cecea2","#f1cf9e","#e19464","#ca562c"],7:["#3d5941","#778868","#b5b991","#f6edbd","#edbb8a","#de8a5a","#ca562c"],tags:["diverging"]},_Ce={2:["#008080","#ca562c"],3:["#008080","#f6edbd","#ca562c"],4:["#008080","#b4c8a8","#edbb8a","#ca562c"],5:["#008080","#92b69e","#f6edbd","#e6a272","#ca562c"],6:["#008080","#7eab98","#ced7b1","#f1cf9e","#e19464","#ca562c"],7:["#008080","#70a494","#b4c8a8","#f6edbd","#edbb8a","#de8a5a","#ca562c"],tags:["diverging"]},yCe={2:["#009392","#cf597e"],3:["#009392","#e9e29c","#cf597e"],4:["#009392","#9ccb86","#eeb479","#cf597e"],5:["#009392","#71be83","#e9e29c","#ed9c72","#cf597e"],6:["#009392","#52b684","#bcd48c","#edc783","#eb8d71","#cf597e"],7:["#009392","#39b185","#9ccb86","#e9e29c","#eeb479","#e88471","#cf597e"],tags:["diverging"]},vCe={2:["#009392","#d0587e"],3:["#009392","#f1eac8","#d0587e"],4:["#009392","#91b8aa","#f1eac8","#dfa0a0","#d0587e"],5:["#009392","#91b8aa","#f1eac8","#dfa0a0","#d0587e"],6:["#009392","#72aaa1","#b1c7b3","#e5b9ad","#d98994","#d0587e"],7:["#009392","#72aaa1","#b1c7b3","#f1eac8","#e5b9ad","#d98994","#d0587e"],tags:["diverging"]},bCe={2:["#009B9E","#C75DAB"],3:["#009B9E","#F1F1F1","#C75DAB"],4:["#009B9E","#A7D3D4","#E4C1D9","#C75DAB"],5:["#009B9E","#7CC5C6","#F1F1F1","#DDA9CD","#C75DAB"],6:["#009B9E","#5DBCBE","#C6DFDF","#E9D4E2","#D99BC6","#C75DAB"],7:["#009B9E","#42B7B9","#A7D3D4","#F1F1F1","#E4C1D9","#D691C1","#C75DAB"],tags:["diverging"]},xCe={2:["#A16928","#2887a1"],3:["#A16928","#edeac2","#2887a1"],4:["#A16928","#d6bd8d","#b5c8b8","#2887a1"],5:["#A16928","#caa873","#edeac2","#98b7b2","#2887a1"],
53356:["#A16928","#c29b64","#e0cfa2","#cbd5bc","#85adaf","#2887a1"],7:["#A16928","#bd925a","#d6bd8d","#edeac2","#b5c8b8","#79a7ac","#2887a1"],tags:["diverging"]},wCe={2:["#855C75","#D9AF6B","#7C7C7C"],3:["#855C75","#D9AF6B","#AF6458","#7C7C7C"],4:["#855C75","#D9AF6B","#AF6458","#736F4C","#7C7C7C"],5:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#7C7C7C"],6:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#7C7C7C"],7:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#7C7C7C"],8:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#7C7C7C"],9:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#7C7C7C"],10:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#7C7C7C"],11:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#467378","#7C7C7C"],tags:["qualitative"]},CCe={2:["#7F3C8D","#11A579","#A5AA99"],3:["#7F3C8D","#11A579","#3969AC","#A5AA99"],4:["#7F3C8D","#11A579","#3969AC","#F2B701","#A5AA99"],5:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#A5AA99"],6:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#A5AA99"],7:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#A5AA99"],8:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#A5AA99"],9:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#A5AA99"],10:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#f97b72","#A5AA99"],11:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#f97b72","#4b4b8f","#A5AA99"],tags:["qualitative"]},TCe={2:["#66C5CC","#F6CF71","#B3B3B3"],3:["#66C5CC","#F6CF71","#F89C74","#B3B3B3"],4:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#B3B3B3"],5:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#B3B3B3"],6:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#B3B3B3"],7:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#B3B3B3"],8:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#B3B3B3"],9:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B3B3B3"],10:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#B3B3B3"],11:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#D3B484","#B3B3B3"],tags:["qualitative"]},ECe={2:["#5F4690","#1D6996","#666666"],3:["#5F4690","#1D6996","#38A6A5","#666666"],4:["#5F4690","#1D6996","#38A6A5","#0F8554","#666666"],5:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#666666"],6:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#666666"],7:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#666666"],8:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#666666"],9:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#666666"],10:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#666666"],11:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#994E95","#666666"],tags:["qualitative"]},BCe={2:["#88CCEE","#CC6677","#888888"],3:["#88CCEE","#CC6677","#DDCC77","#888888"],4:["#88CCEE","#CC6677","#DDCC77","#117733","#888888"],5:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#888888"],6:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#888888"],7:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#888888"],8:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#888888"],9:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#888888"],10:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#661100","#888888"],11:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#661100","#6699CC","#888888"],tags:["qualitative","colorblind"]}
5335,SCe={2:["#E58606","#5D69B1","#A5AA99"],3:["#E58606","#5D69B1","#52BCA3","#A5AA99"],4:["#E58606","#5D69B1","#52BCA3","#99C945","#A5AA99"],5:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#A5AA99"],6:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#A5AA99"],7:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#A5AA99"],8:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#A5AA99"],9:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#A5AA99"],10:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#ED645A","#A5AA99"],11:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#ED645A","#CC3A8E","#A5AA99"],tags:["qualitative"]},ICe={...Pn.BuGn,tags:["quantitative"]},MCe={...Pn.BuPu,tags:["quantitative"]},PCe={...Pn.GnBu,tags:["quantitative"]},RCe={...Pn.OrRd,tags:["quantitative"]},FCe={...Pn.PuBu,tags:["quantitative"]},DCe={...Pn.PuBuGn,tags:["quantitative"]},OCe={...Pn.PuRd,tags:["quantitative"]},LCe={...Pn.RdPu,tags:["quantitative"]},kCe={...Pn.YlGn,tags:["quantitative"]},NCe={...Pn.YlGnBu,tags:["quantitative"]},UCe={...Pn.YlOrBr,tags:["quantitative"]},zCe={...Pn.YlOrRd,tags:["quantitative"]},GCe={...Pn.Accent,tags:["qualitative"]},VCe={...Pn.Dark2,tags:["qualitative"]},HCe={...Pn.Paired,tags:["qualitative"]},jCe={...Pn.Pastel1,tags:["qualitative"]},$Ce={...Pn.Pastel2,tags:["qualitative"]},WCe={...Pn.Set1,tags:["qualitative"]},JCe={...Pn.Set2,tags:["qualitative"]},XCe={...Pn.Set3,tags:["qualitative"]},KCe={...Pn.Blues,tags:["quantitative"]},qCe={...Pn.Greens,tags:["quantitative"]},YCe={...Pn.Greys,tags:["quantitative"]},ZCe={...Pn.Oranges,tags:["quantitative"]},QCe={...Pn.Purples,tags:["quantitative"]},eTe={...Pn.Reds,tags:["quantitative"]},tTe={...Pn.BrBG,tags:["diverging"]},rTe={...Pn.PiYG,tags:["diverging"]},nTe={...Pn.PRGn,tags:["diverging"]},iTe={...Pn.PuOr,tags:["diverging"]},sTe={...Pn.RdBu,tags:["diverging"]},oTe={...Pn.RdGy,tags:["diverging"]},aTe={...Pn.RdYlBu,tags:["diverging"]},cTe={...Pn.RdYlGn,tags:["diverging"]},lTe={...Pn.Spectral,tags:["diverging"]};const uTe=Object.freeze(Object.defineProperty({__proto__:null,Antique:wCe,ArmyRose:gCe,BluGrn:rCe,BluYl:oCe,Bold:CCe,BrwnYl:ACe,Burg:Kwe,BurgYl:qwe,DarkMint:nCe,Earth:xCe,Emrld:iCe,Fall:mCe,Geyser:_Ce,Magenta:hCe,Mint:tCe,OrYel:Zwe,Pastel:TCe,Peach:Qwe,PinkYl:eCe,Prism:ECe,Purp:lCe,PurpOr:uCe,RedOr:Ywe,Safe:BCe,Sunset:fCe,SunsetDark:dCe,Teal:aCe,TealGrn:cCe,TealRose:vCe,Temps:yCe,Tropic:bCe,Vivid:SCe,ag_GrnYl:sCe,ag_Sunset:pCe,cb_Accent:GCe,cb_Blues:KCe,cb_BrBG:tTe,cb_BuGn:ICe,cb_BuPu:MCe,cb_Dark2:VCe,cb_GnBu:PCe,cb_Greens:qCe,cb_Greys:YCe,cb_OrRd:RCe,cb_Oranges:ZCe,cb_PRGn:nTe,cb_Paired:HCe,cb_Pastel1:jCe,cb_Pastel2:$Ce,cb_PiYG:rTe,cb_PuBu:FCe,cb_PuBuGn:DCe,cb_PuOr:iTe,cb_PuRd:OCe,cb_Purples:QCe,cb_RdBu:sTe,cb_RdGy:oTe,cb_RdPu:LCe,cb_RdYlBu:aTe,cb_RdYlGn:cTe,cb_Reds:eTe,cb_Set1:WCe,cb_Set2:JCe,cb_Set3:XCe,cb_Spectral:lTe,cb_YlGn:kCe,cb_YlGnBu:NCe,cb_YlOrBr:UCe,cb_YlOrRd:zCe},Symbol.toStringTag,{value:"Module"})),VT="PurpOr",HT=[204,204,204],fTe=[119,119,119];function jT(r,e){const t=uTe[r];let n=e;gh(t,`Palette "${r}" not found. Expected a CARTOColors string`);const i=Object.keys(t).filter(f=>f!=="tags").map(Number),s=Math.max(...i),o=Math.min(...i);!Number.isInteger(e)||e>s?n=s:e<o&&(n=o);let c=t[n];return t.tags&&t.tags.includes("qualitative")&&(c=c.slice(0,-1)),c.map(f=>hTe(f))}function hTe(r){let e=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(r);return e?[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),255]:(e=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(r),e?[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),parseInt(e[4]+e[4],16)]:(e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r),e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16),255]:(e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r),gh(e,`Hexadecimal color "${r}" was not parsed correctly`),[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16),parseInt(e[4],16)])))}const dTe=Object.freeze(["function","string"]);function $T(r,e,t){return gh(typeof e=="object",'Expected "data" to be an object'),gh(dTe.includes(typeof r),'Expected "attr" to be a function or string'),typeof r=="function"?r(e,t):e?.properties?.[r]}function pTe({attr:r,domain:e,colors:t=VT,nullColor:n=HT}){gh(Array.isArray(e),'Expected "domain" to be an array of numbers');const i=typeof t=="string"?jT(t,e.length+1):t,s=v5().domain(e).range(i);return(o,c)=>{const f=$T(r,o,c);return typeof f=="number"&&Number.isFinite(f)?s(f):n}}function ATe({attr:r,domain:e,colors:t=VT,nullColor:n=HT,othersColor:i=fTe}){gh(Array.isArray(e),'Expected "domain" to be an array of numbers or strings');const s={},o=typeof t=="string"?jT(t,e.length):t;for(const[c,f]of e.entries())s[f]=o[c];return(c,f)=>{const A=$T(r,c,f);return typeof A=="number"&&Number.isFinite(A)||typeof A=="string"?s[A]||i:n}}function gTe({attr:r,domain:e,colors:t=VT,nullColor:n=HT}){gh(Array.isArray(e),'Expected "domain" to be an array of numbers');const i=typeof t=="string"?jT(t,e.length):t,s=b5().domain(e).range(i);return(o,c)=>{const f=$T(r,o,c);return typeof f=="number"&&Number.isFinite(f)?s(f):n}}const mTe={ClusterTileLayer:FT,H3TileLayer:DT,HeatmapTileLayer:LT,PointLabelLayer:sv,QuadbinTileLayer:iv,RasterTileLayer:UT,VectorTileLayer:GT};function Lx(r,e=""){if(!r)throw new Error(`JSON conversion error ${e}`)}function _Te(r,e){const t=vTe(e);let n=r;for(const i of t)n=yTe(n)?n[i]:void 0;return n}function yTe(r){return r!==null&&typeof r=="object"}const LD={};function vTe(r){if(typeof r=="string"){let e=LD[r];return e||(e=r.split("."),LD[r]=e),e}return Array.isArray(r)?r:[r]}var F0={exports:{}},kD;function bTe(){return kD||(kD=1,function(r,e){(function(t){var n="Compound",i="Identifier",s="MemberExpression",o="Literal",c="ThisExpression",f="CallExpression",A="UnaryExpression",v="BinaryExpression",w="LogicalExpression",S="ConditionalExpression",F="ArrayExpression",N=46,U=44,$=39,G=34,H=40,J=41,ue=91,q=93,se=63,Te=59,Ue=58,de=function(St,st){var dr=new Error(St+" at character "+st);throw dr.index=st,dr.description=St,dr},me=!0,pe={"-":me,"!":me,"~":me,"+":me},W={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},re=function(St){var st=0,dr;for(var er in St)(dr=er.length)>st&&St.hasOwnProperty(er)&&(st=dr);return st},Ee=re(pe),et=re(W),_e={true:!0,false:!1,null:null},Le="this",Ge=function(St){return W[St]||0},Ze=function(St,st,dr){var er=St==="||"||St==="&&"?w:v;return{type:er,operator:St,left:st,right:dr}},tt=function(St){return St>=48&&St<=57},rt=function(St){return St===36||St===95||St>=65&&St<=90||St>=97&&St<=122||St>=128&&!W[String.fromCharCode(St)]},ut=function(St){return St===36||St===95||St>=65&&St<=90||St>=97&&St<=122||St>=48&&St<=57||St>=128&&!W[String.fromCharCode(St)]},vt=function(St){for(var st=0,dr=St.charAt,er=St.charCodeAt,Kt=function(Vt){return dr.call(St,Vt)},Nt=function(Vt){return er.call(St,Vt)},Ar=St.length,ln=function(){for(var Vt=Nt(st);Vt===32||Vt===9||Vt===10||Vt===13;)Vt=Nt(++st)},Pr=function(){var Vt=Vn(),mr,Rr;if(ln(),Nt(st)===se){if(st++,mr=Pr(),mr||de("Expected expression",st),ln(),Nt(st)===Ue)return st++,Rr=Pr(),Rr||de("Expected expression",st),{type:S,test:Vt,consequent:mr,alternate:Rr};de("Expected :",st)}else return Vt},xr=function(){ln();for(var Vt=St.substr(st,et),mr=Vt.length;mr>0;){if(W.hasOwnProperty(Vt)&&(!rt(Nt(st))||st+Vt.length<St.length&&!ut(Nt(st+Vt.length))))return st+=mr,Vt;Vt=Vt.substr(0,--mr)}return!1},Vn=function(){var Vt,mr,Rr,nn,_i,Me,kt,$t,lr;if(Me=_r(),mr=xr(),!mr)return Me;for(_i={value:mr,prec:Ge(mr)},kt=_r(),kt||de("Expected expression after "+mr,st),nn=[Me,_i,kt];
5335(mr=xr())&&(Rr=Ge(mr),Rr!==0);){for(_i={value:mr,prec:Rr},lr=mr;nn.length>2&&Rr<=nn[nn.length-2].prec;)kt=nn.pop(),mr=nn.pop().value,Me=nn.pop(),Vt=Ze(mr,Me,kt),nn.push(Vt);Vt=_r(),Vt||de("Expected expression after "+lr,st),nn.push(_i,Vt)}for($t=nn.length-1,Vt=nn[$t];$t>1;)Vt=Ze(nn[$t-1].value,nn[$t-2],Vt),$t-=2;return Vt},_r=function(){var Vt,mr,Rr;if(ln(),Vt=Nt(st),tt(Vt)||Vt===N)return yr();if(Vt===$||Vt===G)return un();if(Vt===ue)return ti();for(mr=St.substr(st,Ee),Rr=mr.length;Rr>0;){if(pe.hasOwnProperty(mr)&&(!rt(Nt(st))||st+mr.length<St.length&&!ut(Nt(st+mr.length))))return st+=Rr,{type:A,operator:mr,argument:_r(),prefix:!0};mr=mr.substr(0,--Rr)}return rt(Vt)||Vt===H?Yn():!1},yr=function(){for(var Vt="",mr,Rr;tt(Nt(st));)Vt+=Kt(st++);if(Nt(st)===N)for(Vt+=Kt(st++);tt(Nt(st));)Vt+=Kt(st++);if(mr=Kt(st),mr==="e"||mr==="E"){for(Vt+=Kt(st++),mr=Kt(st),(mr==="+"||mr==="-")&&(Vt+=Kt(st++));tt(Nt(st));)Vt+=Kt(st++);tt(Nt(st-1))||de("Expected exponent ("+Vt+Kt(st)+")",st)}return Rr=Nt(st),rt(Rr)?de("Variable names cannot start with a number ("+Vt+Kt(st)+")",st):Rr===N&&de("Unexpected period",st),{type:o,value:parseFloat(Vt),raw:Vt}},un=function(){for(var Vt="",mr=Kt(st++),Rr=!1,nn;st<Ar;)if(nn=Kt(st++),nn===mr){Rr=!0;break}else if(nn==="\\")switch(nn=Kt(st++),nn){case"n":Vt+=`
5336`;break;case"r":Vt+="\r";break;case"t":Vt+="	";break;case"b":Vt+="\b";break;case"f":Vt+="\f";break;case"v":Vt+="\v";break;default:Vt+=nn}else Vt+=nn;return Rr||de('Unclosed quote after "'+Vt+'"',st),{type:o,value:Vt,raw:mr+Vt+mr}},Dr=function(){var Vt=Nt(st),mr=st,Rr;for(rt(Vt)?st++:de("Unexpected "+Kt(st),st);st<Ar&&(Vt=Nt(st),ut(Vt));)st++;return Rr=St.slice(mr,st),_e.hasOwnProperty(Rr)?{type:o,value:_e[Rr],raw:Rr}:Rr===Le?{type:c}:{type:i,name:Rr}},ci=function(Vt){for(var mr,Rr=[],nn,_i=!1,Me=0;st<Ar;)if(ln(),mr=Nt(st),mr===Vt){_i=!0,st++,Vt===J&&Me&&Me>=Rr.length&&de("Unexpected token "+String.fromCharCode(Vt),st);break}else if(mr===U){if(st++,Me++,Me!==Rr.length){if(Vt===J)de("Unexpected token ,",st);else if(Vt===q)for(var kt=Rr.length;kt<Me;kt++)Rr.push(null)}}else nn=Pr(),(!nn||nn.type===n)&&de("Expected comma",st),Rr.push(nn);return _i||de("Expected "+String.fromCharCode(Vt),st),Rr},Yn=function(){var Vt,mr;for(Vt=Nt(st),Vt===H?mr=mn():mr=Dr(),ln(),Vt=Nt(st);Vt===N||Vt===ue||Vt===H;)st++,Vt===N?(ln(),mr={type:s,computed:!1,object:mr,property:Dr()}):Vt===ue?(mr={type:s,computed:!0,object:mr,property:Pr()},ln(),Vt=Nt(st),Vt!==q&&de("Unclosed [",st),st++):Vt===H&&(mr={type:f,arguments:ci(J),callee:mr}),ln(),Vt=Nt(st);return mr},mn=function(){st++;var Vt=Pr();if(ln(),Nt(st)===J)return st++,Vt;de("Unclosed (",st)},ti=function(){return st++,{type:F,elements:ci(q)}},Hn=[],Bn,Zn;st<Ar;)Bn=Nt(st),Bn===Te||Bn===U?st++:(Zn=Pr())?Hn.push(Zn):st<Ar&&de('Unexpected "'+Kt(st)+'"',st);return Hn.length===1?Hn[0]:{type:n,body:Hn}};vt.version="0.3.5",vt.toString=function(){return"JavaScript Expression Parser (JSEP) v"+vt.version},vt.addUnaryOp=function(St){return Ee=Math.max(St.length,Ee),pe[St]=me,this},vt.addBinaryOp=function(St,st){return et=Math.max(St.length,et),W[St]=st,this},vt.addLiteral=function(St,st){return _e[St]=st,this},vt.removeUnaryOp=function(St){return delete pe[St],St.length===Ee&&(Ee=re(pe)),this},vt.removeAllUnaryOps=function(){return pe={},Ee=0,this},vt.removeBinaryOp=function(St){return delete W[St],St.length===et&&(et=re(W)),this},vt.removeAllBinaryOps=function(){return W={},et=0,this},vt.removeLiteral=function(St){return delete _e[St],this},vt.removeAllLiterals=function(){return _e={},this},r.exports?e=r.exports=vt:e.parse=vt})()}
5336(F0,F0.exports)),F0.exports}var xTe=bTe();const wTe=_h(xTe),ND={"||":(r,e)=>r||e,"&&":(r,e)=>r&&e,"|":(r,e)=>r|e,"^":(r,e)=>r^e,"&":(r,e)=>r&e,"==":(r,e)=>r==e,"!=":(r,e)=>r!=e,"===":(r,e)=>r===e,"!==":(r,e)=>r!==e,"<":(r,e)=>r<e,">":(r,e)=>r>e,"<=":(r,e)=>r<=e,">=":(r,e)=>r>=e,"<<":(r,e)=>r<<e,">>":(r,e)=>r>>e,">>>":(r,e)=>r>>>e,"+":(r,e)=>r+e,"-":(r,e)=>r-e,"*":(r,e)=>r*e,"/":(r,e)=>r/e,"%":(r,e)=>r%e},CTe={"-":r=>-r,"+":r=>+r,"~":r=>~r,"!":r=>!r};function UD(r,e){return r.map(function(t){return Ks(t,e)})}function zD(r,e){const t=Ks(r.object,e);let n;if(r.computed?n=Ks(r.property,e):n=r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error(`Access to member "${n}" disallowed.`);return[t,t[n]]}function Ks(r,e){const t=r;switch(t.type){case"ArrayExpression":return UD(t.elements,e);case"BinaryExpression":return ND[t.operator](Ks(t.left,e),Ks(t.right,e));case"CallExpression":let n,i,s;return t.callee.type==="MemberExpression"?(s=zD(t.callee,e),n=s[0],i=s[1]):i=Ks(t.callee,e),typeof i!="function"?void 0:i.apply(n,UD(t.arguments,e));case"ConditionalExpression":return Ks(t.test,e)?Ks(t.consequent,e):Ks(t.alternate,e);case"Identifier":return e[t.name];case"Literal":return t.value;case"LogicalExpression":return t.operator==="||"?Ks(t.left,e)||Ks(t.right,e):t.operator==="&&"?Ks(t.left,e)&&Ks(t.right,e):ND[t.operator](Ks(t.left,e),Ks(t.right,e));case"MemberExpression":return zD(t,e)[1];case"ThisExpression":return e;case"UnaryExpression":return CTe[t.operator](Ks(t.argument,e));default:return}}const e2={"-":r=>r};function EU(r,e){if(r in e2)return e2[r];let t;const n=wTe(r);return n.type==="Identifier"?t=i=>_Te(i,r):(kx(n,i=>{if(i.type==="CallExpression")throw new Error("Function calls not allowed in JSON expressions")}),t=i=>Ks(n,i)),e2[r]=t,t}function kx(r,e){if(Array.isArray(r))r.forEach(t=>kx(t,e));else if(r&&typeof r=="object"){r.type&&e(r);for(const t in r)kx(r[t],e)}}const ny="@@=",GD="@@#",TTe="@@type",BU="@@function",VD=r=>r&&typeof r=="object";class Nx{constructor(...e){this.typeKey=TTe,this.functionKey=BU,this.log=console,this.classes={},this.reactComponents={},this.enumerations={},this.constants={},this.functions={},this.React=null,this.convertFunction=EU,this.preProcessClassProps=(t,n)=>n,this.postProcessConvertedJson=t=>t;for(const t of e)this.merge(t)}merge(e){for(const t in e)switch(t){case"layers":case"views":Object.assign(this.classes,e[t]);break;default:if(t in this){const n=e[t];this[t]=VD(this[t])?Object.assign(this[t],n):n}}}validate(e){return Lx(!this.typeKey||typeof this.typeKey=="string"),Lx(VD(this.classes)),!0}}function ETe(r){return typeof r=="string"&&r.startsWith(ny)}function BTe(r){return r.replace(ny,"")}function SU(r,e){const t={};for(const n in r){let i=r[n];ETe(i)&&(i=BTe(i),i=EU(i)),t[n]=i}return t}function STe(r,e,t){const n=t.classes[r],i=t.reactComponents[r];if(!n&&!i){const{log:s}=t;if(s){const o=JSON.stringify(e,null,0).slice(0,40);s.warn(`JSON converter: No registered class of type ${r}(${o}...)  `)}return null}return n?ITe(n,e,t):MTe(i,e,t)}function ITe(r,e,t){return t.preProcessClassProps&&(e=t.preProcessClassProps(r,e,t)),e=SU(e),new r(e)}function MTe(r,e,t){const{React:n}=t,{children:i=[]}=e;return delete e.children,t.preProcessClassProps&&(e=t.preProcessClassProps(r,e,t)),e=SU(e),n.createElement(r,e,i)}function PTe(r,e,t){const n=t.functions[r];if(!n){const{log:i}=t;if(i){const s=JSON.stringify(e,null,0).slice(0,40);i.warn(`JSON converter: No registered function ${r}(${s}...)  `)}return null}return n(e)}function RTe(r){return typeof r=="string"?JSON.parse(r):r}const WT=r=>r&&typeof r=="object";class FTe{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 Nx?e.configuration:new Nx(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;const t=RTe(e);let n=DTe(t,this.configuration);return n=this.configuration.postProcessConvertedJson(n),this.convertedJson=n,n}convertJson(e){return this.convert(e)}}function DTe(r,e){return e=new Nx(e),JT(r,"",e)}function JT(r,e,t){return Array.isArray(r)?r.map((n,i)=>
5336JT(n,String(i),t)):OTe(r,t)?LTe(r,t):WT(r)?BU in r?kTe(r,t):XT(r,t):typeof r=="string"?NTe(r,e,t):r}function OTe(r,e){const{typeKey:t}=e;return WT(r)&&!!r[t]}function LTe(r,e){const{typeKey:t}=e,n=r[t];let i={...r};return delete i[t],i=XT(i,e),STe(n,i,e)}function kTe(r,e){const{functionKey:t}=e,n=r[t];let i={...r};return delete i[t],i=XT(i,e),PTe(n,i,e)}function XT(r,e){Lx(WT(r));const t={};for(const n in r){const i=r[n];t[n]=JT(i,n,e)}return t}function NTe(r,e,t){if(r.startsWith(ny)&&t.convertFunction)return r=r.replace(ny,""),t.convertFunction(r,t);if(r.startsWith(GD)){if(r=r.replace(GD,""),t.constants[r])return t.constants[r];const[n,i]=r.split(".");return t.enumerations[n][i]}return r}const UTe={classes:{...fue,...Pxe,...s2e,...e0e,...mTe},functions:{colorBins:pTe,colorCategories:ATe,colorContinuous:gTe}},IU=new FTe({configuration:UTe}),zTe={[qy.layerName]:["getFillColor"],[Uy.layerName]:["getFillColor"],[_l.layerName]:["getFillColor"],[Xp.layerName]:["getFillColor"],[Fy.layerName]:["getFillColor"],[Ry.layerName]:["getFillColor"],[Ly.layerName]:["getColor"],[jg.layerName]:["getTargetColor","getSourceColor"],[ml.layerName]:["getFillColor"],[iu.layerName]:["getFillColor"],[Jp.layerName]:["getColor"],[Sy.layerName]:["getColor"],[uf.layerName]:["getColor"],[$g.layerName]:["getColor"],[hf.layerName]:["getFillColor"],[Wg.layerName]:["getFillColor","getColor","getLineColor"],[ff.layerName]:["getFillColor"],[Eh.layerName]:["getColor"],[Qg.layerName]:["getColor"],[Ah.layerName]:["getColor"]},GTe=({object:r,objectInfo:e,originalFillFunction:t})=>{const n=typeof t=="function"?t(r,e):t;if(Array.isArray(n))return[n[0]||0,n[1]||0,n[2]||0,n[3]||255];if(typeof n=="string"&&n.startsWith("@@=")){const i=IU.convert({originalColor:n}).originalColor(r);return[i[0]||0,i[1]||0,i[2]||0,i[3]||255]}return null},HD=({isSelected:r,object:e,objectInfo:t,opacity:n,originalFillFunction:i})=>{const s=GTe({object:e,objectInfo:t,originalFillFunction:i});if(!s)return null;let o=0;return r?o=Math.max(typeof s[3]=="number"?s[3]:n,n):o=Math.min(typeof s[3]=="number"?s[3]:n,n),[s[0]||0,s[1]||0,s[2]||0,o]},VTe=({isSelected:r,object:e,objectInfo:t,originalFillFunction:n,selectedColor:i,selectedOpacity:s=255,unselectedColor:o,unselectedOpacity:c=Math.floor(255*.4)})=>r?HD({opacity:s,isSelected:!0,object:e,objectInfo:t,originalFillFunction:n})||i:HD({opacity:c,isSelected:!1,object:e,objectInfo:t,originalFillFunction:n})||o,Dg={selection:{indices:{},objects:{}}},jD=(r,e)=>{const t=e.match(/{(.*?)}/g);return t&&t.forEach(n=>{const i=n.substring(1,n.length-1);Object.hasOwn(r.object,i)?e=e.replace(n,r.object[i]):Object.hasOwn(r.object,"properties")&&Object.hasOwn(r.object.properties,i)&&(e=e.replace(n,r.object.properties[i]))}),e};function HTe(r,e){return e.id?r.getElementState(e.id,"selection")??Dg:Dg}function jTe(r,e){if(!e.id)return Dg;const t=r.getStringValue(e);return(t?r2.parse(t):null)??Dg}function $Te(r,e,t,n){r.id&&e.setStringValue(r,JSON.stringify(t.value),{fromUi:t.fromUi},n)}const WTe=r=>{const{height:e,width:t,expanded:n}=XD(KD),{element:i,fragmentId:s,isLightTheme:o,theme:c,widgetMgr:f}=r,{selectionMode:A,tooltip:v,useContainerWidth:w}=i,S=n??!1,[F,N]=y5({element:i,getDefaultState:HTe,getStateFromWidgetMgr:jTe,updateWidgetMgrState:$Te,widgetMgr:f,fragmentId:s}),[U,$]=It.useState(null),{height:G,width:H}=Yae({element:i,isFullScreen:S,shouldUseContainerWidth:w,container:{height:e,width:t},heightFallback:U?.initialViewState?.height||c.sizes.defaultMapHeight}),[J,ue]=It.useState(null),q=A[0],se=q!==void 0,Te=se&&Object.keys(F.selection.indices).length>0,Ue=It.useMemo(()=>Object.freeze(r2.parse(i.json)),[S,o,i.json]),de=It.useMemo(()=>{const W={...Ue};if(W.mapStyle||(W.mapStyle=o?"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json":"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"),(W?.mapProvider=="carto"||W?.mapStyle&&W.mapStyle?.indexOf("cartocdn")>=0)&&!W.cartoKey&&(W.cartoKey="x7g2plm9yq8vfrc"),W.layers){const Ee=Object.values(F.selection.indices).some(_e=>_e?.length),et=W.layers.some(_e=>Object.hasOwn(_e,"pickable"));W.layers=W.layers.map(_e=>{if(!_e||Array.isArray(_e)||!se)return _e;et||(_e.pickable=!0);const Le=`${_e.id||null}
5336`,Ge=F?.selection?.indices?.[Le]||[],Ze=zTe[_e["@@type"]];if(!Ze)return _e;const tt={..._e};return Ze.forEach(rt=>{tt.updateTriggers={[rt]:[...tt.updateTriggers?.[rt]||[],Ge,Ee]};const ut=!Ee,vt=_e[rt];if(ut||!vt)return tt;const St=255,st=Math.floor(255*.4),dr=AB(c.colors.primary),er=[dr[0],dr[1],dr[2],St],Kt=AB(c.colors.gray20),Nt=[Kt[0],Kt[1],Kt[2],st],Ar=(ln,Pr)=>VTe({isSelected:Ge.includes(Pr.index),object:ln,objectInfo:Pr,originalFillFunction:vt,selectedColor:er,unselectedColor:Nt,selectedOpacity:St,unselectedOpacity:st});tt[rt]=Ar}),tt})}return delete W?.views,IU.convert(W)},[F.selection.indices,o,se,Ue,c.colors.gray20,c.colors.primary]);It.useEffect(()=>{if(!u5(de.initialViewState,J)){const W=Object.keys(de.initialViewState).reduce((re,Ee)=>de.initialViewState[Ee]===J?.[Ee]?re:{...re,[Ee]:de.initialViewState[Ee]},{});$(re=>({...re,...W})),ue(de.initialViewState)}},[de.initialViewState,J,U]);const me=It.useCallback(W=>{if(!W?.object||!v)return null;const re=r2.parse(v);return re.html?re.html=jD(W,re.html):re.text=jD(W,re.text),re},[v]),pe=It.useCallback(({viewState:W})=>{$(W)},[$]);return{createTooltip:me,data:F,deck:de,hasActiveSelection:Te,height:G,isSelectionModeActivated:se,onViewStateChange:pe,selectionMode:q,setSelection:N,viewState:U,width:H}};Ug([Jw,X2]);const t2=Dg.selection,JTe=[],XTe=r=>{const{disabled:e,disableFullscreenMode:t,element:n,fragmentId:i,heightConfig:s,widgetMgr:o}=r,{mapboxToken:c}=It.useContext(f5),f=h5(),{expanded:A,expand:v,collapse:w}=XD(KD),S=!!s?.useStretch,{createTooltip:F,data:N,deck:U,hasActiveSelection:$,isSelectionModeActivated:G,onViewStateChange:H,selectionMode:J,setSelection:ue,viewState:q}=WTe({element:n,fragmentId:i,isLightTheme:JD(f),theme:f,widgetMgr:o}),se=n.mapboxToken||c,Te=U.mapProvider=="mapbox"||U?.mapStyle&&U.mapStyle?.indexOf("mapbox")>=0,[Ue,de]=It.useState(!1);It.useEffect(()=>{de(!0)},[]);const me=It.useCallback(W=>{if(J===void 0)return;const{index:re,object:Ee}=W,et=`${W.layer?.id||null}`,_e=N,Le=re===-1,Ze=(()=>{if(Le)return t2;switch(J){case mB.SelectionMode.SINGLE_OBJECT:return _e.selection.indices[et]?.[0]===re?t2:{indices:{[`${et}`]:[re]},objects:{[`${et}`]:[Ee]}};case mB.SelectionMode.MULTI_OBJECT:{const tt=new Map((_e?.selection?.indices?.[et]||[]).map((ut,vt)=>[ut,_e.selection?.objects?.[et]?.[vt]]));if(tt.has(re)?tt.delete(re):tt.set(re,Ee),tt.size===0){const{[et]:rt,...ut}=_e.selection.indices,{[et]:vt,...St}=_e.selection.objects;return{indices:ut,objects:St}}return{indices:{..._e.selection.indices,[`${et}`]:Array.from(tt.keys())},objects:{..._e.selection.objects,[`${et}`]:Array.from(tt.values())}}}default:throw d5(J),new Error("Invalid selection mode")}})();JSON.stringify(Ze)!==JSON.stringify(_e.selection)&&ue({fromUi:!0,value:{selection:Ze}})},[J,N,ue]),pe=It.useCallback(()=>{ue({value:{selection:t2},fromUi:!0})},[ue]);return gB(SM,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",isStretchHeight:S,children:[Te?Jf(Kae,{}):null,Jf(_5,{isFullScreen:A,disableFullscreenMode:t,onExpand:v,onCollapse:w,target:SM,locked:$&&!e?!0:void 0,children:$&&!e&&Jf(m5,{label:"Clear selection",onClick:pe,icon:A5})}),q&&gB(EZ,{viewState:q,onViewStateChange:H,layers:Ue?U.layers:JTe,getTooltip:F,ContextProvider:Th.Provider,controller:!0,onClick:G&&!e?me:void 0,children:[Jf(nu,{mapStyle:U.mapStyle&&(typeof U.mapStyle=="string"?U.mapStyle:U.mapStyle[0]),mapboxApiAccessToken:se}),Jf(qae,{children:Jf($ae,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})]})},KTe=g5(XTe),oBe=It.memo(KTe);export{oBe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.