vendor: 30,830 bytes, lines 1-6
1import{r as Bt,c_ as Er,d0 as ef,cZ as tf,d8 as At,ah as uh,d9 as gs,da as wN,cX as j2,c$ as ku,db as ap,dc as H2,_ as KR,j as Gf,a0 as TN,F as ZR,m as YR,X as QR,dd as rC,bj as EN,L as CN,l as SN,o as nC,cu as IN,de as iC}from"./index.DFT9nVK6.js";import{_ as BN,C as PN}from"./toConsumableArray.DFAIugL0.js";import{E as e4,w as MN}from"./withFullScreenWrapper.Dl2f8_gt.js";import{a as RN,T as ON}from"./Toolbar.BbO8bxwz.js";import{l as d1}from"./index.8HslT92O.js";import{a as DN}from"./useBasicWidgetState.CTtyymrp.js";import{u as FN,s as LN}from"./threshold.CUNQbqMA.js";import"./FormClearHelper.CUrwwEeX.js";import"./value.DaKxGC7O.js";function kN(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 sC(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const t4=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),oC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);oC&&parseFloat(oC[1]);const aC=globalThis,lC=globalThis.process||{},NN=globalThis.navigator||{};function r4(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 fh(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||r4()}function UN(r){return fh()?r4()?"Electron":(NN.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const n4="4.1.0";function zN(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}class VN{constructor(e,t,n="sessionStorage"){this.storage=zN(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 GN(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 jN(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var Dm;(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"})(Dm||(Dm={}));const HN=10;function cC(r){return typeof r!="string"?r:(r=r.toUpperCase(),Dm[r]||Dm.WHITE)}function WN(r,e,t){return!fh&&typeof r=="string"&&(e&&(r=`\x1B[${cC(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${cC(t)+HN}m${r}\x1B[49m`)),r}function $N(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(l=>s===l)||(i[s]=o.bind(r)))}}function W2(r,e){if(!r)throw new Error("Assertion failed")}function ld(){let r;if(fh()&&aC.performance)r=aC?.performance?.now?.();else if("hrtime"in lC){const e=lC?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const cd={debug:fh()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},XN={enabled:!0,level:0};function ud(){}const uC={},fC={once:!0};class wp{constructor({id:e}={id:""}){this.VERSION=n4,this._startTs=ld(),this._deltaTs=ld(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new VN(`__probe-${this.id}__`,XN),this.timeStamp(`${this.id} started`),$N(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((ld()-this._startTs).toPrecision(10))}getDelta(){return Number((ld()-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,fC)}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,fC)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||ud,n&&[n],{tag:JN(t)}):ud}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||ud)}group(e,t,n={collapsed:!1}){const i=hC({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||ud)}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()>=i4(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=hC({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,W2(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=ld();const o=s.tag||s.message;if(s.once&&o)if(!uC[o])uC[o]=ld();else return ud;return t=qN(this.id,s.message,s),n.bind(console,t,...s.args)}return ud}}wp.VERSION=n4;function i4(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 W2(Number.isFinite(e)&&e>=0),e}function hC(r){const{logLevel:e,message:t}=r;r.logLevel=i4(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 W2(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function qN(r,e,t){if(typeof e=="string"){const n=t.time?jN(GN(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=WN(e,t.color,t.background)}return e}function JN(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}globalThis.probe={};const s4=new wp({id:"@probe.gl/log"}),Qy="4.3.3",KN=Qy[0]>="0"&&Qy[0]<="9"?`v${Qy}`:"";function ZN(){const r=new wp({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=r,globalThis.loaders.version=KN,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=r,r}const YN=ZN();function QN(r,e){return o4(r||{},e)}function o4(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]=o4(n[i]||{},e[i],t+1):n[i]=e[i];return n}const e5="latest";function t5(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const r5=t5();function qu(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const Kf=typeof process!="object"||String(process)!=="[object process]"||process.browser,n5=typeof window<"u"&&typeof window.orientation<"u",dC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);dC&&parseFloat(dC[1]);class i5{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 ev{terminate(){}}const tv=new Map;function s5(r){qu(r.source&&!r.url||!r.source&&r.url);let e=tv.get(r.source||r.url);return e||(r.url&&(e=o5(r.url),tv.set(r.url,e)),r.source&&(e=a4(r.source),tv.set(r.source,e))),qu(e),e}function o5(r){if(!r.startsWith("http"))return r;const e=a5(r);return a4(e)}function a4(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function a5(r){return`try { 2 importScripts('${r}'); 3} catch (error) { 4 console.error(error); 5 throw error; 6}`}function l4(r,e=!0,t){const n=t||new Set;if(r){if(pC(r))n.add(r);else if(pC(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(const i in r)l4(r[i],e,n)}}return t===void 0?Array.from(n):[]}function pC(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 rv=()=>{};class p1{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Kf||typeof ev<"u"&&!Kf}constructor(e){const{name:t,source:n,url:i}=e;qu(n||i),this.name=t,this.source=n,this.url=i,this.onMessage=rv,this.onError=s=>console.log(s),this.worker=Kf?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=rv,this.onError=rv,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,t){t=t||l4(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=s5({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 ev(n,{eval:!1})}else if(this.source)e=new ev(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 l5{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return p1.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 i5(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){!Kf||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 p1({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return n5?this.maxMobileConcurrency:this.maxConcurrency}}const c5={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class Uu{props;workerPools=new Map;static _workerFarm;static isSupported(){return p1.isSupported()}static getWorkerFarm(e={}){return Uu._workerFarm=Uu._workerFarm||new Uu({}),Uu._workerFarm.setProps(e),Uu._workerFarm}constructor(e){this.props={...c5},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 l5({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 u5(r,e={}){const t=e[r.id]||{},n=Kf?`${r.id}-worker.js`:`${r.id}-worker-node.js`;let i=t.workerUrl;if(!i&&r.id==="compression"&&(i=e.workerUrl),e._workerType==="test"&&(Kf?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=e5);const o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return qu(i),i}function f5(r,e=r5){qu(r,"no worker provided");const t=r.version;return!(!e||!t)}const Pu={};function h5(r,e){return!Uu.isSupported()||!Kf&&!e?._nodeWorkers?!1:r.worker&&e?.worker}async function d5(r,e,t,n,i){const s=r.id,o=u5(r,t),f=Uu.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",p5.bind(null,i));return A.postMessage("process",{input:e,options:t,context:n}),await(await A.result).result}async function p5(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 l=await r(s,o);e.postMessage("done",{id:i,result:l})}catch(l){const f=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:i,error:f})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function A5(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 g5(...r){return m5(r)}function m5(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 _5(r){const e=[];for await(const t of r)e.push(t);return g5(...e)}function AC(){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 gC{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=AC(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(AC()-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 hh{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 gC?i=e:i=new gC(t,n),this.stats[t]=i),i}}let y5="";const mC={};function v5(r){for(const e in mC)if(r.startsWith(e)){const t=mC[e];r=r.replace(e,t)}return!r.startsWith("http://")&&!r.startsWith("https://")&&(r=`${y5}${r}`),r}function b5(r){return r&&typeof r=="object"&&r.isBuffer}function c4(r){if(b5(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 u4(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(e+1):""}function x5(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(0,e):""}const w5=r=>typeof r=="boolean",RA=r=>typeof r=="function",fg=r=>r!==null&&typeof r=="object",_C=r=>fg(r)&&r.constructor==={}.constructor,T5=r=>!!r&&typeof r[Symbol.iterator]=="function",E5=r=>r&&typeof r[Symbol.asyncIterator]=="function",dh=r=>typeof Response<"u"&&r instanceof Response||r&&r.arrayBuffer&&r.text&&r.json,ph=r=>typeof Blob<"u"&&r instanceof Blob,C5=r=>r&&typeof r=="object"&&r.isBuffer,S5=r=>typeof ReadableStream<"u"&&r instanceof ReadableStream||fg(r)&&RA(r.tee)&&RA(r.cancel)&&RA(r.getReader),I5=r=>fg(r)&&RA(r.read)&&RA(r.pipe)&&w5(r.readable),f4=r=>S5(r)||I5(r);class B5 extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response}const P5=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,M5=/^([-\w.]+\/[-\w.+]+)/;function yC(r,e){return r.toLowerCase()===e.toLowerCase()}function R5(r){const e=M5.exec(r);return e?e[1]:r}function vC(r){const e=P5.exec(r);return e?e[1]:""}const h4=/\?.*/;function O5(r){const e=r.match(h4);return e&&e[0]}function $2(r){return r.replace(h4,"")}function D5(r){if(r.length<50)return r;const e=r.slice(r.length-15);return`${r.substr(0,32)}...${e}`}function C_(r){return dh(r)?r.url:ph(r)?r.name||"":typeof r=="string"?r:""}function X2(r){if(dh(r)){const e=r,t=e.headers.get("content-type")||"",n=$2(e.url);return R5(t)||vC(n)}return ph(r)?r.type||"":typeof r=="string"?vC(r):""}function F5(r){return dh(r)?r.headers["content-length"]||-1:ph(r)?r.size:typeof r=="string"?r.length:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:-1}async function d4(r){if(dh(r))return r;const e={},t=F5(r);t>=0&&(e["content-length"]=String(t));const n=C_(r),i=X2(r);i&&(e["content-type"]=i);const s=await N5(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 L5(r){if(!r.ok)throw await k5(r)}async function k5(r){const e=D5(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 B5(t,n)}async function N5(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,${U5(t)}`}return null}function U5(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 z5(r){return!V5(r)&&!G5(r)}function V5(r){return r.startsWith("http:")||r.startsWith("https:")}function G5(r){return r.startsWith("data:")}async function bC(r,e){if(typeof r=="string"){const t=v5(r);return z5(t)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(t,e):await fetch(t,e)}return await d4(r)}const xC=new wp({id:"loaders.gl"});class j5{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}class H5{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 p4={fetch:null,mimeType:void 0,nothrow:!1,log:new H5,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:t4,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},W5={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 A4(){globalThis.loaders=globalThis.loaders||{};const{loaders:r}=globalThis;return r._state||(r._state={}),r._state}function g4(){const r=A4();return r.globalOptions=r.globalOptions||{...p4},r.globalOptions}function $5(r,e,t,n){return t=t||[],t=Array.isArray(t)?t:[t],X5(r,t),J5(e,r,n)}function X5(r,e){wC(r,null,p4,W5,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]||{};wC(n,t.id,i,s,e)}}function wC(r,e,t,n,i){const s=e||"Top level",o=e?`${e}.`:"";for(const l in r){const f=!e&&fg(r[l]),A=l==="baseUri"&&!e,v=l==="workerUrl"&&e;if(!(l in t)&&!A&&!v){if(l in n)xC.warn(`${s} loader option '${o}${l}' no longer supported, use '${n[l]}'`)();else if(!f){const T=q5(l,i);xC.warn(`${s} loader option '${o}${l}' not recognized. ${T}`)()}}}}function q5(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 J5(r,e,t){const i={...r.options||{}};return K5(i,t),i.log===null&&(i.log=new j5),TC(i,g4()),TC(i,e),i}function TC(r,e){for(const t in e)if(t in e){const n=e[t];_C(n)&&_C(r[t])?r[t]={...r[t],...e[t]}:r[t]=e[t]}}function K5(r,e){e&&!("baseUri"in r)&&(r.baseUri=e)}function q2(r){return r?(Array.isArray(r)&&(r=r[0]),Array.isArray(r?.extensions)):!1}function J2(r){sC(r,"null loader"),sC(q2(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 m4=()=>{const r=A4();return r.loaderRegistry=r.loaderRegistry||[],r.loaderRegistry};function Tp(r){const e=m4();r=Array.isArray(r)?r:[r];for(const t of r){const n=J2(t);e.find(i=>n===i)||e.unshift(n)}}function Z5(){return m4()}const Y5=/\.([^.]+)$/;async function Q5(r,e=[],t,n){if(!_4(r))return null;let i=EC(r,e,{...t,nothrow:!0},n);if(i)return i;if(ph(r)&&(r=await r.slice(0,10).arrayBuffer(),i=EC(r,e,t,n)),!i&&!t?.nothrow)throw new Error(y4(r));return i}function EC(r,e=[],t,n){if(!_4(r))return null;if(e&&!Array.isArray(e))return J2(e);let i=[];e&&(i=i.concat(e)),t?.ignoreRegisteredLoaders||i.push(...Z5()),tU(i);const s=eU(r,i,t,n);if(!s&&!t?.nothrow)throw new Error(y4(r));return s}function eU(r,e,t,n){const i=C_(r),s=X2(r),o=$2(i)||n?.url;let l=null,f="";return t?.mimeType&&(l=nv(e,t?.mimeType),f=`match forced by supplied MIME type ${t?.mimeType}`),l=l||rU(e,o),f=f||(l?`matched url ${o}`:""),l=l||nv(e,s),f=f||(l?`matched MIME type ${s}`:""),l=l||iU(e,r),f=f||(l?`matched initial data ${v4(r)}`:""),t?.fallbackMimeType&&(l=l||nv(e,t?.fallbackMimeType),f=f||(l?`matched fallback MIME type ${s}`:"")),f&&YN.log(1,`selectLoader selected ${l?.name}: ${f}.`),l}function _4(r){return!(r instanceof Response&&r.status===204)}function y4(r){const e=C_(r),t=X2(r);let n="No valid loader found (";n+=e?`${u4(e)}, `:"no url provided, ",n+=`MIME type: ${t?`"${t}"`:"not provided"}, `;const i=r?v4(r):"";return n+=i?` first bytes: "${i}"`:"first bytes: not available",n+=")",n}function tU(r){for(const e of r)J2(e)}function rU(r,e){const t=e&&Y5.exec(e),n=t&&t[1];return n?nU(r,n):null}function nU(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 nv(r,e){for(const t of r)if(t.mimeTypes?.some(n=>yC(e,n))||yC(e,`application/x.${t.id}`))return t;return null}function iU(r,e){if(!e)return null;for(const t of r)if(typeof e=="string"){if(sU(e,t))return t}else if(ArrayBuffer.isView(e)){if(CC(e.buffer,e.byteOffset,t))return t}else if(e instanceof ArrayBuffer&&CC(e,0,t))return t;return null}function sU(r,e){return e.testText?e.testText(r):(Array.isArray(e.tests)?e.tests:[e.tests]).some(n=>r.startsWith(n))}function CC(r,e,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>oU(r,e,t,i))}function oU(r,e,t,n){if(n instanceof ArrayBuffer)return A5(n,r,n.byteLength);switch(typeof n){case"function":return n(r);case"string":const i=A1(r,e,n.length);return n===i;default:return!1}}function v4(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?A1(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?A1(r,0,e):""}function A1(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 aU=256*1024;function*lU(r,e){const t=e?.chunkSize||aU;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 cU=256*1024;function*uU(r,e={}){const{chunkSize:t=cU}=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 fU=1024*1024;async function*hU(r,e){const t=e?.chunkSize||fU;let n=0;for(;n<r.size;){const i=n+t,s=await r.slice(n,i).arrayBuffer();n=i,yield s}}function SC(r,e){return t4?dU(r,e):pU(r)}async function*dU(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 c4(o)}}catch{t.releaseLock()}}async function*pU(r,e){for await(const t of r)yield c4(t)}function AU(r,e){if(typeof r=="string")return lU(r,e);if(r instanceof ArrayBuffer)return uU(r,e);if(ph(r))return hU(r,e);if(f4(r))return SC(r,e);if(dh(r))return SC(r.body,e);throw new Error("makeIterator")}const b4="Cannot convert supplied data type";function gU(r,e,t){if(e.text&&typeof r=="string")return r;if(C5(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(b4)}async function mU(r,e,t){const n=r instanceof ArrayBuffer||ArrayBuffer.isView(r);if(typeof r=="string"||n)return gU(r,e);if(ph(r)&&(r=await d4(r)),dh(r)){const i=r;return await L5(i),e.binary?await i.arrayBuffer():await i.text()}if(f4(r)&&(r=AU(r,t)),T5(r)||E5(r))return _5(r);throw new Error(b4)}function x4(r,e){const t=g4(),n=r||t;return typeof n.fetch=="function"?n.fetch:fg(n.fetch)?i=>bC(i,n.fetch):e?.fetch?e?.fetch:bC}function _U(r,e,t){if(t)return t;const n={fetch:x4(e,r),...r};if(n.url){const i=$2(n.url);n.baseUrl=i,n.queryString=O5(n.url),n.filename=u4(i),n.baseUrl=x5(i)}return Array.isArray(n.loaders)||(n.loaders=null),n}function yU(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 Fm(r,e,t,n){e&&!Array.isArray(e)&&!q2(e)&&(n=void 0,t=e,e=void 0),r=await r,t=t||{};const i=C_(r),o=yU(e,n),l=await Q5(r,o,t);return l?(t=$5(t,l,o,i),n=_U({url:i,_parse:Fm,loaders:o},t,n||null),await vU(l,r,t,n)):null}async function vU(r,e,t,n){if(f5(r),t=QN(r.options,t),dh(e)){const s=e,{ok:o,redirected:l,status:f,statusText:A,type:v,url:T}=s,I=Object.fromEntries(s.headers.entries());n.response={headers:I,ok:o,redirected:l,status:f,statusText:A,type:v,url:T}}
6e=await mU(e,r,t);const i=r;if(i.parseTextSync&&typeof e=="string")return i.parseTextSync(e,t,n);if(h5(r,t))return await d5(r,e,t,n,Fm);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`)}function bU(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"}}const IC=100;class xU{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(IC),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(IC),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 w4(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 T4(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 wU(r){const e=[];for(let t=0;t<r.length;t++){const n=`column-${t}`;e.push(n)}return e}function TU(r){return Object.keys(r)}const BC=100;class EU{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||=wU(e),this.options.shape){case"object-row-table":const n=w4(e,this._headers);this.addObjectRow(n,t);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(BC),this.arrayRows[this.length]=e,this.length++;break}}addObjectRow(e,t){switch(Number.isFinite(t)&&(this.cursor=t),this._headers||=TU(e),this.options.shape){case"array-row-table":const n=T4(e,this._headers);this.addArrayRow(n,t);break;case"object-row-table":this.objectRows=this.objectRows||new Array(BC),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 CU=100;class SU{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:CU,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 IU={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},BU="TableBatchBuilder";class Lm{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={...IU,...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 EU;case"columnar-table":return SU;case"arrow-table":if(!Lm.ArrowBatch)throw new Error(BU);return Lm.ArrowBatch;default:return xU}}}function E4(r){let e=1/0,t=1/0,n=1/0,i=-1/0,s=-1/0,o=-1/0;const l=r.POSITION?r.POSITION.value:[],f=l&&l.length;for(let A=0;A<f;A+=3){const v=l[A],T=l[A+1],I=l[A+2];e=v<e?v:e,t=T<t?T:t,n=I<n?I:n,i=v>i?v:i,s=T>s?T:s,o=I>o?I:o}return[[e,t,n],[i,s,o]]}function PU(r,e,t){const n=bU(e.value),i=t||MU(e);return{name:r,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:i}}function MU(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}class PC extends Array{enqueue(e){return this.push(e)}dequeue(){return this.shift()}}class RU{_values;_settlers;_closed;constructor(){this._values=new PC,this._settlers=new PC,this._closed=!1}
6close(){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})})}}async function Kc(r,e,t,n){let i,s;!Array.isArray(e)&&!q2(e)?(i=[],s=e):(i=e,s=t);const o=x4(s);let l=r;return typeof r=="string"&&(l=await o(r)),ph(r)&&(l=await o(r)),Array.isArray(i)?await Fm(l,i,s):await Fm(l,i,s)}const OU="4.3.3";function C4(r,e){if(!r)throw new Error("loader assertion failed.")}const DU=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),MC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);MC&&parseFloat(MC[1]);const FU=globalThis.loaders?.parseImageNode,g1=typeof Image<"u",m1=typeof ImageBitmap<"u",LU=!!FU,_1=DU?!0:LU;function kU(r){switch(r){case"auto":return m1||g1||_1;case"imagebitmap":return m1;case"image":return g1;case"data":return _1;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function NU(){if(m1)return"imagebitmap";if(g1)return"image";if(_1)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function UU(r){const e=VU(r);if(!e)throw new Error("Not an image");return e}function zU(r){switch(UU(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 VU(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 GU=/^data:image\/svg\+xml/,jU=/\.svg((\?|#).*)?$/;function K2(r){return r&&(GU.test(r)||jU.test(r))}function HU(r,e){if(K2(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 S4(r,e)}function S4(r,e){if(K2(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}async function I4(r,e,t){const n=HU(r,t),i=self.URL||self.webkitURL,s=typeof n!="string"&&i.createObjectURL(n);try{return await WU(s||n,e)}finally{s&&i.revokeObjectURL(s)}}async function WU(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 $U={};let RC=!0;async function XU(r,e,t){let n;K2(t)?n=await I4(r,e,t):n=S4(r,t);const i=e&&e.imagebitmap;return await qU(n,i)}async function qU(r,e=null){if((JU(e)||!RC)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),RC=!1}return await createImageBitmap(r)}function JU(r){for(const e in r||$U)return!1;return!0}function KU(r){return!e9(r,"ftyp",4)||(r[8]&96)===0?null:ZU(r)}function ZU(r){switch(YU(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function YU(r,e,t){return String.fromCharCode(...r.slice(e,t))}function QU(r){return[...r].map(e=>e.charCodeAt(0))}function e9(r,e,t=0){const n=QU(e);for(let i=0;i<n.length;++i)if(n[i]!==r[i+t])return!1;return!0}const rc=!1,OA=!0;function B4(r){const e=hg(r);return r9(e)||s9(e)||n9(e)||i9(e)||t9(e)}function t9(r){const e=new Uint8Array(r instanceof DataView?r.buffer:r),t=KU(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function r9(r){const e=hg(r);return e.byteLength>=24&&e.getUint32(0,rc)===2303741511?{mimeType:"image/png",width:e.getUint32(16,rc),height:e.getUint32(20,rc)}:null}function n9(r){const e=hg(r);return e.byteLength>=10&&e.getUint32(0,rc)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,OA),height:e.getUint16(8,OA)}:null}function i9(r){const e=hg(r);return e.byteLength>=14&&e.getUint16(0,rc)===16973&&e.getUint32(2,OA)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,OA),height:e.getUint32(22,OA)}:null}function s9(r){const e=hg(r);if(!(e.byteLength>=3&&e.getUint16(0,rc)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:n,sofMarkers:i}=o9();let s=2;
6for(;s+9<e.byteLength;){const o=e.getUint16(s,rc);if(i.has(o))return{mimeType:"image/jpeg",height:e.getUint16(s+5,rc),width:e.getUint16(s+7,rc)};if(!n.has(o))return null;s+=2,s+=e.getUint16(s,rc)}return null}function o9(){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 hg(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 a9(r,e){const{mimeType:t}=B4(r)||{},n=globalThis.loaders?.parseImageNode;return C4(n),await n(r,t)}async function l9(r,e,t){e=e||{};const i=(e.image||{}).type||"auto",{url:s}=t||{},o=c9(i);let l;switch(o){case"imagebitmap":l=await XU(r,e,s);break;case"image":l=await I4(r,e,s);break;case"data":l=await a9(r);break;default:C4(!1)}return i==="data"&&(l=zU(l)),l}function c9(r){switch(r){case"auto":case"data":return NU();default:return kU(r),r}}const u9=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],f9=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],h9={image:{type:"auto",decode:!0}},d9={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:OU,mimeTypes:f9,extensions:u9,parse:l9,tests:[r=>!!B4(new DataView(r))],options:h9},Zr=new wp({id:"deck"});let y1={};function p9(r){y1=r}function Ao(r,e,t,n){Zr.level>0&&y1[r]&&y1[r].call(null,e,t,n)}function A9(r){const e=r[0],t=r[r.length-1];return e==="{"&&t==="}"||e==="["&&t==="]"}const g9={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:A9,parseTextSync:JSON.parse};function m9(){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||(Zr.log(1,`deck.gl ${r}`)(),globalThis.deck={...globalThis.deck,VERSION:r,version:r,log:Zr,_registerLoggers:p9},Tp([g9,[d9,{imagebitmap:{premultiplyAlpha:"none"}}]])),r}const _9=m9();function Z2(r,e){if(!r)throw new Error(e||"shadertools: assertion failed.")}const iv={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 y9(r){const e={};for(const[t,n]of Object.entries(r))e[t]=v9(n);return e}function v9(r){let e=OC(r);if(e!=="object")return{value:r,...iv[e],type:e};if(typeof r=="object")return r?r.type!==void 0?{...r,...iv[r.type],type:r.type}:r.value===void 0?{type:"object",value:r}:(e=OC(r.value),{...r,...iv[e],type:e}):{type:"object",value:null};throw new Error("props")}function OC(r){return Array.isArray(r)||ArrayBuffer.isView(r)?"array":typeof r}const b9=`#ifdef MODULE_LOGDEPTH 7 logdepth_adjustPosition(gl_Position); 8#endif 9`,x9=`#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`,w9={vertex:b9,fragment:x9},DC=/void\s+main\s*\([^)]*\)\s*\{\n?/,FC=/}\n?[^{}]*$/,sv=[],cm="__LUMA_INJECT_DECLARATIONS__";function T9(r){const e={vertex:{},fragment:{}};for(const t in r){let n=r[t];const i=E9(t);typeof n=="string"&&(n={order:0,injection:n}),e[i][t]=n}return e}function E9(r){const e=r.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function km(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),sv.length=o.length;for(let f=0,A=o.length;f<A;++f)sv[f]=o[f].injection;const l=`${sv.join(` 30`)} 31`;switch(s){case"vs:#decl":i&&(r=r.replace(cm,l));break;case"vs:#main-start":i&&(r=r.replace(DC,f=>f+l));break;case"vs:#main-end":i&&(r=r.replace(FC,f=>l+f));break;case"fs:#decl":i||(r=r.replace(cm,l));break;case"fs:#main-start":i||(r=r.replace(DC,f=>f+l));break;case"fs:#main-end":i||(r=r.replace(FC,f=>l+f));break;default:r=r.replace(s,f=>f+l)}}return r=r.replace(cm,""),n&&(r=r.replace(/\}\s*$/,s=>s+w9[e])),r}function Nm(r){r.map(e=>P4(e))}function P4(r){if(r.instance)return;Nm(r.dependencies||[]);const{propTypes:e={},deprecations:t=[],inject:n={}}=r,i={normalizedInjections:T9(n),parsedDeprecations:C9(t)};e&&(i.propValidators=y9(e)),r.instance=i;let s={};e&&(s=Object.entries(e).reduce((o,[l,f])=>{const A=f?.value;return A&&(o[l]=A),o},{})),r.defaultUniforms={...r.defaultUniforms,...s}}function M4(r,e,t){r.deprecations?.forEach(n=>
vendor: 4,739 bytes, lines 31-63
31{n.regex?.test(e)&&(n.deprecated?t.deprecated(n.old,n.new)():t.removed(n.old,n.new)())})}function C9(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 Y2(r){Nm(r);const e={},t={};R4({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 Nm(n),n}function R4(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&&R4({modules:s.dependencies,level:t+1,moduleMap:n,moduleDepth:i})}function S9(r){switch(r?.gpu.toLowerCase()){case"apple":return`#define APPLE_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 I9(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=LC(r,B9),r;case"fragment":return r=LC(r,P9),r;default:throw new Error(e)}}const O4=[[/^(#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("]],B9=[...O4,[v1("attribute"),"in $1"],[v1("varying"),"out $1"]],P9=[...O4,[v1("varying"),"in $1"]];function LC(r,e){for(const[t,n]of e)r=r.replace(t,n);return r}function v1(r){return new RegExp(`\\b${r}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function D4(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,l)=>o.order-l.order);for(const o of s)t+=` ${o.injection} 58`}i.footer&&(t+=` ${i.footer}`),t+=`} 59`}return t}function F4(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(":"),l=i.replace(/\(.+/,""),f=Object.assign(n,{signature:o});switch(s){case"vs":e.vertex[l]=f;break;case"fs":e.fragment[l]=f;break;default:throw new Error(s)}}return e}function M9(r,e){return{name:R9(r,e),language:"glsl",version:O9(r)}}function R9(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 O9(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 L4=` 60 61${cm} 62`,D9=`precision highp float; 63`;function F9(r){const e=Y2(r.modules||[]);return{source:k9(r.platformInfo,{...r,source:r.source,stage:"vertex",modules:e}),getUniforms:k4(e)}}function L9(r){const{vs:e,fs:t}=r,n=Y2(r.modules||[]);return{vs:kC(r.platformInfo,{...r,source:e,stage:"vertex",modules:n}),fs:kC(r.platformInfo,{...r,source:t,stage:"fragment",modules:n}),getUniforms:k4(n)}}function k9(r,e){const{source:t,stage:n,modules:i,hookFunctions:s=[],inject:o={},log:l}=e;Z2(typeof t=="string","shader source must be a string");const f=t;let A="";const v=F4(s),T={},I={},F={};for(const U in o){const $=typeof o[U]=="string"?{injection:o[U],order:0}:o[U],V=/^(v|f)s:(#)?([\w-]+)$/.exec(U);if(V){const j=V[2],X=V[3];j?X==="decl"?I[U]=[$]:F[U]=[$]:T[U]=[$]}else F[U]=[$]}const N=i;for(const U of N){l&&M4(U,f,l);const $=N4(U,"wgsl");A+=$;const V=U.injections?.[n]||{};for(const j in V){const X=/^(v|f)s:#([\w-]+)$/.exec(j);if(X){const K=X[2]==="decl"?I:F;
63K[j]=K[j]||[],K[j].push(V[j])}else T[j]=T[j]||[],T[j].push(V[j])}}return A+=L4,A=km(A,n,I),A+=D4(v[n],T),A+=f,A=km(A,n,F),A}function kC(r,e){const{id:t,source:n,stage:i,language:s="glsl",modules:o,defines:l={},hookFunctions:f=[],inject:A={},prologue:v=!0,log:T}=e;Z2(typeof n=="string","shader source must be a string");const I=s==="glsl"?M9(n).version:-1,F=r.shaderLanguageVersion,N=I===100?"#version 100":"#version 300 es",$=n.split(` 64`).slice(1).join(` 65`),V={};o.forEach(Ee=>{Object.assign(V,Ee.defines)}),Object.assign(V,l);let j="";switch(s){case"wgsl":break;case"glsl":j=v?`${N} 66 67// ----- PROLOGUE ------------------------- 68${N9({id:t,source:n,stage:i})} 69${`#define SHADER_TYPE_${i.toUpperCase()}`} 70 71${S9(r)} 72${i==="fragment"?D9:""} 73 74// ----- APPLICATION DEFINES ------------------------- 75 76${U9(V)} 77 78`:`${N} 79`;break}const X=F4(f),ue={},K={},se={};for(const Ee in A){const Ue=typeof A[Ee]=="string"?{injection:A[Ee],order:0}:A[Ee],de=/^(v|f)s:(#)?([\w-]+)$/.exec(Ee);if(de){const me=de[2],pe=de[3];me?pe==="decl"?K[Ee]=[Ue]:se[Ee]=[Ue]:ue[Ee]=[Ue]}else se[Ee]=[Ue]}for(const Ee of o){T&&M4(Ee,$,T);const Ue=N4(Ee,i);j+=Ue;const de=Ee.instance?.normalizedInjections[i]||{};for(const me in de){const pe=/^(v|f)s:#([\w-]+)$/.exec(me);if(pe){const re=pe[2]==="decl"?K:se;re[me]=re[me]||[],re[me].push(de[me])}else ue[me]=ue[me]||[],ue[me].push(de[me])}}return j+="// ----- MAIN SHADER SOURCE -------------------------",j+=L4,j=km(j,i,K),j+=D4(X[i],ue),j+=$,j=km(j,i,se),s==="glsl"&&I!==F&&(j=I9(j,i)),j.trim()}function k4(r){return function(t){const n={};for(const i of r){const s=i.getUniforms?.(t,n);Object.assign(n,s)}return n}}function N9(r){const{id:e,source:t,stage:n}=r;return e&&t.indexOf("SHADER_NAME")===-1?` 80#define SHADER_NAME ${e}_${n}`:""}function U9(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 N4(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:Z2(!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 z9=/^\s*\#\s*ifdef\s*([a-zA-Z_]+)\s*$/,V9=/^\s*\#\s*endif\s*$/;function G9(r,e){const t=r.split(` 86`),n=[];let i=!0,s=null;for(const o of t){const l=o.match(z9),f=o.match(V9);l?(s=l[1],i=!!e?.defines?.[s]):f?i=!0:i&&n.push(o)}return n.join(` 87`)}class Wf{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return Wf.defaultShaderAssembler=Wf.defaultShaderAssembler||new Wf,Wf.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}=F9({...e,source:e.source,modules:t,hookFunctions:n});return{source:e.platformInfo.shaderLanguage==="wgsl"?G9(i):i,getUniforms:s,modules:t}}assembleGLSLShaderPair(e){const t=this._getModuleList(e.modules),n=this._hookFunctions;return{...L9({...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 l=this._defaultModules[s],f=l.name;t[i++]=l,n[f]=!0}for(let s=0,o=e.length;s<o;++s){const l=e[s],f=l.name;n[f]||(t[i++]=l,n[f]=!0)}return t.length=i,Nm(t),t}}const j9=`out vec4 transform_output; 88void main() { 89 transform_output = vec4(0); 90}`,H9=`#version 300 es 91${j9}`;function U4(r){const{input:e,inputChannels:t,output:n}=r||{};if(!e)return H9;if(!t)throw new Error("inputChannels");const i=W9(t),s=$9(e,t);return`#version 300 es 92in ${i} ${e}; 93out vec4 ${n}; 94void main() { 95 ${n} = ${s}; 96}`}function W9(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 $9(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}`)}}class X9{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new hh({id:e})),this.stats.get(e)}}const z4=new X9,Yt=new wp({id:"luma.gl"}),ov={};function S_(r="id"){ov[r]=ov[r]||1;const e=ov[r]++;return`${r}-${e}`}let Ai=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=q9(t,n);const i=this.props.id!=="undefined"?this.props.id:S_(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 q9(r,e){const t={...e};for(const n in r)r[n]!==void 0&&(t[n]=r[n]);return t}let Hi=class um extends Ai{static defaultProps={...Ai.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)&um.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(e,n,um.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,um.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 V4(r){const e=NC[r],t=J9(e),n=r.includes("norm"),i=!n&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:NC[r],byteLength:t,integer:i,signed:s,normalized:n}}function J9(r){return K9[r]}const NC={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},K9={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4},co="texture-compression-bc",pi="texture-compression-astc",Zl="texture-compression-etc2",Z9="texture-compression-etc1-webgl",f0="texture-compression-pvrtc-webgl",av="texture-compression-atc-webgl",h0="float32-renderable-webgl",lv="float16-renderable-webgl",Y9="rgb9e5ufloat-renderable-webgl",cv="snorm8-renderable-webgl",fA="norm16-renderable-webgl",uv="snorm16-renderable-webgl",d0="float32-filterable",UC="float16-filterable-webgl";function G4(r){const e=Q9[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}const Q9={r8unorm:{},r8snorm:{render:cv},r8uint:{},r8sint:{},rg8unorm:{},rg8snorm:{render:cv},rg8uint:{},rg8sint:{},r16uint:{},r16sint:{},r16float:{render:lv,filter:"float16-filterable-webgl"},"r16unorm-webgl":{f:fA},"r16snorm-webgl":{f:uv},"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:cv},rgba8uint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{},rg16sint:{},rg16float:{render:lv,filter:UC},"rg16unorm-webgl":{render:fA},"rg16snorm-webgl":{render:uv},r32uint:{},r32sint:{},r32float:{render:h0,filter:d0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:Y9},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:h0},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:fA},"rgb16snorm-webgl":{f:fA},rg32uint:{},rg32sint:{},rg32float:{render:!1,filter:d0},rgba16uint:{},rgba16sint:{},rgba16float:{render:lv,filter:UC},"rgba16unorm-webgl":{render:fA},"rgba16snorm-webgl":{render:uv},"rgb32float-webgl":{render:h0,filter:d0},rgba32uint:{},rgba32sint:{},rgba32float:{render:h0,filter:d0},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:co},"bc1-rgb-unorm-srgb-webgl":{f:co},"bc1-rgba-unorm":{f:co},"bc1-rgba-unorm-srgb":{f:co},"bc2-rgba-unorm":{f:co},"bc2-rgba-unorm-srgb":{f:co},"bc3-rgba-unorm":{f:co},"bc3-rgba-unorm-srgb":{f:co},"bc4-r-unorm":{f:co},"bc4-r-snorm":{f:co},"bc5-rg-unorm":{f:co},"bc5-rg-snorm":{f:co},"bc6h-rgb-ufloat":{f:co},"bc6h-rgb-float":{f:co},"bc7-rgba-unorm":{f:co},"bc7-rgba-unorm-srgb":{f:co},"etc2-rgb8unorm":{f:Zl},"etc2-rgb8unorm-srgb":{f:Zl},"etc2-rgb8a1unorm":{f:Zl},"etc2-rgb8a1unorm-srgb":{f:Zl},"etc2-rgba8unorm":{f:Zl},"etc2-rgba8unorm-srgb":{f:Zl},"eac-r11unorm":{f:Zl},"eac-r11snorm":{f:Zl},"eac-rg11unorm":{f:Zl},"eac-rg11snorm":{f:Zl},"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:f0},"pvrtc-rgba4unorm-webgl":{f:f0},"pvrtc-rbg2unorm-webgl":{f:f0},"pvrtc-rgba2unorm-webgl":{f:f0},"etc1-rbg-unorm-webgl":{f:Z9},"atc-rgb-unorm-webgl":{f:av},"atc-rgba-unorm-webgl":{f:av},"atc-rgbai-unorm-webgl":{f:av}},ez=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],tz=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function j4(r){return ez.some(e=>r.startsWith(e))}function Q2(r){let e=rz(r);if(j4(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;const n=nz(r);n&&(e.blockWidth=n.blockWidth,e.blockHeight=n.blockHeight)}const t=tz.exec(r);if(t){const[,n,i,s,o,l]=t,f=`${s}${i}`,A=V4(f),v=A.byteLength*8,T=n.length,I=[v,T>=2?v:0,T>=3?v:0,T>=4?v:0];e={format:r,attachment:e.attachment,dataType:A.dataType,components:T,channels:n,integer:A.integer,signed:A.signed,normalized:A.normalized,bitsPerChannel:I,bytesPerPixel:A.byteLength*n.length,packed:e.packed,srgb:e.srgb},l==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function rz(r){const e=G4(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 nz(r){const t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){const[,n,i]=t;return{blockWidth:Number(n),blockHeight:Number(i)}}return null}function iz(r){const e=G4(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=Q2(r),i=r.startsWith("depth")||r.startsWith("stencil"),s=n?.signed,o=n?.integer,l=n?.webgl;return t.render&&=!s,t.filter&&=!i&&!s&&!o&&!l,t}class sz{}class oz{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 Hu{static defaultProps={id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:e=>Yt.error(e.message)(),_reuseDevices:!1,_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:Yt.get("debug")||void 0,debugShaders:Yt.get("debug-shaders")||void 0,debugFramebuffers:!!Yt.get("debug-framebuffers"),debugWebGL:!!Yt.get("debug-webgl"),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0};get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...Hu.defaultProps,...e},this.id=this.props.id||S_(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=z4;timestamp=0;_reused=!1;_lumaData={};getTextureFormatCapabilities(e){const t=iz(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 j4(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)&Hi.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":Yt.warn("indices buffer content must be of integer type")()),t}}const az=fh()&&typeof document<"u",lz=()=>az&&document.readyState==="complete",cz="set luma.log.level=1 (or higher) to trace rendering",zC="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.";class Ld{static defaultProps={...Hu.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0};static pageLoaded=uz().then(()=>{Yt.probe(2,"DOM is loaded")()});stats=z4;log=Yt;VERSION="9.1.9";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw Yt.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),Yt.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");Yt.error("This version of luma.gl has already been initialized")()}Yt.log(1,`${this.VERSION} - ${cz}`)(),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(Ld.defaultProps,e)}async createDevice(e={}){e={...Ld.defaultProps,...e},e.waitForPageLoad&&await Ld.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(zC)}async attachDevice(e){const t=this.getAdapterMap(e.adapters);let n="";e.handle instanceof WebGL2RenderingContext&&(n="webgl"),e.createCanvasContext&&await Ld.pageLoaded,e.handle===null&&(n="unknown");const s=await t.get(n)?.attach?.(null);if(s)return s;throw new Error(zC)}enforceWebGL2(e=!0,t=[]){const i=this.getAdapterMap(t).get("webgl");i||Yt.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){Yt.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 b1=new Ld;function uz(){return lz()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}class fz{}class ex{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={...ex.defaultProps,...e},e=this.props,!fh()){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=dz(e.canvas):this.canvas=e.canvas;else{const t=pz(e),n=hz(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 Az(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)&&(Yt.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 l=Math.floor(n*o),f=Math.floor(i*o);if(this.htmlCanvas.width=l,this.htmlCanvas.height=f,this.device.gl){const[v,T]=this.getDrawingBufferSize();(v!==l||T!==f)&&(o=Math.min(v/n,T/i),this.htmlCanvas.width=Math.floor(n*o),this.htmlCanvas.height=Math.floor(i*o),Yt.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 hz(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 dz(r){const e=document.getElementById(r);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function pz(r){const{width:e,height:t}=r,n=document.createElement("canvas");return n.id=S_("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 Az(r,e,t,n,i){const s=r,o=VC(s[0],e,t);let l=GC(s[1],e,n,i),f=VC(s[0]+1,e,t);const A=f===t-1?f:f-1;f=GC(s[1]+1,e,n,i);let v;return i?(f=f===0?f:f+1,v=l,l=f):v=f===n-1?f:f-1,{x:o,y:l,width:Math.max(A-o+1,1),height:Math.max(v-l+1,1)}}function VC(r,e,t){return Math.min(Math.round(r*e),t-1)}function GC(r,e,t,n){return n?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}class oi extends Ai{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={...Ai.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=oi.normalizeProps(e,t),super(e,t,oi.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=oi.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"?oi.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 oi.getTextureDataSize(e[0]);if(oi.isExternalImage(e))return oi.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 I_ extends Ai{static defaultProps={...Ai.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,I_.defaultProps)}}function gz(r,e,t){let n="";const i=e.split(/\r?\n/),s=r.slice().sort((o,l)=>o.lineNum-l.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let l=1;l<=i.length;l++)for(n+=H4(i[l-1],l,t);s.length>o&&s[o].lineNum===l;){const f=s[o++];n+=jC(f,i,f.lineNum,{...t,inlineSource:!1})}return n;case"issues":case"no":for(const l of r)n+=jC(l,i,l.lineNum,{inlineSource:t?.showSourceCode!=="no"});return n}}function jC(r,e,t,n){if(n?.inlineSource){const s=mz(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 mz(r,e,t){let n="";for(let i=e-2;i<=e;i++){const s=r[i-1];s!==void 0&&(n+=H4(s,e,t))}return n}function H4(r,e,t){const n=t?.html?yz(r):r;return`${_z(String(e),4)}: ${n}${t?.html?"<br/>":` 101`}`}function _z(r,e){let t="";for(let n=r.length;n<e;++n)t+=" ";return t+r}function yz(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}class B_ extends Ai{static defaultProps={...Ai.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:vz(t),...t},B_.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=W4(this.source),n=`${this.stage} ${t}`;let i=gz(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 vz(r){return W4(r.source)||r.id||S_(`unnamed ${r.stage}-shader`)}function W4(r,e="unnamed"){const n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);
105return n?n[1]:e}class KA extends Ai{static defaultProps={...Ai.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=KA.normalizeProps(e,t),super(e,t,KA.defaultProps)}static normalizeProps(e,t){const n=e?.props?._resourceDefaults?.sampler||{};return{...t,...n}}}class P_ extends Ai{static defaultProps={...Ai.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null};get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,P_.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&&(Yt.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 oi?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 oi?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:oi.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:oi.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 lp extends Ai{static defaultProps={...Ai.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,lp.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}}class jf extends Ai{static defaultClearColor=[0,0,0,1];static defaultClearDepth=1;static defaultClearStencil=0;static defaultProps={...Ai.defaultProps,framebuffer:null,parameters:void 0,clearColor:jf.defaultClearColor,clearColors:void 0,clearDepth:jf.defaultClearDepth,clearStencil:jf.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=jf.normalizeProps(e,t),super(e,t,jf.defaultProps)}static normalizeProps(e,t){return{...e.props._resourceDefaults?.renderPass,...t}}}class Um extends Ai{static defaultProps={...Ai.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0};get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Um.defaultProps),this.shaderLayout=t.shaderLayout}}class tx extends Ai{static defaultProps={...Ai.defaultProps,measureExecutionTime:void 0};get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,tx.defaultProps)}}class rx extends Ai{static defaultProps={...Ai.defaultProps};get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,rx.defaultProps)}}function bz(r){const[e,t]=wz[r],n=e==="i32"||e==="u32",i=e!=="u32",s=Tz[e]*t,o=xz(e,t);return{dataType:e,components:t,defaultVertexFormat:o,byteLength:s,integer:n,signed:i}}function xz(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 wz={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]},Tz={f32:4,f16:2,i32:4,u32:4};function $4(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=V4(i),l={type:i,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(l.webglOnly=!0),l}function X4(r,e){const t={};for(const n of r.attributes){const i=Cz(r,e,n.name);i&&(t[n.name]=i)}return t}function Ez(r,e,t=16){const n=X4(r,e),i=new Array(t).fill(null);for(const s of Object.values(n))i[s.location]=s;return i}function Cz(r,e,t){const n=Sz(r,t),i=Iz(e,t);if(!n)return null;const s=bz(n.type),o=i?.vertexFormat||s.defaultVertexFormat,l=$4(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:l.type,bufferComponents:l.components,normalized:l.normalized,integer:s.integer,stepMode:i?.stepMode||n.stepMode||"vertex",byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function Sz(r,e){const t=r.attributes.find(n=>n.name===e);return t||Yt.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Iz(r,e){Bz(r);let t=Pz(r,e);return t||(t=Mz(r,e),t)?t:(Yt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Bz(r){for(const e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&Yt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Pz(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 Mz(r,e){for(const t of r){let n=t.byteStride;if(typeof t.byteStride!="number")for(const s of t.attributes||[]){const o=$4(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 nx extends Ai{static defaultProps={...Ai.defaultProps,renderPipeline:null};get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,nx.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=Ez(n,i,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"))}}class ix extends Ai{static defaultProps={...Ai.defaultProps,layout:void 0,buffers:{}};get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,ix.defaultProps)}}class sx extends Ai{static defaultProps={...Ai.defaultProps,type:void 0,count:void 0};get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,sx.defaultProps)}}const Rz={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 Oz(r){return Rz[r]}function Dz(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}let p0;function q4(r){return(!p0||p0.byteLength<r)&&(p0=new ArrayBuffer(r)),p0}function Fz(r,e){const t=q4(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function Lz(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function zm(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":Lz(r)}const HC=1024;class kz{layout={};byteLength;constructor(e){let t=0;for(const[i,s]of Object.entries(e)){const o=Oz(s),{type:l,components:f}=o;
105t=Dz(t,f);const A=t;t+=f,this.layout[i]={type:l,size:f,offset:A}}t+=(4-t%4)%4;const n=t*4;this.byteLength=Math.max(n,HC)}getData(e){const t=Math.max(this.byteLength,HC),n=q4(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 l=this.layout[s];if(!l){Yt.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}const{type:f,size:A,offset:v}=l,T=i[f];if(A===1){if(typeof o!="number"&&typeof o!="boolean"){Yt.warn(`Supplied value for single component uniform ${s} is not a number: ${o}`)();continue}T[v]=Number(o)}else{if(!zm(o)){Yt.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${o}`)();continue}T.set(o,v)}}return new Uint8Array(n)}has(e){return!!this.layout[e]}get(e){return this.layout[e]}}function Nz(r,e,t=16){if(r!==e)return!1;const n=r,i=e;if(!zm(n))return!1;if(zm(i)&&n.length===i.length){for(let s=0;s<n.length;++s)if(i[s]!==n[s])return!1}return!0}function Uz(r){return zm(r)?r.slice():r}class zz{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){Nz(this.uniforms[e],t)||(this.uniforms[e]=Uz(t),this.modifiedUniforms[e]=!0,this.modified=!0)}}class Vz{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(const[t,n]of Object.entries(e)){const i=t,s=new kz(n.uniformTypes||{});this.uniformBufferLayouts.set(i,s);const o=new zz({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:Hi.UNIFORM|Hi.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:Hi.UNIFORM|Hi.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&&Yt.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();Yt.log(4,`Writing to uniform buffer ${String(e)}`,s,o)()}return i}}function J4(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 K4(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 Gz(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);const n=e;let i=J4(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 fv{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&&Yt.warn(`BufferLayout: Missing buffer for "${e}".`)(),t}}function jz(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],l=s.attributes?s.attributes.map(v=>v.attribute):[s.name],f=Math.min(...o.map(v=>t[v])),A=Math.min(...l.map(v=>t[v]));return f-A}),n}class za{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 WC{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 zu=class extends za{constructor(e,t){super(e,t),this.members=[],this.align=0,this.startLine=-1,this.endLine=-1,this.inUse=!1}get isStruct(){return!0}},Wu=class extends za{constructor(e,t){super(e,t),this.count=0,this.stride=0}get isArray(){return!0}getTypeName(){return`array<${this.format.getTypeName()}, ${this.count}>`}},x1=class extends za{constructor(e,t,n){super(e,n),this.format=t}get isPointer(){return!0}getTypeName(){return`&${this.format.getTypeName()}`}},th=class extends za{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 Nu;(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"})(Nu||(Nu={}));let A0=class{constructor(e,t,n,i,s,o,l){this.name=e,this.type=t,this.group=n,this.binding=i,this.attributes=s,this.resourceType=o,this.access=l}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray||this.type.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 Hz{constructor(e,t){this.name=e,this.type=t}}let Wz=class{constructor(e,t,n,i){this.name=e,this.type=t,this.locationType=n,this.location=i,this.interpolation=null}};class $C{constructor(e,t,n,i){this.name=e,this.type=t,this.locationType=n,this.location=i}}class $z{constructor(e,t,n,i){this.name=e,this.type=t,this.attributes=n,this.id=i}}let Xz=class{constructor(e,t,n){this.name=e,this.type=t,this.attributes=n}};class qz{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 Jz{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}}function Kz(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 Z4=new Float32Array(1),Zz=new Int32Array(Z4.buffer),uo=new Uint16Array(1);function Yz(r){Z4[0]=r;const e=Zz[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 ox=new Uint32Array(1),Y4=new Float32Array(ox.buffer,0,1);function XC(r){const e=112+(r>>6&31)<<23|(63&r)<<17;return ox[0]=e,Y4[0]}function Qz(r,e,t,n,i,s,o,l,f){const A=n*(o>>=i)*(s>>=i)+t*o+e*l;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],T=(4192256&v)>>11,I=(4290772992&v)>>22;return[XC(2047&v),XC(T),(function(F){const N=112+(F>>5&31)<<23|(31&F)<<18;return ox[0]=N,Y4[0]})(I),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]=Kz(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 ti(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=Yz(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 hv={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}};
105class ja{constructor(){this.id=ja._id++,this.line=0}get isAstNode(){return!0}get astNodeType(){return""}search(e){e(this)}searchBlock(e,t){if(e){t(Vm.instance);for(const n of e)n instanceof Array?this.searchBlock(n,t):n.search(t);t(Gm.instance)}}constEvaluate(e,t){throw new Error("Cannot evaluate node")}constEvaluateString(e){return this.constEvaluate(e).toString()}}ja._id=0;class Vm extends ja{}Vm.instance=new Vm;class Gm extends ja{}Gm.instance=new Gm;const Q4=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 ja{constructor(){super()}}class ZA 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 e7 extends Ui{constructor(e){super(),this.expression=e}get astNodeType(){return"staticAssert"}search(e){this.expression.search(e)}}class eO 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 w1 extends Ui{constructor(e,t){super(),this.body=e,this.loopId=t}get astNodeType(){return"continuing"}search(e){this.searchBlock(this.body,e)}}let tO=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 Hc 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 ax 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 DA 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 fm 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 kd,wA,_t,ot;(r=>{r.increment="++",r.decrement="--"})(kd||(kd={})),(r=>{r.parse=function(e){const t=e;if(t=="parse")throw new Error("Invalid value for IncrementOperator");return r[t]}})(kd||(kd={}));class rO 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=">>="})(wA||(wA={})),(r=>{r.parse=function(e){const t=e;if(t=="parse")throw new Error("Invalid value for AssignOperator");return t}})(wA||(wA={}));
105class nO 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 lx extends Ui{constructor(e,t){super(),this.name=e,this.args=t}get astNodeType(){return"call"}isBuiltin(){return Q4.has(this.name)}search(e){for(const t of this.args)t.search(e);e(this)}}class iO 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 sO 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 oO 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 aO 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 t7 extends Ui{constructor(e){super(),this.name=e}get astNodeType(){return"enable"}}class r7 extends Ui{constructor(e){super(),this.extensions=e}get astNodeType(){return"requires"}}class lO extends Ui{constructor(e,t){super(),this.severity=e,this.rule=t}get astNodeType(){return"diagnostic"}}class cx extends Ui{constructor(e,t){super(),this.name=e,this.type=t}get astNodeType(){return"alias"}}class n7 extends Ui{constructor(){super()}get astNodeType(){return"discard"}}class cO extends Ui{constructor(){super(),this.condition=null,this.loopId=-1}get astNodeType(){return"break"}}class uO 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"}get 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 qC extends Ut{constructor(e){super(e)}}class Gc 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 hm extends Ut{constructor(e,t,n,i){super(e),this.storage=t,this.type=n,this.access=i}get astNodeType(){return"pointer"}}class FA 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 TA extends Ut{constructor(e,t,n){super(e),this.format=t,this.access=n}get astNodeType(){return"sampler"}}class Sl extends ja{constructor(){super(),this.postfix=null}}class rh extends Sl{constructor(e){super(),this.value=e}
105get astNodeType(){return"stringExpr"}toString(){return this.value}constEvaluateString(){return this.value}}class tc extends Sl{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 ux extends Sl{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 Q4.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 fa extends Sl{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 fO extends Sl{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 Sl{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 hO extends Sl{constructor(e,t){super(),this.type=e,this.value=t}get astNodeType(){return"bitcastExpr"}search(e){this.value.search(e)}}class cp extends Sl{constructor(e){super(),this.index=e}search(e){this.index.search(e)}}class dO extends Sl{constructor(){super()}}class ds extends dO{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 fl extends dO{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 pO extends ja{constructor(e){super(),this.body=e}search(e){e(this),this.searchBlock(this.body,e)}}class dm extends Sl{constructor(){super()}get astNodeType(){return"default"}}class AO extends pO{constructor(e,t){super(t),this.selectors=e}get astNodeType(){return"case"}search(e){this.searchBlock(this.body,e)}}class gO extends pO{constructor(e){super(e)}get astNodeType(){return"default"}search(e){this.searchBlock(this.body,e)}}class JC extends ja{constructor(e,t,n){super(),this.name=e,this.type=t,this.attributes=n}get astNodeType(){return"argument"}}class i7 extends ja{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 KC extends ja{constructor(e,t,n){super(),this.name=e,this.type=t,this.attributes=n}get astNodeType(){return"member"}}class mO extends ja{constructor(e,t){super(),this.name=e,this.value=t}get astNodeType(){return"attribute"}}class Ga{constructor(e,t){this.parent=null,this.typeInfo=e,this.parent=t,this.id=Ga._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()}>`}}Ga._id=0;class T1 extends Ga{constructor(){super(new za("void",null),null)}toString(){return"void"}}T1.void=new T1;class fd extends Ga{constructor(e){super(new x1("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 Ga{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 s7(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 Ga{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 rh?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 th)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 cp){const o=t.index;let l=-1;if(o instanceof ws){if(!(o.value instanceof it))return console.error(`GetSubData: Invalid array index ${o.value}`),null;l=o.value.value}else{const f=e.evalExpression(o,n);if(!(f instanceof it))return console.error("GetSubData: Unknown index type",o),null;l=f.value}if(l<0||l>=s.data.length)return console.error("GetSubData: Index out of range",l),null;if(s.data instanceof Float32Array){const f=new Float32Array(s.data.buffer,s.data.byteOffset+4*l,1);return new it(f,i)}if(s.data instanceof Int32Array){const f=new Int32Array(s.data.buffer,s.data.byteOffset+4*l,1);return new it(f,i)}if(s.data instanceof Uint32Array){const f=new Uint32Array(s.data.buffer,s.data.byteOffset+4*l,1);return new it(f,i)}throw"GetSubData: Invalid data type"}if(!(t instanceof rh))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 l=[];for(const f of o)f==="x"||f==="r"?l.push(this.data[0]):f==="y"||f==="g"?l.push(this.data[1]):f==="z"||f==="b"?l.push(this.data[2]):f==="w"||f==="a"?l.push(this.data[3]):console.error(`GetDataValue: Unknown member ${f}`);s=s7(e,l,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 Ga{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 rh?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 th)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 cp){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 l=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${l}`));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${l}`));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${l}`))}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 Ga{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 cp)if(o instanceof Wu){const l=n.index;if(l instanceof ws){if(!(l.value instanceof it))return void console.error(`SetDataValue: Invalid index type ${l.value}`);s+=l.value.value*o.stride}else{const f=e.evalExpression(l,i);if(!(f instanceof it))return void console.error("SetDataValue: Unknown index type",l);s+=f.value*o.stride}o=o.format}else console.error(`SetDataValue: Type ${o.getTypeName()} is not an array`);else{if(!(n instanceof rh))return void console.error("SetDataValue: Unknown postfix type",n);{const l=n.value;if(o instanceof zu){let f=!1;for(const A of o.members)if(A.name===l){s+=A.offset,o=A.type,f=!0;break}if(!f)return void console.error(`SetDataValue: Member ${l} not found`)}else if(o instanceof za){const f=o.getTypeName();let A=0;if(l==="x"||l==="r")A=0;else if(l==="y"||l==="g")A=1;else if(l==="z"||l==="b")A=2;else{if(l!=="w"&&l!=="a")return void console.error(`SetDataValue: Unknown member ${l}`);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 l=new Float32Array(this.buffer,i,2);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1]):(l[0]=t[0],l[1]=t[1]))}if(o==="vec3f"||o==="vec3h"){const l=new Float32Array(this.buffer,i,3);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2]):(l[0]=t[0],l[1]=t[1],l[2]=t[2]))}if(o==="vec4f"||o==="vec4h"){const l=new Float32Array(this.buffer,i,4);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3]))}if(o==="vec2i"){const l=new Int32Array(this.buffer,i,2);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1]):(l[0]=t[0],l[1]=t[1]))}if(o==="vec3i"){const l=new Int32Array(this.buffer,i,3);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2]):(l[0]=t[0],l[1]=t[1],l[2]=t[2]))}if(o==="vec4i"){const l=new Int32Array(this.buffer,i,4);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3]))}if(o==="vec2u"){const l=new Uint32Array(this.buffer,i,2);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1]):(l[0]=t[0],l[1]=t[1]))}if(o==="vec3u"){const l=new Uint32Array(this.buffer,i,3);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2]):(l[0]=t[0],l[1]=t[1],l[2]=t[2]))}if(o==="vec4u"){const l=new Uint32Array(this.buffer,i,4);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3]))}if(o==="vec2b"){const l=new Uint32Array(this.buffer,i,2);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1]):(l[0]=t[0],l[1]=t[1]))}if(o==="vec3b"){const l=new Uint32Array(this.buffer,i,3);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2]):(l[0]=t[0],l[1]=t[1],l[2]=t[2]))}if(o==="vec4b"){const l=new Uint32Array(this.buffer,i,4);return void(t instanceof ze?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3]))}if(o==="mat2x2f"||o==="mat2x2h"){const l=new Float32Array(this.buffer,i,4);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3]))}if(o==="mat2x3f"||o==="mat2x3h"){const l=new Float32Array(this.buffer,i,6);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5]))}if(o==="mat2x4f"||o==="mat2x4h"){const l=new Float32Array(this.buffer,i,8);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5],l[6]=t.data[6],l[7]=t.data[7]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7]
105))}if(o==="mat3x2f"||o==="mat3x2h"){const l=new Float32Array(this.buffer,i,6);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5]))}if(o==="mat3x3f"||o==="mat3x3h"){const l=new Float32Array(this.buffer,i,9);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5],l[6]=t.data[6],l[7]=t.data[7],l[8]=t.data[8]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8]))}if(o==="mat3x4f"||o==="mat3x4h"){const l=new Float32Array(this.buffer,i,12);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5],l[6]=t.data[6],l[7]=t.data[7],l[8]=t.data[8],l[9]=t.data[9],l[10]=t.data[10],l[11]=t.data[11]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8],l[9]=t[9],l[10]=t[10],l[11]=t[11]))}if(o==="mat4x2f"||o==="mat4x2h"){const l=new Float32Array(this.buffer,i,8);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5],l[6]=t.data[6],l[7]=t.data[7]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7]))}if(o==="mat4x3f"||o==="mat4x3h"){const l=new Float32Array(this.buffer,i,12);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5],l[6]=t.data[6],l[7]=t.data[7],l[8]=t.data[8],l[9]=t.data[9],l[10]=t.data[10],l[11]=t.data[11]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8],l[9]=t[9],l[10]=t[10],l[11]=t[11]))}if(o==="mat4x4f"||o==="mat4x4h"){const l=new Float32Array(this.buffer,i,16);return void(t instanceof on?(l[0]=t.data[0],l[1]=t.data[1],l[2]=t.data[2],l[3]=t.data[3],l[4]=t.data[4],l[5]=t.data[5],l[6]=t.data[6],l[7]=t.data[7],l[8]=t.data[8],l[9]=t.data[9],l[10]=t.data[10],l[11]=t.data[11],l[12]=t.data[12],l[13]=t.data[13],l[14]=t.data[14],l[15]=t.data[15]):(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8],l[9]=t[9],l[10]=t[10],l[11]=t[11],l[12]=t[12],l[13]=t[13],l[14]=t[14],l[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;let l=this.offset,f=this.typeInfo;for(;t;){if(t instanceof cp){const v=t.index,T=v instanceof Sl?e.evalExpression(v,n):v;let I=0;if(T instanceof it?I=T.value:typeof T=="number"?I=T:console.error("GetDataValue: Invalid index type",v),f instanceof Wu)l+=I*f.stride,f=f.format;else{const F=f.getTypeName();F==="mat4x4"||F==="mat4x4f"||F==="mat4x4h"?(l+=16*I,f=e.getTypeInfo("vec4f")):console.error(`getDataValue: Type ${f.getTypeName()} is not an array`)}}else{if(!(t instanceof rh))return console.error("GetDataValue: Unknown postfix type",t),null;{const v=t.value;if(f instanceof zu){let T=!1;for(const I of f.members)if(I.name===v){l+=I.offset,f=I.type,T=!0;break}if(!T)return console.error(`GetDataValue: Member ${v} not found`),null}else if(f instanceof za){const T=f.getTypeName();if(T==="vec2f"||T==="vec3f"||T==="vec4f"||T==="vec2i"||T==="vec3i"||T==="vec4i"||T==="vec2u"||T==="vec3u"||T==="vec4u"||T==="vec2b"||T==="vec3b"||T==="vec4b"||T==="vec2h"||T==="vec3h"||T==="vec4h"||T==="vec2"||T==="vec3"||T==="vec4"){if(v.length>0&&v.length<5){let I="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(T.endsWith("f"))return this.buffer.byteLength<l+4*$+4?(console.log("Insufficient buffer data"),null):new it(new Float32Array(this.buffer,l+4*$,1),e.getTypeInfo("f32"),this);if(T.endsWith("h"))return new it(new Float32Array(this.buffer,l+4*$,1),e.getTypeInfo("f16"),this);if(T.endsWith("i"))return new it(new Int32Array(this.buffer,l+4*$,1),e.getTypeInfo("i32"),this);if(T.endsWith("b"))return new it(new Int32Array(this.buffer,l+4*$,1),e.getTypeInfo("bool"),this);if(T.endsWith("u"))return new it(new Uint32Array(this.buffer,l+4*$,1),e.getTypeInfo("i32"),this)}if(T==="vec2f")F.push(new Float32Array(this.buffer,l,2)[$]);else if(T==="vec3f"){if(l+12>=this.buffer.byteLength)return console.log("Insufficient buffer data"),null;const V=new Float32Array(this.buffer,l,3);F.push(V[$])}else if(T==="vec4f")F.push(new Float32Array(this.buffer,l,4)[$]);else if(T==="vec2i")I="i",F.push(new Int32Array(this.buffer,l,2)[$]);else if(T==="vec3i")I="i",F.push(new Int32Array(this.buffer,l,3)[$]);else if(T==="vec4i")I="i",F.push(new Int32Array(this.buffer,l,4)[$]);else if(T==="vec2u"){I="u";const V=new Uint32Array(this.buffer,l,2);F.push(V[$])}else T==="vec3u"?(I="u",F.push(new Uint32Array(this.buffer,l,3)[$])):T==="vec4u"&&(I="u",F.push(new Uint32Array(this.buffer,l,4)[$]))}return F.length===2?f=e.getTypeInfo(`vec2${I}`):F.length===3?f=e.getTypeInfo(`vec3${I}
105`):F.length===4?f=e.getTypeInfo(`vec4${I}`):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 ${T} is not a struct`),null}}}t=t.postfix}const A=f.getTypeName();return A==="f32"?new it(new Float32Array(this.buffer,l,1),f,this):A==="i32"?new it(new Int32Array(this.buffer,l,1),f,this):A==="u32"?new it(new Uint32Array(this.buffer,l,1),f,this):A==="vec2f"?new ze(new Float32Array(this.buffer,l,2),f,this):A==="vec3f"?new ze(new Float32Array(this.buffer,l,3),f,this):A==="vec4f"?new ze(new Float32Array(this.buffer,l,4),f,this):A==="vec2i"?new ze(new Int32Array(this.buffer,l,2),f,this):A==="vec3i"?new ze(new Int32Array(this.buffer,l,3),f,this):A==="vec4i"?new ze(new Int32Array(this.buffer,l,4),f,this):A==="vec2u"?new ze(new Uint32Array(this.buffer,l,2),f,this):A==="vec3u"?new ze(new Uint32Array(this.buffer,l,3),f,this):A==="vec4u"?new ze(new Uint32Array(this.buffer,l,4),f,this):f instanceof th&&f.name==="atomic"?((i=f.format)===null||i===void 0?void 0:i.name)==="u32"?new it(new Uint32Array(this.buffer,l,1)[0],f.format,this):((s=f.format)===null||s===void 0?void 0:s.name)==="i32"?new it(new Int32Array(this.buffer,l,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,l,this)}toString(){let e="";
105if(this.typeInfo instanceof Wu)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 zu?e+="{...}":e="[...]";return e}}class jc extends Ga{constructor(e,t,n,i){super(t,null),this.data=e,this.descriptor=n,this.view=i}clone(){return new jc(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=hv[e];return t?t.isDepthStencil?4:t.bytesPerBlock:0}get bytesPerRow(){return this.width*this.texelByteSize}get isDepthStencil(){const e=this.format,t=hv[e];return!!t&&t.isDepthStencil}getGpuSize(){const e=this.format,t=hv[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,l=this.height,f=this.data[i];return Qz(new Uint8Array(f),e,t,n,i,l,o,s,this.format)}setPixel(e,t,n,i,s){const o=this.texelByteSize,l=this.bytesPerRow,f=this.height,A=this.data[i];(function(v,T,I,F,N,U,$,V,j,X){const ue=F*($>>=N)*(U>>=N)+I*$+T*V;switch(j){case"r8unorm":return void ti(v,ue,"8unorm",1,X);case"r8snorm":return void ti(v,ue,"8snorm",1,X);case"r8uint":return void ti(v,ue,"8uint",1,X);case"r8sint":return void ti(v,ue,"8sint",1,X);case"rg8unorm":return void ti(v,ue,"8unorm",2,X);case"rg8snorm":return void ti(v,ue,"8snorm",2,X);case"rg8uint":return void ti(v,ue,"8uint",2,X);case"rg8sint":return void ti(v,ue,"8sint",2,X);case"rgba8unorm-srgb":case"rgba8unorm":case"bgra8unorm-srgb":case"bgra8unorm":return void ti(v,ue,"8unorm",4,X);case"rgba8snorm":return void ti(v,ue,"8snorm",4,X);case"rgba8uint":return void ti(v,ue,"8uint",4,X);case"rgba8sint":return void ti(v,ue,"8sint",4,X);case"r16uint":return void ti(v,ue,"16uint",1,X);case"r16sint":return void ti(v,ue,"16sint",1,X);case"r16float":return void ti(v,ue,"16float",1,X);case"rg16uint":return void ti(v,ue,"16uint",2,X);case"rg16sint":return void ti(v,ue,"16sint",2,X);case"rg16float":return void ti(v,ue,"16float",2,X);case"rgba16uint":return void ti(v,ue,"16uint",4,X);case"rgba16sint":return void ti(v,ue,"16sint",4,X);case"rgba16float":return void ti(v,ue,"16float",4,X);case"r32uint":return void ti(v,ue,"32uint",1,X);case"r32sint":return void ti(v,ue,"32sint",1,X);case"depth16unorm":case"depth24plus":case"depth24plus-stencil8":case"depth32float":case"depth32float-stencil8":case"r32float":return void ti(v,ue,"32float",1,X);case"rg32uint":return void ti(v,ue,"32uint",2,X);case"rg32sint":return void ti(v,ue,"32sint",2,X);case"rg32float":return void ti(v,ue,"32float",2,X);case"rgba32uint":return void ti(v,ue,"32uint",4,X);case"rgba32sint":return void ti(v,ue,"32sint",4,X);case"rgba32float":return void ti(v,ue,"32float",4,X);case"rg11b10ufloat":console.error("TODO: rg11b10ufloat not supported for writing")}})(new Uint8Array(A),e,t,n,i,f,l,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 ZC{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 o7{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 ZC(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 l=this._peekAhead();if(e=="-"&&this._tokens.length>0){if(l=="=")return this._current++,e+=l,this._addToken(De.tokens.minus_equal),!0;if(l=="-")return this._current++,e+=l,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)&&l!=">")return this._addToken(o),!0}if(e==">"&&(l==">"||l=="=")){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 T=0;T<v;++T)if(f+=this._peekAhead(T),o=this._findType(f),o!==De.none){A=T;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 ZC(e,t,this._line,this._start,this._current))}}function gr(r){return Array.isArray(r)||r?.buffer instanceof ArrayBuffer}const jm=new Float32Array(1),a7=new Uint32Array(jm.buffer),l7=new Uint32Array(jm.buffer),Hm=new Int32Array(1),c7=new Float32Array(Hm.buffer),u7=new Uint32Array(Hm.buffer),Wm=new Uint32Array(1),f7=new Float32Array(Wm.buffer),h7=new Int32Array(Wm.buffer);function YC(r,e,t){if(e===t)return r;if(e==="f32"){if(t==="i32"||t==="x32")return jm[0]=r,a7[0];if(t==="u32")return jm[0]=r,l7[0]}else if(e==="i32"||e==="x32"){if(t==="f32")return Hm[0]=r,c7[0];if(t==="u32")return Hm[0]=r,u7[0]}else if(e==="u32"){if(t==="f32")return Wm[0]=r,f7[0];if(t==="i32"||t==="x32")return Wm[0]=r,h7[0]}return console.error(`Unsupported cast from ${e} to ${t}`),r}class d7{constructor(e){this.resources=null,this.inUse=!1,this.info=null,this.node=e}}class g0{constructor(e,t){this.align=e,this.size=t}}class oc{constructor(){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new Jz,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 ZA&&this._functions.set(t.name,new d7(t));for(const t of e)if(t instanceof Gc){const n=this.getTypeInfo(t,null);n instanceof zu&&this.structs.push(n)}for(const t of e)if(t instanceof cx)this.aliases.push(this._getAliasInfo(t));else{if(t instanceof ax){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 $z(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),l=new A0(n.name,o,i,s,n.attributes,Nu.Uniform,n.access);l.access||(l.access="read"),this.uniforms.push(l);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),l=this._isStorageTexture(o),f=new A0(n.name,o,i,s,n.attributes,l?Nu.StorageTexture:Nu.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),l=this._isStorageTexture(o),f=new A0(n.name,o,i,s,n.attributes,l?Nu.StorageTexture:Nu.Texture,n.access);f.access||(f.access="read"),l?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),l=new A0(n.name,o,i,s,n.attributes,Nu.Sampler,n.access);this.samplers.push(l);continue}}for(const t of e)if(t instanceof ZA){const n=this._getAttribute(t,"vertex"),i=this._getAttribute(t,"fragment"),s=this._getAttribute(t,"compute"),o=n||i||s,l=new qz(t.name,o?.name,t.attributes);l.attributes=t.attributes,l.startLine=t.startLine,l.endLine=t.endLine,this.functions.push(l),this._functions.get(t.name).info=l,o&&(this._functions.get(t.name).inUse=!0,l.inUse
109=!0,l.resources=this._findResources(t,!!o),l.inputs=this._getInputs(t.args),l.outputs=this._getOutputs(t.returnType),this.entry[o.name].push(l)),l.arguments=t.args.map(f=>new Xz(f.name,this.getTypeInfo(f.type,f.attributes),f.attributes)),l.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 mO){if(n.value)if(gr(n.value))for(const l of n.value)for(const f of this.overrides)l===f.name&&((i=t.info)===null||i===void 0||i.overrides.push(f));else for(const l of this.overrides)n.value===l.name&&((s=t.info)===null||s===void 0||s.overrides.push(l))}else if(n instanceof fa)for(const l of this.overrides)n.name===l.name&&((o=t.info)===null||o===void 0||o.overrides.push(l))});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 Vm)s.push({});else if(o instanceof Gm)s.pop();else if(o instanceof Hc){const l=o;t&&l.type!==null&&this._markStructsFromAST(l.type),s.length>0&&(s[s.length-1][l.name]=l)}else if(o instanceof tc){const l=o;t&&l.type!==null&&this._markStructsFromAST(l.type)}else if(o instanceof DA){const l=o;t&&l.type!==null&&this._markStructsFromAST(l.type),s.length>0&&(s[s.length-1][l.name]=l)}else if(o instanceof fa){const l=o;if(s.length>0&&s[s.length-1][l.name])return;const f=i._findResource(l.name);f&&n.push(f)}else if(o instanceof ux){const l=o,f=i._functions.get(l.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 lx){const l=o,f=i._functions.get(l.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 Gc)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 Gc)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),l=new $C(n.name,s,i.name,o);t.push(l)}}}_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 $C("",n,t.name,i)}return null}_getInputs(e,t=void 0){t===void 0&&(t=[]);for(const n of e)if(n.type instanceof Gc)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 Gc)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 Wz(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 Hz(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 hm){const i=e.type?this.getTypeInfo(e.type,e.attributes):null,s=new x1(e.name,i,t);return this._types.set(e,s),this._updateTypeInfo(s),s}if(e instanceof FA){const i=e,s=i.format?this.getTypeInfo(i.format,i.attributes):null,o=new Wu(i.name,t);return o.format=s,o.count=i.count,this._types.set(e,o),this._updateTypeInfo(o),o}if(e instanceof Gc){const i=e,s=new zu(i.name,t);s.startLine=i.startLine,s.endLine=i.endLine;for(const o of i.members){const l=this.getTypeInfo(o.type,o.attributes);s.members.push(new WC(o.name,l,o.attributes))}return this._types.set(e,s),this._updateTypeInfo(s),s}if(e instanceof TA){const i=e,s=i.format instanceof Ut,o=i.format?s?this.getTypeInfo(i.format,null):new za(i.format,null):null,l=new th(i.name,o,t,i.access);return this._types.set(e,l),this._updateTypeInfo(l),l}if(e instanceof ft){const i=e,s=i.format?this.getTypeInfo(i.format,null):null,o=new th(i.name,s,t,i.access);return this._types.set(e,o),this._updateTypeInfo(o),o}const n=new za(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 Wu&&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 x1&&this._updateTypeInfo(e.format),e instanceof zu&&this._updateStructInfo(e)}_updateStructInfo(e){var t;let n=0,i=0,s=0,o=0;for(let l=0,f=e.members.length;l<f;++l){const A=e.members[l],v=this._getTypeSize(A);if(!v)continue;(t=this._getAlias(A.type.name))!==null&&t!==void 0||A.type;const T=v.align,I=v.size;n=this._roundUp(T,n+i),i=I,s=n,o=Math.max(o,T),A.offset=n,A.size=I,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 WC&&(e=e.type),e instanceof za){const o=this._getAlias(e.name);o!==null&&(e=o)}{const o=oc._typeInfo[e.name];if(o!==void 0){const l=((t=e.format)===null||t===void 0?void 0:t.name)==="f16"?2:1;return new g0(Math.max(s,o.align/l),Math.max(i,o.size/l))}}{const o=oc._typeInfo[e.name.substring(0,e.name.length-1)];if(o){const l=e.name[e.name.length-1]==="h"?2:1;return new g0(Math.max(s,o.align/l),Math.max(i,o.size/l))}}if(e instanceof Wu){let o=e,l=8,f=8;const A=this._getTypeSize(o.format);return A!==null&&(f=A.size,l=A.align),f=o.count*this._getAttributeNum((n=e?.attributes)!==null&&n!==void 0?n:null,"
109stride",this._roundUp(l,f)),i&&(f=i),new g0(Math.max(s,l),Math.max(i,f))}if(e instanceof zu){let o=0,l=0,f=0,A=0,v=0;for(const T of e.members){const I=this._getTypeSize(T.type);I!==null&&(o=Math.max(I.align,o),f=this._roundUp(I.align,f+A),A=I.size,v=f)}return l=this._roundUp(o,v+A),new g0(Math.max(s,o),Math.max(i,l))}return null}_isUniformVar(e){return e instanceof Hc&&e.storage=="uniform"}_isStorageVar(e){return e instanceof Hc&&e.storage=="storage"}_isTextureVar(e){return e instanceof Hc&&e.type!==null&&oc._textureTypes.indexOf(e.type.name)!=-1}_isSamplerVar(e){return e instanceof Hc&&e.type!==null&&oc._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}}oc._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}},oc._textureTypes=De.any_texture_type.map(r=>r.name),oc._samplerTypes=De.sampler_type.map(r=>r.name);let fx=0;class hx{constructor(e,t,n){this.id=fx++,this.name=e,this.value=t,this.node=n}clone(){return new hx(this.name,this.value,this.node)}}class dx{constructor(e){this.id=fx++,this.name=e.name,this.node=e}clone(){return new dx(this.node)}}class px{constructor(e){this.parent=null,this.variables=new Map,this.functions=new Map,this.currentFunctionName="",this.id=fx++,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 hx(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 px(this)}}class p7{evalExpression(e,t){return null}getTypeInfo(e){return null}getVariableName(e,t){return""}}class A7{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((l,f)=>Math.atan2(l,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,l=i,f=s;return new it(this._clamp(o.value,l.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 l=0;for(let f=0;f<n.data.length;++f)l+=(n.data[f]-i.data[f])*(n.data[f]-i.data[f]);return new it(Math.sqrt(l),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,l=s.value;if(n instanceof ze)return new ze(n.data.map(A=>A>>o&(1<<l)-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<<l)-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(l=>-l),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,l=i,f=s;return new it(o.value*l.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 l=s.value,f=(1<<o.value)-1<<l,A=~f;if(n instanceof ze&&i instanceof ze)return new ze(n.data.map((I,F)=>I&A|i.data[F]<<l&f),n.typeInfo);const v=n.value,T=i.value;return new it(v&A|T<<l&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((l,f)=>Math.max(l,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((l,f)=>Math.min(l,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,l=s;return new it(n.value*(1-l.value)+o.value*l.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,l)=>o%i.data[l]),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((l,f)=>Math.pow(l,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,l)=>o-2*s*i.data[l]),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((l,f)=>{const A=1-s.value*s.value*(1-o*o);if(A<0)return 0;const v=Math.sqrt(A);return s.value*l-(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,l=i,f=s;return new it(this._smoothstep(o.value,l.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,l)=>o<n.data[l]?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 fa){const s=n.name,o=t.getVariableValue(s);if(o instanceof jc){if(i<0||i>=o.mipLevelCount)return console.error(`Invalid mip level for textureDimensions. Line ${e.line}`),null;const l=o.getMipLevelSize(i),f=o.dimension;return f==="1d"?new it(l[0],this.getTypeInfo("u32")):f==="3d"?new ze(l,this.getTypeInfo("vec3u")):f==="2d"?new ze(l.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 fa){const o=n.name,l=t.getVariableValue(o);if(l instanceof jc){const f=Math.floor(i.data[0]),A=Math.floor(i.data[1]);if(f<0||f>=l.width||A<0||A>=l.height)return console.error(`Texture ${o} out of bounds. Line ${e.line}`),null;const v=l.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 fa){const i=n.name,s=t.getVariableValue(i);return s instanceof jc?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 fa){const i=n.name,s=t.getVariableValue(i);return s instanceof jc?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 fa){const i=n.name,s=t.getVariableValue(i);return s instanceof jc?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 fa){const l=n.name,f=t.getVariableValue(l);if(f instanceof jc){const A=f.getMipLevelSize(0),v=Math.floor(i.data[0]),T=Math.floor(i.data[1]);return v<0||v>=A[0]||T<0||T>=A[1]?(console.error(`Texture ${l} out of bounds. Line ${e.line}`),null):(f.setPixel(v,T,0,s,Array.from(o)),null)}return console.error(`Texture ${l} 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 l=this.exec.evalExpression(o,t),f=s.value.getSubData(this.exec,n.postfix,t);return f instanceof it&&l instanceof it&&(f.value=l.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 l=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&&l instanceof it&&(f.value+=l.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 l=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&&l instanceof it&&(f.value-=l.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 l=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&&l instanceof it&&(f.value=Math.max(f.value,l.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 l=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&&l instanceof it&&(f.value=Math.min(f.value,l.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 l=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&&l instanceof it&&(f.value=f.value&l.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 l=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&&l instanceof it&&(f.value=f.value|l.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 l=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&&l instanceof it&&(f.value=f.value^l.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 l=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&&l instanceof it&&(f.value=l.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 dv={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 p7{constructor(e,t){var n;super(),this.ast=e??[],this.reflection=new oc,this.reflection.updateAST(this.ast),this.context=(n=t?.clone())!==null&&n!==void 0?n:new px,this.builtins=new A7(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 Wu){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 l=t[0],f=t[1],A=t[2],v=this.getTypeInfo("vec3u");s.setVariable("@num_workgroups",new ze(t,v));const T=this.reflection.getFunctionInfo(e);T===null&&console.error(`Function ${e} not found in reflection data`);for(const I in n)for(const F in n[I]){const N=n[I][F];
109s.variables.forEach(U=>{var $;const V=U.node;if(V?.attributes){let j=null,X=null;for(const ue of V.attributes)ue.name==="binding"?j=ue.value:ue.name==="group"&&(X=ue.value);if(F==j&&I==X){let ue=!1;for(const K of T.resources)if(K.name===U.name&&K.group===parseInt(I)&&K.binding===parseInt(F)){ue=!0;break}if(ue)if(N.texture!==void 0&&N.descriptor!==void 0){const K=new jc(N.texture,this.getTypeInfo(V.type),N.descriptor,($=N.texture.view)!==null&&$!==void 0?$:null);U.value=K}else N.uniform!==void 0?U.value=new ts(N.uniform,this.getTypeInfo(V.type)):U.value=new ts(N,this.getTypeInfo(V.type))}}})}for(let I=0;I<A;++I)for(let F=0;F<f;++F)for(let N=0;N<l;++N)s.setVariable("@workgroup_id",new ze([N,F,I],this.getTypeInfo("vec3u"))),this._dispatchWorkgroup(o,[N,F,I],s)}execStatement(e,t){if(e instanceof aO)return this.evalExpression(e.value,t);if(e instanceof cO){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 uO)return po._continueObj;if(e instanceof DA)this._let(e,t);else if(e instanceof Hc)this._var(e,t);else if(e instanceof fm)this._const(e,t);else if(e instanceof ZA)this._function(e,t);else{if(e instanceof oO)return this._if(e,t);if(e instanceof sO)return this._switch(e,t);if(e instanceof tO)return this._for(e,t);if(e instanceof eO)return this._while(e,t);if(e instanceof iO)return this._loop(e,t);if(e instanceof w1){const n=t.clone();return n.currentFunctionName=t.currentFunctionName,this._execStatements(e.body,n)}if(e instanceof nO)this._assign(e,t);else if(e instanceof rO)this._increment(e,t);else{if(e instanceof Gc)return null;if(e instanceof ax){const n=e.name;t.getVariable(n)===null&&t.setVariable(n,new it(0,this.getTypeInfo("u32")))}else if(e instanceof lx)this._call(e,t);else{if(e instanceof lO||e instanceof cx)return null;console.error("Invalid statement type.",e,`Line ${e.line}`)}}}return null}evalExpression(e,t){return e instanceof fl?this._evalBinaryOp(e,t):e instanceof ws?this._evalLiteral(e,t):e instanceof fa?this._evalVariable(e,t):e instanceof ux?this._evalCall(e,t):e instanceof tc?this._evalCreate(e,t):e instanceof fO?this._evalConst(e,t):e instanceof hO?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 T=n.getVariableValue(v.value[0]);i[0]=T instanceof it?T.value:parseInt(v.value[0])}if(v.value.length>1){const T=n.getVariableValue(v.value[1]);i[1]=T instanceof it?T.value:parseInt(v.value[1])}if(v.value.length>2){const T=n.getVariableValue(v.value[2]);i[2]=T instanceof it?T.value:parseInt(v.value[2])}}const s=this.getTypeInfo("vec3u"),o=this.getTypeInfo("u32");n.setVariable("@workgroup_size",new ze(i,s));const l=i[0],f=i[1],A=i[2];for(let v=0,T=0;v<A;++v)for(let I=0;I<f;++I)for(let F=0;F<l;++F,++T){const N=[F,I,v],U=[F+t[0]*i[0],I+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(T,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;
109return e instanceof fa?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}const 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],l=this.evalExpression(e.args[s],n);n.setVariable(o.name,l,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 fa){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 fd?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 fd(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((T,I)=>f.data[I]+T)):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((T,I)=>f.data[I]-T)):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 fd))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 fd&&(n=n.reference),n===null)return void console.error(`Variable ${i} not found. Line ${e.line}`);const o=this.evalExpression(e.value,t),l=e.operator;if(l!=="="){const f=n.getSubData(this,s,t);if(f instanceof ze&&o instanceof it){const A=f.data,v=o.value;if(l==="+=")for(let T=0;T<A.length;++T)A[T]+=v;else if(l==="-=")for(let T=0;T<A.length;++T)A[T]-=v;else if(l==="*=")for(let T=0;T<A.length;++T)A[T]*=v;else if(l==="/=")for(let T=0;T<A.length;++T)A[T]/=v;else if(l==="%=")for(let T=0;T<A.length;++T)A[T]%=v;else if(l==="&=")for(let T=0;T<A.length;++T)A[T]&=v;else if(l==="|=")for(let T=0;T<A.length;++T)A[T]|=v;else if(l==="^=")for(let T=0;T<A.length;++T)A[T]^=v;else if(l==="<<=")for(let T=0;T<A.length;++T)A[T]<<=v;else if(l===">>=")for(let T=0;T<A.length;++T)A[T]>>=v;else console.error(`Invalid operator ${l}. 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(l==="+=")for(let T=0;T<A.length;++T)A[T]+=v[T];else if(l==="-=")for(let T=0;T<A.length;++T)A[T]-=v[T];else if(l==="*=")for(let T=0;T<A.length;++T)A[T]*=v[T];else if(l==="/=")for(let T=0;T<A.length;++T)A[T]/=v[T];else if(l==="%=")for(let T=0;T<A.length;++T)A[T]%=v[T];else if(l==="&=")for(let T=0;T<A.length;++T)A[T]&=v[T];else if(l==="|=")for(let T=0;T<A.length;++T)A[T]|=v[T];else if(l==="^=")for(let T=0;T<A.length;++T)A[T]^=v[T];else if(l==="<<=")for(let T=0;T<A.length;++T)A[T]<<=v[T];else if(l===">>=")for(let T=0;T<A.length;++T)A[T]>>=v[T];else console.error(`Invalid operator ${l}. Line ${e.line}`)}else{if(!(f instanceof it&&o instanceof it))return void console.error(`Invalid type for ${e.operator} operator. Line ${e.line}`);l==="+="?f.value+=o.value:l==="-="?f.value-=o.value:l==="*="?f.value*=o.value:l==="/="?f.value/=o.value:l==="%="?f.value%=o.value:l==="&="?f.value&=o.value:l==="|="?f.value|=o.value:l==="^="?f.value^=o.value:l==="<<="?f.value<<=o.value:l===">>="?f.value>>=o.value:console.error(`Invalid operator ${l}. 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 cp){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 rh){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 dx(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 tc(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 FA||e.type instanceof Gc||e.type instanceof ft){const s=new tc(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 AO)for(const o of s.selectors){if(o instanceof dm){i=s;continue}const l=this.evalExpression(o,t);if(!(l instanceof it))return console.error(`Invalid case selector. Line ${e.line}`),null;if(l.value===n.value)return this._execStatements(s.body,t)}else s instanceof gO&&(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=YC(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 l=i.getTypeName();let f="";if(l.endsWith("f"))f="f32";else if(l.endsWith("i"))f="i32";else if(l.endsWith("u"))f="u32";else if(l.endsWith("b"))f="bool";else{if(!l.endsWith("h"))return console.error(`Unknown vector type ${f}. Line ${e.line}`),null;f="f16"}const A=(function(v,T,I){if(T===I)return v;const F=new Array(v.length);for(let N=0;N<v.length;N++)F[N]=YC(v[N],T,I);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;
109if(e instanceof tc){if(e.type===null)return T1.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 tc?e.type.name:e.name,s=e instanceof tc?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 zu){if(e.args)for(let l=0;l<e.args.length;++l){const f=s.members[l],A=e.args[l],v=this.evalExpression(A,t);o.setData(this,v,f.type,f.offset,t)}}else if(s instanceof Wu){let l=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,l,t),l+=s.stride}}else console.error(`Unknown type "${i}". Line ${e.line}`);return e instanceof tc?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 fd(n);if(e.operator==="*")return n instanceof fd?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 l=i.map((f,A)=>+f);return new ze(l,n.typeInfo)}const s=i,o=this._maxFormatTypeInfo([n.typeInfo,n.typeInfo]);return new it(+s,o)}case"-":{if(gr(i)){const l=i.map((f,A)=>-f);return new ze(l,n.typeInfo)}const s=i,o=this._maxFormatTypeInfo([n.typeInfo,n.typeInfo]);return new it(-s,o)}case"!":{if(gr(i)){const l=i.map((f,A)=>f?0:1);return new ze(l,n.typeInfo)}const s=i,o=this._maxFormatTypeInfo([n.typeInfo,n.typeInfo]);return new it(s?0:1,o)}case"~":{if(gr(i)){const l=i.map((f,A)=>~f);return new ze(l,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,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F+T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I+v);return new ze(T,n.typeInfo)}
109if(gr(o)){const v=s,T=o.map((I,F)=>v+I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l+f,A)}case"-":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F-T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I-v);return new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v-I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l-f,A)}case"*":{if(gr(s)&&gr(o)){const v=s,T=o;if(n instanceof on&&i instanceof on){const I=(function($,V,j,X){if(Io[V.name]===void 0||Io[X.name]===void 0)return null;const ue=Io[V.name][0],K=Io[V.name][1],se=Io[X.name][0];if(ue!==Io[X.name][1])return null;const Ee=new Array(se*K);for(let Ue=0;Ue<K;Ue++)for(let de=0;de<se;de++){let me=0;for(let pe=0;pe<ue;pe++)me+=$[pe*K+Ue]*j[de*ue+pe];Ee[Ue*se+de]=me}return Ee})(v,n.typeInfo,T,i.typeInfo);if(I===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(I,U)}if(n instanceof on&&i instanceof ze){const I=(function(F,N,U,$){if(Io[N.name]===void 0||dv[$.name]===void 0)return null;const V=Io[N.name][0],j=Io[N.name][1];if(V!==U.length)return null;const X=new Array(j);for(let ue=0;ue<j;ue++){let K=0;for(let se=0;se<V;se++)K+=F[se*j+ue]*U[se];X[ue]=K}return X})(v,n.typeInfo,T,i.typeInfo);return I===null?(console.error(`Matrix vector multiplication failed. Line ${e.line}.`),null):new ze(I,i.typeInfo)}if(n instanceof ze&&i instanceof on){const I=(function(F,N,U,$){if(dv[N.name]===void 0||Io[$.name]===void 0)return null;const V=Io[$.name][0],j=Io[$.name][1];if(j!==F.length)return null;const X=[];for(let ue=0;ue<V;ue++){let K=0;for(let se=0;se<j;se++)K+=F[se]*U[se*V+ue];X[ue]=K}return X})(v,n.typeInfo,T,i.typeInfo);return I===null?(console.error(`Matrix vector multiplication failed. Line ${e.line}.`),null):new ze(I,n.typeInfo)}{if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F*T[N]);return new ze(I,n.typeInfo)}}if(gr(s)){const v=o,T=s.map((I,F)=>I*v);return n instanceof on?new on(T,n.typeInfo):new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v*I);return i instanceof on?new on(T,i.typeInfo):new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l*f,A)}case"%":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F%T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I%v);return new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v%I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l%f,A)}case"/":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F/T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I/v);return new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v/I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l/f,A)}case"&":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F&T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I&v);return new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v&I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l&f,A)}case"|":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F|T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I|v);return new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v|I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l|f,A)}case"^":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F^T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I^v);return new ze(T,n.typeInfo)}
109if(gr(o)){const v=s,T=o.map((I,F)=>v^I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l^f,A)}case"<<":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F<<T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I<<v);return new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v<<I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l<<f,A)}case">>":{if(gr(s)&&gr(o)){const v=s,T=o;if(v.length!==T.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const I=v.map((F,N)=>F>>T[N]);return new ze(I,n.typeInfo)}if(gr(s)){const v=o,T=s.map((I,F)=>I>>v);return new ze(T,n.typeInfo)}if(gr(o)){const v=s,T=o.map((I,F)=>v>>I);return new ze(T,i.typeInfo)}const l=s,f=o,A=this._maxFormatTypeInfo([n.typeInfo,i.typeInfo]);return new it(l>>f,A)}case">":if(gr(s)&&gr(o)){const l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v>f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A>l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l>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 l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v<f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A<l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l<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 l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v===f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A==l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l==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 l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v!==f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A!==l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l!==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 l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v>=f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A>=l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l>=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 l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v<=f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A<=l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l<=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 l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v&&f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A&&l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l&&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 l=s,f=o;if(l.length!==f.length)return console.error(`Vector length mismatch. Line ${e.line}.`),null;const A=l.map((v,T)=>v||f[T]?1:0);return new ze(A,n.typeInfo)}if(gr(s)){const l=o,f=s.map((A,v)=>A||l?1:0);return new ze(f,n.typeInfo)}if(gr(o)){const l=s,f=o.map((A,v)=>l||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],l=this.evalExpression(e.args[s],n);n.createVariable(o.name,l,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],l=this.evalExpression(e.args[s],i);i.setVariable(o.name,l,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=dv[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 l=e.vectorValue;for(const f of l)o.push(f)}else o.push(e.scalarValue);else if(e.args)for(const l of e.args){const f=this.evalExpression(l,t);if(f instanceof ze){const A=f.data;for(let v=0;v<A.length;++v){let T=A[v];o.push(T)}}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 l=new Array(s).fill(0);return new ze(l,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 l=e.vectorValue;for(const f of l)o.push(f)}else o.push(e.scalarValue);else if(e.args)for(const l of e.args){const f=this.evalExpression(l,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 th&&n.format===null&&(n.format=this.getTypeInfo("f32")),o.length===0){const l=new Array(s[2]).fill(0);return new on(l,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 Ga(new za("BREAK",null),null),po._continueObj=new Ga(new za("CONTINUE",null),null),po._priority=new Map([["f32",0],["f16",1],["u32",2],["i32",3],["x32",3]]);class g7{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}}class m7{constructor(){this._tokens=[],this._current=0,this._currentLine=1,this._deferArrayCountEval=[],this._currentLoop=[],this._context=new g7,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 fa){const o=s.name,l=this._context.constants.get(o);if(l)try{const f=l.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 KC||i instanceof hm?i.type=this._forwardType(i.type):i instanceof FA?i.format=this._forwardType(i.format):i instanceof Hc||i instanceof DA||i instanceof fm?i.type=this._forwardType(i.type):i instanceof ZA?i.returnType=this._forwardType(i.returnType):i instanceof JC&&(i.type=this._forwardType(i.type))});return t}_forwardType(e){if(e instanceof qC){const t=this._getType(e.name);if(t)return t}else e instanceof hm?e.type=this._forwardType(e.type):e instanceof FA&&(e.format=this._forwardType(e.format));return e}_initialize(e){if(e)if(typeof e=="string"){const t=new o7(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 l=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 JC(f,v,l))))}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 l=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=l)}const s=this._compound_statement(),o=this._currentLine;return this._updateNode(new ZA(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 n7);else if(this._match(De.keywords.break)){const t=this._updateNode(new cO);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 uO);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 e7(t),e)}_while_statement(){if(!this._match(De.keywords.while))return null;const e=this._updateNode(new eO(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 w1(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 tO(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 Hc(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 DA(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 fm(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 rO(n.type===De.tokens.plus_plus?kd.increment:kd.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 nO(wA.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 lx(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 iO([],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 w1){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 sO(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 dm){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 AO(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 gO(n)))}}return e}_case_selectors(){const e=[];for(this._match(De.keywords.default)?e.push(this._updateNode(new dm)):e.push(this._shift_expression());this._match(De.tokens.comma);)this._match(De.keywords.default)?e.push(this._updateNode(new dm)):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 oO(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 i7(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 aO(e))}_short_circuit_or_expression(){let e=this._short_circuit_and_expr();for(;this._match(De.tokens.or_or);
109)e=this._updateNode(new fl(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 fl(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 fl(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 fl(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 fl(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 fl(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 fl(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 fl(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 fl(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 fl(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 cp(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 rh(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 tc(s,i)):this._updateNode(new ux(n,i))}if(this._context.constants.has(n)){const i=this._context.constants.get(n);return this._updateNode(new fO(n,i.value))}return this._updateNode(new fa(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 hO(n,i))}const e=this._type_decl(),t=this._argument_expression_list();return this._updateNode(new tc(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(),l=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 KC(l,A,o)))}this._consume(De.tokens.brace_right,"Expected '}' after struct body.");const i=this._currentLine,s=this._updateNode(new Gc(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 th&&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 l=this._updateNode(new fm(t.toString(),i,"","",s),n);return this._context.constants.set(l.name,l),l}_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 DA(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 Hc(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 ax(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 lO(e.toString(),t))}_enable_directive(){const e=this._consume(De.tokens.ident,"identity expected.");return this._updateNode(new t7(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 r7(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 cx(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 qC(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 hm(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 l=this._updateNode(new FA(s.toString(),t,n,i));return o&&this._deferArrayCountEval.push({arrayType:l,countNode:o}),l}return null}_texture_sampler_types(){if(this._match(De.sampler_type))return this._updateNode(new TA(this._previous().toString(),null,null));if(this._match(De.depth_texture_type))return this._updateNode(new TA(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 TA(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 TA(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 mO(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 _7 extends oc{constructor(e){super(),e&&this.update(e)}update(e){const t=new m7().parse(e);this.updateAST(t)}}function y7(r){const e={attributes:[],bindings:[]};let t;try{t=v7(r)}catch(s){return Yt.error(s.message)(),e}for(const s of t.uniforms){const o=[];for(const l of s.type?.members||[])o.push({name:l.name,type:QC(l.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 l=QC(o.type);e.attributes.push({name:o.name,location:Number(o.location),type:l})}}return e}function QC(r){return r.format?`${r.name}<${r.format.name}>`:r.name}function v7(r){try{return new _7(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 b7=1/Math.PI*180,x7=1/180*Math.PI,w7={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...w7}};const Es=globalThis.mathgl.config;function T7(r,{precision:e=Es.precision}={}){return r=I7(r),`${parseFloat(r.toPrecision(e))}`}function Ju(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function E7(r){return S7(r)}function C7(r){return pl(r)}function S7(r,e){return Ax(r,t=>t*x7,e)}function pl(r,e){return Ax(r,t=>t*b7,e)}function $c(r,e,t){return Ax(r,n=>Math.max(e,Math.min(t,n)))}function wl(r,e,t){return Ju(r)?r.map((n,i)=>wl(n,e[i],t)):t*e+(1-t)*r}function ga(r,e,t){const n=Es.EPSILON;t&&(Es.EPSILON=t);try{if(r===e)return!0;
vendor: 34,277 bytes, line 109
109if(Ju(r)&&Ju(e)){if(r.length!==e.length)return!1;for(let i=0;i<r.length;++i)if(!ga(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)<=Es.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{Es.EPSILON=n}}function I7(r){return Math.round(r/Es.EPSILON)*Es.EPSILON}function B7(r){return r.clone?r.clone():new Array(r.length)}function Ax(r,e,t){if(Ju(r)){const n=r;t=t||B7(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 gx 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:Ju(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Es)}formatString(e){let t="";for(let n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+T7(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(!ga(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(Es.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 P7(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 Zn(r){if(!Number.isFinite(r))throw new Error(`Invalid number ${JSON.stringify(r)}`);return r}function LA(r,e,t=""){if(Es.debug&&!P7(r,e))throw new Error(`math.gl: ${t} some fields set to invalid numbers'`);return r}function gl(r,e){if(!r)throw new Error(`math.gl assertion ${e}`)}class mx extends gx{get x(){return this[0]}set x(e){this[0]=Zn(e)}get y(){return this[1]}set y(e){this[1]=Zn(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 Zn(t)}dot(e){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return Zn(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 gl(e>=0&&e<this.ELEMENTS,"index is out of range"),Zn(this[e])}setComponent(e,t){return gl(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 kA=1e-6;let El=typeof Float32Array<"u"?Float32Array:Array;function M7(){const r=new El(2);return El!=Float32Array&&(r[0]=0,r[1]=0),r}function e3(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function R7(r,e){return r[0]=-e[0],r[1]=-e[1],r}function _O(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 O7(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 D7(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 yO(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 vO(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=M7();return function(e,t,n,i,s,o){let l,f;for(t||(t=2),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,l=n;l<f;l+=t)r[0]=e[l],r[1]=e[l+1],s(r,r,o),e[l]=r[0],e[l+1]=r[1];return e}})();function bO(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 xO(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 F7(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 L7(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 wO(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 _x extends mx{constructor(e=0,t=0){super(2),Ju(e)&&arguments.length===1?this.copy(e):(Es.debug&&(Zn(e),Zn(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 Es.debug&&(Zn(e.x),Zn(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 vO(this,this,e),this.check()}transformAsVector(e){return bO(this,this,e),this.check()}transformByMatrix3(e){return yO(this,this,e),this.check()}transformByMatrix2x3(e){return D7(this,this,e),this.check()}transformByMatrix2(e){return O7(this,this,e),this.check()}}function TO(){const r=new El(3);return El!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function EO(r){const e=r[0],t=r[1],n=r[2];return Math.sqrt(e*e+t*t+n*n)}function t3(r,e,t){const n=new El(3);return n[0]=r,n[1]=e,n[2]=t,n}function k7(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function N7(r){const e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function U7(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function z7(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 yx(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function pm(r,e,t){const n=e[0],i=e[1],s=e[2],o=t[0],l=t[1],f=t[2];return r[0]=i*f-s*l,r[1]=s*o-n*f,r[2]=n*l-i*o,r}function V7(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 vx(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 CO(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 SO(r,e,t){const n=t[0],i=t[1],s=t[2],o=t[3],l=e[0],f=e[1],A=e[2];let v=i*A-s*f,T=s*l-n*A,I=n*f-i*l,F=i*I-s*T,N=s*v-n*I,U=n*T-i*v;const $=o*2;return v*=$,T*=$,I*=$,F*=2,N*=2,U*=2,r[0]=l+v+F,r[1]=f+T+N,r[2]=A+I+U,r}function G7(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 j7(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 H7(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 W7(r,e){const t=r[0],n=r[1],i=r[2],s=e[0],o=e[1],l=e[2],f=Math.sqrt((t*t+n*n+i*i)*(s*s+o*o+l*l)),A=f&&yx(r,e)/f;return Math.acos(Math.min(Math.max(A,-1),1))}const IO=k7,BO=EO,pv=N7;(function(){const r=TO();return function(e,t,n,i,s,o){let l,f;for(t||(t=3),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,l=n;l<f;l+=t)r[0]=e[l],r[1]=e[l+1],r[2]=e[l+2],s(r,r,o),e[l]=r[0],e[l+1]=r[1],e[l+2]=r[2];return e}})();const Av=[0,0,0];let m0;class dt extends mx{static get ZERO(){return m0||(m0=new dt(0,0,0),Object.freeze(m0)),m0}constructor(e=0,t=0,n=0){super(-0,-0,-0),arguments.length===1&&Ju(e)?this.copy(e):(Es.debug&&(Zn(e),Zn(t),Zn(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 Es.debug&&(Zn(e.x),Zn(e.y),Zn(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]=Zn(e)}angle(e){return W7(this,e)}cross(e){return pm(this,this,e),this.check()}rotateX({radians:e,origin:t=Av}){return G7(this,this,t,e),this.check()}rotateY({radians:e,origin:t=Av}){return j7(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=Av}){return H7(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return vx(this,this,e),this.check()}transformAsVector(e){return xO(this,this,e),this.check()}transformByMatrix3(e){return CO(this,this,e),this.check()}transformByMatrix2(e){return F7(this,this,e),this.check()}transformByQuaternion(e){return SO(this,this,e),this.check()}}let _0;class bx extends mx{static get ZERO(){return _0||(_0=new bx(0,0,0,0),Object.freeze(_0)),_0}constructor(e=0,t=0,n=0,i=0){super(-0,-0,-0,-0),Ju(e)&&arguments.length===1?this.copy(e):(Es.debug&&(Zn(e),Zn(t),Zn(n),Zn(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 Es.debug&&(Zn(e.x),Zn(e.y),Zn(e.z),Zn(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]=Zn(e)}get w(){return this[3]}set w(e){this[3]=Zn(e)}transform(e){return vx(this,this,e),this.check()}transformByMatrix3(e){return wO(this,this,e),this.check()}transformByMatrix2(e){return L7(this,this,e),this.check()}transformByQuaternion(e){return SO(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}class PO extends gx{toString(){let e="[";if(Es.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]=Zn(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 $7(){const r=new El(9);return El!=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 X7(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 q7(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],f=e[6],A=e[7],v=e[8],T=v*o-l*A,I=-v*s+l*f,F=A*s-o*f;let N=t*T+n*I+i*F;return N?(N=1/N,r[0]=T*N,r[1]=(-v*n+i*A)*N,r[2]=(l*n-i*o)*N,r[3]=I*N,r[4]=(v*t-i*f)*N,r[5]=(-l*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 J7(r){const e=r[0],t=r[1],n=r[2],i=r[3],s=r[4],o=r[5],l=r[6],f=r[7],A=r[8];return e*(A*s-o*f)+t*(-A*i+o*l)+n*(f*i-s*l)}function r3(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],l=e[4],f=e[5],A=e[6],v=e[7],T=e[8],I=t[0],F=t[1],N=t[2],U=t[3],$=t[4],V=t[5],j=t[6],X=t[7],ue=t[8];return r[0]=I*n+F*o+N*A,r[1]=I*i+F*l+N*v,r[2]=I*s+F*f+N*T,r[3]=U*n+$*o+V*A,r[4]=U*i+$*l+V*v,r[5]=U*s+$*f+V*T,r[6]=j*n+X*o+ue*A,r[7]=j*i+X*l+ue*v,r[8]=j*s+X*f+ue*T,r}function K7(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],l=e[4],f=e[5],A=e[6],v=e[7],T=e[8],I=t[0],F=t[1];return r[0]=n,r[1]=i,r[2]=s,r[3]=o,r[4]=l,r[5]=f,r[6]=I*n+F*o+A,r[7]=I*i+F*l+v,r[8]=I*s+F*f+T,r}function Z7(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],l=e[4],f=e[5],A=e[6],v=e[7],T=e[8],I=Math.sin(t),F=Math.cos(t);return r[0]=F*n+I*o,r[1]=F*i+I*l,r[2]=F*s+I*f,r[3]=F*o-I*n,r[4]=F*l-I*i,r[5]=F*f-I*s,r[6]=A,r[7]=v,r[8]=T,r}function n3(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 Y7(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=t+t,l=n+n,f=i+i,A=t*o,v=n*o,T=n*l,I=i*o,F=i*l,N=i*f,U=s*o,$=s*l,V=s*f;return r[0]=1-T-N,r[3]=v-V,r[6]=I+$,r[1]=v+V,r[4]=1-A-N,r[7]=F-U,r[2]=I-$,r[5]=F+U,r[8]=1-A-T,r}var E1;(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"})(E1||(E1={}));const Q7=Object.freeze([1,0,0,0,1,0,0,0,1]);class Oi extends PO{static get IDENTITY(){return tV()}static get ZERO(){return eV()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return E1}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(Q7)}fromObject(e){return this.check()}fromQuaternion(e){return Y7(this,e),this.check()}set(e,t,n,i,s,o,l,f,A){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=s,this[5]=o,this[6]=l,this[7]=f,this[8]=A,this.check()}setRowMajor(e,t,n,i,s,o,l,f,A){return this[0]=e,this[1]=i,this[2]=l,this[3]=t,this[4]=s,this[5]=f,this[6]=n,this[7]=o,this[8]=A,this.check()}determinant(){return J7(this)}transpose(){return X7(this,this),this.check()}invert(){return q7(this,this),this.check()}multiplyLeft(e){return r3(this,e,this),this.check()}multiplyRight(e){return r3(this,this,e),this.check()}rotate(e){return Z7(this,this,e),this.check()}scale(e){return Array.isArray(e)?n3(this,this,e):n3(this,this,[e,e]),this.check()}translate(e){return K7(this,this,e),this.check()}transform(e,t){let n;switch(e.length){case 2:n=yO(t||[-0,-0],e,this);break;case 3:n=CO(t||[-0,-0,-0],e,this);break;case 4:n=wO(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return LA(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 y0,v0=null;function eV(){return y0||(y0=new Oi([0,0,0,0,0,0,0,0,0]),Object.freeze(y0)),y0}function tV(){return v0||(v0=new Oi,Object.freeze(v0)),v0}function rV(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 nV(r,e){if(r===e){const t=e[1],n=e[2],i=e[3],s=e[6],o=e[7],l=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]=l}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 C1(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],f=e[6],A=e[7],v=e[8],T=e[9],I=e[10],F=e[11],N=e[12],U=e[13],$=e[14],V=e[15],j=t*l-n*o,X=t*f-i*o,ue=t*A-s*o,K=n*f-i*l,se=n*A-s*l,Ee=i*A-s*f,Ue=v*U-T*N,de=v*$-I*N,me=v*V-F*N,pe=T*$-I*U,W=T*V-F*U,re=I*V-F*$;let Ce=j*re-X*W+ue*pe+K*me-se*de+Ee*Ue;return Ce?(Ce=1/Ce,r[0]=(l*re-f*W+A*pe)*Ce,r[1]=(i*W-n*re-s*pe)*Ce,r[2]=(U*Ee-$*se+V*K)*Ce,r[3]=(I*se-T*Ee-F*K)*Ce,r[4]=(f*me-o*re-A*de)*Ce,r[5]=(t*re-i*me+s*de)*Ce,r[6]=($*ue-N*Ee-V*X)*Ce,r[7]=(v*Ee-I*ue+F*X)*Ce,r[8]=(o*W-l*me+A*Ue)*Ce,r[9]=(n*me-t*W-s*Ue)*Ce,r[10]=(N*se-U*ue+V*j)*Ce,r[11]=(T*ue-v*se-F*j)*Ce,r[12]=(l*de-o*pe-f*Ue)*Ce,r[13]=(t*pe-n*de+i*Ue)*Ce,r[14]=(U*X-N*K-$*j)*Ce,r[15]=(v*K-T*X+I*j)*Ce,r):null}function iV(r){const e=r[0],t=r[1],n=r[2],i=r[3],s=r[4],o=r[5],l=r[6],f=r[7],A=r[8],v=r[9],T=r[10],I=r[11],F=r[12],N=r[13],U=r[14],$=r[15],V=e*o-t*s,j=e*l-n*s,X=t*l-n*o,ue=A*N-v*F,K=A*U-T*F,se=v*U-T*N,Ee=e*se-t*K+n*ue,Ue=s*se-o*K+l*ue,de=A*X-v*j+T*V,me=F*X-N*j+U*V;return f*Ee-i*Ue+$*de-I*me}function Zf(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],l=e[4],f=e[5],A=e[6],v=e[7],T=e[8],I=e[9],F=e[10],N=e[11],U=e[12],$=e[13],V=e[14],j=e[15];let X=t[0],ue=t[1],K=t[2],se=t[3];return r[0]=X*n+ue*l+K*T+se*U,r[1]=X*i+ue*f+K*I+se*$,r[2]=X*s+ue*A+K*F+se*V,r[3]=X*o+ue*v+K*N+se*j,X=t[4],ue=t[5],K=t[6],se=t[7],r[4]=X*n+ue*l+K*T+se*U,r[5]=X*i+ue*f+K*I+se*$,r[6]=X*s+ue*A+K*F+se*V,r[7]=X*o+ue*v+K*N+se*j,X=t[8],ue=t[9],K=t[10],se=t[11],r[8]=X*n+ue*l+K*T+se*U,r[9]=X*i+ue*f+K*I+se*$,r[10]=X*s+ue*A+K*F+se*V,r[11]=X*o+ue*v+K*N+se*j,X=t[12],ue=t[13],K=t[14],se=t[15],r[12]=X*n+ue*l+K*T+se*U,r[13]=X*i+ue*f+K*I+se*$,r[14]=X*s+ue*A+K*F+se*V,r[15]=X*o+ue*v+K*N+se*j,r}function $m(r,e,t){const n=t[0],i=t[1],s=t[2];let o,l,f,A,v,T,I,F,N,U,$,V;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],l=e[1],f=e[2],A=e[3],v=e[4],T=e[5],I=e[6],F=e[7],N=e[8],U=e[9],$=e[10],V=e[11],r[0]=o,r[1]=l,r[2]=f,r[3]=A,r[4]=v,r[5]=T,r[6]=I,r[7]=F,r[8]=N,r[9]=U,r[10]=$,r[11]=V,r[12]=o*n+v*i+N*s+e[12],r[13]=l*n+T*i+U*s+e[13],r[14]=f*n+I*i+$*s+e[14],r[15]=A*n+F*i+V*s+e[15]),r}function xx(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 sV(r,e,t,n){let i=n[0],s=n[1],o=n[2],l=Math.sqrt(i*i+s*s+o*o),f,A,v,T,I,F,N,U,$,V,j,X,ue,K,se,Ee,Ue,de,me,pe,W,re,Ce,et;return l<kA?null:(l=1/l,i*=l,s*=l,o*=l,A=Math.sin(t),f=Math.cos(t),v=1-f,T=e[0],I=e[1],F=e[2],N=e[3],U=e[4],$=e[5],V=e[6],j=e[7],X=e[8],ue=e[9],K=e[10],se=e[11],Ee=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,Ce=s*o*v-i*A,et=o*o*v+f,r[0]=T*Ee+U*Ue+X*de,r[1]=I*Ee+$*Ue+ue*de,r[2]=F*Ee+V*Ue+K*de,r[3]=N*Ee+j*Ue+se*de,r[4]=T*me+U*pe+X*W,r[5]=I*me+$*pe+ue*W,r[6]=F*me+V*pe+K*W,r[7]=N*me+j*pe+se*W,r[8]=T*re+U*Ce+X*et,r[9]=I*re+$*Ce+ue*et,r[10]=F*re+V*Ce+K*et,r[11]=N*re+j*Ce+se*et,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function MO(r,e,t){const n=Math.sin(t),i=Math.cos(t),s=e[4],o=e[5],l=e[6],f=e[7],A=e[8],v=e[9],T=e[10],I=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]=l*i+T*n,r[7]=f*i+I*n,r[8]=A*i-s*n,r[9]=v*i-o*n,r[10]=T*i-l*n,r[11]=I*i-f*n,r}function oV(r,e,t){const n=Math.sin(t),i=Math.cos(t),s=e[0],o=e[1],l=e[2],f=e[3],A=e[8],v=e[9],T=e[10],I=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]=l*i-T*n,r[3]=f*i-I*n,r[8]=s*n+A*i,r[9]=o*n+v*i,r[10]=l*n+T*i,r[11]=f*n+I*i,r}function RO(r,e,t){const n=Math.sin(t),i=Math.cos(t),s=e[0],o=e[1],l=e[2],f=e[3],A=e[4],v=e[5],T=e[6],I=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]=l*i+T*n,r[3]=f*i+I*n,r[4]=A*i-s*n,r[5]=v*i-o*n,r[6]=T*i-l*n,r[7]=I*i-f*n,r}function aV(r,e){const t=e[0],n=e[1],i=e[2],s=e[4],o=e[5],l=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+l*l),r[2]=Math.sqrt(f*f+A*A+v*v),r}function lV(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=t+t,l=n+n,f=i+i,A=t*o,v=n*o,T=n*l,I=i*o,F=i*l,N=i*f,U=s*o,$=s*l,V=s*f;return r[0]=1-T-N,r[1]=v+V,r[2]=I-$,r[3]=0,r[4]=v-V,r[5]=1-A-N,r[6]=F+U,r[7]=0,r[8]=I+$,r[9]=F-U,r[10]=1-A-T,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function cV(r,e,t,n,i,s,o){const l=1/(t-e),f=1/(i-n),A=1/(s-o);return r[0]=s*2*l,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)*l,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 uV(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 fV=uV;function hV(r,e,t,n,i,s,o){const l=1/(e-t),f=1/(n-i),A=1/(s-o);return r[0]=-2*l,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)*l,r[13]=(i+n)*f,r[14]=(o+s)*A,r[15]=1,r}const dV=hV;function pV(r,e,t,n){let i,s,o,l,f,A,v,T,I,F;const N=e[0],U=e[1],$=e[2],V=n[0],j=n[1],X=n[2],ue=t[0],K=t[1],se=t[2];return Math.abs(N-ue)<kA&&Math.abs(U-K)<kA&&Math.abs($-se)<kA?rV(r):(T=N-ue,I=U-K,F=$-se,i=1/Math.sqrt(T*T+I*I+F*F),T*=i,I*=i,F*=i,s=j*F-X*I,o=X*T-V*F,l=V*I-j*T,i=Math.sqrt(s*s+o*o+l*l),i?(i=1/i,s*=i,o*=i,l*=i):(s=0,o=0,l=0),f=I*l-F*o,A=F*s-T*l,v=T*o-I*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]=T,r[3]=0,r[4]=o,r[5]=A,r[6]=I,r[7]=0,r[8]=l,r[9]=v,r[10]=F,r[11]=0,r[12]=-(s*N+o*U+l*$),r[13]=-(f*N+A*U+v*$),r[14]=-(T*N+I*U+F*$),r[15]=1,r)}function AV(){const r=new El(4);return El!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function gV(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 wx(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 mV(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 _V(r){const e=r[0],t=r[1],n=r[2],i=r[3];return e*e+t*t+n*n+i*i}function yV(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 vV(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function bV(r,e,t,n){const i=e[0],s=e[1],o=e[2],l=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]=l+n*(t[3]-l),r}function Ep(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 xV(r,e,t){const n=e[0],i=e[1],s=e[2],o=t[0],l=t[1],f=t[2],A=t[3],v=A*n+l*s-f*i,T=A*i+f*n-o*s,I=A*s+o*i-l*n,F=-o*n-l*i-f*s;return r[0]=v*A+F*-o+T*-f-I*-l,r[1]=T*A+F*-l+I*-o-v*-f,r[2]=I*A+F*-f+v*-l-T*-o,r[3]=e[3],r}(function(){const r=AV();return function(e,t,n,i,s,o){let l,f;for(t||(t=4),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,l=n;l<f;l+=t)r[0]=e[l],r[1]=e[l+1],r[2]=e[l+2],r[3]=e[l+3],s(r,r,o),e[l]=r[0],e[l+1]=r[1],e[l+2]=r[2],e[l+3]=r[3];return e}})();var S1;(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"})(S1||(S1={}));const wV=45*Math.PI/180,TV=1,gv=.1,mv=500,EV=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class vn extends PO{static get IDENTITY(){return SV()}static get ZERO(){return CV()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return S1}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,l,f,A,v,T,I,F,N,U,$){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=s,this[5]=o,this[6]=l,this[7]=f,this[8]=A,this[9]=v,this[10]=T,this[11]=I,this[12]=F,this[13]=N,this[14]=U,this[15]=$,this.check()}setRowMajor(e,t,n,i,s,o,l,f,A,v,T,I,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]=l,this[10]=T,this[11]=U,this[12]=i,this[13]=f,this[14]=I,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(EV)}fromObject(e){return this.check()}fromQuaternion(e){return lV(this,e),this.check()}frustum(e){const{left:t,right:n,bottom:i,top:s,near:o=gv,far:l=mv}=e;return l===1/0?IV(this,t,n,i,s,o):cV(this,t,n,i,s,o,l),this.check()}lookAt(e){const{eye:t,center:n=[0,0,0],up:i=[0,1,0]}=e;return pV(this,t,n,i),this.check()}ortho(e){const{left:t,right:n,bottom:i,top:s,near:o=gv,far:l=mv}=e;return dV(this,t,n,i,s,o,l),this.check()}orthographic(e){const{fovy:t=wV,aspect:n=TV,focalDistance:i=1,near:s=gv,far:o=mv}=e;i3(t);const l=t/2,f=i*Math.tan(l),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 i3(t),fV(this,t,n,i,s),this.check()}determinant(){return iV(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 nV(this,this),this.check()}invert(){return C1(this,this),this.check()}multiplyLeft(e){return Zf(this,e,this),this.check()}multiplyRight(e){return Zf(this,this,e),this.check()}rotateX(e){return MO(this,this,e),this.check()}rotateY(e){return oV(this,this,e),this.check()}rotateZ(e){return RO(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return sV(this,this,e,t),this.check()}scale(e){return xx(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return $m(this,this,e),this.check()}transform(e,t){return e.length===4?(t=Ep(t||[-0,-0,-0,-0],e,this),LA(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:n}=e;let i;switch(n){case 2:i=vO(t||[-0,-0],e,this);break;case 3:i=vx(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return LA(i,e.length),i}transformAsVector(e,t){let n;switch(e.length){case 2:n=bO(t||[-0,-0],e,this);break;case 3:n=xO(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return LA(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 b0,x0;function CV(){return b0||(b0=new vn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(b0)),b0}function SV(){return x0||(x0=new vn,Object.freeze(x0)),x0}function i3(r){if(r>Math.PI*2)throw Error("expected radians")}function IV(r,e,t,n,i,s){const o=2*s/(t-e),l=2*s/(i-n),f=(t+e)/(t-e),A=(i+n)/(i-n),v=-1,T=-1,I=-2*s;return r[0]=o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=f,r[9]=A,r[10]=v,r[11]=T,r[12]=0,r[13]=0,r[14]=I,r[15]=0,r}function s3(){const r=new El(4);return El!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function BV(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function OO(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 o3(r,e,t){const n=e[0],i=e[1],s=e[2],o=e[3],l=t[0],f=t[1],A=t[2],v=t[3];return r[0]=n*v+o*l+i*A-s*f,r[1]=i*v+o*f+s*l-n*A,r[2]=s*v+o*A+n*f-i*l,r[3]=o*v-n*l-i*f-s*A,r}function PV(r,e,t){t*=.5;const n=e[0],i=e[1],s=e[2],o=e[3],l=Math.sin(t),f=Math.cos(t);return r[0]=n*f+o*l,r[1]=i*f+s*l,r[2]=s*f-i*l,r[3]=o*f-n*l,r}function MV(r,e,t){t*=.5;const n=e[0],i=e[1],s=e[2],o=e[3],l=Math.sin(t),f=Math.cos(t);return r[0]=n*f-s*l,r[1]=i*f+o*l,r[2]=s*f+n*l,r[3]=o*f-i*l,r}function RV(r,e,t){t*=.5;const n=e[0],i=e[1],s=e[2],o=e[3],l=Math.sin(t),f=Math.cos(t);return r[0]=n*f+i*l,r[1]=i*f-n*l,r[2]=s*f+o*l,r[3]=o*f-s*l,r}function OV(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 Am(r,e,t,n){const i=e[0],s=e[1],o=e[2],l=e[3];let f=t[0],A=t[1],v=t[2],T=t[3],I,F,N,U,$;return I=i*f+s*A+o*v+l*T,I<0&&(I=-I,f=-f,A=-A,v=-v,T=-T),1-I>kA?(F=Math.acos(I),$=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*l+U*T,r}function DV(r,e){const t=e[0],n=e[1],i=e[2],s=e[3],o=t*t+n*n+i*i+s*s,l=o?1/o:0;return r[0]=-t*l,r[1]=-n*l,r[2]=-i*l,r[3]=s*l,r}function FV(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function DO(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 LV=gV,kV=wx,NV=vV,UV=bV,zV=mV,VV=_V,FO=yV,GV=(function(){const r=TO(),e=t3(1,0,0),t=t3(0,1,0);return function(n,i,s){const o=yx(i,s);return o<-.999999?(pm(r,e,i),BO(r)<1e-6&&pm(r,t,i),z7(r,r),OO(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(pm(r,i,s),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,FO(n,n))}})();(function(){const r=s3(),e=s3();return function(t,n,i,s,o,l){return Am(r,n,o,l),Am(e,i,s,l),Am(t,r,e,2*l*(1-l)),t}})();(function(){const r=$7();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],FO(e,DO(e,r))}})();const jV=[0,0,0,1];class YA extends gx{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 DO(this,e),this.check()}fromAxisRotation(e,t){return OO(this,e,t),this.check()}identity(){return BV(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]=Zn(e)}get y(){return this[1]}set y(e){this[1]=Zn(e)}get z(){return this[2]}set z(e){this[2]=Zn(e)}get w(){return this[3]}set w(e){this[3]=Zn(e)}len(){return zV(this)}lengthSquared(){return VV(this)}dot(e){return NV(this,e)}rotationTo(e,t){return GV(this,e,t),this.check()}add(e){return LV(this,this,e),this.check()}calculateW(){return OV(this,this),this.check()}conjugate(){return FV(this,this),this.check()}invert(){return DV(this,this),this.check()}lerp(e,t,n){return n===void 0?this.lerp(this,e,t):(UV(this,e,t,n),this.check())}multiplyRight(e){return o3(this,this,e),this.check()}multiplyLeft(e){return o3(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 PV(this,this,e),this.check()}rotateY(e){return MV(this,this,e),this.check()}rotateZ(e){return RV(this,this,e),this.check()}scale(e){return kV(this,this,e),this.check()}slerp(e,t,n){let i,s,o;switch(arguments.length){case 1:({start:i=jV,target:s,ratio:o}=e);break;case 2:i=this,s=e,o=t;break;default:i=e,s=t,o=n}return Am(this,i,s,o),this.check()}transformVector4(e,t=new bx){return xV(t,e,this),LA(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 HV=.1,WV=1e-12,LO=1e-15,$V=1e-20;function kO(r,e=[],t=0){const n=Math.fround(r),i=r-n;
109return e[t]=n,e[t+1]=i,e}function XV(r){return r-Math.fround(r)}function qV(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;kO(r[n*4+t],e,i*2)}return e}const JV=`#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`,KV={name:"fp32",vs:JV},ZV=` 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`,YV={ONE:1},QV={name:"fp64arithmetic",vs:ZV,defaultUniforms:YV,uniformTypes:{ONE:"f32"},fp64ify:kO,fp64LowPart:XV,fp64ifyMatrix4:qV},eG=[0,1,1,1],tG=`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`,rG=`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`,a3={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:eG},vs:tG,fs:rG,getUniforms:nG};function nG(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 l3=`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`,iG=`// #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`,NO=3,sG=255;var QA;(function(r){r[r.POINT=0]="POINT",r[r.DIRECTIONAL=1]="DIRECTIONAL"})(QA||(QA={}));const Zd={props:{},uniforms:{},name:"lighting",defines:{MAX_LIGHTS:NO},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:QA.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:iG,vs:l3,fs:l3,getUniforms:oG};function oG(r,e={}){if(r=r&&{...r},!r)return{...Zd.defaultUniforms};r.lights&&(r={...r,...lG(r.lights),lights:void 0});const{ambientLight:t,pointLights:n,directionalLights:i}=r||{};if(!(t||n&&n.length>0||i&&i.length>0))return{...Zd.defaultUniforms,enabled:0};const o={...Zd.defaultUniforms,...e,...aG({ambientLight:t,pointLights:n,directionalLights:i})};return r.enabled!==void 0&&(o.enabled=r.enabled?1:0),o}function aG({ambientLight:r,pointLights:e=[],directionalLights:t=[]}){const n={};n.ambientLightColor=_v(r);let i=0;for(const s of e){n.lightType=QA.POINT;const o=i;n[`lightColor${o}`]=_v(s),n[`lightPosition${o}`]=s.position,n[`lightAttenuation${o}`]=s.attenuation||[1,0,0],i++}for(const s of t){n.lightType=QA.DIRECTIONAL;const o=i;n[`lightColor${o}`]=_v(s),n[`lightDirection${o}`]=s.direction,i++}return i>NO&&Yt.warn("MAX_LIGHTS exceeded")(),n.directionalLightCount=t.length,n.pointLightCount=e.length,n}function lG(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 _v(r={}){const{color:e=[0,0,0],intensity:t=1}=r;return e.map(n=>n*t/sG)}const UO=`uniform phongMaterialUniforms { 680 uniform float ambient; 681 uniform float diffuse; 682 uniform float shininess; 683 uniform vec3 specularColor; 684} material; 685`,zO=`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`,VO=`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`,M_={props:{},name:"gouraudMaterial",vs:zO.replace("phongMaterial","gouraudMaterial"),fs:UO.replace("phongMaterial","gouraudMaterial"),source:VO.replaceAll("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:1},dependencies:[Zd],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)),{...M_.defaultUniforms,...e}}}
815,Tx={name:"phongMaterial",dependencies:[Zd],source:VO,vs:UO,fs:zO,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)),{...Tx.defaultUniforms,...e}}},cG=`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`,uG=`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`,c3=`uniform pbrProjectionUniforms { 1250 mat4 modelViewProjectionMatrix; 1251 mat4 modelMatrix; 1252 mat4 normalMatrix; 1253 vec3 camera; 1254} pbrProjection; 1255`,fG={name:"pbrProjection",vs:c3,fs:c3,getUniforms:r=>r,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}},Ex={props:{},uniforms:{}
1255,name:"pbrMaterial",dependencies:[Zd,fG],vs:cG,fs:uG,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>"}},u3=`uniform layerUniforms { 1256 uniform float opacity; 1257} layer; 1258`,hG={name:"layer",vs:u3,fs:u3,getUniforms:r=>({opacity:Math.pow(r.opacity,1/2.2)}),uniformTypes:{opacity:"f32"}},dG=`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`,GO="#define SMOOTH_EDGE_RADIUS 0.5",pG=`${GO} 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`,AG=`${GO} 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`,jO={name:"geometry",source:dG,vs:pG,fs:AG},gG=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 Ts;(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"})(Ts||(Ts={}));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 mG="compute",_G="auto",I1="manipulation",gm="none",B1="pan-x",P1="pan-y";function yG(r){if(r.includes(gm))return gm;const e=r.includes(B1),t=r.includes(P1);return e&&t?gm:e||t?e?B1:P1:r.includes(I1)?I1:_G}class vG{constructor(e,t){this.actions="",this.manager=e,this.set(t)}set(e){e===mG&&(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 yG(e.join(" "))}}function Xm(r){return r.trim().split(/\s+/g)}function yv(r,e,t){if(r)for(const n of Xm(e))r.addEventListener(n,t,!1)}function vv(r,e,t){if(r)for(const n of Xm(e))r.removeEventListener(n,t,!1)}function f3(r){return(r.ownerDocument||r).defaultView}function bG(r,e){let t=r;for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function HO(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 h3(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:HO(e),deltaX:r.deltaX,deltaY:r.deltaY}}function WO(r,e){const t=e.x-r.x,n=e.y-r.y;return Math.sqrt(t*t+n*n)}function d3(r,e){const t=e.clientX-r.clientX,n=e.clientY-r.clientY;return Math.sqrt(t*t+n*n)}function xG(r,e){const t=e.x-r.x,n=e.y-r.y;return Math.atan2(n,t)*180/Math.PI}function p3(r,e){const t=e.clientX-r.clientX,n=e.clientY-r.clientY;return Math.atan2(n,t)*180/Math.PI}function $O(r,e){return r===e?Ts.None:Math.abs(r)>=Math.abs(e)?r<0?Ts.Left:Ts.Right:e<0?Ts.Up:Ts.Down}function wG(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 XO(r,e,t){return{x:e/r||0,y:t/r||0}}function TG(r,e){return d3(e[0],e[1])/d3(r[0],r[1])}function EG(r,e){return p3(e[1],e[0])-p3(r[1],r[0])}function CG(r,e){const t=r.lastInterval||e,n=e.timeStamp-t.timeStamp;let i,s,o,l;if(e.eventType!==As.Cancel&&(n>gG||t.velocity===void 0)){const f=e.deltaX-t.deltaX,A=e.deltaY-t.deltaY,v=XO(n,f,A);s=v.x,o=v.y,i=Math.abs(v.x)>Math.abs(v.y)?v.x:v.y,l=$O(f,A),r.lastInterval=e}else i=t.velocity,s=t.velocityX,o=t.velocityY,l=t.direction;e.velocity=i,e.velocityX=s,e.velocityY=o,e.direction=l}function SG(r,e){const{session:t}=r,{pointers:n}=e,{length:i}=n;t.firstInput||(t.firstInput=h3(e)),i>1&&!t.firstMultiple?t.firstMultiple=h3(e):i===1&&(t.firstMultiple=!1);const{firstInput:s,firstMultiple:o}=t,l=o?o.center:s.center,f=e.center=HO(n);e.timeStamp=Date.now(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=
1313xG(l,f),e.distance=WO(l,f);const{deltaX:A,deltaY:v}=wG(t,e);e.deltaX=A,e.deltaY=v,e.offsetDirection=$O(e.deltaX,e.deltaY);const T=XO(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=T.x,e.overallVelocityY=T.y,e.overallVelocity=Math.abs(T.x)>Math.abs(T.y)?T.x:T.y,e.scale=o?TG(o.pointers,n):1,e.rotation=o?EG(o.pointers,n):0,e.maxPointers=t.prevInput?e.pointers.length>t.prevInput.maxPointers?e.pointers.length:t.prevInput.maxPointers:e.pointers.length;let I=r.element;return bG(e.srcEvent.target,I)&&(I=e.srcEvent.target),e.target=I,CG(t,e),e}function IG(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 l=SG(r,t);r.emit("hammer.input",l),r.recognize(l),r.session.prevInput=l}let BG=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){IG(this.manager,e,t)}init(){yv(this.element,this.evEl,this.domHandler),yv(this.target,this.evTarget,this.domHandler),yv(f3(this.element),this.evWin,this.domHandler)}destroy(){vv(this.element,this.evEl,this.domHandler),vv(this.target,this.evTarget,this.domHandler),vv(f3(this.element),this.evWin,this.domHandler)}};const PG={pointerdown:As.Start,pointermove:As.Move,pointerup:As.End,pointercancel:As.Cancel,pointerout:As.Cancel},MG="pointerdown",RG="pointermove pointerup pointercancel";class OG extends BG{constructor(e){super(e),this.evEl=MG,this.evWin=RG,this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){const{store:t}=this;let n=!1;const i=PG[e.type],s=e.pointerType,o=s==="touch";let l=t.findIndex(f=>f.pointerId===e.pointerId);i&As.Start&&(e.buttons||o)?l<0&&(t.push(e),l=t.length-1):i&(As.End|As.Cancel)&&(n=!0),!(l<0)&&(t[l]=e,this.callback(i,{pointers:t,changedPointers:[e],eventType:i,pointerType:s,srcEvent:e}),n&&t.splice(l,1))}}const DG=["","webkit","Moz","MS","ms","o"];function FG(r,e){const t=e[0].toUpperCase()+e.slice(1);for(const n of DG){const i=n?n+t:e;if(i in r)return i}}const LG=1,A3=2,g3={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}};let kG=class{constructor(e,t){this.options={...g3,...t,cssProps:{...g3.cssProps,...t.cssProps},inputTarget:t.inputTarget||e},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new OG(this),this.touchAction=new vG(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?A3:LG}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!==A3&&(!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 Xm(e))n[i]=n[i]||[],n[i].push(t)}off(e,t){if(!e)return;const{handlers:n}=this;for(const i of Xm(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=FG(t.style,n);e?(this.oldCssProps[s]=t.style[s],t.style[s]=i):t.style[s]=this.oldCssProps[s]||""}e||(this.oldCssProps={})}}},NG=1;function UG(){return NG++}function m3(r){return r&yn.Cancelled?"cancel":r&yn.Ended?"end":r&yn.Changed?"move":r&yn.Began?"
1313start":""}class qO{constructor(e){this.options=e,this.id=UG(),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+m3(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+m3(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 JO extends qO{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 _3 extends qO{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[I1]}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,l=!this.pCenter||WO(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!l||!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 zG=["","start","move","end","cancel","up","down","left","right"];class y3 extends JO{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:Ts.All,...e}),this.pX=null,this.pY=null}getTouchAction(){const{options:{direction:e}}=this,t=[];return e&Ts.Horizontal&&t.push(P1),e&Ts.Vertical&&t.push(B1),t}getEventNames(){return zG.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,l=e.deltaY;return s&t.direction||(t.direction&Ts.Horizontal?(s=o===0?Ts.None:o<0?Ts.Left:Ts.Right,n=o!==this.pX,i=Math.abs(e.deltaX)):(s=l===0?Ts.None:l<0?Ts.Up:Ts.Down,n=l!==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=Ts[e.direction].toLowerCase();t&&(e.additionalEvent=this.options.event+t),super.emit(e)}}const VG=["","start","move","end","cancel","in","out"];class GG extends JO{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[gm]}getEventNames(){return VG.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 R_=class{constructor(e,t,n){this.element=e,this.callback=t,this.options=n}};const jG=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",HG=jG.indexOf("firefox")!==-1,v3=4.000244140625,WG=40,$G=.25;let XG=class extends R_{constructor(e,t,n){super(e,t,{enable:!0,...n}),this.handleEvent=i=>{if(!this.options.enable)return;let s=i.deltaY;globalThis.WheelEvent&&(HG&&i.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(s/=globalThis.devicePixelRatio),i.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(s*=WG)),s!==0&&s%v3===0&&(s=Math.floor(s/v3)),i.shiftKey&&s&&(s=s*$G),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 b3=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"];let qG=class extends R_{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,b3.forEach(s=>e.addEventListener(s,this.handleEvent))}destroy(){b3.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 x3=["keydown","keyup"];let JG=class extends R_{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",x3.forEach(i=>e.addEventListener(i,this.handleEvent))}destroy(){x3.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){e==="keydown"&&(this.enableDownEvent=t),e==="keyup"&&(this.enableUpEvent=t)}},KG=class extends R_{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 w3=1,M1=2,T3=4,ZG={pointerdown:w3,pointermove:M1,pointerup:T3,mousedown:w3,mousemove:M1,mouseup:T3},YG=0,QG=1,ej=2,tj=1,rj=2,nj=4;function ij(r){const e=ZG[r.srcEvent.type];if(!e)return null;const{buttons:t,button:n}=r.srcEvent;let i=!1,s=!1,o=!1;return e===M1?(i=!!(t&tj),s=!!(t&nj),o=!!(t&rj)):(i=n===YG,s=n===QG,o=n===ej),{leftButton:i,middleButton:s,rightButton:o}}function sj(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 oj={srcElement:"root",priority:0};let aj=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:l}=this,f={...oj,...n};let A=l.get(f.srcElement);A||(A=[],l.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 T=A.length-1;for(;T>=0&&!(A[T].priority>=v.priority);)T--;A.splice(T+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 l=i.get(o.srcElement);l.splice(l.indexOf(o),1),l.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},l=[];for(let f=0;f<n.length;f++){const{type:A,handler:v,once:T}=n[f];if(v({...e,type:A,stopPropagation:s,stopImmediatePropagation:o}),T&&l.push(n[f]),i)break}for(let f=0;f<l.length;f++){const{type:A,handler:v}=l[f];this.remove(A,v)}
1313}}_normalizeEvent(e){const t=this.eventManager.getElement();return{...e,...ij(e),...sj(e,t),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:t}}};function lj(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 cj=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 kG(e,this.options);for(const n of this.options.recognizers){const{recognizer:i,recognizeWith:s,requireFailure:o}=lj(n);this.manager.add(i),s&&i.recognizeWith(s),o&&i.requireFailure(o)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new XG(e,this._onOtherEvent,{enable:!1}),this.moveInput=new qG(e,this._onOtherEvent,{enable:!1}),this.keyInput=new JG(e,this._onOtherEvent,{enable:!1,tabIndex:t.tabIndex}),this.contextmenuInput=new KG(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:l}=this;if(!o)return;let f=l.get(e);if(!f){const A=this._getRecognizerName(e)||e;f=new aj(this,A),l.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 l of n.values())if(l.recognizerName===s&&!l.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:()=>(Zr.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});const ha={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},Po={common:0,meters:1,pixels:2},R1={click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},E3={multipan:[y3,{threshold:10,direction:Ts.Vertical,pointers:2}],pinch:[GG,{},null,["multipan"]],pan:[y3,{threshold:1},["pinch"],["multipan"]],dblclick:[_3,{event:"dblclick",taps:2}],click:[_3,{event:"click"},null,["dblclick"]]};function uj(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 dg(r){let e={},t;return n=>{for(const i in n)if(!uj(n[i],e[i])){t=r(n),e=n;break}return t}}const C3=[0,0,0,0],fj=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],KO=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],hj=[0,0,0],ZO=[0,0,0],dj=dg(gj);function YO(r,e,t=ZO){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 ha.WEB_MERCATOR:(e===Qr.LNGLAT||e===Qr.CARTESIAN)&&(i=[0,0,0],s=!1);break;case ha.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 ha.IDENTITY:n=r.position.map(Math.fround),n[2]=n[2]||0;break;case ha.GLOBE:s=!1,i=null;break;default:s=!1}return{geospatialOrigin:i,shaderCoordinateOrigin:n,offsetMode:s}}function pj(r,e,t){const{viewMatrixUncentered:n,projectionMatrix:i}=r;let{viewMatrix:s,viewProjectionMatrix:o}=r,l=C3,f=C3,A=r.cameraPosition;const{geospatialOrigin:v,shaderCoordinateOrigin:T,offsetMode:I}=YO(r,e,t);return I&&(f=r.projectPosition(v||T),A=[A[0]-f[0],A[1]-f[1],A[2]-f[2]],f[3]=1,l=Ep([],f,o),s=n||s,o=Zf([],i,s),o=Zf
vendor: 8,303 bytes, lines 1313-1504
1313([],o,fj)),{viewMatrix:s,viewProjectionMatrix:o,projectionCenter:l,originCommon:f,cameraPosCommon:A,shaderCoordinateOrigin:T,geospatialOrigin:v}}function Aj({viewport:r,devicePixelRatio:e=1,modelMatrix:t=null,coordinateSystem:n=Qr.DEFAULT,coordinateOrigin:i=ZO,autoWrapLongitude:s=!1}){n===Qr.DEFAULT&&(n=r.isGeospatial?Qr.LNGLAT:Qr.CARTESIAN);const o=dj({viewport:r,devicePixelRatio:e,coordinateSystem:n,coordinateOrigin:i});return o.wrapLongitude=s,o.modelMatrix=t||KO,o}function gj({viewport:r,devicePixelRatio:e,coordinateSystem:t,coordinateOrigin:n}){const{projectionCenter:i,viewProjectionMatrix:s,originCommon:o,cameraPosCommon:l,shaderCoordinateOrigin:f,geospatialOrigin:A}=pj(r,t,n),v=r.getDistanceScales(),T=[r.width*e,r.height*e],I=Ep([],[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:T,devicePixelRatio:e,focalDistance:I,commonUnitsPerMeter:v.unitsPerMeter,commonUnitsPerWorldUnit:v.unitsPerMeter,commonUnitsPerWorldUnit2:hj,scale:r.scale,wrapLongitude:!1,viewProjectionMatrix:s,modelMatrix:KO,cameraPosition:l};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.commonUnitsPerWorldUnit2=[0,0,N.unitsPerMeter2[2]];break}}return F}const mj=Object.keys(Qr).map(r=>`const COORDINATE_SYSTEM_${r}: i32 = ${Qr[r]};`).join(""),_j=Object.keys(ha).map(r=>`const PROJECTION_MODE_${r}: i32 = ${ha[r]};`).join(""),yj=Object.keys(Po).map(r=>`const UNIT_${r.toUpperCase()}: i32 = ${Po[r]};`).join(""),vj=`${mj} 1314${_j} 1315${yj} 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`,bj=`${vj} 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`,xj=Object.keys(Qr).map(r=>`const int COORDINATE_SYSTEM_${r} = ${Qr[r]};`).join(""),wj=Object.keys(ha).map(r=>`const int PROJECTION_MODE_${r} = ${ha[r]};`).join(""),Tj=Object.keys(Po).map(r=>`const int UNIT_${r.toUpperCase()} = ${Po[r]};`).join(""),Ej=`${xj} 1596${wj} 1597${Tj}
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`,Cj={};function Sj(r=Cj){return"viewport"in r?Aj(r):{}}const O_={name:"project",dependencies:[KV,jO],source:bj,vs:Ej,getUniforms:Sj,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"}},Ij=`// 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`,Bj=`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:[O_],source:Ij,vs:Bj};function Pj(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Yd(r,e){const t=Ep([],e,r);return wx(t,t,1/t[3]),t}function S3(r,e){const t=r%e;return t<0?e+t:t}function O1(r,e,t){return r<e?e:r>t?t:r}function Mj(r){return Math.log(r)*Math.LOG2E}const Cx=Math.log2||Mj;function Zc(r,e){if(!r)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const _l=Math.PI,QO=_l/4,Va=_l/180,D1=180/_l,up=512,qm=4003e4,Nd=85.051129,Rj=1.5;function Oj(r){return Cx(r)}function Yc(r){const[e,t]=r;Zc(Number.isFinite(e)),Zc(Number.isFinite(t)&&t>=-90&&t<=90,"invalid latitude");const n=e*Va,i=t*Va,s=up*(n+_l)/(2*_l),o=up*(_l+Math.log(Math.tan(QO+i*.5)))/(2*_l);return[s,o]}function uc(r){const[e,t]=r,n=e/up*(2*_l)-_l,i=2*(Math.atan(Math.exp(t/up*(2*_l)-_l))-QO);return[n*D1,i*D1]}function Dj(r){const{latitude:e}=r;Zc(Number.isFinite(e));const t=Math.cos(e*Va);return Oj(qm*t)-9}function bv(r){const e=Math.cos(r*Va);return up/qm/e}function F1(r){const{latitude:e,longitude:t,highPrecision:n=!1}=r;Zc(Number.isFinite(e)&&Number.isFinite(t));const i=up,s=Math.cos(e*Va),o=i/360,l=o/s,f=i/qm/s,A={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[o,l,f],degreesPerUnit:[1/o,1/l,1/f]};if(n){const v=Va*Math.tan(e*Va)/s,T=o*v/2,I=i/qm*v,F=I/l*f;A.unitsPerDegree2=[0,T,I],A.unitsPerMeter2=[F,0,F]}return A}function eD(r,e){const[t,n,i]=r,[s,o,l]=e,{unitsPerMeter:f,unitsPerMeter2:A}=F1({longitude:t,latitude:n,highPrecision:!0}),v=Yc(r);v[0]+=s*(f[0]+A[0]*o),v[1]+=o*(f[1]+A[1]*o);const T=uc(v),I=(i||0)+(l||0);return Number.isFinite(i)||Number.isFinite(l)?[T[0],T[1],I]:T}function Fj(r){const{height:e,pitch:t,bearing:n,altitude:i,scale:s,center:o}=r,l=Pj();$m(l,l,[0,0,-i]),MO(l,l,-t*Va),RO(l,l,n*Va);const f=s/e;return xx(l,l,[f,f,f]),o&&$m(l,l,U7([],o)),l}function Lj(r){const{width:e,height:t,altitude:n,pitch:i=0,offset:s,center:o,scale:l,nearZMultiplier:f=1,farZMultiplier:A=1}=r;let{fovy:v=eg(Rj)}=r;n!==void 0&&(v=eg(n));const T=v*Va,I=i*Va,F=Sx(v);let N=F;o&&(N+=o[2]*l/Math.cos(I)/t);const U=T*(.5+(s?s[1]:0)/t),$=Math.sin(U)*N/Math.sin(O1(Math.PI/2-I-U,.01,Math.PI-.01)),V=Math.sin(I)*$+N,j=N*10,X=Math.min(V*A,j);return{fov:T,aspect:e/t,focalDistance:F,near:f,far:X}}function eg(r){return 2*Math.atan(.5/r)*D1}function Sx(r){return .5/Math.tan(.5*r*Va)}function tD(r,e){const[t,n,i=0]=r;return Zc(Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)),Yd(e,[t,n,i,1])}function Ix(r,e,t=0){const[n,i,s]=r;if(Zc(Number.isFinite(n)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(s))return Yd(e,[n,i,s,1]);const o=Yd(e,[n,i,0,1]),l=Yd(e,[n,i,1,1]),f=o[2],A=l[2],v=f===A?0:((t||0)-f)/(A-f);return _O([],o,l,v)}function kj(r){const{width:e,height:t,bounds:n,minExtent:i=0,maxZoom:s=24,offset:o=[0,0]}
1849=r,[[l,f],[A,v]]=n,T=Nj(r.padding),I=Yc([l,O1(v,-Nd,Nd)]),F=Yc([A,O1(f,-Nd,Nd)]),N=[Math.max(Math.abs(F[0]-I[0]),i),Math.max(Math.abs(F[1]-I[1]),i)],U=[e-T.left-T.right-Math.abs(o[0])*2,t-T.top-T.bottom-Math.abs(o[1])*2];Zc(U[0]>0&&U[1]>0);const $=U[0]/N[0],V=U[1]/N[1],j=(T.right-T.left)/2/$,X=(T.top-T.bottom)/2/V,ue=[(F[0]+I[0])/2+j,(F[1]+I[1])/2+X],K=uc(ue),se=Math.min(s,Cx(Math.abs(Math.min($,V))));return Zc(Number.isFinite(se)),{longitude:K[0],latitude:K[1],zoom:se}}function Nj(r=0){return typeof r=="number"?{top:r,bottom:r,left:r,right:r}:(Zc(Number.isFinite(r.top)&&Number.isFinite(r.bottom)&&Number.isFinite(r.left)&&Number.isFinite(r.right)),r)}const I3=Math.PI/180;function Uj(r,e=0){const{width:t,height:n,unproject:i}=r,s={targetZ:e},o=i([0,n],s),l=i([t,n],s);let f,A;const v=r.fovy?.5*r.fovy*I3:Math.atan(.5/r.altitude),T=(90-r.pitch)*I3;return v>T-.01?(f=B3(r,0,e),A=B3(r,t,e)):(f=i([0,0],s),A=i([t,0],s)),[o,l,A,f]}function B3(r,e,t){const{pixelUnprojectionMatrix:n}=r,i=Yd(n,[e,0,1,1]),s=Yd(n,[e,r.height,1,1]),l=(t*r.distanceScales.unitsPerMeter[2]-i[2])/(s[2]-i[2]),f=_O([],i,s,l),A=uc(f);return A.push(t),A}const P3=512;function zj(r){const{width:e,height:t,pitch:n=0}=r;let{longitude:i,latitude:s,zoom:o,bearing:l=0}=r;(i<-180||i>180)&&(i=S3(i+180,360)-180),(l<-180||l>180)&&(l=S3(l+180,360)-180);const f=Cx(t/P3);if(o<=f)o=f,s=0;else{const A=t/2/Math.pow(2,o),v=uc([0,A])[1];if(s<v)s=v;else{const T=uc([0,P3-A])[1];s>T&&(s=T)}}return{width:e,height:t,longitude:i,latitude:s,zoom:o,pitch:n,bearing:l}}const rD=` 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`,Vj=` 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`,Gj=` 1888${rD} 1889${Vj} 1890`,jj=` 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`,Hj=` 1931${rD} 1932${jj} 1933`,Wj=dg(Kj),$j=dg(Zj),Xj=[0,0,0,1],qj=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function Jj(r,e){const[t,n,i]=r,s=Ix([t,n,i],e);return Number.isFinite(i)?s:[s[0],s[1],0]}function Kj({viewport:r,center:e}){return new vn(r.viewProjectionMatrix).invert().transform(e)}function Zj({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=>
1933Jj(o,n));for(const o of e){const l=o.clone().translate(new dt(r.center).negate()),f=s.map(v=>l.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 Yj(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=O_.getUniforms(t),i=Wj({viewport:t.viewport,center:n.center}),s=[],o=$j({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===ha.WEB_MERCATOR?(o[f]=v,s[f]=i):(o[f]=A.clone().multiplyRight(qj),s[f]=v.transform(i))}const l={drawShadowMap:!!r.drawToShadowMap,useShadowMap:r.shadowMaps?r.shadowMaps.length>0:!1,color:r.shadowColor||Xj,lightId:r.shadowLightId||0,lightCount:r.shadowMatrices.length,shadow_uShadowMap0:r.dummyShadowMap,shadow_uShadowMap1:r.dummyShadowMap};for(let f=0;f<o.length;f++)l[`viewProjectionMatrix${f}`]=o[f],l[`projectCenter${f}`]=s[f];for(let f=0;f<2;f++)l[`shadow_uShadowMap${f}`]=r.shadowMaps&&r.shadowMaps[f]||r.dummyShadowMap;return l}const M3={name:"shadow",dependencies:[O_],vs:Gj,fs:Hj,inject:{"vs:DECKGL_FILTER_GL_POSITION":` 1934 position = shadow_setVertexPosition(geometry.position); 1935 `,"fs:DECKGL_FILTER_COLOR":` 1936 color = shadow_filterShadowColor(color); 1937 `},getUniforms:Yj,uniformTypes:{drawShadowMap:"f32",useShadowMap:"f32",color:"vec4<f32>",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4<f32>",viewProjectionMatrix1:"mat4x4<f32>",projectCenter0:"vec4<f32>",projectCenter1:"vec4<f32>"}},ma={...a3,defaultUniforms:{...a3.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 `}}},Qj=[jO],eH=["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)"],tH=[];function rH(r){const e=Wf.getDefaultShaderAssembler();for(const n of Qj)e.addDefaultModule(n);const t=r==="glsl"?eH:tH;for(const n of t)e.addShaderHook(n);return e}const nH=[255,255,255],iH=1;let sH=0;class oH{constructor(e={}){this.type="ambient";const{color:t=nH}=e,{intensity:n=iH}=e;this.id=e.id||`ambient-${sH++}`,this.color=t,this.intensity=n}}const aH=[255,255,255],lH=1,cH=[0,0,-1];let uH=0;class R3{constructor(e={}){this.type="directional";const{color:t=aH}=e,{intensity:n=lH}=e,{direction:i=cH}=e,{_shadow:s=!1}=e;this.id=e.id||`directional-${uH++}`,this.color=t,this.intensity=n,this.type="directional",this.direction=new dt(i).normalize().toArray(),this.shadow=s}getProjectedLight(e){return this}}class nD{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 D_ extends nD{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,l=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:l});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:l,clearStack:f=!0}=t;t.pass=t.pass||"unknown",f&&(this._lastRenderIndex=-1);const A=[];for(const v of s){const T=o&&o[v.id];l?.(v);const I=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:T,pass:t.pass,layers:t.layers},I);A.push(U)}}return A}_getDrawLayerParams(e,{layers:t,pass:n,isPicking:i=!1,layerFilter:s,cullRect:o,effects:l,shaderModuleProps:f},A=!1){const v=[],T=iD(this._lastRenderIndex+1),I={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,I,s,F),V={shouldDrawLayer:$};$&&!A&&(V.shouldDrawLayer=!0,V.layerRenderIndex=T(U,$),V.shaderModuleProps=this._getShaderModuleProps(U,l,n,f),V.layerParameters={...U.context.deck?.props.parameters,...this.getLayerParameters(U,N,e)}),v[N]=V}return v}_drawLayersInViewport(e,{layers:t,shaderModuleProps:n,pass:i,target:s,viewport:o,view:l},f){const A=fH(this.device,{shaderModuleProps:n,target:s,viewport:o});if(l&&l.props.clear){const T=l.props.clear===!0?{color:!0,depth:!0}:l.props.clear;this.device.beginRenderPass({framebuffer:s,parameters:{viewport:A,scissorRect:A},clearColor:T.color?[0,0,0,0]:!1,clearDepth:T.depth?1:!1}).end()}const v={totalCount:t.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:A});for(let T=0;T<t.length;T++){const I=t[T],F=f[T],{shouldDrawLayer:N}=F;if(N&&I.props.pickable&&v.pickableCount++,I.isComposite&&v.compositeCount++,I.isDrawable&&F.shouldDrawLayer){const{layerRenderIndex:U,shaderModuleProps:$,layerParameters:V}=F;v.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,U),$.project&&($.project.viewport=o),I.context.renderPass=e;try{I._drawLayer({renderPass:e,shaderModuleProps:$,uniforms:{layerIndex:U},parameters:V})}catch(j){I.raiseError(j,`drawing ${I} 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 l=t.layer.id;if(l in i||(i[l]=n(t)),!i[l])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,l={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)O3(l,f.getShaderModuleProps?.(e,l));
1948return O3(l,this.getShaderModuleProps(e,t,l),i)}}function iD(r=0,e={}){const t={},n=(i,s)=>{const o=i.props._offset,l=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]||iD(e[f],e);A=v(i,s),t[l]=v}else Number.isFinite(o)?(A=o+(e[f]||0),t[l]=null):A=r;return s&&A>=r&&(r=A+1),e[l]=A,A};return n}function fH(r,{shaderModuleProps:e,target:t,viewport:n}){const i=e?.project?.devicePixelRatio??r.canvasContext.cssToDeviceRatio(),[,s]=r.canvasContext.getDrawingBufferSize(),o=t?t.height:s,l=n;return[l.x*i,o-(l.y+l.height)*i,l.width*i,l.height*i]}function O3(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 hH extends D_{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,l=[1,1,1,1];(s!==t.width||o!==t.height)&&t.resize({width:s,height:o}),super.render({...e,clearColor:l,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 dH={color:[255,255,255],intensity:1},D3=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],pH=[0,0,0,200/255];class sD{constructor(e={}){this.id="lighting-effect",this.shadowColor=pH,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(M3),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(M3))}_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 hH(e);this.shadowPasses[t]=n}}_applyDefaultLights(){const{ambientLight:e,pointLights:t,directionalLights:n}=this;!e&&t.length===0&&n.length===0&&(this.ambientLight=new oH(dH),this.directionalLights.push(new R3(D3[0]),new R3(D3[1])))}}class AH{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:l=!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 T=1/0;f&&(T=f*n+s);const I=this._allocate(A,v,l,T);return e&&o?I.set(e):l||I.fill(0,0,4),this._release(e),I}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,l=e.BYTES_PER_ELEMENT*s,f=o.findIndex(A=>A.byteLength>=l);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}
vendor: 17,211 bytes, line 1948
1948=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 fp=new AH;function EA(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function gH(r){return[r[12],r[13],r[14]]}function mH(r){return{left:hd(r[3]+r[0],r[7]+r[4],r[11]+r[8],r[15]+r[12]),right:hd(r[3]-r[0],r[7]-r[4],r[11]-r[8],r[15]-r[12]),bottom:hd(r[3]+r[1],r[7]+r[5],r[11]+r[9],r[15]+r[13]),top:hd(r[3]-r[1],r[7]-r[5],r[11]-r[9],r[15]-r[13]),near:hd(r[3]+r[2],r[7]+r[6],r[11]+r[10],r[15]+r[14]),far:hd(r[3]-r[2],r[7]-r[6],r[11]-r[10],r[15]-r[14])}}const F3=new dt;function hd(r,e,t,n){F3.set(r,e,t);const i=F3.len();return{distance:n/i,normal:new dt(-r/i,-e/i,-t/i)}}function _H(r){return r-Math.fround(r)}let hA;function xv(r,e){const{size:t=1,startIndex:n=0}=e,i=e.endIndex!==void 0?e.endIndex:r.length,s=(i-n)/t;hA=fp.allocate(hA,s,{type:Float32Array,size:t*2});let o=n,l=0;for(;o<i;){for(let f=0;f<t;f++){const A=r[o++];hA[l+f]=A,hA[l+f+t]=_H(A)}l+=t*2}return hA.subarray(0,s*t*2)}function yH(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 vH=Math.PI/180,bH=EA(),L3=[0,0,0],xH={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function wH({width:r,height:e,orthographic:t,fovyRadians:n,focalDistance:i,padding:s,near:o,far:l}){const f=r/e,A=t?new vn().orthographic({fovy:n,aspect:f,focalDistance:i,near:o,far:l}):new vn().perspective({fovy:n,aspect:f,near:o,far:l});if(s){const{left:v=0,right:T=0,top:I=0,bottom:F=0}=s,N=$c((v+r-T)/2,0,r)-r/2,U=$c((I+e-F)/2,0,e)-e/2;A[8]-=N*2/r,A[9]+=U*2/e}return A}class eu{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||xH,this.focalDistance=e.focalDistance||1,this.position=e.position||L3,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?ha.WEB_MERCATOR:ha.WEB_MERCATOR_AUTO_OFFSET:ha.IDENTITY}equals(e){return e instanceof eu?this===e?!0:e.width===this.width&&e.height===this.height&&e.scale===this.scale&&ga(e.projectionMatrix,this.projectionMatrix)&&ga(e.viewMatrix,this.viewMatrix):!1}project(e,{topLeft:t=!0}={}){const n=this.projectPosition(e),i=tD(n,this.pixelProjectionMatrix),[s,o]=i,l=t?o:this.height-o;return e.length===2?[s,l]:[s,l,i[2]]}unproject(e,{topLeft:t=!0,targetZ:n}={}){const[i,s,o]=e,l=t?s:this.height-s,f=n&&n*this.distanceScales.unitsPerMeter[2],A=Ix([i,l,o],this.pixelUnprojectionMatrix,f),[v,T,I]=this.unprojectPosition(A);return Number.isFinite(o)?[v,T,I]:Number.isFinite(n)?[v,T,n]:[v,T]}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=Yc(e);return t[1]=$c(t[1],-318,830),t}return e}unprojectFlat(e){return this.isGeospatial?uc(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?F1({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,mH(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=Dj({latitude:n})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||F1({latitude:n,longitude:t}));const i=Math.pow(2,this.zoom);this.scale=i;const{position:s,modelMatrix:o}=e;let l=L3;if(s&&(l=o?new vn(o).transformAsVector(s,[]):s),this.isGeospatial){const f=this.projectPosition([t,n,0]);this.center=new dt(l).scale(this.distanceScales.unitsPerMeter).add(f)}else this.center=this.projectPosition(l)}_initMatrices(e){const{viewMatrix:t=bH,projectionMatrix:n=null,orthographic:i=!1,fovyRadians:s,fovy:o=75,near:l=.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||wH({width:this.width,height:this.height,orthographic:i,fovyRadians:s||o*vH,focalDistance:v,padding:A,near:l,far:f});const T=EA();Zf(T,T,this.projectionMatrix),Zf(T,T,this.viewMatrix),this.viewProjectionMatrix=T,this.viewMatrixInverse=C1([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=gH(this.viewMatrixInverse);const I=EA(),F=EA();xx(I,I,[this.width/2,-this.height/2,1]),$m(I,I,[1,-1,0]),Zf(F,I,this.viewProjectionMatrix),this.pixelProjectionMatrix=F,this.pixelUnprojectionMatrix=C1(EA(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||Zr.warn("Pixel project matrix not invertible")()}}eu.displayName="Viewport";let tg=class L1 extends eu{constructor(e={}){const{latitude:t=0,longitude:n=0,zoom:i=0,pitch:s=0,bearing:o=0,nearZMultiplier:l=.1,farZMultiplier:f=1.01,nearZ:A,farZ:v,orthographic:T=!1,projectionMatrix:I,repeat:F=!1,worldOffset:N=0,position:U,padding:$,legacyMeterSizes:V=!1}=e;let{width:j,height:X,altitude:ue=1.5}=e;const K=Math.pow(2,i);j=j||1,X=X||1;let se,Ee=null;if(I)ue=I[5]/2,se=eg(ue);else{e.fovy?(se=e.fovy,ue=Sx(se)):se=eg(ue);let de;if($){const{top:me=0,bottom:pe=0}=$;de=[0,$c((me+X-pe)/2,0,X)-X/2]}Ee=Lj({width:j,height:X,scale:K,center:U&&[0,0,U[2]*bv(t)],offset:de,pitch:s,fovy:se,nearZMultiplier:l,farZMultiplier:f}),Number.isFinite(A)&&(Ee.near=A),Number.isFinite(v)&&(Ee.far=v)}let Ue=Fj({height:X,pitch:s,bearing:o,scale:K,altitude:ue});N&&(Ue=new vn().translate([512*N,0,0]).multiplyLeft(Ue)),super({...e,width:j,height:X,viewMatrix:Ue,longitude:n,latitude:t,zoom:i,...Ee,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=T,this._subViewports=F?[]:null,this._pseudoMeters=V,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 L1({...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)*bv(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)/bv(n);return[t,n,i]}addMetersToLngLat(e,t){return eD(e,t)}panByPosition(e,t){const n=Ix(t,this.pixelUnprojectionMatrix),i=this.projectFlat(e),s=e3([],i,R7([],n)),o=e3([],this.center,s),[l,f]=this.unprojectFlat(o);return{longitude:l,latitude:f}}getBounds(e={}){const t=Uj(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:l}=kj({width:n,height:i,bounds:e,...t});return new L1({width:n,height:i,longitude:s,latitude:o,zoom:l})}};tg.displayName="WebMercatorViewport";const k3=[0,0,0];function wv(r,e,t=!1){const n=e.projectPosition(r);if(t&&e instanceof tg){const[i,s,o=0]=r,l=e.getDistanceScales([i,s]);n[2]=o*l.unitsPerMeter[2]}return n}function TH(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 oD(r,{viewport:e,modelMatrix:t,coordinateSystem:n,coordinateOrigin:i,offsetMode:s}){let[o,l,f=0]=r;switch(t&&([o,l,f]=Ep([],[o,l,f,1],t)),n){case Qr.LNGLAT:return wv([o,l,f],e,s);case Qr.LNGLAT_OFFSETS:return wv([o+i[0],l+i[1],f+(i[2]||0)],e,s);case Qr.METER_OFFSETS:return wv(eD(i,[o,l,f]),e,s);case Qr.CARTESIAN:default:return e.isGeospatial?[o+i[0],l+i[1],f+i[2]]:e.projectPosition([o,l,f])}}function EH(r,e){const{viewport:t,coordinateSystem:n,coordinateOrigin:i,modelMatrix:s,fromCoordinateSystem:o,fromCoordinateOrigin:l}=TH(e),{autoOffset:f=!0}=e,{geospatialOrigin:A=k3,shaderCoordinateOrigin:v=k3,offsetMode:T=!1}=f?YO(t,n,i):{},I=oD(r,{viewport:t,modelMatrix:s,coordinateSystem:o,coordinateOrigin:l,offsetMode:T});if(T){const F=t.projectPosition(A||v);IO(I,I,F)}return I}let CH=1,SH=1;class aD{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=CH++,l={time:0,delay:t,duration:n,rate:i,repeat:s};return this._setChannelTime(l,this.time),this.channels.set(o,l),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=SH++;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 IH(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function BH(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}let PH=0;const MH={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:r=>console.error(r),stats:b1.stats.get(`animation-loop-${PH++}`),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1};class RH{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={...MH,...e},e=this.props,!e.device)throw new Error("No device provided");const{useDevicePixels:t=!0}=this.props;this.stats=e.stats||new hh({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=IH(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(BH(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 Tv={};function Ah(r="id"){Tv[r]=Tv[r]||1;const e=Tv[r]++;return`${r}-${e}`}class N3{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){if(this.id=e.id||Ah("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&Hi.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 OH(r,e){if(e instanceof N3)return e;const t=DH(r,e),{attributes:n,bufferLayout:i}=FH(r,e);return new N3({topology:e.topology||"triangle-list",bufferLayout:i,vertexCount:e.vertexCount,indices:t,attributes:n})}function DH(r,e){if(!e.indices)return;const t=e.indices.value;return r.createBuffer({usage:Hi.INDEX,data:t})}function FH(r,e){const t=[],n={};for(const[s,o]of Object.entries(e.attributes)){let l=s;switch(s){case"POSITION":l="positions";break;case"NORMAL":l="normals";break;case"TEXCOORD_0":l="texCoords";break;case"COLOR_0":l="colors";break}if(o){n[l]=r.createBuffer({data:o.value,id:`${s}-buffer`});const{value:f,size:A,normalized:v}=o;t.push({name:l,format:Gz(f,A,v)})}}const i=e._calculateVertexCount(e.attributes,e.indices);return{attributes:n,bufferLayout:t,vertexCount:i}}class Bx{static defaultProps={...lp.defaultProps};static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new Bx(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={...lp.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={...Um.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 Um?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 Px{static defaultProps={...B_.defaultProps};static getDefaultShaderFactory(e){return e._lumaData.defaultShaderFactory||=new Px(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 LH(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 Fs=null,Ev=null;function kH(r,{id:e,minimap:t,opaque:n,top:i="0",left:s="0",rgbaScale:o=1}){Fs||(Fs=document.createElement("canvas"),Fs.id=e,Fs.title=e,Fs.style.zIndex="100",Fs.style.position="absolute",Fs.style.top=i,Fs.style.left=s,Fs.style.border="blue 5px solid",Fs.style.transform="scaleY(-1)",document.body.appendChild(Fs),Ev=Fs.getContext("2d")),(Fs.width!==r.width||Fs.height!==r.height)&&(Fs.width=r.width/2,Fs.height=r.height/2,Fs.style.width="400px",Fs.style.height="400px");const l=r.device.readPixelsToArrayWebGL(r),f=Ev?.createImageData(r.width,r.height);if(f){for(let v=0;v<l.length;v+=4)f.data[0+v+0]=l[v+0]*o,f.data[0+v+1]=l[v+1]*o,f.data[0+v+2]=l[v+2]*o,f.data[0+v+3]=n?255:l[v+3]*o;Ev?.putImageData(f,0,0)}}function k1(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(!k1(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)||!k1(r[s],e[s],t-1))return!1;return!0}return!1}function NH(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function UH(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":!1}function lD(r){return NH(r)||UH(r)}function zH(r){return lD(r)||typeof r=="number"||typeof r=="boolean"}function cD(r){const e={bindings:{},uniforms:{}};return Object.keys(r).forEach(t=>{const n=r[t];zH(n)?e.uniforms[t]=n:e.bindings[t]=n}),e}class VH{options={disableWarnings:!1};modules;moduleUniforms;moduleBindings;constructor(e,t){Object.assign(this.options,t);const n=Y2(Object.values(e).filter(i=>i.dependencies));for(const i of n)e[i.name]=i;Yt.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&&Yt.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||Yt.warn(`Module ${t} not found`)();continue}const o=this.moduleUniforms[n],l=this.moduleBindings[n],f=s.getUniforms?.(i,o)||i,{uniforms:A,bindings:v}=cD(f);this.moduleUniforms[n]={...o,...A},this.moduleBindings[n]={...l,...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 GH="";async function jH(r,e){const t=new Image;return t.crossOrigin="anonymous",t.src=r.startsWith("http")?r:GH+r,await t.decode(),e?await createImageBitmap(t,e):await createImageBitmap(t)}class Cv{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||Ah("async-texture"),typeof t?.data=="string"&&t.dimension==="2d"&&(t={...t,data:jH(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 uD(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 uD(r){if(r=await r,Array.isArray(r))return await Promise.all(r.map(uD));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 Ff=2,HH=1e4;class Di{static defaultProps={...lp.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:Wf.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||Ah("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 VH(n,{disableWarnings:this.props.disableWarnings});this.setShaderInputs(i);const s=$H(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||=y7(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||Bx.getDefaultPipelineFactory(this.device),this.shaderFactory=t.shaderFactory||Px.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 Yt.info(Ff,`>>> 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}),N1(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&&OH(this.device,e);
1948if(t){this.setTopology(t.topology||"triangle-list");const n=new fv(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 fv(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){k1(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 Vz(this.shaderInputs.modules);for(const[t,n]of Object.entries(this.shaderInputs.modules))if(WH(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&&Yt.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)(),this.bufferLayout=jz(this.pipeline.shaderLayout,this.bufferLayout);const i=new fv(this.bufferLayout);for(const[s,o]of Object.entries(e)){const l=i.getBufferLayout(s);if(!l){n||Yt.warn(`Model(${this.id}): Missing layout for buffer "${s}".`)();continue}const f=i.getAttributeNamesForBuffer(l);let A=!1;for(const v of f){const T=this._attributeInfos[v];if(T){const I=this.device.type==="webgpu"?i.getBufferIndex(T.bufferName):T.location;this.vertexArray.setBuffer(I,o),A=!0}}!A&&!n&&Yt.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)||Yt.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${n}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){this.setUniformsWebGL(e)}setUniformsWebGL(e){N1(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettingsWebGL(e){const{bindings:t,uniforms:n}=cD(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 Cv&&!e.isReady)return e.id;return!1}_getBindings(){const e={};for(const[t,n]of Object.entries(this.bindings))n instanceof Cv?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 I_?e=Math.max(e,t.texture.updateTimestamp):t instanceof Hi||t instanceof oi?e=Math.max(e,t.updateTimestamp):t instanceof Cv?e=t.texture?Math.max(e,t.texture.updateTimestamp):1/0:t instanceof KA||(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&&(Yt.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=X4(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=Yt.level>3?0:HH;
1948Yt.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,Yt.group(Ff,`>>> DRAWING MODEL ${this.id}`,{collapsed:Yt.level<=2})())}_logDrawCallEnd(){if(this._logOpen){const e=LH(this.pipeline.shaderLayout,this.id);Yt.table(Ff,e)();const t=this.shaderInputs.getDebugTable();for(const[i,s]of Object.entries(this.uniforms))t[i]={value:s};Yt.table(Ff,t)();const n=this._getAttributeDebugTable();Yt.table(Ff,this._attributeInfos)(),Yt.table(Ff,n)(),Yt.groupEnd(Ff)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){const t=this.device.props.debugFramebuffers;if(this._drawCount++,!t)return;const n=e.props.framebuffer;n&&kH(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=K4(t);return(e instanceof Hi?new n(e.debugData):e).toString()}}function WH(r){return!!(r.uniformTypes&&!N1(r.uniformTypes))}function $H(r){return{type:r.type,shaderLanguage:r.info.shadingLanguage,shaderLanguageVersion:r.info.shadingLanguageVersion,gpu:r.info.gpu,features:r.features}}function N1(r){for(const e in r)return!1;return!0}class nh{device;model;transformFeedback;static defaultProps={...Di.defaultProps,outputs:void 0,feedbackBuffers:void 0};static isSupported(e){return e?.info?.type==="webgl"}constructor(e,t=nh.defaultProps){if(!nh.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||U4(),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 Hi)return t.readAsync();const{buffer:n,byteOffset:i=0,byteLength:s=n.byteLength}=t;return n.readAsync(i,s)}}const XH="transform_output";class U3{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||U4({input:t.targetTextureVarying,inputChannels:t.targetTextureChannels,output:XH}),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 Zs{id;topology;vertexCount;indices;attributes;userData={};constructor(e){const{attributes:t={},indices:n=null,vertexCount:i=null}=e;this.id=e.id||Ah("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 l=ArrayBuffer.isView(o)?{value:o}:o;if(!ArrayBuffer.isView(l.value))throw new Error(`${this._print(s)}: must be typed array or object with value as typed array`);if((s==="POSITION"||s==="positions")&&!l.size&&(l.size=3),s==="indices"){if(this.indices)throw new Error("Multiple indices detected");this.indices=l}else this.attributes[s]=l}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:l}=i;!l&&s&&o!==void 0&&o>=1&&(n=Math.min(n,s.length/o))}return n}}const qH=`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`,JH=`#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`,z3=[-1,-1,1,-1,-1,1,1,1];class KH extends Di{constructor(e,t){const n=z3.map(i=>i===-1?0:i);t.source&&(t={...t,source:`${qH} 1986${t.source}`}),super(e,{id:t.id||Ah("clip-space"),...t,vs:JH,vertexCount:4,geometry:new Zs({topology:"triangle-strip",vertexCount:4,attributes:{clipSpacePositions:{size:2,value:new Float32Array(z3)},texCoords:{size:2,value:new Float32Array(n)},coordinates:{size:2,value:new Float32Array(n)}}})})}}class Jm{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||Ah(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 Qd extends Jm{children;constructor(e={}){e=Array.isArray(e)?{children:e}:e;const{children:t=[]}=e;Yt.assert(t.every(n=>n instanceof Jm),"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,l=new dt(s).add(o).divide([2,2,2]);n.transformAsPoint(l,l);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(l);for(let T=0;T<3;T++)e[0][T]=Math.min(e[0][T],v[T]),e[1][T]=Math.max(e[1][T],v[T])}}),Number.isFinite(e[0][0])?e:null}
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 Qd?i.traverse(e,{worldMatrix:n}):e(i,{worldMatrix:n})}}class U1 extends Jm{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 fD extends Zs{constructor(e={}){const{id:t=Ah("cube-geometry"),indices:n=!0}=e;super(n?{...e,id:t,topology:"triangle-list",indices:{size:1,value:ZH},attributes:{...iW,...e.attributes}}:{...e,id:t,topology:"triangle-list",indices:void 0,attributes:{...sW,...e.attributes}})}}const ZH=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]),YH=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]),QH=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]),eW=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]),tW=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]),rW=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]),nW=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]),iW={POSITION:{size:3,value:YH},NORMAL:{size:3,value:QH},TEXCOORD_0:{size:2,value:eW}},sW={POSITION:{size:3,value:tW},TEXCOORD_0:{size:2,value:rW},COLOR_0:{size:3,value:nW}},oW=`uniform screenUniforms { 1987 vec2 texSize; 1988} screen; 1989`,aW={name:"screen",fs:oW,uniformTypes:{texSize:"vec2<f32>"}};class lW extends nD{constructor(e,t){super(e,t);const{module:n,fs:i,id:s}=t,o={depthWriteEnabled:!1,depthCompare:"always"};this.model=new KH(e,{id:s,fs:i,modules:[n,aW],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],l={texSrc:i.colorAttachments[0],texSize:o};this.model.shaderInputs.setProps({screen:l,...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 cW{constructor(e,t){this.id=`${e.name}-pass`,this.props=t,P4(e),this.module=e}setup({device:e}){this.passes=uW(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 l=o===t.length-1,f=n!==void 0&&l;f&&(s=n);const A=!f||!!e.clearCanvas,v={},T=this.module.passes[o].uniforms;v[this.module.name]={...this.props,...T},t[o].render({clearCanvas:A,inputBuffer:i,outputBuffer:s,moduleProps:v});const I=s;s=i,i=I}return i}cleanup(){if(this.passes){for(const e of this.passes)e.delete();this.passes=void 0}}}function uW(r,e,t){return e.passes.map((n,i)=>{const s=dW(e,n),o=`${t}-${i}`;return new lW(r,{id:o,module:e,fs:s})})}const hD=`#version 300 es 1990uniform sampler2D texSrc; 1991 1992in vec2 position; 1993in vec2 coordinate; 1994in vec2 uv; 1995 1996out vec4 fragColor; 1997`,fW=r=>`${hD} 1998void main() { 1999 fragColor = texture(texSrc, coordinate); 2000 fragColor = ${r}(fragColor, screen.texSize, coordinate); 2001} 2002`,hW=r=>`${hD} 2003void main() { 2004 fragColor = ${r}(texSrc, screen.texSize, coordinate); 2005} 2006`;function dW(r,e){if(e.filter){const t=typeof e.filter=="string"?e.filter:`${r.name}_filterColor_ext`;return fW(t)}if(e.sampler){const t=typeof e.sampler=="string"?e.sampler:`${r.name}
2006_sampleColor`;return hW(t)}return""}const pW={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant-alpha",blendAlphaDstFactor:"zero"};class dD extends D_{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:l,y:f,width:A,height:v},cullRect:T,effects:I,pass:F="picking",pickZ:N,shaderModuleProps:U}){this.pickZ=N;const $=this._resetColorEncoder(N),V=[l,f,A,v],j=super.render({target:o,layers:e,layerFilter:t,views:n,viewports:i,onViewportActive:s,cullRect:T,effects:I?.filter(ue=>ue.useInPicking),pass:F,isPicking:!0,shaderModuleProps:U,clearColor:[0,0,0,0],colorMask:15,scissorRect:V});return this._colorEncoderState=null,{decodePickingColor:$&&gW.bind(null,$),stats:j}}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,pW),i.blend=!0,i.blendColor=AW(this._colorEncoderState,e,n)),i}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function AW(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):(Zr.warn("Too many pickable layers, only picking the first 255")(),s=0)),[0,0,0,s/255]}function gW(r,e){const t=r.byAlpha[e[3]];return t&&{pickedLayer:t.layer,pickedViewports:t.viewports,pickedObjectIndex:t.layer.decodePickingColor(e)}}const Od={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"},Km=Symbol.for("component"),$u=Symbol.for("propTypes"),Sv=Symbol.for("deprecatedProps"),ep=Symbol.for("asyncPropDefaults"),ih=Symbol.for("asyncPropOriginal"),Vu=Symbol.for("asyncPropResolved");function F_(r,e=()=>!0){return Array.isArray(r)?pD(r,e,[]):e(r)?[r]:[]}function pD(r,e,t){let n=-1;for(;++n<r.length;){const i=r[n];Array.isArray(i)?pD(i,e,t):e(i)&&t.push(i)}return t}function mW({target:r,source:e,start:t=0,count:n=1}){const i=e.length,s=n*i;let o=0;for(let l=t;o<i;o++)r[l++]=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}class _W{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=Kc(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 yW{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 _W(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 l=s[e];if(this._track(n,i,l,t),l)return l.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 l=o[t];const f=l&&l.resourceId&&this._resources[l.resourceId];f&&(f.unsubscribe(l),this.prune()),n&&(l?(l.onChange=i,l.resourceId=n.id):l={onChange:i,resourceId:n.id},o[t]=l,n.subscribe(l))}_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 vW="layerManager.setLayers",bW="layerManager.activateViewport";class xW{constructor(e,t){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=l=>{Ao(bW,this,l),l&&(this.context.viewport=l)};const{deck:n,stats:i,viewport:s,timeline:o}=t||{};
vendor: 49,910 bytes, line 2006
2006this.layers=[],this.resourceManager=new yW({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:n,shaderAssembler:rH(e?.info?.shadingLanguage||"glsl"),defaultShaderModules:[hG],renderPass:void 0,stats:i||new hh({id:"deck.gl"}),viewport:s||new eu({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new aD,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(vW,this,t,e),this._lastRenderedLayers=e;const n=F_(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]?Zr.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&&Zr.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(l){this._handleError("matching",l,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=Od.INITIALIZED}catch(t){this._handleError("initialization",t,e)}}_transferLayerState(e,t){t._transferState(e),t.lifecycle=Od.MATCHED,t!==e&&(e.lifecycle=Od.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(t){this._handleError("update",t,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Od.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Od.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 wW{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 l=e.slice();return l[0]-=o.x,l[1]-=o.y,o.unproject(l,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=F_(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):Zr.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),l=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,l,f),l&&this._viewports.unshift(l)}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 TW=/([0-9]+\.?[0-9]*)(%|px)/;function Mu(r){switch(typeof r){case"number":return{position:r,relative:!1};case"string":const e=TW.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 Ru(r,e){return r.relative?Math.round(r.position*e):r.position}class hp{constructor(e){const{id:t,x:n=0,y:i=0,width:s="100%",height:o="100%",padding:l=null}=e;this.id=t||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=Mu(n),this._y=Mu(i),this._width=Mu(s),this._height=Mu(o),this._padding=l&&{left:Mu(l.left||0),right:Mu(l.right||0),top:Mu(l.top||0),bottom:Mu(l.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:Ru(this._x,e),y:Ru(this._y,t),width:Ru(this._width,e),height:Ru(this._height,t)};return this._padding&&(n.padding={left:Ru(this._padding.left,e),top:Ru(this._padding.top,t),right:Ru(this._padding.right,e),bottom:Ru(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 L_{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 V3=()=>{},z1={BREAK:1,SNAP_TO_END:2,IGNORE:3},EW=r=>r,CW=z1.BREAK;let SW=class{constructor(e){this._onTransitionUpdate=t=>{const{time:n,settings:{interpolator:i,startProps:s,endProps:o,duration:l,easing:f}}=t,A=f(n/l),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 L_(e.timeline),this.onViewStateChange=e.onViewStateChange||V3,this.onStateChange=e.onStateChange||V3}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===z1.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===z1.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 l=s.initializeProps(e,i);this.propsInTransition={};const f={duration:o,easing:t.transitionEasing||EW,interpolator:s,interruption:t.transitionInterruption||CW,startProps:l.start,endProps:l.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 Ks(r,e){if(!r)throw new Error(e||"deck.gl: assertion failed.")}let IW=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)||!ga(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];Ks(Number.isFinite(n)||Array.isArray(n),`${t} is required for transition`)})}};const BW=["longitude","latitude","zoom","bearing","pitch"],PW=["longitude","latitude","zoom"];let AD=class extends IW{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:BW,required:PW},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),l=i(t),f=o.unproject(s);n.start.around=s,Object.assign(n.end,{around:l.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]=wl(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,wl(e.around,t.around,n)))}return i}};const Ou={transitionDuration:0},MW=300,w0=r=>1-(1-r)*(1-r),dd={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},Lf={};class RW{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 SW({...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?MW:0;const{scrollZoom:n=!0,dragPan:i=!0,dragRotate:s=!0,doubleClickZoom:o=!0,touchZoom:l=!0,touchRotate:f=!1,keyboard:A=!0}=e,v=!!this.onViewStateChange;this.toggleEvents(dd.WHEEL,v&&n),this.toggleEvents(dd.PAN,v),this.toggleEvents(dd.PINCH,v&&(l||f)),this.toggleEvents(dd.MULTI_PAN,v&&f),this.toggleEvents(dd.DOUBLE_CLICK,v&&o),this.toggleEvents(dd.KEYBOARD,v&&A),this.scrollZoom=n,this.dragPan=i,this.dragRotate=s,this.doubleClickZoom=o,this.touchZoom=l,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,Ou,{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,Ou,{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:w0},{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,Ou,{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:w0},{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 l=this.controllerState.zoom({pos:t,scale:o});return this.updateViewport(l,{...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,Ou,{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,Ou,{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:w0},{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 Lf._startPinchRotation=e.rotation,Lf._lastPinchEvent=e,this.updateViewport(n,Ou,{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:Lf._startPinchRotation-n})}return this.updateViewport(t,Ou,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Lf._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;const{inertia:t}=this,{_lastPinchEvent:n}=Lf;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),l=(o-Math.log2(n.scale))/(e.deltaTime-n.deltaTime),f=Math.pow(2,o+l*t/2);s=s.zoom({pos:i,scale:f}).zoomEnd(),this.updateViewport(s,{...this._getTransitionProps({around:i}),transitionDuration:t,transitionEasing:w0},{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 Lf._startPinchRotation=null,Lf._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:l}=this;let f;const A={};switch(e.srcEvent.code){case"Minus":f=t?l.zoomOut(n).zoomOut(n):l.zoomOut(n),A.isZooming=!0;break;case"Equal":f=t?l.zoomIn(n).zoomIn(n):l.zoomIn(n),A.isZooming=!0;break;case"ArrowLeft":t?(f=l.rotateLeft(s),A.isRotating=!0):(f=l.moveLeft(i),A.isPanning=!0);break;case"ArrowRight":t?(f=l.rotateRight(s),A.isRotating=!0):(f=l.moveRight(i),A.isPanning=!0);break;case"ArrowUp":t?(f=l.rotateUp(o),A.isRotating=!0):(f=l.moveUp(i),A.isPanning=!0);break;case"ArrowDown":t?(f=l.rotateDown(o),A.isRotating=!0):(f=l.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?Ou:e?{...t,transitionInterpolator:new AD({...e,...t.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:t}}class OW{constructor(e,t){this._viewportProps=this.applyConstraints(e),this._state=t}getViewportProps(){return this._viewportProps}getState(){return this._state}}const G3=5,DW=1.2;let FW=class extends OW{constructor(e){const{width:t,height:n,latitude:i,longitude:s,zoom:o,bearing:l=0,pitch:f=0,altitude:A=1.5,position:v=[0,0,0],maxZoom:T=20,minZoom:I=0,maxPitch:F=60,minPitch:N=0,startPanLngLat:U,startZoomLngLat:$,startRotatePos:V,startBearing:j,startPitch:X,startZoom:ue,normalize:K=!0}=e;Ks(Number.isFinite(s)),Ks(Number.isFinite(i)),Ks(Number.isFinite(o)),super({width:t,height:n,latitude:i,longitude:s,zoom:o,bearing:l,pitch:f,altitude:A,maxZoom:T,minZoom:I,maxPitch:F,minPitch:N,normalize:K,position:v},{startPanLngLat:U,startZoomLngLat:$,startRotatePos:V,startBearing:j,startPitch:X,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 l;return e?l=this._getNewRotation(e,i,o,s):l={bearing:s+t,pitch:o+n},this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos: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:l}=this.getViewportProps();let f=i+Math.log2(n);f=$c(f,l,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=$c(i,n,t);const{maxPitch:s,minPitch:o,pitch:l}=e;e.pitch=$c(l,o,s);const{normalize:f=!0}=e;return f&&Object.assign(e,zj(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],l=e[1],f=t[1],{width:A,height:v}=this.getViewportProps(),T=s/A;let I=0;o>0?Math.abs(v-f)>G3&&(I=o/(f-v)*DW):o<0&&f>G3&&(I=1-l/f),I=$c(I,-1,1);const{minPitch:F,maxPitch:N}=this.getViewportProps(),U=i+180*T;let $=n;return I>0?$=n+I*(N-n):I<0&&($=n-I*(F-n)),{pitch:$,bearing:U}}},LW=class extends RW{constructor(){super(...arguments),this.ControllerState=FW,this.transition={transitionDuration:300,transitionInterpolator:new AD({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 gD extends hp{constructor(e={}){super(e)}getViewportType(){return tg}get ControllerType(){return LW}}gD.displayName="MapView";const kW=new sD;function NW(r,e){const t=r.order??1/0,n=e.order??1/0;return t-n}class UW{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=>NW(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 sD)||this._resolvedEffects.push(kW),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 zW extends D_{shouldDrawLayer(e){const{operation:t}=e.props;return t.includes("draw")||t.includes("terrain")}}const VW="deckRenderer.renderLayers";class GW{constructor(e){this.device=e,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new zW(e),this.pickLayersPass=new dD(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(VW,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 jW={pickedColor:null,pickedObjectIndex:-1};function HW({pickedColors:r,decodePickingColor:e,deviceX:t,deviceY:n,deviceRadius:i,deviceRect:s}){const{x:o,y:l,width:f,height:A}=s;let v=i*i,T=-1,I=0;for(let F=0;F<A;F++){const N=F+l-n,U=N*N;if(U>v)I+=4*f;else for(let $=0;$<f;$++){if(r[I+3]-1>=0){const j=$+o-t,X=j*j+U;X<=v&&(v=X,T=I)}I+=4}}if(T>=0){const F=r.slice(T,T+4),N=e(F);if(N){const U=Math.floor(T/4/f),$=T/4-U*f;return{...N,pickedColor:F,pickedX:o+$,pickedY:l+U}}Zr.error("Picked non-existent layer. Is picking buffer corrupt?")()}return jW}function WW({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 l=e(s);l?t.set(o,{...l,color:s}):Zr.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(t.values())}function mD({pickInfo:r,viewports:e,pixelRatio:t,x:n,y:i,z:s}){let o=e[0];e.length>1&&(o=XW(r?.pickedViewports||e,{x:n,y:i}));let l;if(o){const f=[n-o.x,i-o.y];s!==void 0&&(f[2]=s),l=o.unproject(f)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:n,y:i,pixel:[n,i],coordinate:l,devicePixel:r&&"pickedX"in r?[r.pickedX,r.pickedY]:void 0,pixelRatio:t}}function $W(r){const{pickInfo:e,lastPickedInfo:t,mode:n,layers:i}=r,{pickedColor:s,pickedLayer:o,pickedObjectIndex:l}=e,f=o?[o]:[];if(n==="hover"){const T=t.index,I=t.layerId,F=o?o.props.id:null;if(F!==I||l!==T){if(F!==I){const N=i.find(U=>U.props.id===I);N&&f.unshift(N)}t.layerId=F,t.index=l,t.info=null}}const A=mD(r),v=new Map;return v.set(null,A),f.forEach(T=>{let I={...A};T===o&&(I.color=s,I.index=l,I.picked=!0),I=_D({layer:T,info:I,mode:n});const F=I.layer;T===o&&n==="hover"&&(t.info=I),v.set(F.id,I),n==="hover"&&F.updateAutoHighlight(I)}),v}function _D({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 XW(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 qW{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new dD(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,l=s&&s.viewport&&s.viewport.id,f=o?n.find(I=>I.id===o):null,A=l&&i.find(I=>I.id===l)||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:l=1,mode:f="query",unproject3D:A,onViewportActive:v,effects:T}){const I=this.device.canvasContext.cssToDeviceRatio(),F=this._getPickable(e);if(!F||n.length===0)return{result:[],emptyInfo:mD({viewports:n,x:i,y:s,pixelRatio:I})};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*I),{width:V,height:j}=this.pickingFBO,X=this._getPickingRect({deviceX:U[0],deviceY:U[1],deviceRadius:$,deviceWidth:V,deviceHeight:j}),ue={x:i-o,y:s-o,width:o*2+1,height:o*2+1};let K;const se=[],Ee=new Set;for(let Ue=0;Ue<l;Ue++){let de;if(X){const pe=this._drawAndSample({layers:F,views:t,viewports:n,onViewportActive:v,deviceRect:X,cullRect:ue,effects:T,pass:`picking:${f}`});de=HW({...pe,deviceX:U[0],deviceY:U[1],deviceRadius:$,deviceRect:X})}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:T,pass:`picking:${f}:z`},!0);pe[3]&&(me=pe[0])}de.pickedLayer&&Ue+1<l&&(Ee.add(de.pickedLayer),de.pickedLayer.disablePickingIndex(de.pickedObjectIndex)),K=$W({pickInfo:de,lastPickedInfo:this.lastPickedInfo,mode:f,layers:F,viewports:n,x:i,y:s,z:me,pixelRatio:I});for(const pe of K.values())pe.layer&&se.push(pe);if(!de.pickedColor)break}for(const Ue of Ee)Ue.restorePickingColors();return{result:se,emptyInfo:K.get(null)}}_pickVisibleObjects({layers:e,views:t,viewports:n,x:i,y:s,width:o=1,height:l=1,mode:f="query",maxObjects:A=null,onViewportActive:v,effects:T}){const I=this._getPickable(e);if(!I||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,V=this.device.canvasContext.cssToDevicePixels([i+o,s+l],!0),j=V.x+V.width,X=V.y,ue={x:U,y:X,width:j-U,height:$-X},K=this._drawAndSample({layers:I,views:t,viewports:n,onViewportActive:v,deviceRect:ue,cullRect:{x:i,y:s,width:o,height:l},effects:T,pass:`picking:${f}`}),se=WW(K),Ee=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=_D({layer:pe.pickedLayer,info:W,mode:f});const re=W.layer.id;Ee.has(re)||Ee.set(re,new Set);const Ce=Ee.get(re),et=W.object??W.index;Ce.has(et)||(Ce.add(et),Ue.push(W))}return Ue}_drawAndSample({layers:e,views:t,viewports:n,onViewportActive:i,deviceRect:s,cullRect:o,effects:l,pass:f},A=!1){const v=A?this.depthFBO:this.pickingFBO,T={layers:e,layerFilter:this.layerFilter,views:t,viewports:n,onViewportActive:i,pickingFBO:v,deviceRect:s,cullRect:o,effects:l,pass:f,pickZ:A,preRenderStats:{},isPicking:!0};for(const j of l)j.useInPicking&&(T.preRenderStats[j.id]=j.preRender(T));const{decodePickingColor:I}=this.pickLayersPass.render(T),{x:F,y:N,width:U,height:$}=s,V=new(A?Float32Array:Uint8Array)(U*$*4);return this.device.readPixelsToArrayWebGL(v,{sourceX:F,sourceY:N,sourceWidth:U,sourceHeight:$,target:V}),{pickedColors:V,decodePickingColor:I}}_getPickingRect({deviceX:e,deviceY:t,deviceRadius:n,deviceWidth:i,deviceHeight:s}){const o=Math.max(0,e-n),l=Math.max(0,t-n),f=Math.min(i,e+n+1)-o,A=Math.min(s,t+n+1)-l;return f<=0||A<=0?null:{x:o,y:l,width:f,height:A}}}const JW={"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}},KW="top-left",j3="__root";class ZW{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=KW}=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||j3;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,JW[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===j3||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=R1[t.type];if(n)for(const i of this.getWidgets()){const{viewId:s}=i;(!s||s===e.viewport?.id)&&i[n]?.(e,t)}}}const YW={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class QW{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,YW),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 Ud;(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"})(Ud||(Ud={}));const Mx={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),H3=(r,e,t)=>r.hint(t,e),oa=(r,e,t)=>r.pixelStorei(t,e),W3=(r,e,t)=>{const n=t===36006?36009:36008;return r.bindFramebuffer(n,e)},dA=(r,e,t)=>{const i={34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[t];r.bindBuffer(i,e)};function Iv(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}const e$={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:H3,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:W3,36010:W3,34964:dA,36662:dA,36663:dA,35053:dA,35055:dA,2886:(r,e)=>r.frontFace(e),33170:H3,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:oa,3317:oa,37440:oa,37441:oa,37443:oa,3330:oa,3332:oa,3331:oa,3314:oa,32878:oa,3316:oa,3315:oa,32877:oa,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)=>
vendor: 4,401 bytes, line 2006
2006r.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=Iv(e)?e:[e,e];const[t,n]=e;r.stencilMaskSeparate(1028,t),r.stencilMaskSeparate(1029,n)},stencilFunc:(r,e)=>{e=Iv(e)&&e.length===3?[...e,...e]:e;const[t,n,i,s,o,l]=e;r.stencilFuncSeparate(1028,t,n,i),r.stencilFuncSeparate(1029,s,o,l)},stencilOp:(r,e)=>{e=Iv(e)&&e.length===3?[...e,...e]:e;const[t,n,i,s,o,l]=e;r.stencilOpSeparate(1028,t,n,i),r.stencilOpSeparate(1029,s,o,l)},viewport:(r,e)=>r.viewport(...e)};function es(r,e,t){return e[r]!==void 0?e[r]:t[r]}const t$={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))},$3={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]})},Yl=(r,e)=>r.isEnabled(e),X3={3042:Yl,2884:Yl,2929:Yl,3024:Yl,32823:Yl,32926:Yl,32928:Yl,3089:Yl,2960:Yl,35977:Yl},r$=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 Cp(r,e){if(i$(e))return;const t={};for(const i in e){const s=Number(i),o=e$[i];o&&(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=t$[i];s(r,e,n)}}function yD(r,e=Mx){if(typeof e=="number"){const i=e,s=X3[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=X3[i];n[i]=s?s(r,Number(i)):r.getParameter(Number(i))}return n}function n$(r){Cp(r,Mx)}function i$(r){for(const e in r)return!1;return!0}function s$(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 Yf{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||(()=>{}
2006),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){const e=this.stateStack[this.stateStack.length-1];Cp(this.gl,e),this.stateStack.pop()}trackState(e,t){if(this.cache=t.copyState?yD(e):Object.assign({},Mx),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,a$(e);for(const n in $3){const i=$3[n];o$(e,n,i)}q3(e,"getParameter"),q3(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],l=this.cache[s];s$(o,l)||(t=!0,n=l,i&&!(s in i)&&(i[s]=l),this.cache[s]=o)}return{valueChanged:t,oldValue:n}}}function q3(r,e){const t=r[e].bind(r);r[e]=function(i){if(i===void 0||r$.has(i))return t(i);const s=Yf.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 o$(r,e,t){if(!r[e])return;const n=r[e].bind(r);r[e]=function(...s){const o=Yf.get(r),{valueChanged:l,oldValue:f}=t(o._updateCache,...s);return l&&n(...s),f},Object.defineProperty(r[e],"name",{value:`${e}-to-cache`,configurable:!1})}function a$(r){const e=r.useProgram.bind(r);r.useProgram=function(n){const i=Yf.get(r);i.program!==n&&(e(n),i.program=n)}}function l$(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:l}=e;return r.addEventListener("webglcontextlost",f=>o(f),!1),r.addEventListener("webglcontextrestored",f=>l(f),!1),s.luma||={},s}function dp(r,e,t){return t[e]===void 0&&(t[e]=r.getExtension(e)||null),t[e]}function c$(r,e){const t=r.getParameter(7936),n=r.getParameter(7937);dp(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),l=s||t,f=o||n,A=r.getParameter(7938),v=vD(l,f),T=u$(l,f),I=f$(l,f);return{type:"webgl",gpu:v,gpuType:I,gpuBackend:T,vendor:l,renderer:f,version:A,shadingLanguage:"glsl",shadingLanguageVersion:300}}function vD(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 u$(r,e){return/Metal/i.exec(r)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(r)||/ANGLE/i.exec(e)?"opengl":"unknown"}function f$(r,e){if(/SwiftShader/i.exec(r)||/SwiftShader/i.exec(e))return"cpu";switch(vD(r,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function bD(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 CA="WEBGL_compressed_texture_s3tc",SA="WEBGL_compressed_texture_s3tc_srgb",zd="EXT_texture_compression_rgtc",Vd="EXT_texture_compression_bptc",h$="WEBGL_compressed_texture_etc",d$="WEBGL_compressed_texture_astc",p$="WEBGL_compressed_texture_etc1",A$="WEBGL_compressed_texture_pvrtc",g$="WEBGL_compressed_texture_atc",J3="EXT_texture_norm16",K3="EXT_render_snorm",m$="EXT_color_buffer_float",Rx={"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":[K3],"norm16-renderable-webgl":[J3],"snorm16-renderable-webgl":[J3,K3],"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":[CA,SA,zd,Vd],"texture-compression-bc5-webgl":[zd],"texture-compression-bc7-webgl":[Vd],"texture-compression-etc2":[h$],"texture-compression-astc":[d$],"texture-compression-etc1-webgl":[p$],"texture-compression-pvrtc-webgl":[A$],"texture-compression-atc-webgl":[g$]};function _$(r){return r in Rx}function y$(r,e,t){return(Rx[e]||[]).every(i=>dp(r,i,t))}const Ox={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:m$,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:CA},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:SA},"bc1-rgba-unorm":{gl:33777,x:CA},"bc1-rgba-unorm-srgb":{gl:35916,x:SA},"bc2-rgba-unorm":{gl:33778,x:CA},"bc2-rgba-unorm-srgb":{gl:35918,x:SA},"bc3-rgba-unorm":{gl:33779,x:CA},"bc3-rgba-unorm-srgb":{gl:35919,x:SA},"bc4-r-unorm":{gl:36283,x:zd},"bc4-r-snorm":{gl:36284,x:zd},"bc5-rg-unorm":{gl:36285,x:zd},"bc5-rg-snorm":{gl:36286,x:zd},"bc6h-rgb-ufloat":{gl:36495,x:Vd},"bc6h-rgb-float":{gl:36494,x:Vd},"bc7-rgba-unorm":{gl:36492,x:Vd},"bc7-rgba-unorm-srgb":{gl:36493,x:Vd},"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 v$(r,e,t){let n=e.create;const i=Ox[e.format];return i?.gl===void 0&&(n=!1),i?.x&&(n=n&&!!dp(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 xD(r){const e=Ox[r],t=w$(r),n=Q2(r);return{internalFormat:t,format:e?.dataFormat||x$(n.channels,n.integer,n.normalized,t),type:n.dataType?bD(n.dataType):e?.types?.[0]||5121,compressed:n.compressed||!1}}function b$(r){switch(Q2(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 x$(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 w$(r){const t=Ox[r]?.gl;if(t===void 0)throw new Error(`Unsupported texture format ${r}`);return t}const Z3={"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 T$ extends oz{gl;extensions;testedFeatures=new Set;constructor(e,t,n){super([],n),this.gl=e,this.extensions=t,dp(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),_$(e)&&y$(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(Z3),...Object.keys(Rx)]}getWebGLFeature(e){const t=Z3[e];return typeof t=="string"?!!dp(this.gl,t,this.extensions):!!t}}class E$ extends sz{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 NA extends P_{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=b$(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 ${S$(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 l=C$(o);n.framebufferTexture2D(36160,e,l,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 C$(r){return r<34069?r+34069:r}function S$(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}`}}class I$ extends ex{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 NA(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 wD(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 B$=1;let aa=null,Y3=!1;const Dx={debugSpectorJS:Yt.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/[email protected]/dist/spector.bundle.js",gl:void 0};async function P$(r){if(!globalThis.SPECTOR)try{await wD(r.debugSpectorJSUrl||Dx.debugSpectorJSUrl)}catch(e){Yt.warn(String(e))}}function M$(r){if(r={...Dx,...r},!r.debugSpectorJS)return null;if(!aa&&globalThis.SPECTOR&&!globalThis.luma?.spector){Yt.probe(B$,"SPECTOR foun
2006d and initialized. Start with `luma.spector.displayUI()`")();const{Spector:e}=globalThis.SPECTOR;aa=new e,globalThis.luma&&(globalThis.luma.spector=aa)}if(!aa)return null;if(Y3||(Y3=!0,aa.spyCanvases(),aa?.onCaptureStarted.add(e=>Yt.info("Spector capture started:",e)()),aa?.onCapture.add(e=>{Yt.info("Spector capture complete:",e)(),aa?.getResultUI(),aa?.resultView.display(),aa?.resultView.addCapture(e)})),r.gl){const e=r.gl,t=e.device;aa?.startCapture(r.gl,500),e.device=t,new Promise(n=>setTimeout(n,2e3)).then(n=>{Yt.info("Spector capture stopped after 2 seconds")(),aa?.stopCapture()})}return aa}const R$="https://unpkg.com/[email protected]/index.js";function TD(r){return r.luma=r.luma||{},r.luma}async function O$(){fh()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await wD(R$))}function D$(r,e={}){return e.debugWebGL||e.traceWebGL?L$(r,e):F$(r)}function F$(r){const e=TD(r);return e.realContext?e.realContext:r}function L$(r,e){if(!globalThis.WebGLDebugUtils)return Yt.warn("webgl-debug not loaded")(),r;const t=TD(r);if(t.debugContext)return t.debugContext;globalThis.WebGLDebugUtils.init({...Ud,...r});const n=globalThis.WebGLDebugUtils.makeDebugContext(r,k$.bind(null,e),N$.bind(null,e));for(const o in Ud)!(o in n)&&typeof Ud[o]=="number"&&(n[o]=Ud[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 Q3(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 k$(r,e,t,n){n=Array.from(n).map(l=>l===void 0?"undefined":l);const i=globalThis.WebGLDebugUtils.glEnumToString(e),s=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,n),o=`${i} in gl.${t}(${s})`;Yt.error(o)();debugger}function N$(r,e,t){let n="";Yt.level>=1&&(n=Q3(e,t),r.traceWebGL&&Yt.log(1,n)());for(const i of t)if(i===void 0){n=n||Q3(e,t);debugger}}const Bv={};function U$(r="id"){Bv[r]=Bv[r]||1;const e=Bv[r]++;return`${r}-${e}`}class UA extends Hi{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=z$(this.props.usage),this.glUsage=V$(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)}async 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 z$(r){return r&Hi.INDEX?34963:r&Hi.VERTEX?34962:r&Hi.UNIFORM?35345:34962}function V$(r){return r&Hi.INDEX||r&Hi.VERTEX?35044:r&Hi.UNIFORM?35048:35044}function G$(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[T,I]=i;t.push({message:I.trim(),type:eS(T),lineNum:0,linePos:0});continue}const[s,o,l,...f]=i;let A=parseInt(l,10);isNaN(A)&&(A=0);let v=parseInt(o,10);isNaN(v)&&(v=0),t.push({message:f.join(":").trim(),type:eS(s),lineNum:A,linePos:v})}return t}function eS(r){const e=["warning","error","info"],t=r.toLowerCase();return e.includes(t)?t:"info"}class j$ extends B_{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?G$(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}Yt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Yt.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 H$(r,e,t,n){if(q$(e))return n(r);const i=r;i.pushState();try{return W$(r,e),Cp(i.gl,t),n(r)}finally{i.popState()}}function W$(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(Qf("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=Qf("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=Qf("polygonMode",e.polygonMode,{fill:6914,line:6913});s?.polygonModeWEBGL(1028,o),s?.polygonModeWEBGL(1029,o)}e.polygonOffsetLine&&n.enable(10754)}
vendor: 5,116 bytes, line 2007
2007if(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(X$("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(V1("depthCompare",e.depthCompare))),e.stencilWriteMask){const i=e.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(e.stencilReadMask&&Yt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){const i=e.stencilReadMask||4294967295,s=V1("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=Pv("stencilPassOperation",e.stencilPassOperation),s=Pv("stencilFailOperation",e.stencilFailOperation),o=Pv("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=tS("blendColorOperation",e.blendColorOperation||"add"),s=tS("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(i,s);const o=T0("blendColorSrcFactor",e.blendColorSrcFactor||"one"),l=T0("blendColorDstFactor",e.blendColorDstFactor||"zero"),f=T0("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),A=T0("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(o,l,f,A)}}function V1(r,e){return Qf(r,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Pv(r,e){return Qf(r,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function tS(r,e){return Qf(r,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function T0(r,e){return Qf(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 $$(r,e){return`Illegal parameter ${e} for ${r}`}function Qf(r,e,t){if(!(e in t))throw new Error($$(r,e));return t[e]}function X$(r,e){return e}function q$(r){let e=!0;for(const t in r){e=!1;break}return e}function ED(r){const e={};return r.addressModeU&&(e[10242]=Mv(r.addressModeU)),r.addressModeV&&(e[10243]=Mv(r.addressModeV)),r.addressModeW&&(e[32882]=Mv(r.addressModeW)),r.magFilter&&(e[10240]=G1(r.magFilter)),(r.minFilter||r.mipmapFilter)&&(e[10241]=J$(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]=V1("compare",r.compare)),r.maxAnisotropy&&(e[34046]=r.maxAnisotropy),e}function Mv(r){switch(r){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function G1(r){switch(r){case"nearest":return 9728;case"linear":return 9729}}function J$(r,e="none"){if(!e)return G1(r);switch(e){case"none":return G1(r);case"nearest":return r==="nearest"?9984:9986;case"linear":return r==="nearest"?9985:9987}}class j1 extends KA{device;handle;parameters;constructor(e,t){super(e,t),this.device=e,this.parameters=ED(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 Gd extends I_{device;gl;handle;texture;constructor(e,t){super(e,{...oi.defaultProps,...t}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=t.texture}}const K$="Failed to deduce GL constant from typed array";function Z$(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(K$)}}function Y$(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 CD(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 Q$(r){switch(r){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function Zm(r,e,t){if(eX(e))return t(r);const{nocatch:n=!0}=e,i=Yf.get(r);i.push(),Cp(r,e);let s;if(n)s=t(r),i.pop();else try{s=t(r)}finally{i.pop()}return s}function eX(r){for(const e in r)return!1;return!0}function tX(r,e,t){const{dimension:n,width:i,height:s,depth:o=0}=t,{glInternalFormat:l}=t,f=t.glTarget;switch(n){case"2d-array":case"3d":r.texStorage3D(f,e,l,i,s,o);break;default:r.texStorage2D(f,e,l,i,s)}}function rS(r,e,t,n){const{width:i,height:s}=n,{dimension:o,depth:l=0,mipLevel:f=0}=n,{x:A=0,y:v=0,z:T=0}=n,{glFormat:I,glType:F}=n,N=SD(n.glTarget,o,l),U=n.flipY?{37440:!0}:{};Zm(r,U,()=>{switch(o){case"2d-array":case"3d":r.bindTexture(N,e),r.texSubImage3D(N,f,A,v,T,i,s,l,I,F,t),r.bindTexture(N,null);break;case"2d":case"cube":r.bindTexture(N,e),r.texSubImage2D(N,f,A,v,i,s,I,F,t),r.bindTexture(N,null);break;default:throw new Error(o)}})}function nS(r,e,t){const{dimension:n,width:i,height:s,depth:o=0,mipLevel:l=0,byteOffset:f=0}=t,{x:A=0,y:v=0,z:T=0}=t,{glFormat:I,glType:F,compressed:N}=t,U=SD(t.glTarget,n,o);switch(n){case"2d-array":case"3d":N?r.compressedTexSubImage3D(U,l,A,v,T,i,s,o,I,e,f):r.texSubImage3D(U,l,A,v,T,i,s,o,I,F,e,f);break;case"2d":case"cube":N?r.compressedTexSubImage2D(U,l,A,v,i,s,I,e,f):r.texSubImage2D(U,l,A,v,i,s,I,F,e,f);break;default:throw new Error(n)}}function rX(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 SD(r,e,t){return e==="cube"?34069+t:r}function nX(r,e){const{sourceX:t=0,sourceY:n=0,sourceAttachment:i=0}=e||{};let{target:s=null,sourceWidth:o,sourceHeight:l,sourceDepth:f,sourceFormat:A,sourceType:v}=e||{};const{framebuffer:T,deleteFramebuffer:I}=ID(r),{gl:F,handle:N}=T;o||=T.width,l||=T.height;const U=T.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=oX(s,v,A,o,l),v=v||Z$(s);const $=F.bindFramebuffer(36160,N);return F.readBuffer(36064+i),F.readPixels(t,n,o,l,A,v,s),F.readBuffer(36064),F.bindFramebuffer(36160,$||null),I&&T.destroy(),s}function iX(r,e){const{target:t,sourceX:n=0,sourceY:i=0,sourceFormat:s=6408,targetByteOffset:o=0}=e||{};let{sourceWidth:l,sourceHeight:f,sourceType:A}=e||{};const{framebuffer:v,deleteFramebuffer:T}=ID(r);l=l||v.width,f=f||v.height;const I=v;A=A||5121;let F=t;if(!F){const U=CD(s),$=Q$(A),V=o+l*f*U*$;F=I.device.createBuffer({byteLength:V})}const N=r.device.createCommandEncoder();return N.copyTextureToBuffer({sourceTexture:r,width:l,height:f,origin:[n,i],destinationBuffer:F,byteOffset:o}),N.destroy(),T&&v.destroy(),F}function ID(r){return r instanceof P_?{framebuffer:r,deleteFramebuffer:!1}:{framebuffer:sX(r),deleteFramebuffer:!0}}function sX(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 oX(r,e,t,n,i,s){if(r)return r;e||=5121;const o=Y$(e,{clamped:!1}),l=CD(t);return new o(n*i*l)}class zA extends oi{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=rX(this.props.dimension);const i=xD(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=oi.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 Gd(this.device,{...this.props,texture:this}),this.bind(),tX(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 Gd(this.device,{...e,texture:this})}setSampler(e={}){let t;e instanceof j1?(this.sampler=e,t=e.props):(this.sampler=new j1(this.device,e),t=e);const n=ED(t);this._setSamplerParameters(n)}generateMipmap(e){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(Yt.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){Yt.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(e){const t=oi.getExternalImageSize(e.image),n={...oi.defaultCopyExternalImageOptions,...t,...e},{image:i,depth:s,mipLevel:o,x:l,y:f,z:A,flipY:v}=n;let{width:T,height:I}=n;const{dimension:F,glTarget:N,glFormat:U,glInternalFormat:$,glType:V}=this;if(T=Math.min(T,this.width-l),I=Math.min(I,this.height-f),e.sourceX||e.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");return rS(this.device.gl,this.handle,i,{dimension:F,mipLevel:o,x:l,y:f,z:A,width:T,height:I,depth:s,glFormat:U,glType:V,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=oi.normalizeTextureData(e,this);n.length>1&&this.props.mipmaps!==!1&&Yt.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(),nS(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 oi.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&&Yt.warn(`${this.id} has mipmap and multiple LODs.`)();const i=oi.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:l=6408,type:f=5121}=e,{gl:A}=this,v=s||o;this.bind(),v instanceof Promise?v.then(T=>this.setImageDataForFace(Object.assign({},e,{face:t,data:T,pixels:T}))):this.width||this.height?A.texImage2D(t,0,l,n,i,0,l,f,v):A.texImage2D(t,0,l,l,f,v)}_getImageDataMap(e){for(let t=0;t<oi.CubeFaces.length;++t){const n=oi.CubeFaces[t];e[n]&&(e[34069+t]=e[n],delete e[n])}return e}_setSamplerParameters(e){Yt.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(oi.isExternalImage(n)){rS(this.device.gl,this.handle,n,{...this,depth:e,mipLevel:t,glTarget:i,flipY:this.props.flipY});return}if(oi.isTextureLevelData(n)){nS(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 aX=[1,2,4,8];class lX extends jf{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,l)=>36064+l);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=aX.map(n=>!!(n&e.colorMask))),this.glParameters=t,Cp(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&&Zm(this.device.gl,e,()=>{this.device.gl.clear(t)})}clearColorBuffer(e=0,t=[0,0,0,0]){Zm(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 cX(r){return uX.includes(r)}const uX=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],BD={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 PD(r){const e=BD[r];if(!e)throw new Error("uniform");const[t,n,,i]=e;return{format:i,components:n,glType:t}}function fX(r){const e=BD[r];if(!e)throw new Error("attribute");const[,t,,n,i]=e;return{attributeType:n,vertexFormat:i,components:t}}function hX(r,e){const t={attributes:[],bindings:[]};t.attributes=dX(r,e);const n=gX(r,e);for(const l of n){const f=l.uniforms.map(A=>({name:A.name,format:A.format,byteOffset:A.byteOffset,byteStride:A.byteStride,arrayLength:A.arrayLength}));t.bindings.push({type:"uniform",name:l.name,group:0,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:f})}const i=AX(r,e);let s=0;for(const l of i)if(cX(l.type)){const{viewDimension:f,sampleType:A}=_X(l.type);t.bindings.push({type:"texture",name:l.name,group:0,location:s,viewDimension:f,sampleType:A}),l.textureUnit=s,s+=1}i.length&&(t.uniforms=i);const o=pX(r,e);return o?.length&&(t.varyings=o),t}function dX(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:l}=s,f=r.getAttribLocation(e,o);if(f>=0){const{attributeType:A}=fX(l),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 pX(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:l,size:f}=s,{glType:A,components:v}=PD(l),T={location:i,name:o,type:A,size:f*v};t.push(T)}return t.sort((i,s)=>i.location-s.location),t}function AX(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:l,type:f}=s,{name:A,isArray:v}=yX(o);let T=r.getUniformLocation(e,A);const I={location:T,name:A,size:l,type:f,isArray:v};if(t.push(I),I.size>1)for(let F=0;F<I.size;F++){const N=`${A}[${F}]`;T=r.getUniformLocation(e,N);const U={...I,name:N,location:T};t.push(U)}}return t}function gX(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:[]},l=t(s,35395)||[],f=r.getActiveUniforms(e,l,35383),A=r.getActiveUniforms(e,l,35384),v=r.getActiveUniforms(e,l,35387),T=r.getActiveUniforms(e,l,35388);for(let I=0;I<o.uniformCount;++I){const F=r.getActiveUniform(e,l[I]);if(!F)throw new Error("activeInfo");o.uniforms.push({name:F.name,format:PD(f[I]).format,type:f[I],arrayLength:A[I],byteOffset:v[I],byteStride:T[I]})}n.push(o)}return n.sort((s,o)=>s.location-o.location),n}const mX={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 _X(r){const e=mX[r];if(!e)throw new Error("sampler");const[t,n]=e;return{viewDimension:t,sampleType:n}}function yX(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 vX(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 bX(r){return lD(r)!==null||typeof r=="number"||typeof r=="boolean"}function xX(r){const e={bindings:{},uniforms:{}};return Object.keys(r).forEach(t=>{const n=r[t];bX(n)?e.uniforms[t]=n:e.bindings[t]=n}),e}function wX(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 TX(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 iS=4;class EX extends lp{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(),Yt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=hX(this.device.gl,this.handle),Yt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=CX(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(l=>`"${l.name}"`).join(", ");t?.disableWarnings||Yt.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${o}`,i)();continue}switch(i||Yt.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),s.type){case"uniform":if(!(i instanceof UA)&&!(i.buffer instanceof UA))throw new Error("buffer value");break;case"texture":if(!(i instanceof Gd||i instanceof zA||i instanceof NA))throw new Error("texture value");break;case"sampler":Yt.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:l,isInstanced:f=!1,firstVertex:A=0,transformFeedback:v}=e,T=wX(i),I=!!s.indexBuffer,F=s.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return Yt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return Yt.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 H$(this.device,n,N.glParameters,()=>{I&&f?this.device.gl.drawElementsInstanced(T,o||0,F,A,l||0):I?this.device.gl.drawElements(T,o||0,F,A):f?this.device.gl.drawArraysInstanced(T,A,o||0,l||0):this.device.gl.drawArrays(T,A,o||0),v&&v.end()}),s.unbindAfterRender(t),!0}setUniformsWebGL(e){const{bindings:t}=xX(e);Object.keys(t).forEach(n=>{Yt.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),Yt.time(iS,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),Yt.timeEnd(iS,`linkProgram for ${this.id}`)(),Yt.level,!this.device.features.has("compilation-status-async-webgl")){const n=this._getLinkStatus();this._reportLinkStatus(n);return}Yt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Yt.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$/,"")]&&(Yt.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,l=e.getUniformBlockIndex(this.handle,o);if(l===4294967295)throw new Error(`Invalid uniform block name ${o}`);e.uniformBlockBinding(this.handle,n,l),s instanceof UA?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 Gd||s instanceof zA||s instanceof NA))throw new Error("texture");let f;if(s instanceof Gd)f=s.texture;else if(s instanceof zA)f=s;else if(s instanceof NA&&s.colorAttachments[0]instanceof Gd)Yt.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&&vX(this.device.gl,n,i,o)}}}function CX(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):Yt.warn(`shader layout attribute ${n.name} not present in shader`)}return t}class SX extends rx{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":IX(this.device,t.options);break;case"copy-buffer-to-texture":BX(this.device,t.options);break;case"copy-texture-to-buffer":PX(this.device,t.options);break;case"copy-texture-to-texture":MX(this.device,t.options);break;default:throw new Error(t.name)}}}function IX(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 BX(r,e){throw new Error("Not implemented")}function PX(r,e){const{sourceTexture:t,mipLevel:n=0,aspect:i="all",width:s=e.sourceTexture.width,height:o=e.sourceTexture.height,depthOrArrayLayers:l=0,origin:f=[0,0],destinationBuffer:A,byteOffset:v=0,bytesPerRow:T,rowsPerImage:I}=e;if(i!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||l!==0||T||I)throw new Error("not implemented");const{framebuffer:F,destroyFramebuffer:N}=MD(t);let U;try{const $=A,V=s||F.width,j=o||F.height,X=xD(F.colorAttachments[0].texture.props.format),ue=X.format,K=X.type;r.gl.bindBuffer(35051,$.handle),U=r.gl.bindFramebuffer(36160,F.handle),r.gl.readPixels(f[0],f[1],V,j,ue,K,v)}finally{r.gl.bindBuffer(35051,null),U!==void 0&&r.gl.bindFramebuffer(36160,U),N&&F.destroy()}}function MX(r,e){const{sourceTexture:t,destinationMipLevel:n=0,origin:i=[0,0],destinationOrigin:s=[0,0],destinationTexture:o}=e;let{width:l=e.destinationTexture.width,height:f=e.destinationTexture.height}=e;const{framebuffer:A,destroyFramebuffer:v}=MD(t),[T,I]=i,[F,N,U]=s,$=r.gl.bindFramebuffer(36160,A.handle);let V=null,j;if(o instanceof zA)V=o,l=Number.isFinite(l)?l:V.width,f=Number.isFinite(f)?f:V.height,V.bind(0),j=V.glTarget;else throw new Error("invalid destination");switch(j){case 3553:case 34067:r.gl.copyTexSubImage2D(j,n,F,N,T,I,l,f);break;case 35866:case 32879:r.gl.copyTexSubImage3D(j,n,F,N,U,T,I,l,f);break}V&&V.unbind(),r.gl.bindFramebuffer(36160,$),v&&A.destroy()}function MD(r){if(r instanceof oi){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 RX extends tx{device;commandBuffer;constructor(e,t){super(e,t),this.device=e,this.commandBuffer=new SX(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 OX(r){const{target:e,source:t,start:n=0,count:i=1}=r,s=t.length,o=i*s;let l=0;for(let f=n;l<s;l++)e[f++]=t[l];for(;l<o;)l<o-l?(e.copyWithin(n+l,n,n+l),l*=2):(e.copyWithin(n+l,n,n+o-l),l=o);return r.target}class Fx extends nx{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return UN()==="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:l,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,l):this.device.gl.vertexAttribPointer(e,i,s,f,o,l),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=bD(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=Fx.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=DX(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||!FX(n,this.bufferValue),o){const l=Fz(t.constructor,s);OX({target:l,source:n,start:0,count:s}),this.buffer.write(l),this.bufferValue=t}return this.buffer}}function DX(r){return Array.isArray(r)?new Float32Array(r):r}function FX(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 LX extends ix{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(TX(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,Yt.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(sS(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 UA)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(sS(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 sS(r){return typeof r=="number"?Number.isInteger(r):/^\d+$/.test(r)}class kX extends sx{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 jd extends Hu{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||U$("webgl-device")});const t=Hu._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 I$(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||l$(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 Yt.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=M$({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=c$(this.gl,this._extensions),this.limits=new E$(this.gl),this.features=new T$(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),t.autoResize!==!1&&this.canvasContext.resize(),new Yf(this.gl,{log:(...v)=>Yt.log(1,...v)()}).trackState(this.gl,{copyState:!1});const f=e.debugWebGL||e.debug,A=e.debugWebGL;f&&(this.gl=D$(this.gl,{debugWebGL:f,traceWebGL:A}),Yt.warn("WebGL debug mode activated. Performance reduced.")(),e.debugWebGL&&(Yt.level=Math.max(Yt.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 UA(this,t)}createTexture(e){return new zA(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new j1(this,e)}createShader(e){return new j$(this,e)}createFramebuffer(e){return new NA(this,e)}createVertexArray(e){return new Fx(this,e)}createTransformFeedback(e){return new LX(this,e)}createQuerySet(e){return new kX(this,e)}createRenderPipeline(e){return new EX(this,e)}beginRenderPass(e){return new lX(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 RX(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,t){return nX(e,t)}readPixelsToBufferWebGL(e,t){return iX(e,t)}setParametersWebGL(e){Cp(this.gl,e)}getParametersWebGL(e){return yD(this.gl,e)}withParametersWebGL(e,t){return Zm(this.gl,e,t)}resetWebGL(){Yt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),n$(this.gl)}_getDeviceSpecificTextureFormatCapabilities(e){return v$(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(){Yf.get(this.gl).push()}popState(){Yf.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&&VX(i,t)&&Yt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=t,t.constructor){case Float32Array:NX(this,e,t);break;case Int32Array:UX(this,e,t);break;case Uint32Array:zX(this,e,t);break;default:throw new Error("constant")}}getExtension(e){return dp(this.gl,e,this._extensions),this._extensions}}function NX(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 UX(r,e,t){r.gl.vertexAttribI4iv(e,t)}function zX(r,e,t){r.gl.vertexAttribI4uiv(e,t)}function VX(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}
2007const GX={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:{}},jX=r=>({drawBuffersWEBGL(e){return r.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),HX=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)}}),WX=r=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return r.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return r.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return r.vertexAttribDivisor(...e)}});function $X(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&&XX(i),i}return this.originalGetContext(t,n)}}function XX(r){r.getExtension("EXT_color_buffer_float");const e={...GX,WEBGL_disjoint_timer_query:r.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:jX(r),OES_vertex_array_object:HX(r),ANGLE_instanced_arrays:WX(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 E0=1;class qX extends fz{type="webgl";constructor(){super(),Hu.defaultProps={...Hu.defaultProps,...Dx},jd.adapter=this}isSupported(){return typeof WebGL2RenderingContext<"u"}enforceWebGL2(e){$X(e)}async attach(e){if(e instanceof jd)return e;if(e?.device instanceof Hu)return e.device;if(!JX(e))throw new Error("Invalid WebGL2RenderingContext");return new jd({_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1}})}async create(e={}){Yt.groupCollapsed(E0,"WebGLDevice created")();const t=[];(e.debugWebGL||e.debug)&&t.push(O$()),e.debugSpectorJS&&t.push(P$(e));const n=await Promise.allSettled(t);for(const o of n)o.status==="rejected"&&Yt.error(`Failed to initialize debug libraries ${o.reason}`)();const i=new jd(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 Yt.probe(E0,s)(),Yt.table(E0,i.info)(),Yt.groupEnd(E0)(),i}}function JX(r){return typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext?!0:!!(r&&Number.isFinite(r._version))}const oS=new qX;function Du(){}const KX=({isDragging:r})=>r?"grabbing":"grab",RD={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:Du,onWebGLInitialized:Du,onResize:Du,onViewStateChange:Du,onInteractionStateChange:Du,onBeforeRender:Du,onAfterRender:Du,onLoad:Du,onError:r=>Zr.error(r.message,r.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:KX,getTooltip:null,debug:!1,drawPickingColors:!1};class Lx{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 hh({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=R1[n.type],s=n.offsetCenter;if(!i||!s||!this.layerManager)return;const o=this.layerManager.getLayers(),l=this.deckPicker.getLastPickedObject({x:s.x,y:s.y,layers:o,viewports:this.getViewports(s)},this._lastPointerDownInfo),{layer:f}=l,A=f&&(f[i]||f.props[i]),v=this.props[i];let T=!1;A&&(T=A.call(f,l,n)),T||(v?.(l,n),this.widgetManager.onEvent(l,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={...RD,...e},e=this.props,e.viewState&&e.initialViewState&&Zr.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&&Zr.error("WebGL1 context not supported.")(),t=oS.attach(e.gl)),t||(t=b1.createDevice({type:"best-available",_reuseDevices:!0,adapters:[oS],...e.deviceProps,createCanvasContext:{canvas:this._createCanvas(e),useDevicePixels:this.props.useDevicePixels,autoResize:!1}})),this.animationLoop=this._createAnimationLoop(t,e),this.setProps(e),e._typedArrayManagerProps&&fp.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&&Zr.removed("onLayerHover","onHover")(),"onLayerClick"in e&&Zr.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 Ks(this.viewManager),this.viewManager.views}getViewports(e){return Ks(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: 57,705 bytes, lines 2007-2087
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){Ks(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),Ks(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 RH({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 gD({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 aD;t.play(),this.animationLoop.attachTimeline(t),this.eventManager=new cj(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(E3).map(i=>{const[s,o,l,f]=E3[i],A=this.props.eventRecognizerOptions?.[i],v={...o,...A,event:i};return{recognizer:new s(v),recognizeWith:l,requestFailure:f}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const i in R1)this.eventManager.on(i,this._onEvent);this.viewManager=new wW({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 xW(this.device,{deck:this,stats:this.stats,viewport:n,timeline:t}),this.effectManager=new UW({deck:this,device:this.device}),this.deckRenderer=new GW(this.device),this.deckPicker=new qW(this.device),this.widgetManager=new ZW({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new QW),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(),Zr.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=b1.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}}Lx.defaultProps=RD;Lx.VERSION=_9;function ZX(r){switch(r){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return K4(r)}}const YX=J4;function C0(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 $f(r){return r.stride||r.size*r.bytesPerElement}function QX(r,e){return r.type===e.type&&r.size===e.size&&$f(r)===$f(e)&&(r.offset||0)===(e.offset||0)}function H1(r,e){e.offset&&Zr.removed("shaderAttribute.offset","vertexOffset, elementOffset")();const t=$f(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 eq(r,e){const t=H1(r,e);return{high:t,low:{...t,offset:t.offset+r.size*4}}}class tq{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 l;s?l="float32":!i&&t.isIndexed?l="uint32":l=i||"float32";let f=ZX(i||l);this.doublePrecision=s,s&&t.fp64===!1&&(f=Float32Array),this.value=null,this.settings={...t,defaultType:f,defaultValue:o,logicalType:i,type:l,normalized:l.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*$f(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),fp.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=H1(this.getAccessor(),t),o=s.offset/i.BYTES_PER_ELEMENT,l=s.size||this.size;n[e]=i.subarray(o,o+l)}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:$f(n),attributes:i};if(this.doublePrecision){const o=eq(n,t||{});i.push(C0(e,{...n,...o.high},this.device.type),C0(`${e}64Low`,{...n,...o.low},this.device.type))}else if(t){const o=H1(n,t);i.push(C0(e,{...n,...o},this.device.type))}else i.push(C0(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),l=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>l[A]&&(l[A]=v)}e=[o,l]}}return this.state.bounds=e,e}setData(e){const{state:t}=this;let n;ArrayBuffer.isView(e)?n={value:e}:e instanceof Hi?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=YX(n.value);i.type=i.normalized?o.replace("int","norm"):o}i.bytesPerElement=n.value.BYTES_PER_ELEMENT,i.stride=$f(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 l=$f(i),f=(i.vertexOffset||0)*l;if(this.doublePrecision&&s instanceof Float64Array&&(s=xv(s,i)),this.settings.isIndexed){const v=this.settings.defaultType;s.constructor!==v&&(s=new v(s))}const A=s.byteLength+f+l*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?xv(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=fp.allocate(i,e+1,{size:this.size,type:this.settings.defaultType,copy:t});this.value=s;const{byteOffset:o}=this;let{buffer:l}=this;return(!l||l.byteLength<s.byteLength+o)&&(l=this._createBuffer(s.byteLength+o),t&&i&&l.write(i instanceof Float64Array?xv(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)&&Zr.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?Hi.INDEX:Hi.VERTEX)|Hi.COPY_DST,indexType:t?n:void 0,byteLength:e}),this._buffer}}const aS=[],lS=[];function dc(r,e=0,t=1/0){let n=aS;const i={index:-1,data:r,target:[]};return r?typeof r[Symbol.iterator]=="function"?n=r:r.length>0&&(lS.length=r.length,n=lS):n=aS,(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 OD(r){return r&&r[Symbol.asyncIterator]}function DD(r,e){const{size:t,stride:n,offset:i,startIndices:s,nested:o}=e,l=r.BYTES_PER_ELEMENT,f=n?n/l:t,A=i?i/l:0,v=Math.floor((r.length-A)/f);return(T,{index:I,target:F})=>{if(!s){const V=I*f+A;for(let j=0;j<t;j++)F[j]=r[V+j];return F}const N=s[I],U=s[I+1]||v;let $;if(o){$=new Array(U-N);for(let V=N;V<U;V++){const j=V*f+A;F=new Array(t);for(let X=0;X<t;X++)F[X]=r[j+X];$[V-N]=F}}else if(f===t)$=r.subarray(N*t+A,U*t+A);else{$=new r.constructor((U-N)*t);let V=0;for(let j=N;j<U;j++){const X=j*f+A;for(let ue=0;ue<t;ue++)$[V++]=r[X+ue]}}return $}}const rq=[],mm=[[0,1/0]];function nq(r,e){if(r===mm||(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 iq={interpolation:{duration:0,easing:r=>r},spring:{stiffness:.05,damping:.5}};function FD(r,e){if(!r)return null;Number.isFinite(r)&&(r={type:"interpolation",duration:r});const t=r.type||"interpolation";return{...iq[t],...e,...r,type:t}}class LD extends tq{constructor(e,t){super(e,t,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:mm}),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=!QX(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 FD(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=nq(this.state.updateRanges,[n,i])}else this.state.updateRanges=mm}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=rq}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!==mm),!0):!1}updateBuffer({numInstances:e,data:t,props:n,context:i}){if(!this.needsUpdate())return!1;const{state:{updateRanges:s},settings:{update:o,noAlloc:l}}=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 T=Number.isFinite(A)?this.getVertexOffset(A):0,I=Number.isFinite(v)?this.getVertexOffset(v):l||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:T,endOffset:I})}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;Ks(ArrayBuffer.isView(o.value),`invalid ${i.accessor}`);const l=!!o.size&&o.size!==this.size;return n.binaryAccessor=DD(o.value,{size:o.size||this.size,stride:o.stride,offset:o.offset,startIndices:t,nested:l}),!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:l,state:f,value:A,size:v,startIndices:T}=e,{accessor:I,transform:F}=l;let N=f.binaryAccessor||(typeof I=="function"?I:s[I]);typeof N!="function"&&(N=()=>N),Ks(typeof N=="function",`accessor "${I}" is not a function`);let U=e.getVertexOffset(n);const{iterable:$,objectInfo:V}=dc(t,n,i);for(const j of $){V.index++;let X=N(j,V);if(F&&(X=F.call(this,X)),T){const ue=(V.index<T.length-1?T[V.index+1]:o)-T[V.index];if(X&&Array.isArray(X[0])){let K=U;for(const se of X)e._normalizeValue(se,A,K),K+=v}else X&&X.length>v?A.set(X,U):(e._normalizeValue(X,V.target,0),mW({target:A,source:V.target,start:U,count:ue}));U+=ue*v}else e._normalizeValue(X,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 Rv(r){const{source:e,target:t,start:n=0,size:i,getData:s}=r,o=r.end||t.length,l=e.length,f=o-n;if(l>f){t.set(e.subarray(0,f),n);return}if(t.set(e,n),!s)return;let A=l;for(;A<f;){const v=s(A,e);for(let T=0;T<i;T++)t[n+A]=v[T]||0,A++}}function sq({source:r,target:e,size:t,getData:n,sourceStartIndices:i,targetStartIndices:s}){if(!i||!s)return Rv({source:r,target:e,size:t,getData:n}),e;let o=0,l=0;const f=n&&((v,T)=>n(v+l,T)),A=Math.min(i.length,s.length);for(let v=1;v<A;v++){const T=i[v]*t,I=s[v]*t;Rv({source:r.subarray(o,T),target:e,start:l,end:I,size:t,getData:f}),o=T,l=I}return l<e.length&&Rv({source:[],target:e,start:l,size:t,getData:f}),e}function oq(r){const{device:e,settings:t,value:n}=r,i=new LD(e,t);return i.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:t.normalized}),i}function kD(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 ND(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 UD(r){r.push(r.shift())}function aq(r,e){const{doublePrecision:t,settings:n,value:i,size:s}=r,o=t&&i instanceof Float64Array?2:1;let l=0;const{shaderAttributes:f}=r.settings;if(f)for(const A of Object.values(f))l=Math.max(l,A.vertexOffset??0);return(n.noAlloc?i.length:(e+l)*s)*o}function zD({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 VD({device:r,buffer:e,attribute:t,fromLength:n,toLength:i,fromStartIndices:s,getData:o=l=>l}){const l=t.doublePrecision&&t.value instanceof Float64Array?2:1,f=t.size*l,A=t.byteOffset,v=t.settings.bytesPerElement<4?A/t.settings.bytesPerElement*4:A,T=t.startIndices,I=s&&T,F=t.isConstant;if(!I&&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 X=o;o=(ue,K)=>t.normalizeConstant(X(ue,K))}const $=F?(X,ue)=>o(U,ue):(X,ue)=>o(U.subarray(X+A,X+A+f),ue),V=e?new Float32Array(e.readSyncWebGL(v,n*4).buffer):new Float32Array(0),j=new Float32Array(i);return sq({source:V,target:j,sourceStartIndices:s,targetStartIndices:T,size:f,getData:$}),(!e||e.byteLength<j.byteLength+v)&&(e?.destroy(),e=r.createBuffer({byteLength:j.byteLength+v,usage:35050})),e.write(j,v),e}class GD{constructor({device:e,attribute:t,timeline:n}){this.buffers=[],this.currentLength=0,this.device=e,this.transition=new L_(n),this.attribute=t,this.attributeInTransition=oq(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=aq(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 lq extends GD{constructor({device:e,attribute:t,timeline:n}){super({device:e,attribute:t,timeline:n}),this.type="interpolation",this.transform=hq(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;UD(s),s[0]=VD({device:this.device,buffer:s[0],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:i,getData:e.enter}),s[1]=zD({device:this.device,source:s[0],target:s[1]}),this.setBuffer(s[1]);const{transform:l}=this,f=l.model;let A=Math.floor(this.currentLength/o.size);jD(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()}),l.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 cq=`uniform interpolationUniforms { 2008 float time; 2009} interpolation; 2010`,cS={name:"interpolation",vs:cq,uniformTypes:{time:"f32"}},uq=`#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`,fq=`#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 jD(r){return r.doublePrecision&&r.value instanceof Float64Array}function hq(r,e){const t=e.size,n=kD(t),i=ND(t),s=e.getBufferLayout();return jD(e)?new nh(r,{vs:fq,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:[QV,cS],defines:{ATTRIBUTE_TYPE:n,ATTRIBUTE_SIZE:t},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0}):new nh(r,{vs:uq,bufferLayout:[{name:"aFrom",format:i},{name:"aTo",format:s.attributes[0].format}],modules:[cS],defines:{ATTRIBUTE_TYPE:n},varyings:["vCurrent"],disableWarnings:!0})}class dq extends GD{constructor({device:e,attribute:t,timeline:n}){super({device:e,attribute:t,timeline:n}),this.type="spring",this.texture=yq(e),this.framebuffer=vq(e,this.texture),this.transform=_q(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]=VD({device:this.device,buffer:s[f],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:i,getData:e.enter});s[2]=zD({device:this.device,source:s[0],target:s[2]}),this.setBuffer(s[1]);const{model:l}=this.transform;l.setVertexCount(Math.floor(this.currentLength/o.size)),o.isConstant?l.setConstantAttributes({aTo:o.value}):l.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]}),UD(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 pq=`uniform springUniforms { 2045 float damping; 2046 float stiffness; 2047} spring; 2048`,Aq={name:"spring",vs:pq,uniformTypes:{damping:"f32",stiffness:"f32"}},gq=`#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`,mq=`#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 _q(r,e){const t=kD(e.size),n=ND(e.size);return new nh(r,{vs:gq,fs:mq,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[Aq],defines:{ATTRIBUTE_TYPE:t},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function yq(r){return r.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function vq(r,e){return r.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}const bq={interpolation:lq,spring:dq};class xq{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=bq[n.type];o?this.transitions[e]=new o({attribute:t,timeline:this.timeline,device:this.device}):(Zr.error(`unsupported transition type '${n.type}'`)(),s=!1)}(s||t.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(n,this.numInstances))}}const uS="attributeManager.invalidate",wq="attributeManager.updateStart",Tq="attributeManager.updateEnd",Eq="attribute.updateStart",Cq="attribute.allocate",Sq="attribute.updateEnd";class k_{constructor(e,{id:t="attribute-manager",stats:n,timeline:i}={}){this.mergeBoundsMemoized=dg(yH),this.id=t,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new xq(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(uS,this,e,n)}invalidateAll(e){for(const t in this.attributes)this.attributes[t].setNeedsUpdate(t,e);Ao(uS,this,"all")}update({data:e,numInstances:t,startIndices:n=null,transitions:i,props:s={},buffers:o={},context:l={}}){let f=!1;Ao(wq,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(const A in this.attributes){const v=this.attributes[A],T=v.settings.accessor;v.startIndices=n,v.numInstances=t,s[A]&&Zr.removed(`props.${A}`,`data.attributes.${A}`)(),v.setExternalBuffer(o[A])||v.setBinaryValue(typeof T=="string"?o[T]:void 0,e.startIndices)||typeof T=="string"&&!o[T]&&v.setConstantValue(s[T])||v.needsUpdate()&&(f=!0,this._updateAttribute({attribute:v,numInstances:t,data:e,props:s,context:l})),this.needsRedraw=this.needsRedraw||v.needsRedraw()}f&&Ao(Tq,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 LD(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 l=n[o];l&&l.setNeedsUpdate(l.id,t)}),s}_updateAttribute(e){const{attribute:t,numInstances:n}=e;if(Ao(Eq,t),t.constant){t.setConstantValue(t.value);return}t.allocate(n)&&Ao(Cq,t,n),t.updateBuffer(e)&&(this.needsRedraw=!0,Ao(Sq,t,n))}}class Iq extends L_{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=wl(t,n,o)}}const fS=1e-5;function hS(r,e,t,n,i){const s=e-r,l=(t-e)*i,f=-s*n;return l+f+s+e}function Bq(r,e,t,n,i){if(Array.isArray(t)){const s=[];for(let o=0;o<t.length;o++)s[o]=hS(r[o],e[o],t[o],n,i);return s}return hS(r,e,t,n,i)}function dS(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 Pq extends L_{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 l=Bq(s,o,t,n,i);const f=dS(l,t),A=dS(l,o);f<fS&&A<fS&&(l=t,this.end()),this._prevValue=o,this._currValue=l}}const Mq={interpolation:Iq,spring:Pq};class Rq{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=FD(i),!i)return;const o=Mq[i.type];if(!o){Zr.error(`unsupported transition type '${i.type}'`)();return}const l=new o(this.timeline);l.start({...i,fromValue:t,toValue:n}),s.set(e,l)}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 Oq(r){const e=r[$u];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 Dq(r,e){const t=kx({newProps:r,oldProps:e,propTypes:r[$u],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=Lq(r,e);let i=!1;return n||(i=kq(r,e)),{dataChanged:n,propsChanged:t,updateTriggersChanged:i,extensionsChanged:Nq(r,e),transitionsChanged:Fq(r,e)}}function Fq(r,e){if(!r.transitions)return!1;const t={},n=r[$u];let i=!1;for(const s in r.transitions){const o=n[s],l=o&&o.type;(l==="number"||l==="color"||l==="array")&&W1(r[s],e[s],o)&&(t[s]=!0,i=!0)}return i?t:!1}function kx({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=W1(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=W1(r[s],e[s],n[s]);if(o)return`${i}.${s} ${o}`}}return!1}function W1(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 Lq(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 kq(r,e){if(e===null)return{all:!0};if("all"in r.updateTriggers&&pS(r,e,"all"))return{all:!0};const t={};let n=!1;for(const i in r.updateTriggers)i!=="all"&&pS(r,e,i)&&(t[i]=!0,n=!0);return n?t:!1}function Nq(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 pS(r,e,t){let n=r.updateTriggers[t];n=n??{};let i=e.updateTriggers[t];return i=i??{},kx({oldProps:i,newProps:n,triggerName:t})}const Uq="count(): argument not an object",zq="count(): argument not a container";function Vq(r){if(!jq(r))throw new Error(Uq);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(Gq(r))return Object.keys(r).length;throw new Error(zq)}function Gq(r){return r!==null&&typeof r=="object"&&r.constructor===Object}function jq(r){return r!==null&&typeof r=="object"}function AS(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 Hq={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},$1={};function Wq(r,e,t,n){if(t instanceof oi)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:{...Hq,...i,...n},mipmaps:!0});return $1[s.id]=r,s}function $q(r,e){!e||!(e instanceof oi)||$1[e.id]===r&&(e.delete(),delete $1[e.id])}const Xq={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||X1(r)&&(r.length===3||r.length===4)},equal(r,e,t){return rs(r,e,1)}},accessor:{validate(r,e){const t=Ym(r);return t==="function"||t===Ym(e.value)},equal(r,e,t){return typeof e=="function"?!0:rs(r,e,1)}},array:{validate(r,e){return e.optional&&!r||X1(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:Wq(t.id,n.device,r,{...e.parameters,...t.props.textureParameters})},release:(r,e,t)=>{$q(t.id,r)}}};function qq(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 l=Jq(i,s);e[i]=l,t[i]=l.value}}return{propTypes:e,defaultProps:t,deprecatedProps:n}}function Jq(r,e){switch(Ym(e)){case"object":return pA(r,e);case"array":return pA(r,{type:"array",value:e,compare:!1});case"boolean":return pA(r,{type:"boolean",value:e});case"number":return pA(r,{type:"number",value:e});case"function":return pA(r,{type:"function",value:e,compare:!0});default:return{name:r,type:"unknown",value:e}}}function pA(r,e){return"type"in e?{name:r,...Xq[e.type],...e}:"value"in e?{name:r,type:Ym(e.value),...e}:{name:r,type:"object",value:e}}function X1(r){return Array.isArray(r)||ArrayBuffer.isView(r)}function Ym(r){return X1(r)?"array":r===null?"null":typeof r}function Kq(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=q1(r.constructor,t),i=Object.create(n);i[Km]=r,i[ih]={},i[Vu]={};for(let s=0;s<e.length;++s){const o=e[s];for(const l in o)i[l]=o[l]}return Object.freeze(i),i}const Zq="_mergedDefaultProps";function q1(r,e){if(!(r instanceof N_.constructor))return{};let t=Zq;if(e)for(const i of e){const s=i.constructor;s&&(t+=`:${s.extensionName||s.name}`)}const n=HD(r,t);return n||(r[t]=Yq(r,e||[]))}function Yq(r,e){if(!r.prototype)return null;const n=Object.getPrototypeOf(r),i=q1(n),s=HD(r,"defaultProps")||{},o=qq(s),l=Object.assign(Object.create(null),i,o.defaultProps),f=Object.assign(Object.create(null),i?.[$u],o.propTypes),A=Object.assign(Object.create(null),i?.[Sv],o.deprecatedProps);for(const v of e){const T=q1(v.constructor);T&&(Object.assign(l,T),Object.assign(f,T[$u]),Object.assign(A,T[Sv]))}return Qq(l,r),tJ(l,f),eJ(l,A),l[$u]=f,l[Sv]=A,e.length===0&&!Nx(r,"_propTypes")&&(r._propTypes=f),l}function Qq(r,e){const t=nJ(e);Object.defineProperties(r,{id:{writable:!0,value:t}})}function eJ(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])Nx(this,s)||(this[s]=n);Zr.deprecated(i,e[t].join("/"))()}})}function tJ(r,e){const t={},n={};for(const i in e){const s=e[i],{name:o,value:l}=s;s.async&&(t[o]=l,n[o]=rJ(o))}r[ep]=t,r[ih]={},Object.defineProperties(r,n)}function rJ(r){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||OD(e)?this[ih][r]=e:this[Vu][r]=e},get(){if(this[Vu]){if(r in this[Vu])return this[Vu][r]||this[ep][r];if(r in this[ih]){const e=this[Km]&&this[Km].internalState;if(e&&e.hasAsyncProp(r))return e.getAsyncProp(r)||this[ep][r]}}return this[ep][r]}}}function Nx(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function HD(r,e){return Nx(r,e)&&r[e]}function nJ(r){const e=r.componentName;return e||Zr.warn(`${r.name}.componentName not specified`)(),e||r.name}let iJ=0;class N_{constructor(...e){this.props=Kq(this,e),this.id=this.props.id,this.count=iJ++}clone(e){const{props:t}=this,n={};for(const i in t[ep])i in t[Vu]?n[i]=t[Vu][i]:i in t[ih]&&(n[i]=t[ih][i]);return new this.constructor({...t,...n,...e})}}N_.componentName="Component";N_.defaultProps={};const sJ=Object.freeze({});class oJ{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||sJ}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[Km]||this.component;const t=e[Vu]||{},n=e[ih]||e,i=e[ep]||{};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(OD(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 l of t){if(!this.component)return;const{dataTransform:f}=this.component.props;f?s=f(l,s):s=s.concat(l),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[$u];this.asyncProps[e]={type:i&&i[e],lastValue:null,resolvedValue:t,pendingLoadCount:0,resolvedLoadCount:0}}}}class aJ extends oJ{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 lJ="layer.changeFlag",cJ="layer.initialize",uJ="layer.update",fJ="layer.finalize",hJ="layer.matched",gS=2**24-1,dJ=Object.freeze([]),pJ=dg(({oldViewport:r,viewport:e})=>r.equals(e));let ll=new Uint8ClampedArray(0);const AJ={data:{type:"data",value:dJ,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 l=o.contains(r);return!l&&!i&&(o.add({resourceId:r,data:Kc(r,n),persistent:!1}),l=!0),l?o.subscribe({resourceId:r,onChange:f=>t.internalState?.reloadAsyncProp(e,f),consumerId:t.id,requestId:e}):Kc(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 Cs extends N_{constructor(){super(...arguments),this.internalState=null,this.lifecycle=Od.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){Ks(this.internalState);const t=this.internalState.viewport||this.context.viewport,n=oD(e,{viewport:t,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[i,s,o]=tD(n,t.pixelProjectionMatrix);return e.length===2?[i,s]:[i,s,o]}unproject(e){return Ks(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,t){Ks(this.internalState);const n=this.internalState.viewport||this.context.viewport;return EH(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){Ks(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:Vq(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=AS(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(const t of this.props.extensions)e=AS(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(l=>l.getNeedsPickingBuffer.call(this,l));if(s!==o){this.internalState.hasPickingBuffer=o;const{pickingColors:l,instancePickingColors:f}=t.attributes,A=l||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||!pJ({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(ll.length/4);if(this.internalState.usesPickingColorCache=!0,n<t){t>gS&&Zr.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),ll=fp.allocate(ll,t,{size:4,copy:!0,maxCount:Math.max(t,gS)});const i=Math.floor(ll.length/4),s=[0,0,0];for(let o=n;o<i;o++)this.encodePickingColor(o,s),ll[o*4+0]=s[0],ll[o*4+1]=s[1],ll[o*4+2]=s[2],ll[o*4+3]=0}e.value=ll.subarray(0,t*4)}_setModelAttributes(e,t,n=!1){if(!Object.keys(t).length)return;if(n){const l=this.getAttributeManager();e.setBufferLayout(l.getBufferLayouts(e)),t=l.getAttributes()}const i=e.userData?.excludeAttributes||{},s={},o={};for(const l in t){if(i[l])continue;const f=t[l].getValue();for(const A in f){const v=f[A];v instanceof Hi?t[l].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 l=o.value,f=this.encodePickingColor(e);for(let A=0;A<t.length;A++){const v=s.getVertexOffset(A);l[v]===f[0]&&l[v+1]===f[1]&&l[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!==ll.buffer&&(n.value=ll.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){Ks(!this.internalState),Ks(Number.isFinite(this.props.coordinateSystem)),Ao(cJ,this);const e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new aJ({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(Zr.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new Rq(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(hJ,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(uJ,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 l=this._getUpdateParams(),f=this.getModels();if(n.device)this.updateState(l);else try{this.updateState(l)}catch{}for(const v of this.props.extensions)v.updateState.call(this,l,v);this.setNeedsRedraw(),this._updateAttributes();const A=this.getModels()[0]!==f[0];this._postUpdate(l,A)}finally{n.viewport=s,this.props=t,this._clearChangeFlags(),i.needsUpdate=!1,i.resetOldProps()}}_finalize(){Ao(fJ,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:l}=this.props,f=l&&l(n)||[0,0];o.device instanceof jd&&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 jd)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],l=t[i];o&&Array.isArray(l)&&(t.dataChanged=Array.isArray(o)?l.concat(o):o,s=!0);default:t[i]||(t[i]=e[i],s=!0)}s&&Ao(lJ,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=Dq(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(){Oq(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 k_(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:l,highlightColor:f}=n;if(t||i.autoHighlight!==o||i.highlightedObjectIndex!==l||i.highlightColor!==f){const A={};Array.isArray(f)&&(A.highlightColor=f),(t||i.autoHighlight!==o||l!==i.highlightedObjectIndex)&&(A.highlightedObjectColor=Number.isFinite(l)&&l>=0?this.encodePickingColor(l):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()}}Cs.defaultProps=AJ;Cs.layerName="Layer";const gJ="compositeLayer.renderLayers";class Ss extends Cs{get isComposite(){return!0}get isDrawable(){return!1}
2087get 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:l,autoHighlight:f,highlightColor:A,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:I,positionFormat:F,modelMatrix:N,extensions:U,fetch:$,operation:V,_subLayerProps:j}=this.props,X={id:"",updateTriggers:{},opacity:t,pickable:n,visible:i,parameters:s,getPolygonOffset:o,highlightedObjectIndex:l,autoHighlight:f,highlightColor:A,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:I,positionFormat:F,modelMatrix:N,extensions:U,fetch:$,operation:V},ue=j&&e.id&&j[e.id],K=ue&&ue.updateTriggers,se=e.id||"sublayer";if(ue){const Ee=this.props[$u],Ue=e.type?e.type._propTypes:{};for(const de in ue){const me=Ue[de]||Ee[de];me&&me.type==="accessor"&&(ue[de]=this.getSubLayerAccessor(ue[de]))}}Object.assign(X,e,ue),X.id=`${this.props.id}-${se}`,X.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...K};for(const Ee of U){const Ue=Ee.getSubLayerProps.call(this,Ee);Ue&&Object.assign(X,Ue,{updateTriggers:Object.assign(X.updateTriggers,Ue.updateTriggers)})}return X}_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=F_(s,Boolean),this.internalState.subLayers=n}Ao(gJ,this,i,n);for(const s of n)s.parent=this}}Ss.layerName="CompositeLayer";const S0=Math.PI/180,mS=180/Math.PI,_m=6370972,Hd=256;function mJ(){const r=Hd/_m,e=Math.PI/180*Hd;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 _J extends eu{constructor(e={}){const{longitude:t=0,zoom:n=0,nearZMultiplier:i=.5,farZMultiplier:s=1,resolution:o=10}=e;let{latitude:l=0,height:f,altitude:A=1.5,fovy:v}=e;l=Math.max(Math.min(l,Nd),-Nd),f=f||1,v?A=Sx(v):v=eg(A);const T=1/Math.PI/Math.cos(l*Math.PI/180),I=Math.pow(2,n)*T,F=e.nearZ??i,N=e.farZ??(A+Hd*2*I/f)*s,U=new vn().lookAt({eye:[0,-A,0],up:[0,0,1]});U.rotateX(l*S0),U.rotateZ(-t*S0),U.scale(I/f),super({...e,height:f,viewMatrix:U,longitude:t,latitude:l,zoom:n,distanceScales:mJ(),fovy:v,focalDistance:A,near:F,far:N}),this.scale=I,this.latitude=l,this.longitude=t,this.resolution=o}get projectionMode(){return ha.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,l=t?s:this.height-s,{pixelUnprojectionMatrix:f}=this;let A;if(Number.isFinite(o))A=Ov(f,[i,l,o,1]);else{const F=Ov(f,[i,l,-1,1]),N=Ov(f,[i,l,1,1]),U=((n||0)/_m+1)*Hd,$=pv(IO([],F,N)),V=pv(F),j=pv(N),ue=4*((4*V*j-($-V-j)**2)/16)/$,K=Math.sqrt(V-ue),se=Math.sqrt(Math.max(0,U*U-ue)),Ee=(K-se)/Math.sqrt($);A=V7([],F,N,Ee)}const[v,T,I]=this.unprojectPosition(A);return Number.isFinite(o)?[v,T,I]:Number.isFinite(n)?[v,T,n]:[v,T]}projectPosition(e){const[t,n,i=0]=e,s=t*S0,o=n*S0,l=Math.cos(o),f=(i/_m+1)*Hd;return[Math.sin(s)*l*f,-Math.cos(s)*l*f,Math.sin(o)*f]}unprojectPosition(e){const[t,n,i]=e,s=BO(e),o=Math.asin(i/s),f=Math.atan2(t,-n)*mS,A=o*mS,v=(s/Hd-1)*_m;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 Ov(r,e){const t=Ep([],e,r);return wx(t,t,1/t[3]),t}class U_{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){}}U_.defaultProps={};U_.extensionName="LayerExtension";class WD{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;const{attributes:t={}}=e;this.typedArrayManager=fp,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:l,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&&(Ks(t.startIndices),this.getGeometry=this.getGeometryFromBuffer(s),f||(n.vertexPositions=s)),this.geometryBuffer=n.vertexPositions,Array.isArray(l))for(const A of l)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)?DD(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 l in s)if(l in i)o.release(n[l]),n[l]=null;else{const f=s[l];f.copy=t,n[l]=o.allocate(n[l],e,f)}}_forEachGeometry(e,t,n){const{data:i,getGeometry:s}=this,{iterable:o,objectInfo:l}=dc(i,t,n);for(const f of o){l.index++;const A=s?s(f,l):null;e(A,l.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:t,vertexStarts:n,instanceCount:i}=this;const{data:s,geometryBuffer:o}=this,{startRow:l=0,endRow:f=1/0}=e||{},A={};if(e||(t=[0],n=[0]),this.normalize||!o)this._forEachGeometry((T,I)=>{const F=T&&this.normalizeGeometry(T);A[I]=F,n[I+1]=n[I]+(F?this.getGeometrySize(F):0)},l,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 Hi){const T=this.positionSize*4;i=i||o.byteLength/T}else if(o.buffer){const T=o.stride||this.positionSize*4;i=i||o.buffer.byteLength/T}else if(o.value){const T=o.value,I=o.stride/T.BYTES_PER_ELEMENT||this.positionSize;i=i||T.length/I}this._allocate(i,!!e),this.indexStarts=t,this.vertexStarts=n,this.instanceCount=i;const v={};this._forEachGeometry((T,I)=>
2087{const F=A[I]||T;v.vertexStart=n[I],v.indexStart=t[I];const N=I<n.length-1?n[I+1]:i;v.geometrySize=N-n[I],v.geometryIndex=I,this.updateGeometryAttributes(F,v)},l,f),this.vertexCount=t[t.length-1]}}const yJ=typeof window<"u"?Bt.useLayoutEffect:Bt.useEffect;function Qm(r,e){for(;r;){if(r===e)return!0;r=Object.getPrototypeOf(r)}return!1}const vJ={position:"absolute",zIndex:-1};function $D(r,e){if(typeof r=="function")return r(e);if(Array.isArray(r))return r.map(t=>$D(t,e));if(z_(r)){if(bJ(r))return e.style=vJ,Bt.cloneElement(r,e);if(xJ(r))return Bt.cloneElement(r,e)}return r}function z_(r){return r&&typeof r=="object"&&"type"in r||!1}function bJ(r){return r.props?.mapStyle}function xJ(r){const e=r.type;return e&&e.deckGLViewProps}function J1(r){if(typeof r=="function")return Bt.createElement(hp,{},r);if(Array.isArray(r))return r.map(J1);if(z_(r)){if(r.type===Bt.Fragment)return J1(r.props.children);if(Qm(r.type,hp))return r}return r}function wJ({children:r,layers:e=[],views:t=null}){const n=[],i=[],s={};return Bt.Children.forEach(J1(r),o=>{if(z_(o)){const l=o.type;if(Qm(l,Cs)){const f=TJ(l,o.props);i.push(f)}else n.push(o);if(Qm(l,hp)&&l!==hp&&o.props.id){const f=new l(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 TJ(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 EJ=Bt.createContext();function CJ({children:r,deck:e,ContextProvider:t=EJ.Provider}){const{viewManager:n}=e||{};if(!n||!n.views.length)return[];const i={},s=n.views[0].id;for(const o of r){let l=s,f=o;z_(o)&&Qm(o.type,hp)&&(l=o.props.id||s,f=o.props.children);const A=n.getViewport(l),v=n.getViewState(l);if(A){v.padding=A.padding;const{x:T,y:I,width:F,height:N}=A;f=$D(f,{x:T,y:I,width:F,height:N,viewport:A,viewState:v}),i[l]||(i[l]={viewport:A,children:[]}),i[l].children.push(f)}}return Object.keys(i).map(o=>{const{viewport:l,children:f}=i[o],{x:A,y:v,width:T,height:I}=l,F={position:"absolute",left:A,top:v,width:T,height:I},N=`view-${o}`,U=Bt.createElement("div",{key:N,id:N,style:F},...f),$={deck:e,viewport:l,container:e.canvas.offsetParent,eventManager:e.eventManager,onViewStateChange:j=>{j.viewId=o,e._onViewStateChange(j)},widgets:[]},V=`view-${o}-context`;return Bt.createElement(t,{key:V,value:$},U)})}const SJ={mixBlendMode:null};function IJ({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 SJ?i[s]=t[s]:n[s]=t[s];return{containerStyle:n,canvasStyle:i}}function BJ(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 XD(r){r.redrawReason&&(r.deck._drawLayers(r.redrawReason),r.redrawReason=null)}function PJ(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():XD(r)}});return n}function MJ(r,e){const[t,n]=Bt.useState(0),s=Bt.useRef({control:null,version:t,forceUpdate:()=>n(K=>K+1)}).current,o=Bt.useRef(null),l=Bt.useRef(null),f=Bt.useMemo(()=>wJ(r),[r.layers,r.views,r.children]);let A=!0;const v=K=>A&&r.viewState?(s.viewStateUpdateRequested=K,null):(s.viewStateUpdateRequested=null,r.onViewStateChange?.(K)),T=K=>{A?s.interactionStateUpdateRequested=K:(s.interactionStateUpdateRequested=null,r.onInteractionStateChange?.(K))},I=Bt.useMemo(()=>{const K={widgets:[],...r,style:null,width:"100%",height:"100%",parent:o.current,canvas:l.current,layers:f.layers,views:f.views,onViewStateChange:v,onInteractionStateChange:T};return delete K._customRender,s.deck&&s.deck.setProps(K),K},[r]);Bt.useEffect(()=>{const K=r.Deck||Lx;return s.deck=PJ(s,K,{...I,parent:o.current,canvas:l.current}),()=>s.deck?.finalize()},[]),yJ(()=>{XD(s);const{viewStateUpdateRequested:K,interactionStateUpdateRequested:se}=s;K&&v(K),se&&T(se)}),Bt.useImperativeHandle(e,()=>BJ(s),[]);const F=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:N,width:U="100%",height:$="
2087100%",id:V,style:j}=r,{containerStyle:X,canvasStyle:ue}=Bt.useMemo(()=>IJ({width:U,height:$,style:j}),[U,$,j]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===F||s.version!==t){s.lastRenderedViewports=F,s.version=t;const K=CJ({children:f.children,deck:s.deck,ContextProvider:N}),se=Bt.createElement("canvas",{key:"canvas",id:V||"deckgl-overlay",ref:l,style:ue});s.control=Bt.createElement("div",{id:`${V||"deckgl"}-wrapper`,ref:o,style:X},[se,K])}return A=!1,s.control}const RJ=Bt.forwardRef(MJ);const _S="\uFEFF";function OJ(r,e={},t=FJ){e=e||{};var n=e.dynamicTyping||!1;yl(n)&&(e.dynamicTypingFunction=n,n={}),e.dynamicTyping=n,e.transform=yl(e.transform)?e.transform:!1;var i=new t(e);return i.stream(r)}function DJ(r,e){var t=!1,n=!0,i=",",s=`\r 2088`,o='"',l=o+o,f=!1,A=null;T();var v=new RegExp(rg(o),"g");if(typeof r=="string"&&(r=JSON.parse(r)),Array.isArray(r)){if(!r.length||Array.isArray(r[0]))return I(null,r,f);if(typeof r[0]=="object")return I(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])),I(r.fields||[],r.data||[],f);throw new Error("Unable to serialize unrecognized input");function T(){if(typeof e=="object"){if(typeof e.delimiter=="string"&&!La.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&&(l=e.escapeChar+o)}}function I(U,$,V){var j="";typeof U=="string"&&(U=JSON.parse(U)),typeof $=="string"&&($=JSON.parse($));var X=Array.isArray(U)&&U.length>0,ue=!Array.isArray($[0]);if(X&&n){for(var K=0;K<U.length;K++)K>0&&(j+=i),j+=F(U[K],K);$.length>0&&(j+=s)}for(var se=0;se<$.length;se++){var Ee=X?U.length:$[se].length,Ue=!1,de=X?Object.keys($[se]).length===0:$[se].length===0;if(V&&!X&&(Ue=V==="greedy"?$[se].join("").trim()==="":$[se].length===1&&$[se][0].length===0),V==="greedy"&&X){for(var me=[],pe=0;pe<Ee;pe++){var W=ue?U[pe]:pe;me.push($[se][W])}Ue=me.join("").trim()===""}if(!Ue){for(var re=0;re<Ee;re++){re>0&&!de&&(j+=i);var Ce=X&&ue?U[re]:re;j+=F($[se][Ce],re)}se<$.length-1&&(!V||Ee>0&&!de)&&(j+=s)}}return j}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,l);var V=typeof t=="boolean"&&t||Array.isArray(t)&&t[$]||N(U,La.BAD_DELIMITERS)||U.indexOf(i)>-1||U.charAt(0)===" "||U.charAt(U.length-1)===" ";return V?o+U+o:U}function N(U,$){for(var V=0;V<$.length;V++)if(U.indexOf($[V])>-1)return!0;return!1}}let qD=class{_handle;_config;_finished=!1;_completed=!1;_input=null;_baseIndex=0;_partialLine="";_rowCount=0;_start=0;isFirstChunk=!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 JD(t),this._handle.streamer=this,this._config=t}parseChunk(e,t){if(this.isFirstChunk&&yl(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 l=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(yl(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&&l&&yl(this._config.complete)&&(!s||!s.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),s}}_sendError(e){yl(this._config.error)&&this._config.error(e)}};class FJ extends qD{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 LJ=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,kJ=/(\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 JD{_config;_stepCounter=0;_rowCounter=0;_input;_parser;_paused=!1;_aborted=!1;_delimiterError=!1;_fields=[];_results={data:[],errors:[],meta:{}};constructor(e){if(yl(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=NJ(e,i)),this._delimiterError=!1,this._config.delimiter)yl(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=La.DefaultDelimiter),this._results.meta.delimiter=this._config.delimiter}var o=KD(this._config);return this._config.preview&&this._config.header&&o.preview++,this._input=e,this._parser=new K1(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,yl(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 '"+La.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=>{yl(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:LJ.test(t)?parseFloat(t):kJ.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,l,f;s=s||[","," ","|",";",La.RECORD_SEP,La.UNIT_SEP];for(var A=0;A<s.length;A++){var v=s[A],T=0,I=0,F=0;f=void 0;for(var N=new K1({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(I+=$,typeof f>"u"){f=0;continue}else $>1&&(T+=Math.abs($-f),f=$)}N.data.length>0&&(I/=N.data.length-F),(typeof l>"u"||T>l)&&I>1.99&&(l=T,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 NJ(r,e){r=r.substr(0,1024*1024);var t=new RegExp(rg(e)+"([^]*?)"+rg(e),"gm");r=r.replace(t,"");var n=r.split("\r"),i=r.split(` 2089`),s=i.length>1&&i[0].length<n[0].length;if(n.length===1||s)return` 2090`;for(var o=0,l=0;l<n.length;l++)n[l][0]===` 2091`&&o++;return o>=n.length/2?`\r 2092`:"\r"}function rg(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K1(r){r=r||{};var e=r.delimiter,t=r.newline,n=r.comments,i=r.step,s=r.preview,o=r.fastMode,l;r.quoteChar===void 0?l='"':l=r.quoteChar;var f=l;if(r.escapeChar!==void 0&&(f=r.escapeChar),(typeof e!="string"||La.BAD_DELIMITERS.indexOf(e)>-1)&&(e=","),n===e)throw new Error("Comment character same as delimiter");
2092n===!0?n="#":(typeof n!="string"||La.BAD_DELIMITERS.indexOf(n)>-1)&&(n=!1),t!==` 2093`&&t!=="\r"&&t!==`\r 2094`&&(t=` 2095`);var A=0,v=!1;this.parse=function(T,I,F){if(typeof T!="string")throw new Error("Input must be a string");var N=T.length,U=e.length,$=t.length,V=n.length,j=yl(i);A=0;var X=[],ue=[],K=[],se=0;if(!T)return rt();if(o||o!==!1&&T.indexOf(l)===-1){for(var Ee=T.split(t),Ue=0;Ue<Ee.length;Ue++){const vt=Ee[Ue];if(A+=vt.length,Ue!==Ee.length-1)A+=t.length;else if(F)return rt();if(!(n&&vt.substr(0,V)===n)){if(j){if(X=[],Le(vt.split(e)),ut(),v)return rt()}else Le(vt.split(e));if(s&&Ue>=s)return X=X.slice(0,s),rt(!0)}}return rt()}for(var de=T.indexOf(e,A),me=T.indexOf(t,A),pe=new RegExp(rg(f)+rg(l),"g"),W;;){if(T[A]===l){for(W=A,A++;;){if(W=T.indexOf(l,W+1),W===-1)return F||ue.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:X.length,index:A}),Ye();if(W===N-1){var re=T.substring(A,W).replace(pe,l);return Ye(re)}if(l===f&&T[W+1]===f){W++;continue}if(!(l!==f&&W!==0&&T[W-1]===f)){var Ce=me===-1?de:Math.min(de,me),et=Ve(Ce);if(T[W+1+et]===e){if(K.push(T.substring(A,W).replace(pe,l)),A=W+1+et+U,de=T.indexOf(e,A),me=T.indexOf(t,A),j&&(ut(),v))return rt();if(s&&X.length>=s)return rt(!0);break}var _e=Ve(me);if(T.substr(W+1+_e,$)===t){if(K.push(T.substring(A,W).replace(pe,l)),tt(W+1+_e+$),de=T.indexOf(e,A),j&&(ut(),v))return rt();if(s&&X.length>=s)return rt(!0);break}ue.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:X.length,index:A}),W++}}if(j&&(ut(),v))return rt();if(s&&X.length>=s)return rt(!0);continue}if(n&&K.length===0&&T.substr(A,V)===n){if(me===-1)return rt();A=me+$,me=T.indexOf(t,A),de=T.indexOf(e,A);continue}if(de!==-1&&(de<me||me===-1)){K.push(T.substring(A,de)),A=de+U,de=T.indexOf(e,A);continue}if(me!==-1){if(K.push(T.substring(A,me)),tt(me+$),j&&(ut(),v))return rt();if(s&&X.length>=s)return rt(!0);continue}break}return Ye();function Le(vt){X.push(vt),se=A}function Ve(vt){var It=0;if(vt!==-1){var st=T.substring(W+1,vt);st&&st.trim()===""&&(It=st.length)}return It}function Ye(vt){return F||(typeof vt>"u"&&(vt=T.substr(A)),K.push(vt),A=N,Le(K),j&&ut()),rt()}function tt(vt){A=vt,Le(K),K=[],me=T.indexOf(t,A)}function rt(vt,It){var st=It||!1;return{data:st?X[0]:X,errors:ue,meta:{delimiter:e,linebreak:t,aborted:v,truncated:!!vt,cursor:se+(I||0)}}}function ut(){i(rt(void 0,!0)),X=[],ue=[]}},this.abort=function(){v=!0},this.getCharIndex=function(){return A}}function KD(r){if(typeof r!="object"||r===null)return r;var e=Array.isArray(r)?[]:{};for(var t in r)e[t]=KD(r[t]);return e}function yl(r){return typeof r=="function"}const La={parse:OJ,unparse:DJ,RECORD_SEP:"�",UNIT_SEP:"�",BYTE_ORDER_MARK:_S,BAD_DELIMITERS:["\r",` 2096`,'"',_S],WORKERS_SUPPORTED:!1,NODE_STREAM_INPUT:1,LocalChunkSize:1024*1024*10,RemoteChunkSize:1024*1024*5,DefaultDelimiter:",",Parser:K1,ParserHandle:JD,ChunkStreamer:qD},{ChunkStreamer:UJ}=La;class zJ extends UJ{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 VJ="4.3.3",Ux="object-row-table",zx={dataType:null,batchType:null,id:"csv",module:"csv",name:"CSV",version:VJ,extensions:["csv","tsv","dsv"],mimeTypes:["text/csv","text/tab-separated-values","text/dsv"],category:"table",parse:async(r,e)=>yS(new TextDecoder().decode(r),e),parseText:(r,e)=>yS(r,e),parseInBatches:GJ,options:{csv:{shape:Ux,optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[","," ","|",";"]}}};async function yS(r,e){const t={...zx.options.csv,...e?.csv},n=jJ(r),s=t.header==="auto"?ZD(n):!!t.header,o={...t,header:s,download:!1,transformHeader:s?YD():void 0,error:T=>{throw new Error(T)}},l=La.parse(r,o),f=l.data,A=l.meta.fields||QD(t.columnPrefix,n.length),v=t.shape||Ux;switch(v){case"object-row-table":return{shape:"object-row-table",data:f.map(T=>Array.isArray(T)?w4(T,A):T)};case"array-row-table":return{shape:"array-row-table",data:f.map(T=>Array.isArray(T)?T:T4(T,A))};default:throw new Error(v)}}function GJ(r,e){e={...e},e.batchSize==="auto"&&(e.batchSize=4e3);const t={...zx.options.csv,...e?.csv},n=new RU;let i=!0,s=null,o=null,l=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 T=A.meta.cursor;if(i&&!s&&(t.header==="auto"?ZD(v):!!t.header)){s=v.map(YD());return}i&&(i=!1,s||(s=QD(t.columnPrefix,v.length)),l=HJ(v,s)),t.optimizeMemoryUsage&&(v=JSON.parse(JSON.stringify(v)));const I=t.shape||Ux;o=o||new Lm(l,{shape:I,...e});try{o.addRow(v);const F=o&&o.getFullBatch({bytesUsed:T});F&&n.enqueue(F)}
2096catch(F){n.enqueue(F)}},complete(A){try{const v=A.meta.cursor,T=o&&o.getFinalBatch({bytesUsed:v});T&&n.enqueue(T)}catch(v){n.enqueue(v)}n.close()}};return La.parse(r,f,zJ),n}function ZD(r){return r&&r.every(e=>typeof e=="string")}function jJ(r){return La.parse(r,{dynamicTyping:!0,preview:1}).data[0]}function YD(){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 QD(r,e=0){const t=[];for(let n=0;n<e;n++)t.push(`${r}${n+1}`);return t}function HJ(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 WJ="4.3.3";async function eF(r,e,t,n){return n._parse(r,e,t,n)}function sh(r,e){if(!r)throw new Error("loader assertion failed.")}const tF=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),vS=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);vS&&parseFloat(vS[1]);function $J(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const XJ=$J();function qJ(r,e){if(!r)throw new Error("loaders.gl assertion failed.")}const pg=typeof process!="object"||String(process)!=="[object process]"||process.browser,Vx=typeof importScripts=="function",bS=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);bS&&parseFloat(bS[1]);const Dv={};async function Fv(r,e=null,t={},n=null){return e&&(r=JJ(r,e,t,n)),Dv[r]=Dv[r]||KJ(r),await Dv[r]}function JJ(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]:pg?t.CDN?(qJ(t.CDN.startsWith("http")),`${t.CDN}/${e}@${XJ}/dist/libs/${n}`):Vx?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function KJ(r){if(r.endsWith("wasm"))return await YJ(r);if(!pg)try{const{requireFromFile:t}=globalThis.loaders||{};return await t?.(r)}catch(t){return console.error(t),null}if(Vx)return importScripts(r);const e=await QJ(r);return ZJ(e,r)}function ZJ(r,e){if(!pg){const{requireFromString:n}=globalThis.loaders||{};return n?.(r,e)}if(Vx)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 YJ(r){const{readFileAsArrayBuffer:e}=globalThis.loaders||{};return pg||!e||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await e(r)}async function QJ(r){const{readFileAsText:e}=globalThis.loaders||{};return pg||!e||r.startsWith("http")?await(await fetch(r)).text():await e(r)}function eK(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?xS(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?xS(r,0,e):""}function xS(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 tK(r){try{return JSON.parse(r)}catch{throw new Error(`Failed to parse JSON from data starting with "${eK(r)}"`)}}function rF(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 Ag(r,e){return sh(r>=0),sh(e>0),r+(e-1)&-4}function rK(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+Ag(n.byteLength,4)}const nK=globalThis.loaders?.parseImageNode,Z1=typeof Image<"u",Y1=typeof ImageBitmap<"u",iK=!!nK,Q1=tF?!0:iK;function sK(r){switch(r){case"auto":return Y1||Z1||Q1;case"imagebitmap":return Y1;case"image":return Z1;case"data":return Q1;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function oK(){if(Y1)return"imagebitmap";if(Z1)return"image";if(Q1)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function aK(r){const e=lK(r);if(!e)throw new Error("Not an image");return e}function nF(r){switch(aK(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 lK(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 cK=/^data:image\/svg\+xml/,uK=/\.svg((\?|#).*)?$/;function Gx(r){return r&&(cK.test(r)||uK.test(r))}function fK(r,e){if(Gx(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 iF(r,e)}function iF(r,e){if(Gx(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}
vendor: 23,833 bytes, line 2096
2096async function sF(r,e,t){const n=fK(r,t),i=self.URL||self.webkitURL,s=typeof n!="string"&&i.createObjectURL(n);try{return await hK(s||n,e)}finally{s&&i.revokeObjectURL(s)}}async function hK(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 dK={};let wS=!0;async function pK(r,e,t){let n;Gx(t)?n=await sF(r,e,t):n=iF(r,t);const i=e&&e.imagebitmap;return await AK(n,i)}async function AK(r,e=null){if((gK(e)||!wS)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),wS=!1}return await createImageBitmap(r)}function gK(r){for(const e in r||dK)return!1;return!0}function mK(r){return!bK(r,"ftyp",4)||(r[8]&96)===0?null:_K(r)}function _K(r){switch(yK(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function yK(r,e,t){return String.fromCharCode(...r.slice(e,t))}function vK(r){return[...r].map(e=>e.charCodeAt(0))}function bK(r,e,t=0){const n=vK(e);for(let i=0;i<n.length;++i)if(n[i]!==r[i+t])return!1;return!0}const nc=!1,VA=!0;function jx(r){const e=gg(r);return wK(e)||CK(e)||TK(e)||EK(e)||xK(e)}function xK(r){const e=new Uint8Array(r instanceof DataView?r.buffer:r),t=mK(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function wK(r){const e=gg(r);return e.byteLength>=24&&e.getUint32(0,nc)===2303741511?{mimeType:"image/png",width:e.getUint32(16,nc),height:e.getUint32(20,nc)}:null}function TK(r){const e=gg(r);return e.byteLength>=10&&e.getUint32(0,nc)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,VA),height:e.getUint16(8,VA)}:null}function EK(r){const e=gg(r);return e.byteLength>=14&&e.getUint16(0,nc)===16973&&e.getUint32(2,VA)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,VA),height:e.getUint32(22,VA)}:null}function CK(r){const e=gg(r);if(!(e.byteLength>=3&&e.getUint16(0,nc)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:n,sofMarkers:i}=SK();let s=2;for(;s+9<e.byteLength;){const o=e.getUint16(s,nc);if(i.has(o))return{mimeType:"image/jpeg",height:e.getUint16(s+5,nc),width:e.getUint16(s+7,nc)};if(!n.has(o))return null;s+=2,s+=e.getUint16(s,nc)}return null}function SK(){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 gg(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 IK(r,e){const{mimeType:t}=jx(r)||{},n=globalThis.loaders?.parseImageNode;return sh(n),await n(r,t)}async function BK(r,e,t){e=e||{};const i=(e.image||{}).type||"auto",{url:s}=t||{},o=PK(i);let l;switch(o){case"imagebitmap":l=await pK(r,e,s);break;case"image":l=await sF(r,e,s);break;case"data":l=await IK(r);break;default:sh(!1)}return i==="data"&&(l=nF(l)),l}function PK(r){switch(r){case"auto":case"data":return oK();default:return sK(r),r}}const MK=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],RK=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],OK={image:{type:"auto",decode:!0}},DK={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:WJ,mimeTypes:RK,extensions:MK,parse:BK,tests:[r=>!!jx(new DataView(r))],options:OK},Lv={};function FK(r){if(Lv[r]===void 0){const e=tF?kK(r):LK(r);Lv[r]=e}return Lv[r]}function LK(r){const e=["image/png","image/jpeg","image/gif"],t=globalThis.loaders?.imageFormatsNode||e;return!!globalThis.loaders?.parseImageNode&&t.includes(r)}function kK(r){switch(r){case"image/avif":case"image/webp":return NK(r);default:return!0}}function NK(r){try{return document.createElement("canvas").toDataURL(r).indexOf(`data:${r}`)===0}catch{return!1}}function da(r,e){if(!r)throw new Error(e||"assert failed: gltf")}const oF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},aF={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},TS=["SCALAR","VEC2","VEC3","VEC4"],UK=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],zK=new Map(UK),VK={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},GK={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},jK={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function lF(r){return TS[r-1]||TS[0]}function V_(r){const e=zK.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function Hx(r,e){const t=jK[r.componentType],n=VK[r.type],i=GK[r.componentType],s=r.count*n,o=r.count*n*i;da(o>=0&&o<=e.byteLength);const l=aF[r.componentType],f=oF[r.type];return{ArrayType:t,length:s,byteLength:o,componentByteSize:l,numberOfComponentsInElement:f}}function HK(r,e,t){const n=r.bufferViews[t];da(n);const i=n.buffer,s=e[i];da(s);const o=(n.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,o,n.byteLength)}function WK(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],l=(o||0)+(n.byteOffset||0)+(i.byteOffset||0),{ArrayType:f,length:A,componentByteSize:v,numberOfComponentsInElement:T}=Hx(n,i),I=v*T,F=i.byteStride||I;if(typeof i.byteStride>"u"||i.byteStride===I)return new f(s,l,A);const N=new f(A);for(let U=0;U<n.count;U++){const $=new f(s,l+U*F,T);N.set($,U*T)}return N}function $K(){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||$K(),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];da(n);const i=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,e.byteLength)}getTypedArrayForAccessor(e){const t=this.getAccessor(e);return WK(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 da(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return da(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,l={primitives:[{attributes:this._addAttributes(t),mode:s}]};if(n){const f=this._addIndices(n);l.primitives[0].indices=f}return Number.isFinite(i)&&(l.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(l),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=jx(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;da(Number.isFinite(i)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const s={buffer:t,byteOffset:n,byteLength:i};return this.byteLength+=Ag(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:lF(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:V_(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=rK(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 ES(r){return(r%1+1)%1}const cF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},XK={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},uF={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Wx(r,e){return uF[e]*cF[r]}function G_(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;const i=r.getTypedArrayForBufferView(e),s=j_(i,"SCALAR",t,n+1);return s instanceof BigInt64Array||s instanceof BigUint64Array?null:s}function j_(r,e,t,n=1){const i=cF[e],s=XK[t],o=uF[t],l=n*i,f=l*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,l)}function $x(r,e,t){const n=`TEXCOORD_${e.texCoord||0}`,i=t.attributes[n],s=r.getTypedArrayForAccessor(i),o=r.gltf.json,l=e.index,f=o.textures?.[l]?.source;if(typeof f<"u"){const A=o.images?.[f]?.mimeType,v=r.gltf.images?.[f];if(v&&typeof v.width<"u"){const T=[];for(let I=0;I<s.length;I+=2){const F=qK(v,A,s,I,e.channels);T.push(F)}return T}}return[]}function fF(r,e,t,n,i){if(!t?.length)return;const s=[];for(const v of t){let T=n.findIndex(I=>I===v);T===-1&&(T=n.push(v)-1),s.push(T)}const o=new Uint32Array(s),l=r.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,f=r.addBufferView(o,l,0),A=r.addAccessor(f,{size:1,componentType:V_(o),count:o.length});i.attributes[e]=A}function qK(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],l=t[n+1];let f=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(f=4);const A=JK(o,l,r,f);let v=0;for(const T of i){const I=typeof T=="number"?Object.values(s)[T]:s[T],F=A+I.offset,N=nF(r);if(N.data.length<=F)throw new Error(`${N.data.length} <= ${F}`);const U=N.data[F];v|=U<<I.shift}return v}function JK(r,e,t,n=1){const i=t.width,s=ES(r)*(i-1),o=Math.round(s),l=t.height,f=ES(e)*(l-1),A=Math.round(f),v=t.components?t.components:n;return(A*i+o)*v}function hF(r,e,t,n,i){const s=[];for(let o=0;o<e;o++){const l=t[o],f=t[o+1]-t[o];if(f+l>n)break;const A=l/i,v=f/i;s.push(r.slice(A,A+v))}return s}function dF(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 pF(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 l=0;l<r;l++){const f=n[l+1]-n[l];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 tp="EXT_mesh_features",KK=tp;async function ZK(r,e){const t=new ks(r);QK(t,e)}function YK(r,e){const t=new ks(r);return tZ(t),t.createBinaryChunk(),t.gltf}function QK(r,e){const t=r.gltf.json;if(t.meshes)for(const n of t.meshes)for(const i of n.primitives)eZ(r,i,e)}function eZ(r,e,t){if(!t?.gltf?.loadBuffers)return;const i=e.extensions?.[tp]?.featureIds;if(i)for(const s of i){let o;if(typeof s.attribute<"u"){const l=`_FEATURE_ID_${s.attribute}`,f=e.attributes[l];o=r.getTypedArrayForAccessor(f)}else typeof s.texture<"u"&&t?.gltf?.loadImages?o=$x(r,s.texture,e):o=[];s.data=o}}function tZ(r,e){const t=r.gltf.json.meshes;if(t)for(const n of t)for(const i of n.primitives)nZ(r,i)}function rZ(r,e,t,n){e.extensions||(e.extensions={});let i=e.extensions[tp];i||(i={featureIds:[]},e.extensions[tp]=i);const{featureIds:s}=i,o={featureCount:t.length,propertyTable:n,data:t};s.push(o),r.addObjectExtension(e,tp,i)}function nZ(r,e){const t=e.extensions?.[tp];if(!t)return;const n=t.featureIds;n.forEach((i,s)=>{if(i.data){const{accessorKey:o,index:l}=iZ(e.attributes),f=new Uint32Array(i.data);n[s]={featureCount:f.length,propertyTable:i.propertyTable,attribute:l},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:V_(f),count:f.length});e.attributes[o]=v}})}function iZ(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 sZ=Object.freeze(Object.defineProperty({__proto__:null,createExtMeshFeatures:rZ,decode:ZK,encode:YK,name:KK},Symbol.toStringTag,{value:"Module"})),pp="EXT_structural_metadata",oZ=pp;async function aZ(r,e){const t=new ks(r);cZ(t,e)}function lZ(r,e){const t=new ks(r);return EZ(t),t.createBinaryChunk(),t.gltf}function cZ(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(pp);t&&(e.gltf?.loadImages&&uZ(r,t),fZ(r,t))}function uZ(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)dZ(r,t,s,e)}function fZ(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=hZ(i,s);o&&AZ(r,t,o)}}function hZ(r,e){for(const t of r)if(t.class===e)return t;return null}function dZ(r,e,t,n){if(!e)return;const s=t.extensions?.[pp]?.propertyTextures;if(s)for(const o of s){const l=e[o];pZ(r,l,t,n)}}function pZ(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}`,l=e.properties?.[s];if(!l)continue;l.data||(l.data=[]);const f=l.data,A=$x(r,l,t);A!==null&&(fF(r,o,A,f,t),l.data=f,n.dataAttributeNames.push(o))}}function AZ(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],l=t.properties?.[s];if(l){const f=gZ(r,e,o,i,l);l.data=f}}}function gZ(r,e,t,n,i){let s=[];const o=i.values,l=r.getTypedArrayForBufferView(o),f=mZ(r,t,i,n),A=_Z(r,i,n);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{s=yZ(t,n,l,f);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${t.type}`);case"STRING":{s=pF(n,l,f,A);break}case"ENUM":{s=vZ(e,t,n,l,f);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return s}function mZ(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?G_(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function _Z(r,e,t){return typeof e.stringOffsets<"u"?G_(r,e.stringOffsets,e.stringOffsetType||"UINT32",t):null}function yZ(r,e,t,n){const i=r.array,s=r.count,o=Wx(r.type,r.componentType),l=t.byteLength/o;let f;return r.componentType?f=j_(t,r.type,r.componentType,l):f=t,i?n?hF(f,e,n,t.length,o):s?dF(f,e,s):[]:f}function vZ(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 l=o.valueType||"UINT16",f=Wx(e.type,l),A=n.byteLength/f;let v=j_(n,e.type,l,A);if(v||(v=n),e.array){if(i)return bZ({valuesData:v,numberOfElements:t,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:f,enumEntry:o});const T=e.count;return T?xZ(v,t,T,o):[]}return Xx(v,0,t,o)}function bZ(r){const{valuesData:e,numberOfElements:t,arrayOffsets:n,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=r,l=[];for(let f=0;f<t;f++){const A=n[f],v=n[f+1]-n[f];if(v+A>i)break;const T=A/s,I=v/s,F=Xx(e,T,I,o);l.push(F)}return l}function xZ(r,e,t,n){const i=[];for(let s=0;s<e;s++){const o=t*s,l=Xx(r,o,t,n);i.push(l)}return i}function Xx(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],l=wZ(n,o);l?i.push(l.name):i.push("")}return i}function wZ(r,e){for(const t of r.values)if(t.value===e)return t;return null}const TZ="schemaClassId";function EZ(r,e){const t=r.getExtension(pp);if(t&&t.propertyTables)for(const n of t.propertyTables){const i=n.class,s=t.schema?.classes?.[i];n.properties&&s&&CZ(n,s,r)}}function CZ(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=PZ(i,s,t);r.properties[n]=o}}}}function SZ(r,e,t=TZ){let n=r.getExtension(pp);n||(n=r.addExtension(pp)),n.schema=IZ(e,t,n.schema);const i=BZ(e,t,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(i)-1}function IZ(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 BZ(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 PZ(r,e,t){const n={values:0};if(e.type==="STRING"){const{stringData:i,stringOffsets:s}=OZ(r);n.stringOffsets=kv(s,t),n.values=kv(i,t)}else if(e.type==="SCALAR"&&e.componentType){const i=RZ(r,e.componentType);n.values=kv(i,t)}return n}const MZ={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function RZ(r,e){const t=[];for(const i of r)t.push(Number(i));const n=MZ[e];if(!n)throw new Error("Illegal component type");return new n(t)}function OZ(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 l=new Uint32Array(s);return{stringData:i,stringOffsets:l}}function kv(r,e){return e.gltf.buffers.push({arrayBuffer:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}),e.addBufferView(r)}const DZ=Object.freeze(Object.defineProperty({__proto__:null,createExtStructuralMetadata:SZ,decode:aZ,encode:lZ,name:oZ},Symbol.toStringTag,{value:"Module"})),AF="EXT_feature_metadata",FZ=AF;async function LZ(r,e){const t=new ks(r);kZ(t,e)}function kZ(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(AF);t&&(e.gltf?.loadImages&&NZ(r,t),UZ(r,t))}function NZ(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],l=VZ(i,s);l&&jZ(r,l,o)}}function UZ(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=zZ(i,s);o&&GZ(r,t,o)}}function zZ(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function VZ(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function GZ(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
2096name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],l=t.properties?.[s];if(l){const f=HZ(r,e,o,i,l);l.data=f}}}function jZ(r,e,t){const n=e.class;for(const i in t.properties){const s=e?.properties?.[i];if(s){const o=JZ(r,s,n);s.data=o}}}function HZ(r,e,t,n,i){let s=[];const o=i.bufferView,l=r.getTypedArrayForBufferView(o),f=WZ(r,t,i,n),A=$Z(r,t,i,n);return t.type==="STRING"||t.componentType==="STRING"?s=pF(n,l,f,A):XZ(t)&&(s=qZ(t,n,l,f)),s}function WZ(r,e,t,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof t.arrayOffsetBufferView<"u"?G_(r,t.arrayOffsetBufferView,t.offsetType||"UINT32",n):null}function $Z(r,e,t,n){return typeof t.stringOffsetBufferView<"u"?G_(r,t.stringOffsetBufferView,t.offsetType||"UINT32",n):null}function XZ(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 qZ(r,e,t,n){const i=r.type==="ARRAY",s=r.componentCount,o="SCALAR",l=r.componentType||r.type,f=Wx(o,l),A=t.byteLength/f,v=j_(t,o,l,A);return i?n?hF(v,e,n,t.length,f):s?dF(v,e,s):[]:v}function JZ(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)KZ(r,t,e,i,o);return i}function KZ(r,e,t,n,i){const s={channels:t.channels,...t.texture},o=$x(r,s,i);o&&fF(r,e,o,n,i)}const ZZ=Object.freeze(Object.defineProperty({__proto__:null,decode:LZ,name:FZ},Symbol.toStringTag,{value:"Module"})),YZ="4.3.3",QZ="4.3.3";function eY(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function tY(r){return globalThis.loaders?.modules?.[r]||null}function rY(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const nY=rY();function iY(r,e){if(!r)throw new Error("loaders.gl assertion failed.")}const mg=typeof process!="object"||String(process)!=="[object process]"||process.browser,qx=typeof importScripts=="function",CS=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);CS&&parseFloat(CS[1]);const Nv={};async function e_(r,e=null,t={},n=null){return e&&(r=sY(r,e,t,n)),Nv[r]=Nv[r]||oY(r),await Nv[r]}function sY(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]:mg?t.CDN?(iY(t.CDN.startsWith("http")),`${t.CDN}/${e}@${nY}/dist/libs/${n}`):qx?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function oY(r){if(r.endsWith("wasm"))return await lY(r);if(!mg)try{const{requireFromFile:t}=globalThis.loaders||{};return await t?.(r)}catch(t){return console.error(t),null}if(qx)return importScripts(r);const e=await cY(r);return aY(e,r)}function aY(r,e){if(!mg){const{requireFromString:n}=globalThis.loaders||{};return n?.(r,e)}if(qx)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 lY(r){const{readFileAsArrayBuffer:e}=globalThis.loaders||{};return mg||!e||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await e(r)}async function cY(r){const{readFileAsText:e}=globalThis.loaders||{};return mg||!e||r.startsWith("http")?await(await fetch(r)).text():await e(r)}const t_={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"};let SS;async function IS(r){eY(r.modules);const e=tY("basis");return e||(SS||=uY(r),await SS)}async function uY(r){let e=null,t=null;return[e,t]=await Promise.all([await e_(t_.TRANSCODER,"textures",r),await e_(t_.TRANSCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await fY(e,t)}function fY(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 Uv;async function BS(r){const e=r.modules||{};return e.basisEncoder?e.basisEncoder:(Uv=Uv||hY(r),await Uv)}async function hY(r){let e=null,t=null;
vendor: 6,514 bytes, line 2096
2096return[e,t]=await Promise.all([await e_(t_.ENCODER,"textures",r),await e_(t_.ENCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await dY(e,t)}function dY(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r(t).then(i=>{const{BasisFile:s,KTX2File:o,initializeBasis:l,BasisEncoder:f}=i;l(),n({BasisFile:s,KTX2File:o,BasisEncoder:f})})})}const pd={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},pY=["","WEBKIT_","MOZ_"],PS={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 I0=null;function AY(r){if(!I0){r=r||gY()||void 0,I0=new Set;for(const e of pY)for(const t in PS)if(r&&r.getExtension(`${e}${t}`)){const n=PS[t];I0.add(n)}}return I0}function gY(){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 mY(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 _Y={etc1:{basisFormat:0,compressed:!0,format:pd.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:pd.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:pd.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:pd.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:pd.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:pd.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 yY(r,e){if(e.basis.containerFormat==="auto"){if(mY(r)){const n=await BS(e);return MS(n.KTX2File,r,e)}const{BasisFile:t}=await IS(e);return zv(t,r,e)}switch(e.basis.module){case"encoder":const t=await BS(e);switch(e.basis.containerFormat){case"ktx2":return MS(t.KTX2File,r,e);case"basis":default:return zv(t.BasisFile,r,e)}case"transcoder":default:const{BasisFile:n}=await IS(e);return zv(n,r,e)}}function zv(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 l=n.getNumLevels(o),f=[];for(let A=0;A<l;A++)f.push(vY(n,o,A,t));s.push(f)}return s}finally{n.close(),n.delete()}}function vY(r,e,t,n){const i=r.getImageWidth(e,t),s=r.getImageHeight(e,t),o=r.getHasAlpha(),{compressed:l,format:f,basisFormat:A}=gF(n,o),v=r.getImageTranscodedSizeInBytes(e,t,A),T=new Uint8Array(v);if(!r.transcodeImage(T,e,t,A,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:s,data:T,compressed:l,format:f,hasAlpha:o}}function MS(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(bY(n,o,t));return[s]}finally{n.close(),n.delete()}}function bY(r,e,t){const{alphaFlag:n,height:i,width:s}=r.getImageLevelInfo(e,0,0),{compressed:o,format:l,basisFormat:f}=gF(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:l}}function gF(r,e){let t=r&&r.basis&&r.basis.format;return t==="auto"&&(t=mF()),typeof t=="object"&&(t=e?t.alpha:t.noAlpha),t=t.toLowerCase(),_Y[t]}function mF(){const r=AY();return r.has("astc")?"astc-4x4":r.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:r.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:r.has("etc1")?"etc1":r.has("etc2")?"etc2":"rgb565"}const xY={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:QZ,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"}}},wY={...xY,parse:yY},Ap=!0,RS=1735152710,Jx=12,r_=8,TY=1313821514,EY=5130562,CY=0,SY=0,IY=1;function BY(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 PY(r,e=0,t={}){const n=new DataView(r),{magic:i=RS}=t,s=n.getUint32(e,!1);return s===i||s===RS}function MY(r,e,t=0,n={}){const i=new DataView(e),s=BY(i,t+0),o=i.getUint32(t+4,Ap),l=i.getUint32(t+8,Ap);switch(Object.assign(r,{header:{byteOffset:t,byteLength:l,hasBinChunk:!1},type:s,version:o,json:{},binChunks:[]}),t+=Jx,r.version){case 1:return RY(r,i,t);case 2:return OY(r,i,t,n={});default:throw new Error(`Invalid GLB version ${r.version}. Only supports version 1 and 2.`)}}function RY(r,e,t){sh(r.header.byteLength>Jx+r_);const n=e.getUint32(t+0,Ap),i=e.getUint32(t+4,Ap);return t+=r_,sh(i===CY),e2(r,e,t,n),t+=n,t+=t2(r,e,t,r.header.byteLength),t}function OY(r,e,t,n){return sh(r.header.byteLength>Jx+r_),DY(r,e,t,n),t+r.header.byteLength}function DY(r,e,t,n){for(;t+8<=r.header.byteLength;){const i=e.getUint32(t+0,Ap),s=e.getUint32(t+4,Ap);switch(t+=r_,s){case TY:e2(r,e,t,i);break;case EY:t2(r,e,t,i);break;case SY:n.strict||e2(r,e,t,i);break;case IY:n.strict||t2(r,e,t,i);break}t+=Ag(i,4)}return t}function e2(r,e,t,n){const i=new Uint8Array(e.buffer,t,n),o=new TextDecoder("utf8").decode(i);return r.json=JSON.parse(o),Ag(n,4)}function t2(r,e,t,n){return r.header.hasBinChunk=!0,r.binChunks.push({byteOffset:t,byteLength:n,arrayBuffer:e.buffer}),Ag(n,4)}function _F(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}
2096const FY="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIA
2096LAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/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",LY
vendor: 10,662 bytes, line 2096
2096="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,095 bytes, line 2096
2096kY=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]),NY=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]),UY={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},zY={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function VY(r,e,t,n,i,s="NONE"){const o=await GY();WY(o,o.exports[zY[i]],r,e,t,n,o.exports[UY[s||"NONE"]])}let Vv;async function GY(){return Vv||(Vv=jY()),Vv}async function jY(){let r=FY;WebAssembly.validate(kY)&&(r=LY,console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(HY(r),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function HY(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?NY[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,t)}function WY(r,e,t,n,i,s,o){const l=r.exports.sbrk,f=n+3&-4,A=l(f*i),v=l(s.length),T=new Uint8Array(r.exports.memory.buffer);T.set(s,v);const I=e(A,n,i,v,s.length);if(I===0&&o&&o(A,f,i),t.set(T.subarray(A,A+n*i)),l(A-l(0)),I!==0)throw new Error(`Malformed buffer data: ${I}`)}const n_="EXT_meshopt_compression",$Y=n_;async function XY(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(qY(t,i));await Promise.all(n),t.removeExtension(n_)}async function qY(r,e){const t=r.getObjectExtension(e,n_);if(t){const{byteOffset:n=0,byteLength:i=0,byteStride:s,count:o,mode:l,filter:f="NONE",buffer:A}=t,v=r.gltf.buffers[A],T=new Uint8Array(v.arrayBuffer,v.byteOffset+n,i),I=new Uint8Array(r.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await VY(I,o,s,T,l,f),r.removeObjectExtension(e,n_)}}const JY=Object.freeze(Object.defineProperty({__proto__:null,decode:XY,name:$Y},Symbol.toStringTag,{value:"Module"})),Dd="EXT_texture_webp",KY=Dd;function ZY(r,e){const t=new ks(r);if(!FK("image/webp")){if(t.getRequiredExtensions().includes(Dd))throw new Error(`gltf: Required extension ${Dd} not supported by browser`);return}const{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,Dd);s&&(i.source=s.source),t.removeObjectExtension(i,Dd)}t.removeExtension(Dd)}const YY=Object.freeze(Object.defineProperty({__proto__:null,name:KY,preprocess:ZY},Symbol.toStringTag,{value:"Module"})),ym="KHR_texture_basisu",QY=ym;function eQ(r,e){const t=new ks(r),{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,ym);s&&(i.source=s.source,t.removeObjectExtension(i,ym))}t.removeExtension(ym)}const tQ=Object.freeze(Object.defineProperty({__proto__:null,name:QY,preprocess:eQ},Symbol.toStringTag,{value:"Module"})),rQ="4.3.3",nQ={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:rQ,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 iQ(r,e,t){const n=yF(e.metadata),i=[],s=sQ(e.attributes);for(const o in r){const l=r[o],f=OS(o,l,s[o]);i.push(f)}if(t){const o=OS("indices",t);i.push(o)}return{fields:i,metadata:n}}function sQ(r){const e={};for(const t in r){const n=r[t];e[n.name||"undefined"]=n}return e}function OS(r,e,t){const n=t?yF(t.metadata):void 0;return PU(r,e,n)}function yF(r){Object.entries(r);const e={};for(const t in r)e[`${t}.string`]=JSON.stringify(r[t]);return e}const DS={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},oQ={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},aQ=4;let lQ=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 I=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(I)}const l=this._getDracoLoaderData(s,i,t),f=this._getMeshData(s,l,t),A=E4(f.attributes),v=iQ(f.attributes,l,f.indices);return{loader:"draco",loaderData:l,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 l=this._getQuantizationTransform(s,t);l&&(n[s.unique_id()].quantization_transform=l);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 l=this._getAttributeValues(t,s);if(l){const{value:f,size:A}=l;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*aQ,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),fQ(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const n=oQ[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,l=o*n.BYTES_PER_ELEMENT,f=cQ(this.draco,n);let A;const v=this.draco._malloc(l);try{const T=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,T,f,l,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,l]of Object.entries(t.extraAttributes||{}))if(l===n)return o;const i=e.attribute_type;for(const o in DS)if(this.draco[o]===i)return DS[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=uQ(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(l=>o.min_value(l))}}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 cQ(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 uQ(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function fQ(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}const hQ="1.5.6",dQ="1.4.1",Gv=`https://www.gstatic.com/draco/versioned/decoders/${hQ}`,Vo={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},jv={[Vo.DECODER]:`${Gv}/${Vo.DECODER}`,[Vo.DECODER_WASM]:`${Gv}/${Vo.DECODER_WASM}`,[Vo.FALLBACK_DECODER]:`${Gv}/${Vo.FALLBACK_DECODER}`,[Vo.ENCODER]:`https://raw.githubusercontent.com/google/draco/${dQ}/javascript/${Vo.ENCODER}`};let Hv;async function pQ(r){const e=r.modules||{};return e.draco3d?Hv||=e.draco3d.createDecoderModule({}).then(t=>({draco:t})):Hv||=AQ(r),await Hv}async function AQ(r){let e,t;switch(r.draco&&r.draco.decoderType){case"js":e=await Fv(jv[Vo.FALLBACK_DECODER],"draco",r,Vo.FALLBACK_DECODER);break;case"wasm":default:[e,t]=await Promise.all([await Fv(jv[Vo.DECODER],"draco",r,Vo.DECODER),await Fv(jv[Vo.DECODER_WASM],"draco",r,Vo.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await gQ(e,t)}function gQ(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r({...t,onModuleLoaded:i=>n({draco:i})})})}const mQ={...nQ,parse:_Q};async function _Q(r,e){const{draco:t}=await pQ(e),n=new lQ(t);try{return n.parseSync(r,e?.draco)}finally{n.destroy()}}function yQ(r){const e={};for(const t in r){const n=r[t];if(t!=="indices"){const i=vF(n);e[t]=i}}return e}function vF(r){const{buffer:e,size:t,count:n}=vQ(r);return{value:e,size:t,byteOffset:0,count:n,type:lF(t),componentType:V_(e)}}function vQ(r){let e=r,t=1,n=0;return r&&r.value&&(e=r.value,t=r.size||1),e&&(ArrayBuffer.isView(e)||(e=bQ(e,Float32Array)),n=e.length/t),{buffer:e,size:t,count:n}}function bQ(r,e,t=!1){return r?Array.isArray(r)?new e(r):t&&!(r instanceof e)?new e(r):r:null}const Ku="KHR_draco_mesh_compression",xQ=Ku;function wQ(r,e,t){const n=new ks(r);for(const i of bF(n))n.getObjectExtension(i,Ku)}async function TQ(r,e,t){if(!e?.gltf?.decompressMeshes)return;const n=new ks(r),i=[];for(const s of bF(n))n.getObjectExtension(s,Ku)&&i.push(CQ(n,s,e,t));await Promise.all(i),n.removeExtension(Ku)}function EQ(r,e={}){const t=new ks(r);for(const n of t.json.meshes||[])SQ(n),t.addRequiredExtension(Ku)}async function CQ(r,e,t,n){const i=r.getObjectExtension(e,Ku);if(!i)return;const s=r.getTypedArrayForBufferView(i.bufferView),o=rF(s.buffer,s.byteOffset),l={...t};delete l["3d-tiles"];const f=await eF(o,mQ,l,n),A=yQ(f.attributes);for(const[v,T]of Object.entries(A))if(v in e.attributes){const I=e.attributes[v],F=r.getAccessor(I);F?.min&&F?.max&&(T.min=F.min,T.max=F.max)}e.attributes=A,f.indices&&(e.indices=vF(f.indices)),r.removeObjectExtension(e,Ku),IQ(e)}function SQ(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}),l=n._addFauxAttributes(o.attributes),f=n.addBufferView(s);return{primitives:[{attributes:l,mode:t,extensions:{[Ku]:{bufferView:f,attributes:l}}}]}}function IQ(r){if(!r.attributes&&Object.keys(r.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*bF(r){for(const e of r.json.meshes||[])for(const t of e.primitives)yield t}const BQ=Object.freeze(Object.defineProperty({__proto__:null,decode:TQ,encode:EQ,name:xQ,preprocess:wQ},Symbol.toStringTag,{value:"Module"})),H_="KHR_texture_transform",PQ=H_,B0=new dt,MQ=new Oi,RQ=new Oi;async function OQ(r,e){if(!new ks(r).hasExtension(H_)||!e.gltf?.loadBuffers)return;const i=r.json.materials||[];for(let s=0;s<i.length;s++)DQ(s,r)}function DQ(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?.[H_]&&FQ(e,r,s,i)}function FQ(r,e,t,n){const i=LQ(t,n);if(!i)return;const s=r.json.meshes||[];for(const o of s)for(const l of o.primitives){const f=l.material;Number.isFinite(f)&&e===f&&kQ(r,l,i)}}function LQ(r,e){const t=r.extensions?.[H_],{texCoord:n=0}=r,{texCoord:i=n}=t;if(!(e.findIndex(([o,l])=>o===n&&l===i)!==-1)){const o=zQ(t);return n!==i&&(r.texCoord=i),e.push([n,i]),{originalTexCoord:n,texCoord:i,matrix:o}}return null}function kQ(r,e,t){const{originalTexCoord:n,texCoord:i,matrix:s}=t,o=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){const l=r.json.accessors?.[o];if(l&&l.bufferView){const f=r.json.bufferViews?.[l.bufferView];if(f){const{arrayBuffer:A,byteOffset:v}=r.buffers[f.buffer],T=(v||0)+(l.byteOffset||0)+(f.byteOffset||0),{ArrayType:I,length:F}=Hx(l,f),N=aF[l.componentType],U=oF[l.type],$=f.byteStride||N*U,V=new Float32Array(F);for(let j=0;j<l.count;j++){const X=new I(A,T+j*$,2);B0.set(X[0],X[1],1),B0.transformByMatrix3(s),V.set([B0[0],B0[1]],j*U)}n===i?NQ(l,f,r.buffers,V):UQ(i,l,e,r,V)}}}}function NQ(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 UQ(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 zQ(r){const{offset:e=[0,0],rotation:t=0,scale:n=[1,1]}=r,i=new Oi().set(1,0,0,0,1,0,e[0],e[1],1),s=MQ.set(Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0,0,0,1),o=RQ.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}const VQ=Object.freeze(Object.defineProperty({__proto__:null,decode:OQ,name:PQ},Symbol.toStringTag,{value:"Module"})),Xf="KHR_lights_punctual",GQ=Xf;async function jQ(r){const e=new ks(r),{json:t}=e,n=e.getExtension(Xf);n&&(e.json.lights=n.lights,e.removeExtension(Xf));for(const i of t.nodes||[]){const s=e.getObjectExtension(i,Xf);s&&(i.light=s.light),e.removeObjectExtension(i,Xf)}}async function HQ(r){const e=new ks(r),{json:t}=e;if(t.lights){const n=e.addExtension(Xf);da(!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,Xf,n)}delete e.json.lights}}const WQ=Object.freeze(Object.defineProperty({__proto__:null,decode:jQ,encode:HQ,name:GQ},Symbol.toStringTag,{value:"Module"})),ng="KHR_materials_unlit",$Q=ng;async function XQ(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,ng);e.removeExtension(ng)}function qQ(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,ng,{}),e.addExtension(ng))}const JQ=Object.freeze(Object.defineProperty({__proto__:null,decode:XQ,encode:qQ,name:$Q},Symbol.toStringTag,{value:"Module"})),IA="KHR_techniques_webgl",KQ=IA;async function ZQ(r){const e=new ks(r),{json:t}=e,n=e.getExtension(IA);if(n){const i=QQ(n,e);for(const s of t.materials||[]){const o=e.getObjectExtension(s,IA);o&&(s.technique=Object.assign({},o,i[o.technique]),s.technique.values=eee(s.technique,e)),e.removeObjectExtension(s,IA)}e.removeExtension(IA)}}async function YQ(r,e){}function QQ(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 eee(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 tee=Object.freeze(Object.defineProperty({__proto__:null,decode:ZQ,encode:YQ,name:KQ},Symbol.toStringTag,{value:"Module"})),xF=[DZ,sZ,JY,YY,tQ,BQ,WQ,JQ,tee,VQ,ZZ];function ree(r,e={},t){const n=xF.filter(i=>wF(i.name,e));for(const i of n)i.preprocess?.(r,e,t)}async function nee(r,e={},t){const n=xF.filter(i=>wF(i.name,e));for(const i of n)await i.decode?.(r,e,t)}function wF(r,e){const t=e?.gltf?.excludeExtensions||{};return!(r in t&&!t[r])}const Wv="KHR_binary_glTF";function iee(r){const e=new ks(r),{json:t}=e;for(const n of t.images||[]){const i=e.getObjectExtension(n,Wv);i&&Object.assign(n,i),e.removeObjectExtension(n,Wv)}t.buffers&&t.buffers[0]&&delete t.buffers[0].uri,e.removeExtension(Wv)}const FS={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},see={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 oee=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),iee(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 FS)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 FS)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=see[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 aee(r,e={}){return new oee().normalize(r,e)}async function lee(r,e,t=0,n,i){return cee(r,e,t,n),aee(r,{normalize:n?.gltf?.normalize}),ree(r,n,i),n?.gltf?.loadBuffers&&r.json.buffers&&await uee(r,n,i),n?.gltf?.loadImages&&await fee(r,n,i),await nee(r,n,i),r}function cee(r,e,t,n){if(n.uri&&(r.baseUri=n.uri),e instanceof ArrayBuffer&&!PY(e,t,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")r.json=tK(e);else if(e instanceof ArrayBuffer){const o={};t=MY(o,e,t,n.glb),da(o.type==="glTF",`Invalid GLB magic string ${o.type}`),r._glb=o,r.json=o.json}else da(!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 uee(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;da(o);const l=_F(s.uri,e),A=await(await t?.fetch?.(l))?.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 fee(r,e,t){const n=hee(r),i=r.json.images||[],s=[];for(const o of n)s.push(dee(r,i[o],o,e,t));return await Promise.all(s)}function hee(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 dee(r,e,t,n,i){let s;if(e.uri&&!e.hasOwnProperty("bufferView")){const l=_F(e.uri,n),{fetch:f}=i;s=await(await f(l)).arrayBuffer(),e.bufferView={data:s}}if(Number.isFinite(e.bufferView)){const l=HK(r.json,r.buffers,e.bufferView);s=rF(l.buffer,l.byteOffset,l.byteLength)}da(s,"glTF image has no data");let o=await eF(s,[DK,wY],{...n,mimeType:e.mimeType,basis:n.basis||{format:mF()}},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 i_={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:YZ,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:pee,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function pee(r,e={},t){e={...i_.options,...e},e.gltf={...i_.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await lee({},r,n,e,t)}const Aee={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},gee={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},mee={magFilter:Oa.TEXTURE_MAG_FILTER,minFilter:Oa.TEXTURE_MIN_FILTER,wrapS:Oa.TEXTURE_WRAP_S,wrapT:Oa.TEXTURE_WRAP_T},_ee={[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 yee(){return{id:"default-sampler",parameters:_ee}}function vee(r){return gee[r]}function bee(r){return Aee[r]}let xee=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(e,t={}){const{json:n,buffers:i=[],images:s=[]}=e,{baseUri:o=""}=e;return da(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 l in o)s.attributes[l]=this.getAccessor(o[l]);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=vee(e.componentType),i=bee(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 l=o.bufferView.buffer,{ArrayType:f,byteLength:A}=Hx(o,o.bufferView),v=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+l.byteOffset;let T=l.arrayBuffer.slice(v,v+A);o.bufferView.byteStride&&(T=this._getValueFromInterleavedBuffer(l,v,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new f(T)}return o}_getValueFromInterleavedBuffer(e,t,n,i,s){const o=new Uint8Array(s*i);for(let l=0;l<s;l++){const f=t+l*n;o.set(new Uint8Array(e.arrayBuffer.slice(f,f+i)),l*i)}return o.buffer}_resolveTexture(e,t){return{...e,id:e.id||`texture-${t}
2096`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):yee(),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 mee[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 wee(r,e){return new xee().postProcess(r,e)}var fo=1e-6,gp=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 Tee(){var r=new gp(4);return gp!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Eee(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 Cee(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=Tee();return function(e,t,n,i,s,o){var l,f;for(t||(t=4),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,l=n;l<f;l+=t)r[0]=e[l],r[1]=e[l+1],r[2]=e[l+2],r[3]=e[l+3],s(r,r,o),e[l]=r[0],e[l+1]=r[1],e[l+2]=r[2],e[l+3]=r[3];return e}})();function vm(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function rp(r,e){const t=Cee([],e,r);return Eee(t,t,1/t[3]),t}function LS(r,e){const t=r%e;return t<0?e+t:t}function See(r,e,t){return t*e+(1-t)*r}function r2(r,e,t){return r<e?e:r>t?t:r}function Iee(r){return Math.log(r)*Math.LOG2E}const Kx=Math.log2||Iee;function Bee(r,e){var t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],f=e[6],A=e[7],v=e[8],T=e[9],I=e[10],F=e[11],N=e[12],U=e[13],$=e[14],V=e[15],j=t*l-n*o,X=t*f-i*o,ue=t*A-s*o,K=n*f-i*l,se=n*A-s*l,Ee=i*A-s*f,Ue=v*U-T*N,de=v*$-I*N,me=v*V-F*N,pe=T*$-I*U,W=T*V-F*U,re=I*V-F*$,Ce=j*re-X*W+ue*pe+K*me-se*de+Ee*Ue;return Ce?(Ce=1/Ce,r[0]=(l*re-f*W+A*pe)*Ce,r[1]=(i*W-n*re-s*pe)*Ce,r[2]=(U*Ee-$*se+V*K)*Ce,r[3]=(I*se-T*Ee-F*K)*Ce,r[4]=(f*me-o*re-A*de)*Ce,r[5]=(t*re-i*me+s*de)*Ce,r[6]=($*ue-N*Ee-V*X)*Ce,r[7]=(v*Ee-I*ue+F*X)*Ce,r[8]=(o*W-l*me+A*Ue)*Ce,r[9]=(n*me-t*W-s*Ue)*Ce,r[10]=(N*se-U*ue+V*j)*Ce,r[11]=(T*ue-v*se-F*j)*Ce,r[12]=(l*de-o*pe-f*Ue)*Ce,r[13]=(t*pe-n*de+i*Ue)*Ce,r[14]=(U*X-N*K-$*j)*Ce,r[15]=(v*K-T*X+I*j)*Ce,r):null}function $v(r,e,t){var n=e[0],i=e[1],s=e[2],o=e[3],l=e[4],f=e[5],A=e[6],v=e[7],T=e[8],I=e[9],F=e[10],N=e[11],U=e[12],$=e[13],V=e[14],j=e[15],X=t[0],ue=t[1],K=t[2],se=t[3];return r[0]=X*n+ue*l+K*T+se*U,r[1]=X*i+ue*f+K*I+se*$,r[2]=X*s+ue*A+K*F+se*V,r[3]=X*o+ue*v+K*N+se*j,X=t[4],ue=t[5],K=t[6],se=t[7],r[4]=X*n+ue*l+K*T+se*U,r[5]=X*i+ue*f+K*I+se*$,r[6]=X*s+ue*A+K*F+se*V,r[7]=X*o+ue*v+K*N+se*j,X=t[8],ue=t[9],K=t[10],se=t[11],r[8]=X*n+ue*l+K*T+se*U,r[9]=X*i+ue*f+K*I+se*$,r[10]=X*s+ue*A+K*F+se*V,r[11]=X*o+ue*v+K*N+se*j,X=t[12],ue=t[13],K=t[14],se=t[15],r[12]=X*n+ue*l+K*T+se*U,r[13]=X*i+ue*f+K*I+se*$,r[14]=X*s+ue*A+K*F+se*V,r[15]=X*o+ue*v+K*N+se*j,r}function n2(r,e,t){var n=t[0],i=t[1],s=t[2],o,l,f,A,v,T,I,F,N,U,$,V;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],l=e[1],f=e[2],A=e[3],v=e[4],T=e[5],I=e[6],F=e[7],N=e[8],U=e[9],$=e[10],V=e[11],r[0]=o,r[1]=l,r[2]=f,r[3]=A,r[4]=v,r[5]=T,r[6]=I,r[7]=F,r[8]=N,r[9]=U,r[10]=$,r[11]=V,r[12]=o*n+v*i+N*s+e[12],r[13]=l*n+T*i+U*s+e[13],r[14]=f*n+I*i+$*s+e[14],r[15]=A*n+F*i+V*s+e[15]),r}function TF(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 Pee(r,e,t){var n=Math.sin(t),i=Math.cos(t),s=e[4],o=e[5],l=e[6],f=e[7],A=e[8],v=e[9],T=e[10],I=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]=l*i+T*n,r[7]=f*i+I*n,r[8]=A*i-s*n,r[9]=v*i-o*n,r[10]=T*i-l*n,r[11]=I*i-f*n,r}function Mee(r,e,t){var n=Math.sin(t),i=Math.cos(t),s=e[0],o=e[1],l=e[2],f=e[3],A=e[4],v=e[5],T=e[6],I=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]=l*i+T*n,r[3]=f*i+I*n,r[4]=A*i-s*n,r[5]=v*i-o*n,r[6]=T*i-l*n,r[7]=I*i-f*n,r}function Ree(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 Oee=Ree;function kS(r,e){var t=r[0],n=r[1],i=r[2],s=r[3],o=r[4],l=r[5],f=r[6],A=r[7],v=r[8],T=r[9],I=r[10],F=r[11],N=r[12],U=r[13],$=r[14],V=r[15],j=e[0],X=e[1],ue=e[2],K=e[3],se=e[4],Ee=e[5],Ue=e[6],de=e[7],me=e[8],pe=e[9],W=e[10],re=e[11],Ce=e[12],et=e[13],_e=e[14],Le=e[15];return Math.abs(t-j)<=fo*Math.max(1,Math.abs(t),Math.abs(j))&&Math.abs(n-X)<=fo*Math.max(1,Math.abs(n),Math.abs(X))&&Math.abs(i-ue)<=fo*Math.max(1,Math.abs(i),Math.abs(ue))&&Math.abs(s-K)<=fo*Math.max(1,Math.abs(s),Math.abs(K))&&Math.abs(o-se)<=fo*Math.max(1,Math.abs(o),Math.abs(se))&&Math.abs(l-Ee)<=fo*Math.max(1,Math.abs(l),Math.abs(Ee))&&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(T-pe)<=fo*Math.max(1,Math.abs(T),Math.abs(pe))&&Math.abs(I-W)<=fo*Math.max(1,Math.abs(I),Math.abs(W))&&Math.abs(F-re)<=fo*Math.max(1,Math.abs(F),Math.abs(re))&&Math.abs(N-Ce)<=fo*Math.max(1,Math.abs(N),Math.abs(Ce))&&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(V-Le)<=fo*Math.max(1,Math.abs(V),Math.abs(Le))}function Dee(){var r=new gp(2);return gp!=Float32Array&&(r[0]=0,r[1]=0),r}function i2(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function Fee(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function Lee(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function kee(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function Nee(r,e){return r[0]=-e[0],r[1]=-e[1],r}function EF(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 Uee=Fee;(function(){var r=Dee();return function(e,t,n,i,s,o){var l,f;for(t||(t=2),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,l=n;l<f;l+=t)r[0]=e[l],r[1]=e[l+1],s(r,r,o),e[l]=r[0],e[l+1]=r[1];return e}})();function zee(){var r=new gp(3);return gp!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Vee(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function Gee(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function jee(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}var Hee=Gee;(function(){var r=zee();return function(e,t,n,i,s,o){var l,f;for(t||(t=3),n||(n=0),i?f=Math.min(i*t+n,e.length):f=e.length,l=n;l<f;l+=t)r[0]=e[l],r[1]=e[l+1],r[2]=e[l+2],s(r,r,o),e[l]=r[0],e[l+1]=r[1],e[l+2]=r[2];return e}})();function Zu(r,e){if(!r)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const vl=Math.PI,CF=vl/4,lc=vl/180,s2=180/vl,ig=512,NS=4003e4,P0=85.051129,SF=1.5;function o2(r){return Math.pow(2,r)}function Wee(r){return Kx(r)}function Gu(r){const[e,t]=r;Zu(Number.isFinite(e)),Zu(Number.isFinite(t)&&t>=-90&&t<=90,"invalid latitude");const n=e*lc,i=t*lc,s=ig*(n+vl)/(2*vl),o=ig*(vl+Math.log(Math.tan(CF+i*.5)))/(2*vl);return[s,o]}function Xu(r){const[e,t]=r,n=e/ig*(2*vl)-vl,i=2*(Math.atan(Math.exp(t/ig*(2*vl)-vl))-CF);return[n*s2,i*s2]}function $ee(r){const{latitude:e,longitude:t,highPrecision:n=!1}=r;Zu(Number.isFinite(e)&&Number.isFinite(t));const i=ig,s=Math.cos(e*lc),o=i/360,l=o/s,f=i/NS/s,A={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[o,l,f],degreesPerUnit:[1/o,1/l,1/f]};if(n){const v=lc*Math.tan(e*lc)/s,T=o*v/2,I=i/NS*v,F=I/l*f;A.unitsPerDegree2=[0,T,I],A.unitsPerMeter2=[F,0,F]}return A}function Xee(r){const{height:e,pitch:t,bearing:n,altitude:i,scale:s,center:o}=r,l=vm();n2(l,l,[0,0,-i]),Pee(l,l,-t*lc),Mee(l,l,n*lc);const f=s/e;return TF(l,l,[f,f,f]),o&&n2(l,l,jee([],o)),l}function qee(r){const{width:e,height:t,altitude:n,pitch:i=0,offset:s,center:o,scale:l,nearZMultiplier:f=1,farZMultiplier:A=1}=r;let{fovy:v=s_(SF)}=r;n!==void 0&&(v=s_(n));const T=v*lc,I=i*lc,F=IF(v);let N=F;o&&(N+=o[2]*l/Math.cos(I)/t);const U=T*(.5+(s?s[1]:0)/t),$=Math.sin(U)*N/Math.sin(r2(Math.PI/2-I-U,.01,Math.PI-.01)),V=Math.sin(I)*$+N,j=N*10,X=Math.min(V*A,j);return{fov:T,aspect:e/t,focalDistance:F,near:f,far:X}}function Jee(r){const{fov:e,aspect:t,near:n,far:i}=qee(r);return Oee([],e,t,n,i)}function s_(r){return 2*Math.atan(.5/r)*s2}function IF(r){return .5/Math.tan(.5*r*lc)}function Kee(r,e){const[t,n,i=0]=r;return Zu(Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)),rp(e,[t,n,i,1])}function US(r,e,t=0){const[n,i,s]=r;if(Zu(Number.isFinite(n)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(s))return rp(e,[n,i,s,1]);const o=rp(e,[n,i,0,1]),l=rp(e,[n,i,1,1]),f=o[2],A=l[2],v=f===A?0:((t||0)-f)/(A-f);return EF([],o,l,v)}function Zee(r){const{width:e,height:t,bounds:n,minExtent:i=0,maxZoom:s=24,offset:o=[0,0]}
2096=r,[[l,f],[A,v]]=n,T=Yee(r.padding),I=Gu([l,r2(v,-P0,P0)]),F=Gu([A,r2(f,-P0,P0)]),N=[Math.max(Math.abs(F[0]-I[0]),i),Math.max(Math.abs(F[1]-I[1]),i)],U=[e-T.left-T.right-Math.abs(o[0])*2,t-T.top-T.bottom-Math.abs(o[1])*2];Zu(U[0]>0&&U[1]>0);const $=U[0]/N[0],V=U[1]/N[1],j=(T.right-T.left)/2/$,X=(T.top-T.bottom)/2/V,ue=[(F[0]+I[0])/2+j,(F[1]+I[1])/2+X],K=Xu(ue),se=Math.min(s,Kx(Math.abs(Math.min($,V))));return Zu(Number.isFinite(se)),{longitude:K[0],latitude:K[1],zoom:se}}function Yee(r=0){return typeof r=="number"?{top:r,bottom:r,left:r,right:r}:(Zu(Number.isFinite(r.top)&&Number.isFinite(r.bottom)&&Number.isFinite(r.left)&&Number.isFinite(r.right)),r)}const zS=Math.PI/180;function Qee(r,e=0){const{width:t,height:n,unproject:i}=r,s={targetZ:e},o=i([0,n],s),l=i([t,n],s);let f,A;const v=r.fovy?.5*r.fovy*zS:Math.atan(.5/r.altitude),T=(90-r.pitch)*zS;return v>T-.01?(f=VS(r,0,e),A=VS(r,t,e)):(f=i([0,0],s),A=i([t,0],s)),[o,l,A,f]}function VS(r,e,t){const{pixelUnprojectionMatrix:n}=r,i=rp(n,[e,0,1,1]),s=rp(n,[e,r.height,1,1]),l=(t*r.distanceScales.unitsPerMeter[2]-i[2])/(s[2]-i[2]),f=EF([],i,s,l),A=Xu(f);return A.push(t),A}class cc{constructor(e={width:1,height:1}){Er(this,"latitude",void 0),Er(this,"longitude",void 0),Er(this,"zoom",void 0),Er(this,"pitch",void 0),Er(this,"bearing",void 0),Er(this,"altitude",void 0),Er(this,"fovy",void 0),Er(this,"meterOffset",void 0),Er(this,"center",void 0),Er(this,"width",void 0),Er(this,"height",void 0),Er(this,"scale",void 0),Er(this,"distanceScales",void 0),Er(this,"viewMatrix",void 0),Er(this,"projectionMatrix",void 0),Er(this,"viewProjectionMatrix",void 0),Er(this,"pixelProjectionMatrix",void 0),Er(this,"pixelUnprojectionMatrix",void 0),Er(this,"equals",V=>V instanceof cc?V.width===this.width&&V.height===this.height&&kS(V.projectionMatrix,this.projectionMatrix)&&kS(V.viewMatrix,this.viewMatrix):!1),Er(this,"project",(V,j={})=>{const{topLeft:X=!0}=j,ue=this.projectPosition(V),K=Kee(ue,this.pixelProjectionMatrix),[se,Ee]=K,Ue=X?Ee:this.height-Ee;return V.length===2?[se,Ue]:[se,Ue,K[2]]}),Er(this,"unproject",(V,j={})=>{const{topLeft:X=!0,targetZ:ue=void 0}=j,[K,se,Ee]=V,Ue=X?se:this.height-se,de=ue&&ue*this.distanceScales.unitsPerMeter[2],me=US([K,Ue,Ee],this.pixelUnprojectionMatrix,de),[pe,W,re]=this.unprojectPosition(me);return Number.isFinite(Ee)?[pe,W,re]:Number.isFinite(ue)?[pe,W,ue]:[pe,W]}),Er(this,"projectPosition",V=>{const[j,X]=Gu(V),ue=(V[2]||0)*this.distanceScales.unitsPerMeter[2];return[j,X,ue]}),Er(this,"unprojectPosition",V=>{const[j,X]=Xu(V),ue=(V[2]||0)*this.distanceScales.metersPerUnit[2];return[j,X,ue]});let{width:t,height:n,altitude:i=null,fovy:s=null}=e;const{latitude:o=0,longitude:l=0,zoom:f=0,pitch:A=0,bearing:v=0,position:T=null,nearZMultiplier:I=.02,farZMultiplier:F=1.01}=e;t=t||1,n=n||1,s===null&&i===null?(i=SF,s=s_(i)):s===null?s=s_(i):i===null&&(i=IF(s));const N=o2(f);i=Math.max(.75,i);const U=$ee({longitude:l,latitude:o}),$=Gu([l,o]);$.push(0),T&&Vee($,$,Hee([],T,U.unitsPerMeter)),this.projectionMatrix=Jee({width:t,height:n,scale:N,center:$,pitch:A,fovy:s,nearZMultiplier:I,farZMultiplier:F}),this.viewMatrix=Xee({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=l,this.zoom=f,this.pitch=A,this.bearing=v,this.altitude=i,this.fovy=s,this.center=$,this.meterOffset=T||[0,0,0],this.distanceScales=U,this._initMatrices(),Object.freeze(this)}_initMatrices(){const{width:e,height:t,projectionMatrix:n,viewMatrix:i}=this,s=vm();$v(s,s,n),$v(s,s,i),this.viewProjectionMatrix=s;const o=vm();TF(o,o,[e/2,-t/2,1]),n2(o,o,[1,-1,0]),$v(o,o,s);const l=Bee(vm(),o);if(!l)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=o,this.pixelUnprojectionMatrix=l}projectFlat(e){return Gu(e)}unprojectFlat(e){return Xu(e)}getMapCenterByLngLatPosition({lngLat:e,pos:t}){const n=US(t,this.pixelUnprojectionMatrix),i=Gu(e),s=i2([],i,Nee([],n)),o=i2([],this.center,s);return Xu(o)}fitBounds(e,t={}){const{width:n,height:i}=this,{longitude:s,latitude:o,zoom:l}=Zee(Object.assign({width:n,height:i,bounds:e},t));return new cc({width:n,height:i,longitude:s,latitude:o,zoom:l})}getBounds(e){const t=this.getBoundingRegion(e),n=Math.min(...t.map(l=>l[0])),i=Math.max(...t.map(l=>l[0])),s=Math.min(...t.map(l=>l[1])),o=Math.max(...t.map(l=>l[1]));return[[n,s],[i,o]]}getBoundingRegion(e={}){return Qee(this,e.z||0)}getLocationAtPoint({lngLat:e,pos:t}){return this.getMapCenterByLngLatPosition({lngLat:e,pos:t})}}const GS=512;function ete(r){const{width:e,height:t,pitch:n=0}=r;let{longitude:i,latitude:s,zoom:o,bearing:l=0}=r;(i<-180||i>180)&&(i=LS(i+180,360)-180),(l<-180||l>180)&&(l=LS(l+180,360)-180);const f=Kx(t/GS);if(o<=f)o=f,s=0;else{const A=t/2/Math.pow(2,o),v=Xu([0,A])[1];if(s<v)s=v;else{const T=Xu([0,GS-A])[1];s>T&&(s=T)}}return{width:e,height:t,longitude:i,latitude:s,zoom:o,pitch:n,bearing:l}}const BF=.01,tte=["longitude","latitude","zoom"],PF={curve:1.414,speed:1.2};function rte(r,e,t,n){const{startZoom:i,startCenterXY:s,uDelta:o,w0:l,u1:f,S:A,rho:v,rho2:T,r0:I}=MF(r,e,n);if(f<BF){const ue={};for(const K of tte){const se=r[K],Ee=e[K];ue[K]=See(se,Ee,t)}return ue}
2096const F=t*A,N=Math.cosh(I)/Math.cosh(I+v*F),U=l*((Math.cosh(I)*Math.tanh(I+v*F)-Math.sinh(I))/T)/f,$=1/N,V=i+Wee($),j=Lee([],o,U);i2(j,j,s);const X=Xu(j);return{longitude:X[0],latitude:X[1],zoom:V}}function nte(r,e,t){const n={...PF,...t},{screenSpeed:i,speed:s,maxDuration:o}=n,{S:l,rho:f}=MF(r,e,n),A=1e3*l;let v;return Number.isFinite(i)?v=A/(i/f):v=A/s,Number.isFinite(o)&&v>o?0:v}function MF(r,e,t){t=Object.assign({},PF,t);const n=t.curve,i=r.zoom,s=[r.longitude,r.latitude],o=o2(i),l=e.zoom,f=[e.longitude,e.latitude],A=o2(l-i),v=Gu(s),T=Gu(f),I=Uee([],T,v),F=Math.max(r.width,r.height),N=F/A,U=kee(I)*o,$=Math.max(U,BF),V=n*n,j=(N*N-F*F+V*V*$*$)/(2*F*V*$),X=(N*N-F*F-V*V*$*$)/(2*N*V*$),ue=Math.log(Math.sqrt(j*j+1)-j),K=Math.log(Math.sqrt(X*X+1)-X),se=(K-ue)/n;return{startZoom:i,startCenterXY:v,uDelta:I,w0:F,u1:U,S:se,rho:n,rho2:V,r0:ue,r1:K}}var Wc=typeof document<"u"?document:{};function jS(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 M0(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jS(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):jS(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function HS(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=ite(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. 2097In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,l;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,l=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function ite(r,e){if(r){if(typeof r=="string")return WS(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 WS(r,e)}}function WS(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 ste=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Xv(r){if(!r)return null;if(typeof r=="string")return r;r.toJS&&(r=r.toJS());var e={},t=HS(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 l=e[o.ref],f=null;if("interactive"in o&&(f=M0({},o),delete f.interactive),l){f=f||M0({},o),delete f.ref;var A=HS(ste),v;try{for(A.s();!(v=A.n()).done;){var T=v.value;T in l&&(f[T]=l[T])}}catch(I){A.e(I)}finally{A.f()}}return f||o});return M0(M0({},r),{},{layers:s})}var $S={};function ote(){}function ate(r){r&&console.error(r.error)}var RF={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},bm={container:Wc.body,mapboxApiAccessToken:lte(),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:ote,onError:ate,width:0,height:0,longitude:0,latitude:0,zoom:0,bearing:0,pitch:0,altitude:1.5};function lte(){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||$S.MapboxAccessToken||$S.REACT_APP_MAPBOX_ACCESS_TOKEN),r||"no-token"}function XS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"component";r.debug&&At.checkPropTypes(RF,r,"prop",e)}var gh=(function(){function r(e){var t=this;if(tf(this,r),Er(this,"props",bm),Er(this,"width",0),Er(this,"height",0),Er(this,"_fireLoadEvent",function(){t.props.onLoad({type:"load",target:t._map})}),Er(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 ef(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(Xv(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:Xv(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({},bm,t),XS(t,"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||bm.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),XS(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(Xv(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,l=n.pitch,f=l===void 0?0:l,A=n.bearing,v=A===void 0?0:A,T=n.altitude,I=T===void 0?1.5:T;return{longitude:i,latitude:s,zoom:o,pitch:f,bearing:v,altitude:I}}},{key:"_checkStyleSheet",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"0.47.0";if(!(typeof Wc>"u"))try{var n=Wc.createElement("div");n.className="mapboxgl-map",n.style.display="none",Wc.body.appendChild(n);var i=window.getComputedStyle(n).position!=="static";if(!i){var s=Wc.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")),Wc.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})();Er(gh,"initialized",!1);
2097Er(gh,"propTypes",RF);Er(gh,"defaultProps",bm);Er(gh,"savedMap",null);var xm={exports:{}},cte=xm.exports,qS;function ute(){return qS||(qS=1,(function(r,e){(function(t,n){r.exports=n()})(cte,(function(){var t,n,i;function s(o,l){if(!t)t=l;else if(!n)n=l;else{var f="var sharedChunk = {}; ("+t+")(sharedChunk); ("+n+")(sharedChunk);",A={};t(A),i=l(A),typeof window<"u"&&(i.workerUrl=window.URL.createObjectURL(new Blob([f],{type:"text/javascript"})))}}return s(["exports"],(function(o){function l(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,C,B,O;for(u===void 0&&(u=1e-6),C=a,O=0;O<8;O++){if(B=this.sampleCurveX(C)-a,Math.abs(B)<u)return C;var k=this.sampleCurveDerivativeX(C);if(Math.abs(k)<1e-6)break;C-=B/k}if((C=a)<(p=0))return p;if(C>(x=1))return x;for(;p<x;){if(B=this.sampleCurveX(C),Math.abs(B-a)<u)return C;a>B?p=C:x=C,C=.5*(x-p)+p}return C},A.prototype.solve=function(a,u){return this.sampleCurveY(this.solveCurveX(a,u))};var v=T;function T(a,u){this.x=a,this.y=u}T.prototype={clone:function(){return new T(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),C=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=C,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},T.convert=function(a){return a instanceof T?a:Array.isArray(a)?new T(a[0],a[1]):a};var I=typeof self<"u"?self:{},F=Math.pow(2,53)-1;function N(a,u,p,x){var C=new f(a,u,p,x);return function(B){return C.solve(B)}}var U=N(.25,.1,.25,1);function $(a,u,p){return Math.min(p,Math.max(u,a))}function V(a,u,p){var x=p-u,C=((a-u)%x+x)%x+u;return C===u?p:C}function j(a){for(var u=[],p=arguments.length-1;p-- >0;)u[p]=arguments[p+1];for(var x=0,C=u;x<C.length;x+=1){var B=C[x];for(var O in B)a[O]=B[O]}return a}var X=1;function ue(){return X++}function K(){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 Ee(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 C in a)x[C]=u.call(p||this,a[C],C,a);return x}
2097function me(a,u,p){var x={};for(var C in a)u.call(p||this,a[C],C,a)&&(x[C]=a[C]);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 Ce(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,C=x-1,B=void 0,O=void 0;p<x;C=p++)u+=((O=a[C]).x-(B=a[p]).x)*(B.y+O.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,C,B,O){var k=B||O;return u[C]=!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 Ve=null;function Ye(a){if(Ve==null){var u=a.navigator?a.navigator.userAgent:null;Ve=!!a.safari||!(!u||!(/\b(iPad|iPhone|iPod)\b/.test(u)||u.match("Safari")&&!u.match("Chrome")))}return Ve}function tt(a){try{var u=I[a];return u.setItem("_mapbox_test_",1),u.removeItem("_mapbox_test_"),!0}catch{return!1}}var rt,ut,vt,It,st=I.performance&&I.performance.now?I.performance.now.bind(I.performance):Date.now.bind(Date),dr=I.requestAnimationFrame||I.mozRequestAnimationFrame||I.webkitRequestAnimationFrame||I.msRequestAnimationFrame,er=I.cancelAnimationFrame||I.mozCancelAnimationFrame||I.webkitCancelAnimationFrame||I.msCancelAnimationFrame,Jt={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=I.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=I.document.createElement("a")),rt.href=a,rt.href},hardwareConcurrency:I.navigator&&I.navigator.hardwareConcurrency||4,get devicePixelRatio(){return I.devicePixelRatio},get prefersReducedMotion(){return!!I.matchMedia&&(ut==null&&(ut=I.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){!cn&&It&&(Mr?xr(a):vt=a)}},cn=!1,Mr=!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,It),a.isContextLost())return;Ar.supported=!0}
2097catch{}a.deleteTexture(u),cn=!0}I.document&&((It=I.document.createElement("img")).onload=function(){vt&&xr(vt),vt=null,Mr=!0},It.onerror=function(){cn=!0,vt=null},It.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var jn="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",jn,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 C=Yn(a);return yr(a)?(C.path="/styles/v1"+C.path+"/sprite"+u+p,this._makeAPIURL(C,this._customAccessToken||x)):(C.path+=""+u+p,mn(C))},_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*)(?=$)/,(Jt.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(C){for(var B=0,O=C;B<O.length;B+=1){var k=O[B].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 C=p.params;return u&&(C=C.filter((function(B){return!B.match(/^access_token=/)}))),C.length&&(x+="?"+C.join("&")),x},_r.prototype.canonicalizeTileset=function(a,u){for(var p=!!u&&yr(u),x=[],C=0,B=a.tiles||[];C<B.length;C+=1){var O=B[C];Dr(O)?x.push(this.canonicalizeTileURL(O,p)):x.push(O)}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 C=a.params.indexOf("secure");C>=0&&a.params.splice(C,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(B){return B.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 li=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Yn(a){var u=a.match(li);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 ri(a){if(!a)return null;var u=a.split(".");if(!u||u.length!==3)return null;try{return JSON.parse(decodeURIComponent(I.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=ri(Nt.ACCESS_TOKEN);return u=p&&p.u?I.btoa(encodeURIComponent(p.u).replace(/%([0-9A-F]{2})/g,(function(x,C){return String.fromCharCode(+("0x"+C))}))):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=I.localStorage.getItem(u);x&&(this.eventData=JSON.parse(x));var C=I.localStorage.getItem(p);C&&(this.anonId=C)}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{I.localStorage.setItem(p,this.anonId),Object.keys(this.eventData).length>=1&&I.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 C=this;if(Nt.EVENTS_URL){var B=Yn(Nt.EVENTS_URL);B.params.push("access_token="+(x||Nt.ACCESS_TOKEN||""));var O={event:this.type,created:new Date(a).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.13.3",skuId:jn,userId:this.anonId},k=u?j(O,u):O,G={url:mn(B),headers:{"Content-Type":"text/plain"},body:JSON.stringify([k])};this.pendingRequest=ct(G,(function(J){C.pendingRequest=null,p(J),C.saveEventData(),C.processRequests(x)}))}},Hn.prototype.queueRequest=function(a,u){this.queue.push(a),this.processRequests(u)};var Sn,Qn,Gt=(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,C,B){this.skuToken=C;var O=!(!B&&!Nt.ACCESS_TOKEN),k=Array.isArray(p)&&p.some((function(G){return yr(G)||Dr(G)}));Nt.EVENTS_URL&&O&&k&&this.queueRequest({id:x,timestamp:Date.now()},B)},u.prototype.processRequests=function(p){var x=this;if(!this.pendingRequest&&this.queue.length!==0){var C=this.queue.shift(),B=C.id,O=C.timestamp;B&&this.success[B]||(this.anonId||this.fetchEventData(),se(this.anonId)||(this.anonId=K()),this.postEvent(O,{skuToken:this.skuToken},(function(k){k||B&&(x.success[B]=!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(C){return yr(C)||Dr(C)}))&&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 C=ri(Nt.ACCESS_TOKEN),B=C?C.u:Nt.ACCESS_TOKEN,O=B!==this.eventData.tokenU;se(this.anonId)||(this.anonId=K(),O=!0);var k=this.queue.shift();if(this.eventData.lastSuccess){var G=new Date(this.eventData.lastSuccess),J=new Date(k),Q=(k-this.eventData.lastSuccess)/864e5;O=O||Q>=1||Q<-1||G.getDate()!==J.getDate()}else O=!0;
2097if(!O)return this.processRequests();this.postEvent(k,{"enabled.telemetry":!1},(function(ie){ie||(x.eventData.lastSuccess=k,x.eventData.tokenU=B)}),p)}},u})(Hn)),Rr=mr.postTurnstileEvent.bind(mr),nn=new Gt,gi=nn.postMapLoadEvent.bind(nn),Pe=500,kt=50;function Wt(){I.caches&&!Sn&&(Sn=I.caches.open("mapbox-tiles"))}function cr(a){var u=a.indexOf("?");return u<0?a:a.slice(0,u)}var Ze,Rt=1/0;function Ae(){return Ze==null&&(Ze=I.OffscreenCanvas&&new I.OffscreenCanvas(1,1).getContext("2d")&&typeof I.createImageBitmap=="function"),Ze}var Vt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Vt);var Et=(function(a){function u(p,x,C){x===401&&Dr(C)&&(p+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),a.call(this,p),this.status=x,this.url=C,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),H=_e()?function(){return self.worker&&self.worker.referrer}:function(){return(I.location.protocol==="blob:"?I.parent:I).location.href},bt,St,Te=function(a,u){if(!(/^file:/.test(p=a.url)||/^file:/.test(H())&&!/^\w+:/.test(p))){if(I.fetch&&I.Request&&I.AbortController&&I.Request.prototype.hasOwnProperty("signal"))return(function(x,C){var B,O=new I.AbortController,k=new I.Request(x.url,{method:x.method||"GET",body:x.body,credentials:x.credentials,headers:x.headers,referrer:H(),signal:O.signal}),G=!1,J=!1,Q=(B=k.url).indexOf("sku=")>0&&Dr(B);x.type==="json"&&k.headers.set("Accept","application/json");var ie=function(ye,ke,Ne){if(!J){if(ye&&ye.message!=="SecurityError"&&re(ye),ke&&Ne)return fe(ke);var He=Date.now();I.fetch(k).then((function(Ge){if(Ge.ok){var Ke=Q?Ge.clone():null;return fe(Ge,Ke,He)}return C(new Et(Ge.statusText,Ge.status,x.url))})).catch((function(Ge){Ge.code!==20&&C(new Error(Ge.message))}))}},fe=function(ye,ke,Ne){(x.type==="arrayBuffer"?ye.arrayBuffer():x.type==="json"?ye.json():ye.text()).then((function(He){J||(ke&&Ne&&(function(Ge,Ke,lt){if(Wt(),Sn){var mt={status:Ke.status,statusText:Ke.statusText,headers:new I.Headers};Ke.headers.forEach((function(Ot,Ht){return mt.headers.set(Ht,Ot)}));var yt=Le(Ke.headers.get("Cache-Control")||"");yt["no-store"]||(yt["max-age"]&&mt.headers.set("Expires",new Date(lt+1e3*yt["max-age"]).toUTCString()),new Date(mt.headers.get("Expires")).getTime()-lt<42e4||(function(Ot,Ht){if(Qn===void 0)try{new Response(new ReadableStream),Qn=!0}catch{Qn=!1}Qn?Ht(Ot.body):Ot.blob().then(Ht)})(Ke,(function(Ot){var Ht=new I.Response(Ot,mt);Wt(),Sn&&Sn.then((function(Kt){return Kt.put(cr(Ge.url),Ht)})).catch((function(Kt){return re(Kt.message)}))})))}})(k,ke,Ne),G=!0,C(null,He,ye.headers.get("Cache-Control"),ye.headers.get("Expires")))})).catch((function(He){J||C(new Error(He.message))}))};return Q?(function(ye,ke){if(Wt(),!Sn)return ke(null);var Ne=cr(ye.url);Sn.then((function(He){He.match(Ne).then((function(Ge){var Ke=(function(lt){if(!lt)return!1;var mt=new Date(lt.headers.get("Expires")||0),yt=Le(lt.headers.get("Cache-Control")||"");return mt>Date.now()&&!yt["no-cache"]})(Ge);He.delete(Ne),Ke&&He.put(Ne,Ge.clone()),ke(null,Ge,Ke)})).catch(ke)})).catch(ke)})(k,ie):ie(null,null),{cancel:function(){J=!0,G||O.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,C){var B=new I.XMLHttpRequest;for(var O in B.open(x.method||"GET",x.url,!0),x.type==="arrayBuffer"&&(B.responseType="arraybuffer"),x.headers)B.setRequestHeader(O,x.headers[O]);return x.type==="json"&&(B.responseType="text",B.setRequestHeader("Accept","application/json")),B.withCredentials=x.credentials==="include",B.onerror=function(){C(new Error(B.statusText))},B.onload=function(){if((B.status>=200&&B.status<300||B.status===0)&&B.response!==null){var k=B.response;if(x.type==="json")try{k=JSON.parse(B.response)}catch(G){return C(G)}
2097C(null,k,B.getResponseHeader("Cache-Control"),B.getResponseHeader("Expires"))}else C(new Et(B.statusText,B.status,x.url))},B.send(x.body),{cancel:function(){return B.abort()}}})(a,u)},Xe=function(a,u){return Te(j(a,{type:"arrayBuffer"}),u)},ct=function(a,u){return Te(j(a,{method:"POST"}),u)},Z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";bt=[],St=0;var ne=function(a,u){if(Ar.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),St>=Nt.MAX_PARALLEL_IMAGE_REQUESTS){var p={requestParameters:a,callback:u,cancelled:!1,cancel:function(){this.cancelled=!0}};return bt.push(p),p}St++;var x=!1,C=function(){if(!x)for(x=!0,St--;bt.length&&St<Nt.MAX_PARALLEL_IMAGE_REQUESTS;){var O=bt.shift();O.cancelled||(O.cancel=ne(O.requestParameters,O.callback).cancel)}},B=Xe(a,(function(O,k,G,J){C(),O?u(O):k&&(Ae()?(function(Q,ie){var fe=new I.Blob([new Uint8Array(Q)],{type:"image/png"});I.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 I.Image,Ne=I.URL;ke.onload=function(){ie(null,ke),Ne.revokeObjectURL(ke.src),ke.onload=null,I.requestAnimationFrame((function(){ke.src=Z}))},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 He=new I.Blob([new Uint8Array(Q)],{type:"image/png"});ke.cacheControl=fe,ke.expires=ye,ke.src=Q.byteLength?Ne.createObjectURL(He):Z})(k,u,G,J))}));return{cancel:function(){B.cancel(),C()}}};function ce(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 Fe=function(a,u){u===void 0&&(u={}),j(this,u),this.type=a},he=(function(a){function u(p,x){x===void 0&&(x={}),a.call(this,"error",j({error:p},x))}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u})(Fe),be=function(){};be.prototype.on=function(a,u){return this._listeners=this._listeners||{},ce(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||{},ce(a,u,this._oneTimeListeners),this},be.prototype.fire=function(a,u){typeof a=="string"&&(a=new Fe(a,u||{}));var p=a.type;if(this.listens(p)){a.target=this;for(var x=0,C=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];x<C.length;x+=1)C[x].call(this,a);for(var B=0,O=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];B<O.length;B+=1){var k=O[B];ve(p,k,this._oneTimeListeners),k.call(this,a)}var G=this._eventedParent;G&&(j(a,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),G.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 2097
2097={$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 2097
2097,"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"}}}
2097,Se=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 Se(a.key,u,"constants have been deprecated as of v8")]:[]}function le(a){for(var u=[],p=arguments.length-1;p-- >0;)u[p]=arguments[p+1];for(var x=0,C=u;x<C.length;x+=1){var B=C[x];for(var O in B)a[O]=B[O]}return a}function xt(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function Je(a){if(Array.isArray(a))return a.map(Je);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){var u={};for(var p in a)u[p]=Je(a[p]);return u}return xt(a)}var Ct=(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),Mt=function(a,u){u===void 0&&(u=[]),this.parent=a,this.bindings={};for(var p=0,x=u;p<x.length;p+=1){var C=x[p];this.bindings[C[0]]=C[1]}};Mt.prototype.concat=function(a){return new Mt(this,a)}
2097,Mt.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.")},Mt.prototype.has=function(a){return!!this.bindings[a]||!!this.parent&&this.parent.has(a)};var Ft={kind:"null"},ht={kind:"number"},Lt={kind:"string"},Pt={kind:"boolean"},jt={kind:"color"},Ur={kind:"object"},Qt={kind:"value"},en={kind:"collator"},ln={kind:"formatted"},$r={kind:"resolvedImage"};function Xr(a,u){return{kind:"array",itemType:a,N:u}}function Gr(a){if(a.kind==="array"){var u=Gr(a.itemType);return typeof a.N=="number"?"array<"+u+", "+a.N+">":a.itemType.kind==="value"?"array":"array<"+u+">"}return a.kind}var mi=[Ft,ht,Lt,Pt,jt,ln,Ur,Xr(Qt),$r];function qr(a,u){if(u.kind==="error")return null;if(a.kind==="array"){if(u.kind==="array"&&(u.N===0&&u.itemType.kind==="value"||!qr(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=mi;p<x.length;p+=1)if(!qr(x[p],u))return null}}return"Expected "+Gr(a)+" but found "+Gr(u)+" instead."}function pr(a,u){return u.some((function(p){return p.kind===a.kind}))}function Be(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 qt=l((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 C(k){return x(k[k.length-1]==="%"?parseFloat(k)/100*255:parseInt(k))}function B(k){return(G=k[k.length-1]==="%"?parseFloat(k)/100:parseFloat(k))<0?0:G>1?1:G;var G}function O(k,G,J){return J<0?J+=1:J>1&&(J-=1),6*J<1?k+(G-k)*J*6:2*J<1?G:3*J<2?k+(G-k)*(2/3-J)*6:k}try{u.parseCSSColor=function(k){var G,J=k.replace(/ /g,"").toLowerCase();if(J in p)return p[J].slice();if(J[0]==="#")return J.length===4?(G=parseInt(J.substr(1),16))>=0&&G<=4095?[(3840&G)>>4|(3840&G)>>8,240&G|(240&G)>>4,15&G|(15&G)<<4,1]:null:J.length===7&&(G=parseInt(J.substr(1),16))>=0&&G<=16777215?[(16711680&G)>>16,(65280&G)>>8,255&G,1]:null;var Q=J.indexOf("("),ie=J.indexOf(")");if(Q!==-1&&ie+1===J.length){var fe=J.substr(0,Q),ye=J.substr(Q+1,ie-(Q+1)).split(","),ke=1;switch(fe){case"rgba":if(ye.length!==4)return null;
2097ke=B(ye.pop());case"rgb":return ye.length!==3?null:[C(ye[0]),C(ye[1]),C(ye[2]),ke];case"hsla":if(ye.length!==4)return null;ke=B(ye.pop());case"hsl":if(ye.length!==3)return null;var Ne=(parseFloat(ye[0])%360+360)%360/360,He=B(ye[1]),Ge=B(ye[2]),Ke=Ge<=.5?Ge*(He+1):Ge+He-Ge*He,lt=2*Ge-Ke;return[x(255*O(lt,Ke,Ne+1/3)),x(255*O(lt,Ke,Ne)),x(255*O(lt,Ke,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=qt(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 Wi=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"})};Wi.prototype.compare=function(a,u){return this.collator.compare(a,u)},Wi.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var _a=function(a,u,p,x,C){this.text=a,this.image=u,this.scale=p,this.fontStack=x,this.textColor=C},ci=function(a){this.sections=a};ci.fromString=function(a){return new ci([new _a(a,null,null,null,null)])},ci.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}))},ci.factory=function(a){return a instanceof ci?a:ci.fromString(a)},ci.prototype.toString=function(){return this.sections.length===0?"":this.sections.map((function(a){return a.text})).join("")},ci.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 C={};x.fontStack&&(C["text-font"]=["literal",x.fontStack.split(",")]),x.scale&&(C["font-scale"]=x.scale),x.textColor&&(C["text-color"]=["rgba"].concat(x.textColor.toArray())),a.push(C)}}return a};var Wn=function(a){this.name=a.name,this.available=a.available};function Ie(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 Ho(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof tn||a instanceof Wi||a instanceof ci||a instanceof Wn)return!0;if(Array.isArray(a)){for(var u=0,p=a;u<p.length;u+=1)if(!Ho(p[u]))return!1;return!0}if(typeof a=="object"){for(var x in a)if(!Ho(a[x]))return!1;return!0}return!1}function $n(a){if(a===null)return Ft;if(typeof a=="string")return Lt;if(typeof a=="boolean")return Pt;if(typeof a=="number")return ht;if(a instanceof tn)return jt;if(a instanceof Wi)return en;if(a instanceof ci)return ln;if(a instanceof Wn)return $r;if(Array.isArray(a)){for(var u,p=a.length,x=0,C=a;x<C.length;x+=1){var B=$n(C[x]);if(u){if(u===B)continue;u=Qt;break}u=B}return Xr(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 ci||a instanceof Wn?a.toString():JSON.stringify(a)}Wn.prototype.toString=function(){return this.name},Wn.fromString=function(a){return a?new Wn({name:a,available:!1}):null},Wn.prototype.serialize=function(){return["image",this.name]};var Fi=function(a,u){this.type=a,this.value=u};Fi.parse=function(a,u){if(a.length!==2)return u.error("'literal' expression requires exactly one argument, but found "+(a.length-1)+" instead.");if(!Ho(a[1]))return u.error("invalid value");var p=a[1],x=$n(p),C=u.expectedType;return x.kind!=="array"||x.N!==0||!C||C.kind!=="array"||typeof C.N=="number"&&C.N!==0||(x=C),new Fi(x,p)},Fi.prototype.evaluate=function(){return this.value},Fi.prototype.eachChild=function(){},Fi.prototype.outputDefined=function(){return!0},Fi.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 ci?this.value.serialize():this.value};var ui=function(a){this.name="ExpressionEvaluationError",this.message=a};ui.prototype.toJSON=function(){return this.message};var Si={string:Lt,number:ht,boolean:Pt,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,C=a[0];if(C==="array"){var B,O;if(a.length>2){var k=a[1];if(typeof k!="string"||!(k in Si)||k==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);B=Si[k],x++}else B=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);O=a[2],x++}p=Xr(B,O)}else p=Si[C];for(var G=[];x<a.length;x++){var J=u.parse(a[x],x,Qt);if(!J)return null;G.push(J)}return new Rn(p,G)},Rn.prototype.evaluate=function(a){for(var u=0;u<this.args.length;u++){var p=this.args[u].evaluate(a);if(!qr(this.type,$n(p)))return p;if(u===this.args.length-1)throw new ui("Expected value to be of type "+Gr(this.type)+", but found "+Gr($n(p))+" instead.")}return null}
2097,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(C){return C.serialize()})))};var ms=function(a){this.type=ln,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=[],C=!1,B=1;B<=a.length-1;++B){var O=a[B];if(C&&typeof O=="object"&&!Array.isArray(O)){C=!1;var k=null;if(O["font-scale"]&&!(k=u.parse(O["font-scale"],1,ht)))return null;var G=null;if(O["text-font"]&&!(G=u.parse(O["text-font"],1,Xr(Lt))))return null;var J=null;if(O["text-color"]&&!(J=u.parse(O["text-color"],1,jt)))return null;var Q=x[x.length-1];Q.scale=k,Q.font=G,Q.textColor=J}else{var ie=u.parse(a[B],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'.");C=!0,x.push({content:ie,scale:null,font:null,textColor:null})}}return new ms(x)},ms.prototype.evaluate=function(a){return new ci(this.sections.map((function(u){var p=u.content.evaluate(a);return $n(p)===$r?new _a("",p,null,null,null):new _a(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 C={};x.scale&&(C["font-scale"]=x.scale.serialize()),x.font&&(C["text-font"]=x.font.serialize()),x.textColor&&(C["text-color"]=x.textColor.serialize()),a.push(C)}return a};var $i=function(a){this.type=$r,this.input=a};$i.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 $i(p):u.error("No image name provided.")},$i.prototype.evaluate=function(a){var u=this.input.evaluate(a),p=Wn.fromString(u);return p&&a.availableImages&&(p.available=a.availableImages.indexOf(u)>-1),p},$i.prototype.eachChild=function(a){a(this.input)},$i.prototype.outputDefined=function(){return!1},$i.prototype.serialize=function(){return["image",this.input.serialize()]};var Ns={"to-boolean":Pt,"to-color":jt,"to-number":ht,"to-string":Lt},In=function(a,u){this.type=a,this.args=u};In.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],C=[],B=1;B<a.length;B++){var O=u.parse(a[B],B,Qt);if(!O)return null;C.push(O)}return new In(x,C)},In.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,C=this.args;x<C.length;x+=1){if(p=null,(u=C[x].evaluate(a))instanceof tn)return u;if(typeof u=="string"){var B=a.parseColor(u);if(B)return B}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.":Ie(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 O=null,k=0,G=this.args;k<G.length;k+=1){if((O=G[k].evaluate(a))===null)return 0;var J=Number(O);if(!isNaN(J))return J}throw new ui("Could not convert "+JSON.stringify(O)+" to number.")}return this.type.kind==="formatted"?ci.fromString(Wo(this.args[0].evaluate(a))):this.type.kind==="resolvedImage"?Wn.fromString(Wo(this.args[0].evaluate(a))):Wo(this.args[0].evaluate(a))}
vendor: 4,261 bytes, line 2097
2097,In.prototype.eachChild=function(a){this.args.forEach(a)},In.prototype.outputDefined=function(){return this.args.every((function(a){return a.outputDefined()}))},In.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 $i(this.args[0]).serialize();var a=["to-"+this.type.kind];return this.eachChild((function(u){a.push(u.serialize())})),a};var gc=["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"?gc[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 Me=function(a,u,p,x){this.name=a,this.type=u,this._evaluate=p,this.args=x};Me.prototype.evaluate=function(a){return this._evaluate(a,this.args)},Me.prototype.eachChild=function(a){this.args.forEach(a)},Me.prototype.outputDefined=function(){return!1},Me.prototype.serialize=function(){return[this.name].concat(this.args.map((function(a){return a.serialize()})))},Me.parse=function(a,u){var p,x=a[0],C=Me.definitions[x];if(!C)return u.error('Unknown expression "'+x+'". If you wanted a literal array, use ["literal", [...]].',0);for(var B=Array.isArray(C)?C[0]:C.type,O=Array.isArray(C)?[[C[1],C[2]]]:C.overloads,k=O.filter((function(Sr){var ir=Sr[0];return!Array.isArray(ir)||ir.length===a.length-1})),G=null,J=0,Q=k;J<Q.length;J+=1){var ie=Q[J],fe=ie[0],ye=ie[1];G=new _i(u.registry,u.path,null,u.scope);for(var ke=[],Ne=!1,He=1;He<a.length;He++){var Ge=a[He],Ke=Array.isArray(fe)?fe[He-1]:fe.type,lt=G.parse(Ge,1+ke.length,Ke);if(!lt){Ne=!0;break}ke.push(lt)}if(!Ne)if(Array.isArray(fe)&&fe.length!==ke.length)G.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,Ot=ke[mt];G.concat(mt+1).checkSubtype(yt,Ot.type)}if(G.errors.length===0)return new Me(x,B,ye,ke)}}if(k.length===1)(p=u.errors).push.apply(p,G.errors);else{for(var Ht=(k.length?k:O).map((function(Sr){var ir;return ir=Sr[0],Array.isArray(ir)?"("+ir.map(Gr).join(", ")+")":"("+Gr(ir.type)+"...)"})).join(" | "),Kt=[],br=1;br<a.length;br++){var nr=u.parse(a[br],1+Kt.length);if(!nr)return null;Kt.push(Gr(nr.type))}u.error("Expected arguments of type "+Ht+", but found ("+Kt.join(", ")+") instead.")}return null},Me.register=function(a,u){for(var p in Me.definitions=u,u)a[p]=Me};var We=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 $t(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,C=Math.pow(2,u.z);return[Math.round(p*C*8192),Math.round(x*C*8192)]}function Br(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,C,B,O,k,G,J=!1,Q=0,ie=u.length;Q<ie;Q++)for(var fe=u[Q],ye=0,ke=fe.length;ye<ke-1;ye++){if((B=(p=a)[0]-(x=fe[ye])[0])*(G=p[1]-(C=fe[ye+1])[1])-(k=p[0]-C[0])*(O=p[1]-x[1])==0&&B*k<=0&&O*G<=0)return!1;Br(a,fe[ye],fe[ye+1])&&(J=!J)}return J}function Li(a,u){for(var p=0;p<u.length;p++)if(fi(a,u[p]))return!0;return!1}function Xi(a,u,p,x){var C=x[0]-p[0],B=x[1]-p[1],O=(a[0]-p[0])*B-C*(a[1]-p[1]),k=(u[0]-p[0])*B-C*(u[1]-p[1]);return O>0&&k<0||O<0&&k>0}function Qs(a,u,p){for(var x=0,C=p;x<C.length;x+=1)for(var B=C[x],O=0;O<B.length-1;++O)if((ie=[(Q=B[O+1])[0]-(J=B[O])[0],Q[1]-J[1]])[0]*(fe=[(G=u)[0]-(k=a)[0],G[1]-k[1]])[
20971]-ie[1]*fe[0]!=0&&Xi(k,G,J,Q)&&Xi(J,Q,k,G))return!0;var k,G,J,Q,ie,fe;return!1}function xh(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 uf(a,u){for(var p=0;p<u.length;p++)if(xh(a,u[p]))return!0;return!1}function ya(a,u,p){for(var x=[],C=0;C<a.length;C++){for(var B=[],O=0;O<a[C].length;O++){var k=vr(a[C][O],p);gt(u,k),B.push(k)}x.push(B)}return x}function mc(a,u,p){for(var x=[],C=0;C<a.length;C++){var B=ya(a[C],u,p);x.push(B)}return x}function _c(a,u,p,x){if(a[0]<p[0]||a[0]>p[2]){var C=.5*x,B=a[0]-p[0]>C?-x:p[0]-a[0]>C?x:0;B===0&&(B=a[0]-p[2]>C?-x:p[2]-a[0]>C?x:0),a[0]+=B}gt(u,a)}function wh(a,u,p,x){for(var C=8192*Math.pow(2,x.z),B=[8192*x.x,8192*x.y],O=[],k=0,G=a;k<G.length;k+=1)for(var J=0,Q=G[k];J<Q.length;J+=1){var ie=Q[J],fe=[ie.x+B[0],ie.y+B[1]];_c(fe,u,p,C),O.push(fe)}return O}function yc(a,u,p,x){for(var C,B=8192*Math.pow(2,x.z),O=[8192*x.x,8192*x.y],k=[],G=0,J=a;G<J.length;G+=1){for(var Q=[],ie=0,fe=J[G];ie<fe.length;ie+=1){var ye=fe[ie],ke=[ye.x+O[0],ye.y+O[1]];gt(u,ke),Q.push(ke)}k.push(Q)}if(u[2]-u[0]<=B/2){(C=u)[0]=C[1]=1/0,C[2]=C[3]=-1/0;for(var Ne=0,He=k;Ne<He.length;Ne+=1)for(var Ge=0,Ke=He[Ne];Ge<Ke.length;Ge+=1)_c(Ke[Ge],u,p,B)}return k}We.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,Pt);if(!x)return null;var C=u.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Pt);if(!C)return null;var B=null;return p.locale&&!(B=u.parse(p.locale,1,Lt))?null:new We(x,C,B)},We.prototype.evaluate=function(a){return new Wi(this.caseSensitive.evaluate(a),this.diacriticSensitive.evaluate(a),this.locale?this.locale.evaluate(a):null)},We.prototype.eachChild=function(a){a(this.caseSensitive),a(this.diacriticSensitive),this.locale&&a(this.locale)},We.prototype.outputDefined=function(){return!1},We.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=Pt,this.geojson=a,this.geometries=u};function $o(a){if(a instanceof Me&&(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&&!$o(p)&&(u=!1)})),u}
2097function va(a){if(a instanceof Me&&a.name==="feature-state")return!1;var u=!0;return a.eachChild((function(p){u&&!va(p)&&(u=!1)})),u}function Wa(a,u){if(a instanceof Me&&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(Ho(a[1])){var p=a[1];if(p.type==="FeatureCollection")for(var x=0;x<p.features.length;++x){var C=p.features[x].geometry.type;if(C==="Polygon"||C==="MultiPolygon")return new Us(p,p.features[x].geometry)}else if(p.type==="Feature"){var B=p.geometry.type;if(B==="Polygon"||B==="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],C=[1/0,1/0,-1/0,-1/0],B=u.canonicalID();if(p.type==="Polygon"){var O=ya(p.coordinates,C,B),k=wh(u.geometry(),x,C,B);if(!$t(x,C))return!1;for(var G=0,J=k;G<J.length;G+=1)if(!fi(J[G],O))return!1}if(p.type==="MultiPolygon"){var Q=mc(p.coordinates,C,B),ie=wh(u.geometry(),x,C,B);if(!$t(x,C))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],C=[1/0,1/0,-1/0,-1/0],B=u.canonicalID();if(p.type==="Polygon"){var O=ya(p.coordinates,C,B),k=yc(u.geometry(),x,C,B);if(!$t(x,C))return!1;for(var G=0,J=k;G<J.length;G+=1)if(!xh(J[G],O))return!1}if(p.type==="MultiPolygon"){var Q=mc(p.coordinates,C,B),ie=yc(u.geometry(),x,C,B);if(!$t(x,C))return!1;for(var fe=0,ye=ie;fe<ye.length;fe+=1)if(!uf(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 ba=function(a,u){this.type=u.type,this.name=a,this.boundExpression=u};
2097ba.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 ba(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)},ba.prototype.evaluate=function(a){return this.boundExpression.evaluate(a)},ba.prototype.eachChild=function(){},ba.prototype.outputDefined=function(){return!1},ba.prototype.serialize=function(){return["var",this.name]};var _i=function(a,u,p,x,C){u===void 0&&(u=[]),x===void 0&&(x=new Mt),C===void 0&&(C=[]),this.registry=a,this.path=u,this.key=u.map((function(B){return"["+B+"]"})).join(""),this.scope=x,this.errors=C,this.expectedType=p};function Mo(a,u){for(var p,x=a.length-1,C=0,B=x,O=0;C<=B;)if((p=a[O=Math.floor((C+B)/2)])<=u){if(O===x||u<a[O+1])return O;C=O+1}else{if(!(p>u))throw new ui("Input is not a number.");B=O-1}return 0}_i.prototype.parse=function(a,u,p,x,C){return C===void 0&&(C={}),u?this.concat(u,p,x)._parse(a,C):this._parse(a,C)},_i.prototype._parse=function(a,u){function p(J,Q,ie){return ie==="assert"?new Rn(Q,[J]):ie==="coerce"?new In(Q,[J]):J}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 C=this.registry[x];if(C){var B=C.parse(a,this);if(!B)return null;if(this.expectedType){var O=this.expectedType,k=B.type;if(O.kind!=="string"&&O.kind!=="number"&&O.kind!=="boolean"&&O.kind!=="object"&&O.kind!=="array"||k.kind!=="value")if(O.kind!=="color"&&O.kind!=="formatted"&&O.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string"){if(this.checkSubtype(O,k))return null}else B=p(B,O,u.typeAnnotation||"coerce");else B=p(B,O,u.typeAnnotation||"assert")}if(!(B instanceof Fi)&&B.type.kind!=="resolvedImage"&&(function J(Q){if(Q instanceof ba)return J(Q.boundExpression);if(Q instanceof Me&&Q.name==="error"||Q instanceof We||Q instanceof Us)return!1;var ie=Q instanceof In||Q instanceof Rn,fe=!0;return Q.eachChild((function(ye){fe=ie?fe&&J(ye):fe&&ye instanceof Fi})),!!fe&&$o(Q)&&Wa(Q,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])})(B)){var G=new xe;try{B=new Fi(B.type,B.evaluate(G))}catch(J){return this.error(J.message),null}}return B}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.")},_i.prototype.concat=function(a,u,p){var x=typeof a=="number"?this.path.concat(a):this.path,C=p?this.scope.concat(p):this.scope;return new _i(this.registry,x,u||null,C,this.errors)},_i.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(C){return"["+C+"]"})).join("");this.errors.push(new Ct(x,a))},_i.prototype.checkSubtype=function(a,u){var p=qr(a,u);return p&&this.error(p),p};var Vn=function(a,u,p){this.type=a,this.input=u,this.labels=[],this.outputs=[];for(var x=0,C=p;x<C.length;x+=1){var B=C[x],O=B[1];this.labels.push(B[0]),this.outputs.push(O)}};function hi(a,u,p){return a*(1-p)+u*p}Vn.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=[],C=null;u.expectedType&&u.expectedType.kind!=="value"&&(C=u.expectedType);for(var B=1;B<a.length;B+=2){var O=B===1?-1/0:a[B],k=a[B+1],G=B,J=B+1;if(typeof O!="number")return u.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
2097omputed expressions) for the input values.',G);if(x.length&&x[x.length-1][0]>=O)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',G);var Q=u.parse(k,J,C);if(!Q)return null;C=C||Q.type,x.push([O,Q])}return new Vn(C,p,x)},Vn.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 C=u.length;return x>=u[C-1]?p[C-1].evaluate(a):p[Mo(u,x)].evaluate(a)},Vn.prototype.eachChild=function(a){a(this.input);for(var u=0,p=this.outputs;u<p.length;u+=1)a(p[u])},Vn.prototype.outputDefined=function(){return this.outputs.every((function(a){return a.outputDefined()}))},Vn.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 $a=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,C){return hi(x,u[C],p)}))}}),vc=6/29*3*(6/29),Op=Math.PI/180,Dp=180/Math.PI;function ff(a){return a>.008856451679035631?Math.pow(a,1/3):a/vc+4/29}function iu(a){return a>6/29?a*a*a:vc*(a-4/29)}function Bl(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 hf(a){var u=Xo(a.r),p=Xo(a.g),x=Xo(a.b),C=ff((.4124564*u+.3575761*p+.1804375*x)/.95047),B=ff((.2126729*u+.7151522*p+.072175*x)/1);return{l:116*B-16,a:500*(C-B),b:200*(B-ff((.0193339*u+.119192*p+.9503041*x)/1.08883)),alpha:a.a}}function df(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*iu(u),p=.95047*iu(p),x=1.08883*iu(x),new tn(Bl(3.2404542*p-1.5371385*u-.4985314*x),Bl(-.969266*p+1.8760108*u+.041556*x),Bl(.0556434*p-.2040259*u+1.0572252*x),a.alpha)}function su(a,u,p){var x=u-a;return a+p*(x>180||x<-180?x-360*Math.round(x/360):x)}var bo={forward:hf,reverse:df,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=hf(a),p=u.l,x=u.a,C=u.b,B=Math.atan2(C,x)*Dp;return{h:B<0?B+360:B,c:Math.sqrt(x*x+C*C),l:p,alpha:a.a}},reverse:function(a){var u=a.h*Op,p=a.c;return df({l:a.l,a:Math.cos(u)*p,b:Math.sin(u)*p,alpha:a.alpha})},interpolate:function(a,u,p){return{h:su(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)}}},pf=Object.freeze({__proto__:null,lab:bo,hcl:eo}),zi=function(a,u,p,x,C){this.type=a,this.operator=u,this.interpolation=p,this.input=x,this.labels=[],this.outputs=[];for(var B=0,O=C;B<O.length;B+=1){var k=O[B],G=k[1];this.labels.push(k[0]),this.outputs.push(G)}};function bc(a,u,p,x){var C=x-p,B=a-p;return C===0?0:u===1?B/C:(Math.pow(u,B)-1)/(Math.pow(u,C)-1)}zi.interpolationFactor=function(a,u,p,x){var C=0;if(a.name==="exponential")C=bc(u,a.base,p,x);else if(a.name==="linear")C=bc(u,1,p,x);else if(a.name==="cubic-bezier"){var B=a.controlPoints;C=new f(B[0],B[1],B[2],B[3]).solve(bc(u,1,p,x))}return C},zi.parse=function(a,u){var p=a[0],x=a[1],C=a[2],B=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 O=x[1];if(typeof O!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);x={name:"exponential",base:O}}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(He){return typeof He!="number"||He<0||He>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(!(C=u.parse(C,2,ht)))return null;var G=[],J=null;p==="interpolate-hcl"||p==="interpolate-lab"?J=jt:u.expectedType&&u.expectedType.kind!=="value"&&(J=u.expectedType);for(var Q=0;Q<B.length;Q+=2){var ie=B[Q],fe=B[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
2097omputed expressions) for the input values.',ye);if(G.length&&G[G.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,J);if(!Ne)return null;J=J||Ne.type,G.push([ie,Ne])}return J.kind==="number"||J.kind==="color"||J.kind==="array"&&J.itemType.kind==="number"&&typeof J.N=="number"?new zi(J,p,x,C,G):u.error("Type "+Gr(J)+" 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 C=u.length;if(x>=u[C-1])return p[C-1].evaluate(a);var B=Mo(u,x),O=zi.interpolationFactor(this.interpolation,x,u[B],u[B+1]),k=p[B].evaluate(a),G=p[B+1].evaluate(a);return this.operator==="interpolate"?$a[this.type.kind.toLowerCase()](k,G,O):this.operator==="interpolate-hcl"?eo.reverse(eo.interpolate(eo.forward(k),eo.forward(G),O)):bo.reverse(bo.interpolate(bo.forward(k),bo.forward(G),O))},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 xa=function(a,u){this.type=a,this.args=u};xa.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 C=[],B=0,O=a.slice(1);B<O.length;B+=1){var k=u.parse(O[B],1+C.length,p,void 0,{typeAnnotation:"omit"});if(!k)return null;p=p||k.type,C.push(k)}var G=x&&C.some((function(J){return qr(x,J.type)}));return new xa(G?Qt:p,C)},xa.prototype.evaluate=function(a){for(var u,p=null,x=0,C=0,B=this.args;C<B.length&&(x++,(p=B[C].evaluate(a))&&p instanceof Wn&&!p.available&&(u||(u=p.name),p=null,x===this.args.length&&(p=u)),p===null);C+=1);return p},xa.prototype.eachChild=function(a){this.args.forEach(a)},xa.prototype.outputDefined=function(){return this.args.every((function(a){return a.outputDefined()}))},xa.prototype.serialize=function(){var a=["coalesce"];return this.eachChild((function(u){a.push(u.serialize())})),a};var wa=function(a,u){this.type=u.type,this.bindings=[].concat(a),this.result=u};wa.prototype.evaluate=function(a){return this.result.evaluate(a)},wa.prototype.eachChild=function(a){for(var u=0,p=this.bindings;u<p.length;u+=1)a(p[u][1]);a(this.result)},wa.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 C=a[x];if(typeof C!="string")return u.error("Expected string, but found "+typeof C+" instead.",x);if(/[^a-zA-Z0-9_]/.test(C))return u.error("Variable names must contain only alphanumeric characters or '_'.",x);var B=u.parse(a[x+1],x+1);if(!B)return null;p.push([C,B])}var O=u.parse(a[a.length-1],a.length-1,u.expectedType,p);return O?new wa(p,O):null},wa.prototype.outputDefined=function(){return this.result.outputDefined()},wa.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,Xr(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=Pt,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,[Pt,Lt,ht,Ft,Qt])?new Xa(p,x):u.error("Expected first argument to be of type boolean, string, number or null, but found "+Gr(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(!Be(u,["boolean","string","number","null"]))throw new ui("Expected first argument to be of type boolean, string, number or null, but found "+Gr($n(u))+" instead.");if(!Be(p,["string","array"]))throw new ui("Expected second argument to be of type array or string, but found "+Gr($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,[Pt,Lt,ht,Ft,Qt]))return u.error("Expected first argument to be of type boolean, string, number or null, but found "+Gr(p.type)+" instead");if(a.length===4){var C=u.parse(a[3],3,ht);return C?new Ea(p,x,C):null}return new Ea(p,x)},Ea.prototype.evaluate=function(a){var u=this.needle.evaluate(a),p=this.haystack.evaluate(a);if(!Be(u,["boolean","string","number","null"]))throw new ui("Expected first argument to be of type boolean, string, number or null, but found "+Gr($n(u))+" instead.");if(!Be(p,["string","array"]))throw new ui("Expected second argument to be of type array or string, but found "+Gr($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 qa=function(a,u,p,x,C,B){this.inputType=a,this.type=u,this.input=p,this.cases=x,this.outputs=C,this.otherwise=B};qa.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 C={},B=[],O=2;O<a.length-1;O+=2){var k=a[O],G=a[O+1];Array.isArray(k)||(k=[k]);var J=u.concat(O);if(k.length===0)return J.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 J.error("Branch labels must be numbers or strings.");if(typeof fe=="number"&&Math.abs(fe)>Number.MAX_SAFE_INTEGER)return J.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if(typeof fe=="number"&&Math.floor(fe)!==fe)return J.error("Numeric branch labels must be integer values.");if(p){if(J.checkSubtype(p,$n(fe)))return null}else p=$n(fe);if(C[String(fe)]!==void 0)return J.error("Branch labels must be unique.");C[String(fe)]=B.length}var ye=u.parse(G,O,x);if(!ye)return null;x=x||ye.type,B.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 qa(p,x,ke,C,B,Ne):null},qa.prototype.evaluate=function(a){var u=this.input.evaluate(a);return($n(u)===this.inputType&&this.outputs[this.cases[u]]||this.otherwise).evaluate(a)},qa.prototype.eachChild=function(a){a(this.input),this.outputs.forEac
2097h(a),a(this.otherwise)},qa.prototype.outputDefined=function(){return this.outputs.every((function(a){return a.outputDefined()}))&&this.otherwise.outputDefined()},qa.prototype.serialize=function(){for(var a=this,u=["match",this.input.serialize()],p=[],x={},C=0,B=Object.keys(this.cases).sort();C<B.length;C+=1){var O=B[C];(ie=x[this.cases[O]])===void 0?(x[this.cases[O]]=p.length,p.push([this.cases[O],[O]])):p[ie][1].push(O)}for(var k=function(ye){return a.inputType.kind==="number"?Number(ye):ye},G=0,J=p;G<J.length;G+=1){var Q=J[G],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 Ja=function(a,u,p){this.type=a,this.branches=u,this.otherwise=p};Ja.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=[],C=1;C<a.length-1;C+=2){var B=u.parse(a[C],C,Pt);if(!B)return null;var O=u.parse(a[C+1],C+1,p);if(!O)return null;x.push([B,O]),p=p||O.type}var k=u.parse(a[a.length-1],a.length-1,p);return k?new Ja(p,x,k):null},Ja.prototype.evaluate=function(a){for(var u=0,p=this.branches;u<p.length;u+=1){var x=p[u],C=x[1];if(x[0].evaluate(a))return C.evaluate(a)}return this.otherwise.evaluate(a)},Ja.prototype.eachChild=function(a){for(var u=0,p=this.branches;u<p.length;u+=1){var x=p[u],C=x[1];a(x[0]),a(C)}a(this.otherwise)},Ja.prototype.outputDefined=function(){return this.branches.every((function(a){return a[1].outputDefined()}))&&this.otherwise.outputDefined()},Ja.prototype.serialize=function(){var a=["case"];return this.eachChild((function(u){a.push(u.serialize())})),a};var Ca=function(a,u,p,x){this.type=a,this.input=u,this.beginIndex=p,this.endIndex=x};function Th(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 Eh(a,u,p,x){return x.compare(u,p)===0}function Bn(a,u,p){var x=a!=="=="&&a!=="!=";return(function(){function C(B,O,k){this.type=Pt,this.lhs=B,this.rhs=O,this.collator=k,this.hasUntypedArgument=B.type.kind==="value"||O.type.kind==="value"}return C.parse=function(B,O){if(B.length!==3&&B.length!==4)return O.error("Expected two or three arguments.");var k=B[0],G=O.parse(B[1],1,Qt);if(!G)return null;if(!Th(k,G.type))return O.concat(1).error('"'+k+`" comparisons are not supported for type '`+Gr(G.type)+"'.");var J=O.parse(B[2],2,Qt);if(!J)return null;if(!Th(k,J.type))return O.concat(2).error('"'+k+`" comparisons are not supported for type '`+Gr(J.type)+"'.");if(G.type.kind!==J.type.kind&&G.type.kind!=="value"&&J.type.kind!=="value")return O.error("Cannot compare types '"+Gr(G.type)+"' and '"+Gr(J.type)+"'.");x&&(G.type.kind==="value"&&J.type.kind!=="value"?G=new Rn(J.type,[G]):G.type.kind!=="value"&&J.type.kind==="value"&&(J=new Rn(G.type,[J])));var Q=null;if(B.length===4){if(G.type.kind!=="string"&&J.type.kind!=="string"&&G.type.kind!=="value"&&J.type.kind!=="value")return O.error("Cannot use collator to compare non-string types.");if(!(Q=O.parse(B[3],3,en)))return null}return new C(G,J,Q)},C.prototype.evaluate=function(B){var O=this.lhs.evaluate(B),k=this.rhs.evaluate(B);if(x&&this.hasUntypedArgument){var G=$n(O),J=$n(k);if(G.kind!==J.kind||G.kind!=="string"&&G.kind!=="number")throw new ui('Expected arguments for "'+a+'" to be (string, string) or (number, number), but found ('+G.kind+", "+J.kind+") instead.")}if(this.collator&&!x&&this.hasUntypedArgument){var Q=$n(O),ie=$n(k);if(Q.kind!=="string"||ie.kind!=="string")return u(B,O,k)}return this.collator?p(B,O,k,this.collator.evaluate(B)):u(B,O,k)},C.prototype.eachChild=function(B){B(this.lhs),B(this.rhs),this.collator&&B(this.collator)},C.prototype.outputDefined=function(){return!0},C.prototype.serialize=function(){var B=[a];return this.eachChild((function(O){B.push(O.serialize())})),B},C})()}Ca.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,[Xr(Qt),Lt,Qt]))return u.error("Expected first argument to be of type array or string, but found "+Gr(p.type)+" instead");if(a.length===4){var C=u.parse(a[3],3,ht);return C?new Ca(p.type,p,x,C):null}return new Ca(p.type,p,x)},Ca.prototype.evaluate=function(a){var u=this.input.evaluate(a),p=this.beginIndex.evaluate(a);if(!Be(u,["string","array"]))throw new ui("Expected first argument to be of type array or string, but found "+Gr($n(u))+" instead.");if(this.endIndex){var x=this.endIndex.evaluate(a);return u.slice(p,x)}return u.slice(p)},Ca.prototype.eachChild=function(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)},Ca.prototype.outputDefined=function(){return!1},Ca.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 ou=Bn("==",(function(a,u,p){return u===p}),Eh),au=Bn("!=",(function(a,u,p){return u!==p}),(function(a,u,p,x){return!Eh(0,u,p,x)})),Ch=Bn("<",(function(a,u,p){return u<p}),(function(a,u,p,x){return x.compare(u,p)<0})),Sh=Bn(">",(function(a,u,p){return u>p}),(function(a,u,p,x){return x.compare(u,p)>0})),Pl=Bn("<=",(function(a,u,p){return u<=p}),(function(a,u,p,x){return x.compare(u,p)<=0})),Ih=Bn(">=",(function(a,u,p){return u>=p}),(function(a,u,p,x){return x.compare(u,p)>=0})),qo=function(a,u,p,x,C){this.type=Lt,this.number=a,this.locale=u,this.currency=p,this.minFractionDigits=x,this.maxFractionDigits=C};qo.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 C=null;if(x.locale&&!(C=u.parse(x.locale,1,Lt)))return null;var B=null;if(x.currency&&!(B=u.parse(x.currency,1,Lt)))return null;var O=null;if(x["min-fraction-digits"]&&!(O=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 qo(p,C,B,O,k)},qo.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))},qo.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)},qo.prototype.outputDefined=function(){return!1},qo.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 Jo=function(a){this.type=ht,this.input=a};Jo.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 "+Gr(p.type)+" instead."):new Jo(p):null},Jo.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 "+Gr($n(u))+" instead.")},Jo.prototype.eachChild=function(a){a(this.input)},Jo.prototype.outputDefined=function(){return!1},Jo.prototype.serialize=function(){var a=["length"];return this.eachChild((function(u){a.push(u.serialize())})),a};var to={"==":ou,"!=":au,">":Sh,"<":Ch,">=":Ih,"<=":Pl,array:Rn,at:Ta,boolean:Rn,case:Ja,coalesce:xa,collator:We,format:ms,image:$i,in:Xa,"index-of":Ea,interpolate:zi,"interpolate-hcl":zi,"interpolate-lab":zi,length:Jo,let:wa,literal:Fi,match:qa,number:Rn,"number-format":qo,object:Rn,slice:Ca,step:Vn,string:Rn,"to-boolean":In,"to-color":In,"to-number":In,"to-string":In,var:ba,within:Us};function Bh(a,u){var p=u[0],x=u[1],C=u[2],B=u[3];p=p.evaluate(a),x=x.evaluate(a),C=C.evaluate(a);var O=B?B.evaluate(a):1,k=Ie(p,x,C,O);if(k)throw new ui(k);
2097return new tn(p/255*O,x/255*O,C/255*O,O)}function lu(a,u){return a in u}function cu(a,u){var p=u[a];return p===void 0?null:p}function Ka(a){return{type:a}}function Af(a){return{result:"success",value:a}}function Ko(a){return{result:"error",value:a}}function Zo(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function xc(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function On(a){return!!a.expression&&a.expression.interpolated}function Fn(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function uu(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function Fp(a){return a}function Ml(a,u,p){return a!==void 0?a:u!==void 0?u:p!==void 0?p:void 0}function Ph(a,u,p,x,C){return Ml(typeof p===C?x[p]:void 0,a.default,u.default)}function Lp(a,u,p){if(Fn(p)!=="number")return Ml(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 C=Mo(a.stops.map((function(B){return B[0]})),p);return a.stops[C][1]}function Mh(a,u,p){var x=a.base!==void 0?a.base:1;if(Fn(p)!=="number")return Ml(a.default,u.default);var C=a.stops.length;if(C===1||p<=a.stops[0][0])return a.stops[0][1];if(p>=a.stops[C-1][0])return a.stops[C-1][1];var B=Mo(a.stops.map((function(ie){return ie[0]})),p),O=(function(ie,fe,ye,ke){var Ne=ke-ye,He=ie-ye;return Ne===0?0:fe===1?He/Ne:(Math.pow(fe,He)-1)/(Math.pow(fe,Ne)-1)})(p,x,a.stops[B][0],a.stops[B+1][0]),k=a.stops[B][1],G=a.stops[B+1][1],J=$a[u.type]||Fp;if(a.colorSpace&&a.colorSpace!=="rgb"){var Q=pf[a.colorSpace];J=function(ie,fe){return Q.reverse(Q.interpolate(Q.forward(ie),Q.forward(fe),O))}}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=G.evaluate.apply(void 0,ie);if(ye!==void 0&&ke!==void 0)return J(ye,ke,O)}}:J(k,G,O)}function ns(a,u,p){return u.type==="color"?p=tn.parse(p):u.type==="formatted"?p=ci.fromString(p.toString()):u.type==="resolvedImage"?p=Wn.fromString(p.toString()):Fn(p)===u.type||u.type==="enum"&&u.values[p]||(p=void 0),Ml(p,a.default,u.default)}Me.register(to,{error:[{kind:"error"},[Lt],function(a,u){throw new ui(u[0].evaluate(a))}],typeof:[Lt,[Qt],function(a,u){return Gr($n(u[0].evaluate(a)))}],"to-rgba":[Xr(ht,4),[jt],function(a,u){return u[0].evaluate(a).toArray()}],rgb:[jt,[ht,ht,ht],Bh],rgba:[jt,[ht,ht,ht,ht],Bh],has:{type:Pt,overloads:[[[Lt],function(a,u){return lu(u[0].evaluate(a),a.properties())}],[[Lt,Ur],function(a,u){var p=u[1];return lu(u[0].evaluate(a),p.evaluate(a))}]]},get:{type:Qt,overloads:[[[Lt],function(a,u){return cu(u[0].evaluate(a),a.properties())}],[[Lt,Ur],function(a,u){var p=u[1];return cu(u[0].evaluate(a),p.evaluate(a))}]]},"feature-state":[Qt,[Lt],function(a,u){return cu(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,Ka(ht),function(a,u){for(var p=0,x=0,C=u;x<C.length;x+=1)p+=C[x].evaluate(a);return p}],"*":[ht,Ka(ht),function(a,u){for(var p=1,x=0,C=u;x<C.length;x+=1)p*=C[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,Ka(ht),function(a,u){return Math.min.apply(Math,u.map((function(p){return p.evaluate(a)})))}],max:[ht,Ka(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-==":[Pt,[Lt,Qt],function(a,u){var p=u[0],x=u[1];return a.properties()[p.value]===x.value}],"filter-id-==":[Pt,[Qt],function(a,u){var p=u[0];return a.id()===p.value}],"filter-type-==":[Pt,[Lt],function(a,u){var p=u[0];return a.geometryType()===p.value}],"filter-<":[Pt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],C=a.properties()[p.value],B=x.value;return typeof C==typeof B&&C<B}],"filter-id-<":[Pt,[Qt],function(a,u){var p=u[0],x=a.id(),C=p.value;return typeof x==typeof C&&x<C}],"filter->":[Pt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],C=a.properties()[p.value],B=x.value;return typeof C==typeof B&&C>B}],"filter-id->":[Pt,[Qt],function(a,u){var p=u[0],x=a.id(),C=p.value;return typeof x==typeof C&&x>C}],"filter-<=":[Pt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],C=a.properties()[p.value],B=x.value;return typeof C==typeof B&&C<=B}],"filter-id-<=":[Pt,[Qt],function(a,u){var p=u[0],x=a.id(),C=p.value;return typeof x==typeof C&&x<=C}],"filter->=":[Pt,[Lt,Qt],function(a,u){var p=u[0],x=u[1],C=a.properties()[p.value],B=x.value;return typeof C==typeof B&&C>=B}],"filter-id->=":[Pt,[Qt],function(a,u){var p=u[0],x=a.id(),C=p.value;return typeof x==typeof C&&x>=C}],"filter-has":[Pt,[Qt],function(a,u){return u[0].value in a.properties()}],"filter-has-id":[Pt,[],function(a){return a.id()!==null&&a.id()!==void 0}],"filter-type-in":[Pt,[Xr(Lt)],function(a,u){return u[0].value.indexOf(a.geometryType())>=0}],"filter-id-in":[Pt,[Xr(Qt)],function(a,u){return u[0].value.indexOf(a.id())>=0}],"filter-in-small":[Pt,[Lt,Xr(Qt)],function(a,u){var p=u[0];return u[1].value.indexOf(a.properties()[p.value])>=0}],"filter-in-large":[Pt,[Lt,Xr(Qt)],function(a,u){var p=u[0],x=u[1];return(function(C,B,O,k){for(;O<=k;){var G=O+k>>1;
2097if(B[G]===C)return!0;B[G]>C?k=G-1:O=G+1}return!1})(a.properties()[p.value],x.value,0,x.value.length-1)}],all:{type:Pt,overloads:[[[Pt,Pt],function(a,u){var p=u[1];return u[0].evaluate(a)&&p.evaluate(a)}],[Ka(Pt),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:Pt,overloads:[[[Pt,Pt],function(a,u){var p=u[1];return u[0].evaluate(a)||p.evaluate(a)}],[Ka(Pt),function(a,u){for(var p=0,x=u;p<x.length;p+=1)if(x[p].evaluate(a))return!0;return!1}]]},"!":[Pt,[Pt],function(a,u){return!u[0].evaluate(a)}],"is-supported-script":[Pt,[Lt],function(a,u){var p=a.globals&&a.globals.isSupportedScript;return!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,Ka(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"&&uu(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 xo(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in to}function fu(a,u){var p=new _i(to,[],u?(function(C){var B={color:jt,string:Lt,number:ht,enum:Lt,boolean:Pt,formatted:ln,resolvedImage:$r};return C.type==="array"?Xr(B[C.value]||Qt,C.length):B[C.type]})(u):void 0),x=p.parse(a,void 0,void 0,void 0,u&&u.type==="string"?{typeAnnotation:"coerce"}:void 0);return x?Af(new Sa(x,u)):Ko(p.errors)}Sa.prototype.evaluateWithoutErrorHandling=function(a,u,p,x,C,B){return this._evaluator.globals=a,this._evaluator.feature=u,this._evaluator.featureState=p,this._evaluator.canonical=x,this._evaluator.availableImages=C||null,this._evaluator.formattedSection=B,this.expression.evaluate(this._evaluator)},Sa.prototype.evaluate=function(a,u,p,x,C,B){this._evaluator.globals=a,this._evaluator.feature=u||null,this._evaluator.featureState=p||null,this._evaluator.canonical=x,this._evaluator.availableImages=C||null,this._evaluator.formattedSection=B||null;try{var O=this.expression.evaluate(this._evaluator);if(O==null||typeof O=="number"&&O!=O)return this._defaultValue;if(this._enumValues&&!(O 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(O)+" instead.");return O}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"&&!va(u.expression)};Za.prototype.evaluateWithoutErrorHandling=function(a,u,p,x,C,B){return this._styleExpression.evaluateWithoutErrorHandling(a,u,p,x,C,B)},Za.prototype.evaluate=function(a,u,p,x,C,B){return this._styleExpression.evaluate(a,u,p,x,C,B)};var Rl=function(a,u,p,x){this.kind=a,this.zoomStops=p,this._styleExpression=u,this.isStateDependent=a!=="camera"&&!va(u.expression),this.interpolationType=x};function zs(a,u){if((a=fu(a,u)).result==="error")return a;var p=a.value.expression,x=$o(p);if(!x&&!Zo(u))return Ko([new Ct("","data expressions not supported")]);var C=Wa(p,["zoom"]);if(!C&&!xc(u))return Ko([new Ct("","zoom expressions not supported")]);var B=(function O(k){var G=null;if(k instanceof wa)G=O(k.result);else if(k instanceof xa)for(var J=0,Q=k.args;J<Q.length&&!(G=O(Q[J]));J+=1);else(k instanceof Vn||k instanceof zi)&&k.input instanceof Me&&k.input.name==="zoom"&&(G=k);return G instanceof Ct||k.eachChild((function(ie){var fe=O(ie);
2097fe instanceof Ct?G=fe:!G&&fe?G=new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):G&&fe&&G!==fe&&(G=new Ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),G})(p);return B||C?B instanceof Ct?Ko([B]):B instanceof zi&&!On(u)?Ko([new Ct("",'"interpolate" expressions cannot be used with this property')]):Af(B?new Rl(x?"camera":"composite",a.value,B.labels,B instanceof zi?B.interpolation:void 0):new Za(x?"constant":"source",a.value)):Ko([new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Rl.prototype.evaluateWithoutErrorHandling=function(a,u,p,x,C,B){return this._styleExpression.evaluateWithoutErrorHandling(a,u,p,x,C,B)},Rl.prototype.evaluate=function(a,u,p,x,C,B){return this._styleExpression.evaluate(a,u,p,x,C,B)},Rl.prototype.interpolationFactor=function(a,u,p){return this.interpolationType?zi.interpolationFactor(this.interpolationType,a,u,p):0};var Ya=function(a,u){this._parameters=a,this._specification=u,le(this,(function p(x,C){var B,O,k,G=C.type==="color",J=x.stops&&typeof x.stops[0][0]=="object",Q=J||!(J||x.property!==void 0),ie=x.type||(On(C)?"exponential":"interval");if(G&&((x=le({},x)).stops&&(x.stops=x.stops.map((function(nr){return[nr[0],tn.parse(nr[1])]}))),x.default=tn.parse(x.default?x.default:C.default)),x.colorSpace&&x.colorSpace!=="rgb"&&!pf[x.colorSpace])throw new Error("Unknown color space: "+x.colorSpace);if(ie==="exponential")B=Mh;else if(ie==="interval")B=Lp;else if(ie==="categorical"){B=Ph,O=Object.create(null);for(var fe=0,ye=x.stops;fe<ye.length;fe+=1){var ke=ye[fe];O[ke[0]]=ke[1]}k=typeof x.stops[0][0]}else{if(ie!=="identity")throw new Error('Unknown function type "'+ie+'"');B=ns}if(J){for(var Ne={},He=[],Ge=0;Ge<x.stops.length;Ge++){var Ke=x.stops[Ge],lt=Ke[0].zoom;Ne[lt]===void 0&&(Ne[lt]={zoom:lt,type:x.type,property:x.property,default:x.default,stops:[]},He.push(lt)),Ne[lt].stops.push([Ke[0].value,Ke[1]])}for(var mt=[],yt=0,Ot=He;yt<Ot.length;yt+=1){var Ht=Ot[yt];mt.push([Ne[Ht].zoom,p(Ne[Ht],C)])}var Kt={name:"linear"};return{kind:"composite",interpolationType:Kt,interpolationFactor:zi.interpolationFactor.bind(void 0,Kt),zoomStops:mt.map((function(nr){return nr[0]})),evaluate:function(nr,Sr){var ir=nr.zoom;return Mh({stops:mt,base:x.base},C,ir).evaluate(ir,Sr)}}}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 B(x,C,nr.zoom,O,k)}}}return{kind:"source",evaluate:function(nr,Sr){var ir=Sr&&Sr.properties?Sr.properties[x.property]:void 0;return ir===void 0?Ml(x.default,C.default):B(x,C,ir,O,k)}}})(this._parameters,this._specification))};function Vs(a){var u=a.key,p=a.value,x=a.valueSpec||{},C=a.objectElementValidators||{},B=a.style,O=a.styleSpec,k=[],G=Fn(p);if(G!=="object")return[new Se(u,p,"object expected, "+G+" found")];for(var J in p){var Q=J.split(".")[0],ie=x[Q]||x["*"],fe=void 0;if(C[Q])fe=C[Q];else if(x[Q])fe=fn;else if(C["*"])fe=C["*"];else{if(!x["*"]){k.push(new Se(u,p[J],'unknown property "'+J+'"'));continue}fe=fn}k=k.concat(fe({key:(u&&u+".")+J,value:p[J],valueSpec:ie,style:B,styleSpec:O,object:p,objectKey:J},p))}for(var ye in x)C[ye]||x[ye].required&&x[ye].default===void 0&&p[ye]===void 0&&k.push(new Se(u,p,'missing required property "'+ye+'"'));return k}function Qa(a){var u=a.value,p=a.valueSpec,x=a.style,C=a.styleSpec,B=a.key,O=a.arrayElementValidator||fn;if(Fn(u)!=="array")return[new Se(B,u,"array expected, "+Fn(u)+" found")];if(p.length&&u.length!==p.length)return[new Se(B,u,"array length "+p.length+" expected, length "+u.length+" found")];if(p["min-length"]&&u.length<p["min-length"])return[new Se(B,u,"array length at least "+p["min-length"]+" expected, length "+u.length+" found")];var k={type:p.value,values:p.values};C.$version<7&&(k.function=p.function),Fn(p.value)==="object"&&(k=p.value);for(var G=[],J=0;J<u.length;J++)G=G.concat(O({array:u,arrayIndex:J,value:u[J],valueSpec:k,style:x,styleSpec:C,key:B+"["+J+"]"}));return G}function Ol(a){var u=a.key,p=a.value,x=a.valueSpec,C=Fn(p);return C==="number"&&p!=p&&(C="NaN"),C!=="number"?[new Se(u,p,"number expected, "+C+" found")]:"minimum"in x&&p<x.minimum?[new Se(u,p,p+" is less than the minimum value "+
vendor: 5,089 bytes, line 2097
2097x.minimum)]:"maximum"in x&&p>x.maximum?[new Se(u,p,p+" is greater than the maximum value "+x.maximum)]:[]}function Dl(a){var u,p,x,C=a.valueSpec,B=xt(a.value.type),O={},k=B!=="categorical"&&a.value.property===void 0,G=!k,J=Fn(a.value.stops)==="array"&&Fn(a.value.stops[0])==="array"&&Fn(a.value.stops[0][0])==="object",Q=Vs({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(ye){if(B==="identity")return[new Se(ye.key,ye.value,'identity function may not have a "stops" property')];var ke=[],Ne=ye.value;return ke=ke.concat(Qa({key:ye.key,value:Ne,valueSpec:ye.valueSpec,style:ye.style,styleSpec:ye.styleSpec,arrayElementValidator:ie})),Fn(Ne)==="array"&&Ne.length===0&&ke.push(new Se(ye.key,Ne,"array must have at least one stop")),ke},default:function(ye){return fn({key:ye.key,value:ye.value,valueSpec:C,style:ye.style,styleSpec:ye.styleSpec})}}});return B==="identity"&&k&&Q.push(new Se(a.key,a.value,'missing required property "property"')),B==="identity"||a.value.stops||Q.push(new Se(a.key,a.value,'missing required property "stops"')),B==="exponential"&&a.valueSpec.expression&&!On(a.valueSpec)&&Q.push(new Se(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(G&&!Zo(a.valueSpec)?Q.push(new Se(a.key,a.value,"property functions not supported")):k&&!xc(a.valueSpec)&&Q.push(new Se(a.key,a.value,"zoom functions not supported"))),B!=="categorical"&&!J||a.value.property!==void 0||Q.push(new Se(a.key,a.value,'"property" property is required')),Q;function ie(ye){var ke=[],Ne=ye.value,He=ye.key;if(Fn(Ne)!=="array")return[new Se(He,Ne,"array expected, "+Fn(Ne)+" found")];if(Ne.length!==2)return[new Se(He,Ne,"array length 2 expected, length "+Ne.length+" found")];if(J){if(Fn(Ne[0])!=="object")return[new Se(He,Ne,"object expected, "+Fn(Ne[0])+" found")];if(Ne[0].zoom===void 0)return[new Se(He,Ne,"object stop key must have zoom")];if(Ne[0].value===void 0)return[new Se(He,Ne,"object stop key must have value")];if(x&&x>xt(Ne[0].zoom))return[new Se(He,Ne[0].zoom,"stop zoom values must appear in ascending order")];xt(Ne[0].zoom)!==x&&(x=xt(Ne[0].zoom),p=void 0,O={}),ke=ke.concat(Vs({key:He+"[0]",value:Ne[0],valueSpec:{zoom:{}},style:ye.style,styleSpec:ye.styleSpec,objectElementValidators:{zoom:Ol,value:fe}}))}else ke=ke.concat(fe({key:He+"[0]",value:Ne[0],style:ye.style,styleSpec:ye.styleSpec},Ne));return xo(Je(Ne[1]))?ke.concat([new Se(He+"[1]",Ne[1],"expressions are not allowed in function stops.")]):ke.concat(fn({key:He+"[1]",value:Ne[1],valueSpec:C,style:ye.style,styleSpec:ye.styleSpec}))}function fe(ye,ke){var Ne=Fn(ye.value),He=xt(ye.value),Ge=ye.value!==null?ye.value:ke;if(u){if(Ne!==u)return[new Se(ye.key,Ge,Ne+" stop domain type must match previous stop domain type "+u)]}else u=Ne;if(Ne!=="number"&&Ne!=="string"&&Ne!=="boolean")return[new Se(ye.key,Ge,"stop domain value must be a number, string, or boolean")];if(Ne!=="number"&&B!=="categorical"){var Ke="number expected, "+Ne+" found";return Zo(C)&&B===void 0&&(Ke+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Se(ye.key,Ge,Ke)]}return B!=="categorical"||Ne!=="number"||isFinite(He)&&Math.floor(He)===He?B!=="categorical"&&Ne==="number"&&p!==void 0&&He<p?[new Se(ye.key,Ge,"stop domain values must appear in ascending order")]:(p=He,B==="categorical"&&He in O?[new Se(ye.key,Ge,"stop domain values must be unique")]:(O[He]=!0,[])):[new Se(ye.key,Ge,"integer expected, found "+He)]}}function el(a){var u=(a.expressionContext==="property"?zs:fu)(Je(a.value),a.valueSpec);if(u.result==="error")return u.value.map((function(x){return new Se(""+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 Se(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"&&!va(p))return[new Se(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!va(p))return[new Se(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 Se(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!$o(p))return[new Se(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fl(a){var u=a.key,p=a.value,x=a.valueSpec,C=[];return Array.isArray(x.values)?x.values.indexOf(xt(p))===-1&&C.push(new Se(u,p,"expected one of ["+x.values.join(", ")+"], "+JSON.stringify(p)+" found")):Object.keys(x.values).indexOf(xt(p))===-1&&C.push(new Se(u,p,"expected one of ["+Object.keys(x.values).join(", ")+"], "+JSON.stringify(p)+" found")),C}
2097function hu(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(var u=0,p=a.slice(1);u<p.length;u+=1){var x=p[u];if(!hu(x)&&typeof x!="boolean")return!1}return!0;default:return!0}}Ya.deserialize=function(a){return new Ya(a._parameters,a._specification)},Ya.serialize=function(a){return{_parameters:a._parameters,_specification:a._specification}};var wc={type:"boolean",default:!1};function du(a){if(a==null)return{filter:function(){return!0},needGeometry:!1};hu(a)||(a=Tc(a));var u=fu(a,wc);if(u.result==="error")throw new Error(u.value.map((function(p){return p.key+": "+p.message})).join(", "));return{filter:function(p,x,C){return u.value.evaluate(p,x,{},C)},needGeometry:(function p(x){if(!Array.isArray(x))return!1;if(x[0]==="within")return!0;for(var C=1;C<x.length;C++)if(p(x[C]))return!0;return!1})(a)}}function kp(a,u){return a<u?-1:a>u?1:0}function Tc(a){if(!a)return!0;var u,p=a[0];return a.length<=1?p!=="any":p==="=="?pu(a[1],a[2],"=="):p==="!="?Au(pu(a[1],a[2],"==")):p==="<"||p===">"||p==="<="||p===">="?pu(a[1],a[2],p):p==="any"?(u=a.slice(1),["any"].concat(u.map(Tc))):p==="all"?["all"].concat(a.slice(1).map(Tc)):p==="none"?["all"].concat(a.slice(1).map(Tc).map(Au)):p==="in"?Ll(a[1],a.slice(2)):p==="!in"?Au(Ll(a[1],a.slice(2))):p==="has"?tl(a[1]):p==="!has"?Au(tl(a[1])):p!=="within"||a}function pu(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 Ll(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(kp)]]:["filter-in-small",a,["literal",u]]}}function tl(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function Au(a){return["!",a]}function rl(a){return hu(Je(a.value))?el(le({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):(function u(p){var x=p.value,C=p.key;if(Fn(x)!=="array")return[new Se(C,x,"array expected, "+Fn(x)+" found")];var B,O=p.styleSpec,k=[];if(x.length<1)return[new Se(C,x,"filter array must have at least 1 element")];switch(k=k.concat(Fl({key:C+"[0]",value:x[0],valueSpec:O.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 Se(C,x,'"$type" cannot be use with operator "'+x[0]+'"'));case"==":case"!=":x.length!==3&&k.push(new Se(C,x,'filter array for operator "'+x[0]+'" must have 3 elements'));case"in":case"!in":x.length>=2&&(B=Fn(x[1]))!=="string"&&k.push(new Se(C+"[1]",x[1],"string expected, "+B+" found"));for(var G=2;G<x.length;G++)B=Fn(x[G]),xt(x[1])==="$type"?k=k.concat(Fl({key:C+"["+G+"]",value:x[G],valueSpec:O.geometry_type,style:p.style,styleSpec:p.styleSpec})):B!=="string"&&B!=="number"&&B!=="boolean"&&k.push(new Se(C+"["+G+"]",x[G],"string, number, or boolean expected, "+B+" found"));break;case"any":case"all":case"none":for(var J=1;J<x.length;J++)k=k.concat(u({key:C+"["+J+"]",value:x[J],style:p.style,styleSpec:p.styleSpec}));break;case"has":case"!has":B=Fn(x[1]),x.length!==2?k.push(new Se(C,x,'filter array for "'+x[0]+'" operator must have 2 elements')):B!=="string"&&k.push(new Se(C+"[1]",x[1],"string expected, "+B+" found"));break;case"within":B=Fn(x[1]),x.length!==2?k.push(new Se(C,x,'filter array for "'+x[0]+'" operator must have 2 elements')):B!=="object"&&k.push(new Se(C+"[1]",x[1],"object expected, "+B+" found"))}return k})(a)}function gf(a,u){var p=a.key,x=a.style,C=a.styleSpec,B=a.value,O=a.objectKey,k=C[u+"_"+a.layerType];if(!k)return[];var G=O.match(/^(.*)-transition$/);
2097if(u==="paint"&&G&&k[G[1]]&&k[G[1]].transition)return fn({key:p,value:B,valueSpec:C.transition,style:x,styleSpec:C});var J,Q=a.valueSpec||k[O];if(!Q)return[new Se(p,B,'unknown property "'+O+'"')];if(Fn(B)==="string"&&Zo(Q)&&!Q.tokens&&(J=/^{([^}]+)}$/.exec(B)))return[new Se(p,B,'"'+O+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(J[1])+" }`.")];var ie=[];return a.layerType==="symbol"&&(O==="text-field"&&x&&!x.glyphs&&ie.push(new Se(p,B,'use of "text-field" requires a style "glyphs" property')),O==="text-font"&&uu(Je(B))&&xt(B.type)==="identity"&&ie.push(new Se(p,B,'"text-font" does not support identity functions'))),ie.concat(fn({key:a.key,value:B,valueSpec:Q,style:x,styleSpec:C,expressionContext:"property",propertyType:u,propertyKey:O}))}function mf(a){return gf(a,"paint")}function Ec(a){return gf(a,"layout")}function Rh(a){var u=[],p=a.value,x=a.key,C=a.style,B=a.styleSpec;p.type||p.ref||u.push(new Se(x,p,'either "type" or "ref" is required'));var O,k=xt(p.type),G=xt(p.ref);if(p.id)for(var J=xt(p.id),Q=0;Q<a.arrayIndex;Q++){var ie=C.layers[Q];xt(ie.id)===J&&u.push(new Se(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 Se(x,p[ke],'"'+ke+'" is prohibited for ref layers'))})),C.layers.forEach((function(ke){xt(ke.id)===G&&(O=ke)})),O?O.ref?u.push(new Se(x,p.ref,"ref cannot reference another ref layer")):k=xt(O.type):u.push(new Se(x,p.ref,'ref layer "'+G+'" not found'));else if(k!=="background")if(p.source){var fe=C.sources&&C.sources[p.source],ye=fe&&xt(fe.type);fe?ye==="vector"&&k==="raster"?u.push(new Se(x,p.source,'layer "'+p.id+'" requires a raster source')):ye==="raster"&&k!=="raster"?u.push(new Se(x,p.source,'layer "'+p.id+'" requires a vector source')):ye!=="vector"||p["source-layer"]?ye==="raster-dem"&&k!=="hillshade"?u.push(new Se(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 Se(x,p,'layer "'+p.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):u.push(new Se(x,p,'layer "'+p.id+'" must specify a "source-layer"')):u.push(new Se(x,p.source,'source "'+p.source+'" not found'))}else u.push(new Se(x,p,'missing required property "source"'));return u=u.concat(Vs({key:x,value:p,valueSpec:B.layer,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return fn({key:x+".type",value:p.type,valueSpec:B.layer.type,style:a.style,styleSpec:a.styleSpec,object:p,objectKey:"type"})},filter:rl,layout:function(ke){return Vs({layer:p,key:ke.key,value:ke.value,style:ke.style,styleSpec:ke.styleSpec,objectElementValidators:{"*":function(Ne){return Ec(le({layerType:k},Ne))}}})},paint:function(ke){return Vs({layer:p,key:ke.key,value:ke.value,style:ke.style,styleSpec:ke.styleSpec,objectElementValidators:{"*":function(Ne){return mf(le({layerType:k},Ne))}}})}}}))}function nl(a){var u=a.value,p=a.key,x=Fn(u);return x!=="string"?[new Se(p,u,"string expected, "+x+" found")]:[]}var Xn={promoteId:function(a){var u=a.key,p=a.value;if(Fn(p)==="string")return nl({key:u,value:p});var x=[];for(var C in p)x.push.apply(x,nl({key:u+"."+C,value:p[C]}));return x}};function gu(a){var u=a.value,p=a.key,x=a.styleSpec,C=a.style;if(!u.type)return[new Se(p,u,'"type" is required')];var B,O=xt(u.type);switch(O){case"vector":case"raster":case"raster-dem":return Vs({key:p,value:u,valueSpec:x["source_"+O.replace("-","_")],style:a.style,styleSpec:x,objectElementValidators:Xn});case"geojson":if(B=Vs({key:p,value:u,valueSpec:x.source_geojson,style:C,styleSpec:x,objectElementValidators:Xn}),u.cluster)for(var k in u.clusterProperties){var G=u.clusterProperties[k],J=G[0],Q=typeof J=="string"?[J,["accumulated"],["get",k]]:J;B.push.apply(B,el({key:p+"."+k+".map",value:G[1],expressionContext:"cluster-map"})),B.push.apply(B,el({key:p+"."+k+".reduce",value:Q,expressionContext:"cluster-reduce"}))}return B;case"video":return Vs({key:p,value:u,valueSpec:x.source_video,style:C,styleSpec:x});case"image":return Vs({key:p,value:u,valueSpec:x.source_image,style:C,styleSpec:x});case"canvas":return[new Se(p,null,"Please use runtime APIs to add canvas sources, rather than
2097including them in stylesheets.","source.canvas")];default:return Fl({key:p+".type",value:u.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Yo(a){var u=a.value,p=a.styleSpec,x=p.light,C=a.style,B=[],O=Fn(u);if(u===void 0)return B;if(O!=="object")return B.concat([new Se("light",u,"object expected, "+O+" found")]);for(var k in u){var G=k.match(/^(.*)-transition$/);B=B.concat(G&&x[G[1]]&&x[G[1]].transition?fn({key:k,value:u[k],valueSpec:p.transition,style:C,styleSpec:p}):x[k]?fn({key:k,value:u[k],valueSpec:x[k],style:C,styleSpec:p}):[new Se(k,u[k],'unknown property "'+k+'"')])}return B}var Qo={"*":function(){return[]},array:Qa,boolean:function(a){var u=a.value,p=a.key,x=Fn(u);return x!=="boolean"?[new Se(p,u,"boolean expected, "+x+" found")]:[]},number:Ol,color:function(a){var u=a.key,p=a.value,x=Fn(p);return x!=="string"?[new Se(u,p,"color expected, "+x+" found")]:qt(p)===null?[new Se(u,p,'color expected, "'+p+'" found')]:[]},constants:g,enum:Fl,filter:rl,function:Dl,layer:Rh,object:Vs,source:gu,light:Yo,string:nl,formatted:function(a){return nl(a).length===0?[]:el(a)},resolvedImage:function(a){return nl(a).length===0?[]:el(a)}};function fn(a){var u=a.value,p=a.valueSpec,x=a.styleSpec;return p.expression&&uu(xt(u))?Dl(a):p.expression&&xo(Je(u))?el(a):p.type&&Qo[p.type]?Qo[p.type](a):Vs(le({},a,{valueSpec:p.type?x[p.type]:p}))}function Ln(a){var u=a.value,p=a.key,x=nl(a);return x.length||(u.indexOf("{fontstack}")===-1&&x.push(new Se(p,u,'"glyphs" url must include a "{fontstack}" token')),u.indexOf("{range}")===-1&&x.push(new Se(p,u,'"glyphs" url must include a "{range}" token'))),x}function Gs(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}))),Cc(p)}function Cc(a){return[].concat(a).sort((function(u,p){return u.line-p.line}))}function kl(a){return function(){for(var u=[],p=arguments.length;p--;)u[p]=arguments[p];return Cc(a.apply(this,u))}}Gs.source=kl(gu),Gs.light=kl(Yo),Gs.layer=kl(Rh),Gs.filter=kl(rl),Gs.paintProperty=kl(mf),Gs.layoutProperty=kl(Ec);var Sc=Gs,Np=Sc.light,Up=Sc.paintProperty,Nl=Sc.layoutProperty;function Ic(a,u){var p=!1;if(u&&u.length)for(var x=0,C=u;x<C.length;x+=1)a.fire(new he(new Error(C[x].message))),p=!0;return p}var Ro=kn;function kn(a,u,p){var x=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;var C=new Int32Array(this.arrayBuffer);a=C[0],this.d=(u=C[1])+2*(p=C[2]);for(var B=0;B<this.d*this.d;B++){var O=C[3+B],k=C[3+B+1];x.push(O===k?null:C.subarray(O,k))}var G=C[3+x.length+1];this.keys=C.subarray(C[3+x.length],G),this.bboxes=C.subarray(G),this.insert=this._insertReadonly}else{this.d=u+2*p;for(var J=0;J<this.d*this.d;J++)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,C){this._forEachCell(u,p,x,C,this._insertCell,this.uid++),this.keys.push(a),this.bboxes.push(u),this.bboxes.push(p),this.bboxes.push(x),this.bboxes.push(C)},kn.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},kn.prototype._insertCell=function(a,u,p,x,C,B){this.cells[C].push(B)},kn.prototype.query=function(a,u,p,x,C){var B=this.min,O=this.max;if(a<=B&&u<=B&&O<=p&&O<=x&&!C)return Array.prototype.slice.call(this.keys);var k=[];return this._forEachCell(a,u,p,x,this._queryCell,k,{},C),k},kn.prototype._queryCell=function(a,u,p,x,C,B,O,k){var G=this.cells[C];if(G!==null)for(var J=this.keys,Q=this.bboxes,ie=0;ie<G.length;ie++){var fe=G[ie];if(O[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])?(O[fe]=!0,B.push(J[fe])):O[fe]=!1}}},kn.prototype._forEachCell=function(a,u,p,x,C,B,O,k){for(var G=this._convertToCellCoord(a),J=this._convertToCellCoord(u),Q=this._convertToCellCoord(p),ie=this._convertToCellCoord(x),fe=G;fe<=Q;fe++)for(var ye=J;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)))&&C.call(this,a,u,p,x,ke,B,O,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 C=new Int32Array(u+p+this.keys.length+this.bboxes.length);C[0]=this.extent,C[1]=this.n,C[2]=this.padding;
2097for(var B=u,O=0;O<a.length;O++){var k=a[O];C[3+O]=B,C.set(k,B),B+=k.length}return C[3+a.length]=B,C.set(this.keys,B),C[3+a.length+1]=B+=this.keys.length,C.set(this.bboxes,B),B+=this.bboxes.length,C.buffer};var Ul=I.ImageData,Oh=I.ImageBitmap,xi={};function or(a,u,p){p===void 0&&(p={}),Object.defineProperty(u,"_classRegistryKey",{value:a,writeable:!1}),xi[a]={klass:u,omit:p.omit||[],shallow:p.shallow||[]}}for(var Is in or("Object",Object),Ro.serialize=function(a,u){var p=a.toArrayBuffer();return u&&u.push(p),{buffer:p}},Ro.deserialize=function(a){return new Ro(a.buffer)},or("Grid",Ro),or("Color",tn),or("Error",Error),or("ResolvedImage",Wn),or("StylePropertyFunction",Ya),or("StyleExpression",Sa,{omit:["_evaluator"]}),or("ZoomDependentExpression",Rl),or("ZoomConstantExpression",Za),or("CompoundExpression",Me,{omit:["_evaluate"]}),to)to[Is]._classRegistryKey||or("Expression_"+Is,to[Is]);function mu(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}function js(a){return Oh&&a instanceof Oh}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(mu(a)||js(a))return u&&u.push(a),a;if(ArrayBuffer.isView(a)){var p=a;return u&&u.push(p.buffer),p}if(a instanceof Ul)return u&&u.push(a.data.buffer),a;if(Array.isArray(a)){for(var x=[],C=0,B=a;C<B.length;C+=1)x.push(ro(B[C],u));return x}if(typeof a=="object"){var O=a.constructor,k=O._classRegistryKey;if(!k)throw new Error("can't serialize object of unregistered class");var G=O.serialize?O.serialize(a,u):{};if(!O.serialize){for(var J in a)if(a.hasOwnProperty(J)&&!(xi[k].omit.indexOf(J)>=0)){var Q=a[J];G[J]=xi[k].shallow.indexOf(J)>=0?Q:ro(Q,u)}a instanceof Error&&(G.message=a.message)}if(G.$name)throw new Error("$name property is reserved for worker serialization logic.");return k!=="Object"&&(G.$name=k),G}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||mu(a)||js(a)||ArrayBuffer.isView(a)||a instanceof Ul)return a;
2097if(Array.isArray(a))return a.map(_s);if(typeof a=="object"){var u=a.$name||"Object",p=xi[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),C=0,B=Object.keys(a);C<B.length;C+=1){var O=B[C];if(O!=="$name"){var k=a[O];x[O]=xi[u].shallow.indexOf(O)>=0?k:_s(k)}}return x}throw new Error("can't deserialize object of type "+typeof a)}var _f=function(){this.first=!0};_f.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 Zt={"Latin-1 Supplement":function(a){return a>=128&&a<=255},Arabic:function(a){return a>=1536&&a<=1791},"Arabic Supplement":function(a){return a>=1872&&a<=1919},"Arabic Extended-A":function(a){return a>=2208&&a<=2303},"Hangul Jamo":function(a){return a>=4352&&a<=4607},"Unified Canadian Aboriginal Syllabics":function(a){return a>=5120&&a<=5759},Khmer:function(a){return a>=6016&&a<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(a){return a>=6320&&a<=6399},"General Punctuation":function(a){return a>=8192&&a<=8303},"Letterlike Symbols":function(a){return a>=8448&&a<=8527},"Number Forms":function(a){return a>=8528&&a<=8591},"Miscellaneous Technical":function(a){return a>=8960&&a<=9215},"Control Pictures":function(a){return a>=9216&&a<=9279},"Optical Character Recognition":function(a){return a>=9280&&a<=9311},"Enclosed Alphanumerics":function(a){return a>=9312&&a<=9471},"Geometric Shapes":function(a){return a>=9632&&a<=9727},"Miscellaneous Symbols":function(a){return a>=9728&&a<=9983},"Miscellaneous Symbols and Arrows":function(a){return a>=11008&&a<=11263},"CJK Radicals Supplement":function(a){return a>=11904&&a<=12031},"Kangxi Radicals":function(a){return a>=12032&&a<=12255},"Ideographic Description Characters":function(a){return a>=12272&&a<=12287},"CJK Symbols and Punctuation":function(a){return a>=12288&&a<=12351},Hiragana:function(a){return a>=12352&&a<=12447},Katakana:function(a){return a>=12448&&a<=12543},Bopomofo:function(a){return a>=12544&&a<=12591},"Hangul Compatibility Jamo":function(a){return a>=12592&&a<=12687},Kanbun:function(a){return a>=12688&&a<=12703},"Bopomofo Extended":function(a){return a>=12704&&a<=12735},"CJK Strokes":function(a){return a>=12736&&a<=12783},"Katakana Phonetic Extensions":function(a){return a>=12784&&a<=12799},"Enclosed CJK Letters and Months":function(a){return a>=12800&&a<=13055},"CJK Compatibility":function(a){return a>=13056&&a<=13311},"CJK Unified Ideographs Extension A":function(a){return a>=13312&&a<=19903},"Yijing Hexagram Symbols":function(a){return a>=19904&&a<=19967},"CJK Unified Ideographs":function(a){return a>=19968&&a<=40959},"Yi Syllables":function(a){return a>=40960&&a<=42127},"Yi Radicals":function(a){return a>=42128&&a<=42191},"Hangul Jamo Extended-A":function(a){return a>=43360&&a<=43391},"Hangul Syllables":function(a){return a>=44032&&a<=55215},"Hangul Jamo Extended-B":function(a){return a>=55216&&a<=55295},"Private Use Area":function(a){return a>=57344&&a<=63743},"CJK Compatibility Ideographs":function(a){return a>=63744&&a<=64255},"Arabic Presentation Forms-A":function(a){return a>=64336&&a<=65023},"Vertical Forms":function(a){return a>=65040&&a<=65055},"CJK Compatibility Forms":function(a){return a>=65072&&a<=65103},"Small Form Variants":function(a){return a>=65104&&a<=65135},"Arabic Presentation Forms-B":function(a){return a>=65136&&a<=65279},"Halfwidth and Fullwidth Forms":function(a){return a>=65280&&a<=65519}};function yf(a){for(var u=0,p=a;u<p.length;u+=1)if(_u(p[u].charCodeAt(0)))return!0;return!1}function _u(a){return!(a!==746&&a!==747&&(a<4352||!(Zt["Bopomofo Extended"](a)||Zt.Bopomofo(a)||Zt["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||Zt["CJK Compatibility Ideographs"](a)||Zt["CJK Compatibility"](a)||Zt["CJK Radicals Supplement"](a)||Zt["CJK Strokes"](a)||!(!Zt["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>
2097=12308&&a<=12319||a===12336)||Zt["CJK Unified Ideographs Extension A"](a)||Zt["CJK Unified Ideographs"](a)||Zt["Enclosed CJK Letters and Months"](a)||Zt["Hangul Compatibility Jamo"](a)||Zt["Hangul Jamo Extended-A"](a)||Zt["Hangul Jamo Extended-B"](a)||Zt["Hangul Jamo"](a)||Zt["Hangul Syllables"](a)||Zt.Hiragana(a)||Zt["Ideographic Description Characters"](a)||Zt.Kanbun(a)||Zt["Kangxi Radicals"](a)||Zt["Katakana Phonetic Extensions"](a)||Zt.Katakana(a)&&a!==12540||!(!Zt["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)||!(!Zt["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||Zt["Unified Canadian Aboriginal Syllabics"](a)||Zt["Unified Canadian Aboriginal Syllabics Extended"](a)||Zt["Vertical Forms"](a)||Zt["Yijing Hexagram Symbols"](a)||Zt["Yi Syllables"](a)||Zt["Yi Radicals"](a))))}function vf(a){return!(_u(a)||(function(u){return!!(Zt["Latin-1 Supplement"](u)&&(u===167||u===169||u===174||u===177||u===188||u===189||u===190||u===215||u===247)||Zt["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)||Zt["Letterlike Symbols"](u)||Zt["Number Forms"](u)||Zt["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)||Zt["Control Pictures"](u)&&u!==9251||Zt["Optical Character Recognition"](u)||Zt["Enclosed Alphanumerics"](u)||Zt["Geometric Shapes"](u)||Zt["Miscellaneous Symbols"](u)&&!(u>=9754&&u<=9759)||Zt["Miscellaneous Symbols and Arrows"](u)&&(u>=11026&&u<=11055||u>=11088&&u<=11097||u>=11192&&u<=11243)||Zt["CJK Symbols and Punctuation"](u)||Zt.Katakana(u)||Zt["Private Use Area"](u)||Zt["CJK Compatibility Forms"](u)||Zt["Small Form Variants"](u)||Zt["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||Zt["Arabic Presentation Forms-A"](a)||Zt["Arabic Presentation Forms-B"](a)}function Bs(a,u){return!(!u&&no(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||Zt.Khmer(a))}function yu(a){for(var u=0,p=a;u<p.length;u+=1)if(no(p[u].charCodeAt(0)))return!0;return!1}var vu=null,Ps="unavailable",ea=null,bf=function(a){a&&typeof a=="string"&&a.indexOf("NetworkError")>-1&&(Ps="error"),vu&&vu(a)};function zl(){wi.fire(new Fe("pluginStateChange",{pluginStatus:Ps,pluginURL:ea}))}var wi=new be,xf=function(){return Ps},wo=function(){if(Ps!=="deferred"||!ea)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ps="loading",zl(),ea&&Xe({url:ea},(function(a){a?bf(a):(Ps="loaded",zl())}))},is={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Ps==="loaded"||is.applyArabicShaping!=null},isLoading:function(){return Ps==="loading"},setState:function(a){Ps=a.pluginStatus,ea=a.pluginURL},isParsed:function(){return is.applyArabicShaping!=null&&is.processBidirectionalText!=null&&is.processStyledBidirectionalText!=null},getPluginURL:function(){return ea}},jr=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 _f,this.transition={})};jr.prototype.isSupportedScript=function(a){return(function(u,p){for(var x=0,C=u;x<C.length;x+=1)if(!Bs(C[x].charCodeAt(0),p))return!1;return!0})(a,is.isLoaded())},jr.prototype.crossFadingFactor=function(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},jr.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 Oo=function(a,u){this.property=a,this.value=u,this.expression=(function(p,x){if(uu(p))return new Ya(p,x);if(xo(p)){var C=zs(p,x);if(C.result==="error")throw new Error(C.value.map((function(O){return O.key+": "+O.message})).join(", "));return C.value}var B=p;return typeof p=="string"&&x.type==="color"&&(B=tn.parse(p)),{kind:"constant",evaluate:function(){return B}}})(u===void 0?a.specification.default:u,a.specification)};Oo.prototype.isDataDriven=function(){return this.expression.kind==="source"||this.expression.kind==="composite"},Oo.prototype.possiblyEvaluate=function(a,u,p){return this.property.possiblyEvaluate(this,a,u,p)};var io=function(a){this.property=a,this.value=new Oo(a,void 0)};io.prototype.transitioned=function(a,u){return new Ia(this.property,this.value,u,j({},a.transition,this.transition),a.now)},io.prototype.untransitioned=function(){return new Ia(this.property,this.value,
2097null,{},0)};var qi=function(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)};qi.prototype.getValue=function(a){return pe(this._values[a].value.value)},qi.prototype.setValue=function(a,u){this._values.hasOwnProperty(a)||(this._values[a]=new io(this._values[a].property)),this._values[a].value=new Oo(this._values[a].property,u===null?void 0:pe(u))},qi.prototype.getTransition=function(a){return pe(this._values[a].transition)},qi.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},qi.prototype.serialize=function(){for(var a={},u=0,p=Object.keys(this._values);u<p.length;u+=1){var x=p[u],C=this.getValue(x);C!==void 0&&(a[x]=C);var B=this.getTransition(x);B!==void 0&&(a[x+"-transition"]=B)}return a},qi.prototype.transitioned=function(a,u){for(var p=new ta(this._properties),x=0,C=Object.keys(this._values);x<C.length;x+=1){var B=C[x];p._values[B]=this._values[B].transitioned(a,u._values[B])}return p},qi.prototype.untransitioned=function(){for(var a=new ta(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,C){this.property=a,this.value=u,this.begin=C+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,C=this.value.possiblyEvaluate(a,u,p),B=this.prior;if(B){if(x>this.end)return this.prior=null,C;if(this.value.isDataDriven())return this.prior=null,C;if(x<this.begin)return B.possiblyEvaluate(a,u,p);var O=(x-this.begin)/(this.end-this.begin);return this.property.interpolate(B.possiblyEvaluate(a,u,p),C,(function(k){if(k<=0)return 0;if(k>=1)return 1;var G=k*k,J=G*k;return 4*(k<.5?J:3*(k-G)+J-.75)})(O))}return C};var ta=function(a){this._properties=a,this._values=Object.create(a.defaultTransitioningPropertyValues)};ta.prototype.possiblyEvaluate=function(a,u,p){for(var x=new Bc(this._properties),C=0,B=Object.keys(this._values);C<B.length;C+=1){var O=B[C];x._values[O]=this._values[O].possiblyEvaluate(a,u,p)}return x},ta.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 Oo(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],C=this.getValue(x);C!==void 0&&(a[x]=C)}return a},so.prototype.possiblyEvaluate=function(a,u,p){for(var x=new Bc(this._properties),C=0,B=Object.keys(this._values);C<B.length;C+=1){var O=B[C];x._values[O]=this._values[O].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 Bc=function(a){this._properties=a,this._values=Object.create(a.defaultPossiblyEvaluatedValues)};Bc.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=$a[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;
2097if(a.value.value===void 0||u.value.value===void 0)return new ss(this,{kind:"constant",value:void 0},a.parameters);var x=$a[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,C,B){return a.kind==="constant"?a.value:a.evaluate(u,p,x,C,B)};var bu=(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,C,B){if(p.value===void 0)return new ss(this,{kind:"constant",value:void 0},x);if(p.expression.kind==="constant"){var O=p.expression.evaluate(x,null,{},C,B),k=p.property.specification.type==="resolvedImage"&&typeof O!="string"?O.name:O,G=this._calculate(k,k,k,x);return new ss(this,{kind:"constant",value:G},x)}if(p.expression.kind==="camera"){var J=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:J},x)}return new ss(this,p.expression,x)},u.prototype.evaluate=function(p,x,C,B,O,k){if(p.kind==="source"){var G=p.evaluate(x,C,B,O,k);return this._calculate(G,G,G,x)}return p.kind==="composite"?this._calculate(p.evaluate({zoom:Math.floor(x.zoom)-1},C,B),p.evaluate({zoom:Math.floor(x.zoom)},C,B),p.evaluate({zoom:Math.floor(x.zoom)+1},C,B),x):p.value},u.prototype._calculate=function(p,x,C,B){return B.zoom>B.zoomHistory.lastIntegerZoom?{from:p,to:x}:{from:C,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 C=a.expression.evaluate(u,null,{},p,x);return this._calculate(C,C,C,u)}return this._calculate(a.expression.evaluate(new jr(Math.floor(u.zoom-1),u)),a.expression.evaluate(new jr(Math.floor(u.zoom),u)),a.expression.evaluate(new jr(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 Ji=function(a){this.specification=a};Ji.prototype.possiblyEvaluate=function(a,u,p,x){return!!a.expression.evaluate(u,null,{},p,x)},Ji.prototype.interpolate=function(){return!1};var qn=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 Oo(p,void 0),C=this.defaultTransitionablePropertyValues[u]=new io(p);this.defaultTransitioningPropertyValues[u]=C.untransitioned(),this.defaultPossiblyEvaluatedValues[u]=x.possiblyEvaluate({})}};or("DataDrivenProperty",ur),or("DataConstantProperty",wr),or("CrossFadedDataDrivenProperty",bu),or("CrossFadedProperty",fs),or("ColorRampProperty",Ji);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 C in this._transitionablePaint=new qi(x.paint),p.paint)this.setPaintProperty(C,p.paint[C],{validate:!1});for(var B in p.layout)this.setLayoutProperty(B,p.layout[B],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Bc(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,C){C===void 0&&(C={}),x!=null&&this._validate(Nl,"layers."+this.id+".layout."+p,p,x,C)||(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,C){if(C===void 0&&(C={}
2097),x!=null&&this._validate(Up,"layers."+this.id+".paint."+p,p,x,C))return!1;if(Ue(p,"-transition"))return this._transitionablePaint.setTransition(p.slice(0,-11),x||void 0),!1;var B=this._transitionablePaint._values[p],O=B.property.specification["property-type"]==="cross-faded-data-driven",k=B.value.isDataDriven(),G=B.value;this._transitionablePaint.setValue(p,x),this._handleSpecialPaintPropertyUpdate(p);var J=this._transitionablePaint._values[p].value;return J.isDataDriven()||k||O||this._handleOverridablePaintPropertyUpdate(p,G,J)},u.prototype._handleSpecialPaintPropertyUpdate=function(p){},u.prototype._handleOverridablePaintPropertyUpdate=function(p,x,C){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)}
2097,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,C){return!(x===void 0||C==="layout"&&!Object.keys(x).length||C==="paint"&&!Object.keys(x).length)}))},u.prototype._validate=function(p,x,C,B,O){return O===void 0&&(O={}),(!O||O.validate!==!1)&&Ic(this,p.call(Sc,{key:x,layerType:this.type,objectKey:C,value:B,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},Jr=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(C){var B=oo[C.type].BYTES_PER_ELEMENT,O=p=xu(p,Math.max(u,B)),k=C.components||1;return x=Math.max(x,B),p+=B*k,{name:C.name,type:C.type,components:k,offset:O}})),size:xu(p,Math.max(x,u)),alignment:u}}function xu(a,u){return Math.ceil(a/u)*u}Jr.serialize=function(a,u){return a._trim(),u&&(a.isTransferred=!0,u.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}},Jr.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},Jr.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Jr.prototype.clear=function(){this.length=0},Jr.prototype.resize=function(a){this.reserve(a),this.length=a},Jr.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)}},Jr.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Hs=(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 C=this.length;return this.resize(C+1),this.emplace(C,p,x)},u.prototype.emplace=function(p,x,C){var B=2*p;return this.int16[B+0]=x,this.int16[B+1]=C,p},u})(Jr);Hs.prototype.bytesPerElement=4,or("StructArrayLayout2i4",Hs);var wf=(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,C,B){var O=this.length;return this.resize(O+1),this.emplace(O,p,x,C,B)},u.prototype.emplace=function(p,x,C,B,O){var k=4*p;return this.int16[k+0]=x,this.int16[k+1]=C,this.int16[k+2]=B,this.int16[k+3]=O,p},u})(Jr);wf.prototype.bytesPerElement=8,or("StructArrayLayout4i8",wf);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,C,B,O,k){var G=this.length;return this.resize(G+1),this.emplace(G,p,x,C,B,O,k)},u.prototype.emplace=function(p,x,C,B,O,k,G){var J=6*p;return this.int16[J+0]=x,this.int16[J+1]=C,this.int16[J+2]=B,this.int16[J+3]=O,this.int16[J+4]=k,this.int16[J+5]=G,p},u})(Jr);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,C,B,O,k){var G=this.length;return this.resize(G+1),this.emplace(G,p,x,C,B,O,k)},u.prototype.emplace=function(p,x,C,B,O,k,G){var J=4*p,Q=8*p;return this.int16[J+0]=x,this.int16[J+1]=C,this.uint8[Q+4]=B,this.uint8[Q+5]=O,this.uint8[Q+6]=k,this.uint8[Q+7]=G,p},u})(Jr);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 C=this.length;return this.resize(C+1),this.emplace(C,p,x)},u.prototype.emplace=function(p,x,C){var B=2*p;return this.float32[B+0]=x,this.float32[B+1]=C,p},u})(Jr);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,C,B,O,k,G,J,Q,ie){var fe=this.length;return this.resize(fe+1),this.emplace(fe,p,x,C,B,O,k,G,J,Q,ie)},u.prototype.emplace=function(p,x,C,B,O,k,G,J,Q,ie,fe){var ye=10*p;return this.uint16[ye+0]=x,this.uint16[ye+1]=C,this.uint16[ye+2]=B,this.uint16[ye+3]=O,this.uint16[ye+4]=k,this.uint16[ye+5]=G,this.uint16[ye+6]=J,this.uint16[ye+7]=Q,this.uint16[ye+8]=ie,this.uint16[ye+9]=fe,p},u})(Jr);Eo.prototype.bytesPerElement=20,or("StructArrayLayout10ui20",Eo);var Xt=(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,C,B,O,k,G,J,Q,ie,fe,ye){var ke=this.length;return this.resize(ke+1),this.emplace(ke,p,x,C,B,O,k,G,J,Q,ie,fe,ye)},u.prototype.emplace=function(p,x,C,B,O,k,G,J,Q,ie,fe,ye,ke){var Ne=12*p;return this.int16[Ne+0]=x,this.int16[Ne+1]=C,this.int16[Ne+2]=B,this.int16[Ne+3]=O,this.uint16[Ne+4]=k,this.uint16[Ne+5]=G,this.uint16[Ne+6]=J,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})(Jr);Xt.prototype.bytesPerElement=24,or("StructArrayLayout4i4ui4i24",Xt);var rr=(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,C){var B=this.length;return this.resize(B+1),this.emplace(B,p,x,C)},u.prototype.emplace=function(p,x,C,B){var O=3*p;return this.float32[O+0]=x,this.float32[O+1]=C,this.float32[O+2]=B,p},u})(Jr);rr.prototype.bytesPerElement=12,or("StructArrayLayout3f12",rr);var Vl=(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})(Jr);Vl.prototype.bytesPerElement=4,or("StructArrayLayout1ul4",Vl);var Pc=(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,C,B,O,k,G,J,Q){var ie=this.length;return this.resize(ie+1),this.emplace(ie,p,x,C,B,O,k,G,J,Q)},u.prototype.emplace=function(p,x,C,B,O,k,G,J,Q,ie){var fe=10*p,ye=5*p;return this.int16[fe+0]=x,this.int16[fe+1]=C,this.int16[fe+2]=B,this.int16[fe+3]=O,this.int16[fe+4]=k,this.int16[fe+5]=G,this.uint32[ye+3]=J,this.uint16[fe+8]=Q,this.uint16[fe+9]=ie,p},u})(Jr);Pc.prototype.bytesPerElement=20,or("StructArrayLayout6i1ul2ui20",Pc);var ra=(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,C,B,O,k){var G=this.length;return this.resize(G+1),this.emplace(G,p,x,C,B,O,k)},u.prototype.emplace=function(p,x,C,B,O,k,G){var J=6*p;return this.int16[J+0]=x,this.int16[J+1]=C,this.int16[J+2]=B,this.int16[J+3]=O,this.int16[J+4]=k,this.int16[J+5]=G,p},u})(Jr);ra.prototype.bytesPerElement=12,or("StructArrayLayout2i2i2i12",ra);var Do=(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,C,B,O){var k=this.length;return this.resize(k+1),this.emplace(k,p,x,C,B,O)},u.prototype.emplace=function(p,x,C,B,O,k){var G=4*p,J=8*p;return this.float32[G+0]=x,this.float32[G+1]=C,this.float32[G+2]=B,this.int16[J+6]=O,this.int16[J+7]=k,p},u})(Jr);Do.prototype.bytesPerElement=16,or("StructArrayLayout2f1f2i16",Do);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.float32=new Float32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,C,B){var O=this.length;return this.resize(O+1),this.emplace(O,p,x,C,B)},u.prototype.emplace=function(p,x,C,B,O){var k=12*p,G=3*p;return this.uint8[k+0]=x,this.uint8[k+1]=C,this.float32[G+1]=B,this.float32[G+2]=O,p},u})(Jr);na.prototype.bytesPerElement=12,or("StructArrayLayout2ub2f12",na);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.uint16=new Uint16Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,C){var B=this.length;return this.resize(B+1),this.emplace(B,p,x,C)},u.prototype.emplace=function(p,x,C,B){var O=3*p;return this.uint16[O+0]=x,this.uint16[O+1]=C,this.uint16[O+2]=B,p},u})(Jr);ia.prototype.bytesPerElement=6,or("StructArrayLayout3ui6",ia);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,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne,He,Ge,Ke){var lt=this.length;return this.resize(lt+1),this.emplace(lt,p,x,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne,He,Ge,Ke)},u.prototype.emplace=function(p,x,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne,He,Ge,Ke,lt){var mt=24*p,yt=12*p,Ot=48*p;return this.int16[mt+0]=x,this.int16[mt+1]=C,this.uint16[mt+2]=B,this.uint16[mt+3]=O,this.uint32[yt+2]=k,this.uint32[yt+3]=G,this.uint32[yt+4]=J,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[Ot+36]=Ne,this.uint8[Ot+37]=He,this.uint8[Ot+38]=Ge,this.uint32[yt+10]=Ke,this.int16[mt+22]=lt,p},u})(Jr);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,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne,He,Ge,Ke,lt,mt,yt,Ot,Ht,Kt,br,nr,Sr,ir,sn){var Lr=this.length;return this.resize(Lr+1),this.emplace(Lr,p,x,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne,He,Ge,Ke,lt,mt,yt,Ot,Ht,Kt,br,nr,Sr,ir,sn)},u.prototype.emplace=function(p,x,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne,He,Ge,Ke,lt,mt,yt,Ot,Ht,Kt,br,nr,Sr,ir,sn,Lr){var hr=34*p,hn=17*p;return this.int16[hr+0]=x,this.int16[hr+1]=C,this.int16[hr+2]=B,this.int16[hr+3]=O,this.int16[hr+4]=k,this.int16[hr+5]=G,this.int16[hr+6]=J,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]=He,this.uint16[hr+14]=Ge,this.uint16[hr+15]=Ke,this.uint16[hr+16]=lt,this.uint16[hr+1
20977]=mt,this.uint16[hr+18]=yt,this.uint16[hr+19]=Ot,this.uint16[hr+20]=Ht,this.uint16[hr+21]=Kt,this.uint16[hr+22]=br,this.uint32[hn+12]=nr,this.float32[hn+13]=Sr,this.float32[hn+14]=ir,this.float32[hn+15]=sn,this.float32[hn+16]=Lr,p},u})(Jr);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})(Jr);_.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,C){var B=this.length;return this.resize(B+1),this.emplace(B,p,x,C)},u.prototype.emplace=function(p,x,C,B){var O=3*p;return this.int16[O+0]=x,this.int16[O+1]=C,this.int16[O+2]=B,p},u})(Jr);b.prototype.bytesPerElement=6,or("StructArrayLayout3i6",b);var w=(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,C){var B=this.length;return this.resize(B+1),this.emplace(B,p,x,C)},u.prototype.emplace=function(p,x,C,B){var O=4*p;return this.uint32[2*p+0]=x,this.uint16[O+2]=C,this.uint16[O+3]=B,p},u})(Jr);w.prototype.bytesPerElement=8,or("StructArrayLayout1ul2ui8",w);var S=(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 C=this.length;return this.resize(C+1),this.emplace(C,p,x)},u.prototype.emplace=function(p,x,C){var B=2*p;return this.uint16[B+0]=x,this.uint16[B+1]=C,p},u})(Jr);S.prototype.bytesPerElement=4,or("StructArrayLayout2ui4",S);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._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})(Jr);P.prototype.bytesPerElement=2,or("StructArrayLayout1ui2",P);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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},u.prototype.emplaceBack=function(p,x,C,B){var O=this.length;return this.resize(O+1),this.emplace(O,p,x,C,B)},u.prototype.emplace=function(p,x,C,B,O){var k=4*p;return this.float32[k+0]=x,this.float32[k+1]=C,this.float32[k+2]=B,this.float32[k+3]=O,p},u})(Jr);D.prototype.bytesPerElement=16,or("StructArrayLayout4f16",D);var c=(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]}
2097,p.anchorPoint.get=function(){return new v(this.anchorPointX,this.anchorPointY)},Object.defineProperties(u.prototype,p),u})(An);c.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 c(this,p)},u})(Pc);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 E=(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]}
2097,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);E.prototype.size=68;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 E(this,p)},u})(y);or("SymbolInstanceArray",M);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 q=(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})(w);or("FeatureIndexArray",q);var ee=ki([{name:"a_pos",components:2,type:"Int16"}],4).members,Y=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)}Y.prototype.prepareSegment=function(a,u,p,x){var C=this.segments[this.segments.length-1];return a>Y.MAX_VERTEX_ARRAY_LENGTH&&re("Max vertices per segment is "+Y.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+a),(!C||C.vertexLength+a>Y.MAX_VERTEX_ARRAY_LENGTH||C.sortKey!==x)&&(C={vertexOffset:u.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},x!==void 0&&(C.sortKey=x),this.segments.push(C)),C},Y.prototype.get=function(){return this.segments},Y.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()}}
vendor: 2,595 bytes, line 2097
2097,Y.simpleSegment=function(a,u,p,x){return new Y([{vertexOffset:a,primitiveOffset:u,vertexLength:p,primitiveLength:x,vaos:{},sortKey:0}])},Y.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,or("SegmentVector",Y);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=l((function(a){a.exports=function(u,p){var x,C,B,O,k,G,J,Q;for(C=u.length-(x=3&u.length),B=p,k=3432918353,G=461845907,Q=0;Q<C;)J=255&u.charCodeAt(Q)|(255&u.charCodeAt(++Q))<<8|(255&u.charCodeAt(++Q))<<16|(255&u.charCodeAt(++Q))<<24,++Q,B=27492+(65535&(O=5*(65535&(B=(B^=J=(65535&(J=(J=(65535&J)*k+(((J>>>16)*k&65535)<<16)&4294967295)<<15|J>>>17))*G+(((J>>>16)*G&65535)<<16)&4294967295)<<13|B>>>19))+((5*(B>>>16)&65535)<<16)&4294967295))+((58964+(O>>>16)&65535)<<16);switch(J=0,x){case 3:J^=(255&u.charCodeAt(Q+2))<<16;case 2:J^=(255&u.charCodeAt(Q+1))<<8;case 1:B^=J=(65535&(J=(J=(65535&(J^=255&u.charCodeAt(Q)))*k+(((J>>>16)*k&65535)<<16)&4294967295)<<15|J>>>17))*G+(((J>>>16)*G&65535)<<16)&4294967295}return B^=u.length,B=2246822507*(65535&(B^=B>>>16))+((2246822507*(B>>>16)&65535)<<16)&4294967295,B=3266489909*(65535&(B^=B>>>13))+((3266489909*(B>>>16)&65535)<<16)&4294967295,(B^=B>>>16)>>>0}})),Oe=l((function(a){a.exports=function(u,p){for(var x,C=u.length,B=p^C,O=0;C>=4;)x=1540483477*(65535&(x=255&u.charCodeAt(O)|(255&u.charCodeAt(++O))<<8|(255&u.charCodeAt(++O))<<16|(255&u.charCodeAt(++O))<<24))+((1540483477*(x>>>16)&65535)<<16),B=1540483477*(65535&B)+((1540483477*(B>>>16)&65535)<<16)^(x=1540483477*(65535&(x^=x>>>24))+((1540483477*(x>>>16)&65535)<<16)),C-=4,++O;switch(C){case 3:B^=(255&u.charCodeAt(O+2))<<16;case 2:B^=(255&u.charCodeAt(O+1))<<8;case 1:B=1540483477*(65535&(B^=255&u.charCodeAt(O)))+((1540483477*(B>>>16)&65535)<<16)}return B=1540483477*(65535&(B^=B>>>13))+((1540483477*(B>>>16)&65535)<<16),(B^=B>>>15)>>>0}})),ge=we,Re=Oe;ge.murmur3=we,ge.murmur2=Re;var je=function(){this.ids=[],this.positions=[],this.indexed=!1};je.prototype.add=function(a,u,p,x){this.ids.push(nt(a)),this.positions.push(u,p,x)},je.prototype.getPositions=function(a){for(var u=nt(a),p=0,x=this.ids.length-1;p<x;){var C=p+x>>1;this.ids[C]>=u?x=C:p=C+1}for(var B=[];this.ids[p]===u;)B.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return B},je.serialize=function(a,u){var p=new Float64Array(a.ids),x=new Uint32Array(a.positions);return(function C(B,O,k,G){for(;k<G;){for(var J=B[k+G>>1],Q=k-1,ie=G+1;;){do Q++;while(B[Q]<J);
2097do ie--;while(B[ie]>J);if(Q>=ie)break;qe(B,Q,ie),qe(O,3*Q,3*ie),qe(O,3*Q+1,3*ie+1),qe(O,3*Q+2,3*ie+2)}ie-k<G-ie?(C(B,O,k,ie),k=ie+1):(C(B,O,ie+1,G),G=ie)}})(p,x,0,p.length-1),u&&u.push(p.buffer,x.buffer),{ids:p,positions:x}},je.deserialize=function(a){var u=new je;return u.ids=a.ids,u.positions=a.positions,u.indexed=!0,u};var $e=Math.pow(2,53)-1;function nt(a){var u=+a;return!isNaN(u)&&u<=$e?u:ge(String(a))}function qe(a,u,p){var x=a[u];a[u]=a[p],a[p]=x}or("FeaturePositionMap",je);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),Tt=(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),Cr=(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),Pr=new Float32Array(16),xn=(function(a){function u(p,x){a.call(this,p,x),this.current=Pr}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);function ar(a){return[te(255*a.r,255*a.g),te(255*a.b,255*a.a)]}var Wr=function(a,u,p){this.value=a,this.uniformNames=u.map((function(x){return"u_"+x})),this.type=p};Wr.prototype.setUniform=function(a,u,p){a.set(p.constantOr(this.value))},Wr.prototype.getBinding=function(a,u,p){return this.type==="color"?new Cr(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 C=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;C&&a.set(C)},rn.prototype.getBinding=function(a,u,p){return p.substr(0,9)==="u_pattern"?new sr(a,u):new Dt(a,u)};var Hr=function(a,u,p,x){this.expression=a,this.type=p,this.maxValue=0,this.paintVertexAttributes=u.map((function(C){return{name:"a_"+C,type:"Float32",components:p==="color"?2:1,offset:0}})),this.paintVertexArray=new x};Hr.prototype.populatePaintArray=function(a,u,p,x,C){var B=this.paintVertexArray.length,O=this.expression.evaluate(new jr(0),u,{},x,[],C);this.paintVertexArray.resize(a),this._setPaintValue(B,a,O)},Hr.prototype.updatePaintArray=function(a,u,p,x){var C=this.expression.evaluate({zoom:0},p,x);this._setPaintValue(a,u,C)}
vendor: 12,668 bytes, line 2097
2097,Hr.prototype._setPaintValue=function(a,u,p){if(this.type==="color")for(var x=ar(p),C=a;C<u;C++)this.paintVertexArray.emplace(C,x[0],x[1]);else{for(var B=a;B<u;B++)this.paintVertexArray.emplace(B,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}},Hr.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))},Hr.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var Vr=function(a,u,p,x,C,B){this.expression=a,this.uniformNames=u.map((function(O){return"u_"+O+"_t"})),this.type=p,this.useIntegerZoom=x,this.zoom=C,this.maxValue=0,this.paintVertexAttributes=u.map((function(O){return{name:"a_"+O,type:"Float32",components:p==="color"?4:2,offset:0}})),this.paintVertexArray=new B};Vr.prototype.populatePaintArray=function(a,u,p,x,C){var B=this.expression.evaluate(new jr(this.zoom),u,{},x,[],C),O=this.expression.evaluate(new jr(this.zoom+1),u,{},x,[],C),k=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(k,a,B,O)},Vr.prototype.updatePaintArray=function(a,u,p,x){var C=this.expression.evaluate({zoom:this.zoom},p,x),B=this.expression.evaluate({zoom:this.zoom+1},p,x);this._setPaintValue(a,u,C,B)},Vr.prototype._setPaintValue=function(a,u,p,x){if(this.type==="color")for(var C=ar(p),B=ar(x),O=a;O<u;O++)this.paintVertexArray.emplace(O,C[0],C[1],B[0],B[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))}},Vr.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))},Vr.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},Vr.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)},Vr.prototype.getBinding=function(a,u,p){return new Dt(a,u)};var Yr=function(a,u,p,x,C,B){this.expression=a,this.type=u,this.useIntegerZoom=p,this.zoom=x,this.layerId=B,this.zoomInPaintVertexArray=new C,this.zoomOutPaintVertexArray=new C};Yr.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)},Yr.prototype.updatePaintArray=function(a,u,p,x,C){this._setPaintValues(a,u,p.patterns&&p.patterns[this.layerId],C)},Yr.prototype._setPaintValues=function(a,u,p,x){if(x&&p){var C=x[p.min],B=x[p.mid],O=x[p.max];if(C&&B&&O)for(var k=a;k<u;k++)this.zoomInPaintVertexArray.emplace(k,B.tl[0],B.tl[1],B.br[0],B.br[1],C.tl[0],C.tl[1],C.br[0],C.br[1],B.pixelRatio,C.pixelRatio),this.zoomOutPaintVertexArray.emplace(k,B.tl[0],B.tl[1],B.br[0],B.br[1],O.tl[0],O.tl[1],O.br[0],O.br[1],B.pixelRatio,O.pixelRatio)}},Yr.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))},Yr.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 C in a.paint._values)if(p(C)){var B=a.paint.get(C);if(B instanceof ss&&Zo(B.property.specification)){var O=Ki(C,a.type),k=B.value,G=B.property.specification.type,J=B.property.useIntegerZoom,Q=B.property.specification["property-type"],ie=Q==="cross-faded"||Q==="cross-faded-data-driven";if(k.kind==="constant")this.binders[C]=ie?new rn(k.value,O):new Wr(k.value,O,G),x.push("/u_"+C);else if(k.kind==="source"||ie){var fe=Ti(C,G,"source");this.binders[C]=ie?new Yr(k,G,J,u,fe,a.id):new Hr(k,O,G,fe),x.push("/a_"+C)}else{var ye=Ti(C,G,"composite");this.binders[C]=new Vr(k,O,G,J,u,ye),x.push("/z_"+C)}}}this.cacheKey=x.sort().join("")};kr.prototype.getMaxValue=function(a){var u=this.binders[a];return u instanceof Hr||u instanceof Vr?u.maxValue:0},kr.prototype.populatePaintArrays=function(a,u,p,x,C){for(var B in this.binders){var O=this.binders[B];(O instanceof Hr||O instanceof Vr||O instanceof Yr)&&O.populatePaintArray(a,u,p,x,C)}},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,C){var B=!1;for(var O in a)for(var k=0,G=u.getPositions(O);k<G.length;k+=1){var J=G[k],Q=p.feature(J.index);for(var ie in this.binders){var fe=this.binders[ie];if((fe instanceof Hr||fe instanceof Vr||fe instanceof Yr)&&fe.expression.isStateDependent===!0){var ye=x.paint.get(ie);fe.expression=ye.value,fe.updatePaintArray(J.start,J.end,Q,a[O],C),B=!0}}}return B},kr.prototype.defines=function(){var a=[];for(var u in this.binders){var p=this.binders[u];(p instanceof Wr||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 Hr||p instanceof Vr)for(var x=0;x<p.paintVertexAttributes.length;x++)a.push(p.paintVertexAttributes[x].name);else if(p instanceof Yr)for(var C=0;C<oe.members.length;C++)a.push(oe.members[C].name)}return a},kr.prototype.getBinderUniforms=function(){var a=[];for(var u in this.binders){var p=this.binders[u];if(p instanceof Wr||p instanceof rn||p instanceof Vr)for(var x=0,C=p.uniformNames;x<C.length;x+=1)a.push(C[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 C=this.binders[x];if(C instanceof Wr||C instanceof rn||C instanceof Vr)for(var B=0,O=C.uniformNames;B<O.length;B+=1){var k=O[B];if(u[k]){var G=C.getBinding(a,u[k],k);p.push({name:k,property:x,binding:G})}}}return p},kr.prototype.setUniforms=function(a,u,p,x){for(var C=0,B=u;C<B.length;C+=1){var O=B[C],k=O.name,G=O.property;this.binders[G].setUniform(O.binding,x,p.get(G),k)}},kr.prototype.updatePaintBuffers=function(a){for(var u in this._buffers=[],this.binders){var p=this.binders[u];if(a&&p instanceof Yr){var x=a.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;x&&this._buffers.push(x)}else(p instanceof Hr||p instanceof Vr)&&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 Hr||p instanceof Vr||p instanceof Yr)&&p.upload(a)}this.updatePaintBuffers()},kr.prototype.destroy=function(){for(var a in this.binders){var u=this.binders[a];(u instanceof Hr||u instanceof Vr||u instanceof Yr)&&u.destroy()}};var Fr=function(a,u,p){p===void 0&&(p=function(){return!0}),this.programConfigurations={};for(var x=0,C=a;x<C.length;x+=1){var B=C[x];this.programConfigurations[B.id]=new kr(B,u,p)}this.needsUpload=!1,this._featureMap=new je,this._bufferOffset=0};function Ki(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 Ti(a,u,p){var x={color:{source:To,composite:D},number:{source:_,composite:To}},C=(function(B){return{"line-pattern":{source:Eo,composite:Eo},"fill-pattern":{source:Eo,composite:Eo},"fill-extrusion-pattern":{source:Eo,composite:Eo}}[B]})(a);return C&&C[p]||x[u][p]}Fr.prototype.populatePaintArrays=function(a,u,p,x,C,B){for(var O in this.programConfigurations)this.programConfigurations[O].populatePaintArrays(a,u,x,C,B);u.id!==void 0&&this._featureMap.add(u.id,p,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0},Fr.prototype.updatePaintArrays=function(a,u,p,x){for(var C=0,B=p;C<B.length;C+=1){var O=B[C];this.needsUpload=this.programConfigurations[O.id].updatePaintArrays(a,this._featureMap,u,O,x)||this.needsUpload}},Fr.prototype.get=function(a){return this.programConfigurations[a]},Fr.prototype.upload=function(a){if(this.needsUpload){for(var u in this.programConfigurations)this.programConfigurations[u].upload(a);this.needsUpload=!1}},Fr.prototype.destroy=function(){for(var a in this.programConfigurations)this.programConfigurations[a].destroy()},or("ConstantBinder",Wr),or("CrossFadedConstantBinder",rn),or("SourceExpressionBinder",Hr),or("CrossFadedCompositeBinder",Yr),or("CompositeExpressionBinder",Vr),or("ProgramConfiguration",kr,{omit:["_buffers"]}),or("ProgramConfigurationSet",Fr);var vs=Math.pow(2,14)-1,as=-vs-1;function yi(a){for(var u=8192/a.extent,p=a.loadGeometry(),x=0;x<p.length;x++)for(var C=p[x],B=0;B<C.length;B++){var O=C[B],k=Math.round(O.x*u),G=Math.round(O.y*u);O.x=$(k,as,vs),O.y=$(G,as,vs),(k<O.x||k>O.x+1||G<O.y||G>O.y+1)&&re("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return p}function Ii(a,u){return{type:a.type,id:a.id,properties:a.properties,geometry:u?yi(a):[]}}function ao(a,u,p,x,C){a.emplaceBack(2*u+(x+1)/2,2*p+(C+1)/2)}var Ms=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 Hs,this.indexArray=new ia,this.segments=new Y,this.programConfigurations=new Fr(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter((function(u){return u.isStateDependent()})).map((function(u){return u.id}))};function Gl(a,u){for(var p=0;p<a.length;p++)if(Ba(u,a[p]))return!0;for(var x=0;x<u.length;x++)if(Ba(a,u[x]))return!0;return!!Tf(a,u)}function Ws(a,u,p){return!!Ba(a,u)||!!jl(u,a,p)}function sa(a,u){if(a.length===1)return Ef(u,a[0]);for(var p=0;p<u.length;p++)for(var x=u[p],C=0;C<x.length;C++)if(Ba(a,x[C]))return!0;for(var B=0;B<a.length;B++)if(Ef(u,a[B]))return!0;for(var O=0;O<u.length;O++)if(Tf(a,u[O]))return!0;return!1}function Fo(a,u,p){if(a.length>1){if(Tf(a,u))return!0;for(var x=0;x<u.length;x++)if(jl(u[x],a,p))return!0}for(var C=0;C<a.length;C++)if(jl(a[C],u,p))return!0;return!1}function Tf(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],C=a[p+1],B=0;B<u.length-1;B++)if(wu(x,C,u[B],u[B+1]))return!0;return!1}function wu(a,u,p,x){return Ce(a,p,x)!==Ce(u,p,x)&&Ce(a,u,p)!==Ce(a,u,x)}function jl(a,u,p){var x=p*p;if(u.length===1)return a.distSqr(u[0])<x;for(var C=1;C<u.length;C++)if(Tu(a,u[C-1],u[C])<x)return!0;return!1}function Tu(a,u,p){var x=u.distSqr(p);if(x===0)return a.distSqr(u);var C=((a.x-u.x)*(p.x-u.x)+(a.y-u.y)*(p.y-u.y))/x;return a.distSqr(C<0?u:C>1?p:p.sub(u)._mult(C)._add(u))}function Ef(a,u){for(var p,x,C,B=!1,O=0;O<a.length;O++)for(var k=0,G=(p=a[O]).length-1;k<p.length;G=k++)(x=p[k]).y>u.y!=(C=p[G]).y>u.y&&u.x<(C.x-x.x)*(u.y-x.y)/(C.y-x.y)+x.x&&(B=!B);return B}function Ba(a,u){for(var p=!1,x=0,C=a.length-1;x<a.length;C=x++){var B=a[x],O=a[C];B.y>u.y!=O.y>u.y&&u.x<(O.x-B.x)*(u.y-B.y)/(O.y-B.y)+B.x&&(p=!p)}return p}function Cf(a,u,p){var x=p[0],C=p[2];if(a.x<x.x&&u.x<x.x||a.x>C.x&&u.x>C.x||a.y<x.y&&u.y<x.y||a.y>C.y&&u.y>C.y)return!1;var B=Ce(a,u,p[0]);return B!==Ce(a,u,p[1])||B!==Ce(a,u,p[2])||B!==Ce(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 Zi(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function il(a,u,p,x,C){if(!u[0]&&!u[1])return a;var B=v.convert(u)._mult(C);p==="viewport"&&B._rotate(-x);for(var O=[],k=0;k<a.length;k++)O.push(a[k].sub(B));return O}Ms.prototype.populate=function(a,u,p){var x=this.layers[0],C=[],B=null;
2097x.type==="circle"&&(B=x.layout.get("circle-sort-key"));for(var O=0,k=a;O<k.length;O+=1){var G=k[O],J=G.feature,Q=G.id,ie=G.index,fe=G.sourceLayerIndex,ye=this.layers[0]._featureFilter.needGeometry,ke=Ii(J,ye);if(this.layers[0]._featureFilter.filter(new jr(this.zoom),ke,p)){var Ne=B?B.evaluate(ke,{},p):void 0,He={id:Q,properties:J.properties,type:J.type,sourceLayerIndex:fe,index:ie,geometry:ye?ke.geometry:yi(J),patterns:{},sortKey:Ne};C.push(He)}}B&&C.sort((function(Kt,br){return Kt.sortKey-br.sortKey}));for(var Ge=0,Ke=C;Ge<Ke.length;Ge+=1){var lt=Ke[Ge],mt=lt.geometry,yt=lt.index,Ot=lt.sourceLayerIndex,Ht=a[yt].feature;this.addFeature(lt,mt,yt,p),u.featureIndex.insert(Ht,mt,yt,Ot,this.index)}},Ms.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},Ms.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},Ms.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ms.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},Ms.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ms.prototype.addFeature=function(a,u,p,x){for(var C=0,B=u;C<B.length;C+=1)for(var O=0,k=B[C];O<k.length;O+=1){var G=k[O],J=G.x,Q=G.y;if(!(J<0||J>=8192||Q<0||Q>=8192)){var ie=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),fe=ie.vertexLength;ao(this.layoutVertexArray,J,Q,-1,-1),ao(this.layoutVertexArray,J,Q,1,-1),ao(this.layoutVertexArray,J,Q,1,1),ao(this.layoutVertexArray,J,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",Ms,{omit:["layers"]});var Hl=new qn({"circle-sort-key":new ur(ae.layout_circle["circle-sort-key"])}),Mc={paint:new qn({"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:Hl},Cn=typeof Float32Array<"u"?Float32Array:Array;function Co(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 $s(a,u,p){var x=u[0],C=u[1],B=u[2],O=u[3],k=u[4],G=u[5],J=u[6],Q=u[7],ie=u[8],fe=u[9],ye=u[10],ke=u[11],Ne=u[12],He=u[13],Ge=u[14],Ke=u[15],lt=p[0],mt=p[1],yt=p[2],Ot=p[3];return a[0]=lt*x+mt*k+yt*ie+Ot*Ne,a[1]=lt*C+mt*G+yt*fe+Ot*He,a[2]=lt*B+mt*J+yt*ye+Ot*Ge,a[3]=lt*O+mt*Q+yt*ke+Ot*Ke,a[4]=(lt=p[4])*x+(mt=p[5])*k+(yt=p[6])*ie+(Ot=p[7])*Ne,a[5]=lt*C+mt*G+yt*fe+Ot*He,a[6]=lt*B+mt*J+yt*ye+Ot*Ge,a[7]=lt*O+mt*Q+yt*ke+Ot*Ke,a[8]=(lt=p[8])*x+(mt=p[9])*k+(yt=p[10])*ie+(Ot=p[11])*Ne,a[9]=lt*C+mt*G+yt*fe+Ot*He,a[10]=lt*B+mt*J+yt*ye+Ot*Ge,a[11]=lt*O+mt*Q+yt*ke+Ot*Ke,a[12]=(lt=p[12])*x+(mt=p[13])*k+(yt=p[14])*ie+(Ot=p[15])*Ne,a[13]=lt*C+mt*G+yt*fe+Ot*He,a[14]=lt*B+mt*J+yt*ye+Ot*Ge,a[15]=lt*O+mt*Q+yt*ke+Ot*Ke,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 Rc,by=$s;function Dh(a,u,p){var x=u[0],C=u[1],B=u[2],O=u[3];return a[0]=p[0]*x+p[4]*C+p[8]*B+p[12]*O,a[1]=p[1]*x+p[5]*C+p[9]*B+p[13]*O,a[2]=p[2]*x+p[6]*C+p[10]*B+p[14]*O,a[3]=p[3]*x+p[7]*C+p[11]*B+p[15]*O,a}Rc=new Cn(3),Cn!=Float32Array&&(Rc[0]=0,Rc[1]=0,Rc[2]=0),(function(){var a=new Cn(4);Cn!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0)})();var xy=((function(){var a=new Cn(2);Cn!=Float32Array&&(a[0]=0,a[1]=0)})(),(function(a){function u(p){a.call(this,p,Mc)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.createBucket=function(p){return new Ms(p)},u.prototype.queryRadius=function(p){var x=p;return Pa("circle-radius",this,x)+Pa("circle-stroke-width",this,x)+Zi(this.paint.get("circle-translate"))},u.prototype.queryIntersectsFeature=function(p,x,C,B,O,k,G,J){for(var Q=il(p,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),k.angle,G),ie=this.paint.get("circle-radius").evaluate(x,C)+this.paint.get("circle-stroke-width").evaluate(x,C),fe=this.paint.get("circle-pitch-alignment")==="map",ye=fe?Q:(function(Ht,Kt){return Ht.map((function(br){return Sf(br,Kt)}))})(Q,J),ke=fe?ie*G:ie,Ne=0,He=B;Ne<He.length;Ne+=1)for(var Ge=0,Ke=He[Ne];Ge<Ke.length;Ge+=1){var lt=Ke[Ge],mt=fe?lt:Sf(lt,J),yt=ke,Ot=Dh([],[lt.x,lt.y,0,1],J);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?yt*=Ot[3]/k.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(yt*=k.cameraToCenterDistance/Ot[3]),Ws(ye,mt,yt))return!0}return!1},u})(zr));function Sf(a,u){var p=Dh([],[a.x,a.y,0,1],u);return new v(p[0]/p[3],p[1]/p[3])}var Rg=(function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u})(Ms);
2097function Eu(a,u,p,x){var C=u.width,B=u.height;if(x){if(x instanceof Uint8ClampedArray)x=new Uint8Array(x.buffer);else if(x.length!==C*B*p)throw new RangeError("mismatched image size")}else x=new Uint8Array(C*B*p);return a.width=C,a.height=B,a.data=x,a}function Fh(a,u,p){var x=u.width,C=u.height;if(x!==a.width||C!==a.height){var B=Eu({},{width:x,height:C},p);wy(a,B,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,x),height:Math.min(a.height,C)},p),a.width=x,a.height=C,a.data=B.data}}function wy(a,u,p,x,C,B){if(C.width===0||C.height===0)return u;if(C.width>a.width||C.height>a.height||p.x>a.width-C.width||p.y>a.height-C.height)throw new RangeError("out of range source coordinates for image copy");if(C.width>u.width||C.height>u.height||x.x>u.width-C.width||x.y>u.height-C.height)throw new RangeError("out of range destination coordinates for image copy");for(var O=a.data,k=u.data,G=0;G<C.height;G++)for(var J=((p.y+G)*a.width+p.x)*B,Q=((x.y+G)*u.width+x.x)*B,ie=0;ie<C.width*B;ie++)k[Q+ie]=O[J+ie];return u}or("HeatmapBucket",Rg,{omit:["layers"]});var If=function(a,u){Eu(this,a,1,u)};If.prototype.resize=function(a){Fh(this,a,1)},If.prototype.clone=function(){return new If({width:this.width,height:this.height},new Uint8Array(this.data))},If.copy=function(a,u,p,x,C){wy(a,u,p,x,C,1)};var lo=function(a,u){Eu(this,a,4,u)};lo.prototype.resize=function(a){Fh(this,a,4)},lo.prototype.replace=function(a,u){u?this.data.set(a):this.data=a instanceof Uint8ClampedArray?new Uint8Array(a.buffer):a},lo.prototype.clone=function(){return new lo({width:this.width,height:this.height},new Uint8Array(this.data))},lo.copy=function(a,u,p,x,C){wy(a,u,p,x,C,4)},or("AlphaImage",If),or("RGBAImage",lo);var Wk={paint:new qn({"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 Ji(ae.paint_heatmap["heatmap-color"]),"heatmap-opacity":new wr(ae.paint_heatmap["heatmap-opacity"])})};function LT(a){var u={},p=a.resolution||256,x=a.clips?a.clips.length:1,C=a.image||new lo({width:p,height:x}),B=function(ke,Ne,He){u[a.evaluationKey]=He;var Ge=a.expression.evaluate(u);C.data[ke+Ne+0]=Math.floor(255*Ge.r/Ge.a),C.data[ke+Ne+1]=Math.floor(255*Ge.g/Ge.a),C.data[ke+Ne+2]=Math.floor(255*Ge.b/Ge.a),C.data[ke+Ne+3]=Math.floor(255*Ge.a)};if(a.clips)for(var O=0,k=0;O<x;++O,k+=4*p)for(var G=0,J=0;G<p;G++,J+=4){var Q=G/(p-1),ie=a.clips[O];B(k,J,ie.start*(1-Q)+ie.end*Q)}else for(var fe=0,ye=0;fe<p;fe++,ye+=4)B(0,ye,fe/(p-1));return C}var $k=(function(a){function u(p){a.call(this,p,Wk),this._updateColorRamp()}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.createBucket=function(p){return new Rg(p)},u.prototype._handleSpecialPaintPropertyUpdate=function(p){p==="heatmap-color"&&this._updateColorRamp()},u.prototype._updateColorRamp=function(){this.colorRamp=LT({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),Xk={paint:new qn({"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"])})},qk=(function(a){function u(p){a.call(this,p,Xk)}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),Jk=ki([{name:"a_pos",components:2,type:"Int16"}],4).members,Ty=Og,Kk=Og;function Og(a,u,p){p=p||2;var x,C,B,O,k,G,J,Q=u&&u.length,ie=Q?u[0]*p:a.length,fe=kT(a,0,ie,p,!0),ye=[];if(!fe||fe.next===fe.prev)return ye;if(Q&&(fe=(function(Ne,He,Ge,Ke){var lt,mt,yt,Ot=[];for(lt=0,mt=He.length;lt<mt;lt++)(yt=kT(Ne,He[lt]*Ke,lt<mt-1?He[lt+1]*Ke:Ne.length,Ke,!1))===yt.next&&(yt.steiner=!0),Ot.push(i8(yt));for(Ot.sort(t8),lt=0;lt<Ot.length;lt++)r8(Ot[lt],Ge),Ge=Cu(Ge,Ge.next);return Ge})(a,u,fe,p)),a.length>80*p){x=B=a[0],C=O=a[1];for(var ke=p;ke<ie;ke+=p)(k=a[ke])<x&&(x=k),(G=a[ke+1])<C&&(C=G),k>B&&(B=k),G>O&&(O=G);J=(J=Math.max(B-x,O-C))!==0?1/J:0}return zp(fe,ye,p,x,C,J),ye}function kT(a,u,p,x,C){var B,O;if(C===Sy(a,u,p,x)>0)for(B=u;B<p;B+=x)O=zT(B,a[B],a[B+1],O);else for(B=p-x;B>=u;B-=x)O=zT(B,a[B],a[B+1],O);return O&&Dg(O,O.next)&&(Gp(O),O=O.next),O}function Cu(a,u){if(!a)return a;u||(u=a);var p,x=a;do if(p=!1,x.steiner||!Dg(x,x.next)&&Vi(x.prev,x,x.next)!==0)x=x.next;else{if(Gp(x),(x=u=x.prev)===x.next)break;p=!0}
2097while(p||x!==u);return u}function zp(a,u,p,x,C,B,O){if(a){!O&&B&&(function(Q,ie,fe,ye){var ke=Q;do ke.z===null&&(ke.z=Ey(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 He,Ge,Ke,lt,mt,yt,Ot,Ht,Kt=1;do{for(Ge=Ne,Ne=null,mt=null,yt=0;Ge;){for(yt++,Ke=Ge,Ot=0,He=0;He<Kt&&(Ot++,Ke=Ke.nextZ);He++);for(Ht=Kt;Ot>0||Ht>0&&Ke;)Ot!==0&&(Ht===0||!Ke||Ge.z<=Ke.z)?(lt=Ge,Ge=Ge.nextZ,Ot--):(lt=Ke,Ke=Ke.nextZ,Ht--),mt?mt.nextZ=lt:Ne=lt,lt.prevZ=mt,mt=lt;Ge=Ke}mt.nextZ=null,Kt*=2}while(yt>1)})(ke)})(a,x,C,B);for(var k,G,J=a;a.prev!==a.next;)if(k=a.prev,G=a.next,B?Yk(a,x,C,B):Zk(a))u.push(k.i/p),u.push(a.i/p),u.push(G.i/p),Gp(a),a=G.next,J=G.next;else if((a=G)===J){O?O===1?zp(a=Qk(Cu(a),u,p),u,p,x,C,B,2):O===2&&e8(a,u,p,x,C,B):zp(Cu(a),u,p,x,C,B,1);break}}}function Zk(a){var u=a.prev,p=a,x=a.next;if(Vi(u,p,x)>=0)return!1;for(var C=a.next.next;C!==a.prev;){if(Lh(u.x,u.y,p.x,p.y,x.x,x.y,C.x,C.y)&&Vi(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function Yk(a,u,p,x){var C=a.prev,B=a,O=a.next;if(Vi(C,B,O)>=0)return!1;for(var k=C.x>B.x?C.x>O.x?C.x:O.x:B.x>O.x?B.x:O.x,G=C.y>B.y?C.y>O.y?C.y:O.y:B.y>O.y?B.y:O.y,J=Ey(C.x<B.x?C.x<O.x?C.x:O.x:B.x<O.x?B.x:O.x,C.y<B.y?C.y<O.y?C.y:O.y:B.y<O.y?B.y:O.y,u,p,x),Q=Ey(k,G,u,p,x),ie=a.prevZ,fe=a.nextZ;ie&&ie.z>=J&&fe&&fe.z<=Q;){if(ie!==a.prev&&ie!==a.next&&Lh(C.x,C.y,B.x,B.y,O.x,O.y,ie.x,ie.y)&&Vi(ie.prev,ie,ie.next)>=0||(ie=ie.prevZ,fe!==a.prev&&fe!==a.next&&Lh(C.x,C.y,B.x,B.y,O.x,O.y,fe.x,fe.y)&&Vi(fe.prev,fe,fe.next)>=0))return!1;fe=fe.nextZ}for(;ie&&ie.z>=J;){if(ie!==a.prev&&ie!==a.next&&Lh(C.x,C.y,B.x,B.y,O.x,O.y,ie.x,ie.y)&&Vi(ie.prev,ie,ie.next)>=0)return!1;ie=ie.prevZ}for(;fe&&fe.z<=Q;){if(fe!==a.prev&&fe!==a.next&&Lh(C.x,C.y,B.x,B.y,O.x,O.y,fe.x,fe.y)&&Vi(fe.prev,fe,fe.next)>=0)return!1;fe=fe.nextZ}return!0}function Qk(a,u,p){var x=a;do{var C=x.prev,B=x.next.next;!Dg(C,B)&&NT(C,x,x.next,B)&&Vp(C,B)&&Vp(B,C)&&(u.push(C.i/p),u.push(x.i/p),u.push(B.i/p),Gp(x),Gp(x.next),x=a=B),x=x.next}while(x!==a);return Cu(x)}function e8(a,u,p,x,C,B){var O=a;do{for(var k=O.next.next;k!==O.prev;){if(O.i!==k.i&&s8(O,k)){var G=UT(O,k);return O=Cu(O,O.next),G=Cu(G,G.next),zp(O,u,p,x,C,B),void zp(G,u,p,x,C,B)}k=k.next}O=O.next}while(O!==a)}function t8(a,u){return a.x-u.x}function r8(a,u){if(u=(function(x,C){var B,O=C,k=x.x,G=x.y,J=-1/0;do{if(G<=O.y&&G>=O.next.y&&O.next.y!==O.y){var Q=O.x+(G-O.y)*(O.next.x-O.x)/(O.next.y-O.y);if(Q<=k&&Q>J){if(J=Q,Q===k){if(G===O.y)return O;if(G===O.next.y)return O.next}B=O.x<O.next.x?O:O.next}}O=O.next}while(O!==C);if(!B)return null;if(k===J)return B;var ie,fe=B,ye=B.x,ke=B.y,Ne=1/0;O=B;do k>=O.x&&O.x>=ye&&k!==O.x&&Lh(G<ke?k:J,G,ye,ke,G<ke?J:k,G,O.x,O.y)&&(ie=Math.abs(G-O.y)/(k-O.x),Vp(O,x)&&(ie<Ne||ie===Ne&&(O.x>B.x||O.x===B.x&&n8(B,O)))&&(B=O,Ne=ie)),O=O.next;while(O!==fe);return B})(a,u)){var p=UT(u,a);Cu(u,u.next),Cu(p,p.next)}}function n8(a,u){return Vi(a.prev,a,u.prev)<0&&Vi(u.next,a,a.next)<0}function Ey(a,u,p,x,C){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=32767*(a-p)*C)|a<<8))|a<<4))|a<<2))|a<<1))|(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=32767*(u-x)*C)|u<<8))|u<<4))|u<<2))|u<<1))<<1}function i8(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 Lh(a,u,p,x,C,B,O,k){return(C-O)*(u-k)-(a-O)*(B-k)>=0&&(a-O)*(x-k)-(p-O)*(u-k)>=0&&(p-O)*(B-k)-(C-O)*(x-k)>=0}function s8(a,u){return a.next.i!==u.i&&a.prev.i!==u.i&&!(function(p,x){var C=p;do{if(C.i!==p.i&&C.next.i!==p.i&&C.i!==x.i&&C.next.i!==x.i&&NT(C,C.next,p,x))return!0;C=C.next}while(C!==p);return!1})(a,u)&&(Vp(a,u)&&Vp(u,a)&&(function(p,x){var C=p,B=!1,O=(p.x+x.x)/2,k=(p.y+x.y)/2;do C.y>k!=C.next.y>k&&C.next.y!==C.y&&O<(C.next.x-C.x)*(k-C.y)/(C.next.y-C.y)+C.x&&(B=!B),C=C.next;while(C!==p);return B})(a,u)&&(Vi(a.prev,a,u.prev)||Vi(a,u.prev,u))||Dg(a,u)&&Vi(a.prev,a,a.next)>0&&Vi(u.prev,u,u.next)>0)}function Vi(a,u,p){return(u.y-a.y)*(p.x-u.x)-(u.x-a.x)*(p.y-u.y)}function Dg(a,u){return a.x===u.x&&a.y===u.y}function NT(a,u,p,x){var C=Lg(Vi(a,u,p)),B=Lg(Vi(a,u,x)),O=Lg(Vi(p,x,a)),k=Lg(Vi(p,x,u));return C!==B&&O!==k||!(C!==0||!Fg(a,p,u))||!(B!==0||!Fg(a,x,u))||!(O!==0||!Fg(p,a,x))||!(k!==0||!Fg(p,u,x))}
vendor: 4,214 bytes, line 2097
2097function Fg(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 Lg(a){return a>0?1:a<0?-1:0}function Vp(a,u){return Vi(a.prev,a,a.next)<0?Vi(a,u,a.next)>=0&&Vi(a,a.prev,u)>=0:Vi(a,u,a.prev)<0||Vi(a,a.next,u)<0}function UT(a,u){var p=new Cy(a.i,a.x,a.y),x=new Cy(u.i,u.x,u.y),C=a.next,B=u.prev;return a.next=u,u.prev=a,p.next=C,C.prev=p,x.next=p,p.prev=x,B.next=x,x.prev=B,x}function zT(a,u,p,x){var C=new Cy(a,u,p);return x?(C.next=x.next,C.prev=x,x.next.prev=C,x.next=C):(C.prev=C,C.next=C),C}function Gp(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 Cy(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 Sy(a,u,p,x){for(var C=0,B=u,O=p-x;B<p;B+=x)C+=(a[O]-a[B])*(a[B+1]+a[O+1]),O=B;return C}function o8(a,u,p,x,C){(function B(O,k,G,J,Q){for(;J>G;){if(J-G>600){var ie=J-G+1,fe=k-G+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);B(O,k,Math.max(G,Math.floor(k-fe*ke/ie+Ne)),Math.min(J,Math.floor(k+(ie-fe)*ke/ie+Ne)),Q)}var He=O[k],Ge=G,Ke=J;for(jp(O,G,k),Q(O[J],He)>0&&jp(O,G,J);Ge<Ke;){for(jp(O,Ge,Ke),Ge++,Ke--;Q(O[Ge],He)<0;)Ge++;for(;Q(O[Ke],He)>0;)Ke--}Q(O[G],He)===0?jp(O,G,Ke):jp(O,++Ke,J),Ke<=k&&(G=Ke+1),k<=Ke&&(J=Ke-1)}})(a,u,p,x||a.length-1,C||a8)}function jp(a,u,p){var x=a[u];a[u]=a[p],a[p]=x}function a8(a,u){return a<u?-1:a>u?1:0}function Iy(a,u){var p=a.length;if(p<=1)return[a];for(var x,C,B=[],O=0;O<p;O++){var k=et(a[O]);k!==0&&(a[O].area=Math.abs(k),C===void 0&&(C=k<0),C===k<0?(x&&B.push(x),x=[a[O]]):x.push(a[O]))}if(x&&B.push(x),u>1)for(var G=0;G<B.length;G++)B[G].length<=u||(o8(B[G],u,1,B[G].length-1,l8),B[G]=B[G].slice(0,u));return B}function l8(a,u){return u.area-a.area}function By(a,u,p){for(var x=p.patternDependencies,C=!1,B=0,O=u;B<O.length;B+=1){var k=O[B].paint.get(a+"-pattern");k.isConstant()||(C=!0);var G=k.constantOr(null);G&&(C=!0,x[G.to]=!0,x[G.from]=!0)}return C}function Py(a,u,p,x,C){for(var B=C.patternDependencies,O=0,k=u;O<k.length;O+=1){var G=k[O],J=G.paint.get(a+"-pattern").value;if(J.kind!=="constant"){var Q=J.evaluate({zoom:x-1},p,{},C.availableImages),ie=J.evaluate({zoom:x},p,{},C.availableImages),fe=J.evaluate({zoom:x+1},p,{},C.availableImages);ie=ie&&ie.name?ie.name:ie,fe=fe&&fe.name?fe.name:fe,B[Q=Q&&Q.name?Q.name:Q]=!0,B[ie]=!0,B[fe]=!0,p.patterns[G.id]={min:Q,mid:ie,max:fe}}}return p}Og.deviation=function(a,u,p,x){var C=u&&u.length,B=Math.abs(Sy(a,0,C?u[0]*p:a.length,p));if(C)for(var O=0,k=u.length;O<k;O++)B-=Math.abs(Sy(a,u[O]*p,O<k-1?u[O+1]*p:a.length,p));var G=0;for(O=0;O<x.length;O+=3){var J=x[O]*p,Q=x[O+1]*p,ie=x[O+2]*p;G+=Math.abs((a[J]-a[ie])*(a[Q+1]-a[J+1])-(a[J]-a[Q])*(a[ie+1]-a[J+1]))}return B===0&&G===0?0:Math.abs((G-B)/B)},Og.flatten=function(a){for(var u=a[0][0].length,p={vertices:[],holes:[],dimensions:u},x=0,C=0;C<a.length;C++){for(var B=0;B<a[C].length;B++)for(var O=0;O<u;O++)p.vertices.push(a[C][B][O]);C>0&&p.holes.push(x+=a[C-1].length)}return p},Ty.default=Kk;var sl=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 Hs,this.indexArray=new ia,this.indexArray2=new S,this.programConfigurations=new Fr(a.layers,a.zoom),this.segments=new Y,this.segments2=new Y,this.stateDependentLayerIds=this.layers.filter((function(u){return u.isStateDependent()})).map((function(u){return u.id}))};sl.prototype.populate=function(a,u,p){this.hasPattern=By("fill",this.layers,u);for(var x=this.layers[0].layout.get("fill-sort-key"),C=[],B=0,O=a;B<O.length;B+=1){var k=O[B],G=k.feature,J=k.id,Q=k.index,ie=k.sourceLayerIndex,fe=this.layers[0]._featureFilter.needGeometry,ye=Ii(G,fe);if(this.layers[0]._featureFilter.filter(new jr(this.zoom),ye,p)){var ke=x?x.evaluate(ye,{},p,u.availableImages):void 0,Ne={id:J,properties:G.properties,type:G.type,sourceLayerIndex:ie,index:Q,geometry:fe?ye.geometry:yi(G),patterns:{},sortKey:ke};C.push(Ne)}}x&&C.sort((function(Ht,Kt){return Ht.sortKey-Kt.sortKey}
2097));for(var He=0,Ge=C;He<Ge.length;He+=1){var Ke=Ge[He],lt=Ke.geometry,mt=Ke.index,yt=Ke.sourceLayerIndex;if(this.hasPattern){var Ot=Py("fill",this.layers,Ke,this.zoom,u);this.patternFeatures.push(Ot)}else this.addFeature(Ke,lt,mt,p,{});u.featureIndex.insert(a[mt].feature,lt,mt,yt,this.index)}},sl.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},sl.prototype.addFeatures=function(a,u,p){for(var x=0,C=this.patternFeatures;x<C.length;x+=1){var B=C[x];this.addFeature(B,B.geometry,B.index,u,p)}},sl.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},sl.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},sl.prototype.upload=function(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,Jk),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),this.uploaded=!0},sl.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},sl.prototype.addFeature=function(a,u,p,x,C){for(var B=0,O=Iy(u,500);B<O.length;B+=1){for(var k=O[B],G=0,J=0,Q=k;J<Q.length;J+=1)G+=Q[J].length;for(var ie=this.segments.prepareSegment(G,this.layoutVertexArray,this.indexArray),fe=ie.vertexLength,ye=[],ke=[],Ne=0,He=k;Ne<He.length;Ne+=1){var Ge=He[Ne];if(Ge.length!==0){Ge!==k[0]&&ke.push(ye.length/2);var Ke=this.segments2.prepareSegment(Ge.length,this.layoutVertexArray,this.indexArray2),lt=Ke.vertexLength;this.layoutVertexArray.emplaceBack(Ge[0].x,Ge[0].y),this.indexArray2.emplaceBack(lt+Ge.length-1,lt),ye.push(Ge[0].x),ye.push(Ge[0].y);for(var mt=1;mt<Ge.length;mt++)this.layoutVertexArray.emplaceBack(Ge[mt].x,Ge[mt].y),this.indexArray2.emplaceBack(lt+mt-1,lt+mt),ye.push(Ge[mt].x),ye.push(Ge[mt].y);Ke.vertexLength+=Ge.length,Ke.primitiveLength+=Ge.length}}for(var yt=Ty(ye,ke),Ot=0;Ot<yt.length;Ot+=3)this.indexArray.emplaceBack(fe+yt[Ot],fe+yt[Ot+1],fe+yt[Ot+2]);ie.vertexLength+=G,ie.primitiveLength+=yt.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,p,C,x)},or("FillBucket",sl,{omit:["layers","patternFeatures"]});var c8=new qn({"fill-sort-key":new ur(ae.layout_fill["fill-sort-key"])}),u8={paint:new qn({"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 bu(ae.paint_fill["fill-pattern"])}),layout:c8},f8=(function(a){function u(p){a.call(this,p,u8)}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 C=this.paint._values["fill-outline-color"];C.value.kind==="constant"&&C.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},u.prototype.createBucket=function(p){return new sl(p)},u.prototype.queryRadius=function(){return Zi(this.paint.get("fill-translate"))},u.prototype.queryIntersectsFeature=function(p,x,C,B,O,k,G){return sa(il(p,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),k.angle,G),B)},u.prototype.isTileClipped=function(){return!0},u})(zr),h8=ki([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,VT=kh;function kh(a,u,p,x,C){this.properties={},this.extent=p,this.type=0,this._pbf=a,this._geometry=-1,this._keys=x,this._values=C,a.readFields(d8,this,u)}function d8(a,u,p){a==1?u.id=p.readVarint():a==2?(function(x,C){for(var B=x.readVarint()+x.pos;x.pos<B;){var O=C._keys[x.readVarint()],k=C._values[x.readVarint()];C.properties[O]=k}})(p,u):a==3?u.type=p.readVarint():a==4&&(u._geometry=p.pos)}function p8(a){for(var u,p,x=0,C=0,B=a.length,O=B-1;C<B;O=C++)x+=((p=a[O]).x-(u=a[C]).x)*(u.y+p.y);return x}kh.types=["Unknown","Point","LineString","Polygon"],kh.prototype.loadGeometry=function(){var a=this._pbf;a.pos=this._geometry;for(var u,p=a.readVarint()+a.pos,x=1,C=0,B=0,O=0,k=[];a.pos<p;){if(C<=0){var G=a.readVarint();x=7&G,C=G>>3}if(C--,x===1||x===2)B+=a.readSVarint(),O+=a.readSVarint(),x===1&&(u&&k.push(u),u=[]),u.push(new v(B,O));else{if(x!==7)throw new Error("unknown command "+x);u&&u.push(u[0].clone())}}return u&&k.push(u),k},kh.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var u=a.readVarint()+a.pos,p=1,x=0,C=0,B=0,O=1/0,k=-1/0,G=1/0,J=-1/0;a.pos<u;){if(x<=0){var Q=a.readVarint();p=7&Q,x=Q>>3}if(x--,p===1||p===2)(C+=a.readSVarint())<O&&(O=C),C>k&&(k=C),(B+=a.readSVarint())<G&&(G=B),B>J&&(J=B);else if(p!==7)throw new Error("unknown command "+p)}return[O,G,k,J]},kh.prototype.toGeoJSON=function(a,u,p){var x,C,B=this.extent*Math.pow(2,p),O=this.extent*a,k=this.extent*u,G=this.loadGeometry(),J=kh.types[this.type];function Q(ye){for(var ke=0;ke<ye.length;ke++){var Ne=ye[ke];ye[ke]=[360*(Ne.x+O)/B-180,360/Math.PI*Math.atan(Math.exp((180-360*(Ne.y+k)/B)*Math.PI/180)
2097)-90]}}switch(this.type){case 1:var ie=[];for(x=0;x<G.length;x++)ie[x]=G[x][0];Q(G=ie);break;case 2:for(x=0;x<G.length;x++)Q(G[x]);break;case 3:for(G=(function(ye){var ke=ye.length;if(ke<=1)return[ye];for(var Ne,He,Ge=[],Ke=0;Ke<ke;Ke++){var lt=p8(ye[Ke]);lt!==0&&(He===void 0&&(He=lt<0),He===lt<0?(Ne&&Ge.push(Ne),Ne=[ye[Ke]]):Ne.push(ye[Ke]))}return Ne&&Ge.push(Ne),Ge})(G),x=0;x<G.length;x++)for(C=0;C<G[x].length;C++)Q(G[x][C])}G.length===1?G=G[0]:J="Multi"+J;var fe={type:"Feature",geometry:{type:J,coordinates:G},properties:this.properties};return"id"in this&&(fe.id=this.id),fe};var GT=jT;function jT(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(A8,this,u),this.length=this._features.length}function A8(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 C=null,B=x.readVarint()+x.pos;x.pos<B;){var O=x.readVarint()>>3;C=O===1?x.readString():O===2?x.readFloat():O===3?x.readDouble():O===4?x.readVarint64():O===5?x.readVarint():O===6?x.readSVarint():O===7?x.readBoolean():null}return C})(p))}function g8(a,u,p){if(a===3){var x=new GT(p,p.readVarint()+p.pos);x.length&&(u[x.name]=x)}}jT.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 VT(this._pbf,u,this.extent,this._keys,this._values)};var Nh={VectorTile:function(a,u){this.layers=a.readFields(g8,{},u)},VectorTileFeature:VT,VectorTileLayer:GT},m8=Nh.VectorTileFeature.types,My=Math.pow(2,13);function Hp(a,u,p,x,C,B,O,k){a.emplaceBack(u,p,2*Math.floor(x*My)+O,C*My*2,B*My*2,Math.round(k))}var ol=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 ia,this.programConfigurations=new Fr(a.layers,a.zoom),this.segments=new Y,this.stateDependentLayerIds=this.layers.filter((function(u){return u.isStateDependent()})).map((function(u){return u.id}))};function _8(a,u){return a.x===u.x&&(a.x<0||a.x>8192)||a.y===u.y&&(a.y<0||a.y>8192)}ol.prototype.populate=function(a,u,p){this.features=[],this.hasPattern=By("fill-extrusion",this.layers,u);for(var x=0,C=a;x<C.length;x+=1){var B=C[x],O=B.feature,k=B.id,G=B.index,J=B.sourceLayerIndex,Q=this.layers[0]._featureFilter.needGeometry,ie=Ii(O,Q);if(this.layers[0]._featureFilter.filter(new jr(this.zoom),ie,p)){var fe={id:k,sourceLayerIndex:J,index:G,geometry:Q?ie.geometry:yi(O),properties:O.properties,type:O.type,patterns:{}};this.hasPattern?this.features.push(Py("fill-extrusion",this.layers,fe,this.zoom,u)):this.addFeature(fe,fe.geometry,G,p,{}),u.featureIndex.insert(O,fe.geometry,G,J,this.index,!0)}}},ol.prototype.addFeatures=function(a,u,p){for(var x=0,C=this.features;x<C.length;x+=1){var B=C[x];this.addFeature(B,B.geometry,B.index,u,p)}},ol.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},ol.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},ol.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},ol.prototype.upload=function(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,h8),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0},ol.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},ol.prototype.addFeature=function(a,u,p,x,C){for(var B=0,O=Iy(u,500);B<O.length;B+=1){for(var k=O[B],G=0,J=0,Q=k;J<Q.length;J+=1)G+=Q[J].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(Kr){return Kr.x<0}))||hn.every((function(Kr){return Kr.x>8192}))||hn.every((function(Kr){return Kr.y<0}))||hn.every((function(Kr){return Kr.y>8192}))))for(var Ne=0,He=0;He<ke.length;He++){var Ge=ke[He];if(He>=1){var Ke=ke[He-1];if(!_8(Ge,Ke)){ie.vertexLength+4>Y.MAX_VERTEX_ARRAY_LENGTH&&(ie=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var lt=Ge.sub(Ke)._perp()._unit(),mt=Ke.dist(Ge);Ne+mt>32768&&(Ne=0),Hp(this.layoutVertexArray,Ge.x,Ge.y,lt.x,lt.y,0,0,Ne),Hp(this.layoutVertexArray,Ge.x,Ge.y,lt.x,lt.y,0,1,Ne),Hp(this.layoutVertexArray,Ke.x,Ke.y,lt.x,lt.y,0,0,Ne+=mt),Hp(this.layoutVertexArray,Ke.x,Ke.y,lt.x,lt.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+G>Y.MAX_VERTEX_ARRAY_LENGTH&&(ie=this.segments.prepareSegment(G,this.layoutVertexArray,this.indexArray)),m8[a.type]==="Polygon"){for(var Ot=[],Ht=[],Kt=ie.vertexLength,br=0,nr=k;br<nr.length;br+=1){var Sr=nr[br];if(Sr.length!==0){Sr!==k[0]&&Ht.push(Ot.length/2);for(var ir=0;ir<Sr.length;ir++){var sn=Sr[ir];Hp(this.layoutVertexArray,sn.x,sn.y,0,0,1,1,0),Ot.push(sn.x),Ot.push(sn.y)}}}for(var Lr=Ty(Ot,Ht),hr=0;hr<Lr.length;hr+=3)this.indexArray.emplaceBack(Kt+Lr[hr],Kt+Lr[hr+2],Kt+Lr[hr+1]);ie.primitiveLength+=Lr.length/3,ie.vertexLength+=G}}var hn;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,p,C,x)},or("FillExtrusionBucket",ol,{omit:["layers","features"]});var y8={paint:new qn({"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 bu(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"])})},v8=(function(a){function u(p){a.call(this,p,y8)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.createBucket=function(p){return new ol(p)},u.prototype.queryRadius=function(){return Zi(this.paint.get("fill-extrusion-translate"))},u.prototype.is3D=function(){return!0},u.prototype.queryIntersectsFeature=function(p,x,C,B,O,k,G,J){var Q=il(p,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),k.angle,G),ie=this.paint.get("fill-extrusion-height").evaluate(x,C),fe=this.paint.get("fill-extrusion-base").evaluate(x,C),ye=(function(Ne,He,Ge,Ke){for(var lt=[],mt=0,yt=Ne;mt<yt.length;mt+=1){var Ot=yt[mt],Ht=[Ot.x,Ot.y,0,1];Dh(Ht,Ht,He),lt.push(new v(Ht[0]/Ht[3],Ht[1]/Ht[3]))}return lt})(Q,J),ke=(function(Ne,He,Ge,Ke){for(var lt=[],mt=[],yt=Ke[8]*He,Ot=Ke[9]*He,Ht=Ke[10]*He,Kt=Ke[11]*He,br=Ke[8]*Ge,nr=Ke[9]*Ge,Sr=Ke[10]*Ge,ir=Ke[11]*Ge,sn=0,Lr=Ne;sn<Lr.length;sn+=1){for(var hr=[],hn=[],Kr=0,bn=Lr[sn];Kr<bn.length;Kr+=1){var Ir=bn[Kr],Tn=Ir.x,ii=Ir.y,Ei=Ke[0]*Tn+Ke[4]*ii+Ke[12],vi=Ke[1]*Tn+Ke[5]*ii+Ke[13],si=Ke[2]*Tn+Ke[6]*ii+Ke[14],Ci=Ke[3]*Tn+Ke[7]*ii+Ke[15],Yi=si+Ht,Qi=Ci+Kt,Os=Ei+br,cs=vi+nr,Ds=si+Sr,Bi=Ci+ir,us=new v((Ei+yt)/Qi,(vi+Ot)/Qi);us.z=Yi/Qi,hr.push(us);var gn=new v(Os/Bi,cs/Bi);gn.z=Ds/Bi,hn.push(gn)}lt.push(hr),mt.push(hn)}return[lt,mt]})(B,fe,ie,J);return(function(Ne,He,Ge){var Ke=1/0;sa(Ge,He)&&(Ke=HT(Ge,He[0]));for(var lt=0;lt<He.length;lt++)for(var mt=He[lt],yt=Ne[lt],Ot=0;Ot<mt.length-1;Ot++){var Ht=mt[Ot],Kt=[Ht,mt[Ot+1],yt[Ot+1],yt[Ot],Ht];Gl(Ge,Kt)&&(Ke=Math.min(Ke,HT(Ge,Kt)))}return Ke!==1/0&&Ke})(ke[0],ke[1],ye)},u})(zr);function Wp(a,u){return a.x*u.x+a.y*u.y}function HT(a,u){if(a.length===1){for(var p,x=0,C=u[x++];!p||C.equals(p);
2097)if(!(p=u[x++]))return 1/0;for(;x<u.length;x++){var B=u[x],O=a[0],k=p.sub(C),G=B.sub(C),J=O.sub(C),Q=Wp(k,k),ie=Wp(k,G),fe=Wp(G,G),ye=Wp(J,k),ke=Wp(J,G),Ne=Q*fe-ie*ie,He=(fe*ye-ie*ke)/Ne,Ge=(Q*ke-ie*ye)/Ne,Ke=C.z*(1-He-Ge)+p.z*He+B.z*Ge;if(isFinite(Ke))return Ke}return 1/0}for(var lt=1/0,mt=0,yt=u;mt<yt.length;mt+=1)lt=Math.min(lt,yt[mt].z);return lt}var b8=ki([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,x8=ki([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,w8=Nh.VectorTileFeature.types,T8=Math.cos(Math.PI/180*37.5),WT=Math.pow(2,14)/.5,Xs=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 ia,this.programConfigurations=new Fr(a.layers,a.zoom),this.segments=new Y,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(p){return p.isStateDependent()})).map((function(p){return p.id}))};Xs.prototype.populate=function(a,u,p){this.hasPattern=By("line",this.layers,u);for(var x=this.layers[0].layout.get("line-sort-key"),C=[],B=0,O=a;B<O.length;B+=1){var k=O[B],G=k.feature,J=k.id,Q=k.index,ie=k.sourceLayerIndex,fe=this.layers[0]._featureFilter.needGeometry,ye=Ii(G,fe);if(this.layers[0]._featureFilter.filter(new jr(this.zoom),ye,p)){var ke=x?x.evaluate(ye,{},p):void 0,Ne={id:J,properties:G.properties,type:G.type,sourceLayerIndex:ie,index:Q,geometry:fe?ye.geometry:yi(G),patterns:{},sortKey:ke};C.push(Ne)}}x&&C.sort((function(Ht,Kt){return Ht.sortKey-Kt.sortKey}));for(var He=0,Ge=C;He<Ge.length;He+=1){var Ke=Ge[He],lt=Ke.geometry,mt=Ke.index,yt=Ke.sourceLayerIndex;if(this.hasPattern){var Ot=Py("line",this.layers,Ke,this.zoom,u);this.patternFeatures.push(Ot)}else this.addFeature(Ke,lt,mt,p,{});u.featureIndex.insert(a[mt].feature,lt,mt,yt,this.index)}},Xs.prototype.update=function(a,u,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,u,this.stateDependentLayers,p)},Xs.prototype.addFeatures=function(a,u,p){for(var x=0,C=this.patternFeatures;x<C.length;x+=1){var B=C[x];this.addFeature(B,B.geometry,B.index,u,p)}},Xs.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},Xs.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Xs.prototype.upload=function(a){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,x8)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,b8),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0},Xs.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Xs.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}},Xs.prototype.addFeature=function(a,u,p,x,C){var B=this.layers[0].layout,O=B.get("line-join").evaluate(a,{}),k=B.get("line-cap"),G=B.get("line-miter-limit"),J=B.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,O,k,G,J);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,p,C,x)},Xs.prototype.addLine=function(a,u,p,x,C,B){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var O=0;O<a.length-1;O++)this.totalDistance+=a[O].dist(a[O+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var k=w8[u.type]==="Polygon",G=a.length;G>=2&&a[G-1].equals(a[G-2]);)G--;for(var J=0;J<G-1&&a[J].equals(a[J+1]);)J++;if(!(G<(k?3:2))){p==="bevel"&&(C=1.05);var Q,ie=this.overscaling<=16?122880/(512*this.overscaling):0,fe=this.segments.prepareSegment(10*G,this.layoutVertexArray,this.indexArray),ye=void 0,ke=void 0,Ne=void 0,He=void 0;this.e1=this.e2=-1,k&&(He=a[J].sub(Q=a[G-2])._unit()._perp());for(var Ge=J;Ge<G;Ge++)if(!(ke=Ge===G-1?k?a[J+1]:void 0:a[Ge+1])||!a[Ge].equals(ke)){He&&(Ne=He),Q&&(ye=Q),Q=a[Ge],He=ke?ke.sub(Q)._unit()._perp():Ne;var Ke=(Ne=Ne||He).add(He);Ke.x===0&&Ke.y===0||Ke._unit();var lt=Ne.x*He.x+Ne.y*He.y,mt=Ke.x*He.x+Ke.y*He.y,yt=mt!==0?1/mt:1/0,Ot=2*Math.sqrt(2-2*mt),Ht=mt<T8&&ye&&ke,Kt=Ne.x*He.y-Ne.y*He.x>0;if(Ht&&Ge>J){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 Sr=ye&&ke,ir=Sr?p:k?"butt":x;if(Sr&&ir==="round"&&(yt<B?ir="miter":yt<=2&&(ir="fakeround")),ir==="miter"&&yt>C&&(ir="bevel"),ir==="bevel"&&(yt>2&&(ir="flipbevel"),yt<C&&(ir="miter")),ye&&this.updateDistance(ye,Q),ir==="miter")Ke._mult(yt),this.addCurrentVertex(Q,Ke,0,0,fe);else if(ir==="flipbevel"){if(yt>100)Ke=He.mult(-1);else{var sn=yt*Ne.add(He).mag()/Ne.sub(He).mag();Ke._perp()._mult(sn*(Kt?-1:1))}this.addCurrentVertex(Q,Ke,0,0,fe),this.addCurrentVertex(Q,Ke.mult(-1),0,0,fe)}else if(ir==="bevel"||ir==="fakeround"){var Lr=-Math.sqrt(yt*yt-1),hr=Kt?Lr:0,hn=Kt?0:Lr;if(ye&&this.addCurrentVertex(Q,Ne,hr,hn,fe),ir==="fakeround")for(var Kr=Math.round(180*Ot/Math.PI/20),bn=1;bn<Kr;bn++){var Ir=bn/Kr;if(Ir!==.5){var Tn=Ir-.5;Ir+=Ir*Tn*(Ir-1)*((1.0904+lt*(lt*(3.55645-1.43519*lt)-3.2452))*Tn*Tn+(.848013+lt*(.215638*lt-1.06021)))}var ii=He.sub(Ne)._mult(Ir)._add(Ne)._unit()._mult(Kt?-1:1);this.addHalfVertex(Q,ii.x,ii.y,!1,Kt,0,fe)}ke&&this.addCurrentVertex(Q,He,-hr,-hn,fe)}else if(ir==="butt")this.addCurrentVertex(Q,Ke,0,0,fe);else if(ir==="square"){var Ei=ye?1:-1;this.addCurrentVertex(Q,Ke,Ei,Ei,fe)}else ir==="round"&&(ye&&(this.addCurrentVertex(Q,Ne,0,0,fe),this.addCurrentVertex(Q,Ne,1,1,fe,!0)),ke&&(this.addCurrentVertex(Q,He,-1,-1,fe,!0),this.addCurrentVertex(Q,He,0,0,fe)));if(Ht&&Ge<G-1){var vi=Q.dist(ke);if(vi>2*ie){var si=Q.add(ke.sub(Q)._mult(ie/vi)._round());this.updateDistance(Q,si),this.addCurrentVertex(si,He,0,0,fe),Q=si}}}}},Xs.prototype.addCurrentVertex=function(a,u,p,x,C,B){B===void 0&&(B=!1);var O=u.y*x-u.x,k=-u.y-u.x*x;this.addHalfVertex(a,u.x+u.y*p,u.y-u.x*p,B,!1,p,C),this.addHalfVertex(a,O,k,B,!0,-
2097x,C),this.distance>WT/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(a,u,p,x,C,B))},Xs.prototype.addHalfVertex=function(a,u,p,x,C,B,O){var k=.5*(this.lineClips?this.scaledDistance*(WT-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((a.x<<1)+(x?1:0),(a.y<<1)+(C?1:0),Math.round(63*u)+128,Math.round(63*p)+128,1+(B===0?0:B<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 G=O.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,G),O.primitiveLength++),C?this.e2=G:this.e1=G},Xs.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Xs.prototype.updateDistance=function(a,u){this.distance+=a.dist(u),this.updateScaledDistance()},or("LineBucket",Xs,{omit:["layers","patternFeatures"]});var E8=new qn({"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"])}),$T={paint:new qn({"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 bu(ae.paint_line["line-pattern"]),"line-gradient":new Ji(ae.paint_line["line-gradient"])}),layout:E8},XT=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 jr(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,C,B){return x=j({},x,{zoom:Math.floor(x.zoom)}),a.prototype.evaluate.call(this,p,x,C,B)},u})(ur))($T.paint.properties["line-width"].specification);XT.useIntegerZoom=!0;var C8=(function(a){function u(p){a.call(this,p,$T),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 Vn,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"]=XT.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,p)},u.prototype.createBucket=function(p){return new Xs(p)},u.prototype.queryRadius=function(p){var x=p,C=qT(Pa("line-width",this,x),Pa("line-gap-width",this,x)),B=Pa("line-offset",this,x);return C/2+Math.abs(B)+Zi(this.paint.get("line-translate"))},u.prototype.queryIntersectsFeature=function(p,x,C,B,O,k,G){var J=il(p,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,G),Q=G/2*qT(this.paint.get("line-width").evaluate(x,C),this.paint.get("line-gap-width").evaluate(x,C)),ie=this.paint.get("line-offset").evaluate(x,C);return ie&&(B=(function(fe,ye){for(var ke=[],Ne=new v(0,0),He=0;He<fe.length;He++){for(var Ge=fe[He],Ke=[],lt=0;lt<Ge.length;lt++){var mt=Ge[lt],yt=Ge[lt+1],Ot=lt===0?Ne:mt.sub(Ge[lt-1])._unit()._perp(),Ht=lt===Ge.length-1?Ne:yt.sub(mt)._unit()._perp(),Kt=Ot._add(Ht)._unit();Kt._mult(1/(Kt.x*Ht.x+Kt.y*Ht.y)),Ke.push(Kt._mult(ye)._add(mt))}ke.push(Ke)}return ke})(B,ie*G)),(function(fe,ye,ke){for(var Ne=0;Ne<ye.length;Ne++){var He=ye[Ne];if(fe.length>=3){for(var Ge=0;Ge<He.length;Ge++)if(Ba(fe,He[Ge]))return!0}if(Fo(fe,He,ke))return!0}return!1})(J,B,Q)},u.prototype.isTileClipped=function(){return!0},u})(zr);function qT(a,u){return u>0?u+2*a:a}var S8=ki([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),I8=ki([{name:"a_projected_pos",components:3,type:"Float32"}],4),B8=(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"}])),JT=(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)),P8=ki([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function M8(a,u,p){return a.sections.forEach((function(x){x.text=(function(C,B,O){var k=B.layout.get("text-transform").evaluate(O,{});return k==="uppercase"?C=C.toLocaleUpperCase():k==="lowercase"&&(C=C.toLocaleLowerCase()),is.applyArabicShaping&&(C=is.applyArabicShaping(C)),C})(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 $p={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},KT=function(a,u,p,x,C){var B,O,k=8*C-x-1,G=(1<<k)-1,J=G>>1,Q=-7,ie=C-1,fe=-1,ye=a[u+ie];for(ie+=fe,B=ye&(1<<-Q)-1,ye>>=-Q,Q+=k;Q>0;B=256*B+a[u+ie],ie+=fe,Q-=8);for(O=B&(1<<-Q)-1,B>>=-Q,Q+=x;Q>0;O=256*O+a[u+ie],ie+=fe,Q-=8);if(B===0)B=1-J;else{if(B===G)return O?NaN:1/0*(ye?-1:1);O+=Math.pow(2,x),B-=J}return(ye?-1:1)*O*Math.pow(2,B-x)},ZT=function(a,u,p,x,C,B){var O,k,G,J=8*B-C-1,Q=(1<<J)-1,ie=Q>>1,fe=C===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,O=Q):(O=Math.floor(Math.log(u)/Math.LN2),u*(G=Math.pow(2,-O))<1&&(O--,G*=2),(u+=O+ie>=1?fe/G:fe*Math.pow(2,1-ie))*G>=2&&(O++,G/=2),O+ie>=Q?(k=0,O=Q):O+ie>=1?(k=(u*G-1)*Math.pow(2,C),O+=ie):(k=u*Math.pow(2,ie-1)*Math.pow(2,C),O=0));C>=8;a[p+ye]=255&k,ye+=ke,k/=256,C-=8);for(O=O<<C|k,J+=C;J>0;a[p+ye]=255&O,ye+=ke,O/=256,J-=8);a[p+ye-ke]|=128*Ne},kg=Jn;function Jn(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}Jn.Varint=0,Jn.Fixed64=1,Jn.Bytes=2,Jn.Fixed32=5;var YT=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Oc(a){return a.type===Jn.Bytes?a.readVarint()+a.pos:a.pos+1}function Uh(a,u,p){return p?4294967296*u+(a>>>0):4294967296*(u>>>0)+(a>>>0)}function QT(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 C=p.pos-1;C>=a;C--)p.buf[C+x]=p.buf[C]}function R8(a,u){for(var p=0;p<a.length;p++)u.writeVarint(a[p])}function O8(a,u){for(var p=0;p<a.length;p++)u.writeSVarint(a[p])}function D8(a,u){for(var p=0;p<a.length;p++)u.writeFloat(a[p])}function F8(a,u){for(var p=0;p<a.length;p++)u.writeDouble(a[p])}function L8(a,u){for(var p=0;p<a.length;p++)u.writeBoolean(a[p])}function k8(a,u){for(var p=0;p<a.length;p++)u.writeFixed32(a[p])}function N8(a,u){for(var p=0;p<a.length;p++)u.writeSFixed32(a[p])}function U8(a,u){for(var p=0;p<a.length;
2097p++)u.writeFixed64(a[p])}function z8(a,u){for(var p=0;p<a.length;p++)u.writeSFixed64(a[p])}function Ng(a,u){return(a[u]|a[u+1]<<8|a[u+2]<<16)+16777216*a[u+3]}function zh(a,u,p){a[p]=u,a[p+1]=u>>>8,a[p+2]=u>>>16,a[p+3]=u>>>24}function eE(a,u){return(a[u]|a[u+1]<<8|a[u+2]<<16)+(a[u+3]<<24)}function V8(a,u,p){a===1&&p.readMessage(G8,u)}function G8(a,u,p){if(a===3){var x=p.readMessage(j8,{}),C=x.width,B=x.height,O=x.left,k=x.top,G=x.advance;u.push({id:x.id,bitmap:new If({width:C+6,height:B+6},x.bitmap),metrics:{width:C,height:B,left:O,top:k,advance:G}})}}function j8(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 tE(a){for(var u=0,p=0,x=0,C=a;x<C.length;x+=1){var B=C[x];u+=B.w*B.h,p=Math.max(p,B.w)}a.sort((function(Ne,He){return He.h-Ne.h}));for(var O=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(u/.95)),p),h:1/0}],k=0,G=0,J=0,Q=a;J<Q.length;J+=1)for(var ie=Q[J],fe=O.length-1;fe>=0;fe--){var ye=O[fe];if(!(ie.w>ye.w||ie.h>ye.h)){if(ie.x=ye.x,ie.y=ye.y,G=Math.max(G,ie.y+ie.h),k=Math.max(k,ie.x+ie.w),ie.w===ye.w&&ie.h===ye.h){var ke=O.pop();fe<O.length&&(O[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):(O.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:G,fill:u/(k*G)||0}}Jn.prototype={destroy:function(){this.buf=null},readFields:function(a,u,p){for(p=p||this.length;this.pos<p;){var x=this.readVarint(),C=x>>3,B=this.pos;this.type=7&x,a(C,u,this),this.pos===B&&this.skip(x)}return u},readMessage:function(a,u){return this.readFields(a,u,this.readVarint()+this.pos)},readFixed32:function(){var a=Ng(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=eE(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=Ng(this.buf,this.pos)+4294967296*Ng(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=Ng(this.buf,this.pos)+4294967296*eE(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=KT(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=KT(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(C,B,O){var k,G,J=O.buf;if(k=(112&(G=J[O.pos++]))>>4,G<128||(k|=(127&(G=J[O.pos++]))<<3,G<128)||(k|=(127&(G=J[O.pos++]))<<10,G<128)||(k|=(127&(G=J[O.pos++]))<<17,G<128)||(k|=(127&(G=J[O.pos++]))<<24,G<128)||(k|=(1&(G=J[O.pos++]))<<31,G<128))return Uh(C,k,B);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&&YT?(function(p,x,C){return YT.decode(p.subarray(x,C))})(this.buf,u,a):(function(p,x,C){for(var B="",O=x;O<C;){var k,G,J,Q=p[O],ie=null,fe=Q>239?4:Q>223?3:Q>191?2:1;if(O+fe>C)break;fe===1?Q<128&&(ie=Q):fe===2?(192&(k=p[O+1]))==128&&(ie=(31&Q)<<6|63&k)<=127&&(ie=null):fe===3?(G=p[O+2],(192&(k=p[O+1]))==128&&(192&G)==128&&((ie=(15&Q)<<12|(63&k)<<6|63&G)<=2047||ie>=55296&&ie<=57343)&&(ie=null)):fe===4&&(G=p[O+2],J=p[O+3],(192&(k=p[O+1]))==128&&(192&G)==128&&(192&J)==128&&((ie=(15&Q)<<18|(63&k)<<12|(63&G)<<6|63&J)<=65535||ie>=1114112)&&(ie=null)),ie===null?(ie=65533,fe=1):ie>65535&&(ie-=65536,B+=String.fromCharCode(ie>>>10&1023|55296),ie=56320|1023&ie),B+=String.fromCharCode(ie),O+=fe}return B})(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!==Jn.Bytes)return a.push(this.readVarint(u));var p=Oc(this);for(a=a||[];this.pos<p;)a.push(this.readVarint(u));return a}
vendor: 11,225 bytes, line 2097
2097,readPackedSVarint:function(a){if(this.type!==Jn.Bytes)return a.push(this.readSVarint());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readSVarint());return a},readPackedBoolean:function(a){if(this.type!==Jn.Bytes)return a.push(this.readBoolean());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readBoolean());return a},readPackedFloat:function(a){if(this.type!==Jn.Bytes)return a.push(this.readFloat());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readFloat());return a},readPackedDouble:function(a){if(this.type!==Jn.Bytes)return a.push(this.readDouble());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readDouble());return a},readPackedFixed32:function(a){if(this.type!==Jn.Bytes)return a.push(this.readFixed32());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readFixed32());return a},readPackedSFixed32:function(a){if(this.type!==Jn.Bytes)return a.push(this.readSFixed32());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readSFixed32());return a},readPackedFixed64:function(a){if(this.type!==Jn.Bytes)return a.push(this.readFixed64());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readFixed64());return a},readPackedSFixed64:function(a){if(this.type!==Jn.Bytes)return a.push(this.readSFixed64());var u=Oc(this);for(a=a||[];this.pos<u;)a.push(this.readSFixed64());return a},skip:function(a){var u=7&a;if(u===Jn.Varint)for(;this.buf[this.pos++]>127;);else if(u===Jn.Bytes)this.pos=this.readVarint()+this.pos;else if(u===Jn.Fixed32)this.pos+=4;else{if(u!==Jn.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),zh(this.buf,a,this.pos),this.pos+=4},writeSFixed32:function(a){this.realloc(4),zh(this.buf,a,this.pos),this.pos+=4},writeFixed64:function(a){this.realloc(8),zh(this.buf,-1&a,this.pos),zh(this.buf,Math.floor(a*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(a){this.realloc(8),zh(this.buf,-1&a,this.pos),zh(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,C;if(u>=0?(x=u%4294967296|0,C=u/4294967296|0):(C=~(-u/4294967296),4294967295^(x=~(-u%4294967296))?x=x+1|0:(x=0,C=C+1|0)),u>=18446744073709552e3||u<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");p.realloc(10),(function(B,O,k){k.buf[k.pos++]=127&B|128,B>>>=7,k.buf[k.pos++]=127&B|128,B>>>=7,k.buf[k.pos++]=127&B|128,B>>>=7,k.buf[k.pos++]=127&B|128,k.buf[k.pos]=127&(B>>>=7)})(x,0,p),(function(B,O){var k=(7&B)<<4;O.buf[O.pos++]|=k|((B>>>=3)?128:0),B&&(O.buf[O.pos++]=127&B|((B>>>=7)?128:0),B&&(O.buf[O.pos++]=127&B|((B>>>=7)?128:0),B&&(O.buf[O.pos++]=127&B|((B>>>=7)?128:0),B&&(O.buf[O.pos++]=127&B|((B>>>=7)?128:0),B&&(O.buf[O.pos++]=127&B)))))})(C,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,C,B){for(var O,k,G=0;G<C.length;G++){if((O=C.charCodeAt(G))>55295&&O<57344){if(!k){O>56319||G+1===C.length?(x[B++]=239,x[B++]=191,x[B++]=189):k=O;continue}if(O<56320){x[B++]=239,x[B++]=191,x[B++]=189,k=O;continue}O=k-55296<<10|O-56320|65536,k=null}else k&&(x[B++]=239,x[B++]=191,x[B++]=189,k=null);O<128?x[B++]=O:(O<2048?x[B++]=O>>6|192:(O<65536?x[B++]=O>>12|224:(x[B++]=O>>18|240,x[B++]=O>>12&63|128),x[B++]=O>>6&63|128),x[B++]=63&O|128)}return B})(this.buf,a,this.pos);var p=this.pos-u;p>=128&&QT(u,p,this),this.pos=u-1,this.writeVarint(p),this.pos+=p},writeFloat:function(a){this.realloc(4),ZT(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),ZT(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&&QT(p,x,this),this.pos=p-1,this.writeVarint(x),this.pos+=x},writeMessage:function(a,u,p){this.writeTag(a,Jn.Bytes),this.writeRawMessage(u,p)},writePackedVarint:function(a,u){u.length&&this.writeMessage(a,R8,u)},writePackedSVarint:function(a,u){u.length&&this.writeMessage(a,O8,u)},writePackedBoolean:function(a,u){u.length&&this.writeMessage(a,L8,u)},writePackedFloat:function(a,u){u.length&&this.writeMessage(a,D8,u)},writePackedDouble:function(a,u){u.length&&this.writeMessage(a,F8,u)},writePackedFixed32:function(a,u){u.length&&this.writeMessage(a,k8,u)},writePackedSFixed32:function(a,u){u.length&&this.writeMessage(a,N8,u)},writePackedFixed64:function(a,u){u.length&&this.writeMessage(a,U8,u)},writePackedSFixed64:function(a,u){u.length&&this.writeMessage(a,z8,u)},writeBytesField:function(a,u){this.writeTag(a,Jn.Bytes),this.writeBytes(u)},writeFixed32Field:function(a,u){this.writeTag(a,Jn.Fixed32),this.writeFixed32(u)},writeSFixed32Field:function(a,u){this.writeTag(a,Jn.Fixed32),this.writeSFixed32(u)},writeFixed64Field:function(a,u){this.writeTag(a,Jn.Fixed64),this.writeFixed64(u)},writeSFixed64Field:function(a,u){this.writeTag(a,Jn.Fixed64),this.writeSFixed64(u)},writeVarintField:function(a,u){this.writeTag(a,Jn.Varint),this.writeVarint(u)},writeSVarintField:function(a,u){this.writeTag(a,Jn.Varint),this.writeSVarint(u)},writeStringField:function(a,u){this.writeTag(a,Jn.Bytes),this.writeString(u)},writeFloatField:function(a,u){this.writeTag(a,Jn.Fixed32),this.writeFloat(u)},writeDoubleField:function(a,u){this.writeTag(a,Jn.Fixed64),this.writeDouble(u)},writeBooleanField:function(a,u){this.writeVarintField(a,!!u)}};var Ug=function(a,u){var p=u.pixelRatio,x=u.version,C=u.stretchX,B=u.stretchY,O=u.content;this.paddedRect=a,this.pixelRatio=p,this.stretchX=C,this.stretchY=B,this.content=O,this.version=x},Xp={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};Xp.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Xp.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Xp.tlbr.get=function(){return this.tl.concat(this.br)},Xp.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Ug.prototype,Xp);var qp=function(a,u){var p={},x={};this.haveRenderCallbacks=[];var C=[];this.addImages(a,p,C),this.addImages(u,x,C);var B=tE(C),O=new lo({width:B.w||1,height:B.h||1});for(var k in a){var G=a[k],J=p[k].paddedRect;lo.copy(G.data,O,{x:0,y:0},{x:J.x+1,y:J.y+1},G.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,He=ie.data.height;lo.copy(ie.data,O,{x:0,y:0},{x:ye,y:ke},ie.data),lo.copy(ie.data,O,{x:0,y:He-1},{x:ye,y:ke-1},{width:Ne,height:1}),lo.copy(ie.data,O,{x:0,y:0},{x:ye,y:ke+He},{width:Ne,height:1}),lo.copy(ie.data,O,{x:Ne-1,y:0},{x:ye-1,y:ke},{width:1,height:He}),lo.copy(ie.data,O,{x:0,y:0},{x:ye+Ne,y:ke},{width:1,height:He})}this.image=O,this.iconPositions=p,this.patternPositions=x};qp.prototype.addImages=function(a,u,p){for(var x in a){var C=a[x],B={x:0,y:0,w:C.data.width+2,h:C.data.height+2};p.push(B),u[x]=new Ug(B,C),C.hasRenderCallback&&this.haveRenderCallbacks.push(x)}},qp.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)},qp.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",Ug),or("ImageAtlas",qp);var Lo={horizontal:1,vertical:2,horizontalOnly:3},Vh=function(){this.scale=1,this.fontStack="",this.imageName=null};Vh.forText=function(a,u){var p=new Vh;return p.scale=a||1,p.fontStack=u,p},Vh.forImage=function(a){var u=new Vh;return u.imageName=a,u};var Rs=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function zg(a,u,p,x,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne){var He,Ge=Rs.fromFeature(a,C);ie===Lo.vertical&&Ge.verticalizePunctuation();var Ke=is.processBidirectionalText,lt=is.processStyledBidirectionalText;if(Ke&&Ge.sections.length===1){He=[];for(var mt=0,yt=Ke(Ge.toString(),Ry(Ge,J,B,u,x,ye,ke));mt<yt.length;mt+=1){var Ot=yt[mt],Ht=new Rs;Ht.text=Ot,Ht.sections=Ge.sections;for(var Kt=0;Kt<Ot.length;Kt++)Ht.sectionIndex.push(0);He.push(Ht)}}else if(lt){He=[];for(var br=0,nr=lt(Ge.text,Ge.sectionIndex,Ry(Ge,J,B,u,x,ye,ke));br<nr.length;br+=1){var Sr=nr[br],ir=new Rs;ir.text=Sr[0],ir.sectionIndex=Sr[1],ir.sections=Ge.sections,He.push(ir)}}else He=(function(hr,hn){for(var Kr=[],bn=hr.text,Ir=0,Tn=0,ii=hn;Tn<ii.length;Tn+=1){var Ei=ii[Tn];Kr.push(hr.substring(Ir,Ei)),Ir=Ei}return Ir<bn.length&&Kr.push(hr.substring(Ir,bn.length)),Kr})(Ge,Ry(Ge,J,B,u,x,ye,ke));var sn=[],Lr={positionedLines:sn,text:Ge.toString(),top:Q[1],bottom:Q[1],left:Q[0],right:Q[0],writingMode:ie,iconsInText:!1,verticalizable:!1};return(function(hr,hn,Kr,bn,Ir,Tn,ii,Ei,vi,si,Ci,Yi){for(var Qi=0,Os=-17,cs=0,Ds=0,Bi=Ei==="right"?1:Ei==="left"?0:.5,us=0,gn=0,Nn=Ir;gn<Nn.length;gn+=1){var Pn=Nn[gn];Pn.trim();var wn=Pn.getMaxScale(),qs=24*(wn-1),bs={positionedGlyphs:[],lineOffset:0};hr.positionedLines[us]=bs;var ei=bs.positionedGlyphs,Ni=0;if(Pn.length()){for(var xs=0;xs<Pn.length();xs++){var En=Pn.getSection(xs),Wl=Pn.getSectionIndex(xs),ko=Pn.getCharCode(xs),$l=0,Pi=null,Xl=null,Ma=null,Jh=24,Rf=!(vi===Lo.horizontal||!Ci&&!_u(ko)||Ci&&(Vg[ko]||(kc=ko,Zt.Arabic(kc)||Zt["Arabic Supplement"](kc)||Zt["Arabic Extended-A"](kc)||Zt["Arabic Presentation Forms-A"](kc)||Zt["Arabic Presentation Forms-B"](kc))));if(En.imageName){var Kh=bn[En.imageName];if(!Kh)continue;Ma=En.imageName,hr.iconsInText=hr.iconsInText||!0,Xl=Kh.paddedRect;var Lc=Kh.displaySize;En.scale=24*En.scale/Yi,$l=qs+(24-Lc[1]*En.scale),Jh=(Pi={width:Lc[0],height:Lc[1],left:1,top:-3,advance:Rf?Lc[1]:Lc[0]}).advance;var Zh=Rf?Lc[0]*En.scale-24*wn:Lc[1]*En.scale-24*wn;Zh>0&&Zh>Ni&&(Ni=Zh)}else{var Kg=Kr[En.fontStack],Yh=Kg&&Kg[ko];if(Yh&&Yh.rect)Xl=Yh.rect,Pi=Yh.metrics;else{var Zp=hn[En.fontStack],Zg=Zp&&Zp[ko];if(!Zg)continue;Pi=Zg.metrics}$l=24*(wn-En.scale)}Rf?(hr.verticalizable=!0,ei.push({glyph:ko,imageName:Ma,x:Qi,y:Os+$l,vertical:Rf,scale:En.scale,fontStack:En.fontStack,sectionIndex:Wl,metrics:Pi,rect:Xl}),Qi+=Jh*En.scale+si):(ei.push({glyph:ko,imageName:Ma,x:Qi,y:Os+$l,vertical:Rf,scale:En.scale,fontStack:En.fontStack,sectionIndex:Wl,metrics:Pi,rect:Xl}),Qi+=Pi.advance*En.scale+si)}ei.length!==0&&(cs=Math.max(Qi-si,cs),W8(ei,0,ei.length-1,Bi,Ni)),Qi=0;var Yg=Tn*wn+Ni;bs.lineOffset=Math.max(Ni,qs),Os+=Yg,Ds=Math.max(Yg,Ds),++us}else Os+=Tn,++us}var kc,Yp=Os- -17,Qh=Oy(ii),Iu=Qh.horizontalAlign,ed=Qh.verticalAlign;
2097(function(Qg,e0,Qp,eA,t0,tA,rA,nA,r0){var td,n0=(e0-Qp)*t0;td=tA!==rA?-nA*eA- -17:(-eA*r0+.5)*rA;for(var rd=0,iA=Qg;rd<iA.length;rd+=1)for(var Of=0,sA=iA[rd].positionedGlyphs;Of<sA.length;Of+=1){var nd=sA[Of];nd.x+=n0,nd.y+=td}})(hr.positionedLines,Bi,Iu,ed,cs,Ds,Tn,Yp,Ir.length),hr.top+=-ed*Yp,hr.bottom=hr.top+Yp,hr.left+=-Iu*cs,hr.right=hr.left+cs})(Lr,u,p,x,He,O,k,G,ie,J,fe,Ne),!(function(hr){for(var hn=0,Kr=hr;hn<Kr.length;hn+=1)if(Kr[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 C=a.sections[x];C.image?p.addImageSection(C):p.addTextSection(C,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,C=a.charCodeAt(p-1)||null;u+=x&&vf(x)&&!$p[a[p+1]]||C&&vf(C)&&!$p[a[p-1]]||!$p[a[p]]?a[p]:$p[a[p]]}return u})(this.text)},Rs.prototype.trim=function(){for(var a=0,u=0;u<this.text.length&&Vg[this.text.charCodeAt(u)];u++)a++;for(var p=this.text.length,x=this.text.length-1;x>=0&&x>=a&&Vg[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)}),0)},Rs.prototype.addTextSection=function(a,u){this.text+=a.text,this.sections.push(Vh.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(Vh.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 Vg={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},So={};function rE(a,u,p,x,C,B){if(u.imageName){var O=x[u.imageName];return O?O.displaySize[0]*u.scale*24/B+C:0}var k=p[u.fontStack],G=k&&k[a];return G?G.metrics.advance*u.scale+C:0}function nE(a,u,p,x){var C=Math.pow(a-u,2);return x?a<u?C/2:2*C:C+Math.abs(p)*p}function H8(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 iE(a,u,p,x,C,B){for(var O=null,k=nE(u,p,C,B),G=0,J=x;G<J.length;G+=1){var Q=J[G],ie=nE(u-Q.x,p,C,B)+Q.badness;ie<=k&&(O=Q,k=ie)}return{index:a,x:u,priorBreak:O,badness:k}}function Ry(a,u,p,x,C,B,O){if(B!=="point")return[];if(!a)return[];for(var k,G=[],J=(function(He,Ge,Ke,lt,mt,yt){for(var Ot=0,Ht=0;Ht<He.length();Ht++){var Kt=He.getSection(Ht);Ot+=rE(He.getCharCode(Ht),Kt,lt,mt,Ge,yt)}return Ot/Math.max(1,Math.ceil(Ot/Ke))})(a,u,p,x,C,O),Q=a.text.indexOf("â")>=0,ie=0,fe=0;fe<a.length();fe++){var ye=a.getSection(fe),ke=a.getCharCode(fe);if(Vg[ke]||(ie+=rE(ke,ye,x,C,u,O)),fe<a.length()-1){var Ne=!((k=ke)<11904||!(Zt["Bopomofo Extended"](k)||Zt.Bopomofo(k)||Zt["CJK Compatibility Forms"](k)||Zt["CJK Compatibility Ideographs"](k)||Zt["CJK Compatibility"](k)||Zt["CJK Radicals Supplement"](k)||Zt["CJK Strokes"](k)||Zt["CJK Symbols and Punctuation"](k)||Zt["CJK Unified Ideographs Extension A"](k)||Zt["CJK Unified Ideographs"](k)||Zt["Enclosed CJK Letters and Months"](k)||Zt["Halfwidth and Fullwidth Forms"](k)||Zt.Hiragana(k)||Zt["Ideographic Description Characters"](k)||Zt["Kangxi Radicals"](k)||Zt["Katakana Phonet
2097ic Extensions"](k)||Zt.Katakana(k)||Zt["Vertical Forms"](k)||Zt["Yi Radicals"](k)||Zt["Yi Syllables"](k)));(So[ke]||Ne||ye.imageName)&&G.push(iE(fe+1,ie,J,G,H8(ke,a.getCharCode(fe+1),Ne&&Q),!1))}}return(function He(Ge){return Ge?He(Ge.priorBreak).concat(Ge.index):[]})(iE(a.length(),ie,J,G,0,!0))}function Oy(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 W8(a,u,p,x,C){if(x||C)for(var B=a[p],O=(a[p].x+B.metrics.advance*B.scale)*x,k=u;k<=p;k++)a[k].x-=O,a[k].y+=C}function sE(a,u,p,x,C,B){var O,k=a.image;if(k.content){var G=k.content,J=k.pixelRatio||1;O=[G[0]/J,G[1]/J,k.displaySize[0]-G[2]/J,k.displaySize[1]-G[3]/J]}var Q,ie,fe,ye,ke=u.left*B,Ne=u.right*B;p==="width"||p==="both"?(ye=C[0]+ke-x[3],ie=C[0]+Ne+x[1]):ie=(ye=C[0]+(ke+Ne-k.displaySize[0])/2)+k.displaySize[0];var He=u.top*B,Ge=u.bottom*B;return p==="height"||p==="both"?(Q=C[1]+He-x[0],fe=C[1]+Ge+x[2]):fe=(Q=C[1]+(He+Ge-k.displaySize[1])/2)+k.displaySize[1],{image:k,top:Q,right:ie,bottom:fe,left:ye,collisionPadding:O}}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 Gh=(function(a){function u(p,x,C,B){a.call(this,p,x),this.angle=C,B!==void 0&&(this.segment=B)}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 Dy(a,u){var p=u.expression;if(p.kind==="constant")return{kind:"constant",layoutSize:p.evaluate(new jr(a+1))};if(p.kind==="source")return{kind:"source"};for(var x=p.zoomStops,C=p.interpolationType,B=0;B<x.length&&x[B]<=a;)B++;for(var O=B=Math.max(0,B-1);O<x.length&&x[O]<a+1;)O++;O=Math.min(x.length-1,O);var k=x[B],G=x[O];return p.kind==="composite"?{kind:"composite",minZoom:k,maxZoom:G,interpolationType:C}:{kind:"camera",minZoom:k,maxZoom:G,minSize:p.evaluate(new jr(k)),maxSize:p.evaluate(new jr(G)),interpolationType:C}}function oE(a,u,p){var x=u.uSize,C=p.lowerSize;return a.kind==="source"?C/128:a.kind==="composite"?hi(C/128,p.upperSize/128,u.uSizeT):x}function aE(a,u){var p=0,x=0;if(a.kind==="constant")x=a.layoutSize;else if(a.kind!=="source"){var C=a.interpolationType,B=C?$(zi.interpolationFactor(C,u,a.minZoom,a.maxZoom),0,1):0;a.kind==="camera"?x=hi(a.minSize,a.maxSize,B):p=B}return{uSizeT:p,uSize:x}}or("Anchor",Gh);var $8=Object.freeze({__proto__:null,getSizeData:Dy,evaluateSizeForFeature:oE,evaluateSizeForZoom:aE,SIZE_PACK_FACTOR:128});function lE(a,u,p,x,C){if(u.segment===void 0)return!0;for(var B=u,O=u.segment+1,k=0;k>-p/2;){if(--O<0)return!1;k-=a[O].dist(B),B=a[O]}k+=a[O].dist(a[O+1]),O++;for(var G=[],J=0;k<p/2;){var Q=a[O],ie=a[O+1];if(!ie)return!1;var fe=a[O-1].angleTo(Q)-Q.angleTo(ie);for(fe=Math.abs((fe+3*Math.PI)%(2*Math.PI)-Math.PI),G.push({distance:k,angleDelta:fe}),J+=fe;k-G[0].distance>x;)J-=G.shift().angleDelta;if(J>C)return!1;O++,k+=Q.dist(ie)}return!0}function cE(a){for(var u=0,p=0;p<a.length-1;p++)u+=a[p].dist(a[p+1]);return u}function uE(a,u,p){return a?.6*u*p:0}function fE(a,u){return Math.max(a?a.right-a.left:0,u?u.right-u.left:0)}function X8(a,u,p,x,C,B){for(var O=uE(p,C,B),k=fE(p,x)*B,G=0,J=cE(a)/2,Q=0;Q<a.length-1;Q++){var ie=a[Q],fe=a[Q+1],ye=ie.dist(fe);if(G+ye>J){var ke=(J-G)/ye,Ne=hi(ie.x,fe.x,ke),He=hi(ie.y,fe.y,ke),Ge=new Gh(Ne,He,fe.angleTo(ie),Q);return Ge._round(),!O||lE(a,Ge,k,O,u)?Ge:void 0}G+=ye}}function q8(a,u,p,x,C,B,O,k,G){var J=uE(x,B,O),Q=fE(x,C),ie=Q*O,fe=a[0].x===0||a[0].x===G||a[0].y===0||a[0].y===G;return u-ie<u/4&&(u=ie+u/4),(function ye(ke,Ne,He,Ge,Ke,lt,mt,yt,Ot){for(var Ht=lt/2,Kt=cE(ke),br=0,nr=Ne-He,Sr=[],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+He<br+hr;){var Kr=((nr+=He)-br)/hr,bn=hi(sn.x,Lr.x,Kr),Ir=hi(sn.y,Lr.y,Kr);if(bn>=0&&bn<Ot&&Ir>=0&&Ir<Ot&&nr-Ht>=0&&nr+Ht<=Kt){var Tn=new Gh(bn,Ir,hn,ir);Tn._round(),Ge&&!lE(ke,Tn,lt,Ge,Ke)||Sr.push(Tn)}}br+=hr}return yt||Sr.length||mt||(Sr=ye(ke,br/2,He,Ge,Ke,lt,mt,!0,Ot)),Sr})(a,fe?u/2*k%u:(Q/2+2*B)*O*k%u,u,J,p,ie,fe,!1,G)}function hE(a,u,p,x,C){for(var B=[],O=0;O<a.length;O++)for(var k=a[O],G=void 0,J=0;J<k.length-1;J++){var Q=k[J],ie=k[J+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>=C&&ie.y>=C||(Q.y>=C?Q=new v(Q.x+(C-Q.y)/(ie.y-Q.y)*(ie.x-Q.x),C)._round():ie.y>=C&&(ie=new v(Q.x+(C-Q.y)/(ie.y-Q.y)*(ie.x-Q.x),C)._round()),G&&Q.equals(G[G.length-1])||B.push(G=[Q]),G.push(ie)))))}return B}function dE(a,u,p,x){var C=[],B=a.image,O=B.pixelRatio,k=B.paddedRect.w-2,G=B.paddedRect.h-2,J=a.right-a.left,Q=a.bottom-a.top,ie=B.stretchX||[[0,k]],fe=B.stretchY||[[0,G]],ye=function(bn,Ir){return bn+Ir[1]-Ir[0]}
vendor: 26,948 bytes, line 2097
2097,ke=ie.reduce(ye,0),Ne=fe.reduce(ye,0),He=k-ke,Ge=G-Ne,Ke=0,lt=ke,mt=0,yt=Ne,Ot=0,Ht=He,Kt=0,br=Ge;if(B.content&&x){var nr=B.content;Ke=Gg(ie,0,nr[0]),mt=Gg(fe,0,nr[1]),lt=Gg(ie,nr[0],nr[2]),yt=Gg(fe,nr[1],nr[3]),Ot=nr[0]-Ke,Kt=nr[1]-mt,Ht=nr[2]-nr[0]-lt,br=nr[3]-nr[1]-yt}var Sr=function(bn,Ir,Tn,ii){var Ei=jg(bn.stretch-Ke,lt,J,a.left),vi=Hg(bn.fixed-Ot,Ht,bn.stretch,ke),si=jg(Ir.stretch-mt,yt,Q,a.top),Ci=Hg(Ir.fixed-Kt,br,Ir.stretch,Ne),Yi=jg(Tn.stretch-Ke,lt,J,a.left),Qi=Hg(Tn.fixed-Ot,Ht,Tn.stretch,ke),Os=jg(ii.stretch-mt,yt,Q,a.top),cs=Hg(ii.fixed-Kt,br,ii.stretch,Ne),Ds=new v(Ei,si),Bi=new v(Yi,si),us=new v(Yi,Os),gn=new v(Ei,Os),Nn=new v(vi/O,Ci/O),Pn=new v(Qi/O,cs/O),wn=u*Math.PI/180;if(wn){var qs=Math.sin(wn),bs=Math.cos(wn),ei=[bs,-qs,qs,bs];Ds._matMult(ei),Bi._matMult(ei),gn._matMult(ei),us._matMult(ei)}var Ni=bn.stretch+bn.fixed,xs=Ir.stretch+Ir.fixed;return{tl:Ds,tr:Bi,bl:gn,br:us,tex:{x:B.paddedRect.x+1+Ni,y:B.paddedRect.y+1+xs,w:Tn.stretch+Tn.fixed-Ni,h:ii.stretch+ii.fixed-xs},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Nn,pixelOffsetBR:Pn,minFontScaleX:Ht/O/J,minFontScaleY:br/O/Q,isSDF:p}};if(x&&(B.stretchX||B.stretchY))for(var ir=pE(ie,He,ke),sn=pE(fe,Ge,Ne),Lr=0;Lr<ir.length-1;Lr++)for(var hr=ir[Lr],hn=ir[Lr+1],Kr=0;Kr<sn.length-1;Kr++)C.push(Sr(hr,sn[Kr],hn,sn[Kr+1]));else C.push(Sr({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:k+1},{fixed:0,stretch:G+1}));return C}function Gg(a,u,p){for(var x=0,C=0,B=a;C<B.length;C+=1){var O=B[C];x+=Math.max(u,Math.min(p,O[1]))-Math.max(u,Math.min(p,O[0]))}return x}function pE(a,u,p){for(var x=[{fixed:-1,stretch:0}],C=0,B=a;C<B.length;C+=1){var O=B[C],k=O[0],G=O[1],J=x[x.length-1];x.push({fixed:k-J.stretch,stretch:J.stretch}),x.push({fixed:k-J.stretch,stretch:J.stretch+(G-k)})}return x.push({fixed:u+1,stretch:p}),x}function jg(a,u,p,x){return a/u*p+x}function Hg(a,u,p,x){return a-u*p/x}var Wg=function(a,u,p,x,C,B,O,k,G,J){if(this.boxStartIndex=a.length,G){var Q=B.top,ie=B.bottom,fe=B.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=B.top*O-k,Ne=B.bottom*O+k,He=B.left*O-k,Ge=B.right*O+k,Ke=B.collisionPadding;if(Ke&&(He-=Ke[0]*O,ke-=Ke[1]*O,Ge+=Ke[2]*O,Ne+=Ke[3]*O),J){var lt=new v(He,ke),mt=new v(Ge,ke),yt=new v(He,Ne),Ot=new v(Ge,Ne),Ht=J*Math.PI/180;lt._rotate(Ht),mt._rotate(Ht),yt._rotate(Ht),Ot._rotate(Ht),He=Math.min(lt.x,mt.x,yt.x,Ot.x),Ge=Math.max(lt.x,mt.x,yt.x,Ot.x),ke=Math.min(lt.y,mt.y,yt.y,Ot.y),Ne=Math.max(lt.y,mt.y,yt.y,Ot.y)}a.emplaceBack(u.x,u.y,He,ke,Ge,Ne,p,x,C)}this.boxEndIndex=a.length},jh=function(a,u){if(a===void 0&&(a=[]),u===void 0&&(u=J8),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 J8(a,u){return a<u?-1:a>u?1:0}function K8(a,u,p){p===void 0&&(p=!1);for(var x=1/0,C=1/0,B=-1/0,O=-1/0,k=a[0],G=0;G<k.length;G++){var J=k[G];(!G||J.x<x)&&(x=J.x),(!G||J.y<C)&&(C=J.y),(!G||J.x>B)&&(B=J.x),(!G||J.y>O)&&(O=J.y)}var Q=Math.min(B-x,O-C),ie=Q/2,fe=new jh([],Z8);if(Q===0)return new v(x,C);for(var ye=x;ye<B;ye+=Q)for(var ke=C;ke<O;ke+=Q)fe.push(new Hh(ye+ie,ke+ie,ie,a));for(var Ne=(function(Ke){for(var lt=0,mt=0,yt=0,Ot=Ke[0],Ht=0,Kt=Ot.length,br=Kt-1;Ht<Kt;br=Ht++){var nr=Ot[Ht],Sr=Ot[br],ir=nr.x*Sr.y-Sr.x*nr.y;mt+=(nr.x+Sr.x)*ir,yt+=(nr.y+Sr.y)*ir,lt+=3*ir}return new Hh(mt/lt,yt/lt,0,Ke)})(a),He=fe.length;fe.length;){var Ge=fe.pop();(Ge.d>Ne.d||!Ne.d)&&(Ne=Ge,p&&console.log("found best %d after %d probes",Math.round(1e4*Ge.d)/1e4,He)),Ge.max-Ne.d<=u||(fe.push(new Hh(Ge.p.x-(ie=Ge.h/2),Ge.p.y-ie,ie,a)),fe.push(new Hh(Ge.p.x+ie,Ge.p.y-ie,ie,a)),fe.push(new Hh(Ge.p.x-ie,Ge.p.y+ie,ie,a)),fe.push(new Hh(Ge.p.x+ie,Ge.p.y+ie,ie,a)),He+=4)}return p&&(console.log("num probes: "+He),console.log("best distance: "+Ne.d)),Ne.p}function Z8(a,u){return u.max-a.max}function Hh(a,u,p,x){this.p=new v(a,u),this.h=p,this.d=(function(C,B){for(var O=!1,k=1/0,G=0;G<B.length;G++)for(var J=B[G],Q=0,ie=J.length,fe=ie-1;Q<ie;fe=Q++){var ye=J[Q],ke=J[fe];ye.y>C.y!=ke.y>C.y&&C.x<(ke.x-ye.x)*(C.y-ye.y)/(ke.y-ye.y)+ye.x&&(O=!O),k=Math.min(k,Tu(C,ye,ke))}return(O?1:-1)*Math.sqrt(k)})(this.p,x),this.max=this.d+this.h*Math.SQRT2}jh.prototype.push=function(a){this.data.push(a),this.length++,this._up(this.length-1)},jh.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}},jh.prototype.peek=function(){return this.data[0]},jh.prototype._up=function(a){for(var u=this.data,p=this.compare,x=u[a];a>0;){var C=a-1>>1,B=u[C];if(p(x,B)>=0)break;u[a]=B,a=C}u[a]=x},jh.prototype._down=function(a){for(var u=this.data,p=this.compare,x=this.length>>1,C=u[a];a<x;){var B=1+(a<<1),O=u[B],k=B+1;if(k<this.length&&p(u[k],O)<0&&(B=k,O=u[k]),p(O,C)>=0)break;u[a]=O,a=B}u[a]=C};var Fy=Number.POSITIVE_INFINITY;function AE(a,u){return u[1]!==Fy?(function(p,x,C){var B=0,O=0;switch(x=Math.abs(x),C=Math.abs(C),p){case"top-right":case"top-left":case"top":O=C-7;break;case"bottom-right":case"bottom-left":case"bottom":O=7-C}switch(p){case"top-right":case"bottom-right":case"right":B=-x;break;case"top-left":case"bottom-left":case"left":B=x}return[B,O]})(a,u[0],u[1]):(function(p,x){var C=0,B=0;x<0&&(x=0);var O=x/Math.sqrt(2);switch(p){case"top-right":case"top-left":B=O-7;break;case"bottom-right":case"bottom-left":B=7-O;break;case"bottom":B=7-x;break;case"top":B=x-7}switch(p){case"top-right":case"bottom-right":C=-O;break;case"top-left":case"bottom-left":C=O;break;case"left":C=x;break;case"right":C=-x}return[C,B]})(a,u[0])}function Ly(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 gE(a,u,p,x,C,B,O,k,G,J,Q,ie,fe,ye,ke){var Ne=(function(mt,yt,Ot,Ht,Kt,br,nr,Sr){for(var ir=Ht.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],Kr=0,bn=hn.positionedGlyphs;Kr<bn.length;Kr+=1){var Ir=bn[Kr];if(Ir.rect){var Tn=Ir.rect||{},ii=4,Ei=!0,vi=1,si=0,Ci=(Kt||Sr)&&Ir.vertical,Yi=Ir.metrics.advance*Ir.scale/2;if(Sr&&yt.verticalizable&&(si=hn.lineOffset/2-(Ir.imageName?-(24-Ir.metrics.width*Ir.scale)/2:24*(Ir.scale-1))),Ir.imageName){var Qi=nr[Ir.imageName];Ei=Qi.sdf,ii=1/(vi=Qi.pixelRatio)}var Os=Kt?[Ir.x+Yi,Ir.y]:[0,0],cs=Kt?[0,0]:[Ir.x+Yi+Ot[0],Ir.y+Ot[1]-si],Ds=[0,0];Ci&&(Ds=cs,cs=[0,0]);var Bi=(Ir.metrics.left-ii)*Ir.scale-Yi+cs[0],us=(-Ir.metrics.top-ii)*Ir.scale+cs[1],gn=Bi+Tn.w*Ir.scale/vi,Nn=us+Tn.h*Ir.scale/vi,Pn=new v(Bi,us),wn=new v(gn,us),qs=new v(Bi,Nn),bs=new v(gn,Nn);if(Ci){var ei=new v(-Yi,Yi- -17),Ni=-Math.PI/2,xs=12-Yi,En=new v(22-xs,-(Ir.imageName?xs:0)),Wl=new(Function.prototype.bind.apply(v,[null].concat(Ds)));Pn._rotateAround(Ni,ei)._add(En)._add(Wl),wn._rotateAround(Ni,ei)._add(En)._add(Wl),qs._rotateAround(Ni,ei)._add(En)._add(Wl),bs._rotateAround(Ni,ei)._add(En)._add(Wl)}if(ir){var ko=Math.sin(ir),$l=Math.cos(ir),Pi=[$l,-ko,ko,$l];Pn._matMult(Pi),wn._matMult(Pi),qs._matMult(Pi),bs._matMult(Pi)}var Xl=new v(0,0),Ma=new v(0,0);sn.push({tl:Pn,tr:wn,bl:qs,br:bs,tex:Tn,writingMode:yt.writingMode,glyphOffset:Os,sectionIndex:Ir.sectionIndex,isSDF:Ei,pixelOffsetTL:Xl,pixelOffsetBR:Ma,minFontScaleX:0,minFontScaleY:0})}}return sn})(0,p,k,C,B,O,x,a.allowVerticalPlacement),He=a.textSizeData,Ge=null;He.kind==="source"?(Ge=[128*C.layout.get("text-size").evaluate(O,{})])[0]>32640&&re(a.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):He.kind==="composite"&&((Ge=[128*ye.compositeTextSizes[0].evaluate(O,{},ke),128*ye.compositeTextSizes[1].evaluate(O,{},ke)])[0]>32640||Ge[1]>32640)&&re(a.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),a.addSymbols(a.text,Ne,Ge,k,B,O,J,u,G.lineStartIndex,G.lineLength,fe,ke);for(var Ke=0,lt=Q;Ke<lt.length;Ke+=1)ie[lt[Ke]]=a.text.placedSymbolArray.length-1;return 4*Ne.length}function mE(a){for(var u in a)return a[u];return null}function Y8(a,u,p,x){var C=a.compareText;if(u in C){for(var B=C[u],O=B.length-1;O>=0;O--)if(x.dist(B[O])<p)return!0}else C[u]=[];return C[u].push(x),!1}var Q8=Nh.VectorTileFeature.types,eN=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function $g(a,u,p,x,C,B,O,k,G,J,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*C),B,O,(ye<<1)+(G?1:0),ke,16*J,16*Q,256*ie,256*fe)}function ky(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 tN(a){for(var u=0,p=a.sections;u<p.length;u+=1)if(yu(p[u].text))return!0;return!1}var Wh=function(a){this.layoutVertexArray=new Xt,this.indexArray=new ia,this.programConfigurations=a,this.segments=new Y,this.dynamicLayoutVertexArray=new rr,this.opacityVertexArray=new Vl,this.placedSymbolArray=new m};Wh.prototype.isEmpty=function(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0},Wh.prototype.upload=function(a,u,p,x){this.isEmpty()||(p&&(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,S8.members),this.indexBuffer=a.createIndexBuffer(this.indexArray,u),this.dynamicLayoutVertexBuffer=a.createVertexBuffer(this.dynamicLayoutVertexArray,I8.members,!0),this.opacityVertexBuffer=a.createVertexBuffer(this.opacityVertexArray,eN,!0),this.opacityVertexBuffer.itemSize=1),(p||x)&&this.programConfigurations.upload(a))},Wh.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",Wh);var Jp=function(a,u,p){this.layoutVertexArray=new a,this.layoutAttributes=u,this.indexArray=new p,this.segments=new Y,this.collisionVertexArray=new na};Jp.prototype.upload=function(a){this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=a.createVertexBuffer(this.collisionVertexArray,B8.members,!0)},Jp.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},or("CollisionBuffers",Jp);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(B){return B.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=Co([]),this.placementViewportMatrix=Co([]);var u=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Dy(this.zoom,u["text-size"]),this.iconSizeData=Dy(this.zoom,u["icon-size"]);var p=this.layers[0].layout,x=p.get("symbol-sort-key"),C=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=C!=="viewport-y"&&x.constantOr(1)!==void 0,this.sortFeaturesByY=(C==="viewport-y"||C==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map((function(B){return Lo[B]}))),this.stateDependentLayerIds=this.layers.filter((function(B){return B.isStateDependent()})).map((function(B){return B.id})),this.sourceID=a.sourceID};Dn.prototype.createArrays=function(){this.text=new Wh(new Fr(this.layers,this.zoom,(function(a){return/^text/.test(a)}))),this.icon=new Wh(new Fr(this.layers,this.zoom,(function(a){return/^icon/.test(a)}))),this.glyphOffsetArray=new R,this.lineVertexArray=new L,this.symbolInstances=new M},Dn.prototype.calculateGlyphDependencies=function(a,u,p,x,C){for(var B=0;B<a.length;B++)if(u[a.charCodeAt(B)]=!0,(p||x)&&C){var O=$p[a.charAt(B)];O&&(u[O.charCodeAt(0)]=!0)}},Dn.prototype.populate=function(a,u,p){var x=this.layers[0],C=x.layout,B=C.get("text-font"),O=C.get("text-field"),k=C.get("icon-image"),G=(O.value.kind!=="constant"||O.value.value instanceof ci&&!O.value.value.isEmpty()||O.value.value.toString().length>0)&&(B.value.kind!=="constant"||B.value.value.length>0),J=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,Q=C.get("symbol-sort-key");if(this.features=[],G||J){for(var ie=u.iconDependencies,fe=u.glyphDependencies,ye=u.availableImages,ke=new jr(this.zoom),Ne=0,He=a;Ne<He.length;Ne+=1){var Ge=He[Ne],Ke=Ge.feature,lt=Ge.id,mt=Ge.index,yt=Ge.sourceLayerIndex,Ot=x._featureFilter.needGeometry,Ht=Ii(Ke,Ot);if(x._featureFilter.filter(ke,Ht,p)){Ot||(Ht.geometry=yi(Ke));var Kt=void 0;if(G){var br=x.getValueAndResolveTokens("text-field",Ht,p,ye),nr=ci.factory(br);tN(nr)&&(this.hasRTLText=!0),(!this.hasRTLText||xf()==="unavailable"||this.hasRTLText&&is.isParsed())&&(Kt=M8(nr,x,Ht))}var Sr=void 0;if(J){var ir=x.getValueAndResolveTokens("icon-image",Ht,p,ye);Sr=ir instanceof Wn?ir:Wn.fromString(ir)}if(Kt||Sr){var sn=this.sortFeaturesByKey?Q.evaluate(Ht,{},p):void 0;if(this.features.push({id:lt,text:Kt,icon:Sr,index:mt,sourceLayerIndex:yt,geometry:Ht.geometry,properties:Ke.properties,type:Q8[Ke.type],sortKey:sn}),Sr&&(ie[Sr.name]=!0),Kt){var Lr=B.evaluate(Ht,{},p).join(","),hr=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Lo.vertical)>=0;for(var hn=0,Kr=Kt.sections;hn<Kr.length;hn+=1){var bn=Kr[hn];if(bn.image)ie[bn.image.name]=!0;else{var Ir=yf(Kt.toString()),Tn=bn.fontStack||Lr,ii=fe[Tn]=fe[Tn]||{};this.calculateGlyphDependencies(bn.text,ii,hr,this.allowVerticalPlacement,Ir)}}}}}}C.get("symbol-placement")==="line"&&(this.features=(function(Ei){var vi={},si={},Ci=[],Yi=0;function Qi(ei){Ci.push(Ei[ei]),Yi++}function Os(ei,Ni,xs){var En=si[ei];return delete si[ei],si[Ni]=En,Ci[En].geometry[0].pop(),Ci[En].geometry[0]=Ci[En].geometry[0].concat(xs[0]),En}function cs(ei,Ni,xs){var En=vi[Ni];return delete vi[Ni],vi[ei]=En,Ci[En].geometry[0].shift(),Ci[En].geometry[0]=xs[0].concat(Ci[En].geometry[0]),En}function Ds(ei,Ni,xs){var En=xs?Ni[0][Ni[0].length-1]:Ni[0][0];return ei+":"+En.x+":"+En.y}for(var Bi=0;Bi<Ei.length;Bi++){var us=Ei[Bi],gn=us.geometry,Nn=us.text?us.text.toString():null;if(Nn){var Pn=Ds(Nn,gn),wn=Ds(Nn,gn,!0);if(Pn in si&&wn in vi&&si[Pn]!==vi[wn]){var qs=cs(Pn,wn,gn),bs=Os(Pn,wn,Ci[qs].geometry);delete vi[Pn],delete si[wn],si[Ds(Nn,Ci[bs].geometry,!0)]=bs,Ci[qs].geometry=null}else Pn in si?Os(Pn,wn,gn):wn in vi?cs(Pn,wn,gn):(Qi(Bi),vi[Pn]=Yi-1,si[wn]=Yi-1)}else Qi(Bi)}return Ci.filter((function(ei){return ei.geometry}))})(this.features)),this.sortFeaturesByKey&&this.features.sort((function(Ei,vi){return Ei.sortKey-vi.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]),C=a.dist(u[a.segment]),B={},O=a.segment+1;O<u.length;O++)B[O]={x:u[O].x,y:u[O].y,tileUnitDistanceFromAnchor:x},O<u.length-1&&(x+=u[O+1].dist(u[O]));for(var k=a.segment||0;k>=0;k--)B[k]={x:u[k].x,y:u[k].y,tileUnitDistanceFromAnchor:C},k>0&&(C+=u[k-1].dist(u[k]));for(var G=0;G<u.length;G++){var J=B[G];this.lineVertexArray.emplaceBack(J.x,J.y,J.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}},Dn.prototype.addSymbols=function(a,u,p,x,C,B,O,k,G,J,Q,ie){for(var fe=a.indexArray,ye=a.layoutVertexArray,ke=a.segments.prepareSegment(4*u.length,ye,fe,this.canOverlap?B.sortKey:void 0),Ne=this.glyphOffsetArray.length,He=ke.vertexLength,Ge=this.allowVerticalPlacement&&O===Lo.vertical?Math.PI/2:0,Ke=B.text&&B.text.sections,lt=0;lt<u.length;lt++){var mt=u[lt],yt=mt.tl,Ot=mt.tr,Ht=mt.bl,Kt=mt.br,br=mt.tex,nr=mt.pixelOffsetTL,Sr=mt.pixelOffsetBR,ir=mt.minFontScaleX,sn=mt.minFontScaleY,Lr=mt.glyphOffset,hr=mt.isSDF,hn=mt.sectionIndex,Kr=ke.vertexLength,bn=Lr[1];$g(ye,k.x,k.y,yt.x,bn+yt.y,br.x,br.y,p,hr,nr.x,nr.y,ir,sn),$g(ye,k.x,k.y,Ot.x,bn+Ot.y,br.x+br.w,br.y,p,hr,Sr.x,nr.y,ir,sn),$g(ye,k.x,k.y,Ht.x,bn+Ht.y,br.x,br.y+br.h,p,hr,nr.x,Sr.y,ir,sn),$g(ye,k.x,k.y,Kt.x,bn+Kt.y,br.x+br.w,br.y+br.h,p,hr,Sr.x,Sr.y,ir,sn),ky(a.dynamicLayoutVertexArray,k,Ge),fe.emplaceBack(Kr,Kr+1,Kr+2),fe.emplaceBack(Kr+1,Kr+2,Kr+3),ke.vertexLength+=4,ke.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Lr[0]),lt!==u.length-1&&hn===u[lt+1].sectionIndex||a.programConfigurations.populatePaintArrays(ye.length,B,B.index,{},ie,Ke&&Ke[hn])}a.placedSymbolArray.emplaceBack(k.x,k.y,Ne,this.glyphOffsetArray.length-Ne,He,G,J,k.segment,p?p[0]:0,p?p[1]:0,x[0],x[1],O,0,!1,0,Q)},Dn.prototype._addCollisionDebugVertex=function(a,u,p,x,C,B){return u.emplaceBack(0,0),a.emplaceBack(p.x,p.y,x,C,Math.round(B.x),Math.round(B.y))},Dn.prototype.addCollisionDebugVertices=function(a,u,p,x,C,B,O){var k=C.segments.prepareSegment(4,C.layoutVertexArray,C.indexArray),G=k.vertexLength,J=C.layoutVertexArray,Q=C.collisionVertexArray,ie=O.anchorX,fe=O.anchorY;this._addCollisionDebugVertex(J,Q,B,ie,fe,new v(a,u)),this._addCollisionDebugVertex(J,Q,B,ie,fe,new v(p,u)),this._addCollisionDebugVertex(J,Q,B,ie,fe,new v(p,x)),this._addCollisionDebugVertex(J,Q,B,ie,fe,new v(a,x)),k.vertexLength+=4;var ye=C.indexArray;ye.emplaceBack(G,G+1),ye.emplaceBack(G+1,G+2),ye.emplaceBack(G+2,G+3),ye.emplaceBack(G+3,G),k.primitiveLength+=4},Dn.prototype.addDebugCollisionBoxes=function(a,u,p,x){for(var C=a;C<u;C++){var B=this.collisionBoxArray.get(C);this.addCollisionDebugVertices(B.x1,B.y1,B.x2,B.y2,x?this.textCollisionBox:this.iconCollisionBox,B.anchorPoint,p)}},Dn.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Jp(ra,JT.members,S),this.iconCollisionBox=new Jp(ra,JT.members,S);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,C,B,O,k,G){for(var J={},Q=u;Q<p;Q++){var ie=a.get(Q);J.textBox={x1:ie.x1,y1:ie.y1,x2:ie.x2,y2:ie.y2,anchorPointX:ie.anchorPointX,anchorPointY:ie.anchorPointY},J.textFeatureIndex=ie.featureIndex;break}for(var fe=x;fe<C;fe++){var ye=a.get(fe);J.verticalTextBox={x1:ye.x1,y1:ye.y1,x2:ye.x2,y2:ye.y2,anchorPointX:ye.anchorPointX,anchorPointY:ye.anchorPointY},J.verticalTextFeatureIndex=ye.featureIndex;break}for(var ke=B;ke<O;ke++){var Ne=a.get(ke);J.iconBox={x1:Ne.x1,y1:Ne.y1,x2:Ne.x2,y2:Ne.y2,anchorPointX:Ne.anchorPointX,anchorPointY:Ne.anchorPointY},J.iconFeatureIndex=Ne.featureIndex;break}for(var He=k;He<G;He++){var Ge=a.get(He);J.verticalIconBox={x1:Ge.x1,y1:Ge.y1,x2:Ge.x2,y2:Ge.y2,anchorPointX:Ge.anchorPointX,anchorPointY:Ge.anchorPointY},J.verticalIconFeatureIndex=Ge.featureIndex;break}return J},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,C=p.vertexStartIndex;C<x;C+=4)a.indexArray.emplaceBack(C,C+1,C+2),a.indexArray.emplaceBack(C+1,C+2,C+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=[],C=[],B=[],O=0;O<this.symbolInstances.length;++O){B.push(O);var k=this.symbolInstances.get(O);x.push(0|Math.round(u*k.anchorX+p*k.anchorY)),C.push(k.featureIndex)}return B.sort((function(G,J){return x[G]-x[J]||C[J]-C[G]})),B},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 C=this.symbolInstances.get(x[p]);this.featureSortOrder.push(C.featureIndex),[C.rightJustifiedTextSymbolIndex,C.centerJustifiedTextSymbolIndex,C.leftJustifiedTextSymbolIndex].forEach((function(B,O,k){B>=0&&k.indexOf(B)===O&&u.addIndicesForPlacedSymbol(u.text,B)})),C.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,C.verticalPlacedTextSymbolIndex),C.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,C.placedIconSymbolIndex),C.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,C.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=ky;var rN=new qn({"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"])}),Ny={paint:new qn({"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:jt,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:rN},$h=function(a){this.type=a.property.overrides?a.property.overrides.runtimeType:Ft,this.defaultValue=a};
2097$h.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},$h.prototype.eachChild=function(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)},$h.prototype.outputDefined=function(){return!1},$h.prototype.serialize=function(){return null},or("FormatSectionOverride",$h,{omit:["defaultValue"]});var nN=(function(a){function u(p){a.call(this,p,Ny)}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 C=this.layout.get("text-writing-mode");if(C){for(var B=[],O=0,k=C;O<k.length;O+=1){var G=k[O];B.indexOf(G)<0&&B.push(G)}this.layout._values["text-writing-mode"]=B}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},u.prototype.getValueAndResolveTokens=function(p,x,C,B){var O=this.layout.get(p).evaluate(x,{},C,B),k=this._unevaluatedLayout._values[p];return k.isDataDriven()||xo(k.value)||!O?O:(function(G,J){return J.replace(/{([^{}]+)}/g,(function(Q,ie){return ie in G?String(G[ie]):""}))})(x.properties,O)},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=Ny.paint.overridableProperties;p<x.length;p+=1){var C=x[p];if(u.hasPaintOverride(this.layout,C)){var B,O=this.paint.get(C),k=new $h(O),G=new Sa(k,O.property.specification);B=O.value.kind==="constant"||O.value.kind==="source"?new Za("source",G):new Rl("composite",G,O.value.zoomStops,O.value._interpolationType),this.paint._values[C]=new ss(O.property,B,O.parameters)}}},u.prototype._handleOverridablePaintPropertyUpdate=function(p,x,C){return!(!this.layout||x.isDataDriven()||C.isDataDriven())&&u.hasPaintOverride(this.layout,p)},u.hasPaintOverride=function(p,x){var C=p.get("text-field"),B=Ny.paint.properties[x],O=!1,k=function(Q){for(var ie=0,fe=Q;ie<fe.length;ie+=1)if(B.overrides&&B.overrides.hasOverride(fe[ie]))return void(O=!0)};if(C.value.kind==="constant"&&C.value.value instanceof ci)k(C.value.value.sections);else if(C.value.kind==="source"){var G=function(Q){O||(Q instanceof Fi&&$n(Q.value)===ln?k(Q.value.sections):Q instanceof ms?k(Q.sections):Q.eachChild(G))},J=C.value;J._styleExpression&&G(J._styleExpression.expression)}return O},u})(zr),iN={paint:new qn({"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"])})},sN=(function(a){function u(p){a.call(this,p,iN)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u})(zr),oN={paint:new qn({"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"])})},aN=(function(a){function u(p){a.call(this,p,oN)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u})(zr),lN=(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),cN={circle:xy,heatmap:$k,hillshade:qk,fill:f8,"fill-extrusion":v8,line:C8,symbol
vendor: 14,466 bytes, line 2097
2097:nN,background:sN,raster:aN},_E=I.HTMLImageElement,yE=I.HTMLCanvasElement,vE=I.HTMLVideoElement,bE=I.ImageData,Xg=I.ImageBitmap,Bf=function(a,u,p,x){this.context=a,this.format=p,this.texture=a.gl.createTexture(),this.update(u,x)};Bf.prototype.update=function(a,u,p){var x=a.width,C=a.height,B=!(this.size&&this.size[0]===x&&this.size[1]===C||p),O=this.context,k=O.gl;if(this.useMipmap=!!(u&&u.useMipmap),k.bindTexture(k.TEXTURE_2D,this.texture),O.pixelStoreUnpackFlipY.set(!1),O.pixelStoreUnpack.set(1),O.pixelStoreUnpackPremultiplyAlpha.set(this.format===k.RGBA&&(!u||u.premultiply!==!1)),B)this.size=[x,C],a instanceof _E||a instanceof yE||a instanceof vE||a instanceof bE||Xg&&a instanceof Xg?k.texImage2D(k.TEXTURE_2D,0,this.format,this.format,k.UNSIGNED_BYTE,a):k.texImage2D(k.TEXTURE_2D,0,this.format,x,C,0,this.format,k.UNSIGNED_BYTE,a.data);else{var G=p||{x:0,y:0},J=G.x,Q=G.y;a instanceof _E||a instanceof yE||a instanceof vE||a instanceof bE||Xg&&a instanceof Xg?k.texSubImage2D(k.TEXTURE_2D,0,J,Q,k.RGBA,k.UNSIGNED_BYTE,a):k.texSubImage2D(k.TEXTURE_2D,0,J,Q,x,C,k.RGBA,k.UNSIGNED_BYTE,a.data)}this.useMipmap&&this.isSizePowerOfTwo()&&k.generateMipmap(k.TEXTURE_2D)},Bf.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)},Bf.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Bf.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Uy=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()})};Uy.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))},Uy.prototype.remove=function(){delete this._channel,this._callback=function(){}};var Xh=function(a,u,p){this.target=a,this.parent=u,this.mapId=p,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Ee(["receive","process"],this),this.invoker=new Uy(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=_e()?a:I};function xE(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]}Xh.prototype.send=function(a,u,p,x,C){var B=this;C===void 0&&(C=!1);var O=Math.round(1e18*Math.random()).toString(36).substring(0,10);p&&(this.callbacks[O]=p);var k=Ye(this.globalScope)?void 0:[];return this.target.postMessage({id:O,type:a,hasCallback:!!p,targetMapId:x,mustQueue:C,sourceMapId:this.mapId,data:ro(u,k)},k),{cancel:function(){p&&delete B.callbacks[O],B.target.postMessage({id:O,type:"<cancel>",targetMapId:x,sourceMapId:B.mapId})}}},Xh.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)},Xh.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)}},Xh.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 C=!1,B=Ye(this.globalScope)?void 0:[],O=u.hasCallback?function(Q,ie){C=!0,delete p.cancelCallbacks[a],p.target.postMessage({id:a,type:"<response>",sourceMapId:p.mapId,error:Q?ro(Q):null,data:ro(ie,B)},B)}:function(Q){C=!0},k=null,G=_s(u.data);if(this.parent[u.type])k=this.parent[u.type](u.sourceMapId,G,O);else if(this.parent.getWorkerSource){var J=u.type.split(".");k=this.parent.getWorkerSource(u.sourceMapId,J[0],G.source)[J[1]](G,O)}else O(new Error("Could not find function "+u.type));!C&&k&&k.cancel&&(this.cancelCallbacks[a]=k.cancel)}},Xh.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Gi=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]))};Gi.prototype.setNorthEast=function(a){return this._ne=a instanceof ni?new ni(a.lng,a.lat):ni.convert(a),this},Gi.prototype.setSouthWest=function(a){return this._sw=a instanceof ni?new ni(a.lng,a.lat):ni.convert(a),this},Gi.prototype.extend=function(a){var u,p,x=this._sw,C=this._ne;if(a instanceof ni)u=a,p=a;else{if(!(a instanceof Gi))return Array.isArray(a)?a.length===4||a.every(Array.isArray)?this.extend(Gi.convert(a)):this.extend(ni.convert(a)):this;if(p=a._ne,!(u=a._sw)||!p)return this}return x||C?(x.lng=Math.min(u.lng,x.lng),x.lat=Math.min(u.lat,x.lat),C.lng=Math.max(p.lng,C.lng),C.lat=Math.max(p.lat,C.lat)):(this._sw=new ni(u.lng,u.lat),this._ne=new ni(p.lng,p.lat)),this},Gi.prototype.getCenter=function(){return new ni((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Gi.prototype.getSouthWest=function(){return this._sw},Gi.prototype.getNorthEast=function(){return this._ne},Gi.prototype.getNorthWest=function(){return new ni(this.getWest(),this.getNorth())},Gi.prototype.getSouthEast=function(){return new ni(this.getEast(),this.getSouth())},Gi.prototype.getWest=function(){return this._sw.lng},Gi.prototype.getSouth=function(){return this._sw.lat},Gi.prototype.getEast=function(){return this._ne.lng},Gi.prototype.getNorth=function(){return this._ne.lat},Gi.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Gi.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Gi.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Gi.prototype.contains=function(a){var u=ni.convert(a),p=u.lng,x=u.lat,C=this._sw.lng<=p&&p<=this._ne.lng;return this._sw.lng>this._ne.lng&&(C=this._sw.lng>=p&&p>=this._ne.lng),this._sw.lat<=x&&x<=this._ne.lat&&C},Gi.convert=function(a){return!a||a instanceof Gi?a:new Gi(a)};var ni=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")};ni.prototype.wrap=function(){return new ni(V(this.lng,-180,180),this.lat)},ni.prototype.toArray=function(){return[this.lng,this.lat]},ni.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},ni.prototype.distanceTo=function(a){var u=Math.PI/180,p=this.lat*u,x=a.lat*u,C=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(C,1))},ni.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 Gi(new ni(this.lng-p,this.lat-u),new ni(this.lng+p,this.lat+u))},ni.convert=function(a){if(a instanceof ni)return a;if(Array.isArray(a)&&(a.length===2||a.length===3))return new ni(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&typeof a=="object"&&a!==null)return new ni(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 wE=2*Math.PI*63710088e-1;function TE(a){return wE*Math.cos(a*Math.PI/180)}function EE(a){return(180+a)/360}function CE(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function SE(a,u){return a/TE(u)}function zy(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}var Pf=function(a,u,p){p===void 0&&(p=0),this.x=+a,this.y=+u,this.z=+p};Pf.fromLngLat=function(a,u){u===void 0&&(u=0);var p=ni.convert(a);return new Pf(EE(p.lng),CE(p.lat),SE(u,p.lat))},Pf.prototype.toLngLat=function(){return new ni(360*this.x-180,zy(this.y))},Pf.prototype.toAltitude=function(){return this.z*TE(zy(this.y))},Pf.prototype.meterInMercatorCoordinateUnits=function(){return 1/wE*(a=zy(this.y),1/Math.cos(a*Math.PI/180));var a};var Mf=function(a,u,p){this.z=a,this.x=u,this.y=p,this.key=Kp(0,a,a,u,p)};Mf.prototype.equals=function(a){return this.z===a.z&&this.x===a.x&&this.y===a.y},Mf.prototype.url=function(a,u){var p,x,C,B,O,k=(x=this.y,C=this.z,B=xE(256*(p=this.x),256*(x=Math.pow(2,C)-x-1),C),O=xE(256*(p+1),256*(x+1),C),B[0]+","+B[1]+","+O[0]+","+O[1]),G=(function(J,Q,ie){for(var fe,ye="",ke=J;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}",G).replace("{bbox-epsg-3857}",k)},Mf.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))},Mf.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var IE=function(a,u){this.wrap=a,this.canonical=u,this.key=Kp(a,u.z,u.z,u.x,u.y)},ji=function(a,u,p,x,C){this.overscaledZ=a,this.wrap=u,this.canonical=new Mf(p,+x,+C),this.key=Kp(u,a,p,x,C)};function Kp(a,u,p,x,C){(a*=2)<0&&(a=-1*a-1);var B=1<<p;return(B*B*a+B*C+x).toString(36)+p.toString(36)+u.toString(36)}ji.prototype.equals=function(a){return this.overscaledZ===a.overscaledZ&&this.wrap===a.wrap&&this.canonical.equals(a.canonical)},ji.prototype.scaledTo=function(a){var u=this.canonical.z-a;return a>this.canonical.z?new ji(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ji(a,this.wrap,a,this.canonical.x>>u,this.canonical.y>>u)},ji.prototype.calculateScaledKey=function(a,u){var p=this.canonical.z-a;return a>this.canonical.z?Kp(this.wrap*+u,a,this.canonical.z,this.canonical.x,this.canonical.y):Kp(this.wrap*+u,a,a,this.canonical.x>>p,this.canonical.y>>p)},ji.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},ji.prototype.children=function(a){if(this.overscaledZ>=a)return[new ji(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 ji(u,this.wrap,u,p,x),new ji(u,this.wrap,u,p+1,x),new ji(u,this.wrap,u,p,x+1),new ji(u,this.wrap,u,p+1,x+1)]},ji.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))},ji.prototype.wrapped=function(){return new ji(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},ji.prototype.unwrapTo=function(a){return new ji(this.overscaledZ,a,this.canonical.z,this.canonical.x,this.canonical.y)},ji.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},ji.prototype.toUnwrapped=function(){return new IE(this.wrap,this.canonical)},ji.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},ji.prototype.getTilePoint=function(a){return this.canonical.getTilePoint(new Pf(a.x-this.wrap,a.y))},or("CanonicalTileID",Mf),or("OverscaledTileID",ji,{omit:["posMatrix"]});var Dc=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 C=0;C<x;C++)this.data[this._idx(-1,C)]=this.data[this._idx(0,C)],this.data[this._idx(x,C)]=this.data[this._idx(x-1,C)],this.data[this._idx(C,-1)]=this.data[this._idx(C,0)],this.data[this._idx(C,x)]=this.data[this._idx(C,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)]};Dc.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])},Dc.prototype.getUnpackVector=function(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},Dc.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)},Dc.prototype._unpackMapbox=function(a,u,p){return(256*a*256+256*u+p)/10-1e4},Dc.prototype._unpackTerrarium=function(a,u,p){return 256*a+u+p/256-32768},Dc.prototype.getPixels=function(){return new lo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Dc.prototype.backfillBorder=function(a,u,p){if(this.dim!==a.dim)throw new Error("dem dimension mismatch");var x=u*this.dim,C=u*this.dim+this.dim,B=p*this.dim,O=p*this.dim+this.dim;switch(u){case-1:x=C-1;break;case 1:C=x+1}switch(p){case-1:B=O-1;break;case 1:O=B+1}for(var k=-u*this.dim,G=-p*this.dim,J=B;J<O;J++)for(var Q=x;Q<C;Q++)this.data[this._idx(Q,J)]=a.data[this._idx(Q+k,J+G)]},or("DEMData",Dc);var qg=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}};qg.prototype.encode=function(a){return this._stringToNumber[a]},qg.prototype.decode=function(a){return this._numberToString[a]};var Jg=function(a,u,p,x,C){this.type="Feature",this._vectorTileFeature=a,a._z=u,a._x=p,a._y=x,this.properties=a.properties,this.id=C},Vy={geometry:{configurable:!0}};Vy.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}
2097,Vy.geometry.set=function(a){this._geometry=a},Jg.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(Jg.prototype,Vy);var qh=function(){this.state={},this.stateChanges={},this.deletedStates={}};qh.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]||{},j(this.stateChanges[a][x],p),this.deletedStates[a]===null)for(var C in this.deletedStates[a]={},this.state[a])C!==x&&(this.deletedStates[a][C]=null);else if(this.deletedStates[a]&&this.deletedStates[a][x]===null)for(var B in this.deletedStates[a][x]={},this.state[a][x])p[B]||(this.deletedStates[a][x][B]=null);else for(var O in p)this.deletedStates[a]&&this.deletedStates[a][x]&&this.deletedStates[a][x][O]===null&&delete this.deletedStates[a][x][O]},qh.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}},qh.prototype.getState=function(a,u){var p=String(u),x=j({},(this.state[a]||{})[p],(this.stateChanges[a]||{})[p]);if(this.deletedStates[a]===null)return{};if(this.deletedStates[a]){var C=this.deletedStates[a][u];if(C===null)return{};for(var B in C)delete x[B]}return x},qh.prototype.initializeTileState=function(a,u){a.setFeatureState(this.state,u)},qh.prototype.coalesceChanges=function(a,u){var p={};for(var x in this.stateChanges){this.state[x]=this.state[x]||{};var C={};for(var B in this.stateChanges[x])this.state[x][B]||(this.state[x][B]={}),j(this.state[x][B],this.stateChanges[x][B]),C[B]=this.state[x][B];p[x]=C}for(var O in this.deletedStates){this.state[O]=this.state[O]||{};var k={};if(this.deletedStates[O]===null)for(var G in this.state[O])k[G]={},this.state[O][G]={};else for(var J in this.deletedStates[O]){if(this.deletedStates[O][J]===null)this.state[O][J]={};else for(var Q=0,ie=Object.keys(this.deletedStates[O][J]);Q<ie.length;Q+=1)delete this.state[O][J][ie[Q]];k[J]=this.state[O][J]}p[O]=p[O]||{},j(p[O],k)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(var fe in a)a[fe].setFeatureState(p,u)};var Fc=function(a,u){this.tileID=a,this.x=a.canonical.x,this.y=a.canonical.y,this.z=a.canonical.z,this.grid=new Ro(8192,16,0),this.grid3D=new Ro(8192,16,0),this.featureIndexArray=new q,this.promoteId=u};function BE(a,u,p,x,C){return de(a,(function(B,O){var k=u instanceof Bc?u.get(O):null;return k&&k.evaluate?k.evaluate(p,x,C):k}))}function PE(a){for(var u=1/0,p=1/0,x=-1/0,C=-1/0,B=0,O=a;B<O.length;B+=1){var k=O[B];u=Math.min(u,k.x),p=Math.min(p,k.y),x=Math.max(x,k.x),C=Math.max(C,k.y)}return{minX:u,minY:p,maxX:x,maxY:C}}function uN(a,u){return u-a}Fc.prototype.insert=function(a,u,p,x,C,B){var O=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,x,C);for(var k=B?this.grid3D:this.grid,G=0;G<u.length;G++){for(var J=u[G],Q=[1/0,1/0,-1/0,-1/0],ie=0;ie<J.length;ie++){var fe=J[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(O,Q[0],Q[1],Q[2],Q[3])}},Fc.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Nh.VectorTile(new kg(this.rawTileData)).layers,this.sourceLayerCoder=new qg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Fc.prototype.query=function(a,u,p,x){var C=this;this.loadVTLayers();for(var B=a.params||{},O=8192/a.tileSize/a.scale,k=du(B.filter),G=a.queryGeometry,J=a.queryPadding*O,Q=PE(G),ie=this.grid.query(Q.minX-J,Q.minY-J,Q.maxX+J,Q.maxY+J),fe=PE(a.cameraQueryGeometry),ye=this.grid3D.query(fe.minX-J,fe.minY-J,fe.maxX+J,fe.maxY+J,(function(mt,yt,Ot,Ht){return(function(Kt,br,nr,Sr,ir){for(var sn=0,Lr=Kt;sn<Lr.length;sn+=1){var hr=Lr[sn];if(br<=hr.x&&nr<=hr.y&&Sr>=hr.x&&ir>=hr.y)return!0}var hn=[new v(br,nr),new v(br,ir),new v(Sr,ir),new v(Sr,nr)];if(Kt.length>2){for(var Kr=0,bn=hn;Kr<bn.length;Kr+=1)if(Ba(Kt,bn[Kr]))return!0}for(var Ir=0;Ir<Kt.length-1;Ir++)if(Cf(Kt[Ir],Kt[Ir+1],hn))return!0;return!1}
2097)(a.cameraQueryGeometry,mt-J,yt-J,Ot+J,Ht+J)})),ke=0,Ne=ye;ke<Ne.length;ke+=1)ie.push(Ne[ke]);ie.sort(uN);for(var He,Ge={},Ke=function(mt){var yt=ie[mt];if(yt!==He){He=yt;var Ot=C.featureIndexArray.get(yt),Ht=null;C.loadMatchingFeature(Ge,Ot.bucketIndex,Ot.sourceLayerIndex,Ot.featureIndex,k,B.layers,B.availableImages,u,p,x,(function(Kt,br,nr){return Ht||(Ht=yi(Kt)),br.queryIntersectsFeature(G,Kt,nr,Ht,C.z,a.transform,O,a.pixelPosMatrix)}))}},lt=0;lt<ie.length;lt++)Ke(lt);return Ge},Fc.prototype.loadMatchingFeature=function(a,u,p,x,C,B,O,k,G,J,Q){var ie=this.bucketLayerIDs[u];if(!B||(function(Kt,br){for(var nr=0;nr<Kt.length;nr++)if(br.indexOf(Kt[nr])>=0)return!0;return!1})(B,ie)){var fe=this.sourceLayerCoder.decode(p),ye=this.vtLayers[fe].feature(x);if(C.needGeometry){var ke=Ii(ye,!0);if(!C.filter(new jr(this.tileID.overscaledZ),ke,this.tileID.canonical))return}else if(!C.filter(new jr(this.tileID.overscaledZ),ye))return;for(var Ne=this.getId(ye,fe),He=0;He<ie.length;He++){var Ge=ie[He];if(!(B&&B.indexOf(Ge)<0)){var Ke=k[Ge];if(Ke){var lt={};Ne!==void 0&&J&&(lt=J.getState(Ke.sourceLayer||"_geojsonTileLayer",Ne));var mt=j({},G[Ge]);mt.paint=BE(mt.paint,Ke.paint,ye,lt,O),mt.layout=BE(mt.layout,Ke.layout,ye,lt,O);var yt=!Q||Q(ye,Ke,lt);if(yt){var Ot=new Jg(ye,this.z,this.x,this.y,Ne);Ot.layer=mt;var Ht=a[Ge];Ht===void 0&&(Ht=a[Ge]=[]),Ht.push({featureIndex:x,feature:Ot,intersectionZ:yt})}}}}}},Fc.prototype.lookupSymbolFeatures=function(a,u,p,x,C,B,O,k){var G={};this.loadVTLayers();for(var J=du(C),Q=0,ie=a;Q<ie.length;Q+=1)this.loadMatchingFeature(G,p,x,ie[Q],J,B,O,k,u);return G},Fc.prototype.hasLayer=function(a){for(var u=0,p=this.bucketLayerIDs;u<p.length;u+=1)for(var x=0,C=p[u];x<C.length;x+=1)if(a===C[x])return!0;return!1},Fc.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",Fc,{omit:["rawTileData","sourceLayerCoder"]});var ls=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"};ls.prototype.registerFadeDuration=function(a){var u=a+this.timeAdded;u<Jt.now()||this.fadeEndTime&&u<this.fadeEndTime||(this.fadeEndTime=u)},ls.prototype.wasRequested=function(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"},ls.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(J,Q){var ie={};if(!Q)return ie;for(var fe=function(){var Ne=ke[ye],He=Ne.layerIds.map((function(lt){return Q.getLayer(lt)})).filter(Boolean);if(He.length!==0){Ne.layers=He,Ne.stateDependentLayerIds&&(Ne.stateDependentLayers=Ne.stateDependentLayerIds.map((function(lt){return He.filter((function(mt){return mt.id===lt}))[0]})));for(var Ge=0,Ke=He;Ge<Ke.length;Ge+=1)ie[Ke[Ge].id]=Ne}},ye=0,ke=J;ye<ke.length;ye+=1)fe();return ie})(a.buckets,u.style),this.hasSymbolBuckets=!1,this.buckets){var C=this.buckets[x];if(C instanceof Dn){if(this.hasSymbolBuckets=!0,!p)break;C.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var B in this.buckets){var O=this.buckets[B];if(O instanceof Dn&&O.hasRTLText){this.hasRTLText=!0,is.isLoading()||is.isLoaded()||xf()!=="deferred"||wo();break}}for(var k in this.queryPadding=0,this.buckets){var G=this.buckets[k];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(k).queryRadius(G))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage)}else this.collisionBoxArray=new d},ls.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"},ls.prototype.getBucket=function(a){return this.buckets[a.id]},ls.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 Bf(a,this.imageAtlas.image,x.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Bf(a,this.glyphAtlasImage,x.ALPHA),this.glyphAtlasImage=null)},ls.prototype.prepare=function(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)},ls.prototype.queryRenderedFeatures=function(a,u,p,x,C,B,O,k,G,J){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:x,cameraQueryGeometry:C,scale:B,tileSize:this.tileSize,pixelPosMatrix:J,transform:k,params:O,queryPadding:this.queryPadding*G},a,u,p):{}},ls.prototype.querySourceFeatures=function(a,u){var p=this.latestFeatureIndex;if(p&&p.rawTileData){var x=p.loadVTLayers(),C=u?u.sourceLayer:"",B=x._geojsonTileLayer||x[C];if(B)for(var O=du(u&&u.filter),k=this.tileID.canonical,G=k.z,J=k.x,Q=k.y,ie={z:G,x:J,y:Q},fe=0;fe<B.length;fe++){var ye=B.feature(fe);if(O.needGeometry){var ke=Ii(ye,!0);
2097if(!O.filter(new jr(this.tileID.overscaledZ),ke,this.tileID.canonical))continue}else if(!O.filter(new jr(this.tileID.overscaledZ),ye))continue;var Ne=p.getId(ye,C),He=new Jg(ye,G,J,Q,Ne);He.tile=ie,a.push(He)}}},ls.prototype.hasData=function(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"},ls.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},ls.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(),C=!1;if(this.expirationTime>x)C=!1;else if(u)if(this.expirationTime<u)C=!0;else{var B=this.expirationTime-u;B?this.expirationTime=x+Math.max(B,3e4):C=!0}else C=!0;C?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},ls.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)},ls.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 C=this.buckets[x],B=C.layers[0].sourceLayer||"_geojsonTileLayer",O=p[B],k=a[B];if(O&&k&&Object.keys(k).length!==0){C.update(k,O,this.imageAtlas&&this.imageAtlas.patternPositions||{});var G=u&&u.style&&u.style.getLayer(x);G&&(this.queryPadding=Math.max(this.queryPadding,G.queryRadius(C)))}}}},ls.prototype.holdingForFade=function(){return this.symbolFadeHoldUntil!==void 0},ls.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Jt.now()},ls.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},ls.prototype.setHoldDuration=function(a){this.symbolFadeHoldUntil=Jt.now()+a},ls.prototype.setDependencies=function(a,u){for(var p={},x=0,C=u;x<C.length;x+=1)p[C[x]]=!0;this.dependencies[a]=p},ls.prototype.hasDependency=function(a,u){for(var p=0,x=a;p<x.length;p+=1){var C=this.dependencies[x[p]];if(C){for(var B=0,O=u;B<O.length;B+=1)if(C[O[B]])return!0}}return!1};var Su=I.performance,ME=function(a){this._marks={start:[a.url,"start"].join("#"),end:[a.url,"end"].join("#"),measure:a.url.toString()},Su.mark(this._marks.start)};ME.prototype.finish=function(){Su.mark(this._marks.end);var a=Su.getEntriesByName(this._marks.measure);return a.length===0&&(Su.measure(this._marks.measure,this._marks.start,this._marks.end),a=Su.getEntriesByName(this._marks.measure),Su.clearMarks(this._marks.start),Su.clearMarks(this._marks.end),Su.clearMeasures(this._marks.measure)),a},o.Actor=Xh,o.AlphaImage=If,o.CanonicalTileID=Mf,o.CollisionBoxArray=d,o.Color=tn,o.DEMData=Dc,o.DataConstantProperty=wr,o.DictionaryCoder=qg,o.EXTENT=8192,o.ErrorEvent=he,o.EvaluationParameters=jr,o.Event=Fe,o.Evented=be,o.FeatureIndex=Fc,o.FillBucket=sl,o.FillExtrusionBucket=ol,o.ImageAtlas=qp,o.ImagePosition=Ug,o.LineBucket=Xs,o.LngLat=ni,o.LngLatBounds=Gi,o.MercatorCoordinate=Pf,o.ONE_EM=24,o.OverscaledTileID=ji,o.Point=v,o.Point$1=v,o.Properties=qn,o.Protobuf=kg,o.RGBAImage=lo,o.RequestManager=_r,o.RequestPerformance=ME,o.ResourceType=Vt,o.SegmentVector=Y,o.SourceFeatureState=qh,o.StructArrayLayout1ui2=P,o.StructArrayLayout2f1f2i16=Do,o.StructArrayLayout2i4=Hs,o.StructArrayLayout3ui6=ia,o.StructArrayLayout4i8=wf,o.SymbolBucket=Dn,o.Texture=Bf,o.Tile=ls,o.Transitionable=qi,o.Uniform1f=Dt,o.Uniform1i=pt,o.Uniform2f=Tt,o.Uniform3f=zt,o.Uniform4f=sr,o.UniformColor=Cr,o.UniformMatrix4f=xn,o.UnwrappedTileID=IE,o.ValidationError=Se,o.WritingMode=Lo,o.ZoomHistory=_f,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=ky,o.asyncAll=function(a,u,p){if(!a.length)return p(null,[]);var x=a.length,C=new Array(a.length),B=null;a.forEach((function(O,k){u(O,(function(G,J){G&&(B=G),C[k]=J,--x==0&&p(B,C)}
vendor: 5,805 bytes, line 2097
2097))}))},o.bezier=N,o.bindAll=Ee,o.browser=Jt,o.cacheEntryPossiblyAdded=function(a){++Rt>kt&&(a.getActor().send("enforceCacheSizeLimit",Pe),Rt=0)},o.clamp=$,o.clearTileCache=function(a){var u=I.caches.delete("mapbox-tiles");a&&u.catch(a).then((function(){return a()}))},o.clipLine=hE,o.clone=function(a){var u=new Cn(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 Cn(3);return u[0]=a[0],u[1]=a[1],u[2]=a[2],u},o.collisionCircleLayout=P8,o.config=Nt,o.create=function(){var a=new Cn(16);return Cn!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},o.create$1=function(){var a=new Cn(9);return Cn!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a},o.create$2=function(){var a=new Cn(4);return Cn!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a},o.createCommonjsModule=l,o.createExpression=fu,o.createLayout=ki,o.createStyleLayer=function(a){return a.type==="custom"?new lN(a):new cN[a.type](a)},o.cross=function(a,u,p){var x=u[0],C=u[1],B=u[2],O=p[0],k=p[1],G=p[2];return a[0]=C*G-B*k,a[1]=B*O-x*G,a[2]=x*k-C*O,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 C in u)if(!a(u[C],p[C]))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=Ic,o.endsWith=Ue,o.enforceCacheSizeLimit=function(a){Wt(),Sn&&Sn.then((function(u){u.keys().then((function(p){for(var x=0;x<p.length-a;x++)u.delete(p[x])}))}))},o.evaluateSizeForFeature=oE,o.evaluateSizeForZoom=aE,o.evaluateVariableOffset=AE,o.evented=wi,o.extend=j,o.featureFilter=du,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=Oy,o.getAnchorJustification=Ly,o.getArrayBuffer=Xe,o.getImage=ne,o.getJSON=function(a,u){return Te(j(a,{type:"json"}),u)},o.getRTLTextPluginStatus=xf,o.getReferrer=H,o.getVideo=function(a,u){var p,x,C=I.document.createElement("video");C.muted=!0,C.onloadstart=function(){u(null,C)};for(var B=0;B<a.length;B++){var O=I.document.createElement("source");p=a[B],x=void 0,(x=I.document.createElement("a")).href=p,(x.protocol!==I.document.location.protocol||x.host!==I.document.location.host)&&(C.crossOrigin="Anonymous"),O.src=a[B],C.appendChild(O)}return{cancel:function(){}}},o.identity=Co,o.invert=function(a,u){var p=u[0],x=u[1],C=u[2],B=u[3],O=u[4],k=u[5],G=u[6],J=u[7],Q=u[8],ie=u[9],fe=u[10],ye=u[11],ke=u[12],Ne=u[13],He=u[14],Ge=u[15],Ke=p*k-x*O,lt=p*G-C*O,mt=p*J-B*O,yt=x*G-C*k,Ot=x*J-B*k,Ht=C*J-B*G,Kt=Q*Ne-ie*ke,br=Q*He-fe*ke,nr=Q*Ge-ye*ke,Sr=ie*He-fe*Ne,ir=ie*Ge-ye*Ne,sn=fe*Ge-ye*He,Lr=Ke*sn-lt*ir+mt*Sr+yt*nr-Ot*br+Ht*Kt;return Lr?(a[0]=(k*sn-G*ir+J*Sr)*(Lr=1/Lr),a[1]=(C*ir-x*sn-B*Sr)*Lr,a[2]=(Ne*Ht-He*Ot+Ge*yt)*Lr,a[3]=(fe*Ot-ie*Ht-ye*yt)*Lr,a[4]=(G*nr-O*sn-J*br)*Lr,a[5]=(p*sn-C*nr+B*br)*Lr,a[6]=(He*mt-ke*Ht-Ge*lt)*Lr,a[7]=(Q*Ht-fe*mt+ye*lt)*Lr,a[8]=(O*ir-k*nr+J*Kt)*Lr,a[9]=(x*nr-p*ir-B*Kt)*Lr,a[10]=(ke*Ot-Ne*mt+Ge*Ke)*Lr,a[11]=(ie*mt-Q*Ot-ye*Ke)*Lr,a[12]=(k*br-O*Sr-G*Kt)*Lr,a[13]=(p*Sr-x*br+C*Kt)*Lr,a[14]=(Ne*lt-ke*yt-He*Ke)*Lr,a[15]=(Q*yt-ie*lt+fe*Ke)*Lr,a):null},o.isChar=Zt,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=Te,o.mapObject=de,o.mercatorXfromLng=EE,o.mercatorYfromLat=CE,o.mercatorZfromAltitude=SE,o.mul=by,o.multiply=$s,o.mvt=Nh,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],C=u[2],B=p*p+x*x+C*C;return B>0&&(B=1/Math.sqrt(B)),a[0]=u[0]*B,a[1]=u[1]*B,a[2]=u[2]*B,a},o.number=hi,o.offscreenCanvasSupported=Ae,o.ortho=function(a,u,p,x,C,B,O){var k=1/(u-p),G=1/(x-C),J=1/(B-O);return a[0]=-2*k,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*G,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*J,a[11]=0,a[12]=(u+p)*k,a[13]=(C+x)*G,a[14]=(O+B)*J,a[15]=1,a},o.parseGlyphPBF=function(a){return new kg(a).readFields(V8,[])},o.pbf=kg,o.performSymbolLayout=function(a,u,p,x,C,B,O){a.createArrays(),a.tilePixelRatio=8192/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;var k=a.layers[0].layout,G=a.layers[0]._unevaluatedLayout._values,J={};if(a.textSizeData.kind==="composite"){var Q=a.textSizeData,ie=Q.maxZoom;J.compositeTextSizes=[G["text-size"].possiblyEvaluate(new jr(Q.minZoom),O),G["text-size"].possiblyEvaluate(new jr(ie),O)]}if(a.iconSizeData.kind==="composite"){var fe=a.iconSizeData,ye=fe.maxZoom;J.compositeIconSizes=[G["icon-size"].possiblyEvaluate(new jr(fe.minZoom),O),G["icon-size"].possiblyEvaluate(new jr(ye),O)]}J.layoutTextSize=G["text-size"].possiblyEvaluate(new jr(a.zoom+1),O),J.layoutIconSize=G["icon-size"].possiblyEvaluate(new jr(a.zoom+1),O),J.textMaxSize=G["text-size"].possiblyEvaluate(new jr(18));for(var ke=24*k.get("text-line-height"),Ne=k.get("text-rotation-alignment")==="map"&&k.get("symbol-placement")!=="point",He=k.get("text-keep-upright"),Ge=k.get("text-size"),Ke=function(){var yt=mt[lt],Ot=k.get("text-font").evaluate(yt,{},O).join(","),Ht=Ge.evaluate(yt,{},O),Kt=J.layoutTextSize.evaluate(yt,{},O),br=J.layoutIconSize.evaluate(yt,{},O),nr={horizontal:{},vertical:void 0},Sr=yt.text,ir=[0,0];if(Sr){var sn=Sr.toString(),Lr=24*k.get("text-letter-spacing").evaluate(yt,{},O),hr=(function(gn){for(var Nn=0,Pn=gn;Nn<Pn.length;
2097Nn+=1)if(wn=Pn[Nn].charCodeAt(0),Zt.Arabic(wn)||Zt["Arabic Supplement"](wn)||Zt["Arabic Extended-A"](wn)||Zt["Arabic Presentation Forms-A"](wn)||Zt["Arabic Presentation Forms-B"](wn))return!1;var wn;return!0})(sn)?Lr:0,hn=k.get("text-anchor").evaluate(yt,{},O),Kr=k.get("text-variable-anchor");if(!Kr){var bn=k.get("text-radial-offset").evaluate(yt,{},O);ir=bn?AE(hn,[24*bn,Fy]):k.get("text-offset").evaluate(yt,{},O).map((function(gn){return 24*gn}))}var Ir=Ne?"center":k.get("text-justify").evaluate(yt,{},O),Tn=k.get("symbol-placement"),ii=Tn==="point"?24*k.get("text-max-width").evaluate(yt,{},O):0,Ei=function(){a.allowVerticalPlacement&&yf(sn)&&(nr.vertical=zg(Sr,u,p,C,Ot,ii,ke,hn,"left",hr,ir,Lo.vertical,!0,Tn,Kt,Ht))};if(!Ne&&Kr){for(var vi=Ir==="auto"?Kr.map((function(gn){return Ly(gn)})):[Ir],si=!1,Ci=0;Ci<vi.length;Ci++){var Yi=vi[Ci];if(!nr.horizontal[Yi])if(si)nr.horizontal[Yi]=nr.horizontal[0];else{var Qi=zg(Sr,u,p,C,Ot,ii,ke,"center",Yi,hr,ir,Lo.horizontal,!1,Tn,Kt,Ht);Qi&&(nr.horizontal[Yi]=Qi,si=Qi.positionedLines.length===1)}}Ei()}else{Ir==="auto"&&(Ir=Ly(hn));var Os=zg(Sr,u,p,C,Ot,ii,ke,hn,Ir,hr,ir,Lo.horizontal,!1,Tn,Kt,Ht);Os&&(nr.horizontal[Ir]=Os),Ei(),yf(sn)&&Ne&&He&&(nr.vertical=zg(Sr,u,p,C,Ot,ii,ke,hn,Ir,hr,ir,Lo.vertical,!1,Tn,Kt,Ht))}}var cs=void 0,Ds=!1;if(yt.icon&&yt.icon.name){var Bi=x[yt.icon.name];Bi&&(cs=(function(gn,Nn,Pn){var wn=Oy(Pn),qs=Nn[0]-gn.displaySize[0]*wn.horizontalAlign,bs=Nn[1]-gn.displaySize[1]*wn.verticalAlign;
2097return{image:gn,top:bs,bottom:bs+gn.displaySize[1],left:qs,right:qs+gn.displaySize[0]}})(C[yt.icon.name],k.get("icon-offset").evaluate(yt,{},O),k.get("icon-anchor").evaluate(yt,{},O)),Ds=Bi.sdf,a.sdfIcons===void 0?a.sdfIcons=Bi.sdf:a.sdfIcons!==Bi.sdf&&re("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Bi.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||cs)&&(function(gn,Nn,Pn,wn,qs,bs,ei,Ni,xs,En,Wl){var ko=bs.textMaxSize.evaluate(Nn,{});ko===void 0&&(ko=ei);var $l,Pi=gn.layers[0].layout,Xl=Pi.get("icon-offset").evaluate(Nn,{},Wl),Ma=mE(Pn.horizontal),Jh=ei/24,Rf=gn.tilePixelRatio*Jh,Kh=gn.tilePixelRatio*ko/24,Lc=gn.tilePixelRatio*Ni,Zh=gn.tilePixelRatio*Pi.get("symbol-spacing"),Kg=Pi.get("text-padding")*gn.tilePixelRatio,Yh=Pi.get("icon-padding")*gn.tilePixelRatio,Zp=Pi.get("text-max-angle")/180*Math.PI,Zg=Pi.get("text-rotation-alignment")==="map"&&Pi.get("symbol-placement")!=="point",Yg=Pi.get("icon-rotation-alignment")==="map"&&Pi.get("symbol-placement")!=="point",kc=Pi.get("symbol-placement"),Yp=Zh/2,Qh=Pi.get("icon-text-fit");wn&&Qh!=="none"&&(gn.allowVerticalPlacement&&Pn.vertical&&($l=sE(wn,Pn.vertical,Qh,Pi.get("icon-text-fit-padding"),Xl,Jh)),Ma&&(wn=sE(wn,Ma,Qh,Pi.get("icon-text-fit-padding"),Xl,Jh)));var Iu=function(fN,oA){oA.x<0||oA.x>=8192||oA.y<0||oA.y>=8192||(function(Mi,al,hN,Bu,Wy,DE,i0,ql,s0,aA,o0,a0,$y,FE,lA,LE,kE,NE,UE,zE,No,l0,VE,Jl,dN){var GE,Df,id,sd,od,ad=Mi.addToLineVertexArray(al,hN),jE=0,HE=0,WE=0,$E=0,Xy=-1,qy=-1,Nc={},XE=ge(""),Jy=0,Ky=0;if(ql._unevaluatedLayout.getValue("text-radial-offset")===void 0?(Jy=(GE=ql.layout.get("text-offset").evaluate(No,{},Jl).map((function(uA){return 24*uA})))[0],Ky=GE[1]):(Jy=24*ql.layout.get("text-radial-offset").evaluate(No,{},Jl),Ky=Fy),Mi.allowVerticalPlacement&&Bu.vertical){var qE=ql.layout.get("text-rotate").evaluate(No,{},Jl)+90;sd=new Wg(s0,al,aA,o0,a0,Bu.vertical,$y,FE,lA,qE),i0&&(od=new Wg(s0,al,aA,o0,a0,i0,kE,NE,lA,qE))}if(Wy){var Zy=ql.layout.get("icon-rotate").evaluate(No,{}),JE=ql.layout.get("icon-text-fit")!=="none",KE=dE(Wy,Zy,VE,JE),Yy=i0?dE(i0,Zy,VE,JE):void 0;id=new Wg(s0,al,aA,o0,a0,Wy,kE,NE,!1,Zy),jE=4*KE.length;var ZE=Mi.iconSizeData,cA=null;ZE.kind==="source"?(cA=[128*ql.layout.get("icon-size").evaluate(No,{})])[0]>32640&&re(Mi.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):ZE.kind==="composite"&&((cA=[128*l0.compositeIconSizes[0].evaluate(No,{},Jl),128*l0.compositeIconSizes[1].evaluate(No,{},Jl)])[0]>32640||cA[1]>32640)&&re(Mi.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),Mi.addSymbols(Mi.icon,KE,cA,zE,UE,No,!1,al,ad.lineStartIndex,ad.lineLength,-1,Jl),Xy=Mi.icon.placedSymbolArray.length-1,Yy&&(HE=4*Yy.length,Mi.addSymbols(Mi.icon,Yy,cA,zE,UE,No,Lo.vertical,al,ad.lineStartIndex,ad.lineLength,-1,Jl),qy=Mi.icon.placedSymbolArray.length-1)}for(var YE in Bu.horizontal){var c0=Bu.horizontal[YE];if(!Df){XE=ge(c0.text);var pN=ql.layout.get("text-rotate").evaluate(No,{},Jl);Df=new Wg(s0,al,aA,o0,a0,c0,$y,FE,lA,pN)}var QE=c0.positionedLines.length===1;if(WE+=gE(Mi,al,c0,DE,ql,lA,No,LE,ad,Bu.vertical?Lo.horizontal:Lo.horizontalOnly,QE?Object.keys(Bu.horizontal):[YE],Nc,Xy,l0,Jl),QE)break}Bu.vertical&&($E+=gE(Mi,al,Bu.vertical,DE,ql,lA,No,LE,ad,Lo.vertical,["vertical"],Nc,qy,l0,Jl));var AN=Df?Df.boxStartIndex:Mi.collisionBoxArray.length,gN=Df?Df.boxEndIndex:Mi.collisionBoxArray.length,mN=sd?sd.boxStartIndex:Mi.collisionBoxArray.length,_N=sd?sd.boxEndIndex:Mi.collisionBoxArray.length,yN=id?id.boxStartIndex:Mi.collisionBoxArray.length,vN=id?id.boxEndIndex:Mi.collisionBoxArray.length,bN=od?od.boxStartIndex:Mi.collisionBoxArray.length,xN=od?od.boxEndIndex:Mi.collisionBoxArray.length,Kl=-1,u0=function(uA,tC){return uA&&uA.circleDiameter?Math.max(uA.circleDiameter,tC):tC};Kl=u0(Df,Kl),Kl=u0(sd,Kl),Kl=u0(id,Kl);var eC=(Kl=u0(od,Kl))>-1?1:0;eC&&(Kl*=dN/24),Mi.glyphOffsetArray.length>=Dn.MAX_GLYPHS&&re("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),No.sortKey!==void 0&&Mi.addToSortKey
2097Ranges(Mi.symbolInstances.length,No.sortKey),Mi.symbolInstances.emplaceBack(al.x,al.y,Nc.right>=0?Nc.right:-1,Nc.center>=0?Nc.center:-1,Nc.left>=0?Nc.left:-1,Nc.vertical||-1,Xy,qy,XE,AN,gN,mN,_N,yN,vN,bN,xN,aA,WE,$E,jE,HE,eC,0,$y,Jy,Ky,Kl)})(gn,oA,fN,Pn,wn,qs,$l,gn.layers[0],gn.collisionBoxArray,Nn.index,Nn.sourceLayerIndex,gn.index,Rf,Kg,Zg,xs,Lc,Yh,Yg,Xl,Nn,bs,En,Wl,ei)};if(kc==="line")for(var ed=0,Qg=hE(Nn.geometry,0,0,8192,8192);ed<Qg.length;ed+=1)for(var e0=Qg[ed],Qp=0,eA=q8(e0,Zh,Zp,Pn.vertical||Ma,wn,24,Kh,gn.overscaling,8192);Qp<eA.length;Qp+=1){var t0=eA[Qp];Ma&&Y8(gn,Ma.text,Yp,t0)||Iu(e0,t0)}else if(kc==="line-center")for(var tA=0,rA=Nn.geometry;tA<rA.length;tA+=1){var nA=rA[tA];if(nA.length>1){var r0=X8(nA,Zp,Pn.vertical||Ma,wn,24,Kh);r0&&Iu(nA,r0)}}else if(Nn.type==="Polygon")for(var td=0,n0=Iy(Nn.geometry,0);td<n0.length;td+=1){var rd=n0[td],iA=K8(rd,16);Iu(rd[0],new Gh(iA.x,iA.y,0))}else if(Nn.type==="LineString")for(var Of=0,sA=Nn.geometry;Of<sA.length;Of+=1){var nd=sA[Of];Iu(nd,new Gh(nd[0].x,nd[0].y,0))}else if(Nn.type==="Point")for(var Gy=0,RE=Nn.geometry;Gy<RE.length;Gy+=1)for(var jy=0,OE=RE[Gy];jy<OE.length;jy+=1){var Hy=OE[jy];Iu([Hy],new Gh(Hy.x,Hy.y,0))}})(a,yt,nr,cs,x,J,Kt,br,ir,Ds,O)},lt=0,mt=a.features;lt<mt.length;lt+=1)Ke();B&&a.generateCollisionDebugBuffers()},o.perspective=function(a,u,p,x,C){var B,O=1/Math.tan(u/2);return a[0]=O/p,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=O,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,C!=null&&C!==1/0?(a[10]=(C+x)*(B=1/(x-C)),a[14]=2*C*x*B):(a[10]=-1,a[14]=-2*x),a},o.pick=function(a,u){for(var p={},x=0;x<u.length;x++){var C=u[x];C in a&&(p[C]=a[C])}return p},o.plugin=is,o.polygonIntersectsPolygon=Gl,o.postMapLoadEvent=gi,o.postTurnstileEvent=Rr,o.potpack=tE,o.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.register=or,o.registerForPluginStateChange=function(a){return a({pluginStatus:Ps,pluginURL:ea}),wi.on("pluginStateChange",a),a},o.renderColorRamp=LT,o.rotate=function(a,u,p){var x=u[0],C=u[1],B=u[2],O=u[3],k=Math.sin(p),G=Math.cos(p);
2097return a[0]=x*G+B*k,a[1]=C*G+O*k,a[2]=x*-k+B*G,a[3]=C*-k+O*G,a},o.rotateX=function(a,u,p){var x=Math.sin(p),C=Math.cos(p),B=u[4],O=u[5],k=u[6],G=u[7],J=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]=B*C+J*x,a[5]=O*C+Q*x,a[6]=k*C+ie*x,a[7]=G*C+fe*x,a[8]=J*C-B*x,a[9]=Q*C-O*x,a[10]=ie*C-k*x,a[11]=fe*C-G*x,a},o.rotateZ=function(a,u,p){var x=Math.sin(p),C=Math.cos(p),B=u[0],O=u[1],k=u[2],G=u[3],J=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]=B*C+J*x,a[1]=O*C+Q*x,a[2]=k*C+ie*x,a[3]=G*C+fe*x,a[4]=J*C-B*x,a[5]=Q*C-O*x,a[6]=ie*C-k*x,a[7]=fe*C-G*x,a},o.scale=function(a,u,p){var x=p[0],C=p[1],B=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]*C,a[5]=u[5]*C,a[6]=u[6]*C,a[7]=u[7]*C,a[8]=u[8]*B,a[9]=u[9]*B,a[10]=u[10]*B,a[11]=u[11]*B,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){Pe=a,kt=u},o.setRTLTextPlugin=function(a,u,p){if(p===void 0&&(p=!1),Ps==="deferred"||Ps==="loading"||Ps==="loaded")throw new Error("setRTLTextPlugin cannot be called multiple times.");ea=Jt.resolveURL(a),Ps="deferred",vu=u,zl(),p||wo()},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=$8,o.transformMat3=function(a,u,p){var x=u[0],C=u[1],B=u[2];return a[0]=x*p[0]+C*p[3]+B*p[6],a[1]=x*p[1]+C*p[4]+B*p[7],a[2]=x*p[2]+C*p[5]+B*p[8],a},o.transformMat4=Dh,o.translate=function(a,u,p){var x,C,B,O,k,G,J,Q,ie,fe,ye,ke,Ne=p[0],He=p[1],Ge=p[2];return u===a?(a[12]=u[0]*Ne+u[4]*He+u[8]*Ge+u[12],a[13]=u[1]*Ne+u[5]*He+u[9]*Ge+u[13],a[14]=u[2]*Ne+u[6]*He+u[10]*Ge+u[14],a[15]=u[3]*Ne+u[7]*He+u[11]*Ge+u[15]):(C=u[1],B=u[2],O=u[3],k=u[4],G=u[5],J=u[6],Q=u[7],ie=u[8],fe=u[9],ye=u[10],ke=u[11],a[0]=x=u[0],a[1]=C,a[2]=B,a[3]=O,a[4]=k,a[5]=G,a[6]=J,a[7]=Q,a[8]=ie,a[9]=fe,a[10]=ye,a[11]=ke,a[12]=x*Ne+k*He+ie*Ge+u[12],a[13]=C*Ne+G*He+fe*Ge+u[13],a[14]=B*Ne+J*He+ye*Ge+u[14],a[15]=O*Ne+Q*He+ke*Ge+u[15]),a},o.triggerPluginCompletionEvent=bf,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=Np,o.validateStyle=Sc,o.values=function(a){var u=[];for(var p in a)u.push(a[p]);return u},o.vectorTile=Nh,o.version="1.13.3",o.warnOnce=re,o.webpSupported=Ar,o.window=I,o.wrap=V})),s(["./shared"],(function(o){function l(Z){var ne=typeof Z;if(ne==="number"||ne==="boolean"||ne==="string"||Z==null)return JSON.stringify(Z);if(Array.isArray(Z)){for(var ce="[",ve=0,Fe=Z;ve<Fe.length;ve+=1)ce+=l(Fe[ve])+",";return ce+"]"}for(var he=Object.keys(Z).sort(),be="{",ae=0;ae<he.length;ae++)be+=JSON.stringify(he[ae])+":"+l(Z[he[ae]])+",";return be+"}"}function f(Z){for(var ne="",ce=0,ve=o.refProperties;ce<ve.length;ce+=1)ne+="/"+l(Z[ve[ce]]);return ne}var A=function(Z){this.keyCache={},Z&&this.replace(Z)};A.prototype.replace=function(Z){this._layerConfigs={},this._layers={},this.update(Z,[])},A.prototype.update=function(Z,ne){for(var ce=this,ve=0,Fe=Z;ve<Fe.length;ve+=1){var he=Fe[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,Se=ne;ae<Se.length;ae+=1){var g=Se[ae];delete this.keyCache[g],delete this._layerConfigs[g],delete this._layers[g]}this.familiesBySource={};for(var le=0,xt=(function(Pt,jt){for(var Ur={},Qt=0;Qt<Pt.length;Qt++){var en=jt&&jt[Pt[Qt].id]||f(Pt[Qt]);jt&&(jt[Pt[Qt].id]=en);var ln=Ur[en];ln||(ln=Ur[en]=[]),ln.push(Pt[Qt])}var $r=[];for(var Xr in Ur)$r.push(Ur[Xr]);return $r})(o.values(this._layerConfigs),this.keyCache);le<xt.length;le+=1){var Je=xt[le].map((function(Pt){return ce._layers[Pt.id]})),Ct=Je[0];if(Ct.visibility!=="none"){var Mt=Ct.source||"",Ft=this.familiesBySource[Mt];Ft||(Ft=this.familiesBySource[Mt]={});var ht=Ct.sourceLayer||"_geojsonTileLayer",Lt=Ft[ht];Lt||(Lt=Ft[ht]=[]),Lt.push(Je)}}};var v=function(Z){var ne={},ce=[];for(var ve in Z){var Fe=Z[ve],he=ne[ve]={};for(var be in Fe){var ae=Fe[+be];
vendor: 8,791 bytes, line 2097
2097if(ae&&ae.bitmap.width!==0&&ae.bitmap.height!==0){var Se={x:0,y:0,w:ae.bitmap.width+2,h:ae.bitmap.height+2};ce.push(Se),he[be]={rect:Se,metrics:ae.metrics}}}}var g=o.potpack(ce),le=new o.AlphaImage({width:g.w||1,height:g.h||1});for(var xt in Z){var Je=Z[xt];for(var Ct in Je){var Mt=Je[+Ct];if(Mt&&Mt.bitmap.width!==0&&Mt.bitmap.height!==0){var Ft=ne[xt][Ct].rect;o.AlphaImage.copy(Mt.bitmap,le,{x:0,y:0},{x:Ft.x+1,y:Ft.y+1},Mt.bitmap)}}}this.image=le,this.positions=ne};o.register("GlyphAtlas",v);var T=function(Z){this.tileID=new o.OverscaledTileID(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId};function I(Z,ne,ce){for(var ve=new o.EvaluationParameters(ne),Fe=0,he=Z;Fe<he.length;Fe+=1)he[Fe].recalculate(ve,ce)}function F(Z,ne){var ce=o.getArrayBuffer(Z.request,(function(ve,Fe,he,be){ve?ne(ve):Fe&&ne(null,{vectorTile:new o.vectorTile.VectorTile(new o.pbf(Fe)),rawData:Fe,cacheControl:he,expires:be})}));return function(){ce.cancel(),ne()}}T.prototype.parse=function(Z,ne,ce,ve,Fe){var he=this;this.status="parsing",this.data=Z,this.collisionBoxArray=new o.CollisionBoxArray;var be=new o.DictionaryCoder(Object.keys(Z.layers).sort()),ae=new o.FeatureIndex(this.tileID,this.promoteId);ae.bucketLayerIDs=[];var Se,g,le,xt,Je={},Ct={featureIndex:ae,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ce},Mt=ne.familiesBySource[this.source];for(var Ft in Mt){var ht=Z.layers[Ft];if(ht){ht.version===1&&o.warnOnce('Vector tile source "'+this.source+'" layer "'+Ft+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var Lt=be.encode(Ft),Pt=[],jt=0;jt<ht.length;jt++){var Ur=ht.feature(jt),Qt=ae.getId(Ur,Ft);Pt.push({feature:Ur,id:Qt,index:jt,sourceLayerIndex:Lt})}for(var en=0,ln=Mt[Ft];en<ln.length;en+=1){var $r=ln[en],Xr=$r[0];Xr.minzoom&&this.zoom<Math.floor(Xr.minzoom)||Xr.maxzoom&&this.zoom>=Xr.maxzoom||Xr.visibility!=="none"&&(I($r,this.zoom,ce),(Je[Xr.id]=Xr.createBucket({index:ae.bucketLayerIDs.length,layers:$r,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Lt,sourceID:this.source})).populate(Pt,Ct,this.tileID.canonical),ae.bucketLayerIDs.push($r.map((function(Be){return Be.id}))))}}}var Gr=o.mapObject(Ct.glyphDependencies,(function(Be){return Object.keys(Be).map(Number)}));Object.keys(Gr).length?ve.send("getGlyphs",{uid:this.uid,stacks:Gr},(function(Be,qt){Se||(Se=Be,g=qt,pr.call(he))})):g={};var mi=Object.keys(Ct.iconDependencies);mi.length?ve.send("getImages",{icons:mi,source:this.source,tileID:this.tileID,type:"icons"},(function(Be,qt){Se||(Se=Be,le=qt,pr.call(he))})):le={};var qr=Object.keys(Ct.patternDependencies);function pr(){if(Se)return Fe(Se);if(g&&le&&xt){var Be=new v(g),qt=new o.ImageAtlas(le,xt);for(var tn in Je){var Wi=Je[tn];Wi instanceof o.SymbolBucket?(I(Wi.layers,this.zoom,ce),o.performSymbolLayout(Wi,g,Be.positions,le,qt.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):Wi.hasPattern&&(Wi instanceof o.LineBucket||Wi instanceof o.FillBucket||Wi instanceof o.FillExtrusionBucket)&&(I(Wi.layers,this.zoom,ce),Wi.addFeatures(Ct,this.tileID.canonical,qt.patternPositions))}this.status="done",Fe(null,{buckets:o.values(Je).filter((function(_a){return!_a.isEmpty()})),featureIndex:ae,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Be.image,imageAtlas:qt,glyphMap:this.returnDependencies?g:null,iconMap:this.returnDependencies?le:null,glyphPositions:this.returnDependencies?Be.positions:null})}}qr.length?ve.send("getImages",{icons:qr,source:this.source,tileID:this.tileID,type:"patterns"},(function(Be,qt){Se||(Se=Be,xt=qt,pr.call(he))})):xt={},pr.call(this)};var N=function(Z,ne,ce,ve){this.actor=Z,this.layerIndex=ne,this.availableImages=ce,this.loadVectorData=ve||F,this.loading={},this.loaded={}};N.prototype.loadTile=function(Z,ne){var ce=this,ve=Z.uid;this.loading||(this.loading={});var Fe=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new o.RequestPerformance(Z.request),he=this.loading[ve]=new T(Z);he.abort=this.loadVectorData(Z,(function(be,ae){if(delete ce.loading[ve],be||!ae)return he.status="done",ce.loaded[ve]=he,ne(be);var Se=ae.rawData,g={};ae.expires&&(g.expires=ae.expires),ae.cacheControl&&(g.cacheControl=ae.cacheControl);var le={};if(Fe){var xt=Fe.finish();xt&&(le.resourceTiming=JSON.parse(JSON.stringify(xt)))}he.vectorTile=ae.vectorTile,he.parse(ae.vectorTile,ce.layerIndex,ce.availableImages,ce.actor,(function(Je,Ct){if(Je||!Ct)return ne(Je);ne(null,o.extend({rawTileData:Se.slice(0)},Ct,g,le))})),ce.loaded=ce.loaded||{},ce.loaded[ve]=he}))},N.prototype.reloadTile=function(Z,ne){var ce=this,ve=this.loaded,Fe=Z.uid,he=this;if(ve&&ve[Fe]){var be=ve[Fe];be.showCollisionBoxes=Z.showCollisionBoxes;var ae=function(Se,g){var le=be.reloadCallback;le&&(delete be.reloadCallback,be.parse(be.vectorTile,he.layerIndex,ce.availableImages,he.actor,le)),ne(Se,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(Z,ne){var ce=this.loading,ve=Z.uid;ce&&ce[ve]&&ce[ve].abort&&(ce[ve].abort(),delete ce[ve]),ne()},N.prototype.removeTile=function(Z,ne){var ce=this.loaded,ve=Z.uid;ce&&ce[ve]&&delete ce[ve],ne()};var U=o.window.ImageBitmap,$=function(){this.loaded={}};function V(Z,ne){if(Z.length!==0){j(Z[0],ne);for(var ce=1;ce<Z.length;ce++)j(Z[ce],!ne)}}function j(Z,ne){for(var ce=0,ve=0,Fe=0,he=Z.length,be=he-1;Fe<he;be=Fe++){var ae=(Z[Fe][0]-Z[be][0])*(Z[be][1]+Z[Fe][1]),Se=ce+ae;ve+=Math.abs(ce)>=Math.abs(ae)?ce-Se+ae:ae-Se+ce,ce=Se}ce+ve>=0!=!!ne&&Z.reverse()}$.prototype.loadTile=function(Z,ne){var ce=Z.uid,ve=Z.encoding,Fe=Z.rawImageData,he=U&&Fe instanceof U?this.getImageData(Fe):Fe,be=new o.DEMData(ce,he,ve);this.loaded=this.loaded||{},this.loaded[ce]=be,ne(null,be)},$.prototype.getImageData=function(Z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Z.width,Z.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=Z.width,this.offscreenCanvas.height=Z.height,this.offscreenCanvasContext.drawImage(Z,0,0,Z.width,Z.height);var ne=this.offscreenCanvasContext.getImageData(-1,-1,Z.width+2,Z.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(Z){var ne=this.loaded,ce=Z.uid;ne&&ne[ce]&&delete ne[ce]};var X=o.vectorTile.VectorTileFeature.prototype.toGeoJSON,ue=function(Z){this._feature=Z,this.extent=o.EXTENT,this.type=Z.type,this.properties=Z.tags,"id"in Z&&!isNaN(Z.id)&&(this.id=parseInt(Z.id,10))};ue.prototype.loadGeometry=function(){if(this._feature.type===1){for(var Z=[],ne=0,ce=this._feature.geometry;ne<ce.length;ne+=1){var ve=ce[ne];Z.push([new o.Point$1(ve[0],ve[1])])}return Z}for(var Fe=[],he=0,be=this._feature.geometry;he<be.length;he+=1){for(var ae=[],Se=0,g=be[he];Se<g.length;Se+=1){var le=g[Se];ae.push(new o.Point$1(le[0],le[1]))}Fe.push(ae)}return Fe},ue.prototype.toGeoJSON=function(Z,ne,ce){return X.call(this,Z,ne,ce)};var K=function(Z){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.EXTENT,this.length=Z.length,this._features=Z};K.prototype.feature=function(Z){return new ue(this._features[Z])};var se=o.vectorTile.VectorTileFeature,Ee=Ue;function Ue(Z,ne){this.options=ne||{},this.features=Z,this.length=Z.length}function de(Z,ne){this.id=typeof Z.id=="number"?Z.id:void 0,this.type=Z.type,this.rawGeometry=Z.type===1?[Z.geometry]:Z.geometry,this.properties=Z.tags,this.extent=ne||4096}Ue.prototype.feature=function(Z){return new de(this.features[Z],this.options.extent)},de.prototype.loadGeometry=function(){var Z=this.rawGeometry;this.geometry=[];for(var ne=0;ne<Z.length;ne++){for(var ce=Z[ne],ve=[],Fe=0;Fe<ce.length;Fe++)ve.push(new o.Point$1(ce[Fe][0],ce[Fe][1]));this.geometry.push(ve)}return this.geometry},de.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Z=this.geometry,ne=1/0,ce=-1/0,ve=1/0,Fe=-1/0,he=0;he<Z.length;he++)for(var be=Z[he],ae=0;ae<be.length;ae++){var Se=be[ae];ne=Math.min(ne,Se.x),ce=Math.max(ce,Se.x),ve=Math.min(ve,Se.y),Fe=Math.max(Fe,Se.y)}return[ne,ve,ce,Fe]},de.prototype.toGeoJSON=se.prototype.toGeoJSON;var me=W,pe=Ee;function W(Z){var ne=new o.pbf;
2097return(function(ce,ve){for(var Fe in ce.layers)ve.writeMessage(3,re,ce.layers[Fe])})(Z,ne),ne.finish()}function re(Z,ne){var ce;ne.writeVarintField(15,Z.version||1),ne.writeStringField(1,Z.name||""),ne.writeVarintField(5,Z.extent||4096);var ve={keys:[],values:[],keycache:{},valuecache:{}};for(ce=0;ce<Z.length;ce++)ve.feature=Z.feature(ce),ne.writeMessage(2,Ce,ve);var Fe=ve.keys;for(ce=0;ce<Fe.length;ce++)ne.writeStringField(3,Fe[ce]);var he=ve.values;for(ce=0;ce<he.length;ce++)ne.writeMessage(4,Ye,he[ce])}function Ce(Z,ne){var ce=Z.feature;ce.id!==void 0&&ne.writeVarintField(1,ce.id),ne.writeMessage(2,et,Z),ne.writeVarintField(3,ce.type),ne.writeMessage(4,Ve,ce)}function et(Z,ne){var ce=Z.feature,ve=Z.keys,Fe=Z.values,he=Z.keycache,be=Z.valuecache;for(var ae in ce.properties){var Se=he[ae];Se===void 0&&(ve.push(ae),he[ae]=Se=ve.length-1),ne.writeVarint(Se);var g=ce.properties[ae],le=typeof g;le!=="string"&&le!=="boolean"&&le!=="number"&&(g=JSON.stringify(g));var xt=le+":"+g,Je=be[xt];Je===void 0&&(Fe.push(g),be[xt]=Je=Fe.length-1),ne.writeVarint(Je)}}function _e(Z,ne){return(ne<<3)+(7&Z)}function Le(Z){return Z<<1^Z>>31}function Ve(Z,ne){for(var ce=Z.loadGeometry(),ve=Z.type,Fe=0,he=0,be=ce.length,ae=0;ae<be;ae++){var Se=ce[ae],g=1;ve===1&&(g=Se.length),ne.writeVarint(_e(1,g));for(var le=ve===3?Se.length-1:Se.length,xt=0;xt<le;xt++){xt===1&&ve!==1&&ne.writeVarint(_e(2,le-1));var Je=Se[xt].x-Fe,Ct=Se[xt].y-he;ne.writeVarint(Le(Je)),ne.writeVarint(Le(Ct)),Fe+=Je,he+=Ct}ve===3&&ne.writeVarint(_e(7,1))}}function Ye(Z,ne){var ce=typeof Z;ce==="string"?ne.writeStringField(1,Z):ce==="boolean"?ne.writeBooleanField(7,Z):ce==="number"&&(Z%1!=0?ne.writeDoubleField(3,Z):Z<0?ne.writeSVarintField(6,Z):ne.writeVarintField(5,Z))}function tt(Z,ne,ce,ve){rt(Z,ce,ve),rt(ne,2*ce,2*ve),rt(ne,2*ce+1,2*ve+1)}function rt(Z,ne,ce){var ve=Z[ne];Z[ne]=Z[ce],Z[ce]=ve}function ut(Z,ne,ce,ve){var Fe=Z-ce,he=ne-ve;return Fe*Fe+he*he}me.fromVectorTileJs=W,me.fromGeojsonVt=function(Z,ne){ne=ne||{};var ce={};for(var ve in Z)ce[ve]=new Ee(Z[ve].features,ne),ce[ve].name=ve,ce[ve].version=ne.version,ce[ve].extent=ne.extent;return W({layers:ce})},me.GeoJSONWrapper=pe;var vt=function(Z){return Z[0]},It=function(Z){return Z[1]},st=function(Z,ne,ce,ve,Fe){ne===void 0&&(ne=vt),ce===void 0&&(ce=It),ve===void 0&&(ve=64),Fe===void 0&&(Fe=Float64Array),this.nodeSize=ve,this.points=Z;for(var he=Z.length<65536?Uint16Array:Uint32Array,be=this.ids=new he(Z.length),ae=this.coords=new Fe(2*Z.length),Se=0;Se<Z.length;Se++)be[Se]=Se,ae[2*Se]=ne(Z[Se]),ae[2*Se+1]=ce(Z[Se]);(function g(le,xt,Je,Ct,Mt,Ft){if(!(Mt-Ct<=Je)){var ht=Ct+Mt>>1;(function Lt(Pt,jt,Ur,Qt,en,ln){for(;en>Qt;){if(en-Qt>600){var $r=en-Qt+1,Xr=Ur-Qt+1,Gr=Math.log($r),mi=.5*Math.exp(2*Gr/3),qr=.5*Math.sqrt(Gr*mi*($r-mi)/$r)*(Xr-$r/2<0?-1:1);Lt(Pt,jt,Ur,Math.max(Qt,Math.floor(Ur-Xr*mi/$r+qr)),Math.min(en,Math.floor(Ur+($r-Xr)*mi/$r+qr)),ln)}var pr=jt[2*Ur+ln],Be=Qt,qt=en;for(tt(Pt,jt,Qt,Ur),jt[2*en+ln]>pr&&tt(Pt,jt,Qt,en);Be<qt;){for(tt(Pt,jt,Be,qt),Be++,qt--;jt[2*Be+ln]<pr;)Be++;for(;jt[2*qt+ln]>pr;)qt--}jt[2*Qt+ln]===pr?tt(Pt,jt,Qt,qt):tt(Pt,jt,++qt,en),qt<=Ur&&(Qt=qt+1),Ur<=qt&&(en=qt-1)}})(le,xt,ht,Ct,Mt,Ft%2),g(le,xt,Je,Ct,ht-1,Ft+1),g(le,xt,Je,ht+1,Mt,Ft+1)}})(be,ae,ve,0,be.length-1,0)};st.prototype.range=function(Z,ne,ce,ve){return(function(Fe,he,be,ae,Se,g,le){for(var xt,Je,Ct=[0,Fe.length-1,0],Mt=[];Ct.length;){var Ft=Ct.pop(),ht=Ct.pop(),Lt=Ct.pop();if(ht-Lt<=le)for(var Pt=Lt;Pt<=ht;Pt++)Je=he[2*Pt+1],(xt=he[2*Pt])>=be&&xt<=Se&&Je>=ae&&Je<=g&&Mt.push(Fe[Pt]);else{var jt=Math.floor((Lt+ht)/2);Je=he[2*jt+1],(xt=he[2*jt])>=be&&xt<=Se&&Je>
2097=ae&&Je<=g&&Mt.push(Fe[jt]);var Ur=(Ft+1)%2;(Ft===0?be<=xt:ae<=Je)&&(Ct.push(Lt),Ct.push(jt-1),Ct.push(Ur)),(Ft===0?Se>=xt:g>=Je)&&(Ct.push(jt+1),Ct.push(ht),Ct.push(Ur))}}return Mt})(this.ids,this.coords,Z,ne,ce,ve,this.nodeSize)},st.prototype.within=function(Z,ne,ce){return(function(ve,Fe,he,be,ae,Se){for(var g=[0,ve.length-1,0],le=[],xt=ae*ae;g.length;){var Je=g.pop(),Ct=g.pop(),Mt=g.pop();if(Ct-Mt<=Se)for(var Ft=Mt;Ft<=Ct;Ft++)ut(Fe[2*Ft],Fe[2*Ft+1],he,be)<=xt&&le.push(ve[Ft]);else{var ht=Math.floor((Mt+Ct)/2),Lt=Fe[2*ht],Pt=Fe[2*ht+1];ut(Lt,Pt,he,be)<=xt&&le.push(ve[ht]);var jt=(Je+1)%2;(Je===0?he-ae<=Lt:be-ae<=Pt)&&(g.push(Mt),g.push(ht-1),g.push(jt)),(Je===0?he+ae>=Lt:be+ae>=Pt)&&(g.push(ht+1),g.push(Ct),g.push(jt))}}return le})(this.ids,this.coords,Z,ne,ce,this.nodeSize)};var dr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(Z){return Z}},er=function(Z){this.options=jn(Object.create(dr),Z),this.trees=new Array(this.options.maxZoom+1)};function Jt(Z,ne,ce,ve,Fe){return{x:Z,y:ne,zoom:1/0,id:ce,parentId:-1,numPoints:ve,properties:Fe}}function Nt(Z,ne){var ce=Z.geometry.coordinates,ve=ce[1];return{x:Mr(ce[0]),y:xr(ve),zoom:1/0,index:ne,parentId:-1}}function Ar(Z){return{type:"Feature",id:Z.id,properties:cn(Z),geometry:{type:"Point",coordinates:[(ve=Z.x,360*(ve-.5)),(ne=Z.y,ce=(180-360*ne)*Math.PI/180,360*Math.atan(Math.exp(ce))/Math.PI-90)]}};var ne,ce,ve}function cn(Z){var ne=Z.numPoints,ce=ne>=1e4?Math.round(ne/1e3)+"k":ne>=1e3?Math.round(ne/100)/10+"k":ne;return jn(jn({},Z.properties),{cluster:!0,cluster_id:Z.id,point_count:ne,point_count_abbreviated:ce})}function Mr(Z){return Z/360+.5}function xr(Z){var ne=Math.sin(Z*Math.PI/180),ce=.5-.25*Math.log((1+ne)/(1-ne))/Math.PI;return ce<0?0:ce>1?1:ce}function jn(Z,ne){for(var ce in ne)Z[ce]=ne[ce];return Z}function _r(Z){return Z.x}function yr(Z){return Z.y}function un(Z,ne,ce,ve,Fe,he){var be=Fe-ce,ae=he-ve;if(be!==0||ae!==0){var Se=((Z-ce)*be+(ne-ve)*ae)/(be*be+ae*ae);Se>1?(ce=Fe,ve=he):Se>0&&(ce+=be*Se,ve+=ae*Se)}return(be=Z-ce)*be+(ae=ne-ve)*ae}function Dr(Z,ne,ce,ve){var Fe={id:Z===void 0?null:Z,type:ne,geometry:ce,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")li(he,be);else if(ae==="Polygon"||ae==="MultiLineString")for(var Se=0;Se<be.length;Se++)li(he,be[Se]);else if(ae==="MultiPolygon")for(Se=0;Se<be.length;Se++)for(var g=0;g<be[Se].length;g++)li(he,be[Se][g])})(Fe),Fe}function li(Z,ne){for(var ce=0;ce<ne.length;ce+=3)Z.minX=Math.min(Z.minX,ne[ce]),Z.minY=Math.min(Z.minY,ne[ce+1]),Z.maxX=Math.max(Z.maxX,ne[ce]),Z.maxY=Math.max(Z.maxY,ne[ce+1])}function Yn(Z,ne,ce,ve){if(ne.geometry){var Fe=ne.geometry.coordinates,he=ne.geometry.type,be=Math.pow(ce.tolerance/((1<<ce.maxZoom)*ce.extent),2),ae=[],Se=ne.id;if(ce.promoteId?Se=ne.properties[ce.promoteId]:ce.generateId&&(Se=ve||0),he==="Point")mn(Fe,ae);else if(he==="MultiPoint")for(var g=0;g<Fe.length;g++)mn(Fe[g],ae);else if(he==="LineString")ri(Fe,ae,be,!1);else if(he==="MultiLineString"){if(ce.lineMetrics){for(g=0;g<Fe.length;g++)ri(Fe[g],ae=[],be,!1),Z.push(Dr(Se,"LineString",ae,ne.properties));return}Hn(Fe,ae,be,!1)}else if(he==="Polygon")Hn(Fe,ae,be,!0);else{if(he!=="MultiPolygon"){if(he==="GeometryCollection"){for(g=0;g<ne.geometry.geometries.length;g++)Yn(Z,{id:Se,geometry:ne.geometry.geometries[g],properties:ne.properties},ce,ve);return}throw new Error("Input data is not a valid GeoJSON object.")}for(g=0;g<Fe.length;g++){var le=[];Hn(Fe[g],le,be,!0),ae.push(le)}}Z.push(Dr(Se,he,ae,ne.properties))}}function mn(Z,ne){ne.push(Sn(Z[0])),ne.push(Qn(Z[1])),ne.push(0)}function ri(Z,ne,ce,ve){for(var Fe,he,be=0,ae=0;ae<Z.length;ae++){var Se=Sn(Z[ae][0]),g=Qn(Z[ae][1]);ne.push(Se),ne.push(g),ne.push(0),ae>0&&(be+=ve?(Fe*g-Se*he)/2:Math.sqrt(Math.pow(Se-Fe,2)+Math.pow(g-he,2))),Fe=Se,he=g}var le=ne.length-3;ne[2]=1,(function xt(Je,Ct,Mt,Ft){for(var ht,Lt=Ft,Pt=Mt-Ct>>1,jt=Mt-Ct,Ur=Je[Ct],Qt=Je[Ct+1],en=Je[Mt],ln=Je[Mt+1],$r=Ct+3;$r<Mt;$r+=3){var Xr=un(Je[$r],Je[$r+1],Ur,Qt,en,ln);if(Xr>Lt)ht=$r,Lt=Xr;else if(Xr===Lt){var Gr=Math.abs($r-Pt);Gr<jt&&(ht=$r,jt=Gr)}}Lt>Ft&&(ht-Ct>3&&xt(Je,Ct,ht,Ft),Je[ht+2]=Lt,Mt-ht>3&&xt(Je,ht,Mt,Ft))})(ne,0,le,ce),ne[le+2]=1,ne.size=Math.abs(be),ne.start=0,ne.end=ne.size}function Hn(Z,ne,ce,ve){for(var Fe=0;Fe<Z.length;Fe++){var he=[];ri(Z[Fe],he,ce,ve),ne.push(he)}}function Sn(Z){return Z/360+.5}function Qn(Z){var ne=Math.sin(Z*Math.PI/180),ce=.5-.25*Math.log((1+ne)/(1-ne))/Math.PI;return ce<0?0:ce>1?1:ce}function Gt(Z,ne,ce,ve,Fe,he,be,ae){if(ve/=ne,he>=(ce/=ne)&&be<ve)return Z;if(be<ce||he>=ve)return null;for(var Se=[],g=0;g<Z.length;g++){var le=Z[g],xt=le.geometry,Je=le.type,Ct=Fe===0?le.minX:le.minY,Mt=Fe===0?le.maxX:le.maxY;if(Ct>=ce&&Mt<ve)Se.push(le);else if(!(Mt<ce||Ct>=ve)){var Ft=[];
2097if(Je==="Point"||Je==="MultiPoint")mr(xt,Ft,ce,ve,Fe);else if(Je==="LineString")Rr(xt,Ft,ce,ve,Fe,!1,ae.lineMetrics);else if(Je==="MultiLineString")gi(xt,Ft,ce,ve,Fe,!1);else if(Je==="Polygon")gi(xt,Ft,ce,ve,Fe,!0);else if(Je==="MultiPolygon")for(var ht=0;ht<xt.length;ht++){var Lt=[];gi(xt[ht],Lt,ce,ve,Fe,!0),Lt.length&&Ft.push(Lt)}if(Ft.length){if(ae.lineMetrics&&Je==="LineString"){for(ht=0;ht<Ft.length;ht++)Se.push(Dr(le.id,Je,Ft[ht],le.tags));continue}Je!=="LineString"&&Je!=="MultiLineString"||(Ft.length===1?(Je="LineString",Ft=Ft[0]):Je="MultiLineString"),Je!=="Point"&&Je!=="MultiPoint"||(Je=Ft.length===3?"Point":"MultiPoint"),Se.push(Dr(le.id,Je,Ft,le.tags))}}}return Se.length?Se:null}function mr(Z,ne,ce,ve,Fe){for(var he=0;he<Z.length;he+=3){var be=Z[he+Fe];be>=ce&&be<=ve&&(ne.push(Z[he]),ne.push(Z[he+1]),ne.push(Z[he+2]))}}function Rr(Z,ne,ce,ve,Fe,he,be){for(var ae,Se,g=nn(Z),le=Fe===0?kt:Wt,xt=Z.start,Je=0;Je<Z.length-3;Je+=3){var Ct=Z[Je],Mt=Z[Je+1],Ft=Z[Je+2],ht=Z[Je+3],Lt=Z[Je+4],Pt=Fe===0?Ct:Mt,jt=Fe===0?ht:Lt,Ur=!1;be&&(ae=Math.sqrt(Math.pow(Ct-ht,2)+Math.pow(Mt-Lt,2))),Pt<ce?jt>ce&&(Se=le(g,Ct,Mt,ht,Lt,ce),be&&(g.start=xt+ae*Se)):Pt>ve?jt<ve&&(Se=le(g,Ct,Mt,ht,Lt,ve),be&&(g.start=xt+ae*Se)):Pe(g,Ct,Mt,Ft),jt<ce&&Pt>=ce&&(Se=le(g,Ct,Mt,ht,Lt,ce),Ur=!0),jt>ve&&Pt<=ve&&(Se=le(g,Ct,Mt,ht,Lt,ve),Ur=!0),!he&&Ur&&(be&&(g.end=xt+ae*Se),ne.push(g),g=nn(Z)),be&&(xt+=ae)}var Qt=Z.length-3;Ct=Z[Qt],Mt=Z[Qt+1],Ft=Z[Qt+2],(Pt=Fe===0?Ct:Mt)>=ce&&Pt<=ve&&Pe(g,Ct,Mt,Ft),Qt=g.length-3,he&&Qt>=3&&(g[Qt]!==g[0]||g[Qt+1]!==g[1])&&Pe(g,g[0],g[1],g[2]),g.length&&ne.push(g)}function nn(Z){var ne=[];return ne.size=Z.size,ne.start=Z.start,ne.end=Z.end,ne}function gi(Z,ne,ce,ve,Fe,he){for(var be=0;be<Z.length;be++)Rr(Z[be],ne,ce,ve,Fe,he,!1)}function Pe(Z,ne,ce,ve){Z.push(ne),Z.push(ce),Z.push(ve)}function kt(Z,ne,ce,ve,Fe,he){var be=(he-ne)/(ve-ne);return Z.push(he),Z.push(ce+(Fe-ce)*be),Z.push(1),be}function Wt(Z,ne,ce,ve,Fe,he){var be=(he-ce)/(Fe-ce);return Z.push(ne+(ve-ne)*be),Z.push(he),Z.push(1),be}function cr(Z,ne){for(var ce=[],ve=0;ve<Z.length;ve++){var Fe,he=Z[ve],be=he.type;if(be==="Point"||be==="MultiPoint"||be==="LineString")Fe=Ze(he.geometry,ne);else if(be==="MultiLineString"||be==="Polygon"){Fe=[];for(var ae=0;ae<he.geometry.length;ae++)Fe.push(Ze(he.geometry[ae],ne))}else if(be==="MultiPolygon")for(Fe=[],ae=0;ae<he.geometry.length;ae++){for(var Se=[],g=0;g<he.geometry[ae].length;g++)Se.push(Ze(he.geometry[ae][g],ne));Fe.push(Se)}ce.push(Dr(he.id,be,Fe,he.tags))}return ce}function Ze(Z,ne){var ce=[];ce.size=Z.size,Z.start!==void 0&&(ce.start=Z.start,ce.end=Z.end);for(var ve=0;ve<Z.length;ve+=3)ce.push(Z[ve]+ne,Z[ve+1],Z[ve+2]);return ce}function Rt(Z,ne){if(Z.transformed)return Z;var ce,ve,Fe,he=1<<Z.z,be=Z.x,ae=Z.y;for(ce=0;ce<Z.features.length;ce++){var Se=Z.features[ce],g=Se.geometry,le=Se.type;if(Se.geometry=[],le===1)for(ve=0;ve<g.length;ve+=2)Se.geometry.push(Ae(g[ve],g[ve+1],ne,he,be,ae));else for(ve=0;ve<g.length;ve++){var xt=[];for(Fe=0;Fe<g[ve].length;Fe+=2)xt.push(Ae(g[ve][Fe],g[ve][Fe+1],ne,he,be,ae));Se.geometry.push(xt)}}return Z.transformed=!0,Z}function Ae(Z,ne,ce,ve,Fe,he){return[Math.round(ce*(Z*ve-Fe)),Math.round(ce*(ne*ve-he))]}function Vt(Z,ne,ce,ve,Fe){for(var he=ne===Fe.maxZoom?0:Fe.tolerance/((1<<ne)*Fe.extent),be={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:ce,y:ve,z:ne,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},ae=0;ae<Z.length;ae++){be.numFeatures++,Et(be,Z[ae],he,Fe);var Se=Z[ae].minX,g=Z[ae].minY,le=Z[ae].maxX,xt=Z[ae].maxY;Se<be.minX&&(be.minX=Se),g<be.minY&&(be.minY=g),le>be.maxX&&(be.maxX=le),xt>be.maxY&&(be.maxY=xt)}return be}function Et(Z,ne,ce,ve){var Fe=ne.geometry,he=ne.type,be=[];if(he==="Point"||he==="MultiPoint")for(var ae=0;ae<Fe.length;ae+=3)be.push(Fe[ae]),be.push(Fe[ae+1]),Z.numPoints++,Z.numSimplified++;else if(he==="LineString")H(be,Fe,Z,ce,!1,!1);else if(he==="MultiLineString"||he==="Polygon")for(ae=0;ae<Fe.length;ae++)H(be,Fe[ae],Z,ce,he==="Polygon",ae===0);else if(he==="MultiPolygon")for(var Se=0;Se<Fe.length;Se++){var g=Fe[Se];for(ae=0;ae<g.length;ae++)H(be,g[ae],Z,ce,!0,ae===0)}if(be.length){var le=ne.tags||null;if(he==="LineString"&&ve.lineMetrics){for(var xt in le={},ne.tags)le[xt]=ne.tags[xt];le.mapbox_clip_start=Fe.start/Fe.size,le.mapbox_clip_end=Fe.end/Fe.size}var Je={geometry:be,type:he==="Polygon"||he==="MultiPolygon"?3:he==="LineString"||he==="MultiLineString"?2:1,tags:le};ne.id!==null&&(Je.id=ne.id),Z.features.push(Je)}}function H(Z,ne,ce,ve,Fe,he){var be=ve*ve;if(ve>0&&ne.size<(Fe?be:ve))ce.numPoints+=ne.length/3;else{for(var ae=[],Se=0;Se<ne.length;Se+=3)(ve===0||ne[Se+2]>be)&&(ce.numSimplified++,ae.push(ne[Se]),ae.push(ne[Se+1])),ce.numPoints++;Fe&&(function(g,le){for(var xt=0,Je=0,Ct=g.length,Mt=Ct-2;Je<Ct;Mt=Je,Je+=2)xt+=(g[Je]-g[Mt])*(g[Je+1]+g[Mt+1]);if(xt>0===le)for(Je=0,Ct=g.length;Je<Ct/2;Je+=2){var Ft=g[Je],ht=g[Je+1];g[Je]=g[Ct-2-Je],g[Je+1]=g[Ct-1-Je],g[Ct-2-Je]=Ft,g[Ct-1-Je]=ht}})(ae,he),Z.push(ae)}}function bt(Z,ne){var ce=(ne=this.options=(function(Fe,he){for(var be in he)Fe[be]=he[be];return Fe})(Object.create(this.options),ne)).debug;if(ce&&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(Fe,he){var be=[];if(Fe.type==="FeatureCollection")for(var ae=0;ae<Fe.features.length;ae++)Yn(be,Fe.features[ae],he,ae);else Yn(be,Fe.type==="Feature"?Fe:{geometry:Fe},he);return be})(Z,ne);this.tiles={},this.tileCoords=[],ce&&(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(Fe,he){var be=he.buffer/he.extent,ae=Fe,Se=Gt(Fe,1,-1-be,be,0,-1,2,he),g=Gt(Fe,1,1-be,2+be,0,-1,2,he);return(Se||g)&&(ae=Gt(Fe,1,-be,1+be,0,-1,2,he)||[],Se&&(ae=cr(Se,1).concat(ae)),g&&(ae=ae.concat(cr(g,-1)))),ae})(ve,ne)).length&&this.splitTile(ve,0,0,0),ce&&(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 St(Z,ne,ce){return 32*((1<<Z)*ce+ne)+Z}function Te(Z,ne){var ce=Z.tileID.canonical;if(!this._geoJSONIndex)return ne(null,null);var ve=this._geoJSONIndex.getTile(ce.z,ce.x,ce.y);if(!ve)return ne(null,null);var Fe=new K(ve.features),he=me(Fe);he.byteOffset===0&&he.byteLength===he.buffer.byteLength||(he=new Uint8Array(he)),ne(null,{vectorTile:Fe,rawData:he.buffer})}er.prototype.load=function(Z){var ne=this.options,ce=ne.log,ve=ne.minZoom,Fe=ne.maxZoom,he=ne.nodeSize;ce&&console.time("total time");var be="prepare "+Z.length+" points";ce&&console.time(be),this.points=Z;for(var ae=[],Se=0;Se<Z.length;Se++)Z[Se].geometry&&ae.push(Nt(Z[Se],Se));this.trees[Fe+1]=new st(ae,_r,yr,he,Float32Array),ce&&console.timeEnd(be);for(var g=Fe;g>=ve;g--){var le=+Date.now();ae=this._cluster(ae,g),this.trees[g]=new st(ae,_r,yr,he,Float32Array),ce&&console.log("z%d: %d clusters in %dms",g,ae.length,+Date.now()-le)}return ce&&console.timeEnd("total time"),this},er.prototype.getClusters=function(Z,ne){var ce=((Z[0]+180)%360+360)%360-180,ve=Math.max(-90,Math.min(90,Z[1])),Fe=Z[2]===180?180:((Z[2]+180)%360+360)%360-180,he=Math.max(-90,Math.min(90,Z[3]));if(Z[2]-Z[0]>=360)ce=-180,Fe=180;else if(ce>Fe){var be=this.getClusters([ce,ve,180,he],ne),ae=this.getClusters([-180,ve,Fe,he],ne);return be.concat(ae)}for(var Se=this.trees[this._limitZoom(ne)],g=[],le=0,xt=Se.range(Mr(ce),xr(he),Mr(Fe),xr(ve));le<xt.length;le+=1){var Je=Se.points[xt[le]];g.push(Je.numPoints?Ar(Je):this.points[Je.index])}return g},er.prototype.getChildren=function(Z){var ne=this._getOriginId(Z),ce=this._getOriginZoom(Z),ve="No cluster with the specified id.",Fe=this.trees[ce];if(!Fe)throw new Error(ve);var he=Fe.points[ne];
vendor: 5,764 bytes, line 2097
2097if(!he)throw new Error(ve);for(var be=this.options.radius/(this.options.extent*Math.pow(2,ce-1)),ae=[],Se=0,g=Fe.within(he.x,he.y,be);Se<g.length;Se+=1){var le=Fe.points[g[Se]];le.parentId===Z&&ae.push(le.numPoints?Ar(le):this.points[le.index])}if(ae.length===0)throw new Error(ve);return ae},er.prototype.getLeaves=function(Z,ne,ce){var ve=[];return this._appendLeaves(ve,Z,ne=ne||10,ce=ce||0,0),ve},er.prototype.getTile=function(Z,ne,ce){var ve=this.trees[this._limitZoom(Z)],Fe=Math.pow(2,Z),he=this.options,be=he.radius/he.extent,ae=(ce-be)/Fe,Se=(ce+1+be)/Fe,g={features:[]};return this._addTileFeatures(ve.range((ne-be)/Fe,ae,(ne+1+be)/Fe,Se),ve.points,ne,ce,Fe,g),ne===0&&this._addTileFeatures(ve.range(1-be/Fe,ae,1,Se),ve.points,Fe,ce,Fe,g),ne===Fe-1&&this._addTileFeatures(ve.range(0,ae,be/Fe,Se),ve.points,-1,ce,Fe,g),g.features.length?g:null},er.prototype.getClusterExpansionZoom=function(Z){for(var ne=this._getOriginZoom(Z)-1;ne<=this.options.maxZoom;){var ce=this.getChildren(Z);if(ne++,ce.length!==1)break;Z=ce[0].properties.cluster_id}return ne},er.prototype._appendLeaves=function(Z,ne,ce,ve,Fe){for(var he=0,be=this.getChildren(ne);he<be.length;he+=1){var ae=be[he],Se=ae.properties;if(Se&&Se.cluster?Fe+Se.point_count<=ve?Fe+=Se.point_count:Fe=this._appendLeaves(Z,Se.cluster_id,ce,ve,Fe):Fe<ve?Fe++:Z.push(ae),Z.length===ce)break}return Fe},er.prototype._addTileFeatures=function(Z,ne,ce,ve,Fe,he){for(var be=0,ae=Z;be<ae.length;be+=1){var Se=ne[ae[be]],g=Se.numPoints,le={type:1,geometry:[[Math.round(this.options.extent*(Se.x*Fe-ce)),Math.round(this.options.extent*(Se.y*Fe-ve))]],tags:g?cn(Se):this.points[Se.index].properties},xt=void 0;g?xt=Se.id:this.options.generateId?xt=Se.index:this.points[Se.index].id&&(xt=this.points[Se.index].id),xt!==void 0&&(le.id=xt),he.features.push(le)}},er.prototype._limitZoom=function(Z){return Math.max(this.options.minZoom,Math.min(+Z,this.options.maxZoom+1))},er.prototype._cluster=function(Z,ne){for(var ce=[],ve=this.options,Fe=ve.reduce,he=ve.minPoints,be=ve.radius/(ve.extent*Math.pow(2,ne)),ae=0;ae<Z.length;ae++){var Se=Z[ae];if(!(Se.zoom<=ne)){Se.zoom=ne;for(var g=this.trees[ne+1],le=g.within(Se.x,Se.y,be),xt=Se.numPoints||1,Je=xt,Ct=0,Mt=le;Ct<Mt.length;Ct+=1){var Ft=g.points[Mt[Ct]];Ft.zoom>ne&&(Je+=Ft.numPoints||1)}if(Je>=he){for(var ht=Se.x*xt,Lt=Se.y*xt,Pt=Fe&&xt>1?this._map(Se,!0):null,jt=(ae<<5)+(ne+1)+this.points.length,Ur=0,Qt=le;Ur<Qt.length;Ur+=1){var en=g.points[Qt[Ur]];if(!(en.zoom<=ne)){en.zoom=ne;var ln=en.numPoints||1;ht+=en.x*ln,Lt+=en.y*ln,en.parentId=jt,Fe&&(Pt||(Pt=this._map(Se,!0)),Fe(Pt,this._map(en)))}}Se.parentId=jt,ce.push(Jt(ht/Je,Lt/Je,jt,Je,Pt))}else if(ce.push(Se),Je>1)for(var $r=0,Xr=le;$r<Xr.length;$r+=1){var Gr=g.points[Xr[$r]];Gr.zoom<=ne||(Gr.zoom=ne,ce.push(Gr))}}}return ce},er.prototype._getOriginId=function(Z){return Z-this.points.length>>5},er.prototype._getOriginZoom=function(Z){return(Z-this.points.length)%32},er.prototype._map=function(Z,ne){if(Z.numPoints)return ne?jn({},Z.properties):Z.properties;var ce=this.points[Z.index].properties,ve=this.options.map(ce);return ne&&ve===ce?jn({},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(Z,ne,ce,ve,Fe,he,be){for(var ae=[Z,ne,ce,ve],Se=this.options,g=Se.debug;ae.length;){ve=ae.pop(),ce=ae.pop(),ne=ae.pop(),Z=ae.pop();var le=1<<ne,xt=St(ne,ce,ve),Je=this.tiles[xt];if(!Je&&(g>1&&console.time("creation"),Je=this.tiles[xt]=Vt(Z,ne,ce,ve,Se),this.tileCoords.push({z:ne,x:ce,y:ve}),g)){g>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ne,ce,ve,Je.numFeatures,Je.numPoints,Je.numSimplified),console.timeEnd("creation"));var Ct="z"+ne;this.stats[Ct]=(this.stats[Ct]||0)+1,this.total++}if(Je.source=Z,Fe){if(ne===Se.maxZoom||ne===Fe)continue;var Mt=1<<Fe-ne;if(ce!==Math.floor(he/Mt)||ve!==Math.floor(be/Mt))continue}else if(ne===Se.indexMaxZoom||Je.numPoints<=Se.indexMaxPoints)continue;if(Je.source=null,Z.length!==0){g>1&&console.time("clipping");var Ft,ht,Lt,Pt,jt,Ur,Qt=.5*Se.buffer/Se.extent,en=.5-Qt,ln=.5+Qt,$r=1+Qt;Ft=ht=Lt=Pt=null,jt=Gt(Z,le,ce-Qt,ce+ln,0,Je.minX,Je.maxX,Se),Ur=Gt(Z,le,ce+en,ce+$r,0,Je.minX,Je.maxX,Se),Z=null,jt&&(Ft=Gt(jt,le,ve-Qt,ve+ln,1,Je.minY,Je.maxY,Se),ht=Gt(jt,le,ve+en,ve+$r,1,Je.minY,Je.maxY,Se),jt=null),Ur&&(Lt=Gt(Ur,le,ve-Qt,ve+ln,1,Je.minY,Je.maxY,Se),Pt=Gt(Ur,le,ve+en,ve+$r,1,Je.minY,Je.maxY,Se),Ur=null),g>1&&console.timeEnd("clipping"),ae.push(Ft||[],ne+1,2*ce,2*ve),ae.push(ht||[],ne+1,2*ce,2*ve+1),ae.push(Lt||[],ne+1,2*ce+1,2*ve),ae.push(Pt||[],ne+1,2*ce+1,2*ve+1)}}},bt.prototype.getTile=function(Z,ne,ce){var ve=this.options,Fe=ve.extent,he=ve.debug;if(Z<0||Z>24)return null;var be=1<<Z,ae=St(Z,ne=(ne%be+be)%be,ce);if(this.tiles[ae])return Rt(this.tiles[ae],Fe);he>1&&console.log("drilling down to z%d-%d-%d",Z,ne,ce);for(var Se,g=Z,le=ne,xt=ce;!Se&&g>0;)g--,le=Math.floor(le/2),xt=Math.floor(xt/2),Se=this.tiles[St(g,le,xt)];return Se&&Se.source?(he>1&&console.log("found parent tile z%d-%d-%d",g,le,xt),he>1&&console.time("drilling down"),this.splitTile(Se.source,g,le,xt,Z,ne,ce),he>1&&console.timeEnd("drilling down"),this.tiles[ae]?Rt(this.tiles[ae],Fe):null):null};var Xe=(function(Z){function ne(ce,ve,Fe,he){Z.call(this,ce,ve,Fe,Te),he&&(this.loadGeoJSON=he)}return Z&&(ne.__proto__=Z),(ne.prototype=Object.create(Z&&Z.prototype)).constructor=ne,ne.prototype.loadData=function(ce,ve){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=ve,this._pendingLoadDataParams=ce,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},ne.prototype._loadData=function(){var ce=this;
2097if(this._pendingCallback&&this._pendingLoadDataParams){var ve=this._pendingCallback,Fe=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var he=!!(Fe&&Fe.request&&Fe.request.collectResourceTiming)&&new o.RequestPerformance(Fe.request);this.loadGeoJSON(Fe,(function(be,ae){if(be||!ae)return ve(be);if(typeof ae!="object")return ve(new Error("Input data given to '"+Fe.source+"' is not a valid GeoJSON object."));(function Je(Ct,Mt){var Ft,ht=Ct&&Ct.type;if(ht==="FeatureCollection")for(Ft=0;Ft<Ct.features.length;Ft++)Je(Ct.features[Ft],Mt);else if(ht==="GeometryCollection")for(Ft=0;Ft<Ct.geometries.length;Ft++)Je(Ct.geometries[Ft],Mt);else if(ht==="Feature")Je(Ct.geometry,Mt);else if(ht==="Polygon")V(Ct.coordinates,Mt);else if(ht==="MultiPolygon")for(Ft=0;Ft<Ct.coordinates.length;Ft++)V(Ct.coordinates[Ft],Mt);return Ct})(ae,!0);try{if(Fe.filter){var Se=o.createExpression(Fe.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Se.result==="error")throw new Error(Se.value.map((function(Je){return Je.key+": "+Je.message})).join(", "));var g=ae.features.filter((function(Je){return Se.value.evaluate({zoom:0},Je)}));ae={type:"FeatureCollection",features:g}}ce._geoJSONIndex=Fe.cluster?new er((function(Je){var Ct=Je.superclusterOptions,Mt=Je.clusterProperties;if(!Mt||!Ct)return Ct;for(var Ft={},ht={},Lt={accumulated:null,zoom:0},Pt={properties:null},jt=Object.keys(Mt),Ur=0,Qt=jt;Ur<Qt.length;Ur+=1){var en=Qt[Ur],ln=Mt[en],$r=ln[0],Xr=o.createExpression(ln[1]),Gr=o.createExpression(typeof $r=="string"?[$r,["accumulated"],["get",en]]:$r);Ft[en]=Xr.value,ht[en]=Gr.value}return Ct.map=function(mi){Pt.properties=mi;for(var qr={},pr=0,Be=jt;pr<Be.length;pr+=1){var qt=Be[pr];qr[qt]=Ft[qt].evaluate(Lt,Pt)}return qr},Ct.reduce=function(mi,qr){Pt.properties=qr;for(var pr=0,Be=jt;pr<Be.length;pr+=1){var qt=Be[pr];Lt.accumulated=mi[qt],mi[qt]=ht[qt].evaluate(Lt,Pt)}},Ct})(Fe)).load(ae.features):(function(Je,Ct){return new bt(Je,Ct)})(ae,Fe.geojsonVtOptions)}catch(Je){return ve(Je)}ce.loaded={};var le={};if(he){var xt=he.finish();xt&&(le.resourceTiming={},le.resourceTiming[Fe.source]=JSON.parse(JSON.stringify(xt)))}ve(null,le)}))}},ne.prototype.coalesce=function(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())},ne.prototype.reloadTile=function(ce,ve){var Fe=this.loaded;return Fe&&Fe[ce.uid]?Z.prototype.reloadTile.call(this,ce,ve):this.loadTile(ce,ve)},ne.prototype.loadGeoJSON=function(ce,ve){if(ce.request)o.getJSON(ce.request,ve);else{if(typeof ce.data!="string")return ve(new Error("Input data given to '"+ce.source+"' is not a valid GeoJSON object."));try{return ve(null,JSON.parse(ce.data))}catch{return ve(new Error("Input data given to '"+ce.source+"' is not a valid GeoJSON object."))}}},ne.prototype.removeSource=function(ce,ve){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),ve()},ne.prototype.getClusterExpansionZoom=function(ce,ve){try{ve(null,this._geoJSONIndex.getClusterExpansionZoom(ce.clusterId))}catch(Fe){ve(Fe)}},ne.prototype.getClusterChildren=function(ce,ve){try{ve(null,this._geoJSONIndex.getChildren(ce.clusterId))}catch(Fe){ve(Fe)}},ne.prototype.getClusterLeaves=function(ce,ve){try{ve(null,this._geoJSONIndex.getLeaves(ce.clusterId,ce.limit,ce.offset))}catch(Fe){ve(Fe)}},ne})(N),ct=function(Z){var ne=this;this.self=Z,this.actor=new o.Actor(Z,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:N,geojson:Xe},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(ce,ve){if(ne.workerSourceTypes[ce])throw new Error('Worker source with name "'+ce+'" already registered.');ne.workerSourceTypes[ce]=ve},this.self.registerRTLTextPlugin=function(ce){if(o.plugin.isParsed())throw new Error("RTL text plugin already registered.");o.plugin.applyArabicShaping=ce.applyArabicShaping,o.plugin.processBidirectionalText=ce.processBidirectionalText,o.plugin.processStyledBidirectionalText=ce.processStyledBidirectionalText}};return ct.prototype.setReferrer=function(Z,ne){this.referrer=ne},ct.prototype.setImages=function(Z,ne,ce){for(var ve in this.availableImages[Z]=ne,this.workerSources[Z]){var Fe=this.workerSources[Z][ve];for(var he in Fe)Fe[he].availableImages=ne}ce()},ct.prototype.setLayers=function(Z,ne,ce){this.getLayerIndex(Z).replace(ne),ce()},ct.prototype.updateLayers=function(Z,ne,ce){this.getLayerIndex(Z).update(ne.layers,ne.removedIds),ce()},ct.prototype.loadTile=function(Z,ne,ce){this.getWorkerSource(Z,ne.type,ne.source).loadTile(ne,ce)},ct.prototype.loadDEMTile=function(Z,ne,ce){this.getDEMWorkerSource(Z,ne.source).loadTile(ne,ce)},ct.prototype.reloadTile=function(Z,ne,ce){this.getWorkerSource(Z,ne.type,ne.source).reloadTile(ne,ce)},ct.prototype.abortTile=function(Z,ne,ce){this.getWorkerSource(Z,ne.type,ne.source).abortTile(ne,ce)},ct.prototype.removeTile=function(Z,ne,ce){this.getWorkerSource(Z,ne.type,ne.source).removeTile(ne,ce)},ct.prototype.removeDEMTile=function(Z,ne){this.getDEMWorkerSource(Z,ne.source).removeTile(ne)},ct.prototype.removeSource=function(Z,ne,ce){if(this.workerSources[Z]&&this.workerSources[Z][ne.type]&&this.workerSources[Z][ne.type][ne.source]){var ve=this.workerSources[Z][ne.type][ne.source];delete this.workerSources[Z][ne.type][ne.source],ve.removeSource!==void 0?ve.removeSource(ne,ce):ce()}},ct.prototype.loadWorkerSource=function(Z,ne,ce){try{this.self.importScripts(ne.url),ce()}catch(ve){ce(ve.toString())}},ct.prototype.syncRTLPluginState=function(Z,ne,ce){try{o.plugin.setState(ne);var ve=o.plugin.getPluginURL();if(o.plugin.isLoaded()&&!o.plugin.isParsed()&&ve!=null){this.self.importScripts(ve);var Fe=o.plugin.isParsed();ce(Fe?void 0:new Error("RTL Text Plugin failed to import scripts from "+ve),Fe)}}catch(he){ce(he.toString())}},ct.prototype.getAvailableImages=function(Z){var ne=this.availableImages[Z];return ne||(ne=[]),ne},ct.prototype.getLayerIndex=function(Z){var ne=this.layerIndexes[Z];return ne||(ne=this.layerIndexes[Z]=new A),ne},ct.prototype.getWorkerSource=function(Z,ne,ce){var ve=this;return this.workerSources[Z]||(this.workerSources[Z]={}),this.workerSources[Z][ne]||(this.workerSources[Z][ne]={}),this.workerSources[Z][ne][ce]||(this.workerSources[Z][ne][ce]=new this.workerSourceTypes[ne]({send:function(Fe,he,be){ve.actor.send(Fe,he,be,Z)}},this.getLayerIndex(Z),this.getAvailableImages(Z))),this.workerSources[Z][ne][ce]},ct.prototype.getDEMWorkerSource=function(Z,ne){return this.demWorkerSources[Z]||(this.demWorkerSources[Z]={}),this.demWorkerSources[Z][ne]||(this.demWorkerSources[Z][ne]=new $),this.demWorkerSources[Z][ne]},ct.prototype.enforceCacheSizeLimit=function(Z,ne){o.enforceCacheSizeLimit(ne)},typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new ct(self)),ct})),s(["./shared"],(function(o){var l=o.createCommonjsModule((function(c){function d(E){return!h(E)}function h(E){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"}),q=URL.createObjectURL(z);try{L=new Worker(q),R=!0}catch{R=!1}return L&&L.terminate(),URL.revokeObjectURL(q),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[M=E&&E.failIfMajorPerformanceCaveat]===void 0&&(m[M]=(function(R){var L=(function(q){var ee=document.createElement("canvas"),Y=Object.create(d.webGLContextAttributes);return Y.failIfMajorPerformanceCaveat=q,ee.probablySupportsContext?ee.probablySupportsContext("webgl",Y)||ee.probablySupportsContext("experimental-webgl",Y):ee.supportsContext?ee.supportsContext("webgl",Y)||ee.supportsContext("experimental-webgl",Y):ee.getContext("webgl",Y)||ee.getContext("experimental-webgl",Y)})(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)})(M)),m[M]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray supp
2097ort":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var M}c.exports?c.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(c,d,h){var m=o.window.document.createElement(c);return d!==void 0&&(m.className=d),h&&h.appendChild(m),m},createNS:function(c,d){return o.window.document.createElementNS(c,d)}},A=o.window.document&&o.window.document.documentElement.style;function v(c){if(!A)return c[0];for(var d=0;d<c.length;d++)if(c[d]in A)return c[d];return c[0]}var T,I=v(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);f.disableDrag=function(){A&&I&&(T=A[I],A[I]="none")},f.enableDrag=function(){A&&I&&(A[I]=T)};var F=v(["transform","WebkitTransform"]);f.setTransform=function(c,d){c.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(c,d,h,m){m===void 0&&(m={}),c.addEventListener(d,h,"passive"in m&&N?m:m.capture)},f.removeEventListener=function(c,d,h,m){m===void 0&&(m={}),c.removeEventListener(d,h,"passive"in m&&N?m:m.capture)};var $=function(c){c.preventDefault(),c.stopPropagation(),o.window.removeEventListener("click",$,!0)};function V(c){var d=c.userImage;return!!(d&&d.render&&d.render())&&(c.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(c,d){var h=c.getBoundingClientRect();return new o.Point(d.clientX-h.left-c.clientLeft,d.clientY-h.top-c.clientTop)},f.touchPos=function(c,d){for(var h=c.getBoundingClientRect(),m=[],E=0;E<d.length;E++)m.push(new o.Point(d[E].clientX-h.left-c.clientLeft,d[E].clientY-h.top-c.clientTop));return m},f.mouseButton=function(c){return o.window.InstallTrigger!==void 0&&c.button===2&&c.ctrlKey&&o.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:c.button},f.remove=function(c){c.parentNode&&c.parentNode.removeChild(c)};var j=(function(c){function d(){c.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 c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,E=this.requestors;m<E.length;m+=1){var M=E[m];this._notify(M.ids,M.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 E=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new o.ErrorEvent(new Error('Image "'+h+'" has invalid "stretchX" value'))),E=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new o.ErrorEvent(new Error('Image "'+h+'" has invalid "stretchY" value'))),E=!1),this._validateContent(m.content,m)||(this.fire(new o.ErrorEvent(new Error('Image "'+h+'" has invalid "content" value'))),E=!1),E},d.prototype._validateStretch=function(h,m){if(!h)return!0;for(var E=0,M=0,R=h;M<R.length;M+=1){var L=R[M];if(L[0]<E||L[1]<L[0]||m<L[1])return!1;E=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 E=!0;if(!this.isLoaded())for(var M=0,R=h;M<R.length;M+=1)this.images[R[M]]||(E=!1);this.isLoaded()||E?this._notify(h,m):this.requestors.push({ids:h,callback:m})},d.prototype._notify=function(h,m){for(var E={},M=0,R=h;M<R.length;M+=1){var L=R[M];this.images[L]||this.fire(new o.Event("styleimagemissing",{id:L}));var z=this.images[L];z?E[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,E)},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],E=this.getImage(h);if(!E)return null;if(m&&m.position.version===E.version)return m.position;if(m)m.position.version=E.version;else{var M={w:E.data.width+2,h:E.data.height+2,x:0,y:0},R=new o.ImagePosition(M,E);this.patterns[h]={bin:M,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 E=o.potpack(h),M=E.w,R=E.h,L=this.atlasImage;for(var z in L.resize({width:M||1,height:R||1}),this.patterns){var q=this.patterns[z].bin,ee=q.x+1,Y=q.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:Y},{width:oe,height:we}),o.RGBAImage.copy(te,L,{x:0,y:we-1},{x:ee,y:Y-1},{width:oe,height:1}),o.RGBAImage.copy(te,L,{x:0,y:0},{x:ee,y:Y+we},{width:oe,height:1}),o.RGBAImage.copy(te,L,{x:oe-1,y:0},{x:ee-1,y:Y},{width:1,height:we}),o.RGBAImage.copy(te,L,{x:0,y:0},{x:ee+oe,y:Y},{width:1,height:we})}this.dirty=!0},d.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},d.prototype.dispatchRenderCallbacks=function(h){for(var m=0,E=h;m<E.length;m+=1){var M=E[m];if(!this.callbackDispatchedThisFrame[M]){this.callbackDispatchedThisFrame[M]=!0;var R=this.images[M];V(R)&&this.updateImage(M,R)}}},d})(o.Evented),X=se,ue=se,K=1e20;function se(c,d,h,m,E,M){this.fontSize=c||24,this.buffer=d===void 0?3:d,this.cutoff=m||.25,this.fontFamily=E||"sans-serif",this.fontWeight=M||"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 Ee(c,d,h,m,E,M,R){for(var L=0;L<d;L++){for(var z=0;z<h;z++)m[z]=c[z*d+L];for(Ue(m,E,M,R,h),z=0;z<h;z++)c[z*d+L]=E[z]}for(z=0;z<h;z++){for(L=0;L<d;L++)m[L]=c[z*d+L];for(Ue(m,E,M,R,d),L=0;L<d;L++)c[z*d+L]=Math.sqrt(E[L])}}function Ue(c,d,h,m,E){h[0]=0,m[0]=-K,m[1]=+K;for(var M=1,R=0;M<E;M++){for(var L=(c[M]+M*M-(c[h[R]]+h[R]*h[R]))/(2*M-2*h[R]);L<=m[R];)R--,L=(c[M]+M*M-(c[h[R]]+h[R]*h[R]))/(2*M-2*h[R]);h[++R]=M,m[R]=L,m[R+1]=+K}for(M=0,R=0;M<E;M++){for(;m[R+1]<M;)R++;d[M]=(M-h[R])*(M-h[R])+c[h[R]]}}se.prototype.draw=function(c){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(c,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 E=d.data[4*m+3]/255;this.gridOuter[m]=E===1?0:E===0?K:Math.pow(Math.max(0,.5-E),2),this.gridInner[m]=E===1?K:E===0?0:Math.pow(Math.max(0,E-.5),2)}for(Ee(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),Ee(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},X.default=ue;var de=function(c,d){this.requestManager=c,this.localIdeographFontFamily=d,this.entries={}};de.prototype.setURL=function(c){this.url=c},de.prototype.getGlyphs=function(c,d){var h=this,m=[];for(var E in c)for(var M=0,R=c[E];M<R.length;M+=1)m.push({stack:E,id:R[M]});o.asyncAll(m,(function(L,z){var q=L.stack,ee=L.id,Y=h.entries[q];Y||(Y=h.entries[q]={glyphs:{},requests:{},ranges:{}});var te=Y.glyphs[ee];if(te===void 0){if(te=h._tinySDF(Y,q,ee))return Y.glyphs[ee]=te,void z(null,{stack:q,id:ee,glyph:te});var oe=Math.floor(ee/256);if(256*oe>65535)z(new Error("glyphs > 65535 not supported"));else if(Y.ranges[oe])z(null,{stack:q,id:ee,glyph:te});else{var we=Y.requests[oe];we||(we=Y.requests[oe]=[],de.loadGlyphRange(q,oe,h.url,h.requestManager,(function(Oe,ge){if(ge){for(var Re in ge)h._doesCharSupportLocalGlyph(+Re)||(Y.glyphs[+Re]=ge[+Re]);Y.ranges[oe]=!0}for(var je=0,$e=we;je<$e.length;je+=1)(0,$e[je])(Oe,ge);delete Y.requests[oe]}))),we.push((function(Oe,ge){Oe?z(Oe):ge&&z(null,{stack:q,id:ee,glyph:ge[ee]||null})}))}}else z(null,{stack:q,id:ee,glyph:te})}),(function(L,z){if(L)d(L);else if(z){for(var q={},ee=0,Y=z;ee<Y.length;ee+=1){var te=Y[ee],oe=te.stack,we=te.id,Oe=te.glyph;(q[oe]||(q[oe]={}))[we]=Oe&&{id:Oe.id,bitmap:Oe.bitmap.clone(),metrics:Oe.metrics}}d(null,q)}}
vendor: 9,119 bytes, line 2097
2097))},de.prototype._doesCharSupportLocalGlyph=function(c){return!!this.localIdeographFontFamily&&(o.isChar["CJK Unified Ideographs"](c)||o.isChar["Hangul Syllables"](c)||o.isChar.Hiragana(c)||o.isChar.Katakana(c))},de.prototype._tinySDF=function(c,d,h){var m=this.localIdeographFontFamily;if(m&&this._doesCharSupportLocalGlyph(h)){var E=c.tinySDF;if(!E){var M="400";/bold/i.test(d)?M="900":/medium/i.test(d)?M="500":/light/i.test(d)&&(M="200"),E=c.tinySDF=new de.TinySDF(24,3,8,.25,m,M)}return{id:h,bitmap:new o.AlphaImage({width:30,height:30},E.draw(String.fromCharCode(h))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},de.loadGlyphRange=function(c,d,h,m,E){var M=256*d,R=M+255,L=m.transformRequest(m.normalizeGlyphsURL(h).replace("{fontstack}",c).replace("{range}",M+"-"+R),o.ResourceType.Glyphs);o.getArrayBuffer(L,(function(z,q){if(z)E(z);else if(q){for(var ee={},Y=0,te=o.parseGlyphPBF(q);Y<te.length;Y+=1){var oe=te[Y];ee[oe.id]=oe}E(null,ee)}}))},de.TinySDF=X;var me=function(){this.specification=o.styleSpec.light.position};me.prototype.possiblyEvaluate=function(c,d){return o.sphericalToCartesian(c.expression.evaluate(d))},me.prototype.interpolate=function(c,d,h){return{x:o.number(c.x,d.x,h),y:o.number(c.y,d.y,h),z:o.number(c.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(c){function d(h){c.call(this),this._transitionable=new o.Transitionable(pe),this.setLight(h),this._transitioning=this._transitionable.untransitioned()}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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 E in h){var M=h[E];o.endsWith(E,"-transition")?this._transitionable.setTransition(E.slice(0,-11),M):this._transitionable.setValue(E,M)}},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,E){return(!E||E.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(c,d){this.width=c,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};re.prototype.getDash=function(c,d){var h=c.join(",")+String(d);return this.dashEntry[h]||(this.dashEntry[h]=this.addDash(c,d)),this.dashEntry[h]},re.prototype.getDashRanges=function(c,d,h){var m=[],E=c.length%2==1?-c[c.length-1]*h:0,M=c[0]*h,R=!0;m.push({left:E,right:M,isDash:R,zeroLength:c[0]===0});for(var L=c[0],z=1;z<c.length;z++){var q=c[z];m.push({left:E=L*h,right:M=(L+=q)*h,isDash:R=!R,zeroLength:q===0})}return m},re.prototype.addRoundDash=function(c,d,h){for(var m=d/2,E=-h;E<=h;E++)for(var M=this.width*(this.nextRow+h+E),R=0,L=c[R],z=0;z<this.width;z++){z/L.right>1&&(L=c[++R]);var q=Math.abs(z-L.left),ee=Math.abs(z-L.right),Y=Math.min(q,ee),te=void 0,oe=E/h*(m+1);if(L.isDash){var we=m-Math.abs(oe);te=Math.sqrt(Y*Y+we*we)}else te=m-Math.sqrt(Y*Y+oe*oe);this.data[M+z]=Math.max(0,Math.min(255,te+128))}},re.prototype.addRegularDash=function(c){for(var d=c.length-1;d>=0;--d){var h=c[d],m=c[d+1];h.zeroLength?c.splice(d,1):m&&m.isDash===h.isDash&&(m.left=h.left,c.splice(d,1))}var E=c[0],M=c[c.length-1];E.isDash===M.isDash&&(E.left=M.left-this.width,M.right=E.right+this.width);for(var R=this.width*this.nextRow,L=0,z=c[L],q=0;q<this.width;q++){q/z.right>1&&(z=c[++L]);var ee=Math.abs(q-z.left),Y=Math.abs(q-z.right),te=Math.min(ee,Y);this.data[R+q]=Math.max(0,Math.min(255,(z.isDash?te:-te)+128))}},re.prototype.addDash=function(c,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 E=0,M=0;M<c.length;M++)E+=c[M];if(E!==0){var R=this.width/E,L=this.getDashRanges(c,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:E};return this.nextRow+=m,this.dirty=!0,z},re.prototype.bind=function(c){var d=c.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 Ce=function c(d,h){this.workerPool=d,this.actors=[],this.currentActor=0,this.id=o.uniqueId();for(var m=this.workerPool.acquire(this.id),E=0;E<m.length;E++){var M=new c.Actor(m[E],h,this.id);M.name="Worker "+E,this.actors.push(M)}};function et(c,d,h){var m=function(E,M){if(E)return h(E);if(M){var R=o.pick(o.extend(M,c),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);M.vector_layers&&(R.vectorLayers=M.vector_layers,R.vectorLayerIds=R.vectorLayers.map((function(L){return L.id}))),R.tiles=d.canonicalizeTileset(R,c.url),h(null,R)}};return c.url?o.getJSON(d.transformRequest(d.normalizeSourceURL(c.url),o.ResourceType.Source),m):o.browser.frame((function(){return m(null,c)}))}Ce.prototype.broadcast=function(c,d,h){o.asyncAll(this.actors,(function(m,E){m.send(c,d,E)}),h=h||function(){})},Ce.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},Ce.prototype.remove=function(){this.actors.forEach((function(c){c.remove()})),this.actors=[],this.workerPool.release(this.id)},Ce.Actor=o.Actor;var _e=function(c,d,h){this.bounds=o.LngLatBounds.convert(this.validateBounds(c)),this.minzoom=d||0,this.maxzoom=h||24};_e.prototype.validateBounds=function(c){return Array.isArray(c)&&c.length===4?[Math.max(-180,c[0]),Math.max(-90,c[1]),Math.min(180,c[2]),Math.min(90,c[3])]:[-180,-90,180,90]},_e.prototype.contains=function(c){var d=Math.pow(2,c.z),h=Math.floor(o.mercatorXfromLng(this.bounds.getWest())*d),m=Math.floor(o.mercatorYfromLat(this.bounds.getNorth())*d),E=Math.ceil(o.mercatorXfromLng(this.bounds.getEast())*d),M=Math.ceil(o.mercatorYfromLat(this.bounds.getSouth())*d);return c.x>=h&&c.x<E&&c.y>=m&&c.y<M};var Le=(function(c){function d(h,m,E,M){if(c.call(this),this.id=h,this.dispatcher=E,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(M)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,E){h._tileJSONRequest=null,h._loaded=!0,m?h.fire(new o.ErrorEvent(m)):E&&(o.extend(h,E),E.bounds&&(h.tileBounds=new _e(E.bounds,h.minzoom,h.maxzoom)),o.postTurnstileEvent(E.tiles,h.map._requestManager._customAccessToken),o.postMapLoadEvent(E.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 E=this.map._requestManager.normalizeTileURL(h.tileID.canonical.url(this.tiles,this.scheme)),M={request:this.map._requestManager.transformRequest(E,o.ResourceType.Tile),uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,tileSize:this.tileSize*h.tileID.overscaleFactor(),type:this.t
2097ype,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)))}M.request.collectResourceTiming=this._collectResourceTiming,h.actor&&h.state!=="expired"?h.state==="loading"?h.reloadCallback=m:h.request=h.actor.send("reloadTile",M,R.bind(this)):(h.actor=this.dispatcher.getActor(),h.request=h.actor.send("loadTile",M,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,145 bytes, line 2097
2097ype,source:this.id},void 0)},d.prototype.hasTransition=function(){return!1},d})(o.Evented),Ve=(function(c){function d(h,m,E,M){c.call(this),this.id=h,this.dispatcher=E,this.setEventedParent(M),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 c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,E){h._tileJSONRequest=null,h._loaded=!0,m?h.fire(new o.ErrorEvent(m)):E&&(o.extend(h,E),E.bounds&&(h.tileBounds=new _e(E.bounds,h.minzoom,h.maxzoom)),o.postTurnstileEvent(E.tiles),o.postMapLoadEvent(E.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 E=this,M=this.map._requestManager.normalizeTileURL(h.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);h.request=o.getImage(this.map._requestManager.transformRequest(M,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){E.map._refreshExpiredTiles&&h.setExpiryData(L),delete L.cacheControl,delete L.expires;var z=E.map.painter.context,q=z.gl;h.texture=E.map.painter.getTileTexture(L.width),h.texture?h.texture.update(L,{useMipmap:!0}):(h.texture=new o.Texture(z,L,q.RGBA,{useMipmap:!0}),h.texture.bind(q.LINEAR,q.CLAMP_TO_EDGE,q.LINEAR_MIPMAP_NEAREST),z.extTextureFilterAnisotropic&&q.texParameterf(q.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax)),h.state="loaded",o.cacheEntryPossiblyAdded(E.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),Ye=(function(c){function d(h,m,E,M){c.call(this,h,m,E,M),this.type="raster-dem",this.maxzoom=22,this._options=o.extend({type:"raster-dem"},m),this.encoding=m.encoding||"mapbox"}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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 E=this.map._requestManager.normalizeTileURL(h.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function M(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(E,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),q={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",q,M.bind(this)))}}).bind(this)),h.neighboringTiles=this._getNeighboringTiles(h.tileID)},d.prototype._getNeighboringTiles=function(h){var m=h.canonical,E=Math.pow(2,m.z),M=(m.x-1+E)%E,R=m.x===0?h.wrap-1:h.wrap,L=(m.x+1+E)%E,z=m.x+1===E?h.wrap+1:h.wrap,q={};
2097return q[new o.OverscaledTileID(h.overscaledZ,R,m.z,M,m.y).key]={backfilled:!1},q[new o.OverscaledTileID(h.overscaledZ,z,m.z,L,m.y).key]={backfilled:!1},m.y>0&&(q[new o.OverscaledTileID(h.overscaledZ,R,m.z,M,m.y-1).key]={backfilled:!1},q[new o.OverscaledTileID(h.overscaledZ,h.wrap,m.z,m.x,m.y-1).key]={backfilled:!1},q[new o.OverscaledTileID(h.overscaledZ,z,m.z,L,m.y-1).key]={backfilled:!1}),m.y+1<E&&(q[new o.OverscaledTileID(h.overscaledZ,R,m.z,M,m.y+1).key]={backfilled:!1},q[new o.OverscaledTileID(h.overscaledZ,h.wrap,m.z,m.x,m.y+1).key]={backfilled:!1},q[new o.OverscaledTileID(h.overscaledZ,z,m.z,L,m.y+1).key]={backfilled:!1}),q},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})(Ve),tt=(function(c){function d(h,m,E,M){c.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=E.getActor(),this.setEventedParent(M),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}
vendor: 7,569 bytes, line 2097
2097,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 c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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 E={dataType:"source",sourceDataType:"metadata"};h._collectResourceTiming&&h._resourceTiming&&h._resourceTiming.length>0&&(E.resourceTiming=h._resourceTiming,h._resourceTiming=[]),h.fire(new o.Event("data",E))}}))},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(E){if(E)m.fire(new o.ErrorEvent(E));else{var M={dataType:"source",sourceDataType:"content"};m._collectResourceTiming&&m._resourceTiming&&m._resourceTiming.length>0&&(M.resourceTiming=m._resourceTiming,m._resourceTiming=[]),m.fire(new o.Event("data",M))}})),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,E,M){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:h,limit:m,offset:E},M),this},d.prototype._updateWorkerData=function(h){var m=this;this._loaded=!1;var E=o.extend({},this.workerOptions),M=this._data;typeof M=="string"?(E.request=this.map._requestManager.transformRequest(o.browser.resolveURL(M),o.ResourceType.Source),E.request.collectResourceTiming=this._collectResourceTiming):E.data=JSON.stringify(M),this.actor.send(this.type+".loadData",E,(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:E.source},null),h(R))}))},d.prototype.loaded=function(){return this._loaded},d.prototype.loadTile=function(h,m){var E=this,M=h.actor?"reloadTile":"loadTile";h.actor=this.actor,h.request=this.actor.send(M,{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,E.map.painter,M==="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(c){function d(h,m,E,M){c.call(this),this.id=h,this.dispatcher=E,this.coordinates=m.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(M),this.options=m}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.load=function(h,m){var E=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(M,R){E._loaded=!0,M?E.fire(new o.ErrorEvent(M)):R&&(E.image=R,h&&(E.coordinates=h),m&&m(),E._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 E=h.map(o.MercatorCoordinate.fromLngLat);this.tileID=(function(R){for(var L=1/0,z=1/0,q=-1/0,ee=-1/0,Y=0,te=R;Y<te.length;Y+=1){var oe=te[Y];L=Math.min(L,oe.x),z=Math.min(z,oe.y),q=Math.max(q,oe.x),ee=Math.max(ee,oe.y)}var we=Math.max(q-L,ee-z),Oe=Math.max(0,Math.floor(-Math.log(we)/Math.LN2)),ge=Math.pow(2,Oe);return new o.CanonicalTileID(Oe,Math.floor((L+q)/2*ge),Math.floor((z+ee)/2*ge))})(E),this.minzoom=this.maxzoom=this.tileID.z;var M=E.map((function(R){return m.tileID.getTilePoint(R)._round()}));return this._boundsArray=new o.StructArrayLayout4i8,this._boundsArray.emplaceBack(M[0].x,M[0].y,0,0),this._boundsArray.emplaceBack(M[1].x,M[1].y,o.EXTENT,0),this._boundsArray.emplaceBack(M[3].x,M[3].y,0,o.EXTENT),this._boundsArray.emplaceBack(M[2].x,M[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 E 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 M=this.tiles[E];M.state!=="loaded"&&(M.state="loaded",M.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(c){function d(h,m,E,M){c.call(this,h,m,E,M),this.roundZoom=!0,this.type="video",this.options=m}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.load=function(){var h=this;this._loaded=!1;var m=this.options;this.urls=[];for(var E=0,M=m.urls;E<M.length;E+=1)this.urls.push(this.map._requestManager.transformRequest(M[E],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}
2097,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 E 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 M=this.tiles[E];M.state!=="loaded"&&(M.state="loaded",M.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),It=(function(c){function d(h,m,E,M){c.call(this,h,m,E,M),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 c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,E=m.gl;for(var M 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,E.RGBA,{premultiply:!0}),this.tiles){var R=this.tiles[M];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 E=m[h];if(isNaN(E)||E<=0)return!0}return!1},d})(ut),st={vector:Le,raster:Ve,"raster-dem":Ye,geojson:tt,video:vt,image:ut,canvas:It};function dr(c,d){var h=o.identity([]);return o.translate(h,h,[1,1,0]),o.scale(h,h,[.5*c.width,.5*c.height,1]),o.multiply(h,h,c.calculatePosMatrix(d.toUnwrapped()))}function er(c,d,h,m,E,M){var R=(function(Oe,ge,Re){if(Oe)for(var je=0,$e=Oe;je<$e.length;je+=1){var nt=ge[$e[je]];if(nt&&nt.source===Re&&nt.type==="fill-extrusion")return!0}else for(var qe in ge){var Qe=ge[qe];if(Qe.source===Re&&Qe.type==="fill-extrusion")return!0}return!1})(E&&E.layers,d,c.id),L=M.maxPitchScaleFactor(),z=c.tilesIn(m,L,R);z.sort(Jt);for(var q=[],ee=0,Y=z;ee<Y.length;ee+=1){var te=Y[ee];q.push({wrappedTileID:te.tileID.wrapped().key,queryResults:te.tile.queryRenderedFeatures(d,h,c._state,te.queryGeometry,te.cameraQueryGeometry,te.scale,E,M,L,dr(c.transform,te.tileID))})}var oe=(function(Oe){for(var ge={},Re={},je=0,$e=Oe;je<$e.length;je+=1){var nt=$e[je],qe=nt.queryResults,Qe=nt.wrappedTileID,pt=Re[Qe]=Re[Qe]||{};for(var Dt in qe)for(var Tt=qe[Dt],zt=pt[Dt]=pt[Dt]||{},sr=ge[Dt]=ge[Dt]||[],Cr=0,Pr=Tt;Cr<Pr.length;Cr+=1){var xn=Pr[Cr];zt[xn.featureIndex]||(zt[xn.featureIndex]=!0,sr.push(xn))}}return ge})(q);for(var we in oe)oe[we].forEach((function(Oe){var ge=Oe.feature,Re=c.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 Jt(c,d){var h=c.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(c,d){this.max=c,this.onRemove=d,this.reset()};Nt.prototype.reset=function(){for(var c in this.data)for(var d=0,h=this.data[c];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(c,d,h){var m=this,E=c.wrapped().key;this.data[E]===void 0&&(this.data[E]=[]);var M={value:d,timeout:void 0};if(h!==void 0&&(M.timeout=setTimeout((function(){m.remove(c,M)}),h)),this.data[E].push(M),this.order.push(E),this.order.length>this.max){var R=this._getAndRemoveByKey(this.order[0]);R&&this.onRemove(R)}return this},Nt.prototype.has=function(c){return c.wrapped().key in this.data},Nt.prototype.getAndRemove=function(c){return this.has(c)?this._getAndRemoveByKey(c.wrapped().key):null},Nt.prototype._getAndRemoveByKey=function(c){var d=this.data[c].shift();return d.timeout&&clearTimeout(d.timeout),this.data[c].length===0&&delete this.data[c],this.order.splice(this.order.indexOf(c),1),d.value},Nt.prototype.getByKey=function(c){var d=this.data[c];return d?d[0].value:null},Nt.prototype.get=function(c){return this.has(c)?this.data[c.wrapped().key][0].value:null},Nt.prototype.remove=function(c,d){if(!this.has(c))return this;var h=c.wrapped().key,m=d===void 0?0:this.data[h].indexOf(d),E=this.data[h][m];return this.data[h].splice(m,1),E.timeout&&clearTimeout(E.timeout),this.data[h].length===0&&delete this.data[h],this.onRemove(E.value),this.order.splice(this.order.indexOf(h),1),this},Nt.prototype.setMaxSize=function(c){for(this.max=c;this.order.length>this.max;){var d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this},Nt.prototype.filter=function(c){var d=[];for(var h in this.data)for(var m=0,E=this.data[h];m<E.length;m+=1){var M=E[m];c(M.value)||d.push(M)}for(var R=0,L=d;R<L.length;R+=1){var z=L[R];this.remove(z.value.tileID,z)}};var Ar=function(c,d,h){this.context=c;var m=c.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!h,this.context.unbindVAO(),c.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(c){var d=this.context.gl;this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,c.arrayBuffer)},Ar.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var cn={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Mr=function(c,d,h,m){this.length=d.length,this.attributes=h,this.itemSize=d.bytesPerElement,this.dynamicDraw=m,this.context=c;var E=c.gl;this.buffer=E.createBuffer(),c.bindVertexBuffer.set(this.buffer),E.bufferData(E.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?E.DYNAMIC_DRAW:E.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer};Mr.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},Mr.prototype.updateData=function(c){var d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,c.arrayBuffer)},Mr.prototype.enableAttributes=function(c,d){for(var h=0;h<this.attributes.length;h++){var m=d.attributes[this.attributes[h].name];m!==void 0&&c.enableVertexAttribArray(m)}},Mr.prototype.setVertexAttribPointers=function(c,d,h){for(var m=0;m<this.attributes.length;m++){var E=this.attributes[m],M=d.attributes[E.name];M!==void 0&&c.vertexAttribPointer(M,E.components,c[cn[E.type]],!1,this.itemSize,E.offset+this.itemSize*(h||0))}},Mr.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var xr=function(c){this.gl=c.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};xr.prototype.get=function(){return this.current},xr.prototype.set=function(c){},xr.prototype.getDefault=function(){return this.default},xr.prototype.setDefault=function(){this.set(this.default)};var jn=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.getDefault=function(){return[!0,
vendor: 4,883 bytes, line 2097
2097!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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),li=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),ri=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Sn=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Qn=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Gt=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),gi=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Pe=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.getDefault=function(){return this.gl.BACK}
2097,d.prototype.set=function(h){(h!==this.current||this.dirty)&&(this.gl.cullFace(h),this.current=h,this.dirty=!1)},d})(xr),kt=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Wt=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),cr=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Ze=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Vt=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Et=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),H=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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(c){function d(h){c.call(this,h),this.vao=h.extVertexArrayObject}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),St=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Te=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Xe=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),ct=(function(c){function d(h,m){c.call(this,h),this.context=h,this.parent=m}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.getDefault=function(){return null},d})(xr),Z=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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})(ct),ne=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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})(ct),ce=function(c,d,h,m){this.context=c,this.width=d,this.height=h;var E=this.framebuffer=c.gl.createFramebuffer();
2097this.colorAttachment=new Z(c,E),m&&(this.depthAttachment=new ne(c,E))};ce.prototype.destroy=function(){var c=this.context.gl,d=this.colorAttachment.get();if(d&&c.deleteTexture(d),this.depthAttachment){var h=this.depthAttachment.get();h&&c.deleteRenderbuffer(h)}c.deleteFramebuffer(this.framebuffer)};var ve=function(c,d,h){this.func=c,this.mask=d,this.range=h};ve.ReadOnly=!1,ve.ReadWrite=!0,ve.disabled=new ve(519,ve.ReadOnly,[0,1]);var Fe=function(c,d,h,m,E,M){this.test=c,this.ref=d,this.mask=h,this.fail=m,this.depthFail=E,this.pass=M};Fe.disabled=new Fe({func:519,mask:0},0,0,7680,7680,7680);var he=function(c,d,h){this.blendFunction=c,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(c,d,h){this.enable=c,this.mode=d,this.frontFace=h};be.disabled=new be(!1,1029,2305),be.backCCW=new be(!0,1029,2305);var ae=function(c){this.gl=c,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new jn(this),this.clearDepth=new _r(this),this.clearStencil=new yr(this),this.colorMask=new un(this),this.depthMask=new Dr(this),this.stencilMask=new li(this),this.stencilFunc=new Yn(this),this.stencilOp=new mn(this),this.stencilTest=new ri(this),this.depthRange=new Hn(this),this.depthTest=new Sn(this),this.depthFunc=new Qn(this),this.blend=new Gt(this),this.blendFunc=new mr(this),this.blendColor=new Rr(this),this.blendEquation=new nn(this),this.cullFace=new gi(this),this.cullFaceSide=new Pe(this),this.frontFace=new kt(this),this.program=new Wt(this),this.activeTexture=new cr(this),this.viewport=new Ze(this),this.bindFramebuffer=new Rt(this),this.bindRenderbuffer=new Ae(this),this.bindTexture=new Vt(this),this.bindVertexBuffer=new Et(this),this.bindElementBuffer=new H(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new bt(this),this.pixelStoreUnpack=new St(this),this.pixelStoreUnpackPremultiplyAlpha=new Te(this),this.pixelStoreUnpackFlipY=new Xe(this),this.extTextureFilterAnisotropic=c.getExtension("EXT_texture_filter_anisotropic")||c.getExtension("MOZ_EXT_texture_filter_anisotropic")||c.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=c.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=c.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(c.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=c.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=c.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=c.getParameter(c.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(c,d){return new Ar(this,c,d)},ae.prototype.createVertexBuffer=function(c,d,h){return new Mr(this,c,d,h)},ae.prototype.createRenderbuffer=function(c,d,h){var m=this.gl,E=m.createRenderbuffer();return this.bindRenderbuffer.set(E),m.renderbufferStorage(m.RENDERBUFFER,c,d,h),this.bindRenderbuffer.set(null),E},ae.prototype.createFramebuffer=function(c,d,h){return new ce(this,c,d,h)},ae.prototype.clear=function(c){var d=c.color,h=c.depth,m=this.gl,E=0;d&&(E|=m.COLOR_BUFFER_BIT,this.clearColor.set(d),this.colorMask.set([!0,!0,!0,!0])),h!==void 0&&(E|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(h),this.depthMask.set(!0)),m.clear(E)},ae.prototype.setCullFace=function(c){c.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(c.mode),this.frontFace.set(c.frontFace))},ae.prototype.setDepthMode=function(c){c.func!==this.gl.ALWAYS||c.mask?(this.depthTest.set(!0),this.depthFunc.set(c.func),this.depthMask.set(c.mask),this.depthRange.set(c.range)):this.depthTest.set(!1)},ae.prototype.setStencilMode=function(c){c.test.func!==this.gl.ALWAYS||c.mask?(this.stencilTest.set(!0),this.stencilMask.set(c.mask),this.stencilOp.set([c.fail,c.depthFail,c.pass]),this.stencilFunc.set({func:c.test.func,ref:c.ref,mask:c.test.mask})):this.stencilTest.set(!1)},ae.prototype.setColorMode=function(c){o.deepEqual(c.blendFunction,he.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(c.blendFunction),this.blendColor.set(c.blendColor)),this.colorMask.set(c.mask)},ae.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Se=(function(c){function d(h,m,E){var M=this;c.call(this),this.id=h,this.dispatcher=E,this.on("data",(function(R){R.dataType==="source"&&R.sourceDataType==="metadata"&&(M._sourceLoaded=!0),M._sourceLoaded&&!M._paused&&R.dataType==="source"&&R.sourceDataType==="content"&&(M.reload(),M.transform&&M.update(M.transform))})),this.on("error",(function(){M._sourceErrored=!0})),this._source=(function(R,L,z,q){var ee=new st[L.type](R,L,z,q);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,E,this),this._tiles={},this._cache=new Nt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
2097,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new o.SourceFeatureState}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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 E=this._tiles[m];E.upload(h),E.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,E=[];for(var M in this._tiles)this._isIdRenderable(M,h)&&E.push(this._tiles[M]);return h?E.sort((function(R,L){var z=R.tileID,q=L.tileID,ee=new o.Point(z.canonical.x,z.canonical.y)._rotate(m.transform.angle),Y=new o.Point(q.canonical.x,q.canonical.y)._rotate(m.transform.angle);return z.overscaledZ-q.overscaledZ||Y.y-ee.y||Y.x-ee.x})).map((function(R){return R.tileID.key})):E.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 E=this._tiles[h];E&&(E.state!=="loading"&&(E.state=m),this._loadTile(E,this._tileLoaded.bind(this,E,h,m)))},d.prototype._tileLoaded=function(h,m,E,M){if(M)return h.state="errored",void(M.status!==404?this._source.fire(new o.ErrorEvent(M,{tile:h})):this.update(this.transform));h.timeAdded=o.browser.now(),E==="expired"&&(h.refreshedUponExpiration=!0),this._setTileReloadTimer(m,h),this.get
vendor: 44,710 bytes, line 2097
2097Source().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(),E=0;E<m.length;E++){var M=m[E];if(h.neighboringTiles&&h.neighboringTiles[M]){var R=this.getTileByID(M);L(h,R),L(R,h)}}function L(z,q){z.needsHillshadePrepare=!0;var ee=q.tileID.canonical.x-z.tileID.canonical.x,Y=q.tileID.canonical.y-z.tileID.canonical.y,te=Math.pow(2,z.tileID.canonical.z),oe=q.tileID.key;ee===0&&Y===0||Math.abs(Y)>1||(Math.abs(ee)>1&&(Math.abs(ee+te)===1?ee+=te:Math.abs(ee-te)===1&&(ee-=te)),q.dem&&z.dem&&(z.dem.backfillBorder(q.dem,ee,Y),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,E,M){for(var R in this._tiles){var L=this._tiles[R];if(!(M[R]||!L.hasData()||L.tileID.overscaledZ<=m||L.tileID.overscaledZ>E)){for(var z=L.tileID;L&&L.tileID.overscaledZ>m+1;){var q=L.tileID.scaledTo(L.tileID.overscaledZ-1);(L=this._tiles[q.key])&&L.hasData()&&(z=q)}for(var ee=z;ee.overscaledZ>m;)if(h[(ee=ee.scaledTo(ee.overscaledZ-1)).key]){M[z.key]=z;break}}}},d.prototype.findLoadedParent=function(h,m){if(h.key in this._loadedParentTiles){var E=this._loadedParentTiles[h.key];return E&&E.tileID.overscaledZ>=m?E:null}for(var M=h.overscaledZ-1;M>=m;M--){var R=h.scaledTo(M),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,E=Math.ceil(h.height/this._source.tileSize)+1,M=Math.floor(m*E*5),R=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,M):M;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 E={};for(var M in this._tiles){var R=this._tiles[M];R.tileID=R.tileID.unwrapTo(R.tileID.wrap+m),E[R.tileID.key]=R}for(var L in this._tiles=E,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 E;this.updateCacheSize(h),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?E=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)})):(E=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&&(E=E.filter((function(pt){return m._source.hasTile(pt)})))):E=[];var M=h.coveringZoomLevel(this._source),R=Math.max(M-d.maxOverzooming,this._source.minzoom),L=Math.max(M+d.maxUnderzooming,this._source.minzoom),z=this._updateRetainedTiles(E,M);if(le(this._source.type)){for(var q={},ee={},Y=0,te=Object.keys(z);Y<te.length;Y+=1){var oe=te[Y],we=z[oe],Oe=this._tiles[oe];if(Oe&&!(Oe.fadeEndTime&&Oe.fadeEndTime<=o.browser.now())){var ge=this.findLoadedParent(we,R);ge&&(this._addTile(ge.tileID),q[ge.tileID.key]=ge.tileID),ee[oe]=we}}for(var Re in this._retainLoadedChildren(ee,M,L,z),q)z[Re]||(this._coveredTiles[Re]=!0,z[Re]=q[Re])}for(var je in z)this._tiles[je].clearFadeHold();for(var $e=0,nt=o.keysDifference(this._tiles,z);$e<nt.length;$e+=1){var qe=nt[$e],Qe=this._tiles[qe];Qe.hasSymbolBuckets&&!Qe.holdingForFade()?Qe.setHoldDuration(this.map._fadeDuration):Qe.hasSymbolBuckets&&!Qe.symbolFadeFinished()||this._removeTile(qe)}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 E={},M={},R=Math.max(m-d.maxOverzooming,this._source.minzoom),L=Math.max(m+d.maxUnderzooming,this._source.minzoom),z={},q=0,ee=h;q<ee.length;q+=1){var Y=ee[q],te=this._addTile(Y);E[Y.key]=Y,te.hasData()||m<this._source.maxzoom&&(z[Y.key]=Y)}this._retainLoadedChildren(z,m,L,E);for(var oe=0,we=h;oe<we.length;oe+=1){var Oe=we[oe],ge=this._tiles[Oe.key];if(!ge.hasData()){if(m+1>this._source.maxzoom){var Re=Oe.children(this._source.maxzoom)[0],je=this.getTile(Re);if(je&&je.hasData()){E[Re.key]=Re;continue}}else{var $e=Oe.children(this._source.maxzoom);if(E[$e[0].key]&&E[$e[1].key]&&E[$e[2].key]&&E[$e[3].key])continue}for(var nt=ge.wasRequested(),qe=Oe.overscaledZ-1;qe>=R;--qe){var Qe=Oe.scaledTo(qe);if(M[Qe.key]||(M[Qe.key]=!0,!(ge=this.getTile(Qe))&&nt&&(ge=this._addTile(Qe)),ge&&(E[Qe.key]=Qe,nt=ge.wasRequested(),ge.hasData())))break}}}return E},d.prototype._updateLoadedParentTileCache=function(){for(var h in this._loadedParentTiles={},this._tiles){for(var m=[],E=void 0,M=this._tiles[h].tileID;M.overscaledZ>0;){if(M.key in this._loadedParentTiles){E=this._loadedParentTiles[M.key];break}m.push(M.key);var R=M.scaledTo(M.overscaledZ-1);if(E=this._getLoadedTile(R))break;M=R}for(var L=0,z=m;L<z.length;L+=1)this._loadedParentTiles[z[L]]=E}},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 E=!!m;return E||(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,E||this._source.fire(new o.Event("dataloading",{tile:m,coord:m.tileID,dataType:"source"})),m):null},d.prototype._setTileReloadTimer=function(h,m){var E=this;h in this._timers&&(clearTimeout(this._timers[h]),delete this._timers[h]);var M=m.getExpiryTimeout();M&&(this._timers[h]=setTimeout((function(){E._reloadTile(h,"expired"),delete E._timers[h]}),M))},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,E){var M=this,R=[],L=this.transform;if(!L)return R;for(var z=E?L.getCameraQueryGeometry(h):h,q=h.map((function(qe){return L.pointCoordinate(qe)})),ee=z.map((function(qe){return L.pointCoordinate(qe)})),Y=this.getIds(),te=1/0,oe=1/0,we=-1/0,Oe=-1/0,ge=0,Re=ee;ge<Re.length;ge+=1){var je=Re[ge];te=Math.min(te,je.x),oe=Math.min(oe,je.y),we=Math.max(we,je.x),Oe=Math.max(Oe,je.y)}for(var $e=function(qe){var Qe=M._tiles[Y[qe]];if(!Qe.holdingForFade()){var pt=Qe.tileID,Dt=Math.pow(2,L.zoom-Qe.tileID.overscaledZ),Tt=m*Qe.queryPadding*o.EXTENT/Qe.tileSize/Dt,zt=[pt.getTilePoint(new o.MercatorCoordinate(te,oe)),pt.getTilePoint(new o.MercatorCoordinate(we,Oe))];if(zt[0].x-Tt<o.EXTENT&&zt[0].y-Tt<o.EXTENT&&zt[1].x+Tt>=0&&zt[1].y+Tt>=0){var sr=q.map((function(Pr){return pt.getTilePoint(Pr)})),Cr=ee.map((function(Pr){return pt.getTilePoint(Pr)}));R.push({tile:Qe,tileID:pt,queryGeometry:sr,cameraQueryGeometry:Cr,scale:Dt})}}},nt=0;nt<Y.length;nt++)$e(nt);return R},d.prototype.getVisibleCoordinates=function(h){for(var m=this,E=this.getRenderableIds(h).map((function(z){return m._tiles[z].tileID})),M=0,R=E;M<R.length;M+=1){var L=R[M];L.posMatrix=this.transform.calculatePosMatrix(L.toUnwrapped())}return E},d.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(le(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,E){this._state.updateState(h=h||"_geojsonTileLayer",m,E)},d.prototype.removeFeatureState=function(h,m,E){this._state.removeFeatureState(h=h||"_geojsonTileLayer",m,E)},d.prototype.getFeatureState=function(h,m){return this._state.getState(h=h||"_geojsonTileLayer",m)},d.prototype.setDependencies=function(h,m,E){var M=this._tiles[h];M&&M.setDependencies(m,E)},d.prototype.reloadTilesForDependencies=function(h,m){for(var E in this._tiles)this._tiles[E].hasDependency(h,m)&&this._reloadTile(E,"reloading");this._cache.filter((function(M){return!M.hasDependency(h,m)}))},d})(o.Evented);function g(c,d){var h=Math.abs(2*c.wrap)-+(c.wrap<0),m=Math.abs(2*d.wrap)-+(d.wrap<0);return c.overscaledZ-d.overscaledZ||m-h||d.canonical.y-c.canonical.y||d.canonical.x-c.canonical.x}function le(c){return c==="raster"||c==="image"||c==="video"}function xt(){return new o.window.Worker(D.workerUrl)}Se.maxOverzooming=10,Se.maxUnderzooming=3;var Je="mapboxgl_preloaded_worker_pool",Ct=function(){this.active={}};Ct.prototype.acquire=function(c){if(!this.workers)for(this.workers=[];this.workers.length<Ct.workerCount;)this.workers.push(new xt);return this.active[c]=!0,this.workers.slice()},Ct.prototype.release=function(c){delete this.active[c],this.numActive()===0&&(this.workers.forEach((function(d){d.terminate()})),this.workers=null)},Ct.prototype.isPreloaded=function(){return!!this.active[Je]},Ct.prototype.numActive=function(){return Object.keys(this.active).length};var Mt,Ft=Math.floor(o.browser.hardwareConcurrency/2);function ht(){return Mt||(Mt=new Ct),Mt}function Lt(c,d){var h={};for(var m in c)m!=="ref"&&(h[m]=c[m]);return o.refProperties.forEach((function(E){E in d&&(h[E]=d[E])})),h}function Pt(c){c=c.slice();for(var d=Object.create(null),h=0;h<c.length;h++)d[c[h].id]=c[h];for(var m=0;m<c.length;m++)"ref"in c[m]&&(c[m]=Lt(c[m],d[c[m].ref]));return c}Ct.workerCount=Math.max(Math.min(Ft,6),1);var jt={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(c,d,h){h.push({command:jt.addSource,args:[c,d[c]]})}function Qt(c,d,h){d.push({command:jt.removeSource,args:[c]}),h[c]=!0}function en(c,d,h,m){Qt(c,h,m),Ur(c,d,h)}function ln(c,d,h){var m;for(m in c[h])if(c[h].hasOwnProperty(m)&&m!=="data"&&!o.deepEqual(c[h][m],d[h][m]))return!1;for(m in d[h])if(d[h].hasOwnProperty(m)&&m!=="data"&&!o.deepEqual(c[h][m],d[h][m]))return!1;return!0}function $r(c,d,h,m,E,M){var R;for(R in d=d||{},c=c||{})c.hasOwnProperty(R)&&(o.deepEqual(c[R],d[R])||h.push({command:M,args:[m,R,d[R],E]}));for(R in d)d.hasOwnProperty(R)&&!c.hasOwnProperty(R)&&(o.deepEqual(c[R],d[R])||h.push({command:M,args:[m,R,d[R],E]}))}function Xr(c){return c.id}function Gr(c,d){return c[d.id]=d,c}var mi=function(c,d){this.reset(c,d)};mi.prototype.reset=function(c,d){this.points=c||[],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},mi.prototype.lerp=function(c){if(this.points.length===1)return this.points[0];c=o.clamp(c,0,1);for(var d=1,h=this._distances[d],m=c*this.paddedLength+this.padding;h<m&&d<this._distances.length;)h=this._distances[++d];var E=d-1,M=this._distances[E],R=h-M,L=R>0?(m-M)/R:0;return this.points[E].mult(1-L).add(this.points[d].mult(L))};var qr=function(c,d,h){var m=this.boxCells=[],E=this.circleCells=[];this.xCellCount=Math.ceil(c/h),this.yCellCount=Math.ceil(d/h);for(var M=0;M<this.xCellCount*this.yCellCount;M++)m.push([]),E.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=c,this.height=d,this.xScale=this.xCellCount/c,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0};function pr(c,d,h,m,E){var M=o.create();return d?(o.scale(M,M,[1/E,1/E,1]),h||o.rotateZ(M,M,m.angle)):o.multiply(M,m.labelPlaneMatrix,c),M}function Be(c,d,h,m,E){if(d){var M=o.clone(c);return o.scale(M,M,[E,E,1]),h||o.rotateZ(M,M,-m.angle),M}return m.glCoordMatrix}function qt(c,d){var h=[c.x,c.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(c,d){return .5+c/d*.5}function Wi(c,d){var h=c[0]/c[3],m=c[1]/c[3];return h>=-d[0]&&h<=d[0]&&m>=-d[1]&&m<=d[1]}function _a(c,d,h,m,E,M,R,L){var z=m?c.textSizeData:c.iconSizeData,q=o.evaluateSizeForZoom(z,h.transform.zoom),ee=[256/h.width*2+1,256/h.height*2+1],Y=m?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;Y.clear();for(var te=c.lineVertexArray,oe=m?c.text.placedSymbolArray:c.icon.placedSymbolArray,we=h.transform.width/h.transform.height,Oe=!1,ge=0;ge<oe.length;ge++){var Re=oe.get(ge);if(Re.hidden||Re.writingMode===o.WritingMode.vertical&&!Oe)Fi(Re.numGlyphs,Y);else{Oe=!1;var je=[Re.anchorX,Re.anchorY,0,1];if(o.transformMat4(je,je,d),Wi(je,ee)){var $e=tn(h.transform.cameraToCenterDistance,je[3]),nt=o.evaluateSizeForFeature(z,q,Re),qe=R?nt/$e:nt*$e,Qe=new o.Point(Re.anchorX,Re.anchorY),pt=qt(Qe,E).point,Dt={},Tt=Ie(Re,qe,!1,L,d,E,M,c.glyphOffsetArray,te,Y,pt,Qe,Dt,we);Oe=Tt.useVertical,(Tt.notEnoughRoom||Oe||Tt.needsFlipping&&Ie(Re,qe,!0,L,d,E,M,c.glyphOffsetArray,te,Y,pt,Qe,Dt,we).notEnoughRoom)&&Fi(Re.numGlyphs,Y)}else Fi(Re.numGlyphs,Y)}}m?c.text.dynamicLayoutVertexBuffer.updateData(Y):c.icon.dynamicLayoutVertexBuffer.updateData(Y)}function ci(c,d,h,m,E,M,R,L,z,q,ee){var Y=L.glyphStartIndex+L.numGlyphs,te=L.lineStartIndex,oe=L.lineStartIndex+L.lineLength,we=d.getoffsetX(L.glyphStartIndex),Oe=d.getoffsetX(Y-1),ge=$n(c*we,h,m,E,M,R,L.segment,te,oe,z,q,ee);if(!ge)return null;var Re=$n(c*Oe,h,m,E,M,R,L.segment,te,oe,z,q,ee);return Re?{first:ge,last:Re}:null}function Wn(c,d,h,m){return c===o.WritingMode.horizontal&&Math.abs(h.y-d.y)>Math.abs(h.x-d.x)*m?{useVertical:!0}:(c===o.WritingMode.vertical?d.y<h.y:d.x>h.x)?{needsFlipping:!0}:null}function Ie(c,d,h,m,E,M,R,L,z,q,ee,Y,te,oe){var we,Oe=d/24,ge=c.lineOffsetX*Oe,Re=c.lineOffsetY*Oe;if(c.numGlyphs>1){var je=c.glyphStartIndex+c.numGlyphs,$e=c.lineStartIndex,nt=c.lineStartIndex+c.lineLength,qe=ci(Oe,L,ge,Re,h,ee,Y,c,z,M,te);if(!qe)return{notEnoughRoom:!0};var Qe=qt(qe.first.point,R).point,pt=qt(qe.last.point,R).point;if(m&&!h){var Dt=Wn(c.writingMode,Qe,pt,oe);if(Dt)return Dt}we=[qe.first];for(var Tt=c.glyphStartIndex+1;Tt<je-1;Tt++)we.push($n(Oe*L.getoffsetX(Tt),ge,Re,h,ee,Y,c.segment,$e,nt,z,M,te));we.push(qe.last)}else{if(m&&!h){var zt=qt(Y,E).point,sr=c.lineStartIndex+c.segment+1,Cr=new o.Point(z.getx(sr),z.gety(sr)),Pr=qt(Cr,E),xn=Pr.signedDistanceFromCamera>0?Pr.point:Ho(Y,Cr,zt,1,E),ar=Wn(c.writingMode,zt,xn,oe);if(ar)return ar}var Wr=$n(Oe*L.getoffsetX(c.glyphStartIndex),ge,Re,h,ee,Y,c.segment,c.lineStartIndex,c.lineStartIndex+c.lineLength,z,M,te);if(!Wr)return{notEnoughRoom:!0};we=[Wr]}for(var rn=0,Hr=we;rn<Hr.length;rn+=1){var Vr=Hr[rn];o.addDynamicAttributes(q,Vr.point,Vr.angle)}return{}}function Ho(c,d,h,m,E){var M=qt(c.add(c.sub(d)._unit()),E).point,R=h.sub(M);return h.add(R._mult(m/R.mag()))}function $n(c,d,h,m,E,M,R,L,z,q,ee,Y){var te=m?c-d:c+d,oe=te>0?1:-1,we=0;m&&(oe*=-1,we=Math.PI),oe<0&&(we+=Math.PI);for(var Oe=oe>0?L+R:L+R+1,ge=E,Re=E,je=0,$e=0,nt=Math.abs(te),qe=[];je+$e<=nt;){if((Oe+=oe)<L||Oe>=z)return null;if(Re=ge,qe.push(ge),(ge=Y[Oe])===void 0){var Qe=new o.Point(q.getx(Oe),q.gety(Oe)),pt=qt(Qe,ee);if(pt.signedDistanceFromCamera>0)ge=Y[Oe]=pt.point;else{var Dt=Oe-oe;ge=Ho(je===0?M:new o.Point(q.getx(Dt),q.gety(Dt)),Qe,Re,nt-je+1,ee)}}je+=$e,$e=Re.dist(ge)}var Tt=(nt-je)/$e,zt=ge.sub(Re),sr=zt.mult(Tt)._add(Re);sr._add(zt._unit()._perp()._mult(h*oe));var Cr=we+Math.atan2(ge.y-Re.y,ge.x-Re.x);return qe.push(sr),{point:sr,angle:Cr,path:qe}}qr.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},qr.prototype.insert=function(c,d,h,m,E){this._forEachCell(d,h,m,E,this._insertBoxCell,this.boxUid++),this.boxKeys.push(c),this.bboxes.push(d),this.bboxes.push(h),this.bboxes.push(m),this.bboxes.push(E)},qr.prototype.insertCircle=function(c,d,h,m){this._forEachCell(d-m,h-m,d+m,h+m,this._insertCircleCell,this.circleUid++),this.circleKeys.push(c),this.circles.push(d),this.circles.push(h),this.circles.push(m)},qr.prototype._insertBoxCell=function(c,d,h,m,E,M){this.boxCells[E].push(M)},qr.prototype._insertCircleCell=function(c,d,h,m,E,M){this.circleCells[E].push(M)},qr.prototype._query=function(c,d,h,m,E,M){if(h<0||c>this.width||m<0||d>this.height)return!E&&[];var R=[];if(c<=0&&d<=0&&this.width<=h&&this.height<=m){if(E)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 q=this.circles[3*z],ee=this.circles[3*z+1],Y=this.circles[3*z+2];R.push({key:this.circleKeys[z],x1:q-Y,y1:ee-Y,x2:q+Y,y2:ee+Y})}return M?R.filter(M):R}return this._forEachCell(c,d,h,m,this._queryCell,R,{hitTest:E,seenUids:{box:{},circle:{}}},M),E?R.length>0:R},qr.prototype._queryCircle=function(c,d,h,m,E){var M=c-h,R=c+h,L=d-h,z=d+h;if(R<0||M>this.width||z<0||L>this.height)return!m&&[];var q=[];return this._forEachCell(M,L,R,z,this._queryCellCircle,q,{hitTest:m,circle:{x:c,y:d,radius:h},seenUids:{box:{},circle:{}}},E),m?q.length>0:q},qr.prototype.query=function(c,d,h,m,E){return this._query(c,d,h,m,!1,E)},qr.prototype.hitTest=function(c,d,h,m,E){return this._query(c,d,h,m,!0,E)},qr.prototype.hitTestCircle=function(c,d,h,m){return this._queryCircle(c,d,h,!0,m)},qr.prototype._queryCell=function(c,d,h,m,E,M,R,L){var z=R.seenUids,q=this.boxCells[E];if(q!==null)for(var ee=this.bboxes,Y=0,te=q;Y<te.length;Y+=1){var oe=te[Y];if(!z.box[oe]){z.box[oe]=!0;var we=4*oe;if(c<=ee[we+2]&&d<=ee[we+3]&&h>=ee[we+0]&&m>=ee[we+1]&&(!L||L(this.boxKeys[oe]))){if(R.hitTest)return M.push(!0),!0;M.push({key:this.boxKeys[oe],x1:ee[we],y1:ee[we+1],x2:ee[we+2],y2:ee[we+3]})}}}var Oe=this.circleCells[E];if(Oe!==null)for(var ge=this.circles,Re=0,je=Oe;Re<je.length;Re+=1){var $e=je[Re];if(!z.circle[$e]){z.circle[$e]=!0;var nt=3*$e;if(this._circleAndRectCollide(ge[nt],ge[nt+1],ge[nt+2],c,d,h,m)&&(!L||L(this.circleKeys[$e]))){if(R.hitTest)return M.push(!0),!0;var qe=ge[nt],Qe=ge[nt+1],pt=ge[nt+2];M.push({key:this.circleKeys[$e],x1:qe-pt,y1:Qe-pt,x2:qe+pt,y2:Qe+pt})}}}},qr.prototype._queryCellCircle=function(c,d,h,m,E,M,R,L){var z=R.circle,q=R.seenUids,ee=this.boxCells[E];if(ee!==null)for(var Y=this.bboxes,te=0,oe=ee;te<oe.length;te+=1){var we=oe[te];if(!q.box[we]){q.box[we]=!0;var Oe=4*we;if(this._circleAndRectCollide(z.x,z.y,z.radius,Y[Oe+0],Y[Oe+1],Y[Oe+2],Y[Oe+3])&&(!L||L(this.boxKeys[we])))return M.push(!0),!0}}var ge=this.circleCells[E];if(ge!==null)for(var Re=this.circles,je=0,$e=ge;je<$e.length;je+=1){var nt=$e[je];if(!q.circle[nt]){q.circle[nt]=!0;var qe=3*nt;if(this._circlesCollide(Re[qe],Re[qe+1],Re[qe+2],z.x,z.y,z.radius)&&(!L||L(this.circleKeys[nt])))return M.push(!0),!0}}},qr.prototype._forEachCell=function(c,d,h,m,E,M,R,L){for(var z=this._convertToXCellCoord(c),q=this._convertToYCellCoord(d),ee=this._convertToXCellCoord(h),Y=this._convertToYCellCoord(m),te=z;te<=ee;te++)for(var oe=q;oe<=Y;oe++)if(E.call(this,c,d,h,m,this.xCellCount*oe+te,M,R,L))return},qr.prototype._convertToXCellCoord=function(c){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(c*this.xScale)))},qr.prototype._convertToYCellCoord=function(c){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(c*this.yScale)))},qr.prototype._circlesCollide=function(c,d,h,m,E,M){var R=m-c,L=E-d,z=h+M;return z*z>R*R+L*L},qr.prototype._circleAndRectCollide=function(c,d,h,m,E,M,R){var L=(M-m)/2,z=Math.abs(c-(m+L));if(z>L+h)return!1;var q=(R-E)/2,ee=Math.abs(d-(E+q));if(ee>q+h)return!1;if(z<=L||ee<=q)return!0;var Y=z-L,te=ee-q;return Y*Y+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 Fi(c,d){for(var h=0;h<c;h++){var m=d.length;d.resize(m+4),d.float32.set(Wo,3*m)}}function ui(c,d,h){var m=d[0],E=d[1];return c[0]=h[0]*m+h[4]*E+h[12],c[1]=h[1]*m+h[5]*E+h[13],c[3]=h[3]*m+h[7]*E+h[15],c}var Si=function(c,d,h){d===void 0&&(d=new qr(c.width+200,c.height+200,25)),h===void 0&&(h=new qr(c.width+200,c.height+200,25)),this.transform=c,this.grid=d,this.ignoredGrid=h,this.pitchfactor=Math.cos(c._pitch)*c.cameraToCenterDistance,this.screenRightBoundary=c.width+100,this.screenBottomBoundary=c.height+100,this.gridRightBoundary=c.width+200,this.gridBottomBoundary=c.height+200};function Rn(c,d,h){return d*(o.EXTENT/(c.tileSize*Math.pow(2,h-c.tileID.overscaledZ)))}Si.prototype.placeCollisionBox=function(c,d,h,m,E){var M=this.projectAndGetPerspectiveRatio(m,c.anchorPointX,c.anchorPointY),R=h*M.perspectiveRatio,L=c.x1*R+M.point.x,z=c.y1*R+M.point.y,q=c.x2*R+M.point.x,ee=c.y2*R+M.point.y;return!this.isInsideGrid(L,z,q,ee)||!d&&this.grid.hitTest(L,z,q,ee,E)?{box:[],offscreen:!1}:{box:[L,z,q,ee],offscreen:this.isOffscreen(L,z,q,ee)}},Si.prototype.placeCollisionCircles=function(c,d,h,m,E,M,R,L,z,q,ee,Y,te){var oe=[],we=new o.Point(d.anchorX,d.anchorY),Oe=qt(we,M),ge=tn(this.transform.cameraToCenterDistance,Oe.signedDistanceFromCamera),Re=(q?E/ge:E*ge)/o.ONE_EM,je=qt(we,R).point,$e=ci(Re,m,d.lineOffsetX*Re,d.lineOffsetY*Re,!1,je,we,d,h,R,{}),nt=!1,qe=!1,Qe=!0;if($e){for(var pt=.5*Y*ge+te,Dt=new o.Point(-100,-100),Tt=new o.Point(this.screenRightBoundary,this.screenBottomBoundary),zt=new mi,sr=$e.first,Cr=$e.last,Pr=[],xn=sr.path.length-1;xn>=1;xn--)Pr.push(sr.path[xn]);for(var ar=1;ar<Cr.path.length;ar++)Pr.push(Cr.path[ar]);var Wr=2.5*pt;if(L){var rn=Pr.map((function(Fo){return qt(Fo,L)}));Pr=rn.some((function(Fo){return Fo.signedDistanceFromCamera<=0}))?[]:rn.map((function(Fo){return Fo.point}))}var Hr=[];if(Pr.length>0){for(var Vr=Pr[0].clone(),Yr=Pr[0].clone(),kr=1;kr<Pr.length;kr++)Vr.x=Math.min(Vr.x,Pr[kr].x),Vr.y=Math.min(Vr.y,Pr[kr].y),Yr.x=Math.max(Yr.x,Pr[kr].x),Yr.y=Math.max(Yr.y,Pr[kr].y);Hr=Vr.x>=Dt.x&&Yr.x<=Tt.x&&Vr.y>=Dt.y&&Yr.y<=Tt.y?[Pr]:Yr.x<Dt.x||Vr.x>Tt.x||Yr.y<Dt.y||Vr.y>Tt.y?[]:o.clipLine([Pr],Dt.x,Dt.y,Tt.x,Tt.y)}for(var Fr=0,Ki=Hr;Fr<Ki.length;Fr+=1){var Ti;zt.reset(Ki[Fr],.25*pt),Ti=zt.length<=.5*pt?1:Math.ceil(zt.paddedLength/Wr)+1;for(var vs=0;vs<Ti;vs++){var as=vs/Math.max(Ti-1,1),yi=zt.lerp(as),Ii=yi.x+100,ao=yi.y+100;oe.push(Ii,ao,pt,0);var Ms=Ii-pt,Gl=ao-pt,Ws=Ii+pt,sa=ao+pt;if(Qe=Qe&&this.isOffscreen(Ms,Gl,Ws,sa),qe=qe||this.isInsideGrid(Ms,Gl,Ws,sa),!c&&this.grid.hitTestCircle(Ii,ao,pt,ee)&&(nt=!0,!z))return{circles:[],offscreen:!1,collisionDetected:nt}}}}return{circles:!z&&nt||!qe?[]:oe,offscreen:Qe,collisionDetected:nt}},Si.prototype.queryRenderedSymbols=function(c){if(c.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};for(var d=[],h=1/0,m=1/0,E=-1/0,M=-1/0,R=0,L=c;R<L.length;R+=1){var z=L[R],q=new o.Point(z.x+100,z.y+100);h=Math.min(h,q.x),m=Math.min(m,q.y),E=Math.max(E,q.x),M=Math.max(M,q.y),d.push(q)}for(var ee={},Y={},te=0,oe=this.grid.query(h,m,E,M).concat(this.ignoredGrid.query(h,m,E,M));te<oe.length;te+=1){var we=oe[te],Oe=we.key;if(ee[Oe.bucketInstanceId]===void 0&&(ee[Oe.bucketInstanceId]={}),!ee[Oe.bucketInstanceId][Oe.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[Oe.bucketInstanceId][Oe.featureIndex]=!0,Y[Oe.bucketInstanceId]===void 0&&(Y[Oe.bucketInstanceId]=[]),Y[Oe.bucketInstanceId].push(Oe.featureIndex))}}return Y},Si.prototype.insertCollisionBox=function(c,d,h,m,E){(d?this.ignoredGrid:this.grid).insert({bucketInstanceId:h,featureIndex:m,collisionGroupID:E},c[0],c[1],c[2],c[3])},Si.prototype.insertCollisionCircles=function(c,d,h,m,E){for(var M=d?this.ignoredGrid:this.grid,R={bucketInstanceId:h,featureIndex:m,collisionGroupID:E},L=0;L<c.length;L+=4)M.insertCircle(R,c[L],c[L+1],c[L+2])},Si.prototype.projectAndGetPerspectiveRatio=function(c,d,h){var m=[d,h,0,1];return ui(m,m,c),{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}},Si.prototype.isOffscreen=function(c,d,h,m){return h<100||c>=this.screenRightBoundary||m<100||d>this.screenBottomBoundary},Si.prototype.isInsideGrid=function(c,d,h,m){return h>=0&&c<this.gridRightBoundary&&m>=0&&d<this.gridBottomBoundary},Si.prototype.getViewportMatrix=function(){var c=o.identity([]);return o.translate(c,c,[-100,-100,0]),c};var ms=function(c,d,h,m){this.opacity=c?Math.max(0,Math.min(1,c.opacity+(c.placed?d:-d))):m&&h?1:0,this.placed=h};ms.prototype.isHidden=function(){return this.opacity===0&&!this.placed};var $i=function(c,d,h,m,E){this.text=new ms(c?c.text:null,d,h,E),this.icon=new ms(c?c.icon:null,d,m,E)};$i.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var Ns=function(c,d,h){this.text=c,this.icon=d,this.skipFade=h},In=function(){this.invProjMatrix=o.create(),this.viewportMatrix=o.create(),this.circles=[]},gc=function(c,d,h,m,E){this.bucketInstanceId=c,this.featureIndex=d,this.sourceLayerIndex=h,this.bucketIndex=m,this.tileID=E},xe=function(c){this.crossSourceCollisions=c,this.maxGroupID=0,this.collisionGroups={}};function Me(c,d,h,m,E){var M=o.getAnchorAlignment(c),R=-(M.horizontalAlign-.5)*d,L=-(M.verticalAlign-.5)*h,z=o.evaluateVariableOffset(c,m);return new o.Point(R+z[0]*E,L+z[1]*E)}function We(c,d,h,m,E,M){var R=c.x1,L=c.x2,z=c.y1,q=c.y2,ee=c.anchorPointX,Y=c.anchorPointY,te=new o.Point(d,h);return m&&te._rotate(E?M:-M),{x1:R+te.x,y1:z+te.y,x2:L+te.x,y2:q+te.y,anchorPointX:ee,anchorPointY:Y}}xe.prototype.get=function(c){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[c]){var d=++this.maxGroupID;this.collisionGroups[c]={ID:d,predicate:function(h){return h.collisionGroupID===d}}}return this.collisionGroups[c]};var gt=function(c,d,h,m){this.transform=c.clone(),this.collisionIndex=new Si(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 $t(c,d,h,m,E){c.emplaceBack(d?1:0,h?1:0,m||0,E||0),c.emplaceBack(d?1:0,h?1:0,m||0,E||0),c.emplaceBack(d?1:0,h?1:0,m||0,E||0),c.emplaceBack(d?1:0,h?1:0,m||0,E||0)}gt.prototype.getBucketParts=function(c,d,h,m){var E=h.getBucket(d),M=h.latestFeatureIndex;if(E&&M&&d.id===E.layerIds[0]){var R=h.collisionBoxArray,L=E.layers[0].layout,z=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),q=h.tileSize/o.EXTENT,ee=this.transform.calculatePosMatrix(h.tileID.toUnwrapped()),Y=L.get("text-pitch-alignment")==="map",te=L.get("text-rotation-alignment")==="map",oe=Rn(h,1,this.transform.zoom),we=pr(ee,Y,te,this.transform,oe),Oe=null;if(Y){var ge=Be(ee,Y,te,this.transform,oe);Oe=o.multiply([],this.transform.labelPlaneMatrix,ge)}this.retainedQueryData[E.bucketInstanceId]=new gc(E.bucketInstanceId,M,E.sourceLayerIndex,E.index,h.tileID);var Re={bucket:E,layout:L,posMatrix:ee,textLabelPlaneMatrix:we,labelToScreenMatrix:Oe,scale:z,textPixelRatio:q,holdingForFade:h.holdingForFade(),collisionBoxArray:R,partiallyEvaluatedTextSize:o.evaluateSizeForZoom(E.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(E.sourceID)};if(m)for(var je=0,$e=E.sortKeyRanges;je<$e.length;je+=1){var nt=$e[je];c.push({sortKey:nt.sortKey,symbolInstanceStart:nt.symbolInstanceStart,symbolInstanceEnd:nt.symbolInstanceEnd,parameters:Re})}else c.push({symbolInstanceStart:0,symbolInstanceEnd:E.symbolInstances.length,parameters:Re})}},gt.prototype.attemptAnchorPlacement=function(c,d,h,m,E,M,R,L,z,q,ee,Y,te,oe,we){var Oe,ge=[Y.textOffset0,Y.textOffset1],Re=Me(c,h,m,ge,E),je=this.collisionIndex.placeCollisionBox(We(d,Re.x,Re.y,M,R,this.transform.angle),ee,L,z,q.predicate);if(!we||this.collisionIndex.placeCollisionBox(We(we,Re.x,Re.y,M,R,this.transform.angle),ee,L,z,q.predicate).box.length!==0)return je.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[Y.crossTileID]&&this.prevPlacement.placements[Y.crossTileID]&&this.prevPlacement.placements[Y.crossTileID].text&&(Oe=this.prevPlacement.variableOffsets[Y.crossTileID].anchor),this.variableOffsets[Y.crossTileID]={textOffset:ge,width:h,height:m,anchor:c,textBoxScale:E,prevAnchor:Oe},this.markUsedJustification(te,c,Y,oe),te.allowVerticalPlacement&&(this.markUsedOrientation(te,oe,Y),this.placedOrientations[Y.crossTileID]=oe),{shift:Re,placedGlyphBoxes:je}):void 0},gt.prototype.placeLayerBucketPart=function(c,d,h){var m=this,E=c.parameters,M=E.bucket,R=E.layout,L=E.posMatrix,z=E.textLabelPlaneMatrix,q=E.labelToScreenMatrix,ee=E.textPixelRatio,Y=E.holdingForFade,te=E.collisionBoxArray,oe=E.partiallyEvaluatedTextSize,we=E.collisionGroup,Oe=R.get("text-optional"),ge=R.get("icon-optional"),Re=R.get("text-allow-overlap"),je=R.get("icon-allow-overlap"),$e=R.get("text-rotation-alignment")==="map",nt=R.get("text-pitch-alignment")==="map",qe=R.get("icon-text-fit")!=="none",Qe=R.get("symbol-z-order")==="viewport-y",pt=Re&&(je||!M.hasIconData()||ge),Dt=je&&(Re||!M.hasTextData()||Oe);!M.collisionArrays&&te&&M.deserializeCollisionBoxes(te);var Tt=function(ar,Wr){if(!d[ar.crossTileID])if(Y)m.placements[ar.crossTileID]=new Ns(!1,!1,!1);else{var rn,Hr=!1,Vr=!1,Yr=!0,kr=null,Fr={box:null,offscreen:null},Ki={box:null,offscreen:null},Ti=null,vs=null,as=0,yi=0,Ii=0;Wr.textFeatureIndex?as=Wr.textFeatureIndex:ar.useRuntimeCollisionCircles&&(as=ar.featureIndex),Wr.verticalTextFeatureIndex&&(yi=Wr.verticalTextFeatureIndex);var ao=Wr.textBox;if(ao){var Ms=function(Cn){var Co=o.WritingMode.horizontal;if(M.allowVerticalPlacement&&!Cn&&m.prevPlacement){var $s=m.prevPlacement.placedOrientations[ar.crossTileID];$s&&(m.placedOrientations[ar.crossTileID]=$s,m.markUsedOrientation(M,Co=$s,ar))}return Co},Gl=function(Cn,Co){if(M.allowVerticalPlacement&&ar.numVerticalGlyphVertices>0&&Wr.verticalTextBox)for(var $s=0,Rc=M.writingModes;$s<Rc.length&&(Rc[$s]===o.WritingMode.vertical?(Fr=Co(),Ki=Fr):Fr=Cn(),!(Fr&&Fr.box&&Fr.box.length));$s+=1);else Fr=Cn()};if(R.get("text-variable-anchor")){var Ws=R.get("text-variable-anchor");if(m.prevPlacement&&m.prevPlacement.variableOffsets[ar.crossTileID]){var sa=m.prevPlacement.variableOffsets[ar.crossTileID];Ws.indexOf(sa.anchor)>0&&(Ws=Ws.filter((function(Cn){return Cn!==sa.anchor}))).unshift(sa.anchor)}var Fo=function(Cn,Co,$s){for(var Rc=Cn.x2-Cn.x1,by=Cn.y2-Cn.y1,Dh=ar.textBoxScale,xy=qe&&!je?Co:null,Sf={box:[],offscreen:!1},Rg=Re?2*Ws.length:Ws.length,Eu=0;Eu<Rg;++Eu){var Fh=m.attemptAnchorPlacement(Ws[Eu%Ws.length],Cn,Rc,by,Dh,$e,nt,ee,L,we,Eu>=Ws.length,ar,M,$s,xy);if(Fh&&(Sf=Fh.placedGlyphBoxes)&&Sf.box&&Sf.box.length){Hr=!0,kr=Fh.shift;break}}return Sf};Gl((function(){return Fo(ao,Wr.iconBox,o.WritingMode.horizontal)}),(function(){var Cn=Wr.verticalTextBox;return M.allowVerticalPlacement&&!(Fr&&Fr.box&&Fr.box.length)&&ar.numVerticalGlyphVertices>0&&Cn?Fo(Cn,Wr.verticalIconBox,o.WritingMode.vertical):{box:null,offscreen:null}})),Fr&&(Hr=Fr.box,Yr=Fr.offscreen);var Tf=Ms(Fr&&Fr.box);if(!Hr&&m.prevPlacement){var wu=m.prevPlacement.variableOffsets[ar.crossTileID];wu&&(m.variableOffsets[ar.crossTileID]=wu,m.markUsedJustification(M,wu.anchor,ar,Tf))}}else{var jl=function(Cn,Co){var $s=m.collisionIndex.placeCollisionBox(Cn,Re,ee,L,we.predicate);return $s&&$s.box&&$s.box.length&&(m.markUsedOrientation(M,Co,ar),m.placedOrientations[ar.crossTileID]=Co),$s};Gl((function(){return jl(ao,o.WritingMode.horizontal)}),(function(){var Cn=Wr.verticalTextBox;return M.allowVerticalPlacement&&ar.numVerticalGlyphVertices>0&&Cn?jl(Cn,o.WritingMode.vertical):{box:null,offscreen:null}})),Ms(Fr&&Fr.box&&Fr.box.length)}}if(Hr=(rn=Fr)&&rn.box&&rn.box.length>0,Yr=rn&&rn.offscreen,ar.useRuntimeCollisionCircles){var Tu=M.text.placedSymbolArray.get(ar.centerJustifiedTextSymbolIndex),Ef=o.evaluateSizeForFeature(M.textSizeData,oe,Tu),Ba=R.get("text-padding");Ti=m.collisionIndex.placeCollisionCircles(Re,Tu,M.lineVertexArray,M.glyphOffsetArray,Ef,L,z,q,h,nt,we.predicate,ar.collisionCircleDiameter,Ba),Hr=Re||Ti.circles.length>0&&!Ti.collisionDetected,Yr=Yr&&Ti.offscreen}if(Wr.iconFeatureIndex&&(Ii=Wr.iconFeatureIndex),Wr.iconBox){var Cf=function(Cn){var Co=qe&&kr?We(Cn,kr.x,kr.y,$e,nt,m.transform.angle):Cn;return m.collisionIndex.placeCollisionBox(Co,je,ee,L,we.predicate)};Vr=Ki&&Ki.box&&Ki.box.length&&Wr.verticalIconBox?(vs=Cf(Wr.verticalIconBox)).box.length>0:(vs=Cf(Wr.iconBox)).box.length>0,Yr=Yr&&vs.offscreen}var Pa=Oe||ar.numHorizontalGlyphVertices===0&&ar.numVerticalGlyphVertices===0,Zi=ge||ar.numIconVertices===0;if(Pa||Zi?Zi?Pa||(Vr=Vr&&Hr):Hr=Vr&&Hr:Vr=Hr=Vr&&Hr,Hr&&rn&&rn.box&&m.collisionIndex.insertCollisionBox(rn.box,R.get("text-ignore-placement"),M.bucketInstanceId,Ki&&Ki.box&&yi?yi:as,we.ID),Vr&&vs&&m.collisionIndex.insertCollisionBox(vs.box,R.get("icon-ignore-placement"),M.bucketInstanceId,Ii,we.ID),Ti&&(Hr&&m.collisionIndex.insertCollisionCircles(Ti.circles,R.get("text-ignore-placement"),M.bucketInstanceId,as,we.ID),h)){var il=M.bucketInstanceId,Hl=m.collisionCircleArrays[il];Hl===void 0&&(Hl=m.collisionCircleArrays[il]=new In);for(var Mc=0;Mc<Ti.circles.length;Mc+=4)Hl.circles.push(Ti.circles[Mc+0]),Hl.circles.push(Ti.circles[Mc+1]),Hl.circles.push(Ti.circles[Mc+2]),Hl.circles.push(Ti.collisionDetected?1:0)}m.placements[ar.crossTileID]=new Ns(Hr||pt,Vr||Dt,Yr||M.justReloaded),d[ar.crossTileID]=!0}};if(Qe)for(var zt=M.getSortedSymbolIndexes(this.transform.angle),sr=zt.length-1;sr>=0;--sr){var Cr=zt[sr];Tt(M.symbolInstances.get(Cr),M.collisionArrays[Cr])}else for(var Pr=c.symbolInstanceStart;Pr<c.symbolInstanceEnd;Pr++)Tt(M.symbolInstances.get(Pr),M.collisionArrays[Pr]);if(h&&M.bucketInstanceId in this.collisionCircleArrays){var xn=this.collisionCircleArrays[M.bucketInstanceId];o.invert(xn.invProjMatrix,L),xn.viewportMatrix=this.collisionIndex.getViewportMatrix()}M.justReloaded=!1},gt.prototype.markUsedJustification=function(c,d,h,m){var E;E=m===o.WritingMode.vertical?h.verticalPlacedTextSymbolIndex:{left:h.leftJustifiedTextSymbolIndex,center:h.centerJustifiedTextSymbolIndex,right:h.rightJustifiedTextSymbolIndex}[o.getAnchorJustification(d)];for(var M=0,R=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex,h.verticalPlacedTextSymbolIndex];M<R.length;M+=1){var L=R[M];L>=0&&(c.text.placedSymbolArray.get(L).crossTileID=E>=0&&L!==E?0:h.crossTileID)}},gt.prototype.markUsedOrientation=function(c,d,h){for(var m=d===o.WritingMode.horizontal||d===o.WritingMode.horizontalOnly?d:0,E=d===o.WritingMode.vertical?d:0,M=0,R=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];M<R.length;M+=1)c.text.placedSymbolArray.get(R[M]).placedOrientation=m;h.verticalPlacedTextSymbolIndex&&(c.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=E)},gt.prototype.commit=function(c){this.commitTime=c,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(c):1,E=d?d.opacities:{},M=d?d.variableOffsets:{},R=d?d.placedOrientations:{};for(var L in this.placements){var z=this.placements[L],q=E[L];q?(this.opacities[L]=new $i(q,m,z.text,z.icon),h=h||z.text!==q.text.placed||z.icon!==q.icon.placed):(this.opacities[L]=new $i(null,m,z.text,z.icon,z.skipFade),h=h||z.text||z.icon)}for(var ee in E){var Y=E[ee];if(!this.opacities[ee]){var te=new $i(Y,m,!1,!1);te.isHidden()||(this.opacities[ee]=te,h=h||Y.text.placed||Y.icon.placed)}}for(var oe in M)this.variableOffsets[oe]||!this.opacities[oe]||this.opacities[oe].isHidden()||(this.variableOffsets[oe]=M[oe]);for(var we in R)this.placedOrientations[we]||!this.opacities[we]||this.opacities[we].isHidden()||(this.placedOrientations[we]=R[we]);h?this.lastPlacementChangeTime=c:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:c)},gt.prototype.updateLayerOpacities=function(c,d){for(var h={},m=0,E=d;m<E.length;m+=1){var M=E[m],R=M.getBucket(c);R&&M.latestFeatureIndex&&c.id===R.layerIds[0]&&this.updateBucketOpacities(R,h,M.collisionBoxArray)}},gt.prototype.updateBucketOpacities=function(c,d,h){var m=this;c.hasTextData()&&c.text.opacityVertexArray.clear(),c.hasIconData()&&c.icon.opacityVertexArray.clear(),c.hasIconCollisionBoxData()&&c.iconCollisionBox.collisionVertexArray.clear(),c.hasTextCollisionBoxData()&&c.textCollisionBox.collisionVertexArray.clear();var E=c.layers[0].layout,M=new $i(null,0,!1,!1,!0),R=E.get("text-allow-overlap"),L=E.get("icon-allow-overlap"),z=E.get("text-variable-anchor"),q=E.get("text-rotation-alignment")==="map",ee=E.get("text-pitch-alignment")==="map",Y=E.get("icon-text-fit")!=="none",te=new $i(null,0,R&&(L||!c.hasIconData()||E.get("icon-optional")),L&&(R||!c.hasTextData()||E.get("text-optional")),!0);!c.collisionArrays&&h&&(c.hasIconCollisionBoxData()||c.hasTextCollisionBoxData())&&c.deserializeCollisionBoxes(h);for(var oe=function(Re,je,$e){for(var nt=0;nt<je/4;nt++)Re.opacityVertexArray.emplaceBack($e)},we=function(Re){var je=c.symbolInstances.get(Re),$e=je.numHorizontalGlyphVertices,nt=je.numVerticalGlyphVertices,qe=je.crossTileID,Qe=m.opacities[qe];d[qe]?Qe=M:Qe||(m.opacities[qe]=Qe=te),d[qe]=!0;var pt=je.numIconVertices>0,Dt=m.placedOrientations[je.crossTileID],Tt=Dt===o.WritingMode.vertical,zt=Dt===o.WritingMode.horizontal||Dt===o.WritingMode.horizontalOnly;if($e>0||nt>0){var sr=uf(Qe.text);oe(c.text,$e,Tt?ya:sr),oe(c.text,nt,zt?ya:sr);var Cr=Qe.text.isHidden();[je.rightJustifiedTextSymbolIndex,je.centerJustifiedTextSymbolIndex,je.leftJustifiedTextSymbolIndex].forEach((function(Fr){Fr>=0&&(c.text.placedSymbolArray.get(Fr).hidden=Cr||Tt?1:0)})),je.verticalPlacedTextSymbolIndex>=0&&(c.text.placedSymbolArray.get(je.verticalPlacedTextSymbolIndex).hidden=Cr||zt?1:0);var Pr=m.variableOffsets[je.crossTileID];Pr&&m.markUsedJustification(c,Pr.anchor,je,Dt);var xn=m.placedOrientations[je.crossTileID];xn&&(m.markUsedJustification(c,"left",je,xn),m.markUsedOrientation(c,xn,je))}if(pt){var ar=uf(Qe.icon),Wr=!(Y&&je.verticalPlacedIconSymbolIndex&&Tt);je.placedIconSymbolIndex>=0&&(oe(c.icon,je.numIconVertices,Wr?ar:ya),c.icon.placedSymbolArray.get(je.placedIconSymbolIndex).hidden=Qe.icon.isHidden()),je.verticalPlacedIconSymbolIndex>=0&&(oe(c.icon,je.numVerticalIconVertices,Wr?ya:ar),c.icon.placedSymbolArray.get(je.verticalPlacedIconSymbolIndex).hidden=Qe.icon.isHidden())}if(c.hasIconCollisionBoxData()||c.hasTextCollisionBoxData()){var rn=c.collisionArrays[Re];if(rn){var Hr=new o.Point(0,0);if(rn.textBox||rn.verticalTextBox){var Vr=!0;if(z){var Yr=m.variableOffsets[qe];Yr?(Hr=Me(Yr.anchor,Yr.width,Yr.height,Yr.textOffset,Yr.textBoxScale),q&&Hr._rotate(ee?m.transform.angle:-m.transform.angle)):Vr=!1}rn.textBox&&$t(c.textCollisionBox.collisionVertexArray,Qe.text.placed,!Vr||Tt,Hr.x,Hr.y),rn.verticalTextBox&&$t(c.textCollisionBox.collisionVertexArray,Qe.text.placed,!Vr||zt,Hr.x,Hr.y)}var kr=!!(!zt&&rn.verticalIconBox);rn.iconBox&&$t(c.iconCollisionBox.collisionVertexArray,Qe.icon.placed,kr,Y?Hr.x:0,Y?Hr.y:0),rn.verticalIconBox&&$t(c.iconCollisionBox.collisionVertexArray,Qe.icon.placed,!kr,Y?Hr.x:0,Y?Hr.y:0)}}},Oe=0;Oe<c.symbolInstances.length;Oe++)we(Oe);if(c.sortFeatures(this.transform.angle),this.retainedQueryData[c.bucketInstanceId]&&(this.retainedQueryData[c.bucketInstanceId].featureSortOrder=c.featureSortOrder),c.hasTextData()&&c.text.opacityVertexBuffer&&c.text.opacityVertexBuffer.updateData(c.text.opacityVertexArray),c.hasIconData()&&c.icon.opacityVertexBuffer&&c.icon.opacityVertexBuffer.updateData(c.icon.opacityVertexArray),c.hasIconCollisionBoxData()&&c.iconCollisionBox.collisionVertexBuffer&&c.iconCollisionBox.collisionVertexBuffer.updateData(c.iconCollisionBox.collisionVertexArray),c.hasTextCollisionBoxData()&&c.textCollisionBox.collisionVertexBuffer&&c.textCollisionBox.collisionVertexBuffer.updateData(c.textCollisionBox.collisionVertexArray),c.bucketInstanceId in this.collisionCircleArrays){var ge=this.collisionCircleArrays[c.bucketInstanceId];c.placementInvProjMatrix=ge.invProjMatrix,c.placementViewportMatrix=ge.viewportMatrix,c.collisionCircleArray=ge.circles,delete this.collisionCircleArrays[c.bucketInstanceId]}},gt.prototype.symbolFadeChange=function(c){return this.fadeDuration===0?1:(c-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},gt.prototype.zoomAdjustment=function(c){return Math.max(0,(this.transform.zoom-c)/1.5)},gt.prototype.hasTransitions=function(c){return this.stale||c-this.lastPlacementChangeTime<this.fadeDuration},gt.prototype.stillRecent=function(c,d){var h=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*h>c},gt.prototype.setStale=function(){this.stale=!0};var vr=Math.pow(2,25),Br=Math.pow(2,24),fi=Math.pow(2,17),Li=Math.pow(2,16),Xi=Math.pow(2,9),Qs=Math.pow(2,8),xh=Math.pow(2,1);function uf(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;var d=c.placed?1:0,h=Math.floor(127*c.opacity);return h*vr+d*Br+h*fi+d*Li+h*Xi+d*Qs+h*xh+d}var ya=0,mc=function(c){this._sortAcrossTiles=c.layout.get("symbol-z-order")!=="viewport-y"&&c.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};mc.prototype.continuePlacement=function(c,d,h,m,E){for(var M=this._bucketParts;this._currentTileIndex<c.length;)if(d.getBucketParts(M,m,c[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,E())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort((function(R,L){return R.sortKey-L.sortKey})));this._currentPartIndex<M.length;)if(d.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,h),this._currentPartIndex++,E())return!0;return!1};var _c=function(c,d,h,m,E,M,R){this.placement=new gt(c,E,M,R),this._currentPlacementIndex=d.length-1,this._forceFullPlacement=h,this._showCollisionBoxes=m,this._done=!1};_c.prototype.isDone=function(){return this._done},_c.prototype.continuePlacement=function(c,d,h){for(var m=this,E=o.browser.now(),M=function(){var z=o.browser.now()-E;return!m._forceFullPlacement&&z>2};this._currentPlacementIndex>=0;){var R=d[c[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 mc(R)),this._inProgressLayer.continuePlacement(h[R.source],this.placement,this._showCollisionBoxes,R,M))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},_c.prototype.commit=function(c){return this.placement.commit(c),this.placement};var wh=512/o.EXTENT/2,yc=function(c,d,h){this.tileID=c,this.indexedSymbolInstances={},this.bucketInstanceId=h;for(var m=0;m<d.length;m++){var E=d.get(m),M=E.key;this.indexedSymbolInstances[M]||(this.indexedSymbolInstances[M]=[]),this.indexedSymbolInstances[M].push({crossTileID:E.crossTileID,coord:this.getScaledCoordinates(E,c)})}};yc.prototype.getScaledCoordinates=function(c,d){var h=wh/Math.pow(2,d.canonical.z-this.tileID.canonical.z);return{x:Math.floor((d.canonical.x*o.EXTENT+c.anchorX)*h),y:Math.floor((d.canonical.y*o.EXTENT+c.anchorY)*h)}},yc.prototype.findMatches=function(c,d,h){for(var m=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z),E=0;E<c.length;E++){var M=c.get(E);if(!M.crossTileID){var R=this.indexedSymbolInstances[M.key];if(R)for(var L=this.getScaledCoordinates(M,d),z=0,q=R;z<q.length;z+=1){var ee=q[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,M.crossTileID=ee.crossTileID;break}}}}};var Us=function(){this.maxCrossTileID=0};Us.prototype.generate=function(){return++this.maxCrossTileID};var $o=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};$o.prototype.handleWrapJump=function(c){var d=Math.round((c-this.lng)/360);
2097if(d!==0)for(var h in this.indexes){var m=this.indexes[h],E={};for(var M in m){var R=m[M];R.tileID=R.tileID.unwrapTo(R.tileID.wrap+d),E[R.tileID.key]=R}this.indexes[h]=E}this.lng=c},$o.prototype.addBucket=function(c,d,h){if(this.indexes[c.overscaledZ]&&this.indexes[c.overscaledZ][c.key]){if(this.indexes[c.overscaledZ][c.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(c.overscaledZ,this.indexes[c.overscaledZ][c.key])}for(var m=0;m<d.symbolInstances.length;m++)d.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[c.overscaledZ]||(this.usedCrossTileIDs[c.overscaledZ]={});var E=this.usedCrossTileIDs[c.overscaledZ];for(var M in this.indexes){var R=this.indexes[M];if(Number(M)>c.overscaledZ)for(var L in R){var z=R[L];z.tileID.isChildOf(c)&&z.findMatches(d.symbolInstances,c,E)}else{var q=R[c.scaledTo(Number(M)).key];q&&q.findMatches(d.symbolInstances,c,E)}}for(var ee=0;ee<d.symbolInstances.length;ee++){var Y=d.symbolInstances.get(ee);Y.crossTileID||(Y.crossTileID=h.generate(),E[Y.crossTileID]=!0)}return this.indexes[c.overscaledZ]===void 0&&(this.indexes[c.overscaledZ]={}),this.indexes[c.overscaledZ][c.key]=new yc(c,d.symbolInstances,d.bucketInstanceId),!0},$o.prototype.removeBucketCrossTileIDs=function(c,d){for(var h in d.indexedSymbolInstances)for(var m=0,E=d.indexedSymbolInstances[h];m<E.length;m+=1)delete this.usedCrossTileIDs[c][E[m].crossTileID]},$o.prototype.removeStaleBuckets=function(c){var d=!1;for(var h in this.indexes){var m=this.indexes[h];for(var E in m)c[m[E].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,m[E]),delete m[E],d=!0)}return d};var va=function(){this.layerIndexes={},this.crossTileIDs=new Us,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};va.prototype.addLayer=function(c,d,h){var m=this.layerIndexes[c.id];m===void 0&&(m=this.layerIndexes[c.id]=new $o);var E=!1,M={};m.handleWrapJump(h);for(var R=0,L=d;R<L.length;R+=1){var z=L[R],q=z.getBucket(c);q&&c.id===q.layerIds[0]&&(q.bucketInstanceId||(q.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(z.tileID,q,this.crossTileIDs)&&(E=!0),M[q.bucketInstanceId]=!0)}return m.removeStaleBuckets(M)&&(E=!0),E},va.prototype.pruneUnusedLayers=function(c){var d={};for(var h in c.forEach((function(m){d[m]=!0})),this.layerIndexes)d[h]||delete this.layerIndexes[h]};var Wa=function(c,d){return o.emitValidationErrors(c,d&&d.filter((function(h){return h.identifier!=="source.canvas"})))},ba=o.pick(jt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),_i=o.pick(jt,["setCenter","setZoom","setBearing","setPitch"]),Mo=(function(){var c={},d=o.styleSpec.$version;for(var h in o.styleSpec.$root){var m,E=o.styleSpec.$root[h];E.required&&(m=h==="version"?d:E.type==="array"?[]:{})!=null&&(c[h]=m)}return c})(),Vn=(function(c){function d(h,m){var E=this;m===void 0&&(m={}),c.call(this),this.map=h,this.dispatcher=new Ce(ht(),this),this.imageManager=new j,this.imageManager.setEventedParent(this),this.glyphManager=new de(h._requestManager,m.localIdeographFontFamily),this.lineAtlas=new re(256,512),this.crossTileSymbolIndex=new va,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 M=this;this._rtlTextPluginCallback=d.registerForPluginStateChange((function(R){M.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 q in M.sourceCaches)M.sourceCaches[q].reload()}))})),this.on("data",(function(R){if(R.dataType==="source"&&R.sourceDataType==="metadata"){var L=E.sourceCaches[R.sourceId];if(L){var z=L.getSource();if(z&&z.vectorLayerIds)for(var q in E._layers){var ee=E._layers[q];ee.source===z.id&&E._validateLayer(ee)}}}}))}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.loadURL=function(h,m){var E=this;m===void 0&&(m={}),this.fire(new o.Event("dataloading",{dataType:"style"}));var M=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){E._request=null,L?E.fire(new o.ErrorEvent(L)):z&&E._load(z,M)}))},d.prototype.loadJSON=function(h,m){var E=this;m===void 0&&(m={}),this.fire(new o.Event("dataloading",{dataType:"style"})),this._request=o.browser.frame((function(){E._request=null,E._load(h,m.validate!==!1)}))},d.prototype.loadEmpty=function(){this.fire(new o.Event("dataloading",{dataType:"style"})),this._load(Mo,!1)},d.prototype._load=function(h,m){if(!m||!Wa(this,o.validateStyle(h))){for(var E in this._loaded=!0,this.stylesheet=h,h.sources)this.addSource(E,h.sources[E],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs);
2097var M=Pt(this.stylesheet.layers);this._order=M.map((function(q){return q.id})),this._layers={},this._serializedLayers={};for(var R=0,L=M;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(E,M,R){var L,z,q,ee=o.browser.devicePixelRatio>1?"@2x":"",Y=o.getJSON(M.transformRequest(M.normalizeSpriteURL(E,ee,".json"),o.ResourceType.SpriteJSON),(function(we,Oe){Y=null,q||(q=we,L=Oe,oe())})),te=o.getImage(M.transformRequest(M.normalizeSpriteURL(E,ee,".png"),o.ResourceType.SpriteImage),(function(we,Oe){te=null,q||(q=we,z=Oe,oe())}));function oe(){if(q)R(q);else if(L&&z){var we=o.browser.getImageData(z),Oe={};for(var ge in L){var Re=L[ge],je=Re.width,$e=Re.height,nt=Re.x,qe=Re.y,Qe=Re.sdf,pt=Re.pixelRatio,Dt=Re.stretchX,Tt=Re.stretchY,zt=Re.content,sr=new o.RGBAImage({width:je,height:$e});o.RGBAImage.copy(we,sr,{x:nt,y:qe},{x:0,y:0},{width:je,height:$e}),Oe[ge]={data:sr,pixelRatio:pt,sdf:Qe,stretchX:Dt,stretchY:Tt,content:zt}}R(null,Oe)}}return{cancel:function(){Y&&(Y.cancel(),Y=null),te&&(te.cancel(),te=null)}}})(h,this.map._requestManager,(function(E,M){if(m._spriteRequest=null,E)m.fire(new o.ErrorEvent(E));else if(M)for(var R in M)m.imageManager.addImage(R,M[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 E=h.sourceLayer;if(E){var M=m.getSource();(M.type==="geojson"||M.vectorLayerIds&&M.vectorLayerIds.indexOf(E)===-1)&&this.fire(new o.ErrorEvent(new Error('Source layer "'+E+'" does not exist on source "'+M.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=[],E=0,M=h;E<M.length;E+=1){var R=this._layers[M[E]];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 E=Object.keys(this._updatedLayers),M=Object.keys(this._removedLayers);for(var R in(E.length||M.length)&&this._updateWorkerLayers(E,M),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 q={};for(var ee in this.sourceCaches){var Y=this.sourceCaches[ee];q[ee]=Y.used,Y.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 Oe in q){var ge=this.sourceCaches[Oe];q[Oe]!==ge.used&&ge.fire(new o.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:Oe}))}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=Pt(h.layers);var E=(function(R,L){if(!R)return[{command:jt.setStyle,args:[L]}];var z=[];try{if(!o.deepEqual(R.version,L.version))return[{command:jt.setStyle,args:[L]}];o.deepEqual(R.center,L.center)||z.push({command:jt.setCenter,args:[L.center]}),o.deepEqual(R.zoom,L.zoom)||z.push({command:jt.setZoom,args:[L.zoom]}),o.deepEqual(R.bearing,L.bearing)||z.push({command:jt.setBearing,args:[L.bearing]}),o.deepEqual(R.pitch,L.pitch)||z.push({command:jt.setPitch,args:[L.pitch]}),o.deepEqual(R.sprite,L.sprite)||z.push({command:jt.setSprite,args:[L.sprite]}),o.deepEqual(R.glyphs,L.glyphs)||z.push({command:jt.setGlyphs,args:[L.glyphs]}),o.deepEqual(R.transition,L.transition)||z.push({command:jt.setTransition,args:[L.transition]}),o.deepEqual(R.light,L.light)||z.push({command:jt.setLight,args:[L.light]});var q={},ee=[];(function(te,oe,we,Oe){var ge;for(ge in oe=oe||{},te=te||{})te.hasOwnProperty(ge)&&(oe.hasOwnProperty(ge)||Qt(ge,we,Oe));for(ge in oe)oe.hasOwnProperty(ge)&&(te.hasOwnProperty(ge)?o.deepEqual(te[ge],oe[ge])||(te[ge].type==="geojson"&&oe[ge].type==="geojson"&&ln(te,oe,ge)?we.push({command:jt.setGeoJSONSourceData,args:[ge,oe[ge].data]}):en(ge,oe,we,Oe)):Ur(ge,oe,we))})(R.sources,L.sources,ee,q);var Y=[];
2097R.layers&&R.layers.forEach((function(te){q[te.source]?z.push({command:jt.removeLayer,args:[te.id]}):Y.push(te)})),z=z.concat(ee),(function(te,oe,we){oe=oe||[];var Oe,ge,Re,je,$e,nt,qe,Qe=(te=te||[]).map(Xr),pt=oe.map(Xr),Dt=te.reduce(Gr,{}),Tt=oe.reduce(Gr,{}),zt=Qe.slice(),sr=Object.create(null);for(Oe=0,ge=0;Oe<Qe.length;Oe++)Tt.hasOwnProperty(Re=Qe[Oe])?ge++:(we.push({command:jt.removeLayer,args:[Re]}),zt.splice(zt.indexOf(Re,ge),1));for(Oe=0,ge=0;Oe<pt.length;Oe++)zt[zt.length-1-Oe]!==(Re=pt[pt.length-1-Oe])&&(Dt.hasOwnProperty(Re)?(we.push({command:jt.removeLayer,args:[Re]}),zt.splice(zt.lastIndexOf(Re,zt.length-ge),1)):ge++,we.push({command:jt.addLayer,args:[Tt[Re],nt=zt[zt.length-Oe]]}),zt.splice(zt.length-Oe,0,Re),sr[Re]=!0);for(Oe=0;Oe<pt.length;Oe++)if(je=Dt[Re=pt[Oe]],$e=Tt[Re],!sr[Re]&&!o.deepEqual(je,$e))if(o.deepEqual(je.source,$e.source)&&o.deepEqual(je["source-layer"],$e["source-layer"])&&o.deepEqual(je.type,$e.type)){for(qe in $r(je.layout,$e.layout,we,Re,null,jt.setLayoutProperty),$r(je.paint,$e.paint,we,Re,null,jt.setPaintProperty),o.deepEqual(je.filter,$e.filter)||we.push({command:jt.setFilter,args:[Re,$e.filter]}),o.deepEqual(je.minzoom,$e.minzoom)&&o.deepEqual(je.maxzoom,$e.maxzoom)||we.push({command:jt.setLayerZoomRange,args:[Re,$e.minzoom,$e.maxzoom]}),je)je.hasOwnProperty(qe)&&qe!=="layout"&&qe!=="paint"&&qe!=="filter"&&qe!=="metadata"&&qe!=="minzoom"&&qe!=="maxzoom"&&(qe.indexOf("paint.")===0?$r(je[qe],$e[qe],we,Re,qe.slice(6),jt.setPaintProperty):o.deepEqual(je[qe],$e[qe])||we.push({command:jt.setLayerProperty,args:[Re,qe,$e[qe]]}));for(qe in $e)$e.hasOwnProperty(qe)&&!je.hasOwnProperty(qe)&&qe!=="layout"&&qe!=="paint"&&qe!=="filter"&&qe!=="metadata"&&qe!=="minzoom"&&qe!=="maxzoom"&&(qe.indexOf("paint.")===0?$r(je[qe],$e[qe],we,Re,qe.slice(6),jt.setPaintProperty):o.deepEqual(je[qe],$e[qe])||we.push({command:jt.setLayerProperty,args:[Re,qe,$e[qe]]}))}else we.push({command:jt.removeLayer,args:[Re]}),nt=zt[zt.lastIndexOf(Re)+1],we.push({command:jt.addLayer,args:[$e,nt]})})(Y,L.layers,z)}catch(te){console.warn("Unable to compute style diff:",te),z=[{command:jt.setStyle,args:[L]}]}return z})(this.serialize(),h).filter((function(R){return!(R.command in _i)}));if(E.length===0)return!1;var M=E.filter((function(R){return!(R.command in ba)}));if(M.length>0)throw new Error("Unimplemented: "+M.map((function(R){return R.command})).join(", ")+".");return E.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,E){var M=this;if(E===void 0&&(E={}),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,E))){this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);var R=this.sourceCaches[h]=new Se(h,m,this.dispatcher);R.style=this,R.setEventedParent(this,(function(){return{isSourceLoaded:M.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 E=this.sourceCaches[h];delete this.sourceCaches[h],delete this._updatedSources[h],E.fire(new o.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:h})),E.setEventedParent(null),E.clearTiles(),E.onRemove&&E.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,E){E===void 0&&(E={}),this._checkLoaded();var M=h.id;if(this.getLayer(M))this.fire(new o.ErrorEvent(new Error('Layer with i
2097d "'+M+'" 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(M,h.source),h=o.clone$1(h),h=o.extend(h,{source:M})),this._validate(o.validateStyle.layer,"layers."+M,h,{arrayIndex:-1},E))return;R=o.createStyleLayer(h),this._validateLayer(R),R.setEventedParent(this,{layer:{id:M}}),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,M),this._layerOrderChanged=!0,this._layers[M]=R,this._removedLayers[M]&&R.source&&R.type!=="custom"){var z=this._removedLayers[M];delete this._removedLayers[M],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 E=this._order.indexOf(h);this._order.splice(E,1);var M=m?this._order.indexOf(m):this._order.length;
2097m&&M===-1?this.fire(new o.ErrorEvent(new Error('Layer with id "'+m+'" does not exist on this map.'))):(this._order.splice(M,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 E=this._order.indexOf(h);this._order.splice(E,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,E){this._checkLoaded();var M=this.getLayer(h);M?M.minzoom===m&&M.maxzoom===E||(m!=null&&(M.minzoom=m),E!=null&&(M.maxzoom=E),this._updateLayer(M)):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,E){E===void 0&&(E={}),this._checkLoaded();var M=this.getLayer(h);if(M){if(!o.deepEqual(M.filter,m))return m==null?(M.filter=void 0,void this._updateLayer(M)):void(this._validate(o.validateStyle.filter,"layers."+M.id+".filter",m,null,E)||(M.filter=o.clone$1(m),this._updateLayer(M)))}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,E,M){M===void 0&&(M={}),this._checkLoaded();var R=this.getLayer(h);R?o.deepEqual(R.getLayoutProperty(m),E)||(R.setLayoutProperty(m,E,M),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 E=this.getLayer(h);if(E)return E.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,E,M){M===void 0&&(M={}),this._checkLoaded();var R=this.getLayer(h);R?o.deepEqual(R.getPaintProperty(m),E)||(R.setPaintProperty(m,E,M)&&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 E=h.source,M=h.sourceLayer,R=this.sourceCaches[E];if(R!==void 0){var L=R.getSource().type;L==="geojson"&&M?this.fire(new o.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):L!=="vector"||M?(h.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),R.setFeatureState(M,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 '"+E+"' does not exist in the map's style.")))},d.prototype.removeFeatureState=function(h,m){this._checkLoaded();var E=h.source,M=this.sourceCaches[E];if(M!==void 0){var R=M.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."))):M.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 '"+E+"' does not exist in the map's style.")))},d.prototype.getFeatureState=function(h){this._checkLoaded();var m=h.source,E=h.sourceLayer,M=this.sourceCaches[m];if(M!==void 0){if(M.getSource().type!=="vector"||E)return h.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),M.getFeatureState(E,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,E=function(Dt){return m._layers[Dt].type==="fill-extrusion"},M={},R=[],L=this._order.length-1;L>=0;L--){var z=this._order[L];if(E(z)){M[z]=L;for(var q=0,ee=h;q<ee.length;q+=1){var Y=ee[q][z];if(Y)for(var te=0,oe=Y;te<oe.length;te+=1)R.push(oe[te])}}}R.sort((function(Dt,Tt){return Tt.intersectionZ-Dt.intersectionZ}));for(var we=[],Oe=this._order.length-1;Oe>=0;Oe--){var ge=this._order[Oe];if(E(ge))for(var Re=R.length-1;Re>=0;Re--){var je=R[Re].feature;if(M[je.layer.id]<Oe)break;we.push(je),R.pop()}else for(var $e=0,nt=h;$e<nt.length;$e+=1){var qe=nt[$e][ge];if(qe)for(var Qe=0,pt=qe;Qe<pt.length;Qe+=1)we.push(pt[Qe].feature)}}return we},d.prototype.queryRenderedFeatures=function(h,m,E){m&&m.filter&&this._val
vendor: 5,656 bytes, line 2097
2097idate(o.validateStyle.filter,"queryRenderedFeatures.filter",m.filter,null,m);var M={};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],q=this._layers[z];if(!q)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."))),[];M[q.source]=!0}}var ee=[];for(var Y in m.availableImages=this._availableImages,this.sourceCaches)m.layers&&!M[Y]||ee.push(er(this.sourceCaches[Y],this._layers,this._serializedLayers,h,m,E));return this.placement&&ee.push((function(te,oe,we,Oe,ge,Re,je){for(var $e={},nt=Re.queryRenderedSymbols(Oe),qe=[],Qe=0,pt=Object.keys(nt).map(Number);Qe<pt.length;Qe+=1)qe.push(je[pt[Qe]]);qe.sort(Jt);for(var Dt=function(){var Pr=zt[Tt],xn=Pr.featureIndex.lookupSymbolFeatures(nt[Pr.bucketInstanceId],oe,Pr.bucketIndex,Pr.sourceLayerIndex,ge.filter,ge.layers,ge.availableImages,te);for(var ar in xn){var Wr=$e[ar]=$e[ar]||[],rn=xn[ar];rn.sort((function(Yr,kr){var Fr=Pr.featureSortOrder;if(Fr){var Ki=Fr.indexOf(Yr.featureIndex);return Fr.indexOf(kr.featureIndex)-Ki}return kr.featureIndex-Yr.featureIndex}));for(var Hr=0,Vr=rn;Hr<Vr.length;Hr+=1)Wr.push(Vr[Hr])}},Tt=0,zt=qe;Tt<zt.length;Tt+=1)Dt();var sr=function(Pr){$e[Pr].forEach((function(xn){var ar=xn.feature,Wr=we[te[Pr].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=Wr}))};for(var Cr in $e)sr(Cr);return $e})(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 E=this.sourceCaches[h];return E?(function(M,R){for(var L=M.getRenderableIds().map((function(oe){return M.getTileByID(oe)})),z=[],q={},ee=0;ee<L.length;ee++){var Y=L[ee],te=Y.tileID.canonical.key;q[te]||(q[te]=!0,Y.querySourceFeatures(z,R))}return z})(E,m):[]},d.prototype.addSourceType=function(h,m,E){return d.getSourceType(h)?E(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},E):E(null,null))},d.prototype.getLight=function(){return this.light.getLight()},d.prototype.setLight=function(h,m){m===void 0&&(m={}),this._checkLoaded();var E=this.light.getLight(),M=!1;for(var R in h)if(!o.deepEqual(h[R],E[R])){M=!0;break}if(M){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,E,M,R){return R===void 0&&(R={}),(!R||R.validate!==!1)&&Wa(this,h.call(o.validateStyle,o.extend({key:m,style:this.serialize(),value:E,styleSpec:o.styleSpec},M)))},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,E,M,R){R===void 0&&(R=!1);for(var L=!1,z=!1,q={},ee=0,Y=this._order;ee<Y.length;ee+=1){var te=this._layers[Y[ee]];if(te.type==="symbol"){if(!q[te.source]){var oe=this.sourceCaches[te.source];q[te.source]=oe.getRenderableIds(!0).map((function(je){return oe.getTileByID(je)})).sort((function(je,$e){return $e.tileID.overscaledZ-je.tileID.overscaledZ||(je.tileID.isLessThan($e.tileID)?-1:1)}))}var we=this.crossTileSymbolIndex.addLayer(te,q[te.source],h.center.lng);L=L||we}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((R=R||this._layerOrderChanged||E===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.browser.now(),h.zoom))&&(this.pauseablePlacement=new _c(h,this._order,R,m,E,M,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,q),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.browser.now()),z=!0),L&&this.pauseablePlacement.placement.setStale()),z||L)for(var Oe=0,ge=this._order;Oe<ge.length;Oe+=1){var Re=this._layers[ge[Oe]];Re.type==="symbol"&&this.placement.updateLayerOpacities(Re,q[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,E){this.imageManager.getImages(m.icons,E),this._updateTilesForChangedImages();var M=this.sourceCaches[m.source];M&&M.setDependencies(m.tileID.key,m.type,m.icons)},d.prototype.getGlyphs=function(h,m,E){this.glyphManager.getGlyphs(m.stacks,E)}
2097,d.prototype.getResource=function(h,m,E){return o.makeRequest(m,E)},d})(o.Evented);Vn.getSourceType=function(c){return st[c]},Vn.setSourceType=function(c,d){st[c]=d},Vn.registerForPluginStateChange=o.registerForPluginStateChange;var hi=o.createLayout([{name:"a_pos",type:"Int16",components:2}]),$a=Bn(`#ifdef GL_ES 2098precision mediump float; 2099#else 2100#if !defined(lowp) 2101#define lowp 2102#endif 2103#if !defined(mediump) 2104#define mediump 2105#endif 2106#if !defined(highp) 2107#define highp 2108#endif 2109#endif`,`#ifdef GL_ES 2110precision highp float; 2111#else 2112#if !defined(lowp) 2113#define lowp 2114#endif 2115#if !defined(mediump) 2116#define mediump 2117#endif 2118#if !defined(highp) 2119#define highp 2120#endif 2121#endif 2122vec2 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 2123);}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;}`),vc=Bn(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; 2124#ifdef OVERDRAW_INSPECTOR 2125gl_FragColor=vec4(1.0); 2126#endif 2127}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Op=Bn(`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; 2128#ifdef OVERDRAW_INSPECTOR 2129gl_FragColor=vec4(1.0); 2130#endif 2131}`,"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);}"),Dp=Bn(`varying vec3 v_data; 2132#pragma mapbox: define highp vec4 color 2133#pragma mapbox: define mediump float radius 2134#pragma mapbox: define lowp float blur 2135#pragma mapbox: define lowp float opacity 2136#pragma mapbox: define highp vec4 stroke_color 2137#pragma mapbox: define mediump float stroke_width 2138#pragma mapbox: define lowp float stroke_opacity 2139void main() { 2140#pragma mapbox: initialize highp vec4 color 2141#pragma mapbox: initialize mediump float radius 2142#pragma mapbox: initialize lowp float blur 2143#pragma mapbox: initialize lowp float opacity 2144#pragma mapbox: initialize highp vec4 stroke_color 2145#pragma mapbox: initialize mediump float stroke_width 2146#pragma mapbox: initialize lowp float stroke_opacity 2147vec2 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
2147/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); 2148#ifdef OVERDRAW_INSPECTOR 2149gl_FragColor=vec4(1.0); 2150#endif 2151}`,`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; 2152#pragma mapbox: define highp vec4 color 2153#pragma mapbox: define mediump float radius 2154#pragma mapbox: define lowp float blur 2155#pragma mapbox: define lowp float opacity 2156#pragma mapbox: define highp vec4 stroke_color 2157#pragma mapbox: define mediump float stroke_width 2158#pragma mapbox: define lowp float stroke_opacity 2159void main(void) { 2160#pragma mapbox: initialize highp vec4 color 2161#pragma mapbox: initialize mediump float radius 2162#pragma mapbox: initialize lowp float blur 2163#pragma mapbox: initialize lowp float opacity 2164#pragma mapbox: initialize highp vec4 stroke_color 2165#pragma mapbox: initialize mediump float stroke_width 2166#pragma mapbox: initialize lowp float stroke_opacity 2167vec2 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);}`),ff=Bn("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);}"),iu=Bn(`uniform highp float u_intensity;varying vec2 v_extrude; 2168#pragma mapbox: define highp float weight 2169#define GAUSS_COEF 0.3989422804014327 2170void main() { 2171#pragma mapbox: initialize highp float weight 2172float 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); 2173#ifdef OVERDRAW_INSPECTOR 2174gl_FragColor=vec4(1.0); 2175#endif 2176}`,`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; 2177#pragma mapbox: define highp float weight 2178#pragma mapbox: define mediump float radius 2179const highp float ZERO=1.0/255.0/16.0; 2180#define GAUSS_COEF 0.3989422804014327 2181void main(void) { 2182#pragma mapbox: initialize highp float weight 2183#pragma mapbox: initialize mediump float radius 2184vec2 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;}`),Bl=Bn(`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; 2185#ifdef OVERDRAW_INSPECTOR 2186gl_FragColor=vec4(0.0); 2187#endif 2188}`,"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=Bn("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;}"),hf=Bn("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);}"),df=Bn("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);}"),su=Bn(`#pragma mapbox: define highp vec4 color 2189#pragma mapbox: define lowp float opacity 2190void main() { 2191#pragma mapbox: initialize highp vec4 color 2192#pragma mapbox: initialize lowp float opacity 2193gl_FragColor=color*opacity; 2194#ifdef OVERDRAW_INSPECTOR 2195gl_FragColor=vec4(1.0); 2196#endif 2197}`,`attribute vec2 a_pos;uniform mat4 u_matrix; 2198#pragma mapbox: define highp vec4 color 2199#pragma mapbox: define lowp float opacity 2200void main() { 2201#pragma mapbox: initialize highp vec4 color 2202#pragma mapbox: initialize lowp float opacity 2203gl_Position=u_matrix*vec4(a_pos,0,1);}`),bo=Bn(`varying vec2 v_pos; 2204#pragma mapbox: define highp vec4 outline_color 2205#pragma mapbox: define lowp float opacity 2206void main() { 2207#pragma mapbox: initialize highp vec4 outline_color 2208#pragma mapbox: initialize lowp float opacity 2209float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); 2210#ifdef OVERDRAW_INSPECTOR 2211gl_FragColor=vec4(1.0); 2212#endif 2213}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; 2214#pragma mapbox: define highp vec4 outline_color 2215#pragma mapbox: define lowp float opacity 2216void main() { 2217#pragma mapbox: initialize highp vec4 outline_color 2218#pragma mapbox: initialize lowp float opacity 2219gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),eo=Bn(`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; 2220#pragma mapbox: define lowp float opacity 2221#pragma mapbox: define lowp vec4 pattern_from 2222#pragma mapbox: define lowp vec4 pattern_to 2223void main() { 2224#pragma mapbox: initialize lowp float opacity 2225#pragma mapbox: initialize mediump vec4 pattern_from 2226#pragma mapbox: initialize mediump vec4 pattern_to 2227vec2 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; 2228#ifdef OVERDRAW_INSPECTOR 2229gl_FragColor=vec4(1.0); 2230#endif 2231}`,`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; 2232#pragma mapbox: define lowp float opacity 2233#pragma mapbox: define lowp vec4 pattern_from 2234#pragma mapbox: define lowp vec4 pattern_to 2235#pragma mapbox: define lowp float pixel_ratio_from 2236#pragma mapbox: define lowp float pixel_ratio_to 2237void main() { 2238#pragma mapbox: initialize lowp float opacity 2239#pragma mapbox: initialize mediump vec4 pattern_from 2240#pragma mapbox: initialize mediump vec4 pattern_to 2241#pragma mapbox: initialize lowp float pixel_ratio_from 2242#pragma mapbox: initialize lowp float pixel_ratio_to 2243vec2 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;}`),pf=Bn(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; 2244#pragma mapbox: define lowp float opacity 2245#pragma mapbox: define lowp vec4 pattern_from 2246#pragma mapbox: define lowp vec4 pattern_to 2247void main() { 2248#pragma mapbox: initialize lowp float opacity 2249#pragma mapbox: initialize mediump vec4 pattern_from 2250#pragma mapbox: initialize mediump vec4 pattern_to 2251vec2 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; 2252#ifdef OVERDRAW_INSPECTOR 2253gl_FragColor=vec4(1.0); 2254#endif 2255}`,`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; 2256#pragma mapbox: define lowp float opacity 2257#pragma mapbox: define lowp vec4 pattern_from 2258#pragma mapbox: define lowp vec4 pattern_to 2259#pragma mapbox: define lowp float pixel_ratio_from 2260#pragma mapbox: define lowp float pixel_ratio_to 2261void main() { 2262#pragma mapbox: initialize lowp float opacity 2263#pragma mapbox: initialize mediump vec4 pattern_from 2264#pragma mapbox: initialize mediump vec4 pattern_to 2265#pragma mapbox: initialize lowp float pixel_ratio_from 2266#pragma mapbox: initialize lowp float pixel_ratio_to 2267vec2 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=Bn(`varying vec4 v_color;void main() {gl_FragColor=v_color; 2268#ifdef OVERDRAW_INSPECTOR 2269gl_FragColor=vec4(1.0); 2270#endif 2271}`,`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; 2272#pragma mapbox: define highp float base 2273#pragma mapbox: define highp float height 2274#pragma mapbox: define highp vec4 color 2275void main() { 2276#pragma mapbox: initialize highp float base 2277#pragma mapbox: initialize highp float height 2278#pragma mapbox: initialize highp vec4 color 2279vec3 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;}`),bc=Bn(`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; 2280#pragma mapbox: define lowp float base 2281#pragma mapbox: define lowp float height 2282#pragma mapbox: define lowp vec4 pattern_from 2283#pragma mapbox: define lowp vec4 pattern_to 2284#pragma mapbox: define lowp float pixel_ratio_from 2285#pragma mapbox: define lowp float pixel_ratio_to 2286void main() { 2287#pragma mapbox: initialize lowp float base 2288#pragma mapbox: initialize lowp float height 2289#pragma mapbox: initialize mediump vec4 pattern_from 2290#pragma mapbox: initialize mediump vec4 pattern_to 2291#pragma mapbox: initialize lowp float pixel_ratio_from 2292#pragma mapbox: initialize lowp float pixel_ratio_to 2293vec2 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; 2294#ifdef OVERDRAW_INSPECTOR 2295gl_FragColor=vec4(1.0); 2296#endif 2297}`,`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; 2298#pragma mapbox: define lowp float base 2299#pragma mapbox: define lowp float height 2300#pragma mapbox: define lowp vec4 pattern_from 2301#pragma mapbox: define lowp vec4 pattern_to 2302#pragma mapbox: define lowp float pixel_ratio_from 2303#pragma mapbox: define lowp float pixel_ratio_to 2304void main() { 2305#pragma mapbox: initialize lowp float base 2306#pragma mapbox: initialize lowp float height 2307#pragma mapbox: initialize mediump vec4 pat
2307tern_from 2308#pragma mapbox: initialize mediump vec4 pattern_to 2309#pragma mapbox: initialize lowp float pixel_ratio_from 2310#pragma mapbox: initialize lowp float pixel_ratio_to 2311vec2 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 2312? a_pos 2313: 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;}`),xa=Bn(`#ifdef GL_ES 2314precision highp float; 2315#endif 2316uniform 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); 2317#ifdef OVERDRAW_INSPECTOR 2318gl_FragColor=vec4(1.0); 2319#endif 2320}`,"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;}"),wa=Bn(`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; 2321#define PI 3.141592653589793 2322void 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; 2323#ifdef OVERDRAW_INSPECTOR 2324gl_FragColor=vec4(1.0); 2325#endif 2326}`,"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=Bn(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; 2327#pragma mapbox: define highp vec4 color 2328#pragma mapbox: define lowp float blur 2329#pragma mapbox: define lowp float opacity 2330void main() { 2331#pragma mapbox: initialize highp vec4 color 2332#pragma mapbox: initialize lowp float blur 2333#pragma mapbox: initialize lowp float opacity 2334float 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); 2335#ifdef OVERDRAW_INSPECTOR 2336gl_FragColor=vec4(1.0); 2337#endif 2338}`,` 2339#define scale 0.015873016 2340attribute 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; 2341#pragma mapbox: define highp vec4 color 2342#pragma mapbox: define lowp float blur 2343#pragma mapbox: define lowp float opacity 2344#pragma mapbox: define mediump float gapwidth 2345#pragma mapbox: define lowp float offset 2346#pragma mapbox: define mediump float width 2347void main() { 2348#pragma mapbox: initialize highp vec4 color 2349#pragma mapbox: initialize lowp float blur 2350#pragma mapbox: initialize lowp float opacity 2351#pragma mapbox: initialize mediump float gapwidth 2352#pragma mapbox: initialize lowp float offset 2353#pragma mapbox: initialize mediump float width 2354float 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=Bn(`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; 2355#pragma mapbox: define lowp float blur 2356#pragma mapbox: define lowp float opacity 2357void main() { 2358#pragma mapbox: initialize lowp float blur 2359#pragma mapbox: initialize lowp float opacity 2360float 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); 2361#ifdef OVERDRAW_INSPECTOR 2362gl_FragColor=vec4(1.0); 2363#endif 2364}`,` 2365#define scale 0.015873016 2366attribute 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; 2367#pragma mapbox: define lowp float blur 2368#pragma mapbox: define lowp float opacity 2369#pragma mapbox: define mediump float gapwidth 2370#pragma mapbox: define lowp float offset 2371#pragma mapbox: define mediump float width 2372void main() { 2373#pragma mapbox: initialize lowp float blur 2374#pragma mapbox: initialize lowp float opacity 2375#pragma mapbox: initialize mediump float gapwidth 2376#pragma mapbox: initialize lowp float offset 2377#pragma mapbox: initialize mediump float width 2378float 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=Bn(`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; 2379#pragma mapbox: define lowp vec4 pattern_from 2380#pragma mapbox: define lowp vec4 pattern_to 2381#pragma mapbox: define lowp float pixel_ratio_from 2382#pragma mapbox: define lowp float pixel_ratio_to 2383#pragma mapbox: define lowp float blur 2384#pragma mapbox: define lowp float opacity 2385void main() { 2386#pragma mapbox: initialize mediump vec4 pattern_from 2387#pragma mapbox: initialize mediump vec4 pattern_to 2388#pragma mapbox: initialize lowp float pixel_ratio_from 2389#pragma mapbox: initialize lowp float pixel_ratio_to 2390#pragma mapbox: initialize lowp float blur 2391#pragma mapbox: initialize lowp float opacity 2392vec2 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; 2393#ifdef OVERDRAW_INSPECTOR 2394gl_FragColor=vec4(1.0); 2395#endif 2396}`,` 2397#define scale 0.015873016 2398#define LINE_DISTANCE_SCALE 2.0 2399attribute 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; 2400#pragma mapbox: define lowp float blur 2401#pragma mapbox: define lowp float opacity 2402#pragma mapbox: define lowp float offset 2403#pragma mapbox: define mediump float gapwidth 2404#pragma mapbox: define mediump float width 2405#pragma mapbox: define lowp float floorwidth 2406#pragma mapbox: define lowp vec4 pattern_from 2407#pragma mapbox: define lowp vec4 pattern_to 2408#pragma mapbox: define lowp float pixel_ratio_from 2409#pragma mapbox: define lowp float pixel_ratio_to 2410void main() { 2411#pragma mapbox: initialize lowp float blur 2412#pragma mapbox: initialize lowp float opacity 2413#pragma mapbox: initialize lowp float offset 2414#pragma mapbox: initialize mediump float gapwidth 2415#pragma mapbox: initialize mediump float width 2416#pragma mapbox: initialize lowp float floorwidth 2417#pragma mapbox: initialize mediump vec4 pattern_from 2418#pragma mapbox: initialize mediump vec4 pattern_to 2419#pragma mapbox: initialize lowp float pixel_ratio_from 2420#pragma mapbox: initialize lowp float pixel_ratio_to 2421float 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;}`),qa=Bn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;
2421uniform 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; 2422#pragma mapbox: define highp vec4 color 2423#pragma mapbox: define lowp float blur 2424#pragma mapbox: define lowp float opacity 2425#pragma mapbox: define mediump float width 2426#pragma mapbox: define lowp float floorwidth 2427void main() { 2428#pragma mapbox: initialize highp vec4 color 2429#pragma mapbox: initialize lowp float blur 2430#pragma mapbox: initialize lowp float opacity 2431#pragma mapbox: initialize mediump float width 2432#pragma mapbox: initialize lowp float floorwidth 2433float 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); 2434#ifdef OVERDRAW_INSPECTOR 2435gl_FragColor=vec4(1.0); 2436#endif 2437}`,` 2438#define scale 0.015873016 2439#define LINE_DISTANCE_SCALE 2.0 2440attribute 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; 2441#pragma mapbox: define highp vec4 color 2442#pragma mapbox: define lowp float blur 2443#pragma mapbox: define lowp float opacity 2444#pragma mapbox: define mediump float gapwidth 2445#pragma mapbox: define lowp float offset 2446#pragma mapbox: define mediump float width 2447#pragma mapbox: define lowp float floorwidth 2448void main() { 2449#pragma mapbox: initialize highp vec4 color 2450#pragma mapbox: initialize lowp float blur 2451#pragma mapbox: initialize lowp float opacity 2452#pragma mapbox: initialize mediump float gapwidth 2453#pragma mapbox: initialize lowp float offset 2454#pragma mapbox: initialize mediump float width 2455#pragma mapbox: initialize lowp float floorwidth 2456float 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);}`),Ja=Bn(`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); 2457#ifdef OVERDRAW_INSPECTOR 2458gl_FragColor=vec4(1.0); 2459#endif 2460}`,"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;}"),Ca=Bn(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; 2461#pragma mapbox: define lowp float opacity 2462void main() { 2463#pragma mapbox: initialize lowp float opacity 2464lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; 2465#ifdef OVERDRAW_INSPECTOR 2466gl_FragColor=vec4(1.0); 2467#endif 2468}`,`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; 2469#pragma mapbox: define lowp float opacity 2470void main() { 2471#pragma mapbox: initialize lowp float opacity 2472vec2 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 ? 2473camera_to_anchor_distance/u_camera_to_center_distance : 2474u_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));}`),Th=Bn(`#define SDF_PX 8.0 2475uniform 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; 2476#pragma mapbox: define highp vec4 fill_color 2477#pragma mapbox: define highp vec4 halo_color 2478#pragma mapbox: define lowp float opacity 2479#pragma mapbox: define lowp float halo_width 2480#pragma mapbox: define lowp float halo_blur 2481void main() { 2482#pragma mapbox: initialize highp vec4 fill_color 2483#pragma mapbox: initialize highp vec4 halo_color 2484#pragma mapbox: initialize lowp float opacity 2485#pragma mapbox: initialize lowp float halo_width 2486#pragma mapbox: initialize lowp float halo_blur 2487float 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); 2488#ifdef OVERDRAW_INSPECTOR 2489gl_FragColor=vec4(1.0); 2490#endif 2491}`,`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; 2492#pragma mapbox: define highp vec4 fill_color 2493#pragma mapbox: define highp vec4 halo_color 2494#pragma mapbox: define lowp float opacity 2495#pragma mapbox: define lowp float halo_width 2496#pragma mapbox: define lowp float halo_blur 2497void main() { 2498#pragma mapbox: initialize highp vec4 fill_color 2499#pragma mapbox: initialize highp vec4 halo_color 2500#pragma mapbox: initialize lowp float opacity 2501#pragma mapbox: initialize lowp float halo_width 2502#pragma mapbox: initialize lowp float halo_blur 2503vec2 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 ? 2504camera_to_anchor_distance/u_camera_to_center_distance : 2505u_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);}`),Eh=Bn(`#define SDF_PX 8.0 2506#define SDF 1.0 2507#define ICON 0.0 2508uniform 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; 2509#pragma mapbox: define highp vec4 fill_color 2510#pragma mapbox: define highp vec4 halo_color 2511#pragma mapbox: define lowp float opacity 2512#pragma mapbox: define lowp float halo_width 2513#pragma mapbox: define lowp float halo_blur 2514void main() { 2515#pragma mapbox: initialize highp vec4 fill_color 2516#pragma mapbox: initialize highp vec4 halo_color 2517#pragma mapbox: initialize lowp float opacity 2518#pragma mapbox: initialize lowp float halo_width 2519#pragma mapbox: initialize lowp float halo_blur 2520float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
2520gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; 2521#ifdef OVERDRAW_INSPECTOR 2522gl_FragColor=vec4(1.0); 2523#endif 2524return;}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); 2525#ifdef OVERDRAW_INSPECTOR 2526gl_FragColor=vec4(1.0); 2527#endif 2528}`,`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; 2529#pragma mapbox: define highp vec4 fill_color 2530#pragma mapbox: define highp vec4 halo_color 2531#pragma mapbox: define lowp float opacity 2532#pragma mapbox: define lowp float halo_width 2533#pragma mapbox: define lowp float halo_blur 2534void main() { 2535#pragma mapbox: initialize highp vec4 fill_color 2536#pragma mapbox: initialize highp vec4 halo_color 2537#pragma mapbox: initialize lowp float opacity 2538#pragma mapbox: initialize lowp float halo_width 2539#pragma mapbox: initialize lowp float halo_blur 2540vec2 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 ? 2541camera_to_anchor_distance/u_camera_to_center_distance : 2542u_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 Bn(c,d){var h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,m=d.match(/attribute ([\w]+) ([\w]+)/g),E=c.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),M=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),R=M?M.concat(E):E,L={};return{fragmentSource:c=c.replace(h,(function(z,q,ee,Y,te){return L[te]=!0,q==="define"?` 2543#ifndef HAS_UNIFORM_u_`+te+` 2544varying `+ee+" "+Y+" "+te+`; 2545#else 2546uniform `+ee+" "+Y+" u_"+te+`; 2547#endif 2548`:` 2549#ifdef HAS_UNIFORM_u_`+te+` 2550 `+ee+" "+Y+" "+te+" = u_"+te+`; 2551#endif 2552`})),vertexSource:d=d.replace(h,(function(z,q,ee,Y,te){var oe=Y==="float"?"vec2":"vec4",we=te.match(/color/)?"color":oe;return L[te]?q==="define"?` 2553#ifndef HAS_UNIFORM_u_`+te+` 2554uniform lowp float u_`+te+`_t; 2555attribute `+ee+" "+oe+" a_"+te+`; 2556varying `+ee+" "+Y+" "+te+`; 2557#else 2558uniform `+ee+" "+Y+" u_"+te+`; 2559#endif 2560`:we==="vec4"?` 2561#ifndef HAS_UNIFORM_u_`+te+` 2562 `+te+" = a_"+te+`; 2563#else 2564 `+ee+" "+Y+" "+te+" = u_"+te+`; 2565#endif 2566`:` 2567#ifndef HAS_UNIFORM_u_`+te+` 2568 `+te+" = unpack_mix_"+we+"(a_"+te+", u_"+te+`_t); 2569#else 2570 `+ee+" "+Y+" "+te+" = u_"+te+`; 2571#endif 2572`:q==="define"?` 2573#ifndef HAS_UNIFORM_u_`+te+` 2574uniform lowp float u_`+te+`_t; 2575attribute `+ee+" "+oe+" a_"+te+`; 2576#else 2577uniform `+ee+" "+Y+" u_"+te+`; 2578#endif 2579`:we==="vec4"?` 2580#ifndef HAS_UNIFORM_u_`+te+` 2581 `+ee+" "+Y+" "+te+" = a_"+te+`; 2582#else 2583 `+ee+" "+Y+" "+te+" = u_"+te+`; 2584#endif 2585`:` 2586#ifndef HAS_UNIFORM_u_`+te+` 2587 `+ee+" "+Y+" "+te+" = unpack_mix_"+we+"(a_"+te+", u_"+te+`_t); 2588#else 2589 `+ee+" "+Y+" "+te+" = u_"+te+`; 2590#endif 2591`})),staticAttributes:m,staticUniforms:R}}var ou=Object.freeze({__proto__:null,prelude:$a,background:vc,backgroundPattern:Op,circle:Dp,clippingMask:ff,heatmap:iu,heatmapTexture:Bl,collisionBox:Xo,collisionCircle:hf,debug:df,fill:su,fillOutline:bo,fillOutlinePattern:eo,fillPattern:pf,fillExtrusion:zi,fillExtrusionPattern:bc,hillshadePrepare:xa,hillshade:wa,line:Ta,lineGradient:Xa,linePattern:Ea,lineSDF:qa,raster:Ja,symbolIcon:Ca,symbolSDF:Th,symbolTextAndIcon:Eh}),au=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function Ch(c){for(var d=[],h=0;h<c.length;h++)if(c[h]!==null){var m=c[h].split(" ");d.push(m.pop())}return d}au.prototype.bind=function(c,d,h,m,E,M,R,L){this.context=c;for(var z=this.boundPaintVertexBuffers.length!==m.length,q=0;!z&&q<m.length;q++)this.boundPaintVertexBuffers[q]!==m[q]&&(z=!0);c.extVertexArrayObject&&this.vao&&this.boundProgram===d&&this.boundLayoutVertexBuffer===h&&!z&&this.boundIndexBuffer===E&&this.boundVertexOffset===M&&this.boundDynamicVertexBuffer===R&&this.boundDynamicVertexBuffer2===L?(c.bindVertexArrayOES.set(this.vao),R&&R.bind(),E&&E.dynamicDraw&&E.bind(),L&&L.bind()):this.freshBind(d,h,m,E,M,R,L)}
vendor: 11,488 bytes, lines 2591-2593
2591,au.prototype.freshBind=function(c,d,h,m,E,M,R){var L,z=c.numAttributes,q=this.context,ee=q.gl;if(q.extVertexArrayObject)this.vao&&this.destroy(),this.vao=q.extVertexArrayObject.createVertexArrayOES(),q.bindVertexArrayOES.set(this.vao),L=0,this.boundProgram=c,this.boundLayoutVertexBuffer=d,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=m,this.boundVertexOffset=E,this.boundDynamicVertexBuffer=M,this.boundDynamicVertexBuffer2=R;else{L=q.currentNumAttributes||0;for(var Y=z;Y<L;Y++)ee.disableVertexAttribArray(Y)}d.enableAttributes(ee,c);for(var te=0,oe=h;te<oe.length;te+=1)oe[te].enableAttributes(ee,c);M&&M.enableAttributes(ee,c),R&&R.enableAttributes(ee,c),d.bind(),d.setVertexAttribPointers(ee,c,E);for(var we=0,Oe=h;we<Oe.length;we+=1){var ge=Oe[we];ge.bind(),ge.setVertexAttribPointers(ee,c,E)}M&&(M.bind(),M.setVertexAttribPointers(ee,c,E)),m&&m.bind(),R&&(R.bind(),R.setVertexAttribPointers(ee,c,E)),q.currentNumAttributes=z},au.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var Sh=function(c,d,h,m,E,M){var R=c.gl;this.program=R.createProgram();for(var L=Ch(h.staticAttributes),z=m?m.getBinderAttributes():[],q=L.concat(z),ee=h.staticUniforms?Ch(h.staticUniforms):[],Y=m?m.getBinderUniforms():[],te=[],oe=0,we=ee.concat(Y);oe<we.length;oe+=1){var Oe=we[oe];te.indexOf(Oe)<0&&te.push(Oe)}var ge=m?m.defines():[];M&&ge.push("#define OVERDRAW_INSPECTOR;");var Re=ge.concat($a.fragmentSource,h.fragmentSource).join(` 2592`),je=ge.concat($a.vertexSource,h.vertexSource).join(` 2593`),$e=R.createShader(R.FRAGMENT_SHADER);if(R.isContextLost())this.failedToCreate=!0;else{R.shaderSource($e,Re),R.compileShader($e),R.attachShader(this.program,$e);var nt=R.createShader(R.VERTEX_SHADER);if(R.isContextLost())this.failedToCreate=!0;else{R.shaderSource(nt,je),R.compileShader(nt),R.attachShader(this.program,nt),this.attributes={};var qe={};this.numAttributes=q.length;for(var Qe=0;Qe<this.numAttributes;Qe++)q[Qe]&&(R.bindAttribLocation(this.program,Qe,q[Qe]),this.attributes[q[Qe]]=Qe);R.linkProgram(this.program),R.deleteShader(nt),R.deleteShader($e);for(var pt=0;pt<te.length;pt++){var Dt=te[pt];if(Dt&&!qe[Dt]){var Tt=R.getUniformLocation(this.program,Dt);Tt&&(qe[Dt]=Tt)}}this.fixedUniforms=E(c,qe),this.binderUniforms=m?m.getUniforms(c,qe):[]}}};function Pl(c,d,h){var m=1/Rn(h,1,d.transform.tileZoom),E=Math.pow(2,h.tileID.overscaledZ),M=h.tileSize*Math.pow(2,d.transform.tileZoom)/E,R=M*(h.tileID.canonical.x+h.tileID.wrap*E),L=M*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[m,c.fromScale,c.toScale],u_fade:c.t,u_pixel_coord_upper:[R>>16,L>>16],u_pixel_coord_lower:[65535&R,65535&L]}}Sh.prototype.draw=function(c,d,h,m,E,M,R,L,z,q,ee,Y,te,oe,we,Oe){var ge,Re=c.gl;if(!this.failedToCreate){for(var je in c.program.set(this.program),c.setDepthMode(h),c.setStencilMode(m),c.setColorMode(E),c.setCullFace(M),this.fixedUniforms)this.fixedUniforms[je].set(R[je]);oe&&oe.setUniforms(c,this.binderUniforms,Y,{zoom:te});for(var $e=(ge={},ge[Re.LINES]=2,ge[Re.TRIANGLES]=3,ge[Re.LINE_STRIP]=1,ge)[d],nt=0,qe=ee.get();nt<qe.length;nt+=1){var Qe=qe[nt],pt=Qe.vaos||(Qe.vaos={});(pt[L]||(pt[L]=new au)).bind(c,this,z,oe?oe.getPaintVertexBuffers():[],q,Qe.vertexOffset,we,Oe),Re.drawElements(d,Qe.primitiveLength*$e,Re.UNSIGNED_SHORT,Qe.primitiveOffset*$e*2)}}};var Ih=function(c,d,h,m){var E=d.style.light,M=E.properties.get("position"),R=[M.x,M.y,M.z],L=o.create$1();E.properties.get("anchor")==="viewport"&&o.fromRotation(L,-d.transform.angle),o.transformMat3(R,R,L);var z=E.properties.get("color");return{u_matrix:c,u_lightpos:R,u_lightintensity:E.properties.get("intensity"),u_lightcolor:[z.r,z.g,z.b],u_vertical_gradient:+h,u_opacity:m}},qo=function(c,d,h,m,E,M,R){return o.extend(Ih(c,d,h,m),Pl(M,d,R),{u_height_factor:-Math.pow(2,E.overscaledZ)/R.tileSize/8})},Jo=function(c){return{u_matrix:c}},to=function(c,d,h,m){return o.extend(Jo(c),Pl(h,d,m))},Bh=function(c,d){return{u_matrix:c,u_world:d}},lu=function(c,d,h,m,E){return o.extend(to(c,d,h,m),{u_world:E})},cu=function(c,d,h,m){var E,M,R=c.transform;if(m.paint.get("circle-pitch-alignment")==="map"){var L=Rn(h,1,R.zoom);E=!0,M=[L,L]}else E=!1,M=R.pixelsToGLUnits;return{u_camera_to_center_distance:R.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:c.translatePosMatrix(d.posMatrix,h,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+E,u_device_pixel_ratio:o.browser.devicePixelRatio,u_extrude_scale:M}},Ka=function(c,d,h){var m=Rn(h,1,d.zoom),E=Math.pow(2,d.zoom-h.tileID.overscaledZ),M=h.tileID.overscaleFactor();return{u_matrix:c,u_camera_to_center_distance:d.cameraToCenterDistance,u_pixels_to_tile_units:m,u_extrude_scale:[d.pixelsToGLUnits[0]/(m*E),d.pixelsToGLUnits[1]/(m*E)],u_overscale_factor:M}},Af=function(c,d,h){return{u_matrix:c,u_inv_matrix:d,u_camera_to_center_distance:h.cameraToCenterDistance,u_viewport_size:[h.width,h.height]}},Ko=function(c,d,h){return h===void 0&&(h=1),{u_matrix:c,u_color:d,u_overlay:0,u_overlay_scale:h}},Zo=function(c){return{u_matrix:c}},xc=function(c,d,h,m){return{u_matrix:c,u_extrude_scale:Rn(d,1,h),u_intensity:m}},On=function(c,d,h){var m=c.transform;return{u_matrix:Ph(c,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]]}},Fn=function(c,d,h,m){return o.extend(On(c,d,h),{u_image:0,u_image_height:m})},uu=function(c,d,h,m){var E=c.transform,M=Ml(d,E);return{u_matrix:Ph(c,d,h),u_texsize:d.imageAtlasTexture.size,u_ratio:1/Rn(d,1,E.zoom),u_device_pixel_ratio:o.browser.devicePixelRatio,u_image:0,u_scale:[M,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/E.pixelsToGLUnits[0],1/E.pixelsToGLUnits[1]]}},Fp=function(c,d,h,m,E){var M=c.lineAtlas,R=Ml(d,c.transform),L=h.layout.get("line-cap")==="round",z=M.getDash(m.from,L),q=M.getDash(m.to,L),ee=z.width*E.fromScale,Y=q.width*E.toScale;return o.extend(On(c,d,h),{u_patternscale_a:[R/ee,-z.height/2],u_patternscale_b:[R/Y,-q.height/2],u_sdfgamma:M.width/(256*Math.min(ee,Y)*o.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:z.y,u_tex_y_b:q.y,u_mix:E.t})};function Ml(c,d){return 1/Rn(c,1,d.tileZoom)}function Ph(c,d,h){return c.translatePosMatrix(d.tileID.posMatrix,d,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}var Lp=function(c,d,h,m,E){return{u_matrix:c,u_tl_parent:d,u_scale_parent:h,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*E.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:E.paint.get("raster-brightness-min"),u_brightness_high:E.paint.get("raster-brightness-max"),u_saturation_factor:(R=E.paint.get("raster-saturation"),R>0?1-1/(1.001-R):-R),u_contrast_factor:(M=E.paint.get("raster-contrast"),M>0?1/(1-M):1+M),u_spin_weights:Mh(E.paint.get("raster-hue-rotate"))};var M,R};function Mh(c){c*=Math.PI/180;var d=Math.sin(c),h=Math.cos(c);return[(2*h+1)/3,(-Math.sqrt(3)*d-h+1)/3,(Math.sqrt(3)*d-h+1)/3]}var ns,Sa=function(c,d,h,m,E,M,R,L,z,q){var ee=E.transform;return{u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="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:E.options.fadeDuration?E.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:R,u_coord_matrix:L,u_is_text:+z,u_pitch_with_map:+m,u_texsize:q,u_texture:0}},xo=function(c,d,h,m,E,M,R,L,z,q,ee){var Y=E.transform;return o.extend(Sa(c,d,h,m,E,M,R,L,z,q),{u_gamma_scale:m?Math.cos(Y._pitch)*Y.cameraToCenterDistance:1,u_device_pixel_ratio:o.browser.devicePixelRatio,u_is_halo:1})},fu=function(c,d,h,m,E,M,R,L,z,q){return o.extend(xo(c,d,h,m,E,M,R,L,!0,z),{u_texsize_icon:q,u_texture_icon:1})},Za=function(c,d,h){return{u_matrix:c,u_opacity:d,u_color:h}},Rl=function(c,d,h,m,E,M){return o.extend((function(R,L,z,q){var ee=z.imageManager.getPattern(R.from.toString()),Y=z.imageManager.getPattern(R.to.toString()),te=z.imageManager.getPixelSize(),oe=te.width,we=te.height,Oe=Math.pow(2,q.tileID.overscaledZ),ge=q.tileSize*Math.pow(2,z.transform.tileZoom)/Oe,Re=ge*(q.tileID.canonical.x+q.tileID.wrap*Oe),je=ge*q.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:ee.tl,u_pattern_br_a:ee.br,u_pattern_tl_b:Y.tl,u_pattern_br_b:Y.br,u_texsize:[oe,we],u_mix:L.t,u_pattern_size_a:ee.displaySize,u_pattern_size_b:Y.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Rn(q,1,z.transform.tileZoom),u_pixel_coord_upper:[Re>>16,je>>16],u_pixel_coord_lower:[65535&Re,65535&je]}})(m,M,h,E),{u_matrix:c,u_opacity:d})},zs={fillExtrusion:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_lightpos:new o.Uniform3f(c,d.u_lightpos),u_lightintensity:new o.Uniform1f(c,d.u_lightintensity),u_lightcolor:new o.Uniform3f(c,d.u_lightcolor),u_vertical_gradient:new o.Uniform1f(c,d.u_vertical_gradient),u_opacity:new o.Uniform1f(c,d.u_opacity)}},fillExtrusionPattern:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_lightpos:new o.Uniform3f(c,d.u_lightpos),u_lightintensity:new o.Uniform1f(c,d.u_lightintensity),u_lightcolor:new o.Uniform3f(c,d.u_lightcolor),u_vertical_gradient:new o.Uniform1f(c,d.u_vertical_gradient),u_height_factor:new o.Uniform1f(c,d.u_height_factor),u_image:new o.Uniform1i(c,d.u_image),u_texsize:new o.Uniform2f(c,d.u_texsize),u_pixel_coord_upper:new o.Uniform2f(c,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(c,d.u_pixel_coord_lower),u_scale:new o.Uniform3f(c,d.u_scale),u_fade:new o.Uniform1f(c,d.u_fade),u_opacity:new o.Uniform1f(c,d.u_opacity)}},fill:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix)}},fillPattern:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_image:new o.Uniform1i(c,d.u_image),u_texsize:new o.Uniform2f(c,d.u_texsize),u_pixel_coord_upper:new o.Uniform2f(c,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(c,d.u_pixel_coord_lower),u_scale:new o.Uniform3f(c,d.u_scale),u_fade:new o.Uniform1f(c,d.u_fade)}},fillOutline:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_world:new o.Uniform2f(c,d.u_world)}},fillOutlinePattern:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_world:new o.Uniform2f(c,d.u_world),u_image:new o.Uniform1i(c,d.u_image),u_texsize:new o.Uniform2f(c,d.u_texsize),u_pixel_coord_upper:new o.Uniform2f(c,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(c,d.u_pixel_coord_lower),u_scale:new o.Uniform3f(c,d.u_scale),u_fade:new o.Uniform1f(c,d.u_fade)}},circle:function(c,d){return{u_camera_to_center_distance:new o.Uniform1f(c,d.u_camera_to_center_distance),u_scale_with_map:new o.Uniform1i(c,d.u_scale_with_map),u_pitch_with_map:new o.Uniform1i(c,d.u_pitch_with_map),u_extrude_scale:new o.Uniform2f(c,d.u_extrude_scale),u_device_pixel_ratio:new o.Uniform1f(c,d.u_device_pixel_ratio),u_matrix:new o.UniformMatrix4f(c,d.u_matrix)}},collisionBox:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_camera_to_center_distance:new o.Uniform1f(c,d.u_camera_to_center_distance),u_pixels_to_tile_units:new o.Uniform1f(c,d.u_pixels_to_tile_units),u_extrude_scale:new o.Uniform2f(c,d.u_extrude_scale),u_overscale_factor:new o.Uniform1f(c,d.u_overscale_factor)}},collisionCircle:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_inv_matrix:new o.UniformMatrix4f(c,d.u_inv_matrix
2593),u_camera_to_center_distance:new o.Uniform1f(c,d.u_camera_to_center_distance),u_viewport_size:new o.Uniform2f(c,d.u_viewport_size)}},debug:function(c,d){return{u_color:new o.UniformColor(c,d.u_color),u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_overlay:new o.Uniform1i(c,d.u_overlay),u_overlay_scale:new o.Uniform1f(c,d.u_overlay_scale)}},clippingMask:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix)}},heatmap:function(c,d){return{u_extrude_scale:new o.Uniform1f(c,d.u_extrude_scale),u_intensity:new o.Uniform1f(c,d.u_intensity),u_matrix:new o.UniformMatrix4f(c,d.u_matrix)}},heatmapTexture:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_world:new o.Uniform2f(c,d.u_world),u_image:new o.Uniform1i(c,d.u_image),u_color_ramp:new o.Uniform1i(c,d.u_color_ramp),u_opacity:new o.Uniform1f(c,d.u_opacity)}},hillshade:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_image:new o.Uniform1i(c,d.u_image),u_latrange:new o.Uniform2f(c,d.u_latrange),u_light:new o.Uniform2f(c,d.u_light),u_shadow:new o.UniformColor(c,d.u_shadow),u_highlight:new o.UniformColor(c,d.u_highlight),u_accent:new o.UniformColor(c,d.u_accent)}},hillshadePrepare:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_image:new o.Uniform1i(c,d.u_image),u_dimension:new o.Uniform2f(c,d.u_dimension),u_zoom:new o.Uniform1f(c,d.u_zoom),u_unpack:new o.Uniform4f(c,d.u_unpack)}},line:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_ratio:new o.Uniform1f(c,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(c,d.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(c,d.u_units_to_pixels)}},lineGradient:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_ratio:new o.Uniform1f(c,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(c,d.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(c,d.u_units_to_pixels),u_image:new o.Uniform1i(c,d.u_image),u_image_height:new o.Uniform1f(c,d.u_image_height)}},linePattern:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_texsize:new o.Uniform2f(c,d.u_texsize),u_ratio:new o.Uniform1f(c,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(c,d.u_device_pixel_ratio),u_image:new o.Uniform1i(c,d.u_image),u_units_to_pixels:new o.Uniform2f(c,d.u_units_to_pixels),u_scale:new o.Uniform3f(c,d.u_scale),u_fade:new o.Uniform1f(c,d.u_fade)}},lineSDF:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_ratio:new o.Uniform1f(c,d.u_ratio),u_device_pixel_ratio:new o.Uniform1f(c,d.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(c,d.u_units_to_pixels),u_patternscale_a:new o.Uniform2f(c,d.u_patternscale_a),u_patternscale_b:new o.Uniform2f(c,d.u_patternscale_b),u_sdfgamma:new o.Uniform1f(c,d.u_sdfgamma),u_image:new o.Uniform1i(c,d.u_image),u_tex_y_a:new o.Uniform1f(c,d.u_tex_y_a),u_tex_y_b:new o.Uniform1f(c,d.u_tex_y_b),u_mix:new o.Uniform1f(c,d.u_mix)}},raster:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_tl_parent:new o.Uniform2f(c,d.u_tl_parent),u_scale_parent:new o.Uniform1f(c,d.u_scale_parent),u_buffer_scale:new o.Uniform1f(c,d.u_buffer_scale),u_fade_t:new o.Uniform1f(c,d.u_fade_t),u_opacity:new o.Uniform1f(c,d.u_opacity),u_image0:new o.Uniform1i(c,d.u_image0),u_image1:new o.Uniform1i(c,d.u_image1),u_brightness_low:new o.Uniform1f(c,d.u_brightness_low),u_brightness_high:new o.Uniform1f(c,d.u_brightness_high),u_saturation_factor:new o.Uniform1f(c,d.u_saturation_factor),u_contrast_factor:new o.Uniform1f(c,d.u_contrast_factor),u_spin_weights:new o.Uniform3f(c,d.u_spin_weights)}},symbolIcon:function(c,d){return{u_is_size_zoom_constant:new o.Uniform1i(c,d.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(c,d.u_is_size_feature_constant),u_size_t:new o.Uniform1f(c,d.u_size_t),u_size:new o.Uniform1f(c,d.u_size),u_camera_to_center_distance:new o.Uniform1f(c,d.u_camera_to_center_distance),u_pitch:new o.Uniform1f(c,d.u_pitch),u_rotate_symbol:new o.Uniform1i(c,d.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(c,d.u_aspect_ratio),u_fade_change:new o.Uniform1f(c,d.u_fade_change),u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(c,d.u_label_plane_matrix
vendor: 6,050 bytes, line 2593
2593),u_coord_matrix:new o.UniformMatrix4f(c,d.u_coord_matrix),u_is_text:new o.Uniform1i(c,d.u_is_text),u_pitch_with_map:new o.Uniform1i(c,d.u_pitch_with_map),u_texsize:new o.Uniform2f(c,d.u_texsize),u_texture:new o.Uniform1i(c,d.u_texture)}},symbolSDF:function(c,d){return{u_is_size_zoom_constant:new o.Uniform1i(c,d.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(c,d.u_is_size_feature_constant),u_size_t:new o.Uniform1f(c,d.u_size_t),u_size:new o.Uniform1f(c,d.u_size),u_camera_to_center_distance:new o.Uniform1f(c,d.u_camera_to_center_distance),u_pitch:new o.Uniform1f(c,d.u_pitch),u_rotate_symbol:new o.Uniform1i(c,d.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(c,d.u_aspect_ratio),u_fade_change:new o.Uniform1f(c,d.u_fade_change),u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(c,d.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(c,d.u_coord_matrix),u_is_text:new o.Uniform1i(c,d.u_is_text),u_pitch_with_map:new o.Uniform1i(c,d.u_pitch_with_map),u_texsize:new o.Uniform2f(c,d.u_texsize),u_texture:new o.Uniform1i(c,d.u_texture),u_gamma_scale:new o.Uniform1f(c,d.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(c,d.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(c,d.u_is_halo)}},symbolTextAndIcon:function(c,d){return{u_is_size_zoom_constant:new o.Uniform1i(c,d.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(c,d.u_is_size_feature_constant),u_size_t:new o.Uniform1f(c,d.u_size_t),u_size:new o.Uniform1f(c,d.u_size),u_camera_to_center_distance:new o.Uniform1f(c,d.u_camera_to_center_distance),u_pitch:new o.Uniform1f(c,d.u_pitch),u_rotate_symbol:new o.Uniform1i(c,d.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(c,d.u_aspect_ratio),u_fade_change:new o.Uniform1f(c,d.u_fade_change),u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(c,d.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(c,d.u_coord_matrix),u_is_text:new o.Uniform1i(c,d.u_is_text),u_pitch_with_map:new o.Uniform1i(c,d.u_pitch_with_map),u_texsize:new o.Uniform2f(c,d.u_texsize),u_texsize_icon:new o.Uniform2f(c,d.u_texsize_icon),u_texture:new o.Uniform1i(c,d.u_texture),u_texture_icon:new o.Uniform1i(c,d.u_texture_icon),u_gamma_scale:new o.Uniform1f(c,d.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(c,d.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(c,d.u_is_halo)}},background:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_opacity:new o.Uniform1f(c,d.u_opacity),u_color:new o.UniformColor(c,d.u_color)}},backgroundPattern:function(c,d){return{u_matrix:new o.UniformMatrix4f(c,d.u_matrix),u_opacity:new o.Uniform1f(c,d.u_opacity),u_image:new o.Uniform1i(c,d.u_image),u_pattern_tl_a:new o.Uniform2f(c,d.u_pattern_tl_a),u_pattern_br_a:new o.Uniform2f(c,d.u_pattern_br_a),u_pattern_tl_b:new o.Uniform2f(c,d.u_pattern_tl_b),u_pattern_br_b:new o.Uniform2f(c,d.u_pattern_br_b),u_texsize:new o.Uniform2f(c,d.u_texsize),u_mix:new o.Uniform1f(c,d.u_mix),u_pattern_size_a:new o.Uniform2f(c,d.u_pattern_size_a),u_pattern_size_b:new o.Uniform2f(c,d.u_pattern_size_b),u_scale_a:new o.Uniform1f(c,d.u_scale_a),u_scale_b:new o.Uniform1f(c,d.u_scale_b),u_pixel_coord_upper:new o.Uniform2f(c,d.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(c,d.u_pixel_coord_lower),u_tile_units_to_pixels:new o.Uniform1f(c,d.u_tile_units_to_pixels)}}};function Ya(c,d,h,m,E,M,R){for(var L=c.context,z=L.gl,q=c.useProgram("collisionBox"),ee=[],Y=0,te=0,oe=0;oe<m.length;oe++){var we=m[oe],Oe=d.getTile(we),ge=Oe.getBucket(h);if(ge){var Re=we.posMatrix;E[0]===0&&E[1]===0||(Re=c.translatePosMatrix(we.posMatrix,Oe,E,M));var je=R?ge.textCollisionBox:ge.iconCollisionBox,$e=ge.collisionCircleArray;if($e.length>0){var nt=o.create(),qe=Re;o.mul(nt,ge.placementInvProjMatrix,c.transform.glCoordMatrix),o.mul(nt,nt,ge.placementViewportMatrix),ee.push({circleArray:$e,circleOffset:te,transform:qe,invTransform:nt}),te=Y+=$e.length/4}je&&q.draw(L,z.LINES,ve.disabled,Fe.disabled,c.colorModeForRenderPass(),be.disabled,Ka(Re,c.transform,Oe),h.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,null,c.transform.zoom,null,null,je.collisionVertexBuffer)}}if(R&&ee.length){var Qe=c.useProgram("collisionCircle"),pt=new o.StructArrayLayout2f1f2i16;pt.resize(4*Y),pt._trim();for(var Dt=0,Tt=0,zt=ee;Tt<zt.length;Tt+=1)for(var sr=zt[Tt],Cr=0;Cr<sr.circleArray.length/4;Cr++){var Pr=4*Cr,xn=sr.circleArray[Pr+0],ar=sr.circleArray[Pr+1],Wr=sr.circleArray[Pr+2],rn=sr.circleArray[Pr+3];pt.emplace(Dt++,xn,ar,Wr,rn,0),pt.emplace(Dt++,xn,ar,Wr,rn,1),pt.emplace(Dt++,xn,ar,Wr,rn,2),pt.emplace(Dt++,xn,ar,Wr,rn,3)}(!ns||ns.length<2*Y)&&(ns=(function(Ti){var vs=2*Ti,as=new o.StructArrayLayout3ui6;as.resize(vs),as._trim();for(var yi=0;yi<vs;yi++){var Ii=6*yi;as.uint16[Ii+0]=4*yi+0,as.uint16[Ii+1]=4*yi+1,as.uint16[Ii+2]=4*yi+2,as.uint16[Ii+3]=4*yi+2,as.uint16[Ii+4]=4*yi+3,as.uint16[Ii+5]=4*yi+0}return as})(Y));for(var Hr=L.createIndexBuffer(ns,!0),Vr=L.createVertexBuffer(pt,o.collisionCircleLayout.members,!0),Yr=0,kr=ee;Yr<kr.length;Yr+=1){var Fr=kr[Yr],Ki=Af(Fr.transform,Fr.invTransform,c.transform);Qe.draw(L,z.TRIANGLES,ve.disabled,Fe.disabled,c.colorModeForRenderPass(),be.disabled,Ki,h.id,Vr,Hr,o.SegmentVector.simpleSegment(0,2*Fr.circleOffset,Fr.circleArray.length,Fr.circleArray.length/2),null,c.transform.zoom,null,null,null)}Vr.destroy(),Hr.destroy()}}var Vs=o.identity(new Float32Array(16));function Qa(c,d,h,m,E,M){var R=o.getAnchorAlignment(c),L=-(R.horizontalAlign-.5)*d,z=-(R.verticalAlign-.5)*h,q=o.evaluateVariableOffset(c,m);return new o.Point((L/E+q[0])*M,(z/E+q[1])*M)}function Ol(c,d,h,m,E,M,R,L,z,q,ee){var Y=c.text.placedSymbolArray,te=c.text.dynamicLayoutVertexArray,oe=c.icon.dynamicLayoutVertexArray,we={};te.clear();for(var Oe=0;Oe<Y.length;Oe++){var ge=Y.get(Oe),Re=ge.hidden||!ge.crossTileID||c.allowVerticalPlacement&&!ge.placedOrientation?null:m[ge.crossTileID];if(Re){var je=new o.Point(ge.anchorX,ge.anchorY),$e=qt(je,h?L:R),nt=tn(M.cameraToCenterDistance,$e.signedDistanceFromCamera),qe=E.evaluateSizeForFeature
2593(c.textSizeData,q,ge)*nt/o.ONE_EM;h&&(qe*=c.tilePixelRatio/z);for(var Qe=Qa(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale,qe),pt=h?qt(je.add(Qe),R).point:$e.point.add(d?Qe.rotate(-M.angle):Qe),Dt=c.allowVerticalPlacement&&ge.placedOrientation===o.WritingMode.vertical?Math.PI/2:0,Tt=0;Tt<ge.numGlyphs;Tt++)o.addDynamicAttributes(te,pt,Dt);ee&&ge.associatedIconIndex>=0&&(we[ge.associatedIconIndex]={shiftedAnchor:pt,angle:Dt})}else Fi(ge.numGlyphs,te)}if(ee){oe.clear();for(var zt=c.icon.placedSymbolArray,sr=0;sr<zt.length;sr++){var Cr=zt.get(sr);if(Cr.hidden)Fi(Cr.numGlyphs,oe);else{var Pr=we[sr];if(Pr)for(var xn=0;xn<Cr.numGlyphs;xn++)o.addDynamicAttributes(oe,Pr.shiftedAnchor,Pr.angle);else Fi(Cr.numGlyphs,oe)}}c.icon.dynamicLayoutVertexBuffer.updateData(oe)}c.text.dynamicLayoutVertexBuffer.updateData(te)}function Dl(c,d,h){return h.iconsInText&&d?"symbolTextAndIcon":c?"symbolSDF":"symbolIcon"}function el(c,d,h,m,E,M,R,L,z,q,ee,Y){for(var te=c.context,oe=te.gl,we=c.transform,Oe=L==="map",ge=z==="map",Re=Oe&&h.layout.get("symbol-placement")!=="point",je=Oe&&!ge&&!Re,$e=h.layout.get("symbol-sort-key").constantOr(1)!==void 0,nt=!1,qe=c.depthModeForSublayer(0,ve.ReadOnly),Qe=h.layout.get("text-variable-anchor"),pt=[],Dt=0,Tt=m;Dt<Tt.length;Dt+=1){var zt=Tt[Dt],sr=d.getTile(zt),Cr=sr.getBucket(h);if(Cr){var Pr=E?Cr.text:Cr.icon;if(Pr&&Pr.segments.get().length){var xn=Pr.programConfigurations.get(h.id),ar=E||Cr.sdfIcons,Wr=E?Cr.textSizeData:Cr.iconSizeData,rn=ge||we.pitch!==0,Hr=c.useProgram(Dl(ar,E,Cr),xn),Vr=o.evaluateSizeForZoom(Wr,we.zoom),Yr=void 0,kr=[0,0],Fr=void 0,Ki=void 0,Ti=null,vs=void 0;if(E)Fr=sr.glyphAtlasTexture,Ki=oe.LINEAR,Yr=sr.glyphAtlasTexture.size,Cr.iconsInText&&(kr=sr.imageAtlasTexture.size,Ti=sr.imageAtlasTexture,vs=rn||c.options.rotating||c.options.zooming||Wr.kind==="composite"||Wr.kind==="camera"?oe.LINEAR:oe.NEAREST);else{var as=h.layout.get("icon-size").constantOr(0)!==1||Cr.iconsNeedLinear;Fr=sr.imageAtlasTexture,Ki=ar||c.options.rotating||c.options.zooming||as||rn?oe.LINEAR:oe.NEAREST,Yr=sr.imageAtlasTexture.size}var yi=Rn(sr,1,c.transform.zoom),Ii=pr(zt.posMatrix,ge,Oe,c.transform,yi),ao=Be(zt.posMatrix,ge,Oe,c.transform,yi),Ms=Qe&&Cr.hasTextData(),Gl=h.layout.get("icon-text-fit")!=="none"&&Ms&&Cr.hasIconData();Re&&_a(Cr,zt.posMatrix,c,E,Ii,ao,ge,q);var Ws=c.translatePosMatrix(zt.posMatrix,sr,M,R),sa=Re||E&&Qe||Gl?Vs:Ii,Fo=c.translatePosMatrix(ao,sr,M,R,!0),Tf=ar&&h.paint.get(E?"text-halo-width":"icon-halo-width").constantOr(1)!==0,wu={program:Hr,buffers:Pr,uniformValues:ar?Cr.iconsInText?fu(Wr.kind,Vr,je,ge,c,Ws,sa,Fo,Yr,kr):xo(Wr.kind,Vr,je,ge,c,Ws,sa,Fo,E,Yr):Sa(Wr.kind,Vr,je,ge,c,Ws,sa,Fo,E,Yr),atlasTexture:Fr,atlasTextureIcon:Ti,atlasInterpolation:Ki,atlasInterpolationIcon:vs,isSDF:ar,hasHalo:Tf};if($e&&Cr.canOverlap){nt=!0;for(var jl=0,Tu=Pr.segments.get();jl<Tu.length;jl+=1){var Ef=Tu[jl];pt.push({segments:new o.SegmentVector([Ef]),sortKey:Ef.sortKey,state:wu})}}else pt.push({segments:Pr.segments,sortKey:0,state:wu})}}}nt&&pt.sort((function(Hl,Mc){return Hl.sortKey-Mc.sortKey}));for(var Ba=0,Cf=pt;Ba<Cf.length;Ba+=1){var Pa=Cf[Ba],Zi=Pa.state;if(te.activeTexture.set(oe.TEXTURE0),Zi.atlasTexture.bind(Zi.atlasInterpolation,oe.CLAMP_TO_EDGE),Zi.atlasTextureIcon&&(te.activeTexture.set(oe.TEXTURE1),Zi.atlasTextureIcon&&Zi.atlasTextureIcon.bind(Zi.atlasInterpolationIcon,oe.CLAMP_TO_EDGE)),Zi.isSDF){var il=Zi.uniformValues;Zi.hasHalo&&(il.u_is_halo=1,Fl(Zi.buffers,Pa.segments,h,c,Zi.program,qe,ee,Y,il)),il.u_is_halo=0}Fl(Zi.buffers,Pa.segments,h,c,Zi.program,qe,ee,Y,Zi.uniformValues)}}function Fl(c,d,h,m,E,M,R,L,z){var q=m.context;E.draw(q,q.gl.TRIANGLES,M,R,L,be.disabled,z,h.id,c.layoutVertexBuffer,c.indexBuffer,d,h.paint,m.transform.zoom,c.programConfigurations.get(h.id),c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer)}function hu(c,d,h,m,E,M,R){var L,z,q,ee,Y,te=c.context.gl,oe=h.paint.get("fill-pattern"),we=oe&&oe.constantOr(1),Oe=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 je=Re[ge],$e=d.getTile(je);if(!we||$e.patternsLoaded()){var nt=$e.getBucket(h);if(nt){var qe=nt.programConfigurations.get(h.id),Qe=c.useProgram(z,qe);we&&(c.context.activeTexture.set(te.TEXTURE0),$e.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),qe.updatePaintBuffers(Oe));var pt=oe.constantOr(null);if(pt&&$e.imageAtlas){var Dt=$e.imageAtlas,Tt=Dt.patternPositions[pt.to.toString()],zt=Dt.patternPositions[pt.from.toString()];Tt&&zt&&qe.setConstantPatternPositions(Tt,zt)}var sr=c.translatePosMatrix(je.posMatrix,$e,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(R){ee=nt.indexBuffer2,Y=nt.segments2;var Cr=[te.drawingBufferWidth,te.drawingBufferHeight];q=z==="fillOutlinePattern"&&we?lu(sr,c,Oe,$e,Cr):Bh(sr,Cr)}else ee=nt.indexBuffer,Y=nt.segments,q=we?to(sr,c,Oe,$e):Jo(sr);Qe.draw(c.context,L,E,c.stencilModeForClipping(je),M,be.disabled,q,h.id,nt.layoutVertexBuffer,ee,Y,h.paint,c.transform.zoom,qe)}}}}
vendor: 3,970 bytes, line 2593
2593function wc(c,d,h,m,E,M,R){for(var L=c.context,z=L.gl,q=h.paint.get("fill-extrusion-pattern"),ee=q.constantOr(1),Y=h.getCrossfadeParameters(),te=h.paint.get("fill-extrusion-opacity"),oe=0,we=m;oe<we.length;oe+=1){var Oe=we[oe],ge=d.getTile(Oe),Re=ge.getBucket(h);if(Re){var je=Re.programConfigurations.get(h.id),$e=c.useProgram(ee?"fillExtrusionPattern":"fillExtrusion",je);ee&&(c.context.activeTexture.set(z.TEXTURE0),ge.imageAtlasTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),je.updatePaintBuffers(Y));var nt=q.constantOr(null);if(nt&&ge.imageAtlas){var qe=ge.imageAtlas,Qe=qe.patternPositions[nt.to.toString()],pt=qe.patternPositions[nt.from.toString()];Qe&&pt&&je.setConstantPatternPositions(Qe,pt)}var Dt=c.translatePosMatrix(Oe.posMatrix,ge,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Tt=h.paint.get("fill-extrusion-vertical-gradient"),zt=ee?qo(Dt,c,Tt,te,Oe,Y,ge):Ih(Dt,c,Tt,te);$e.draw(L,L.gl.TRIANGLES,E,M,R,be.backCCW,zt,h.id,Re.layoutVertexBuffer,Re.indexBuffer,Re.segments,h.paint,c.transform.zoom,je)}}}function du(c,d,h,m,E,M){var R=c.context,L=R.gl,z=d.fbo;if(z){var q=c.useProgram("hillshade");R.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,z.colorAttachment.get());var ee=(function(Y,te,oe){var we=oe.paint.get("hillshade-shadow-color"),Oe=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-=Y.transform.angle);var je,$e,nt,qe=!Y.options.moving;return{u_matrix:Y.transform.calculatePosMatrix(te.tileID.toUnwrapped(),qe),u_image:0,u_latrange:(je=te.tileID,$e=Math.pow(2,je.canonical.z),nt=je.canonical.y,[new o.MercatorCoordinate(0,nt/$e).toLngLat().lat,new o.MercatorCoordinate(0,(nt+1)/$e).toLngLat().lat]),u_light:[oe.paint.get("hillshade-exaggeration"),Re],u_shadow:we,u_highlight:Oe,u_accent:ge}})(c,d,h);q.draw(R,L.TRIANGLES,m,E,M,be.disabled,ee,h.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}}function kp(c,d,h,m,E,M){var R=c.context,L=R.gl,z=d.dem;if(z&&z.data){var q=z.dim,ee=z.stride,Y=z.getPixels();if(R.activeTexture.set(L.TEXTURE1),R.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||c.getTileTexture(ee),d.demTexture){var te=d.demTexture;te.update(Y,{premultiply:!1}),te.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else d.demTexture=new o.Texture(R,Y,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:q,height:q,data:null},L.RGBA);we.bind(L.LINEAR,L.CLAMP_TO_EDGE),(oe=d.fbo=R.createFramebuffer(q,q,!0)).colorAttachment.set(we.texture)}R.bindFramebuffer.set(oe.framebuffer),R.viewport.set([0,0,q,q]),c.useProgram("hillshadePrepare").draw(R,L.TRIANGLES,m,E,M,be.disabled,(function(Oe,ge){var Re=ge.stride,je=o.create();return o.ortho(je,0,o.EXTENT,-o.EXTENT,0,0,1),o.translate(je,je,[0,-o.EXTENT,0]),{u_matrix:je,u_image:1,u_dimension:[Re,Re],u_zoom:Oe.overscaledZ,u_unpack:ge.getUnpackVector()}})(d.tileID,z),h.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments),d.needsHillshadePrepare=!1}}function Tc(c,d,h,m,E){var M=m.paint.get("raster-fade-duration");if(M>0){var R=o.browser.now(),L=(R-c.timeAdded)/M,z=d?(R-d.timeAdded)/M:-1,q=h.getSource(),ee=E.coveringZoomLevel({tileSize:q.tileSize,roundZoom:q.roundZoom}),Y=!d||Math.abs(d.tileID.overscaledZ-ee)>Math.abs(c.tileID.overscaledZ-ee),te=Y&&c.refreshedUponExpiration?1:o.clamp(Y?L:1-z,0,1);return c.refreshedUponExpiration&&L>=1&&(c.refreshedUponExpiration=!1),d?{opacity:1,mix:1-te}:{opacity:te,mix:0}}return{opacity:1,mix:0}}var pu=new o.Color(1,0,0,1),Ll=new o.Color(0,1,0,1),tl=new o.Color(0,0,1,1),Au=new o.Color(1,0,1,1),rl=new o.Color(0,1,1,1);function gf(c,d,h,m){Ec(c,0,d+h/2,c.transform.width,h,m)}function mf(c,d,h,m){Ec(c,d-h/2,0,h,c.transform.height,m)}function Ec(c,d,h,m,E,M){var R=c.context,L=R.gl;
2593L.enable(L.SCISSOR_TEST),L.scissor(d*o.browser.devicePixelRatio,h*o.browser.devicePixelRatio,m*o.browser.devicePixelRatio,E*o.browser.devicePixelRatio),R.clear({color:M}),L.disable(L.SCISSOR_TEST)}function Rh(c,d,h){var m=c.context,E=m.gl,M=h.posMatrix,R=c.useProgram("debug"),L=ve.disabled,z=Fe.disabled,q=c.colorModeForRenderPass();m.activeTexture.set(E.TEXTURE0),c.emptyTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),R.draw(m,E.LINE_STRIP,L,z,q,be.disabled,Ko(M,o.Color.red),"$debug",c.debugBuffer,c.tileBorderIndexBuffer,c.debugSegments);var ee=d.getTileByID(h.key).latestRawTileData,Y=Math.floor((ee&&ee.byteLength||0)/1024),te=d.getTile(h).tileSize,oe=512/Math.min(te,512)*(h.overscaledZ/c.transform.zoom)*.5,we=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(we+=" => "+h.overscaledZ),(function(Oe,ge){Oe.initDebugOverlayCanvas();var Re=Oe.debugOverlayCanvas,je=Oe.context.gl,$e=Oe.debugOverlayCanvas.getContext("2d");$e.clearRect(0,0,Re.width,Re.height),$e.shadowColor="white",$e.shadowBlur=2,$e.lineWidth=1.5,$e.strokeStyle="white",$e.textBaseline="top",$e.font="bold 36px Open Sans, sans-serif",$e.fillText(ge,5,5),$e.strokeText(ge,5,5),Oe.debugOverlayTexture.update(Re),Oe.debugOverlayTexture.bind(je.LINEAR,je.CLAMP_TO_EDGE)})(c,we+" "+Y+"kb"),R.draw(m,E.TRIANGLES,L,z,he.alphaBlended,be.disabled,Ko(M,o.Color.transparent,oe),"$debug",c.debugBuffer,c.quadTriangleIndexBuffer,c.debugSegments)}var nl={symbol:function(c,d,h,m,E){if(c.renderPass==="translucent"){var M=Fe.disabled,R=c.colorModeForRenderPass();h.layout.get("text-variable-anchor")&&(function(L,z,q,ee,Y,te,oe){for(var we=z.transform,Oe=Y==="map",ge=te==="map",Re=0,je=L;Re<je.length;Re+=1){var $e=je[Re],nt=ee.getTile($e),qe=nt.getBucket(q);if(qe&&qe.text&&qe.text.segments.get().length){var Qe=o.evaluateSizeForZoom(qe.textSizeData,we.zoom),pt=Rn(nt,1,z.transform.zoom),Dt=pr($e.posMatrix,ge,Oe,z.transform,pt),Tt=q.layout.get("icon-text-fit")!=="none"&&qe.hasIconData();if(Qe){var zt=Math.pow(2,we.zoom-nt.tileID.overscaledZ);Ol(qe,Oe,ge,oe,o.symbolSize,we,Dt,$e.posMatrix,zt,Qe,Tt)}}}})(m,c,h,d,h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),E),h.paint.get("icon-opacity").constantOr(1)!==0&&el(c,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"),M,R),h.paint.get("text-opacity").constantOr(1)!==0&&el(c,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"),M,R),d.map.showCollisionBoxes&&(Ya(c,d,h,m,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),!0),Ya(c,d,h,m,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),!1))}},circle:function(c,d,h,m){if(c.renderPass==="translucent"){var E=h.paint.get("circle-opacity"),M=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(E.constantOr(1)!==0||M.constantOr(1)!==0&&R.constantOr(1)!==0){for(var z=c.context,q=z.gl,ee=c.depthModeForSublayer(0,ve.ReadOnly),Y=Fe.disabled,te=c.colorModeForRenderPass(),oe=[],we=0;we<m.length;we++){var Oe=m[we],ge=d.getTile(Oe),Re=ge.getBucket(h);if(Re){var je=Re.programConfigurations.get(h.id),$e={programConfiguration:je,program:c.useProgram("circle",je),layoutVertexBuffer:Re.layoutVertexBuffer,indexBuffer:Re.indexBuffer,uniformValues:cu(c,Oe,ge,h)};if(L)for(var nt=0,qe=Re.segments.get();nt<qe.length;nt+=1){var Qe=qe[nt];oe.push({segments:new o.SegmentVector([Qe]),sortKey:Qe.sortKey,state:$e})}else oe.push({segments:Re.segments,sortKey:0,state:$e})}}L&&oe.sort((function(sr,Cr){return sr.sortKey-Cr.sortKey}));for(var pt=0,Dt=oe;pt<Dt.length;pt+=1){var Tt=Dt[pt],zt=Tt.state;zt.program.draw(z,q.TRIANGLES,ee,Y,te,be.disabled,zt.uniformValues,h.id,zt.layoutVertexBuffer,zt.indexBuffer,Tt.segments,h.paint,c.transform.zoom,zt.programConfiguration)}}}},heatmap:function(c,d,h,m){if(h.paint.get("heatmap-opacity")!==0)if(c.renderPass==="offscreen"){var E=c.context,M=E.gl,R=Fe.disabled,L=new he([M.ONE,M.ONE],o.Color.transparent,[!0,!0,!0,!0]);(function(oe,we,Oe){var ge=oe.gl;oe.activeTexture.set(ge.TEXTURE1),oe.viewport.set([0,0,we.width/4,we.height/4]);var Re=Oe.heatmapFbo;if(Re)ge.bindTexture(ge.TEXTURE_2D,Re.colorAttachment.get()),oe.bindFramebuffer.set(Re.framebuffer);else{var je=ge.createTexture();ge.bindTexture(ge.TEXTURE_2D,je),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=Oe.heatmapFbo=oe.createFramebuffer(we.width/4,we.height/4,!1),(function($e,nt,qe,Qe){var pt=$e.gl;pt.texImage2D(pt.TEXTURE_2D,0,pt.RGBA,nt.width/4,nt.height/4,0,pt.RGBA,$e.extRenderToTextureHalfFloat?$e.extTextureHalfFloat.HALF_FLOAT_OES:pt.UNSIGNED_BYTE,null),Qe.colorAttachment.set(qe)})(oe,we,je,Re)}})(E,c,h),E.clear({color:o.Color.transparent});for(var z=0;z<m.length;z++){var q=m[z];if(!d.hasRenderableParent(q)){var ee=d.getTile(q),Y=ee.getBucket(h);if(Y){var te=Y.programConfigurations.get(h.id);c.useProgram("heatmap",te).draw(E,M.TRIANGLES,ve.disabled,R,L,be.disabled,xc(q.posMatrix,ee,c.transform.zoom,h.paint.get("heatmap-intensity")),h.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,h.paint,c.transform.zoom,te)}}}E.viewport.set([0,0,c.width,c.height])}else c.renderPass==="translucent"&&(c.context.setColorMode(c.colorModeForRenderPass()),(function(oe,we){var Oe=oe.context,ge=Oe.gl,Re=we.heatmapFbo;if(Re){Oe.activeTexture.set(ge.TEXTURE0),ge.bindTexture(ge.TEXTURE_2D,Re.colorAttachment.get()),Oe.activeTexture.set(ge.TEXTURE1);var je=we.colorRampTexture;je||(je=we.colorRampTexture=new o.Texture(Oe,we.colorRamp,ge.RGBA)),je.bind(ge.LINEAR,ge.CLAMP_TO_EDGE),oe.useProgram("heatmapTexture").draw(Oe,ge.TRIANGLES,ve.disabled,Fe.disabled,oe.colorModeForRenderPass(),be.disabled,(function($e,nt,qe,Qe){var pt=o.create();o.ortho(pt,0,$e.width,$e.height,0,0,1);var Dt=$e.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)}})(c,h))},line:function(c,d,h,m){if(c.renderPass==="translucent"){var E=h.paint.get("line-opacity"),M=h.paint.get("line-width");if(E.constantOr(1)!==0&&M.constantOr(1)!==0)for(var R=c.depthModeForSublayer(0,ve.ReadOnly),L=c.colorModeForRenderPass(),z=h.paint.get("line-dasharray"),q=h.paint.get("line-pattern"),ee=q.constantOr(1),Y=h.paint.get("line-gradient"),te=h.getCrossfadeParameters(),oe=ee?"linePattern":z?"lineSDF":Y?"lineGradient":"line",we=c.context,Oe=we.gl,ge=!0,Re=0,je=m;Re<je.length;Re+=1){var $e=je[Re],nt=d.getTile($e);if(!ee||nt.patternsLoaded()){var qe=nt.getBucket(h);if(qe){var Qe=qe.programConfigurations.get(h.id),pt=c.context.program.get(),Dt=c.useProgram(oe,Qe),Tt=ge||Dt.program!==pt,zt=q.constantOr(null);if(zt&&nt.imageAtlas){var sr=nt.imageAtlas,Cr=sr.patternPositions[zt.to.toString()],Pr=sr.patternPositions[zt.from.toString()];Cr&&Pr&&Qe.setConstantPatternPositions(Cr,Pr)}var xn=ee?uu(c,nt,h,te):z?Fp(c,nt,h,z,te):Y?Fn(c,nt,h,qe.lineClipsArray.length):On(c,nt,h);if(ee)we.activeTexture.set(Oe.TEXTURE0),nt.imageAtlasTexture.bind(Oe.LINEAR,Oe.CLAMP_TO_EDGE),Qe.updatePaintBuffers(te);else if(z&&(Tt||c.lineAtlas.dirty))we.activeTexture.set(Oe.TEXTURE0),c.lineAtlas.bind(we);else if(Y){var ar=qe.gradients[h.id],Wr=ar.texture;if(h.gradientVersion!==ar.version){var rn=256;if(h.stepInterpolant){var Hr=d.getSource().maxzoom,Vr=$e.canonical.z===Hr?Math.ceil(1<<c.transform.maxZoom-$e.canonical.z):1;rn=o.clamp(o.nextPowerOfTwo(qe.maxLineLength/o.EXTENT*1024*Vr),256,we.maxTextureSize)}ar.gradient=o.renderColorRamp({expression:h.gradientExpression(),evaluationKey:"lineProgress",resolution:rn,image:ar.gradient||void 0,clips:qe.lineClipsArray}),ar.texture?ar.texture.update(ar.gradient):ar.texture=new o.Texture(we,ar.gradient,Oe.RGBA),ar.version=h.gradientVersion,Wr=ar.texture}we.activeTexture.set(Oe.TEXTURE0),Wr.bind(h.stepInterpolant?Oe.NEAREST:Oe.LINEAR,Oe.CLAMP_TO_EDGE)}Dt.draw(we,Oe.TRIANGLES,R,c.stencilModeForClipping($e),L,be.disabled,xn,h.id,qe.layoutVertexBuffer,qe.
2593indexBuffer,qe.segments,h.paint,c.transform.zoom,Qe,qe.layoutVertexBuffer2),ge=!1}}}}},fill:function(c,d,h,m){var E=h.paint.get("fill-color"),M=h.paint.get("fill-opacity");if(M.constantOr(1)!==0){var R=c.colorModeForRenderPass(),L=h.paint.get("fill-pattern"),z=c.opaquePassEnabledForLayer()&&!L.constantOr(1)&&E.constantOr(o.Color.transparent).a===1&&M.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===z){var q=c.depthModeForSublayer(1,c.renderPass==="opaque"?ve.ReadWrite:ve.ReadOnly);hu(c,d,h,m,q,R,!1)}if(c.renderPass==="translucent"&&h.paint.get("fill-antialias")){var ee=c.depthModeForSublayer(h.getPaintProperty("fill-outline-color")?2:0,ve.ReadOnly);hu(c,d,h,m,ee,R,!0)}}},"fill-extrusion":function(c,d,h,m){var E=h.paint.get("fill-extrusion-opacity");if(E!==0&&c.renderPass==="translucent"){var M=new ve(c.context.gl.LEQUAL,ve.ReadWrite,c.depthRangeFor3D);if(E!==1||h.paint.get("fill-extrusion-pattern").constantOr(1))wc(c,d,h,m,M,Fe.disabled,he.disabled),wc(c,d,h,m,M,c.stencilModeFor3D(),c.colorModeForRenderPass());else{var R=c.colorModeForRenderPass();wc(c,d,h,m,M,Fe.disabled,R)}}},hillshade:function(c,d,h,m){if(c.renderPass==="offscreen"||c.renderPass==="translucent"){for(var E=c.context,M=c.depthModeForSublayer(0,ve.ReadOnly),R=c.colorModeForRenderPass(),L=c.renderPass==="translucent"?c.stencilConfigForOverlap(m):[{},m],z=L[0],q=0,ee=L[1];q<ee.length;q+=1){var Y=ee[q],te=d.getTile(Y);te.needsHillshadePrepare&&c.renderPass==="offscreen"?kp(c,te,h,M,Fe.disabled,R):c.renderPass==="translucent"&&du(c,te,h,M,z[Y.overscaledZ],R)}E.viewport.set([0,0,c.width,c.height])}},raster:function(c,d,h,m){if(c.renderPass==="translucent"&&h.paint.get("raster-opacity")!==0&&m.length)for(var E=c.context,M=E.gl,R=d.getSource(),L=c.useProgram("raster"),z=c.colorModeForRenderPass(),q=R instanceof ut?[{},m]:c.stencilConfigForOverlap(m),ee=q[0],Y=q[1],te=Y[Y.length-1].overscaledZ,oe=!c.options.moving,we=0,Oe=Y;we<Oe.length;we+=1){var ge=Oe[we],Re=c.depthModeForSublayer(ge.overscaledZ-te,h.paint.get("raster-opacity")===1?ve.ReadWrite:ve.ReadOnly,M.LESS),je=d.getTile(ge),$e=c.transform.calculatePosMatrix(ge.toUnwrapped(),oe);je.registerFadeDuration(h.paint.get("raster-fade-duration"));var nt=d.findLoadedParent(ge,0),qe=Tc(je,nt,d,h,c.transform),Qe=void 0,pt=void 0,Dt=h.paint.get("raster-resampling")==="nearest"?M.NEAREST:M.LINEAR;E.activeTexture.set(M.TEXTURE0),je.texture.bind(Dt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(M.TEXTURE1),nt?(nt.texture.bind(Dt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),Qe=Math.pow(2,nt.tileID.overscaledZ-je.tileID.overscaledZ),pt=[je.tileID.canonical.x*Qe%1,je.tileID.canonical.y*Qe%1]):je.texture.bind(Dt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST);var Tt=Lp($e,pt||[0,0],Qe||1,qe,h);R instanceof ut?L.draw(E,M.TRIANGLES,Re,Fe.disabled,z,be.disabled,Tt,h.id,R.boundsBuffer,c.quadTriangleIndexBuffer,R.boundsSegments):L.draw(E,M.TRIANGLES,Re,ee[ge.overscaledZ],z,be.disabled,Tt,h.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}},background:function(c,d,h){var m=h.paint.get("background-color"),E=h.paint.get("background-opacity");if(E!==0){var M=c.context,R=M.gl,L=c.transform,z=L.tileSize,q=h.paint.get("background-pattern");if(!c.isPatternMissing(q)){var ee=!q&&m.a===1&&E===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass===ee){var Y=Fe.disabled,te=c.depthModeForSublayer(0,ee==="opaque"?ve.ReadWrite:ve.ReadOnly),oe=c.colorModeForRenderPass(),we=c.useProgram(q?"backgroundPattern":"background"),Oe=L.coveringTiles({tileSize:z});q&&(M.activeTexture.set(R.TEXTURE0),c.imageManager.bind(c.context));for(var ge=h.getCrossfadeParameters(),Re=0,je=Oe;Re<je.length;Re+=1){var $e=je[Re],nt=c.transform.calculatePosMatrix($e.toUnwrapped()),qe=q?Rl(nt,E,c,q,{tileID:$e,tileSize:z},ge):Za(nt,E,m);we.draw(M,R.TRIANGLES,te,Y,oe,be.disabled,qe,h.id,c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}}}},debug:function(c,d,h){for(var m=0;m<h.length;m++)Rh(c,d,h[m])},custom:function(c,d,h){var m=c.context,E=h.implementation;if(c.renderPass==="offscreen"){var M=E.prerender;M&&(c.setCustomLayerDefaults(),m.setColorMode(c.colorModeForRenderPass()),M.call(E,m.gl,c.transform.customLayerMatrix()),m.setDirty(),c.setBaseState())}else if(c.renderPass==="translucent"){c.setCustomLayerDefaults(),m.setColorMode(c.colorModeForRenderPass()),m.setStencilMode(Fe.disabled);var R=E.renderingMode==="3d"?new ve(c.context.gl.LEQUAL,ve.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,ve.ReadOnly);m.setDepthMode(R),E.render(m.gl,c.transform.customLayerMatrix()),m.setDirty(),c.setBaseState(),m.bindFramebuffer.set(null)}}},Xn=function(c,d){this.context=new ae(c),this.transform=d,this._tileTextures={},this.setup(),this.numSublayers=Se.maxUnderzooming+Se.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new va,this.gpuTimers={}};Xn.prototype.resize=function(c,d){if(this.width=c*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()},Xn.prototype.setup=function(){var c=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=c.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=c.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=c.createVertexBuffer(m,rt.members),this.rasterBoundsSegments=o.SegmentVector.simpleSegment(0,0,4,2);var E=new o.StructArrayLayout2i4;
vendor: 27,422 bytes, line 2593
2593E.emplaceBack(0,0),E.emplaceBack(1,0),E.emplaceBack(0,1),E.emplaceBack(1,1),this.viewportBuffer=c.createVertexBuffer(E,hi.members),this.viewportSegments=o.SegmentVector.simpleSegment(0,0,4,2);var M=new o.StructArrayLayout1ui2;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=c.createIndexBuffer(M);var R=new o.StructArrayLayout3ui6;R.emplaceBack(0,1,2),R.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=c.createIndexBuffer(R),this.emptyTexture=new o.Texture(c,{width:1,height:1,data:new Uint8Array([0,0,0,0])},c.gl.RGBA);var L=this.context.gl;this.stencilClearMode=new Fe({func:L.ALWAYS,mask:0},0,255,L.ZERO,L.ZERO,L.ZERO)},Xn.prototype.clearStencil=function(){var c=this.context,d=c.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(c,d.TRIANGLES,ve.disabled,this.stencilClearMode,he.disabled,be.disabled,Zo(h),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},Xn.prototype._renderTileClippingMasks=function(c,d){if(this.currentStencilSource!==c.source&&c.isTileClipped()&&d&&d.length){this.currentStencilSource=c.source;var h=this.context,m=h.gl;this.nextStencilID+d.length>256&&this.clearStencil(),h.setColorMode(he.disabled),h.setDepthMode(ve.disabled);var E=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var M=0,R=d;M<R.length;M+=1){var L=R[M],z=this._tileClippingMaskIDs[L.key]=this.nextStencilID++;E.draw(h,m.TRIANGLES,ve.disabled,new Fe({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)}}},Xn.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var c=this.nextStencilID++,d=this.context.gl;return new Fe({func:d.NOTEQUAL,mask:255},c,255,d.KEEP,d.KEEP,d.REPLACE)},Xn.prototype.stencilModeForClipping=function(c){var d=this.context.gl;return new Fe({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[c.key],0,d.KEEP,d.KEEP,d.REPLACE)},Xn.prototype.stencilConfigForOverlap=function(c){var d,h=this.context.gl,m=c.sort((function(z,q){return q.overscaledZ-z.overscaledZ})),E=m[m.length-1].overscaledZ,M=m[0].overscaledZ-E+1;if(M>1){this.currentStencilSource=void 0,this.nextStencilID+M>256&&this.clearStencil();for(var R={},L=0;L<M;L++)R[L+E]=new Fe({func:h.GEQUAL,mask:255},L+this.nextStencilID,255,h.KEEP,h.KEEP,h.REPLACE);return this.nextStencilID+=M,[R,m]}return[(d={},d[E]=Fe.disabled,d),m]},Xn.prototype.colorModeForRenderPass=function(){var c=this.context.gl;return this._showOverdrawInspector?new he([c.CONSTANT_COLOR,c.ONE],new o.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?he.unblended:he.alphaBlended},Xn.prototype.depthModeForSublayer=function(c,d,h){if(!this.opaquePassEnabledForLayer())return ve.disabled;var m=1-((1+this.currentLayer)*this.numSublayers+c)*this.depthEpsilon;return new ve(h||this.context.gl.LEQUAL,d,[m,m])},Xn.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},Xn.prototype.render=function(c,d){var h=this;this.style=c,this.options=d,this.lineAtlas=c.lineAtlas,this.imageManager=c.imageManager,this.glyphManager=c.glyphManager,this.symbolFadeChange=c.placement.symbolFadeChange(o.browser.now()),this.imageManager.beginFrame();var m=this.style._order,E=this.style.sourceCaches;for(var M in E){var R=E[M];R.used&&R.prepare(this.context)}var L,z,q={},ee={},Y={};for(var te in E){var oe=E[te];q[te]=oe.getVisibleCoordinates(),ee[te]=q[te].slice().reverse(),Y[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 Oe=0,ge=m;Oe<ge.length;Oe+=1){var Re=this.style._layers[ge[Oe]];if(Re.hasOffscreenPass()&&!Re.isHidden(this.transform.zoom)){var je=ee[Re.source];(Re.type==="custom"||je.length)&&this.renderLayer(this,E[Re.source],Re,je)}}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-(c._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){var $e=this.style._layers[m[this.currentLayer]],nt=E[$e.source],qe=q[$e.source];this._renderTileClippingMasks($e,qe),this.renderLayer(this,nt,$e,qe)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){var Qe=this.style._layers[m[this.currentLayer]],pt=E[Qe.source],Dt=(Qe.type==="symbol"?Y:ee)[Qe.source];this._renderTileClippingMasks(Qe,q[Qe.source]),this.renderLayer(this,pt,Qe,Dt)}this.options.showTileBoundaries&&(o.values(this.style._layers).forEach((function(Tt){Tt.source&&!Tt.isHidden(h.transform.zoom)&&(Tt.source!==(z&&z.id)&&(z=h.style.sourceCaches[Tt.source]),(!L||L.getSource().maxzoom<z.getSource().maxzoom)&&(L=z))})),L&&nl.debug(this,L,L.getVisibleCoordinates())),this.options.showPadding&&(function(Tt){var zt=Tt.transform.padding;gf(Tt,Tt.transform.height-(zt.top||0),3,pu),gf(Tt,zt.bottom||0,3,Ll),mf(Tt,zt.left||0,3,tl),mf(Tt,Tt.transform.width-(zt.right||0),3,Au);var sr=Tt.transform.centerPoint;(function(Cr,Pr,xn,ar){Ec(Cr,Pr-1,xn-10,2,20,ar),Ec(Cr,Pr-10,xn-1,20,2,ar)})(Tt,sr.x,Tt.transform.height-sr.y,rl)})(this),this.context.setDefault()},Xn.prototype.renderLayer=function(c,d,h,m){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="custom"||m.length)&&(this.id=h.id,this.gpuTimingStart(h),nl[h.type](c,d,h,m,this.style.placement.variableOffsets),this.gpuTimingEnd())},Xn.prototype.gpuTimingStart=function(c){if(this.options.gpuTiming){var d=this.context.extTimerQuery,h=this.gpuTimers[c.id];h||(h=this.gpuTimers[c.id]={calls:0,cpuTime:0,query:d.createQueryEXT()}),h.calls++,d.beginQueryEXT(d.TIME_ELAPSED_EXT,h.query)}},Xn.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var c=this.context.extTimerQuery;c.endQueryEXT(c.TIME_ELAPSED_EXT)}},Xn.prototype.collectGpuTimers=function(){var c=this.gpuTimers;return this.gpuTimers={},c},Xn.prototype.queryGpuTimers=function(c){var d={};for(var h in c){var m=c[h],E=this.context.extTimerQuery,M=E.getQueryObjectEXT(m.query,E.QUERY_RESULT_EXT)/1e6;E.deleteQueryEXT(m.query),d[h]=M}return d},Xn.prototype.translatePosMatrix=function(c,d,h,m,E){if(!h[0]&&!h[1])return c;var M=E?m==="map"?this.transform.angle:0:m==="viewport"?-this.transform.angle:0;if(M){var R=Math.sin(M),L=Math.cos(M);h=[h[0]*L-h[1]*R,h[0]*R+h[1]*L]}var z=[E?h[0]:Rn(d,h[0],this.transform.zoom),E?h[1]:Rn(d,h[1],this.transform.zoom),0],q=new Float32Array(16);return o.translate(q,c,z),q},Xn.prototype.saveTileTexture=function(c){var d=this._tileTextures[c.size[0]];d?d.push(c):this._tileTextures[c.size[0]]=[c]},Xn.prototype.getTileTexture=function(c){var d=this._tileTextures[c];return d&&d.length>0?d.pop():null},Xn.prototype.isPatternMissing=function(c){if(!c)return!1;if(!c.from||!c.to)return!0;var d=this.imageManager.getPattern(c.from.toString()),h=this.imageManager.getPattern(c.to.toString());return!d||!h},Xn.prototype.useProgram=function(c,d){this.cache=this.cache||{};var h=""+c+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[h]||(this.cache[h]=new Sh(this.context,c,ou[c],d,zs[c],this._showOverdrawInspector)),this.cache[h]},Xn.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()},Xn.prototype.setBaseState=function(){var c=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(c.FUNC_ADD)},Xn.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))},Xn.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var gu=function(c,d){this.points=c,this.planes=d};gu.fromInvProjectionMatrix=function(c,d,h){var m=Math.pow(2,h),E=[[-1,1,-1,1],[1,1,-1,1],[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,c)})).map((function(R){return o.scale$1([],R,1/R[3]/d*m)})),M=[[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([],E[R[0]],E[R[1]]),z=o.sub([],E[R[2]],E[R[1]]),q=o.normalize([],o.cross([],L,z)),ee=-o.dot(q,E[R[1]]);return q.concat(ee)}));return new gu(E,M)};var Yo=function(c,d){this.min=c,this.max=d,this.center=o.scale$2([],o.add([],this.min,this.max),.5)};Yo.prototype.quadrant=function(c){for(var d=[c%2==0,c<2],h=o.clone$2(this.min),m=o.clone$2(this.max),E=0;E<d.length;E++)h[E]=d[E]?this.min[E]:this.center[E],m[E]=d[E]?this.center[E]:this.max[E];return m[2]=this.max[2],new Yo(h,m)},Yo.prototype.distanceX=function(c){return Math.max(Math.min(this.max[0],c[0]),this.min[0])-c[0]},Yo.prototype.distanceY=function(c){return Math.max(Math.min(this.max[1],c[1]),this.min[1])-c[1]},Yo.prototype.intersects=function(c){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<c.planes.length;m++){for(var E=c.planes[m],M=0,R=0;R<d.length;R++)M+=o.dot$1(E,d[R])>=0;if(M===0)return 0;M!==d.length&&(h=!1)}if(h)return 2;for(var L=0;L<3;L++){for(var z=Number.MAX_VALUE,q=-Number.MAX_VALUE,ee=0;ee<c.points.length;ee++){var Y=c.points[ee][L]-this.min[L];z=Math.min(z,Y),q=Math.max(q,Y)}if(q<0||z>this.max[L]-this.min[L])return 0}return 1};var Qo=function(c,d,h,m){if(c===void 0&&(c=0),d===void 0&&(d=0),h===void 0&&(h=0),m===void 0&&(m=0),isNaN(c)||c<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=c,this.bottom=d,this.left=h,this.right=m};Qo.prototype.interpolate=function(c,d,h){return d.top!=null&&c.top!=null&&(this.top=o.number(c.top,d.top,h)),d.bottom!=null&&c.bottom!=null&&(this.bottom=o.number(c.bottom,d.bottom,h)),d.left!=null&&c.left!=null&&(this.left=o.number(c.left,d.left,h)),d.right!=null&&c.right!=null&&(this.right=o.number(c.right,d.right,h)),this},Qo.prototype.getCenter=function(c,d){var h=o.clamp((this.left+c-this.right)/2,0,c),m=o.clamp((this.top+d-this.bottom)/2,0,d);return new o.Point(h,m)},Qo.prototype.equals=function(c){return this.top===c.top&&this.bottom===c.bottom&&this.left===c.left&&this.right===c.right},Qo.prototype.clone=function(){return new Qo(this.top,this.bottom,this.left,this.right)},Qo.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var fn=function(c,d,h,m,E){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=E===void 0||E,this._minZoom=c||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 Qo,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 c=new fn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return c.tileSize=this.tileSize,c.latRange=this.latRange,c.width=this.width,c.height=this.height,c._center=this._center,c.zoom=this.zoom,c.angle=this.angle,c._fov=this._fov,c._pitch=this._pitch,c._unmodified=this._unmodified,c._edgeInsets=this._edgeInsets.clone(),c._calcMatrices(),c},Ln.minZoom.get=function(){return this._minZoom},Ln.minZoom.set=function(c){this._minZoom!==c&&(this._minZoom=c,this.zoom=Math.max(this.zoom,c))},Ln.maxZoom.get=function(){return this._maxZoom},Ln.maxZoom.set=function(c){this._maxZoom!==c&&(this._maxZoom=c,this.zoom=Math.min(this.zoom,c))},Ln.minPitch.get=function(){return this._minPitch},Ln.minPitch.set=function(c){this._minPitch!==c&&(this._minPitch=c,this.pitch=Math.max(this.pitch,c))},Ln.maxPitch.get=function(){return this._maxPitch},Ln.maxPitch.set=function(c){this._maxPitch!==c&&(this._maxPitch=c,this.pitch=Math.min(this.pitch,c))},Ln.renderWorldCopies.get=function(){return this._renderWorldCopies},Ln.renderWorldCopies.set=function(c){c===void 0?c=!0:c===null&&(c=!1),this._renderWorldCopies=c},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(c){var d=-o.wrap(c,-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(c){var d=o.clamp(c,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(c){c=Math.max(.01,Math.min(60,c)),this._fov!==c&&(this._unmodified=!1,this._fov=c/180*Math.PI,this._calcMatrices())},Ln.zoom.get=function(){return this._zoom},Ln.zoom.set=function(c){var d=Math.min(Math.max(c,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(c){c.lat===this._center.lat&&c.lng===this._center.lng||(this._unmodified=!1,this._center=c,this._constrain(),this._calcMatrices())},Ln.padding.get=function(){return this._edgeInsets.toJSON()},Ln.padding.set=function(c){this._edgeInsets.equals(c)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,c,1),this._calcMatrices())},Ln.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},fn.prototype.isPaddingEqual=function(c){return this._edgeInsets.equals(c)},fn.prototype.interpolatePadding=function(c,d,h){this._unmodified=!1,this._edgeInsets.interpolate(c,d,h),this._constrain(),this._calcMatrices()},fn.prototype.coveringZoomLevel=function(c){var d=(c.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/c.tileSize));return Math.max(0,d)},fn.prototype.getVisibleUnwrappedCoordinates=function(c){var d=[new o.UnwrappedTileID(0,c)];if(this._renderWorldCopies)for(var h=this.pointCoordinate(new o.Point(0,0)),m=this.pointCoordinate(new o.Point(this.width,0)),E=this.pointCoordinate(new o.Point(this.width,this.height)),M=this.pointCoordinate(new o.Point(0,this.height)),R=Math.floor(Math.min(h.x,m.x,E.x,M.x)),L=Math.floor(Math.max(h.x,m.x,E.x,M.x)),z=R-1;z<=L+1;z++)z!==0&&d.push(new o.UnwrappedTileID(z,c));return d},fn.prototype.coveringTiles=function(c){var d=this.coveringZoomLevel(c),h=d;if(c.minzoom!==void 0&&d<c.minzoom)return[];c.maxzoom!==void 0&&d>c.maxzoom&&(d=c.maxzoom);var m=o.MercatorCoordinate.fromLngLat(this.center),E=Math.pow(2,d),M=[E*m.x,E*m.y,0],R=gu.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d),L=c.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(L=d);var z=function(Tt){return{aabb:new Yo([Tt*E,0,0],[(Tt+1)*E,E,0]),zoom:0,x:0,y:0,wrap:Tt,fullyVisible:!1}},q=[],ee=[],Y=d,te=c.reparseOverscaled?h:d;if(this._renderWorldCopies)for(var oe=1;oe<=3;oe++)q.push(z(-oe)),q.push(z(oe));for(q.push(z(0));q.length>0;){var we=q.pop(),Oe=we.x,ge=we.y,Re=we.fullyVisible;if(!Re){var je=we.aabb.intersects(R);if(je===0)continue;Re=je===2}var $e=we.aabb.distanceX(M),nt=we.aabb.distanceY(M),qe=Math.max(Math.abs($e),Math.abs(nt));if(we.zoom===Y||qe>3+(1<<Y-we.zoom)-2&&we.zoom>=L)ee.push({tileID:new o.OverscaledTileID(we.zoom===Y?te:we.zoom,we.wrap,we.zoom,Oe,ge),distanceSq:o.sqrLen([M[0]-.5-Oe,M[1]-.5-ge])});else for(var Qe=0;Qe<4;Qe++){var pt=(Oe<<1)+Qe%2,Dt=(ge<<1)+(Qe>>1);q.push({aabb:we.aabb.quadrant(Qe),zoom:we.zoom+1,x:pt,y:Dt,wrap:we.wrap,fullyVisible:Re})}}return ee.sort((function(Tt,zt){return Tt.distanceSq-zt.distanceSq})).map((function(Tt){return Tt.tileID}))},fn.prototype.resize=function(c,d){this.width=c,this.height=d,this.pixelsToGLUnits=[2/c,-2/d],this._constrain(),this._calcMatrices()},Ln.unmodified.get=function(){return this._unmodified},fn.prototype.zoomScale=function(c){return Math.pow(2,c)},fn.prototype.scaleZoom=function(c){return Math.log(c)/Math.LN2},fn.prototype.project=function(c){var d=o.clamp(c.lat,-this.maxValidLatitude,this.maxValidLatitude);return new o.Point(o.mercatorXfromLng(c.lng)*this.worldSize,o.mercatorYfromLat(d)*this.worldSize)},fn.prototype.unproject=function(c){return new o.MercatorCoordinate(c.x/this.worldSize,c.y/this.worldSize).toLngLat()},Ln.point.get=function(){return this.project(this.center)},fn.prototype.setLocationAtPoint=function(c,d){var h=this.pointCoordinate(d),m=this.pointCoordinate(this.centerPoint),E=this.locationCoordinate(c),M=new o.MercatorCoordinate(E.x-(h.x-m.x),E.y-(h.y-m.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())},fn.prototype.locationPoint=function(c){return this.coordinatePoint(this.locationCoordinate(c))},fn.prototype.pointLocation=function(c){return this.coordinateLocation(this.pointCoordinate(c))},fn.prototype.locationCoordinate=function(c){return o.MercatorCoordinate.fromLngLat(c)},fn.prototype.coordinateLocation=function(c){return c.toLngLat()},fn.prototype.pointCoordinate=function(c){var d=[c.x,c.y,0,1],h=[c.x,c.y,1,1];o.transformMat4(d,d,this.pixelMatrixInverse),o.transformMat4(h,h,this.pixelMatrixInverse);var m=d[3],E=h[3],M=d[1]/m,R=h[1]/E,L=d[2]/m,z=h[2]/E,q=L===z?0:(0-L)/(z-L);return new o.MercatorCoordinate(o.number(d[0]/m,h[0]/E,q)/this.worldSize,o.number(M,R,q)/this.worldSize)},fn.prototype.coordinatePoint=function(c){var d=[c.x*this.worldSize,c.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(c){c?(this.lngRange=[c.getWest(),c.getEast()],this.latRange=[c.getSouth(),c.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},fn.prototype.calculatePosMatrix=function(c,d){d===void 0&&(d=!1);var h=c.key,m=d?this._alignedPosMatrixCache:this._posMatrixCache;if(m[h])return m[h];var E=c.canonical,M=this.worldSize/this.zoomScale(E.z),R=E.x+Math.pow(2,E.z)*c.wrap,L=o.identity(new Float64Array(16));return o.translate(L,L,[R*M,E.y*M,0]),o.scale(L,L,[M/o.EXTENT,M/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 c,d,h,m,E=-90,M=90,R=-180,L=180,z=this.size,q=this._unmodified;if(this.latRange){var ee=this.latRange;E=o.mercatorYfromLat(ee[1])*this.worldSize,c=(M=o.mercatorYfromLat(ee[0])*this.worldSize)-E<z.y?z.y/(M-E):0}if(this.lngRange){var Y=this.lngRange;R=o.mercatorXfromLng(Y[0])*this.worldSize,d=(L=o.mercatorXfromLng(Y[1])*this.worldSize)-R<z.x?z.x/(L-R):0}var te=this.point,oe=Math.max(d||0,c||0);if(oe)return this.center=this.unproject(new o.Point(d?(L+R)/2:te.x,c?(M+E)/2:te.y)),this.zoom+=this.scaleZoom(oe),this._unmodified=q,void(this._constraining=!1);if(this.latRange){var we=te.y,Oe=z.y/2;we-Oe<E&&(m=E+Oe),we+Oe>M&&(m=M-Oe)}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=q,this._constraining=!1}},fn.prototype._calcMatrices=function(){if(this.height){var c=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var d=Math.PI/2+this._pitch,h=this._fov*(.5+c.y/this.height),m=Math.sin(h)*this.cameraToCenterDistance/Math.sin(o.clamp(Math.PI-d-h,.01,Math.PI-.01)),E=this.point,M=E.x,R=E.y,L=1.01*(Math.cos(Math.PI/2-this._pitch)*m+this.cameraToCenterDistance),z=this.height/50,q=new Float64Array(16);o.perspective(q,this._fov,this.width/this.height,z,L),q[8]=2*-c.x/this.width,q[9]=2*c.y/this.height,o.scale(q,q,[1,-1,1]),o.translate(q,q,[0,0,-this.cameraToCenterDistance]),o.rotateX(q,q,this._pitch),o.rotateZ(q,q,this.angle),o.translate(q,q,[-M,-R,0]),this.mercatorMatrix=o.scale([],q,[this.worldSize,this.worldSize,this.worldSize]),o.scale(q,q,[1,1,o.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=q,this.invProjMatrix=o.invert([],this.projMatrix);var ee=this.width%2/2,Y=this.height%2/2,te=Math.cos(this.angle),oe=Math.sin(this.angle),we=M-Math.round(M)+te*ee+oe*Y,Oe=R-Math.round(R)+te*Y+oe*ee,ge=new Float64Array(q);if(o.translate(ge,ge,[we>.5?we-1:we,Oe>.5?Oe-1:Oe,0]),this.alignedProjMatrix=ge,q=o.create(),o.scale(q,q,[this.width/2,-this.height/2,1]),o.translate(q,q,[1,-1,0]),this.labelPlaneMatrix=q,q=o.create(),o.scale(q,q,[1,-1,1]),o.translate(q,q,[-1,-1,0]),o.scale(q,q,[2/this.width,2/this.height,1]),this.glCoordMatrix=q,this.pixelMatrix=o.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(q=o.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=q,this._posMatrixCache={},this._alignedPosMatrixCache={}}},fn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var c=this.pointCoordinate(new o.Point(0,0)),d=[c.x*this.worldSize,c.y*this.worldSize,0,1];return o.transformMat4(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance},fn.prototype.getCameraPoint=function(){var c=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.Point(0,c))},fn.prototype.getCameraQueryGeometry=function(c){var d=this.getCameraPoint();if(c.length===1)return[c[0],d];for(var h=d.x,m=d.y,E=d.x,M=d.y,R=0,L=c;R<L.length;R+=1){var z=L[R];h=Math.min(h,z.x),m=Math.min(m,z.y),E=Math.max(E,z.x),M=Math.max(M,z.y)}return[new o.Point(h,m),new o.Point(E,m),new o.Point(E,M),new o.Point(h,M),new o.Point(h,m)]},Object.defineProperties(fn.prototype,Ln);var Gs=function(c){var d,h,m,E;this._hashName=c&&encodeURIComponent(c),o.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(d=this._updateHashUnthrottled.bind(this),h=!1,m=null,E=function(){m=null,h&&(d(),m=setTimeout(E,300),h=!1)},function(){return h=!0,m||E(),m})};Gs.prototype.addTo=function(c){return this._map=c,o.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Gs.prototype.remove=function(){return o.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Gs.prototype.getHashString=function(c){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),E=Math.pow(10,m),M=Math.round(d.lng*E)/E,R=Math.round(d.lat*E)/E,L=this._map.getBearing(),z=this._map.getPitch(),q="";if(q+=c?"/"+M+"/"+R+"/"+h:h+"/"+R+"/"+M,(L||z)&&(q+="/"+Math.round(10*L)/10),z&&(q+="/"+Math.round(z)),this._hashName){var ee=this._hashName,Y=!1,te=o.window.location.hash.slice(1).split("&").map((function(oe){var we=oe.split("=")[0];return we===ee?(Y=!0,we+"="+q):oe})).filter((function(oe){return oe}));return Y||te.push(ee+"="+q),"#"+te.join("&")}return"#"+q},Gs.prototype._getCurrentHash=function(){var c,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&&(c=m)})),(c&&c[1]||"").split("/")):h.split("/")},Gs.prototype._onHashChange=function(){var c=this._getCurrentHash();if(c.length>=3&&!c.some((function(h){return isNaN(h)}))){var d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(c[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+c[2],+c[1]],zoom:+c[0],bearing:d,pitch:+(c[4]||0)}),!0}return!1},Gs.prototype._updateHashUnthrottled=function(){var c=o.window.location.href.replace(/(#.+)?$/,this.getHashString());try{o.window.history.replaceState(o.window.history.state,null,c)}catch{}};var Cc={linearity:.3,easing:o.bezier(0,0,.3,1)},kl=o.extend({deceleration:2500,maxSpeed:1400},Cc),Sc=o.extend({deceleration:20,maxSpeed:1400},Cc),Np=o.extend({deceleration:1e3,maxSpeed:360},Cc),Up=o.extend({deceleration:1e3,maxSpeed:90},Cc),Nl=function(c){this._map=c,this.clear()};function Ic(c,d){(!c.duration||c.duration<d.duration)&&(c.duration=d.duration,c.easing=d.easing)}function Ro(c,d,h){var m=h.maxSpeed,E=h.linearity,M=h.deceleration,R=o.clamp(c*E/(d/1e3),-m,m),L=Math.abs(R)/(M*E);return{easing:h.easing,duration:1e3*L,amount:R*(L/2)}}Nl.prototype.clear=function(){this._inertiaBuffer=[]},Nl.prototype.record=function(c){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.browser.now(),settings:c})},Nl.prototype._drainInertiaBuffer=function(){for(var c=this._inertiaBuffer,d=o.browser.now();c.length>0&&d-c[0].time>160;)c.shift()},Nl.prototype._onMoveEnd=function(c){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 E=m[h].settings;d.zoom+=E.zoomDelta||0,d.bearing+=E.bearingDelta||0,d.pitch+=E.pitchDelta||0,E.panDelta&&d.pan._add(E.panDelta),E.around&&(d.around=E.around),E.pinchAround&&(d.pinchAround=E.pinchAround)}var M=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,R={};if(d.pan.mag()){var L=Ro(d.pan.mag(),M,o.extend({},kl,c||{}));R.offset=d.pan.mult(L.amount/d.pan.mag()),R.center=this._map.transform.center,Ic(R,L)}if(d.zoom){var z=Ro(d.zoom,M,Sc);R.zoom=this._map.transform.zoom+z.amount,Ic(R,z)}if(d.bearing){var q=Ro(d.bearing,M,Np);
2593R.bearing=this._map.transform.bearing+o.clamp(q.amount,-179,179),Ic(R,q)}if(d.pitch){var ee=Ro(d.pitch,M,Up);R.pitch=this._map.transform.pitch+ee.amount,Ic(R,ee)}if(R.zoom||R.bearing){var Y=d.pinchAround===void 0?d.around:d.pinchAround;R.around=Y?this._map.unproject(Y):this._map.getCenter()}return this.clear(),o.extend(R,{noMoveStart:!0})}};var kn=(function(c){function d(m,E,M,R){R===void 0&&(R={});var L=f.mousePos(E.getCanvasContainer(),M),z=E.unproject(L);c.call(this,m,o.extend({point:L,lngLat:z,originalEvent:M},R)),this._defaultPrevented=!1,this.target=E}c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Ul=(function(c){function d(m,E,M){var R=m==="touchend"?M.changedTouches:M.touches,L=f.touchPos(E.getCanvasContainer(),R),z=L.map((function(Y){return E.unproject(Y)})),q=L.reduce((function(Y,te,oe,we){return Y.add(te.div(we.length))}),new o.Point(0,0)),ee=E.unproject(q);c.call(this,m,{points:L,point:q,lngLats:z,lngLat:ee,originalEvent:M}),this._defaultPrevented=!1}c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),Oh=(function(c){function d(m,E,M){c.call(this,m,{originalEvent:M}),this._defaultPrevented=!1}c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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),xi=function(c,d){this._map=c,this._clickTolerance=d.clickTolerance};xi.prototype.reset=function(){delete this._mousedownPos},xi.prototype.wheel=function(c){return this._firePreventable(new Oh(c.type,this._map,c))},xi.prototype.mousedown=function(c,d){return this._mousedownPos=d,this._firePreventable(new kn(c.type,this._map,c))},xi.prototype.mouseup=function(c){this._map.fire(new kn(c.type,this._map,c))},xi.prototype.click=function(c,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new kn(c.type,this._map,c))},xi.prototype.dblclick=function(c){return this._firePreventable(new kn(c.type,this._map,c))},xi.prototype.mouseover=function(c){this._map.fire(new kn(c.type,this._map,c))},xi.prototype.mouseout=function(c){this._map.fire(new kn(c.type,this._map,c))},xi.prototype.touchstart=function(c){return this._firePreventable(new Ul(c.type,this._map,c))},xi.prototype.touchmove=function(c){this._map.fire(new Ul(c.type,this._map,c))},xi.prototype.touchend=function(c){this._map.fire(new Ul(c.type,this._map,c))},xi.prototype.touchcancel=function(c){this._map.fire(new Ul(c.type,this._map,c))},xi.prototype._firePreventable=function(c){if(this._map.fire(c),c.defaultPrevented)return{}},xi.prototype.isEnabled=function(){return!0},xi.prototype.isActive=function(){return!1},xi.prototype.enable=function(){},xi.prototype.disable=function(){};var or=function(c){this._map=c};or.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},or.prototype.mousemove=function(c){this._map.fire(new kn(c.type,this._map,c))},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(c){this._delayContextMenu?this._contextMenuEvent=c:this._map.fire(new kn(c.type,this._map,c)),this._map.listens("contextmenu")&&c.preventDefault()},or.prototype.isEnabled=function(){return!0},or.prototype.isActive=function(){return!1},or.prototype.enable=function(){},or.prototype.disable=function(){};var Is=function(c,d){this._map=c,this._el=c.getCanvasContainer(),this._container=c.getContainer(),this._clickTolerance=d.clickTolerance||1};function mu(c,d){for(var h={},m=0;m<c.length;m++)h[c[m].identifier]=d[m];return h}Is.prototype.isEnabled=function(){return!!this._enabled},Is.prototype.isActive=function(){return!!this._active},Is.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Is.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)}
vendor: 8,216 bytes, line 2593
2593,Is.prototype.mousedown=function(c,d){this.isEnabled()&&c.shiftKey&&c.button===0&&(f.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)},Is.prototype.mousemoveWindow=function(c,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",c));var E=Math.min(m.x,h.x),M=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("+E+"px,"+R+"px)"),this._box.style.width=M-E+"px",this._box.style.height=L-R+"px"}}},Is.prototype.mouseupWindow=function(c,d){var h=this;if(this._active&&c.button===0){var m=this._startPos,E=d;if(this.reset(),f.suppressClick(),m.x!==E.x||m.y!==E.y)return this._map.fire(new o.Event("boxzoomend",{originalEvent:c})),{cameraAnimation:function(M){return M.fitScreenCoordinates(m,E,h._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",c)}},Is.prototype.keydown=function(c){this._active&&c.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",c))},Is.prototype.blur=function(){this.reset()},Is.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},Is.prototype._fireEvent=function(c,d){return this._map.fire(new o.Event(c,{originalEvent:d}))};var js=function(c){this.reset(),this.numTouches=c.numTouches};js.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},js.prototype.touchstart=function(c,d,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=c.timeStamp),h.length===this.numTouches&&(this.centroid=(function(m){for(var E=new o.Point(0,0),M=0,R=m;M<R.length;M+=1)E._add(R[M]);return E.div(m.length)})(d),this.touches=mu(h,d)))},js.prototype.touchmove=function(c,d,h){if(!this.aborted&&this.centroid){var m=mu(h,d);for(var E in this.touches){var M=m[E];(!M||M.dist(this.touches[E])>30)&&(this.aborted=!0)}}},js.prototype.touchend=function(c,d,h){if((!this.centroid||c.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(c){this.singleTap=new js(c),this.numTaps=c.numTaps,this.reset()};ro.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},ro.prototype.touchstart=function(c,d,h){this.singleTap.touchstart(c,d,h)},ro.prototype.touchmove=function(c,d,h){this.singleTap.touchmove(c,d,h)},ro.prototype.touchend=function(c,d,h){var m=this.singleTap.touchend(c,d,h);if(m){var E=c.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(m)<30;if(E&&M||this.reset(),this.count++,this.lastTime=c.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(c,d,h){this._zoomIn.touchstart(c,d,h),this._zoomOut.touchstart(c,d,h)},_s.prototype.touchmove=function(c,d,h){this._zoomIn.touchmove(c,d,h),this._zoomOut.touchmove(c,d,h)},_s.prototype.touchend=function(c,d,h){var m=this,E=this._zoomIn.touchend(c,d,h),M=this._zoomOut.touchend(c,d,h);return E?(this._active=!0,c.preventDefault(),setTimeout((function(){return m.reset()}),0),{cameraAnimation:function(R){return R.easeTo({duration:300,zoom:R.getZoom()+1,around:R.unproject(E)},{originalEvent:c})}}):M?(this._active=!0,c.preventDefault(),setTimeout((function(){return m.reset()}),0),{cameraAnimation:function(R){return R.easeTo({duration:300,zoom:R.getZoom()-1,around:R.unproject(M)},{originalEvent:c})}}):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 _f={0:1,2:2},Zt=function(c){this.reset(),this._clickTolerance=c.clickTolerance||1};Zt.prototype.blur=function(){this.reset()},Zt.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Zt.prototype._correctButton=function(c,d){return!1},Zt.prototype._move=function(c,d){return{}},Zt.prototype.mousedown=function(c,d){if(!this._lastPoint){var h=f.mouseButton(c);this._correctButton(c,h)&&(this._lastPoint=d,this._eventButton=h)}},Zt.prototype.mousemoveWindow=function(c,d){var h=this._lastPoint;if(h){if(c.preventDefault(),(function(m,E){var M=_f[E];return m.buttons===void 0||(m.buttons&M)!==M})(c,this._eventButton))this.reset();else if(this._moved||!(d.dist(h)<this._clickTolerance))return this._moved=!0,this._lastPoint=d,this._move(h,d)}},Zt.prototype.mouseupWindow=function(c){this._lastPoint&&f.mouseButton(c)===this._eventButton&&(this._moved&&f.suppressClick(),this.reset())},Zt.prototype.enable=function(){this._enabled=!0},Zt.prototype.disable=function(){this._enabled=!1,this.reset()},Zt.prototype.isEnabled=function(){return this._enabled},Zt.prototype.isActive=function(){return this._active};var yf=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.mousedown=function(h,m){c.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})(Zt),_u=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype._correctButton=function(h,m){return m===0&&h.ctrlKey||m===2},d.prototype._move=function(h,m){var E=.8*(m.x-h.x);if(E)return this._active=!0,{bearingDelta:E}},d.prototype.contextmenu=function(h){h.preventDefault()},d})(Zt),vf=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype._correctButton=function(h,m){return m===0&&h.ctrlKey||m===2},d.prototype._move=function(h,m){var E=-.5*(m.y-h.y);if(E)return this._active=!0,{pitchDelta:E}},d.prototype.contextmenu=function(h){h.preventDefault()},d})(Zt),no=function(c){this._minTouches=1,this._clickTolerance=c.clickTolerance||1,this.reset()};no.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new o.Point(0,0)},no.prototype.touchstart=function(c,d,h){return this._calculateTransform(c,d,h)},no.prototype.touchmove=function(c,d,h){if(this._active&&!(h.length<this._minTouches))return c.preventDefault(),this._calculateTransform(c,d,h)},no.prototype.touchend=function(c,d,h){this._calculateTransform(c,d,h),this._active&&h.length<this._minTouches&&this.reset()},no.prototype.touchcancel=function(){this.reset()},no.prototype._calculateTransform=function(c,d,h){h.length>0&&(this._active=!0);var m=mu(h,d),E=new o.Point(0,0),M=new o.Point(0,0),R=0;for(var L in m){var z=m[L],q=this._touches[L];q&&(E._add(z),M._add(z.sub(q)),R++,m[L]=z)}if(this._touches=m,!(R<this._minTouches)&&M.mag()){var ee=M.div(R);if(this._sum._add(ee),!(this._sum.mag()<this._clickTolerance))return{around:E.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 Bs=function(){this.reset()};function yu(c,d,h){for(var m=0;m<c.length;m++)if(c[m].identifier===h)return d[m]}function vu(c,d){return Math.log(c/d)/Math.LN2}Bs.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Bs.prototype._start=function(c){},Bs.prototype._move=function(c,d,h){return{}},Bs.prototype.touchstart=function(c,d,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([d[0],d[1]])
2593)},Bs.prototype.touchmove=function(c,d,h){if(this._firstTwoTouches){c.preventDefault();var m=this._firstTwoTouches,E=m[1],M=yu(h,d,m[0]),R=yu(h,d,E);if(M&&R){var L=this._aroundCenter?null:M.add(R).div(2);return this._move([M,R],L,c)}}},Bs.prototype.touchend=function(c,d,h){if(this._firstTwoTouches){var m=this._firstTwoTouches,E=m[1],M=yu(h,d,m[0]),R=yu(h,d,E);M&&R||(this._active&&f.suppressClick(),this.reset())}},Bs.prototype.touchcancel=function(){this.reset()},Bs.prototype.enable=function(c){this._enabled=!0,this._aroundCenter=!!c&&c.around==="center"},Bs.prototype.disable=function(){this._enabled=!1,this.reset()},Bs.prototype.isEnabled=function(){return this._enabled},Bs.prototype.isActive=function(){return this._active};var Ps=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.reset=function(){c.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 E=this._distance;if(this._distance=h[0].dist(h[1]),this._active||!(Math.abs(vu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:vu(this._distance,E),pinchAround:m}},d})(Bs);function ea(c,d){return 180*c.angleWith(d)/Math.PI}var bf=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.reset=function(){c.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 E=this._vector;if(this._vector=h[0].sub(h[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ea(this._vector,E),pinchAround:m}},d.prototype._isBelowThreshold=function(h){this._minDiameter=Math.min(this._minDiameter,h.mag());var m=25/(Math.PI*this._minDiameter)*360,E=ea(h,this._startVector);return Math.abs(E)<m},d})(Bs);function zl(c){return Math.abs(c.y)>Math.abs(c.x)}var wi=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d.prototype.reset=function(){c.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},d.prototype._start=function(h){this._lastPoints=h,zl(h[0].sub(h[1]))&&(this._valid=!1)},d.prototype._move=function(h,m,E){var M=h[0].sub(this._lastPoints[0]),R=h[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(M,R,E.timeStamp),this._valid)return this._lastPoints=h,this._active=!0,{pitchDelta:(M.y+R.y)/2*-.5}},d.prototype.gestureBeginsVertically=function(h,m,E){if(this._valid!==void 0)return this._valid;var M=h.mag()>=2,R=m.mag()>=2;if(M||R){if(!M||!R)return this._firstMove===void 0&&(this._firstMove=E),E-this._firstMove<100&&void 0;var L=h.y>0==m.y>0;return zl(h)&&zl(m)&&L}},d})(Bs),xf={panStep:100,bearingStep:15,pitchStep:10},wo=function(){var c=xf;this._panStep=c.panStep,this._bearingStep=c.bearingStep,this._pitchStep=c.pitchStep,this._rotationDisabled=!1};function is(c){return c*(2-c)}wo.prototype.blur=function(){this.reset()},wo.prototype.reset=function(){this._active=!1},wo.prototype.keydown=function(c){var d=this;if(!(c.altKey||c.ctrlKey||c.metaKey)){var h=0,m=0,E=0,M=0,R=0;switch(c.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:c.shiftKey?m=-1:(c.preventDefault(),M=-1);break;case 39:c.shiftKey?m=1:(c.preventDefault(),M=1);break;case 38:c.shiftKey?E=1:(c.preventDefault(),R=-1);break;case 40:c.shiftKey?E=-1:(c.preventDefault(),R=1);break;default:return}return this._rotationDisabled&&(m=0,E=0),{cameraAnimation:function(L){var z=L.getZoom();L.easeTo({duration:300,easeId:"keyboardHandler",easing:is,zoom:h?Math.round(z)+h*(c.shiftKey?2:1):z,bearing:L.getBearing()+m*d._bearingStep,pitch:L.getPitch()+E*d._pitchStep,offset:[-M*d._panStep,-R*d._panStep],center:L.getCenter()},{originalEvent:c})}}}},wo.prototype.enable=function(){this._enabled=!0},wo.prototype.disable=function(){this._enabled=!1,this.reset()},wo.prototype.isEnabled=function(){return this._enabled},wo.prototype.isActive=function(){return this._active},wo.prototype.disableRotation=function(){this._rotationDisabled=!0},wo.prototype.enableRotation=function(){this._rotationDisabled=!1};var jr=function(c,d){this._map=c,this._el=c.getCanvasContainer(),this._handler=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,o.bindAll(["_onT
2593imeout"],this)};jr.prototype.setZoomRate=function(c){this._defaultZoomRate=c},jr.prototype.setWheelZoomRate=function(c){this._wheelZoomRate=c},jr.prototype.isEnabled=function(){return!!this._enabled},jr.prototype.isActive=function(){return!!this._active||this._finishTimeout!==void 0},jr.prototype.isZooming=function(){return!!this._zooming},jr.prototype.enable=function(c){this.isEnabled()||(this._enabled=!0,this._aroundCenter=c&&c.around==="center")},jr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},jr.prototype.wheel=function(c){if(this.isEnabled()){var d=c.deltaMode===o.window.WheelEvent.DOM_DELTA_LINE?40*c.deltaY:c.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,c)):this._type||(this._type=Math.abs(m*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),c.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=c,this._delta-=d,this._active||this._start(c)),c.preventDefault()}}
vendor: 13,161 bytes, line 2593
2593,jr.prototype._onTimeout=function(c){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(c)},jr.prototype._start=function(c){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,c);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())}},jr.prototype.renderFrame=function(){var c=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 E=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):d.scale;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(E*m))),this._type==="wheel"&&(this._startZoom=d.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var M,R=typeof this._targetZoom=="number"?this._targetZoom:d.zoom,L=this._startZoom,z=this._easing,q=!1;if(this._type==="wheel"&&L&&z){var ee=Math.min((o.browser.now()-this._lastWheelEventTime)/200,1),Y=z(ee);M=o.number(L,R,Y),ee<1?this._frameId||(this._frameId=!0):q=!0}else M=R,q=!0;return this._active=!0,q&&(this._active=!1,this._finishTimeout=setTimeout((function(){c._zooming=!1,c._handler._triggerRenderFrame(),delete c._targetZoom,delete c._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!q,zoomDelta:M-d.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},jr.prototype._smoothOutEasing=function(c){var d=o.ease;if(this._prevEase){var h=this._prevEase,m=(o.browser.now()-h.start)/h.duration,E=h.easing(m+.01)-h.easing(m),M=.27/Math.sqrt(E*E+1e-4)*.01,R=Math.sqrt(.0729-M*M);d=o.bezier(M,R,.25,1)}return this._prevEase={start:o.browser.now(),duration:c,easing:d},d},jr.prototype.blur=function(){this.reset()},jr.prototype.reset=function(){this._active=!1};var Oo=function(c,d){this._clickZoom=c,this._tapZoom=d};Oo.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},Oo.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},Oo.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},Oo.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(c,d){return c.preventDefault(),{cameraAnimation:function(h){h.easeTo({duration:300,zoom:h.getZoom()+(c.shiftKey?-1:1),around:h.unproject(d)},{originalEvent:c})}}},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 qi=function(){this._tap=new ro({numTouches:1,numTaps:1}),this.reset()};qi.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},qi.prototype.touchstart=function(c,d,h){this._swipePoint||(this._tapTime&&c.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?h.length>0&&(this._swipePoint=d[0],this._swipeTouch=h[0].identifier):this._tap.touchstart(c,d,h))},qi.prototype.touchmove=function(c,d,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;var m=d[0],E=m.y-this._swipePoint.y;return this._swipePoint=m,c.preventDefault(),this._active=!0,{zoomDelta:E/128}}}else this._tap.touchmove(c,d,h)},qi.prototype.touchend=function(c,d,h){this._tapTime?this._swipePoint&&h.length===0&&this.reset():this._tap.touchend(c,d,h)&&(this._tapTime=c.timeStamp)},qi.prototype.touchcancel=function(){this.reset()},qi.prototype.enable=function(){this._enabled=!0},qi.prototype.disable=function(){this._enabled=!1,this.reset()},qi.prototype.isEnabled=function(){return this._enabled},qi.prototype.isActive=function(){return this._active};var Ia=function(c,d,h){this._el=c,this._mousePan=d,this._touchPan=h};Ia.prototype.enable=function(c){this._inertiaOptions=c||{},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 ta=function(c,d,h){this._pitchWithRotate=c.pitchWithRotate,this._mouseRotate=d,this._mousePitch=h};ta.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},ta.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},ta.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},ta.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var so=function(c,d,h,m){this._el=c,this._touchZoom=d,this._touchRotate=h,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0};so.prototype.enable=function(c){this._touchZoom.enable(c),this._rotationDisabled||this._touchRotate.enable(c),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(c){return c.zoom||c.drag||c.pitch||c.rotate},Bc=(function(c){function d(){c.apply(this,arguments)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.prototype)).constructor=d,d})(o.Event);function wr(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}var ur=function(c,d){this._map=c,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Nl(c),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,E=this._listeners;m<E.length;m+=1){var M=E[m],R=M[0];f.addEventListener(R,M[1],R===o.window.document?this.handleWindowEvent:this.handleEvent,M[2])}};ur.prototype.destroy=function(){for(var c=0,d=this._listeners;c<d.length;c+=1){var h=d[c],m=h[0];f.removeEventListener(m,h[1],m===o.window.document?this.handleWindowEvent:this.handleEvent,h[2])}},ur.prototype._addDefaultHandlers=function(c){var d=this._map,h=d.getCanvasContainer();this._add("mapEvent",new xi(d,c));var m=d.boxZoom=new Is(d,c);this._add("boxZoom",m);var E=new _s,M=new io;d.doubleClickZoom=new Oo(M,E),this._add("tapZoom",E),this._add("clickZoom",M);var R=new qi;this._add("tapDragZoom",R);var L=d.touchPitch=new wi;this._add("touchPitch",L);var z=new _u(c),q=new vf(c);d.dragRotate=new ta(c,z,q),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",q,["mouseRotate"]);var ee=new yf(c),Y=new no(c);d.dragPan=new Ia(h,ee,Y),this._add("mousePan",ee),this._add("touchPan",Y,["touchZoom","touchRotate"]);var te=new bf,oe=new Ps;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 jr(d,this);this._add("scrollZoom",we,["mousePan"]);var Oe=d.keyboard=new wo;this._add("keyboard",Oe),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 je=Re[ge];c.interactive&&c[je]&&d[je].enable(c[je])}},ur.prototype._add=function(c,d,h){this._handlers.push({handlerName:c,handler:d,allowed:h}),this._handlersById[c]=d},ur.prototype.stop=function(c){if(!this._updatingCamera){for(var d=0,h=this._handlers;d<h.length;d+=1)h[d].handler.reset();this._inertia.clear(),this._fireEvents({},{},c),this._changes=[]}},ur.prototype.isActive=function(){for(var c=0,d=this._handlers;c<d.length;c+=1)if(d[c].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(c,d,h){for(var m in c)if(m!==h&&(!d||d.indexOf(m)<0))return!0;return!1},ur.prototype.handleWindowEvent=function(c){this.handleEvent(c,c.type+"Window")},ur.prototype._getMapTouches=function(c){for(var d=[],h=0,m=c;h<m.length;h+=1){var E=m[h];this._el.contains(E.target)&&d.push(E)}return d},ur.prototype.handleEvent=function(c,d){this._updatingCamera=!0;for(var h=c.type==="renderFrame"?void 0:c,m={needsRenderFrame:!1},E={},M={},R=c.touches?this._getMapTouches(c.touches):void 0,L=R?f.touchPos(this._el,R):f.mousePos(this._el,c),z=0,q=this._handlers;z<q.length;z+=1){var ee=q[z],Y=ee.handlerName,te=ee.handler,oe=ee.allowed;if(te.isEnabled()){var we=void 0;this._blockedByActive(M,oe,Y)?te.reset():te[d||c.type]&&(we=te[d||c.type](c,L,R),this.mergeHandlerResult(m,E,we,Y,h),we&&we.needsRenderFrame&&this._triggerRenderFrame()),(we||te.isActive())&&(M[Y]=te)}}var Oe={};for(var ge in this._previousActiveHandlers)M[ge]||(Oe[ge]=h);this._previousActiveHandlers=M,(Object.keys(Oe).length||wr(m))&&(this._changes.push([m,E,Oe]),this._triggerRenderFrame()),(Object.keys(M).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(c,d,h,m,E){if(h){o.extend(c,h);var M={handlerName:m,originalEvent:h.originalEvent||E};h.zoomDelta!==void 0&&(d.zoom=M),h.panDelta!==void 0&&(d.drag=M),h.pitchDelta!==void 0&&(d.pitch=M),h.bearingDelta!==void 0&&(d.rotate=M)}},ur.prototype._applyChanges=function(){for(var c={},d={},h={},m=0,E=this._changes;m<E.length;m+=1){var M=E[m],R=M[0],L=M[1],z=M[2];R.panDelta&&(c.panDelta=(c.panDelta||new o.Point(0,0))._add(R.panDelta)),R.zoomDelta&&(c.zoomDelta=(c.zoomDelta||0)+R.zoomDelta),R.bearingDelta&&(c.bearingDelta=(c.bearingDelta||0)+R.bearingDelta),R.pitchDelta&&(c.pitchDelta=(c.pitchDelta||0)+R.pitchDelta),R.around!==void 0&&(c.around=R.around),R.pinchAround!==void 0&&(c.pinchAround=R.pinchAround),R.noInertia&&(c.noInertia=R.noInertia),o.extend(d,L),o.extend(h,z)}this._updateMapTransform(c,d,h),this._changes=[]},ur.prototype._updateMapTransform=function(c,d,h){var m=this._map,E=m.transform;if(!wr(c))return this._fireEvents(d,h,!0);var M=c.panDelta,R=c.zoomDelta,L=c.bearingDelta,z=c.pitchDelta,q=c.around,ee=c.pinchAround;ee!==void 0&&(q=ee),m._stop(!0),q=q||m.transform.centerPoint;var Y=E.pointLocation(M?q.sub(M):q);L&&(E.bearing+=L),z&&(E.pitch+=z),R&&(E.zoom+=R),E.setLocationAtPoint(Y,q),this._map._update(),c.noInertia||this._inertia.record(c),this._fireEvents(d,h,!0)},ur.prototype._fireEvents=function(c,d,h){var m=this,E=ss(this._eventsInProgress),M=ss(c),R={};for(var L in c)this._eventsInProgress[L]||(R[L+"start"]=c[L].originalEvent),this._eventsInProgress[L]=c[L];for(var z in!E&&M&&this._fireEvent("movestart",M.originalEvent),R)this._fireEvent(z,R[z]);for(var q in M&&this._fireEvent("move",M.originalEvent),c)this._fireEvent(q,c[q].originalEvent);var ee,Y={};for(var te in this._eventsInProgress){var oe=this._eventsInProgress[te],we=oe.handlerName,Oe=oe.originalEvent;this._handlersById[we].isActive()||(delete this._eventsInProgress[te],Y[te+"end"]=ee=d[we]||Oe)}for(var ge in Y)this._fireEvent(ge,Y[ge]);var Re=ss(this._eventsInProgress);if(h&&(E||M)&&!Re){this._updatingCamera=!0;var je=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),$e=function(nt){return nt!==0&&-m._bearingSnap<nt&&nt<m._bearingSnap};
2593je?($e(je.bearing||this._map.getBearing())&&(je.bearing=0),this._map.easeTo(je,{originalEvent:ee})):(this._map.fire(new o.Event("moveend",{originalEvent:ee})),$e(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},ur.prototype._fireEvent=function(c,d){this._map.fire(new o.Event(c,d?{originalEvent:d}:{}))},ur.prototype._requestFrame=function(){var c=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(d){delete c._frameId,c.handleEvent(new Bc("renderFrame",{timeStamp:d})),c._applyChanges()}))},ur.prototype._triggerRenderFrame=function(){this._frameId===void 0&&(this._frameId=this._requestFrame())};var bu=(function(c){function d(h,m){c.call(this),this._moving=!1,this._zooming=!1,this.transform=h,this._bearingSnap=m.bearingSnap,o.bindAll(["_renderFrameCallback"],this)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,E){return h=o.Point.convert(h).mult(-1),this.panTo(this.transform.center,o.extend({offset:h},m),E)},d.prototype.panTo=function(h,m,E){return this.easeTo(o.extend({center:h},m),E)},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,E){return this.easeTo(o.extend({zoom:h},m),E)},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,E){return this.easeTo(o.extend({bearing:h},m),E)},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 E=m&&m.bearing||0;return this._cameraForBoxAndBearing(h.getNorthWest(),h.getSouthEast(),E,m)},d.prototype._cameraForBoxAndBearing=function(h,m,E,M){var R={top:0,bottom:0,right:0,left:0};if(typeof(M=o.extend({padding:R,offset:[0,0],maxZoom:this.transform.maxZoom},M)).padding=="number"){var L=M.padding;M.padding={top:L,bottom:L,right:L,left:L}}M.padding=o.extend(R,M.padding);var z=this.transform,q=z.padding,ee=z.project(o.LngLat.convert(h)),Y=z.project(o.LngLat.convert(m)),te=ee.rotate(-E*Math.PI/180),oe=Y.rotate(-E*Math.PI/180),we=new o.Point(Math.max(te.x,oe.x),Math.max(te.y,oe.y)),Oe=new o.Point(Math.min(te.x,oe.x),Math.min(te.y,oe.y)),ge=we.sub(Oe),Re=(z.width-(q.left+q.right+M.padding.left+M.padding.right))/ge.x,je=(z.height-(q.top+q.bottom+M.padding.top+M.padding.bottom))/ge.y;if(!(je<0||Re<0)){var $e=Math.min(z.scaleZoom(z.scale*Math.min(Re,je)),M.maxZoom),nt=typeof M.offset.x=="number"?new o.Point(M.offset.x,M.offset.y):o.Point.convert(M.offset),qe=new o.Point((M.padding.left-M.padding.right)/2,(M.padding.top-M.padding.bottom)/2).rotate(E*Math.PI/180),Qe=nt.add(qe).mult(z.scale/z.zoomScale($e));return{center:z.unproject(ee.add(Y).div(2).sub(Qe)),zoom:$e,bearing:E}}o.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},d.prototype.fitBounds=function(h,m,E){return this._fitInternal(this.cameraForBounds(h,m),m,E)},d.prototype.fitScreenCoordinates=function(h,m,E,M,R){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(o.Point.convert(h)),this.transform.pointLocation(o.Point.convert(m)),E,M),M,R)},d.prototype._fitInternal=function(h,m,E){return h?(delete(m=o.extend(h,m)).padding,m.linear?this.easeTo(m,E):this.flyTo(m,E)):this},d.prototype.jumpTo=function(h,m){this.stop();var E=this.transform,M=!1,R=!1,L=!1;return"zoom"in h&&E.zoom!==+h.zoom&&(M=!0,E.zoom=+h.zoom),h.center!==void 0&&(E.center=o.LngLat.convert(h.center)),"bearing"in h&&E.bearing!==+h.bearing&&(R=!0,E.bearing=+h.bearing),"pitch"in h&&E.pitch!==+h.pitch&&(L=!0,E.pitch=+h.pitch),h.padding==null||E.isPaddingEqual(h.padding)||(E.padding=h.padding),this.fire(new o.Event("movestart",m)).fire(new o.Event("move",m)),M&&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 E=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 M=this.transform,R=this.getZoom(),L=this.getBearing(),z=this.getPitch(),q=this.getPadding(),ee="zoom"in h?+h.zoom:R,Y="bearing"in h?this._normalizeBearing(h.bearing,L):L,te="pitch"in h?+h.pitch:z,oe="padding"in h?h.padding:M.padding,we=o.Point.convert(h.offset),Oe=M.centerPoint.add(we),ge=M.pointLocation(Oe),Re=o.LngLat.convert(h.center||ge);this._normalizeCenter(Re);
vendor: 12,283 bytes, line 2593
2593var je,$e,nt=M.project(ge),qe=M.project(Re).sub(nt),Qe=M.zoomScale(ee-R);h.around&&(je=o.LngLat.convert(h.around),$e=M.locationPoint(je));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!==Y,this._pitching=this._pitching||te!==z,this._padding=!M.isPaddingEqual(oe),this._easeId=h.easeId,this._prepareEase(m,h.noMoveStart,pt),this._ease((function(Dt){if(E._zooming&&(M.zoom=o.number(R,ee,Dt)),E._rotating&&(M.bearing=o.number(L,Y,Dt)),E._pitching&&(M.pitch=o.number(z,te,Dt)),E._padding&&(M.interpolatePadding(q,oe,Dt),Oe=M.centerPoint.add(we)),je)M.setLocationAtPoint(je,$e);else{var Tt=M.zoomScale(M.zoom-R),zt=ee>R?Math.min(2,Qe):Math.max(.5,Qe),sr=Math.pow(zt,1-Dt),Cr=M.unproject(nt.add(qe.mult(Dt*sr)).mult(Tt));M.setLocationAtPoint(M.renderWorldCopies?Cr.wrap():Cr,Oe)}E._fireMoveEvents(m)}),(function(Dt){E._afterEase(m,Dt)}),h),this},d.prototype._prepareEase=function(h,m,E){E===void 0&&(E={}),this._moving=!0,m||E.moving||this.fire(new o.Event("movestart",h)),this._zooming&&!E.zooming&&this.fire(new o.Event("zoomstart",h)),this._rotating&&!E.rotating&&this.fire(new o.Event("rotatestart",h)),this._pitching&&!E.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 E=this._zooming,M=this._rotating,R=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,E&&this.fire(new o.Event("zoomend",h)),M&&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 E=this;if(!h.essential&&o.browser.prefersReducedMotion){var M=o.pick(h,["center","zoom","bearing","pitch","around"]);return this.jumpTo(M,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(),q=this.getPitch(),ee=this.getPadding(),Y="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:q,we="padding"in h?h.padding:R.padding,Oe=R.zoomScale(Y-L),ge=o.Point.convert(h.offset),Re=R.centerPoint.add(ge),je=R.pointLocation(Re),$e=o.LngLat.convert(h.center||je);this._normalizeCenter($e);var nt=R.project(je),qe=R.project($e).sub(nt),Qe=h.curve,pt=Math.max(R.width,R.height),Dt=pt/Oe,Tt=qe.mag();if("minZoom"in h){var zt=o.clamp(Math.min(h.minZoom,L,Y),R.minZoom,R.maxZoom),sr=pt/R.zoomScale(zt-L);Qe=Math.sqrt(sr/Tt*2)}var Cr=Qe*Qe;function Pr(kr){var Fr=(Dt*Dt-pt*pt+(kr?-1:1)*Cr*Cr*Tt*Tt)/(2*(kr?Dt:pt)*Cr*Tt);return Math.log(Math.sqrt(Fr*Fr+1)-Fr)}function xn(kr){return(Math.exp(kr)-Math.exp(-kr))/2}function ar(kr){return(Math.exp(kr)+Math.exp(-kr))/2}var Wr=Pr(0),rn=function(kr){return ar(Wr)/ar(Wr+Qe*kr)},Hr=function(kr){return pt*((ar(Wr)*(xn(Fr=Wr+Qe*kr)/ar(Fr))-xn(Wr))/Cr)/Tt;var Fr},Vr=(Pr(1)-Wr)/Qe;if(Math.abs(Tt)<1e-6||!isFinite(Vr)){if(Math.abs(pt-Dt)<1e-6)return this.easeTo(h,m);var Yr=Dt<pt?-1:1;Vr=Math.abs(Math.log(Dt/pt))/Qe,Hr=function(){return 0},rn=function(kr){return Math.exp(Yr*Qe*kr)}}return h.duration="duration"in h?+h.duration:1e3*Vr/("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!==q,this._padding=!R.isPaddingEqual(we),this._prepareEase(m,!1),this._ease((function(kr){var Fr=kr*Vr,Ki=1/rn(Fr);R.zoom=kr===1?Y:L+R.scaleZoom(Ki),E._rotating&&(R.bearing=o.number(z,te,kr)),E._pitching&&(R.pitch=o.number(q,oe,kr)),E._padding&&(R.interpolatePadding(ee,we,kr),Re=R.centerPoint.add(ge));var Ti=kr===1?$e:R.unproject(nt.add(qe.mult(Hr(Fr))).mult(Ki));R.setLocationAtPoint(R.renderWorldCopies?Ti.wrap():Ti,Re),E._fireMoveEvents(m)}),(function(){return E._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 E=this._onEaseEnd;delete this._onEaseEnd,E.call(this,m)}if(!h){var M=this.handlers;M&&M.stop(!1)}return this},d.prototype._ease=function(h,m,E){E.animate===!1||E.duration===0?(h(1),m()):(this._easeStart=o.browser.now(),this._easeOptions=E,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 E=Math.abs(h-m);return Math.abs(h-360-m)<E&&(h-=360),Math.abs(h+360-m)<E&&(h+=360),h},d.prototype._normalizeCenter=function(h){var m=this.transform;if(m.renderWorldCopies&&!m.lngRange){var E=h.lng-m.center.lng;h.lng+=E>180?-360:E<-180?360:0}},d})(o.Evented),fs=function(c){c===void 0&&(c={}),this.options=c,o.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};fs.prototype.getDefaultPosition=function(){return"bottom-right"},fs.prototype.onAdd=function(c){var d=this.options&&this.options.compact;return this._map=c,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(c,d){var h=this._map._getUIString("AttributionControl."+d);c.title=h,c.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 c=this._editLink;c||(c=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(c){var h=d.reduce((function(m,E,M){return E.value&&(m+=E.key+"="+E.value+(M<d.length-1?"&":"")),m}),"?");c.href=o.config.FEEDBACK_URL+"/"+h+(this._map._hash?this._map._hash.getHashString(!0):""),c.rel="noopener nofollow",this._setElementTitle(c,"MapFeedback")}},fs.prototype._updateData=function(c){!c||c.sourceDataType!=="metadata"&&c.sourceDataType!=="visibility"&&c.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())},fs.prototype._updateAttributions=function(){if(this._map.style){var c=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?c=c.concat(this.options.customAttribution.map((function(L){return typeof L!="string"?"":L}))):typeof this.options.customAttribution=="string"&&c.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 E=h[m];if(E.used){var M=E.getSource();M.attribution&&c.indexOf(M.attribution)<0&&c.push(M.attribution)}}c.sort((function(L,z){return L.length-z.length}));var R=(c=c.filter((function(L,z){for(var q=z+1;q<c.length;q++)if(c[q].indexOf(L)>=0)return!1;return!0}))).join(" | ");R!==this._attribHTML&&(this._attribHTML=R,c.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 Ji=function(){o.bindAll(["_updateLogo"],this),o.bindAll(["_updateCompact"],this)};Ji.prototype.onAdd=function(c){this._map=c,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},Ji.prototype.onRemove=function(){f.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Ji.prototype.getDefaultPosition=function(){return"bottom-left"},Ji.prototype._updateLogo=function(c){c&&c.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")},Ji.prototype._logoRequired=function(){if(this._map.style){var c=this._map.style.sourceCaches;for(var d in c)if(c[d].getSource().mapbox_logo)return!0;return!1}},Ji.prototype._updateCompact=function(){var c=this._container.children;if(c.length){var d=c[0];this._map.getCanvasContainer().offsetWidth<250?d.classList.add("mapboxgl-compact"):d.classList.remove("mapboxgl-compact")}};var qn=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};qn.prototype.add=function(c){var d=++this._id;return this._queue.push({callback:c,id:d,cancelled:!1}),d},qn.prototype.remove=function(c){for(var d=this._currentlyRunning,h=0,m=d?this._queue.concat(d):this._queue;h<m.length;h+=1){var E=m[h];if(E.id===c)return void(E.cancelled=!0)}},qn.prototype.run=function(c){c===void 0&&(c=0);var d=this._currentlyRunning=this._queue;this._queue=[];for(var h=0,m=d;h<m.length;h+=1){var E=m[h];if(!E.cancelled&&(E.callback(c),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},qn.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,Jr=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
2593acheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},xu=(function(c){function d(m){var E=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 M=new fn(m.minZoom,m.maxZoom,m.minPitch,m.maxPitch,m.renderWorldCopies);if(c.call(this,M,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 qn,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 E._update(!1)})),this.on("moveend",(function(){return E._update(!1)})),this.on("zoom",(function(){return E._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 Gs(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 Ji,m.logoPosition),this.on("style.load",(function(){E.transform.unmodified&&E.jumpTo(E.style.stylesheet)})),this.on("data",(function(R){E._update(R.dataType==="style"),E.fire(new o.Event(R.dataType+"data",R))})),this.on("dataloading",(function(R){E.fire(new o.Event(R.dataType+"dataloading",R))}))}c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,E){if(E===void 0&&(E=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 M=m.onAdd(this);this._controls.push(m);var R=this._controlPositions[E];return E.indexOf("bottom")!==-1?R.insertBefore(M,R.firstChild):R.appendChild(M),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 E=this._controls.indexOf(m);return E>-1&&this._controls.splice(E,1),m.onRemove(this),this}
2593,d.prototype.hasControl=function(m){return this._controls.indexOf(m)>-1},d.prototype.resize=function(m){var E=this._containerDimensions(),M=E[0],R=E[1];if(M===this.transform.width&&R===this.transform.height)return this;this._resizeCanvas(M,R),this.transform.resize(M,R),this.painter.resize(M,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,E,M){var R,L=this;if(m==="mouseenter"||m==="mouseover"){var z=!1;return{layer:E,listener:M,delegates:{mousemove:function(ee){var Y=L.getLayer(E)?L.queryRenderedFeatures(ee.point,{layers:[E]}):[];Y.length?z||(z=!0,M.call(L,new kn(m,L,ee.originalEvent,{features:Y}))):z=!1},mouseout:function(){z=!1}}}}if(m==="mouseleave"||m==="mouseout"){var q=!1;return{layer:E,listener:M,delegates:{mousemove:function(ee){(L.getLayer(E)?L.queryRenderedFeatures(ee.point,{layers:[E]}):[]).length?q=!0:q&&(q=!1,M.call(L,new kn(m,L,ee.originalEvent)))},mouseout:function(ee){q&&(q=!1,M.call(L,new kn(m,L,ee.originalEvent)))}}}}return{layer:E,listener:M,delegates:(R={},R[m]=function(ee){var Y=L.getLayer(E)?L.queryRenderedFeatures(ee.point,{layers:[E]}):[];Y.length&&(ee.features=Y,M.call(L,ee),delete ee.features)},R)}},d.prototype.on=function(m,E,M){if(M===void 0)return c.prototype.on.call(this,m,E);var R=this._createDelegatedListener(m,E,M);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,E,M){if(M===void 0)return c.prototype.once.call(this,m,E);var R=this._createDelegatedListener(m,E,M);for(var L in R.delegates)this.once(L,R.delegates[L]);return this},d.prototype.off=function(m,E,M){var R=this;return M===void 0?c.prototype.off.call(this,m,E):(this._delegatedListeners&&this._delegatedListeners[m]&&(function(L){for(var z=L[m],q=0;q<z.length;q++){var ee=z[q];if(ee.layer===E&&ee.listener===M){for(var Y in ee.delegates)R.off(Y,ee.delegates[Y]);return z.splice(q,1),R}}})(this._delegatedListeners),this)},d.prototype.queryRenderedFeatures=function(m,E){if(!this.style)return[];var M;if(E!==void 0||m===void 0||m instanceof o.Point||Array.isArray(m)||(E=m,m=void 0),E=E||{},(m=m||[[0,0],[this.transform.width,this.transform.height]])instanceof o.Point||typeof m[0]=="number")M=[o.Point.convert(m)];else{var R=o.Point.convert(m[0]),L=o.Point.convert(m[1]);M=[R,new o.Point(L.x,R.y),L,new o.Point(R.x,L.y),R]}return this.style.queryRenderedFeatures(M,E,this.transform)},d.prototype.querySourceFeatures=function(m,E){return this.style.querySourceFeatures(m,E)},d.prototype.setStyle=function(m,E){return(E=o.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},E)).diff!==!1&&E.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&m?(this._diffStyle(m,E),this):(this._localIdeographFontFamily=E.localIdeographFontFamily,this._updateStyle(m,E))},d.prototype._getUIString=function(m){var E=this._locale[m];
2593if(E==null)throw new Error("Missing UI string '"+m+"'");return E},d.prototype._updateStyle=function(m,E){return this.style&&(this.style.setEventedParent(null),this.style._remove()),m?(this.style=new Vn(this,E||{}),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 Vn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},d.prototype._diffStyle=function(m,E){var M=this;if(typeof m=="string"){var R=this._requestManager.normalizeStyleURL(m),L=this._requestManager.transformRequest(R,o.ResourceType.Style);o.getJSON(L,(function(z,q){z?M.fire(new o.ErrorEvent(z)):q&&M._updateDiff(q,E)}))}else typeof m=="object"&&this._updateDiff(m,E)},d.prototype._updateDiff=function(m,E){try{this.style.setState(m)&&this._update(!0)}catch(M){o.warnOnce("Unable to perform style diff: "+(M.message||M.error||M)+". Rebuilding the style from scratch."),this._updateStyle(m,E)}},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,E){return this._lazyInitEmptyStyle(),this.style.addSource(m,E),this._update(!0)},d.prototype.isSourceLoaded=function(m){var E=this.style&&this.style.sourceCaches[m];if(E!==void 0)return E.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 E in m){var M=m[E]._tiles;for(var R in M){var L=M[R];if(L.state!=="loaded"&&L.state!=="errored")return!1}}return!0},d.prototype.addSourceType=function(m,E,M){return this._lazyInitEmptyStyle(),this.style.addSourceType(m,E,M)},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,E,M){M===void 0&&(M={});var R=M.pixelRatio;R===void 0&&(R=1);var L=M.sdf;L===void 0&&(L=!1);var z=M.stretchX,q=M.stretchY,ee=M.content;if(this._lazyInitEmptyStyle(),E instanceof oo||Jr&&E instanceof Jr){var Y=o.browser.getImageData(E);this.style.addImage(m,{data:new o.RGBAImage({width:Y.width,height:Y.height},Y.data),pixelRatio:R,stretchX:z,stretchY:q,content:ee,sdf:L,version:0})}else{if(E.width===void 0||E.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=E;this.style.addImage(m,{data:new o.RGBAImage({width:E.width,height:E.height},new Uint8Array(E.data)),pixelRatio:R,stretchX:z,stretchY:q,content:ee,sdf:L,version:0,userImage:te}),te.onAdd&&te.onAdd(this,m)}},d.prototype.updateImage=function(m,E){var M=this.style.getImage(m);if(!M)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=E instanceof oo||Jr&&E instanceof Jr?o.browser.getImageData(E):E,L=R.width,z=R.height,q=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!==M.data.width||z!==M.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"))):(M.data.replace(q,!(E instanceof oo||Jr&&E instanceof Jr)),void this.style.updateImage(m,M))},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,E){o.getImage(this._requestManager.transformRequest(m,o.ResourceType.Image),E)},d.prototype.listImages=function(){return this.style.listImages()},d.prototype.addLayer=function(m,E){return this._lazyInitEmptyStyle(),this.style.addLayer(m,E),this._update(!0)},d.prototype.moveLayer=function(m,E){return this.style.moveLayer(m,E),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,E,M){return this.style.setLayerZoomRange(m,E,M),this._update(!0)},d.prototype.setFilter=function(m,E,M){return M===void 0&&(M={}),this.style.setFilter(m,E,M),this._update(!0)},d.prototype.getFilter=function(m){return this.style.getFilter(m)},d.prototype.setPaintProperty=function(m,E,M,R){return R===void 0&&(R={}),this.style.setPaintProperty(m,E,M,R),this._update(!0)},d.prototype.getPaintProperty=function(m,E){return this.style.getPaintProperty(m,E)},d.prototype.setLayoutProperty=function(m,E,M,R){return R===void 0&&(R={}),this.style.setLayoutProperty(m,E,M,R),this._update(!0)},d.prototype.getLayoutProperty=function(m,E){return this.style.getLayoutProperty(m,E)},d.prototype.setLight=function(m,E){return E===void 0&&(E={}),this._lazyInitEmptyStyle(),this.style.setLight(m,E),this._update(!0)},d.prototype.getLight=function(){return this.style.getLight()},d.prototype.setFeatureState=function(m,E){return this.style.setFeatureState(m,E),this._update()},d.prototype.removeFeatureState=function(m,E){return this.style.removeFeatureState(m,E),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,E=0;return this._container&&(m=this._container.clientWidth||400,E=this._container.clientHeight||300),[m,E]},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
2593in 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 E=this._canvasContainer=f.create("div","mapboxgl-canvas-container",m);this._interactive&&E.classList.add("mapboxgl-interactive"),this._canvas=f.create("canvas","mapboxgl-canvas",E),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 M=this._containerDimensions();this._resizeCanvas(M[0],M[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,E){var M=o.browser.devicePixelRatio||1;this._canvas.width=M*m,this._canvas.height=M*E,this._canvas.style.width=m+"px",this._canvas.style.height=E+"px"},d.prototype._setupPainter=function(){var m=o.extend({},l.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),E=this._canvas.getContext("webgl",m)||this._canvas.getContext("experimental-webgl",m);E?(this.painter=new Xn(E,this.transform),o.webpSupported.testSupport(E)):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 E,M=this,R=0,L=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(E=L.createQueryEXT(),L.beginQueryEXT(L.TIME_ELAPSED_EXT,E),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 q=this.transform.zoom,ee=o.browser.now();this.style.zoomHistory.update(q,ee);var Y=new o.EvaluationParameters(q,{now:ee,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),te=Y.crossFadingFactor();te===1&&te===this._crossFadingFactor||(z=!0,this._crossFadingFactor=te),this.style.update(Y)}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,E),setTimeout((function(){var ge=L.getQueryObjectEXT(E,L.QUERY_RESULT_EXT)/1e6;L.deleteQueryEXT(E),M.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=M.painter.queryGpuTimers(we);M.fire(new o.Event("gpu-timing-layer",{layerTimes:ge}))}),50)}var Oe=this._sourcesDirty||this._styleDirty||this._placementDirty;return Oe||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.Event("idle")),!this._loaded||this._fullyLoaded||Oe||(this._fullyLoaded=!0),this}},d.prototype.remove=function(){this._hash&&this._hash.remove();for(var m=0,E=this._controls;m<E.length;m+=1)E[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 M=this.painter.context.gl.getExtension("WEBGL_lose_context");M&&M.loseContext(),Hs(this._canvasContainer),Hs(this._controlContainer),Hs(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(E){m._frame=null,m._render(E)})))},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,951 bytes, line 2593
2593,h.vertices.set=function(m){this._vertices=m,this._update()},d.prototype._setCacheLimits=function(m,E){o.setCacheLimits(m,E)},h.version.get=function(){return o.version},Object.defineProperties(d.prototype,h),d})(bu);function Hs(c){c.parentNode&&c.parentNode.removeChild(c)}var wf={showCompass:!0,showZoom:!0,visualizePitch:!1},di=function(c){var d=this;this.options=o.extend({},wf,c),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 c=this._map.getZoom(),d=c===this._map.getMaxZoom(),h=c===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 c=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=c},di.prototype.onAdd=function(c){return this._map=c,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new 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(c,d){var h=f.create("button",c,this._container);return h.type="button",h.addEventListener("click",d),h},di.prototype._setButtonTitle=function(c,d){var h=this._map._getUIString("NavigationControl."+d);c.title=h,c.setAttribute("aria-label",h)};var os=function(c,d,h){h===void 0&&(h=!1),this._clickTolerance=10,this.element=d,this.mouseRotate=new _u({clickTolerance:c.dragRotate._mouseRotate._clickTolerance}),this.map=c,h&&(this.mousePitch=new vf({clickTolerance:c.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(c,d,h){if(c=new o.LngLat(c.lng,c.lat),d){var m=new o.LngLat(c.lng-360,c.lat),E=new o.LngLat(c.lng+360,c.lat),M=h.locationPoint(c).distSqr(d);h.locationPoint(m).distSqr(d)<M?c=m:h.locationPoint(E).distSqr(d)<M&&(c=E)}for(;Math.abs(c.lng-h.center.lng)>180;){var R=h.locationPoint(c);if(R.x>=0&&R.y>=0&&R.x<=h.width&&R.y<=h.height)break;c.lng>h.center.lng?c.lng-=360:c.lng+=360}return c}os.prototype.down=function(c,d){this.mouseRotate.mousedown(c,d),this.mousePitch&&this.mousePitch.mousedown(c,d),f.disableDrag()},os.prototype.move=function(c,d){var h=this.map,m=this.mouseRotate.mousemoveWindow(c,d);if(m&&m.bearingDelta&&h.setBearing(h.getBearing()+m.bearingDelta),this.mousePitch){var E=this.mousePitch.mousemoveWindow(c,d);E&&E.pitchDelta&&h.setPitch(h.getPitch()+E.pitchDelta)}},os.prototype.off=function(){var c=this.element;f.removeEventListener(c,"mousedown",this.mousedown),f.removeEventListener(c,"touchstart",this.touchstart,{passive:!1}),f.removeEventListener(c,"touchmove",this.touchmove),f.removeEventListener(c,"touchend",this.touchend),f.removeEventListener(c,"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(c){this.down(o.extend({},c,{ctrlKey:!0,preventDefault:function(){return c.preventDefault()}}),f.mousePos(this.element,c)),f.addEventListener(o.window,"mousemove",this.mousemove),f.addEventListener(o.window,"mouseup",this.mouseup)},os.prototype.mousemove=function(c){this.move(c,f.mousePos(this.element,c))},os.prototype.mouseup=function(c){this.mouseRotate.mouseupWindow(c),this.mousePitch&&this.mousePitch.mouseupWindow(c),this.offTemp()},os.prototype.touchstart=function(c){c.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=f.touchPos(this.element,c.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return c.preventDefault()}},this._startPos))},os.prototype.touchmove=function(c){c.targetTouches.length!==1?this.reset():(this._lastPos=f.touchPos(this.element,c.targetTouches)[0],this.move({preventDefault:function(){return c.preventDefault()}},this._lastPos))},os.prototype.touchend=function(c){c.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 Xt(c,d,h){var m=c.classList;for(var E in Eo)m.remove("mapboxgl-"+h+"-anchor-"+E);m.add("mapboxgl-"+h+"-anchor-"+d)}var rr,Vl=(function(c){function d(h,m){if(c.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 E=f.createNS("http://www.w3.org/2000/svg","svg");E.setAttributeNS(null,"display","block"),E.setAttributeNS(null,"height","41px"),E.setAttributeNS(null,"width","27px"),E.setAttributeNS(null,"viewBox","0 0 27 41");var M=f.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"stroke","none"),M.setAttributeNS(null,"stroke-width","1"),M.setAttributeNS(null,"fill","none"),M.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,q=[{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<q.length;z+=1){var ee=q[z],Y=f.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",ee.rx),Y.setAttributeNS(null,"ry",ee.ry),L.appendChild(Y)}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 Oe=f.createNS("http://www.w3.org/2000/svg","path");Oe.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(Oe);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 je=f.createNS("http://www.w3.org/2000/svg","circle");je.setAttributeNS(null,"fill","#000000"),je.setAttributeNS(null,"opacity","0.25"),je.setAttributeNS(null,"cx","5.5"),je.setAttributeNS(null,"cy","5.5"),je.setAttributeNS(null,"r","5.4999962");var $e=f.createNS("http://www.w3.org/2000/svg","circle");$e.setAttributeNS(null,"fill","#FFFFFF"),$e.setAttributeNS(null,"cx","5.5"),$e.setAttributeNS(null,"cy","5.5"),$e.setAttributeNS(null,"r","5.4999962"),Re.appendChild(je),Re.appendChild($e),R.appendChild(L),R.appendChild(te),R.appendChild(we),R.appendChild(ge),R.appendChild(Re),E.appendChild(R),E.setAttributeNS(null,"height",41*this._scale+"px"),E.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(E),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()})),Xt(this._element,this._anchor,"marker"),this._popup=null}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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:[
25930,-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,E=h.charCode||h.keyCode;m!=="Space"&&m!=="Enter"&&E!==32&&E!==13||this.togglePopup()},d.prototype._onMapClick=function(h){var m=h.originalEvent.target,E=this._element;this._popup&&(m===E||E.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 E="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?E="rotateX(0deg)":this._pitchAlignment==="map"&&(E="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) "+E+" "+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),Pc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ra=0,Do=!1,na=(function(c){function d(h){c.call(this),this.options=o.extend({},Pc,h),o.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,rr!==void 0?m(rr):o.window.navigator.permissions!==void 0?o.window.navigator.permissions.query({name:"geolocation"}).then((function(E){m(rr=E.state!=="denied")})):m(rr=!!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,ra=0,Do=!1},d.prototype._isOutOfMapMaxBounds=function(h){var m=this._map.getMaxBounds(),E=h.coords;return m&&(E.longitude<m.getWest()||E.longitude>m.getEast()||E.latitude<m.getSouth()||E.latitude>m.getNorth())},d.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
2593RROR",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),E=h.coords.accuracy,M=this._map.getBearing(),R=o.extend({bearing:M},this.options.fitBoundsOptions);this._map.fitBounds(m.toBounds(E),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]),E=this._map.unproject([1,h]),M=m.distanceTo(E),R=Math.ceil(2*this._accuracy/M);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&&Do)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 E=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=E,this._geolocateButton.setAttribute("aria-label",E)}else{var M=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=M,this._geolocateButton.setAttribute("aria-label",M)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2593se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=f.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Vl(this._dotElement),this._circleElement=f.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Vl({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":ra--,Do=!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"),++ra>1?(h={maximumAge:6e5,timeout:0},Do=!0):(h=this.options.positionOptions,Do=!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),ia={maxWidth:100,unit:"metric"},ys=function(c){this.options=o.extend({},ia,c),o.bindAll(["_onMove","setUnit"],this)};function y(c,d,h){var m=h&&h.maxWidth||100,E=c._container.clientHeight/2,M=c.unproject([0,E]),R=c.unproject([m,E]),L=M.distanceTo(R);if(h&&h.unit==="imperial"){var z=3.2808*L;z>5280?_(d,m,z/5280,c._getUIString("ScaleControl.Miles")):_(d,m,z,c._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?_(d,m,L/1852,c._getUIString("ScaleControl.NauticalMiles")):L>=1e3?_(d,m,L/1e3,c._getUIString("ScaleControl.Kilometers")):_(d,m,L,c._getUIString("ScaleControl.Meters"))}function _(c,d,h,m){var E,M,R,L=(E=h,(M=Math.pow(10,(""+Math.floor(E)).length-1))*(R=(R=E/M)>=10?10:R>=5?5:R>=3?3:R>=2?2:R>=1?1:(function(z){var q=Math.pow(10,Math.ceil(-Math.log(z)/Math.LN10));return Math.round(z*q)/q})(R)));c.style.width=d*(L/h)+"px",c.innerHTML=L+" "+m}ys.prototype.getDefaultPosition=function(){return"bottom-left"},ys.prototype._onMove=function(){y(this._map,this._container,this.options)},ys.prototype.onAdd=function(c){return this._map=c,this._container=f.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",c.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(c){this.options.unit=c,y(this._map,this._container,this.options)};var b=function(c){this._fullscreen=!1,c&&c.container&&(c.container instanceof o.window.HTMLElement?this._container=c.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(c){return this._map=c,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 c=this._fullscreenButton=f.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);f.create("span","mapboxgl-ctrl-icon",c).setAttribute("aria-hidden",!0),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),o.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},b.prototype._updateTitle=function(){var c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.title=c},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 w={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"}
vendor: 8,034 bytes, line 2593
2593,S=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),P=(function(c){function d(h){c.call(this),this.options=o.extend(Object.create(w),h),o.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return c&&(d.__proto__=c),(d.prototype=Object.create(c&&c.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,E=o.window.document.createDocumentFragment(),M=o.window.document.createElement("body");for(M.innerHTML=h;m=M.firstChild;)E.appendChild(m);return this.setDOMContent(E)},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="×",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(Y){return m._container.classList.add(Y)})),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 E=this._pos=this._trackPointer&&h?h:this._map.project(this._lngLat),M=this.options.anchor,R=(function Y(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 Y(new o.Point(0,0))})(this.options.offset);if(!M){var L,z=this._container.offsetWidth,q=this._container.offsetHeight;L=E.y+R.bottom.y<q?["top"]:E.y>this._map.transform.height-q?["bottom"]:[],E.x<z/2?L.push("left"):E.x>this._map.transform.width-z/2&&L.push("right"),M=L.length===0?"bottom":L.join("-")}var ee=E.add(R[M]).round();f.setTransform(this._container,Eo[M]+" translate("+ee.x+"px,"+ee.y+"px)"),Xt(this._container,M,"popup")}},d.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var h=this._container.querySelector(S);h&&h.focus()}},d.prototype._onClose=function(){this.remove()},d})(o.Evented),D={version:o.version,supported:l,setRTLTextPlugin:o.setRTLTextPlugin,getRTLTextPluginStatus:o.getRTLTextPluginStatus,Map:xu,NavigationControl:di,GeolocateControl:na,AttributionControl:fs,ScaleControl:ys,FullscreenControl:b,Popup:P,Marker:Vl,Style:Vn,LngLat:o.LngLat,LngLatBounds:o.LngLatBounds,Point:o.Point,MercatorCoordinate:o.MercatorCoordinate,Evented:o.Evented,config:o.config,prewarm:function(){ht().acquire(Je)},clearPrewarmedResources:function(){var c=Mt;c&&(c.isPreloaded()&&c.numActive()===1?(c.release(Je),Mt=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(c){o.config.ACCESS_TOKEN=c},get baseApiUrl(){return o.config.API_URL},set baseApiUrl(c){o.config.API_URL=c},get workerCount(){return Ct.workerCount},set workerCount(c){Ct.workerCount=c},get maxParallelImageRequests(){return o.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(c){o.config.MAX_PARALLEL_IMAGE_REQUESTS=c},clearStorage:function(c){o.clearTileCache(c)},workerUrl:""};return D})),i}))})(xm)),xm.exports}var fte=ute();const fc=uh(fte);var hte=1e-7;function a2(r){return Array.isArray(r)||ArrayBuffer.isView(r)}function OF(r,e){if(r===e)return!0;
2593if(a2(r)&&a2(e)){if(r.length!==e.length)return!1;for(var t=0;t<r.length;++t)if(!OF(r[t],e[t]))return!1;return!0}return Math.abs(r-e)<=hte}function R0(r,e,t){return Math.max(e,Math.min(t,r))}function o_(r,e,t){return a2(r)?r.map(function(n,i){return o_(n,e[i],t)}):t*e+(1-t)*r}function dl(r,e){if(!r)throw new Error(e||"react-map-gl: assertion failed.")}function JS(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 KS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?JS(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):JS(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},qv={pitch:0,bearing:0,altitude:1.5},ZS=5,dte=1.2,np=(function(){function r(e){var t=e.width,n=e.height,i=e.latitude,s=e.longitude,o=e.zoom,l=e.bearing,f=l===void 0?qv.bearing:l,A=e.pitch,v=A===void 0?qv.pitch:A,T=e.altitude,I=T===void 0?qv.altitude:T,F=e.maxZoom,N=F===void 0?qf.maxZoom:F,U=e.minZoom,$=U===void 0?qf.minZoom:U,V=e.maxPitch,j=V===void 0?qf.maxPitch:V,X=e.minPitch,ue=X===void 0?qf.minPitch:X,K=e.transitionDuration,se=e.transitionEasing,Ee=e.transitionInterpolator,Ue=e.transitionInterruption,de=e.startPanLngLat,me=e.startZoomLngLat,pe=e.startRotatePos,W=e.startBearing,re=e.startPitch,Ce=e.startZoom;tf(this,r),dl(Number.isFinite(t),"`width` must be supplied"),dl(Number.isFinite(n),"`height` must be supplied"),dl(Number.isFinite(s),"`longitude` must be supplied"),dl(Number.isFinite(i),"`latitude` must be supplied"),dl(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:I,maxZoom:N,minZoom:$,maxPitch:j,minPitch:ue,transitionDuration:K,transitionEasing:se,transitionInterpolator:Ee,transitionInterruption:Ue}),this._state={startPanLngLat:de,startZoomLngLat:me,startRotatePos:pe,startBearing:W,startPitch:re,startZoom:Ce}}return ef(r,[{key:"getViewportProps",value:function(){return this._viewportProps}},{key:"getState",value:function(){return this._state}},{key:"panStart",value:function(t){var n=t.pos;return 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}),l=gs(o,2),f=l[0],A=l[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,l=o===void 0?0:o,f=this._state,A=f.startRotatePos,v=f.startBearing,T=f.startPitch;if(!Number.isFinite(v)||!Number.isFinite(T))return this;var I;return n?I=this._calculateNewPitchAndBearing(KS(KS({},this._getRotationParams(n,A)),{},{startBearing:v,startPitch:T})):I={bearing:v+s,pitch:T+l},this._getUpdatedMapState(I)}},{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;dl(s>0,"`scale` must be a positive number");var o=this._state,l=o.startZoom,f=o.startZoomLngLat;Number.isFinite(l)||(l=this._viewportProps.zoom,f=this._unproject(i)||this._unproject(n)),dl(f,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var A=this._calculateNewZoom({scale:s,startZoom:l||0}),v=new cc(Object.assign({},this._viewportProps,{zoom:A})),T=v.getMapCenterByLngLatPosition({lngLat:f,pos:n}),I=gs(T,2),F=I[0],N=I[1];
2593return 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,l=t.minPitch,f=t.pitch;return t.pitch=R0(f,l,o),Object.assign(t,ete(t)),t}},{key:"_unproject",value:function(t){var n=new cc(this._viewportProps);return t&&n.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var n=t.startPanLngLat,i=t.pos,s=new cc(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,l=s.minZoom,f=i+Math.log2(n);return R0(f,l,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 l=this._viewportProps,f=l.minPitch,A=l.maxPitch,v=s+180*n,T=o;return i>0?T=o+i*(A-o):i<0&&(T=o-i*(f-o)),{pitch:T,bearing:v}}},{key:"_getRotationParams",value:function(t,n){var i=t[0]-n[0],s=t[1]-n[1],o=t[1],l=n[1],f=this._viewportProps,A=f.width,v=f.height,T=i/A,I=0;return s>0?Math.abs(v-l)>ZS&&(I=s/(l-v)*dte):s<0&&l>ZS&&(I=1-o/l),I=Math.min(1,Math.max(-1,I)),{deltaScaleX:T,deltaScaleY:I}}}]),r})();function pte(r){return r[0].toLowerCase()+r.slice(1)}function Ate(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=pte(t.slice(3));if(n==="min"&&r[i]<e[t]||n==="max"&&r[i]>e[t])return!1}return!0}function YS(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 QS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?YS(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):YS(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var mh=Bt.createContext({viewport:null,map:null,container:null,onViewportChange:null,onViewStateChange:null,eventManager:null}),Zx=mh.Provider;function gte(r){var e=r.value,t=r.children,n=Bt.useState(null),i=gs(n,2),s=i[0],o=i[1],l=Bt.useContext(mh);return e=QS(QS({setMap:o},l),{},{map:l&&l.map||s},e),Bt.createElement(Zx,{value:e},t)}mh.Provider=gte;var l2=typeof window<"u"?Bt.useLayoutEffect:Bt.useEffect;function eI(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 hl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?eI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):eI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var mte="https://visgl.github.io/react-map-gl/docs/get-started/mapbox-tokens",DF="A valid API access token is required to use Mapbox data";function _te(){}function FF(r){var e=r.props,t=r.width,n=r.height;return new cc(hl(hl(hl({},e),e.viewState),{},{width:t,height:n}))}var yte=401,tI={position:"absolute",width:"100%",height:"100%",overflow:"hidden"},vte=Object.assign({},gh.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}),bte=Object.assign({},gh.defaultProps,{disableTokenWarning:!1,visible:!0,onResize:_te,className:"",style:null,visibilityConstraints:qf});function xte(){var r={position:"absolute",left:0,top:0};return Bt.createElement("div",{key:"warning",id:"no-token-warning",style:r},Bt.createElement("h3",{key:"header"},DF),Bt.createElement("div",{key:"text"},"For information on setting up your basemap, read"),Bt.createElement("a",{key:"link",href:mte},"Note on Map Tokens"))}function wte(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 tu=Bt.forwardRef(function(r,e){var t=Bt.useState(!0),n=gs(t,2),i=n[0],s=n[1],o=Bt.useState({width:0,height:0}),l=gs(o,2),f=l[0],A=l[1],v=Bt.useRef(null),T=Bt.useRef(null),I=Bt.useRef(null),F=Bt.useRef(null),N=Bt.useContext(mh);l2(function(){if(tu.supported()){var me=new gh(hl(hl(hl({},r),f),{},{mapboxgl:fc,container:T.current,onError:function(re){var Ce=re.error&&re.error.status||re.
2593status;Ce===yte&&i&&(console.error(DF),s(!1)),r.onError(re)}}));v.current=me,N&&N.setMap&&N.setMap(me.getMap());var pe=new wN(function(W){if(W[0].contentRect){var re=W[0].contentRect,Ce=re.width,et=re.height;A({width:Ce,height:et}),r.onResize({width:Ce,height:et})}});return pe.observe(I.current),function(){me.finalize(),v.current=null,pe.disconnect()}}},[]),l2(function(){v.current&&v.current.setProps(hl(hl({},r),f))});var U=v.current&&v.current.getMap();Bt.useImperativeHandle(e,function(){return wte(v)},[]);var $=Bt.useCallback(function(me){var pe=me.target;pe===F.current&&pe.scrollTo(0,0)},[]),V=U&&Bt.createElement(Zx,{value:hl(hl({},N),{},{viewport:N.viewport||FF(hl({map:U,props:r},f)),map:U,container:N.container||I.current})},Bt.createElement("div",{key:"map-overlays",className:"overlays",ref:F,style:tI,onScroll:$},r.children)),j=r.className,X=r.width,ue=r.height,K=r.style,se=r.visibilityConstraints,Ee=Object.assign({position:"relative"},K,{width:X,height:ue}),Ue=r.visible&&Ate(r.viewState||r,se),de=Object.assign({},tI,{visibility:Ue?"inherit":"hidden"});return Bt.createElement("div",{key:"map-container",ref:I,style:Ee},Bt.createElement("div",{key:"map-mapbox",ref:T,style:de,className:j}),V,!i&&!r.disableTokenWarning&&Bt.createElement(xte,null))});tu.supported=function(){return fc&&fc.supported()};tu.propTypes=vte;tu.defaultProps=bte;function Tte(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=Ete(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. 2594In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,l;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,l=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function Ete(r,e){if(r){if(typeof r=="string")return rI(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 rI(r,e)}}function rI(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 LF=(function(){function r(){tf(this,r),Er(this,"propNames",[])}return ef(r,[{key:"arePropsEqual",value:function(t,n){var i=Tte(this.propNames||[]),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;if(!OF(t[o],n[o]))return!1}}catch(l){i.e(l)}finally{i.f()}return!0}},{key:"initializeProps",value:function(t,n){return{start:t,end:n}}},{key:"interpolateProps",value:function(t,n,i){dl(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,n){return n.transitionDuration}}]),r})(),Cte={longitude:1,bearing:1};function a_(r){return Number.isFinite(r)||Array.isArray(r)}function Ste(r){return r in Cte}function c2(r,e,t){return Ste(r)&&Math.abs(t-e)>180&&(t=t<0?t+360:t-360),t}function Jv(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=Ite(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. 2595In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,l;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,l=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function Ite(r,e){if(r){if(typeof r=="string")return nI(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 nI(r,e)}}function nI(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 Bte(r){var e=Pte();return function(){var n=ap(r),i;if(e){var s=ap(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return H2(this,i)}}function Pte(){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 Mte=["longitude","latitude","zoom","bearing","pitch"],Rte=["latitude","longitude","zoom","width","height"],iI=["bearing","pitch"],Ote={speed:1.2,curve:1.414};(function(r){j2(t,r);var e=Bte(t);function t(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return tf(this,t),n=e.call(this),Er(ku(n),"propNames",Mte),n.props=Object.assign({},Ote,i),n}return ef(t,[{key:"initializeProps",value:function(i,s){var o={},l={},f=Jv(Rte),A;
2595try{for(f.s();!(A=f.n()).done;){var v=A.value,T=i[v],I=s[v];dl(a_(T)&&a_(I),"".concat(v," must be supplied for transition")),o[v]=T,l[v]=c2(v,T,I)}}catch(j){f.e(j)}finally{f.f()}var F=Jv(iI),N;try{for(F.s();!(N=F.n()).done;){var U=N.value,$=i[U]||0,V=s[U]||0;o[U]=$,l[U]=c2(U,$,V)}}catch(j){F.e(j)}finally{F.f()}return{start:o,end:l}}},{key:"interpolateProps",value:function(i,s,o){var l=rte(i,s,o,this.props),f=Jv(iI),A;try{for(f.s();!(A=f.n()).done;){var v=A.value;l[v]=o_(i[v],s[v],o)}}catch(T){f.e(T)}finally{f.f()}return l}},{key:"getDuration",value:function(i,s){var o=s.transitionDuration;return o==="auto"&&(o=nte(i,s,this.props)),o}}]),t})(LF);function sI(r,e){var t;if(typeof Symbol>"u"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=Dte(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. 2596In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,l;return{s:function(){t=r[Symbol.iterator]()},n:function(){var A=t.next();return s=A.done,A},e:function(A){o=!0,l=A},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function Dte(r,e){if(r){if(typeof r=="string")return oI(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 oI(r,e)}}function oI(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 Fte(r){var e=Lte();return function(){var n=ap(r),i;if(e){var s=ap(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return H2(this,i)}}function Lte(){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 kte=["longitude","latitude","zoom","bearing","pitch"],GA=(function(r){j2(t,r);var e=Fte(t);function t(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return tf(this,t),n=e.call(this),Array.isArray(i)&&(i={transitionProps:i}),n.propNames=i.transitionProps||kte,i.around&&(n.around=i.around),n}return ef(t,[{key:"initializeProps",value:function(i,s){var o={},l={};if(this.around){o.around=this.around;var f=new cc(i).unproject(this.around);Object.assign(l,s,{around:new cc(s).project(f),aroundLngLat:f})}var A=sI(this.propNames),v;try{for(A.s();!(v=A.n()).done;){var T=v.value,I=i[T],F=s[T];dl(a_(I)&&a_(F),"".concat(T," must be supplied for transition")),o[T]=I,l[T]=c2(T,I,F)}}catch(N){A.e(N)}finally{A.f()}return{start:o,end:l}}},{key:"interpolateProps",value:function(i,s,o){var l={},f=sI(this.propNames),A;try{for(f.s();!(A=f.n()).done;){var v=A.value;l[v]=o_(i[v],s[v],o)}}catch(U){f.e(U)}finally{f.f()}if(s.around){var T=new cc(Object.assign({},s,l)).getMapCenterByLngLatPosition({lngLat:s.aroundLngLat,pos:o_(i.around,s.around,o)}),I=gs(T,2),F=I[0],N=I[1];l.longitude=F,l.latitude=N}return l}}]),t})(LF),jA=function(){};function Nte(r,e){var t=r(e);return function(n){return 1/(1-t)*(r(n*(1-e)+e)-t)}}var HA={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},Ute={transitionDuration:0,transitionEasing:function(e){return e},transitionInterpolator:new GA,transitionInterruption:HA.BREAK,onTransitionStart:jA,onTransitionInterrupt:jA,onTransitionEnd:jA},Yx=(function(){function r(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tf(this,r),Er(this,"_animationFrame",null),Er(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=t.onViewportChange||jA,this.onStateChange=t.onStateChange||jA,this.time=t.getTime||Date.now}return ef(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===HA.SNAP_TO_END?Object.assign(i,this.state.endProps):Object.assign(i,this.state.propsInTransition),this.state.interruption===HA.UPDATE)){var o=this.time(),l=(o-this.state.startTime)/this.state.duration;s.transitionDuration=this.state.duration-(o-this.state.startTime),s.transitionEasing=Nte(this.state.easing,l),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===HA.IGNORE||this._isUpdateDueToCurrentTransition(n):this._isTransitionEnabled(n)?n.transitionInterpolator.arePropsEqual(t,n):!0:!0}},{key:"_triggerTransition",value:function(t,n){dl(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),l={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(l)}}},{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,l=n.interpolator,f=n.startProps,A=n.endProps,v=!1,T=(t-i)/s;T>=1&&(T=1,v=!0),T=o(T);var I=l.interpolateProps(f,A,T),F=new np(Object.assign({},this.props,I));this.state.propsInTransition=F.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),v&&(this._endTransition(),this.props.onTransitionEnd())}}]),r})();Er(Yx,"defaultProps",Ute);var Kv={exports:{}};var aI;function zte(){return aI||(aI=1,(function(r){(function(e,t,n,i){var s=["","webkit","Moz","MS","ms","o"],o=t.createElement("div"),l="function",f=Math.round,A=Math.abs,v=Date.now;function T(xe,Me,We){return setTimeout(X(xe,We),Me)}function I(xe,Me,We){return Array.isArray(xe)?(F(xe,We[Me],We),!0):!1}function F(xe,Me,We){var gt;if(xe)if(xe.forEach)xe.forEach(Me,We);else if(xe.length!==i)for(gt=0;gt<xe.length;)Me.call(We,xe[gt],gt,xe),gt++;else for(gt in xe)xe.hasOwnProperty(gt)&&Me.call(We,xe[gt],gt,xe)}function N(xe,Me,We){var gt="DEPRECATED METHOD: "+Me+` 2597`+We+` AT 2598`;return function(){var $t=new Error("get-stack-trace"),vr=$t&&$t.stack?$t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Br=e.console&&(e.console.warn||e.console.log);return Br&&Br.call(e.console,gt,vr),xe.apply(this,arguments)}}var U;typeof Object.assign!="function"?U=function(Me){if(Me===i||Me===null)throw new TypeError("Cannot convert undefined or null to object");for(var We=Object(Me),gt=1;gt<arguments.length;gt++){var $t=arguments[gt];if($t!==i&&$t!==null)for(var vr in $t)$t.hasOwnProperty(vr)&&(We[vr]=$t[vr])}return We}:U=Object.assign;var $=N(function(Me,We,gt){for(var $t=Object.keys(We),vr=0;vr<$t.length;)(!gt||gt&&Me[$t[vr]]===i)&&(Me[$t[vr]]=We[$t[vr]]),vr++;return Me},"extend","Use `assign`."),V=N(function(Me,We){return $(Me,We,!0)},"merge","Use `assign`.");function j(xe,Me,We){var gt=Me.prototype,$t;$t=xe.prototype=Object.create(gt),$t.constructor=xe,$t._super=gt,We&&U($t,We)}function X(xe,Me){return function(){return xe.apply(Me,arguments)}}function ue(xe,Me){return typeof xe==l?xe.apply(Me&&Me[0]||i,Me):xe}function K(xe,Me){return xe===i?Me:xe}
vendor: 28,619 bytes, line 2598
2598function se(xe,Me,We){F(me(Me),function(gt){xe.addEventListener(gt,We,!1)})}function Ee(xe,Me,We){F(me(Me),function(gt){xe.removeEventListener(gt,We,!1)})}function Ue(xe,Me){for(;xe;){if(xe==Me)return!0;xe=xe.parentNode}return!1}function de(xe,Me){return xe.indexOf(Me)>-1}function me(xe){return xe.trim().split(/\s+/g)}function pe(xe,Me,We){if(xe.indexOf&&!We)return xe.indexOf(Me);for(var gt=0;gt<xe.length;){if(We&&xe[gt][We]==Me||!We&&xe[gt]===Me)return gt;gt++}return-1}function W(xe){return Array.prototype.slice.call(xe,0)}function re(xe,Me,We){for(var gt=[],$t=[],vr=0;vr<xe.length;){var Br=xe[vr][Me];pe($t,Br)<0&>.push(xe[vr]),$t[vr]=Br,vr++}return gt=gt.sort(function(Li,Xi){return Li[Me]>Xi[Me]}),gt}function Ce(xe,Me){for(var We,gt,$t=Me[0].toUpperCase()+Me.slice(1),vr=0;vr<s.length;){if(We=s[vr],gt=We?We+$t:Me,gt in xe)return gt;vr++}return i}var et=1;function _e(){return et++}function Le(xe){var Me=xe.ownerDocument||xe;return Me.defaultView||Me.parentWindow||e}var Ve=/mobile|tablet|ip(ad|hone|od)|android/i,Ye="ontouchstart"in e,tt=Ce(e,"PointerEvent")!==i,rt=Ye&&Ve.test(navigator.userAgent),ut="touch",vt="pen",It="mouse",st="kinect",dr=25,er=1,Jt=2,Nt=4,Ar=8,cn=1,Mr=2,xr=4,jn=8,_r=16,yr=Mr|xr,un=jn|_r,Dr=yr|un,li=["x","y"],Yn=["clientX","clientY"];function mn(xe,Me){var We=this;this.manager=xe,this.callback=Me,this.element=xe.element,this.target=xe.options.inputTarget,this.domHandler=function(gt){ue(xe.options.enable,[xe])&&We.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&&Ee(this.element,this.evEl,this.domHandler),this.evTarget&&Ee(this.target,this.evTarget,this.domHandler),this.evWin&&Ee(Le(this.element),this.evWin,this.domHandler)}};function ri(xe){var Me,We=xe.options.inputClass;return We?Me=We:tt?Me=Te:rt?Me=he:Ye?Me=g:Me=Vt,new Me(xe,Hn)}function Hn(xe,Me,We){var gt=We.pointers.length,$t=We.changedPointers.length,vr=Me&er&>-$t===0,Br=Me&(Nt|Ar)&>-$t===0;We.isFirst=!!vr,We.isFinal=!!Br,vr&&(xe.session={}),We.eventType=Me,Sn(xe,We),xe.emit("hammer.input",We),xe.recognize(We),xe.session.prevInput=We}function Sn(xe,Me){var We=xe.session,gt=Me.pointers,$t=gt.length;We.firstInput||(We.firstInput=mr(Me)),$t>1&&!We.firstMultiple?We.firstMultiple=mr(Me):$t===1&&(We.firstMultiple=!1);var vr=We.firstInput,Br=We.firstMultiple,fi=Br?Br.center:vr.center,Li=Me.center=Rr(gt);Me.timeStamp=v(),Me.deltaTime=Me.timeStamp-vr.timeStamp,Me.angle=kt(fi,Li),Me.distance=Pe(fi,Li),Qn(We,Me),Me.offsetDirection=gi(Me.deltaX,Me.deltaY);var Xi=nn(Me.deltaTime,Me.deltaX,Me.deltaY);Me.overallVelocityX=Xi.x,Me.overallVelocityY=Xi.y,Me.overallVelocity=A(Xi.x)>A(Xi.y)?Xi.x:Xi.y,Me.scale=Br?cr(Br.pointers,gt):1,Me.rotation=Br?Wt(Br.pointers,gt):0,Me.maxPointers=We.prevInput?Me.pointers.length>We.prevInput.maxPointers?Me.pointers.length:We.prevInput.maxPointers:Me.pointers.length,Gt(We,Me);var Qs=xe.element;Ue(Me.srcEvent.target,Qs)&&(Qs=Me.srcEvent.target),Me.target=Qs}function Qn(xe,Me){var We=Me.center,gt=xe.offsetDelta||{},$t=xe.prevDelta||{},vr=xe.prevInput||{};(Me.eventType===er||vr.eventType===Nt)&&($t=xe.prevDelta={x:vr.deltaX||0,y:vr.deltaY||0},gt=xe.offsetDelta={x:We.x,y:We.y}),Me.deltaX=$t.x+(We.x-gt.x),Me.deltaY=$t.y+(We.y-gt.y)}function Gt(xe,Me){var We=xe.lastInterval||Me,gt=Me.timeStamp-We.timeStamp,$t,vr,Br,fi;if(Me.eventType!=Ar&&(gt>dr||We.velocity===i)){var Li=Me.deltaX-We.deltaX,Xi=Me.deltaY-We.deltaY,Qs=nn(gt,Li,Xi);vr=Qs.x,Br=Qs.y,$t=A(Qs.x)>A(Qs.y)?Qs.x:Qs.y,fi=gi(Li,Xi),xe.lastInterval=Me}else $t=We.velocity,vr=We.velocityX,Br=We.velocityY,fi=We.direction;Me.velocity=$t,Me.velocityX=vr,Me.velocityY=Br,Me.direction=fi}function mr(xe){for(var Me=[],We=0;We<xe.pointers.length;)Me[We]={clientX:f(xe.pointers[We].clientX),clientY:f(xe.pointers[We].clientY)},We++;return{timeStamp:v(),pointers:Me,center:Rr(Me),deltaX:xe.deltaX,deltaY:xe.deltaY}}function Rr(xe){var Me=xe.length;if(Me===1)return{x:f(xe[0].clientX),y:f(xe[0].clientY)};for(var We=0,gt=0,$t=0;$t<Me;)We+=xe[$t].clientX,gt+=xe[$t].clientY,$t++;return{x:f(We/Me),y:f(gt/Me)}}function nn(xe,Me,We){return{x:Me/xe||0,y:We/xe||0}}function gi(xe,Me){return xe===Me?cn:A(xe)>=A(Me)?xe<0?Mr:xr:Me<0?jn:_r}function Pe(xe,Me,We){We||(We=li);var gt=Me[We[0]]-xe[We[0]],$t=Me[We[1]]-xe[We[1]];return Math.sqrt(gt*gt+$t*$t)}function kt(xe,Me,We){We||(We=li);var gt=Me[We[0]]-xe[We[0]],$t=Me[We[1]]-xe[We[1]];return Math.atan2($t,gt)*180/Math.PI}function Wt(xe,Me){return kt(Me[1],Me[0],Yn)+kt(xe[1],xe[0],Yn)}function cr(xe,Me){return Pe(Me[0],Me[1],Yn)/Pe(xe[0],xe[1],Yn)}var Ze={mousedown:er,mousemove:Jt,mouseup:Nt},Rt="mousedown",Ae="mousemove mouseup";function Vt(){this.evEl=Rt,this.evWin=Ae,this.pressed=!1,mn.apply(this,arguments)}j(Vt,mn,{handler:function(Me){var We=Ze[Me.type];We&er&&Me.button===0&&(this.pressed=!0),We&Jt&&Me.which!==1&&(We=Nt),this.pressed&&(We&Nt&&(this.pressed=!1),this.callback(this.manager,We,{pointers:[Me],changedPointers:[Me],pointerType:It,srcEvent:Me}))}});var Et={pointerdown:er,pointermove:Jt,pointerup:Nt,pointercancel:Ar,pointerout:Ar},H={2:ut,3:vt,4:It,5:st},bt="pointerdown",St="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(bt="MSPointerDown",St="MSPointerMove MSPointerUp MSPointerCancel");function Te(){this.evEl=bt,this.evWin=St,mn.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}j(Te,mn,{handler:function(Me){var We=this.store,gt=!1,$t=Me.type.toLowerCase().replace("ms",""),vr=Et[$t],Br=H[Me.pointerType]||Me.pointerType,fi=Br==ut,Li=pe(We,Me.pointerId,"pointerId");vr&er&&(Me.button===0||fi)?Li<0&&(We.push(Me),Li=We.length-1):vr&(Nt|Ar)&&(gt=!0),!(Li<0)&&(We[Li]=Me,this.callback(this.manager,vr,{pointers:We,changedPointers:[Me],pointerType:Br,srcEvent:Me}),gt&&We.splice(Li,1))}});var Xe={touchstart:er,touchmove:Jt,touchend:Nt,touchcancel:Ar},ct="touchstart",Z="touchstart touchmove touchend touchcancel";function ne(){this.evTarget=ct,this.evWin=Z,this.started=!1,mn.apply(this,arguments)}j(ne,mn,{handler:function(Me){var We=Xe[Me.type];if(We===er&&(this.started=!0),!!this.started){var gt=ce.call(this,Me,We);We&(Nt|Ar)&>[0].length-gt[1].length===0&&(this.started=!1),this.callback(this.manager,We,{pointers:gt[0],changedPointers:gt[1],pointerType:ut,srcEvent:Me})}}});function ce(xe,Me){var We=W(xe.touches),gt=W(xe.changedTouches);return Me&(Nt|Ar)&&(We=re(We.concat(gt),"identifier")),[We,gt]}var ve={touchstart:er,touchmove:Jt,touchend:Nt,touchcancel:Ar},Fe="touchstart touchmove touchend touchcancel";function he(){this.evTarget=Fe,this.targetIds={},mn.apply(this,arguments)}j(he,mn,{handler:function(Me){var We=ve[Me.type],gt=be.call(this,Me,We);gt&&this.callback(this.manager,We,{pointers:gt[0],changedPointers:gt[1],pointerType:ut,srcEvent:Me})}});function be(xe,Me){var We=W(xe.touches),gt=this.targetIds;if(Me&(er|Jt)&&We.length===1)return gt[We[0].identifier]=!0,[We,We];var $t,vr,Br=W(xe.changedTouches),fi=[],Li=this.target;if(vr=We.filter(function(Xi){return Ue(Xi.target,Li)}),Me===er)for($t=0;$t<vr.length;)gt[vr[$t].identifier]=!0,$t++;for($t=0;$t<Br.length;)gt[Br[$t].identifier]&&fi.push(Br[$t]),Me&(Nt|Ar)&&delete gt[Br[$t].identifier],$t++;if(fi.length)return[re(vr.concat(fi),"identifier"),fi]}var ae=2500,Se=25;function g(){mn.apply(this,arguments);var xe=X(this.handler,this);this.touch=new he(this.manager,xe),this.mouse=new Vt(this.manager,xe),this.primaryTouch=null,this.lastTouches=[]}j(g,mn,{handler:function(Me,We,gt){var $t=gt.pointerType==ut,vr=gt.pointerType==It;if(!(vr&>.sourceCapabilities&>.sourceCapabilities.firesTouchEvents)){if($t)le.call(this,We,gt);else if(vr&&Je.call(this,gt))return;this.callback(Me,We,gt)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function le(xe,Me){xe&er?(this.primaryTouch=Me.changedPointers[0].identifier,xt.call(this,Me)):xe&(Nt|Ar)&&xt.call(this,Me)}function xt(xe){var Me=xe.changedPointers[0];if(Me.identifier===this.primaryTouch){var We={x:Me.clientX,y:Me.clientY};this.lastTouches.push(We);var gt=this.lastTouches,$t=function(){var vr=gt.indexOf(We);vr>-1&>.splice(vr,1)};setTimeout($t,ae)}}function Je(xe){for(var Me=xe.srcEvent.clientX,We=xe.srcEvent.clientY,gt=0;gt<this.lastTouches.length;gt++){var $t=this.lastTouches[gt],vr=Math.abs(Me-$t.x),Br=Math.abs(We-$t.y);if(vr<=Se&&Br<=Se)return!0}return!1}var Ct=Ce(o.style,"touchAction"),Mt=Ct!==i,Ft="compute",ht="auto",Lt="manipulation",Pt="none",jt="pan-x",Ur="pan-y",Qt=$r();function en(xe,Me){this.manager=xe,this.set(Me)}en.prototype={set:function(xe){xe==Ft&&(xe=this.compute()),Mt&&this.manager.element.style&&Qt[xe]&&(this.manager.element.style[Ct]=xe),this.actions=xe.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var xe=[];return F(this.manager.recognizers,function(Me){ue(Me.options.enable,[Me])&&(xe=xe.concat(Me.getTouchAction()))}),ln(xe.join(" "))},preventDefaults:function(xe){var Me=xe.srcEvent,We=xe.offsetDirection;if(this.manager.session.prevented){Me.preventDefault();return}var gt=this.actions,$t=de(gt,Pt)&&!Qt[Pt],vr=de(gt,Ur)&&!Qt[Ur],Br=de(gt,jt)&&!Qt[jt];if($t){var fi=xe.pointers.length===1,Li=xe.distance<2,Xi=xe.deltaTime<250;if(fi&&Li&&Xi)return}if(!(Br&&vr)&&($t||vr&&We&yr||Br&&We&un))return this.preventSrc(Me)},preventSrc:function(xe){this.manager.session.prevented=!0,xe.preventDefault()}};function ln(xe){if(de(xe,Pt))return Pt;var Me=de(xe,jt),We=de(xe,Ur);return Me&&We?Pt:Me||We?Me?jt:Ur:de(xe,Lt)?Lt:ht}function $r(){if(!Mt)return!1;var xe={},Me=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(We){xe[We]=Me?e.CSS.supports("touch-action",We):!0}),xe}var Xr=1,Gr=2,mi=4,qr=8,pr=qr,Be=16,qt=32;function tn(xe){this.options=U({},this.defaults,xe||{}),this.id=_e(),this.manager=null,this.options.enable=K(this.options.enable,!0),this.state=Xr,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(I(xe,"recognizeWith",this))return this;var Me=this.simultaneous;return xe=ci(xe,this),Me[xe.id]||(Me[xe.id]=xe,xe.recognizeWith(this)),this},dropRecognizeWith:function(xe){return I(xe,"dropRecognizeWith",this)?this:(xe=ci(xe,this),delete this.simultaneous[xe.id],this)},requireFailure:function(xe){if(I(xe,"requireFailure",this))return this;var Me=this.requireFail;return xe=ci(xe,this),pe(Me,xe)===-1&&(Me.push(xe),xe.requireFailure(this)),this},dropRequireFailure:function(xe){if(I(xe,"dropRequireFailure",this))return this;xe=ci(xe,this);var Me=pe(this.requireFail,xe);return Me>-1&&this.requireFail.splice(Me,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(xe){return!!this.simultaneous[xe.id]},emit:function(xe){var Me=this,We=this.state;function gt($t){Me.manager.emit($t,xe)}We<qr&>(Me.options.event+Wi(We)),gt(Me.options.event),xe.additionalEvent&>(xe.additionalEvent),We>=qr&>(Me.options.event+Wi(We))},tryEmit:function(xe){if(this.canEmit())return this.emit(xe);this.state=qt},canEmit:function(){for(var xe=0;xe<this.requireFail.length;){if(!(this.requireFail[xe].state&(qt|Xr)))return!1;xe++}return!0},recognize:function(xe){var Me=U({},xe);if(!ue(this.options.enable,[this,Me])){this.reset(),this.state=qt;return}this.state&(pr|Be|qt)&&(this.state=Xr),this.state=this.process(Me),this.state&(Gr|mi|qr|Be)&&this.tryEmit(Me)},process:function(xe){},getTouchAction:function(){},reset:function(){}};function Wi(xe){return xe&Be?"cancel":xe&qr?"end":xe&mi?"move":xe&Gr?"start":""}function _a(xe){return xe==_r?"down":xe==jn?"up":xe==Mr?"left":xe==xr?"right":""}function ci(xe,Me){var We=Me.manager;return We?We.get(xe):xe}function Wn(){tn.apply(this,arguments)}j(Wn,tn,{defaults:{pointers:1},attrTest:function(xe){var Me=this.options.pointers;return Me===0||xe.pointers.length===Me},process:function(xe){var Me=this.state,We=xe.eventType,gt=Me&(Gr|mi),$t=this.attrTest(xe);return gt&&(We&Ar||!$t)?Me|Be:gt||$t?We&Nt?Me|qr:Me&Gr?Me|mi:Gr:qt}});function Ie(){Wn.apply(this,arguments),this.pX=null,this.pY=null}j(Ie,Wn,{defaults:{event:"pan",threshold:10,pointers:1,direction:Dr},getTouchAction:function(){var xe=this.options.direction,Me=[];return xe&yr&&Me.push(Ur),xe&un&&Me.push(jt),Me},directionTest:function(xe){var Me=this.options,We=!0,gt=xe.distance,$t=xe.direction,vr=xe.deltaX,Br=xe.deltaY;return $t&Me.direction||(Me.direction&yr?($t=vr===0?cn:vr<0?Mr:xr,We=vr!=this.pX,gt=Math.abs(xe.deltaX)):($t=Br===0?cn:Br<0?jn:_r,We=Br!=this.pY,gt=Math.abs(xe.deltaY))),xe.direction=$t,We&>>Me.threshold&&$t&Me.direction},attrTest:function(xe){return Wn.prototype.attrTest.call(this,xe)&&(this.state&Gr||!(this.state&Gr)&&this.directionTest(xe))},emit:function(xe){this.pX=xe.deltaX,this.pY=xe.deltaY;var Me=_a(xe.direction);Me&&(xe.additionalEvent=this.options.event+Me),this._super.emit.call(this,xe)}});function Ho(){Wn.apply(this,arguments)}j(Ho,Wn,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pt]},attrTest:function(xe){return this._super.attrTest.call(this,xe)&&(Math.abs(xe.scale-1)>this.options.threshold||this.state&Gr)},emit:function(xe){if(xe.scale!==1){var Me=xe.scale<1?"in":"out";xe.additionalEvent=this.options.event+Me}this._super.emit.call(this,xe)}});function $n(){tn.apply(this,arguments),this._timer=null,this._input=null}j($n,tn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ht]},process:function(xe){var Me=this.options,We=xe.pointers.length===Me.pointers,gt=xe.distance<Me.threshold,$t=xe.deltaTime>Me.time;if(this._input=xe,!gt||!We||xe.eventType&(Nt|Ar)&&!$t)this.reset();else if(xe.eventType&er)this.reset(),this._timer=T(function(){this.state=pr,this.tryEmit()},Me.time,this);else if(xe.eventType&Nt)return pr;return qt},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(){Wn.apply(this,arguments)}j(Wo,Wn,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pt]},attrTest:function(xe){return this._super.attrTest.call(this,xe)&&(Math.abs(xe.rotation)>this.options.threshold||this.state&Gr)}});function Fi(){Wn.apply(this,arguments)}j(Fi,Wn,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:yr|un,pointers:1},getTouchAction:function(){return Ie.prototype.getTouchAction.call(this)},attrTest:function(xe){var Me=this.options.direction,We;return Me&(yr|un)?We=xe.overallVelocity:Me&yr?We=xe.overallVelocityX:Me&un&&(We=xe.overallVelocityY),this._super.attrTest.call(this,xe)&&Me&xe.offsetDirection&&xe.distance>this.options.threshold&&xe.maxPointers==this.options.pointers&&A(We)>this.options.velocity&&xe.eventType&Nt},emit:function(xe){var Me=_a(xe.offsetDirection);Me&&this.manager.emit(this.options.event+Me,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}j(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 Me=this.options,We=xe.pointers.length===Me.pointers,gt=xe.distance<Me.threshold,$t=xe.deltaTime<Me.time;if(this.reset(),xe.eventType&er&&this.count===0)return this.failTimeout();if(gt&&$t&&We){if(xe.eventType!=Nt)return this.failTimeout();var vr=this.pTime?xe.timeStamp-this.pTime<Me.interval:!0,Br=!this.pCenter||Pe(this.pCenter,xe.center)<Me.posThreshold;this.pTime=xe.timeStamp,this.pCenter=xe.center,!Br||!vr?this.count=1:this.count+=1,this._input=xe;var fi=this.count%Me.taps;if(fi===0)return this.hasRequireFailures()?(this._timer=T(function(){this.state=pr,this.tryEmit()},Me.interval,this),Gr):pr}return qt},failTimeout:function(){return this._timer=T(function(){this.state=qt},this.options.interval,this),qt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==pr&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Si(xe,Me){return Me=Me||{},Me.recognizers=K(Me.recognizers,Si.defaults.preset),new $i(xe,Me)}Si.VERSION="2.0.7",Si.defaults={domEvents:!1,touchAction:Ft,enable:!0,inputTarget:null,inputClass:null,preset:[[Wo,{enable:!1}],[Ho,{enable:!1},["rotate"]],[Fi,{direction:yr}],[Ie,{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 $i(xe,Me){this.options=U({},Si.defaults,Me||{}),this.options.inputTarget=this.options.inputTarget||xe,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=xe,this.input=ri(this),this.touchAction=new en(this,this.options.touchAction),Ns(this,!0),F(this.options.recognizers,function(We){var gt=this.add(new We[0](We[1]));We[2]&>.recognizeWith(We[2]),We[3]&>.requireFailure(We[3])},this)}$i.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 Me=this.session;if(!Me.stopped){this.touchAction.preventDefaults(xe);var We,gt=this.recognizers,$t=Me.curRecognizer;(!$t||$t&&$t.state&pr)&&($t=Me.curRecognizer=null);for(var vr=0;vr<gt.length;)We=gt[vr],Me.stopped!==ms&&(!$t||We==$t||We.canRecognizeWith($t))?We.recognize(xe):We.reset(),!$t&&We.state&(Gr|mi|qr)&&($t=Me.curRecognizer=We),vr++}},get:function(xe){if(xe instanceof tn)return xe;for(var Me=this.recognizers,We=0;We<Me.length;We++)if(Me[We].options.event==xe)return Me[We];return null},add:function(xe){if(I(xe,"add",this))return this;var Me=this.get(xe.options.event);return Me&&this.remove(Me),this.recognizers.push(xe),xe.manager=this,this.touchAction.update(),xe},remove:function(xe){if(I(xe,"remove",this))return this;if(xe=this.get(xe),xe){var Me=this.recognizers,We=pe(Me,xe);We!==-1&&(Me.splice(We,1),this.touchAction.update())}return this},on:function(xe,Me){if(xe!==i&&Me!==i){var We=this.handlers;return F(me(xe),function(gt){We[gt]=We[gt]||[],We[gt].push(Me)}),this}},off:function(xe,Me){if(xe!==i){var We=this.handlers;return F(me(xe),function(gt){Me?We[gt]&&We[gt].splice(pe(We[gt],Me),1):delete We[gt]}),this}},emit:function(xe,Me){this.options.domEvents&&In(xe,Me);var We=this.handlers[xe]&&this.handlers[xe].slice();if(!(!We||!We.length)){Me.type=xe,Me.preventDefault=function(){Me.srcEvent.preventDefault()};for(var gt=0;gt<We.length;)We[gt](Me),gt++}},destroy:function(){this.element&&Ns(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ns(xe,Me){var We=xe.element;if(We.style){var gt;F(xe.options.cssProps,function($t,vr){gt=Ce(We.style,vr),Me?(xe.oldCssProps[gt]=We.style[gt],We.style[gt]=$t):We.style[gt]=xe.oldCssProps[gt]||""}),Me||(xe.oldCssProps={})}}function In(xe,Me){var We=t.createEvent("Event");We.initEvent(xe,!0,!0),We.gesture=Me,Me.target.dispatchEvent(We)}U(Si,{INPUT_START:er,INPUT_MOVE:Jt,INPUT_END:Nt,INPUT_CANCEL:Ar,STATE_POSSIBLE:Xr,STATE_BEGAN:Gr,STATE_CHANGED:mi,STATE_ENDED:qr,STATE_RECOGNIZED:pr,STATE_CANCELLED:Be,STATE_FAILED:qt,DIRECTION_NONE:cn,DIRECTION_LEFT:Mr,DIRECTION_RIGHT:xr,DIRECTION_UP:jn,DIRECTION_DOWN:_r,DIRECTION_HORIZONTAL:yr,DIRECTION_VERTICAL:un,DIRECTION_ALL:Dr,Manager:$i,Input:mn,TouchAction:en,TouchInput:he,MouseInput:Vt,PointerEventInput:Te,TouchMouseInput:g,SingleTouchInput:ne,Recognizer:tn,AttrRecognizer:Wn,Tap:ui,Pan:Ie,Swipe:Fi,Pinch:Ho,Rotate:Wo,Press:$n,on:se,off:Ee,each:F,merge:V,extend:$,assign:U,inherit:j,bindFn:X,prefixed:Ce});var gc=typeof e<"u"?e:typeof self<"u"?self:{};gc.Hammer=Si,r.exports?r.exports=Si:e[n]=Si})(window,document,"Hammer")})(Kv)),Kv.exports}var _g=zte();const Vte=uh(_g),Ql=kN({__proto__:null,default:Vte},[_g]),kF=1,NF=2,u2=4,Gte={mousedown:kF,mousemove:NF,mouseup:u2};function jte(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return!0;return!1}function Hte(r){const e=r.prototype.handler;r.prototype.handler=function(n){const i=this.store;n.button>0&&n.type==="pointerdown"&&(jte(i,s=>s.pointerId===n.pointerId)||i.push(n)),e.call(this,n)}}function Wte(r){r.prototype.handler=function(t){let n=Gte[t.type];n&kF&&t.button>=0&&(this.pressed=!0),n&NF&&t.buttons===0&&(n=u2),this.pressed&&(n&u2&&(this.pressed=!1),this.callback(this.manager,n,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))}}Hte(_g.PointerEventInput);Wte(_g.MouseInput);const $te=_g.Manager;class W_{constructor(e,t,n){this.element=e,this.callback=t,this.options={enable:!0,...n}}}const Xte=Ql?[[Ql.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[Ql.Rotate,{enable:!1}],[Ql.Pinch,{enable:!1}],[Ql.Swipe,{enable:!1}],[Ql.Pan,{threshold:0,enable:!1}],[Ql.Press,{enable:!1}],[Ql.Tap,{event:"doubletap",taps:2,enable:!1}],[Ql.Tap,{event:"anytap",enable:!1}],[Ql.Tap,{enable:!1}]]:null,lI={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},qte={doubletap:["tap"]},Jte={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},Qx={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},Kte={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"},cI={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},Zte=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",Wd=typeof window<"u"?window:global;let f2=!1;try{const r={get passive(){return f2=!0,!0}};Wd.addEventListener("test",null,r),Wd.removeEventListener("test",null)}catch{f2=!1}const Yte=Zte.indexOf("firefox")!==-1,{WHEEL_EVENTS:Qte}=Qx,uI="wheel",fI=4.000244140625,ere=40,tre=.25;class rre extends W_{constructor(e,t,n){super(e,t,n),this.handleEvent=i=>{if(!this.options.enable)return;let s=i.deltaY;Wd.WheelEvent&&(Yte&&i.deltaMode===Wd.WheelEvent.DOM_DELTA_PIXEL&&(s/=Wd.devicePixelRatio),i.deltaMode===Wd.WheelEvent.DOM_DELTA_LINE&&(s*=ere)),s!==0&&s%fI===0&&(s=Math.floor(s/fI)),i.shiftKey&&s&&(s=s*tre),this.callback({type:uI,center:{x:i.clientX,y:i.clientY},delta:-s,srcEvent:i,pointerType:"mouse",target:i.target})},this.events=(this.options.events||[]).concat(Qte),this.events.forEach(i=>e.addEventListener(i,this.handleEvent,f2?{passive:!1}:!1))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){e===uI&&(this.options.enable=t)}}const{MOUSE_EVENTS:nre}=Qx,hI="pointermove",dI="pointerover",pI="pointerout",AI="pointerenter",gI="pointerleave";class ire extends W_{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(nre),this.events.forEach(s=>e.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){e===hI&&(this.enableMoveEvent=t),e===dI&&(this.enableOverEvent=t),e===pI&&(this.enableOutEvent=t),e===AI&&(this.enableEnterEvent=t),e===gI&&(this.enableLeaveEvent=t)}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit(dI,e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit(pI,e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit(AI,e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit(gI,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(hI,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:sre}=Qx,mI="keydown",_I="keyup";class ore extends W_{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:mI,srcEvent:i,key:i.key,target:i.target}),this.enableUpEvent&&i.type==="keyup"&&this.callback({type:_I,srcEvent:i,key:i.key,target:i.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(sre),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===mI&&(this.enableDownEvent=t),e===_I&&(this.enableUpEvent=t)}}const yI="contextmenu";class are extends W_{constructor(e,t,n){super(e,t,n),this.handleEvent=i=>{this.options.enable&&this.callback({type:yI,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===yI&&(this.options.enable=t)}}const vI=1,h2=2,bI=4,lre={pointerdown:vI,pointermove:h2,pointerup:bI,mousedown:vI,mousemove:h2,mouseup:bI},cre=0,ure=1,fre=2,hre=1,dre=2,pre=4;function Are(r){const e=lre[r.srcEvent.type];if(!e)return null;const{buttons:t,button:n}=r.srcEvent;let i=!1,s=!1,o=!1;return e===h2?(i=!!(t&hre),s=!!(t&pre),o=!!(t&dre)):(i=n===cre,s=n===ure,o=n===fre),{leftButton:i,middleButton:s,rightButton:o}}function gre(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 Zv={srcElement:"root",priority:0};class mre{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:l}=this;let f=Zv;typeof n=="string"||n&&n.addEventListener?f={...Zv,srcElement:n}:n&&(f={...Zv,...n});let A=l.get(f.srcElement);A||(A=[],l.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 T=A.length-1;for(;T>=0&&!(A[T].priority>=v.priority);)T--;A.splice(T+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 l=i.get(o.srcElement);l.splice(l.indexOf(o),1),l.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},l=[];for(let f=0;f<n.length;f++){const{type:A,handler:v,once:T}=n[f];if(v({...e,type:A,stopPropagation:s,stopImmediatePropagation:o}),T&&l.push(n[f]),i)break}for(let f=0;f<l.length;f++){const{type:A,handler:v}=l[f];this.remove(A,v)}
2598}}_normalizeEvent(e){const t=this.eventManager.getElement();return{...e,...Are(e),...gre(e,t),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:t}}}const _re={events:null,recognizers:null,recognizerOptions:{},Manager:$te,touchAction:"none",tabIndex:0};class yre{constructor(e=null,t){this._onBasicInput=i=>{const{srcEvent:s}=i,o=Jte[s.type];o&&this.manager.emit(o,i)},this._onOtherEvent=i=>{this.manager.emit(i.type,i)},this.options={..._re,...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||Xte}).on("hammer.input",this._onBasicInput),t.recognizers||Object.keys(lI).forEach(i=>{const s=this.manager.get(i);s&&lI[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 rre(e,this._onOtherEvent,{enable:!1}),this.moveInput=new ire(e,this._onOtherEvent,{enable:!1}),this.keyInput=new ore(e,this._onOtherEvent,{enable:!1,tabIndex:t.tabIndex}),this.contextmenuInput=new are(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=qte[e];s&&!this.options.recognizers&&s.forEach(o=>{const l=n.get(o);t?(l.requireFailure(e),i.dropRequireFailure(o)):l.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:l}=this,f=cI[e]||e;let A=l.get(f);A||(A=new mre(this),l.set(f,A),A.recognizerName=Kte[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=cI[e]||e,s=n.get(i);if(s&&(s.remove(e,t),s.isEmpty())){const{recognizerName:o}=s;let l=!1;for(const f of n.values())if(f.recognizerName===o&&!f.isEmpty()){l=!0;break}l||this._toggleRecognizer(o,!1)}}}function xI(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 Bo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var kf={transitionDuration:0},Vc={transitionDuration:300,transitionEasing:function(e){return e},transitionInterpolator:new GA,transitionInterruption:HA.BREAK},O0=300,D0=function(e){return 1-(1-e)*(1-e)},Ad={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},UF=(function(){function r(){var e=this;tf(this,r),Er(this,"events",[]),Er(this,"scrollZoom",!0),Er(this,"dragPan",!0),Er(this,"dragRotate",!0),Er(this,"doubleClickZoom",!0),Er(this,"touchZoom",!0),Er(this,"touchRotate",!1),Er(this,"keyboard",!0),Er(this,"_interactionState",{isDragging:!1}),Er(this,"_events",{}),Er(this,"_setInteractionState",function(t){Object.assign(e._interactionState,t),e.onStateChange&&e.onStateChange(e._interactionState)}),Er(this,"_onTransition",function(t,n){e.onViewportChange(t,e._interactionState,n)}),this.handleEvent=this.handleEvent.bind(this),this._transitionManager=new Yx({onViewportChange:this._onTransition,onStateChange:this._setInteractionState})}return ef(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 np?this.mapState.getViewportProps():this.mapState,o=Bo(Bo({},t.getViewportProps()),n),l=Object.keys(o).some(function(f){return s[f]!==o[f]});this._state=t.getState(),this._setInteractionState(i),l&&this.onViewportChange(o,this._interactionState,s)}},{key:"getMapState",value:function(t){return new np(Bo(Bo(Bo({},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,l=t.isInteractive,f=l===void 0?!0:l,A=t.scrollZoom,v=A===void 0?this.scrollZoom:A,T=t.dragPan,I=T===void 0?this.dragPan:T,F=t.dragRotate,N=F===void 0?this.dragRotate:F,U=t.doubleClickZoom,$=U===void 0?this.doubleClickZoom:U,V=t.touchZoom,j=V===void 0?this.touchZoom:V,X=t.touchRotate,ue=X===void 0?this.touchRotate:X,K=t.keyboard,se=K===void 0?this.keyboard:K;this.onViewportChange=n,this.onStateChange=i;var Ee=this.mapStateProps||{},Ue=Ee.height!==t.height||Ee.width!==t.width;this.mapStateProps=t,Ue&&(this.mapState=Ee,this.updateViewport(new np(t))),this._transitionManager.processViewportChange(t),this.eventManager!==o&&(this.eventManager=o,this._events={},this.toggleEvents(this.events,!0)),this.toggleEvents(Ad.WHEEL,f&&!!v),this.toggleEvents(Ad.PAN,f&&!!(I||N)),this.toggleEvents(Ad.PINCH,f&&!!(j||ue)),this.toggleEvents(Ad.TRIPLE_PAN,f&&!!ue),this.toggleEvents(Ad.DOUBLE_TAP,f&&!!$),this.toggleEvents(Ad.KEYBOARD,f&&!!se),this.scrollZoom=v,this.dragPan=I,this.dragRotate=N,this.doubleClickZoom=$,this.touchZoom=j,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,kf,{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,kf,{isPanning:!0}),!0}},{key:"_onPanMoveEnd",value:function(t){if(this.dragPan){var n=this.dragPan.inertia,i=n===void 0?O0:n;if(i&&t.velocity){var s=this.getCenter(t),o=[s[0]+t.velocityX*i/2,s[1]+t.velocityY*i/2],l=this.mapState.pan({pos:o}).panEnd();return this.updateViewport(l,Bo(Bo({},Vc),{},{transitionDuration:i,transitionEasing:D0}),{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,kf,{isRotating:!0}),!0}},{key:"_onPanRotateEnd",value:function(t){if(this.dragRotate){var n=this.dragRotate.inertia,i=n===void 0?O0:n;if(i&&t.velocity){var s=this.getCenter(t),o=[s[0]+t.velocityX*i/2,s[1]+t.velocityY*i/2],l=this.mapState.rotate({pos:o}).rotateEnd();return this.updateViewport(l,Bo(Bo({},Vc),{},{transitionDuration:i,transitionEasing:D0}),{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,l=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 T=this.mapState.zoom({pos:f,scale:v});return T.getViewportProps().zoom===this.mapStateProps.zoom?!1:(this.updateViewport(T,Bo(Bo({},Vc),{},{transitionInterpolator:new GA({around:f}),transitionDuration:l?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,kf,{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,kf,{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?O0:n,s=this._lastPinchEvent;if(i&&s&&t.scale!==s.scale){var o=this.getCenter(t),l=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 l=l.zoom({pos:o,scale:v}).zoomEnd(),this.updateViewport(l,Bo(Bo({},Vc),{},{transitionInterpolator:new GA({around:o}),transitionDuration:i,transitionEasing:D0}),{isDragging:!1,isPanning:!!this.touchZoom,isZooming:!!this.touchZoom,isRotating:!1}),this.blockEvents(i),!0}}var T=this.mapState.zoomEnd().rotateEnd();return this._state.startPinchRotation=0,this.updateViewport(T,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,kf,{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,kf,{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?O0:n;if(i&&t.velocityY){var s=this.getCenter(t),o=[s[0],s[1]+=t.velocityY*i/2],l=this.mapState.rotate({pos:o});return this.updateViewport(l,Bo(Bo({},Vc),{},{transitionDuration:i,transitionEasing:D0}),{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({},Vc,{transitionInterpolator:new GA({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,l=i.moveSpeed,f=l===void 0?100:l,A=i.rotateSpeedX,v=A===void 0?15:A,T=i.rotateSpeedY,I=T===void 0?10:T,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+I}):N=this.mapState.pan({pos:[0,f],startPos:[0,0]});break;case 40:n?N=this.getMapState({pitch:F.pitch-I}):N=this.mapState.pan({pos:[0,-f],startPos:[0,0]});break;default:return!1}return this.updateViewport(N,Vc)}}]),r})();function wI(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 Uc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2598e%2?wI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var vre=Object.assign({},tu.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(UF)}),bre=function(e){var t=e.isDragging,n=e.isHovering;return t?"grabbing":n?"pointer":"grab"},xre=Object.assign({},tu.defaultProps,qf,Yx.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:bre});function ew(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 zF(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 Xc(r,e){var t=this.props[r];t&&t(ew.call(this,e))}function wre(r){Xc.call(this,r.pointerType==="touch"?"onTouchStart":"onMouseDown",r)}function Tre(r){Xc.call(this,r.pointerType==="touch"?"onTouchEnd":"onMouseUp",r)}function Ere(r){if(Xc.call(this,r.pointerType==="touch"?"onTouchMove":"onMouseMove",r),!this.state.isDragging){var e=this.props,t=e.onHover,n=e.interactiveLayerIds,i;r=ew.call(this,r),(n||t)&&(i=zF.call(this,r.point));var s=!!(n&&i&&i.length>0),o=s&&!this.state.isHovering,l=!s&&this.state.isHovering;(t||o)&&(r.features=i,t&&t(r)),o&&Xc.call(this,"onMouseEnter",r),l&&Xc.call(this,"onMouseLeave",r),(o||l)&&this.setState({isHovering:s})}}function TI(r){var e=this.props,t=e.onClick,n=e.onNativeClick,i=e.onDblClick,s=e.doubleClickZoom,o=[],l=i||s;switch(r.type){case"anyclick":o.push(n),l||o.push(t);break;case"click":l&&o.push(t);break}o=o.filter(Boolean),o.length&&(r=ew.call(this,r),r.features=zF.call(this,r.point),o.forEach(function(f){return f(r)}))}function Cre(r){return{getMap:r.current&&r.current.getMap,queryRenderedFeatures:r.current&&r.current.queryRenderedFeatures}}var tw=Bt.forwardRef(function(r,e){var t=Bt.useContext(mh),n=Bt.useMemo(function(){return r.controller||new UF},[]),i=Bt.useMemo(function(){return new yre(null,{touchAction:r.touchAction,recognizerOptions:r.eventRecognizerOptions})},[]),s=Bt.useRef(null),o=Bt.useRef(null),l=Bt.useRef({width:0,height:0,state:{isHovering:!1,isDragging:!1}}),f=l.current;f.props=r,f.map=o.current&&o.current.getMap(),f.setState=function(se){f.state=Uc(Uc({},f.state),se),s.current.style.cursor=r.getCursor(f.state)};var A=!0,v,T,I=function(Ee,Ue,de){if(A){v=[Ee,Ue,de];return}var me=f.props,pe=me.onViewStateChange,W=me.onViewportChange;pe&&pe({viewState:Ee,interactionState:Ue,oldViewState:de}),W&&W(Ee,Ue,de)};
2598Bt.useImperativeHandle(e,function(){return Cre(o)},[]);var F=Bt.useMemo(function(){return Uc(Uc({},t),{},{eventManager:i,container:t.container||s.current})},[t,s.current]);F.onViewportChange=I,F.viewport=t.viewport||FF(f),f.viewport=F.viewport;var N=function(Ee){var Ue=Ee.isDragging,de=Ue===void 0?!1:Ue;if(de!==f.state.isDragging&&f.setState({isDragging:de}),A){T=Ee;return}var me=f.props.onInteractionStateChange;me&&me(Ee)},U=function(){f.width&&f.height&&n.setOptions(Uc(Uc(Uc({},f.props),f.props.viewState),{},{isInteractive:!!(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:I,onStateChange:N,eventManager:i,width:f.width,height:f.height}))},$=function(Ee){var Ue=Ee.width,de=Ee.height;f.width=Ue,f.height=de,U(),f.props.onResize({width:Ue,height:de})};Bt.useEffect(function(){return i.setElement(s.current),i.on({pointerdown:wre.bind(f),pointermove:Ere.bind(f),pointerup:Tre.bind(f),pointerleave:Xc.bind(f,"onMouseOut"),click:TI.bind(f),anyclick:TI.bind(f),dblclick:Xc.bind(f,"onDblClick"),wheel:Xc.bind(f,"onWheel"),contextmenu:Xc.bind(f,"onContextMenu")}),function(){i.destroy()}},[]),l2(function(){v&&I.apply(void 0,BN(v)),T&&N(T)}),U();var V=r.width,j=r.height,X=r.style,ue=r.getCursor,K=Bt.useMemo(function(){return Uc(Uc({position:"relative"},X),{},{width:V,height:j,cursor:ue(f.state)})},[X,V,j,ue,f.state]);return(!v||!f._child)&&(f._child=Bt.createElement(Zx,{value:F},Bt.createElement("div",{key:"event-canvas",ref:s,style:K},Bt.createElement(tu,KR({},r,{width:"100%",height:"100%",style:null,onResize:$,ref:o}))))),A=!1,f._child});tw.supported=tu.supported;tw.propTypes=vre;tw.defaultProps=xre;At.string.isRequired;var Sre=["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade"];At.oneOf(Sre).isRequired;var rf={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},Il={captureScroll:At.bool,captureDrag:At.bool,captureClick:At.bool,captureDoubleClick:At.bool,capturePointerMove:At.bool};function Ire(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 nf(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Bt.useContext(mh),t=Bt.useRef(null),n=Bt.useRef({props:r,state:{},context:e,containerRef:t}),i=n.current;return i.props=r,i.context=e,Bt.useEffect(function(){return Ire(i)},[e.eventManager]),i}function Bre(r){var e=Pre();return function(){var n=ap(r),i;if(e){var s=ap(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return H2(this,i)}}function Pre(){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 Mre(r){var e=r.instance,t=nf(r),n=t.context,i=t.containerRef;return e._context=n,e._containerRef=i,e._render()}var VF=(function(r){j2(t,r);var e=Bre(t);function t(){var n;tf(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)),Er(ku(n),"_context",{}),Er(ku(n),"_containerRef",Bt.createRef()),Er(ku(n),"_onScroll",function(l){}),Er(ku(n),"_onDragStart",function(l){}),Er(ku(n),"_onDblClick",function(l){}),Er(ku(n),"_onClick",function(l){}),Er(ku(n),"_onPointerMove",function(l){}),n}return ef(t,[{key:"_render",value:function(){throw new Error("_render() not implemented")}},{key:"render",value:function(){return Bt.createElement(Mre,KR({instance:this},this.props,{onScroll:this._onScroll,onDragStart:this._onDragStart,onDblClick:this._onDblClick,onClick:this._onClick,onPointerMove:this._onPointerMove}))}}]),t})(Bt.PureComponent);Er(VF,"propTypes",Il);Er(VF,"defaultProps",rf);function EI(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 CI(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2598e%2?EI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):EI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Rre=Object.assign({},Il,{draggable:At.bool,onDrag:At.func,onDragEnd:At.func,onDragStart:At.func,offsetLeft:At.number,offsetTop:At.number}),Ore=Object.assign({},rf,{draggable:!1,offsetLeft:0,offsetTop:0});function GF(r){var e=r.offsetCenter,t=e.x,n=e.y;return[t,n]}function Dre(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 rw(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 Fre(r,e){var t=e.props,n=e.callbacks,i=e.state,s=e.context,o=e.containerRef,l=t.draggable;if(l){r.stopPropagation();var f=GF(r),A=Dre(r,o.current);if(i.setDragPos(f),i.setDragOffset(A),n.onDragStart&&A){var v=Object.assign({},r);v.lngLat=rw(f,A,t,s),n.onDragStart(v)}}}function Lre(r,e){var t=e.props,n=e.callbacks,i=e.state,s=e.context;r.stopPropagation();var o=GF(r);i.setDragPos(o);var l=i.dragOffset;if(n.onDrag&&l){var f=Object.assign({},r);f.lngLat=rw(o,l,t,s),n.onDrag(f)}}function kre(r,e){var t=e.props,n=e.callbacks,i=e.state,s=e.context;r.stopPropagation();var o=i.dragPos,l=i.dragOffset;if(i.setDragPos(null),i.setDragOffset(null),n.onDragEnd&&o&&l){var f=Object.assign({},r);f.lngLat=rw(o,l,t,s),n.onDragEnd(f)}}function Nre(r,e){var t=e.state;r.stopPropagation(),t.setDragPos(null),t.setDragOffset(null)}function Ure(r){var e=r.context.eventManager;if(!(!e||!r.state.dragPos)){var t={panmove:function(i){return Lre(i,r)},panend:function(i){return kre(i,r)},pancancel:function(i){return Nre(i,r)}};return e.watch(t),function(){e.off(t)}}}function zre(r){var e=Bt.useState(null),t=gs(e,2),n=t[0],i=t[1],s=Bt.useState(null),o=gs(s,2),l=o[0],f=o[1],A=nf(CI(CI({},r),{},{onDragStart:Fre}));return A.callbacks=r,A.state.dragPos=n,A.state.setDragPos=i,A.state.dragOffset=l,A.state.setDragOffset=f,Bt.useEffect(function(){return Ure(A)},[A.context.eventManager,!!n]),A}var SI=typeof window<"u"&&window.devicePixelRatio||1,sg=function(e){return Math.round(e*SI)/SI},II=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 sg(t/100*i)/i*100};function BI(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 Vre(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?BI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):BI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Gre=Object.assign({},Rre,{className:At.string,longitude:At.number.isRequired,latitude:At.number.isRequired,style:At.object}),jre=Object.assign({},Ore,{className:""});function Hre(r){var e=r.props,t=r.state,n=r.context,i=e.longitude,s=e.latitude,o=e.offsetLeft,l=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]),T=gs(v,2),I=T[0],F=T[1];return I+=o,F+=l,[I,F]}function nw(r){var e=zre(r),t=e.state,n=e.containerRef,i=r.children,s=r.className,o=r.draggable,l=r.style,f=t.dragPos,A=Hre(e),v=gs(A,2),T=v[0],I=v[1],F="translate(".concat(sg(T),"px, ").concat(sg(I),"px)"),N=o?f?"grabbing":"grab":"auto",U=Bt.useMemo(function(){var V=Vre({position:"absolute",left:0,top:0,transform:F,cursor:N},l);return Bt.createElement("div",{className:"mapboxgl-marker ".concat(s),ref:e.containerRef,style:V},i)},[i,s]),$=n.current;return $&&($.style.transform=F,$.style.cursor=N),U}nw.defaultProps=jre;nw.propTypes=Gre;Bt.memo(nw);var og={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}},Wre=Object.keys(og);function $re(r){var e=r.x,t=r.y,n=r.width,i=r.height,s=r.selfWidth,o=r.selfHeight,l=r.anchor,f=r.padding,A=f===void 0?0:f,v=og[l],T=v.x,I=v.y,F=t-I*o,N=F+o,U=Math.max(0,A-F)+Math.max(0,N-i+A);if(U>0){var $=I,V=U;for(I=0;I<=1;I+=.5)F=t-I*o,N=F+o,U=Math.max(0,A-F)+Math.max(0,N-i+A),U<V&&(V=U,$=I);I=$}var j=.5;I===.5&&(T=Math.floor(T),j=1);var X=e-T*s,ue=X+s,K=Math.max(0,A-X)+Math.max(0,ue-n+A);if(K>0){var se=T,Ee=K;for(T=0;T<=1;T+=j)X=e-T*s,ue=X+s,K=Math.max(0,A-X)+Math.max(0,ue-n+A),K<Ee&&(Ee=K,se=T);T=se}return Wre.find(function(Ue){var de=og[Ue];return de.x===T&&de.y===I})||l}var Xre=Object.assign({},Il,{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(og)),dynamicPosition:At.bool,sortByDepth:At.bool,onClose:At.func}
2598),qre=Object.assign({},rf,{className:"",altitude:0,offsetLeft:0,offsetTop:0,tipSize:10,anchor:"bottom",dynamicPosition:!0,sortByDepth:!1,closeButton:!0,closeOnClick:!0,onClose:function(){}});function Jre(r,e,t,n){var i=gs(n,2),s=i[0],o=i[1],l=r.anchor,f=r.dynamicPosition,A=r.tipSize;return t&&f?$re({x:s,y:o,anchor:l,padding:A,width:e.width,height:e.height,selfWidth:t.clientWidth,selfHeight:t.clientHeight}):l}function Kre(r,e,t,n,i){var s=gs(n,3),o=s[0],l=s[1],f=s[2],A=r.offsetLeft,v=r.offsetTop,T=r.sortByDepth,I=og[i],F=o+A,N=l+v,U=II(t,-I.x*100),$=II(t,-I.y*100,"y"),V={position:"absolute",transform:` 2599 translate(`.concat(U,"%, ").concat($,`%) 2600 translate(`).concat(sg(F),"px, ").concat(sg(N),`px) 2601 `),display:void 0,zIndex:void 0};return T&&(f>1||f<-1||o<0||o>e.width||l<0||l>e.height?V.display="none":V.zIndex=Math.floor((1-f)/2*1e5)),V}function iw(r){var e=Bt.useRef(null),t=nf(r),n=t.context,i=t.containerRef,s=Bt.useState(!1),o=gs(s,2),l=o[1];Bt.useEffect(function(){l(!0)},[e.current]),Bt.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,T=r.latitude,I=r.altitude,F=r.tipSize,N=r.closeButton,U=r.children,$=f.project([v,T,I]),V=Jre(r,f,e.current,$),j=Kre(r,f,i.current,$,V),X=Bt.useCallback(function(ue){t.props.onClose();var K=t.context.eventManager;K&&K.once("click",function(se){return se.stopPropagation()},ue.target)},[]);return Bt.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(V," ").concat(A),style:j,ref:i},Bt.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:F}}),Bt.createElement("div",{key:"content",ref:e,className:"mapboxgl-popup-content"},N&&Bt.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:X},"Ã"),U))}iw.propTypes=Xre;iw.defaultProps=qre;Bt.memo(iw);function PI(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 Zre(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?PI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):PI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Yre=Object.assign({},Il,{toggleLabel:At.string,className:At.string,style:At.object,compact:At.bool,customAttribution:At.oneOfType([At.string,At.arrayOf(At.string)])}),Qre=Object.assign({},rf,{className:"",toggleLabel:"Toggle Attribution"});function ene(r,e,t,n){var i=new fc.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 tne(r){r._map.off("styledata",r._updateData),r._map.off("sourcedata",r._updateData)}function sw(r){var e=nf(r),t=e.context,n=e.containerRef,i=Bt.useRef(null),s=Bt.useState(!1),o=gs(s,2),l=o[0],f=o[1];Bt.useEffect(function(){var I;return t.map&&(I=ene({customAttribution:r.customAttribution},t.map,n.current,i.current)),function(){return I&&tne(I)}},[t.map]);var A=r.compact===void 0?t.viewport.width<=640:r.compact;Bt.useEffect(function(){!A&&l&&f(!1)},[A]);var v=Bt.useCallback(function(){return f(function(I){return!I})},[]),T=Bt.useMemo(function(){return Zre({position:"absolute"},r.style)},[r.style]);return Bt.createElement("div",{style:T,className:r.className},Bt.createElement("div",{ref:n,"aria-pressed":l,className:"mapboxgl-ctrl mapboxgl-ctrl-attrib ".concat(A?"mapboxgl-compact":""," ").concat(l?"mapboxgl-compact-show":"")},Bt.createElement("button",{type:"button",className:"mapboxgl-ctrl-attrib-button",title:r.toggleLabel,onClick:v}),Bt.createElement("div",{ref:i,className:"mapboxgl-ctrl-attrib-inner",role:"list"})))}sw.propTypes=Yre;sw.defaultProps=Qre;Bt.memo(sw);function MI(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 rne(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
2601e%2?MI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):MI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var nne=Object.assign({},Il,{className:At.string,style:At.object,container:At.object,label:At.string}),ine=Object.assign({},rf,{className:"",container:null,label:"Toggle fullscreen"});function ow(r){var e=nf(r),t=e.context,n=e.containerRef,i=Bt.useState(!1),s=gs(i,2),o=s[0],l=s[1],f=Bt.useState(!1),A=gs(f,2),v=A[0],T=A[1],I=Bt.useState(null),F=gs(I,2),N=F[0],U=F[1];Bt.useEffect(function(){var K=new fc.FullscreenControl;U(K),T(K._checkFullscreenSupport());var se=function(){var Ue=!K._fullscreen;K._fullscreen=Ue,l(Ue)};return Wc.addEventListener(K._fullscreenchange,se),function(){Wc.removeEventListener(K._fullscreenchange,se)}},[]);var $=function(){N&&(N._container=r.container||t.container,N._onClickFullscreen())},V=Bt.useMemo(function(){return rne({position:"absolute"},r.style)},[r.style]);if(!v)return null;var j=r.className,X=r.label,ue=o?"shrink":"fullscreen";return Bt.createElement("div",{style:V,className:j},Bt.createElement("div",{className:"mapboxgl-ctrl mapboxgl-ctrl-group",ref:n},Bt.createElement("button",{key:ue,className:"mapboxgl-ctrl-icon mapboxgl-ctrl-".concat(ue),type:"button",title:X,onClick:$},Bt.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true"}))))}ow.propTypes=nne;ow.defaultProps=ine;Bt.memo(ow);var gd;function sne(){return gd!==void 0?Promise.resolve(gd):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(function(r){return gd=r.state!=="denied",gd}):(gd=!!window.navigator.geolocation,Promise.resolve(gd))}function RI(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 one(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?RI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):RI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var OI=function(){},ane=Object.assign({},Il,{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}),lne=Object.assign({},rf,{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 cne(r){var e=new fc.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 une(r,e,t){var n=new fc.GeolocateControl(e);n._container=Wc.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 fne(r,e){var t=e.context,n=e.props,i=cne(r),s=t.viewport.fitBounds(i,n.fitBoundsOptions),o=s.longitude,l=s.latitude,f=s.zoom,A=Object.assign({},t.viewport,{longitude:o,latitude:l,zoom:f}),v=new np(A),T=Object.assign({},v.getViewportProps(),Vc),I=n.onViewportChange||t.onViewportChange||OI,F=n.onViewStateChange||t.onViewStateChange||OI;F({viewState:T}),I(T)}function aw(r){var e=nf(r),t=e.context,n=e.containerRef,i=Bt.useRef(null),s=Bt.useState(null),o=gs(s,2),l=o[0],f=o[1],A=Bt.useState(!1),v=gs(A,2),T=v[0],I=v[1];Bt.useEffect(function(){var X;return t.map&&sne().then(function(ue){I(ue),i.current&&(X=une(t,r,i.current),X._updateCamera=function(K){return fne(K,e)},f(X))}),function(){X&&X._clearWatch()}},[t.map]);var F=Bt.useCallback(function(){l&&(l.options=e.props,l.trigger())},[l]);Bt.useEffect(function(){r.auto&&F()},[l,r.auto]),Bt.useEffect(function(){l&&l._onZoom()},[t.viewport.zoom]);var N=r.className,U=r.label,$=r.disabledLabel,V=r.trackUserLocation,j=Bt.useMemo(function(){return one({position:"absolute"},r.style)}
2601,[r.style]);return Bt.createElement("div",{style:j,className:N},Bt.createElement("div",{key:"geolocate-control",className:"mapboxgl-ctrl mapboxgl-ctrl-group",ref:n},Bt.createElement("button",{key:"geolocate",className:"mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",ref:i,disabled:!T,"aria-pressed":!V,type:"button",title:T?U:$,"aria-label":T?U:$,onClick:F},Bt.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true"}))))}aw.propTypes=ane;aw.defaultProps=lne;Bt.memo(aw);function hne(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 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 dne(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?DI(Object(t),!0).forEach(function(n){Er(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}var FI=function(){},pne=Object.assign({},Il,{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}),Ane=Object.assign({},rf,{className:"",showCompass:!0,showZoom:!0,zoomInLabel:"Zoom In",zoomOutLabel:"Zoom Out",compassLabel:"Reset North"}),gne=1,d2=2;function mne(r){return hne(r,"1.6.0")>=0?d2:gne}function Yv(r,e,t){var n=r.viewport,i=new np(Object.assign({},n,t)),s=Object.assign({},i.getViewportProps(),Vc),o=e.onViewportChange||r.onViewportChange||FI,l=e.onViewStateChange||r.onViewStateChange||FI;l({viewState:s}),o(s)}function Qv(r,e,t,n){return Bt.createElement("button",{key:r,className:"mapboxgl-ctrl-icon mapboxgl-ctrl-".concat(r),type:"button",title:e,onClick:t},n||Bt.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true"}))}function _ne(r){var e=Bt.useMemo(function(){return r.map?mne(r.map.version):d2},[r.map]),t=r.viewport.bearing,n={transform:"rotate(".concat(-t,"deg)")};return e===d2?Bt.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:n}):Bt.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:n})}function lw(r){var e=nf(r),t=e.context,n=e.containerRef,i=function(){Yv(t,r,{zoom:t.viewport.zoom+1})},s=function(){Yv(t,r,{zoom:t.viewport.zoom-1})},o=function(){Yv(t,r,{bearing:0,pitch:0})},l=r.className,f=r.showCompass,A=r.showZoom,v=r.zoomInLabel,T=r.zoomOutLabel,I=r.compassLabel,F=Bt.useMemo(function(){return dne({position:"absolute"},r.style)},[r.style]);return Bt.createElement("div",{style:F,className:l},Bt.createElement("div",{className:"mapboxgl-ctrl mapboxgl-ctrl-group",ref:n},A&&Qv("zoom-in",v,i),A&&Qv("zoom-out",T,s),f&&Qv("compass",I,o,_ne(t))))}lw.propTypes=pne;lw.defaultProps=Ane;const yne=Bt.memo(lw);function LI(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 vne(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?LI(Object(t),!0).forEach(function(n){Er(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):LI(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var bne=Object.assign({},Il,{className:At.string,style:At.object,maxWidth:At.number,unit:At.oneOf(["imperial","metric","nautical"])}),xne=Object.assign({},rf,{className:"",maxWidth:100,unit:"metric"});function cw(r){var e=nf(r),t=e.context,n=e.containerRef,i=Bt.useState(null),s=gs(i,2),o=s[0],l=s[1];Bt.useEffect(function(){if(t.map){var A=new fc.ScaleControl;A._map=t.map,A._container=n.current,l(A)}},[t.map]),o&&(o.options=r,o._onMove&&o._onMove());var f=Bt.useMemo(function(){return vne({position:"absolute"},r.style)}
2601,[r.style]);return Bt.createElement("div",{style:f,className:r.className},Bt.createElement("div",{ref:n,className:"mapboxgl-ctrl mapboxgl-ctrl-scale"}))}cw.propTypes=bne;cw.defaultProps=xne;Bt.memo(cw);Object.assign({},Il,{redraw:At.func.isRequired});Object.assign({},Il,{redraw:At.func.isRequired,style:At.object});Object.assign({},Il,{redraw:At.func.isRequired,style:At.object});fc&&fc.setRTLTextPlugin;const wne=()=>Gf(TN,{}),kI=ZR("div",{target:"e90uut00"})(({isStretchHeight:r})=>({position:"relative",height:"100%",width:"100%",...r&&{minHeight:"6.25rem"}})),Tne=ZR("div",{target:"e90uut01"})(({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:YR(r)?"":"invert(100%)"}}})),Ene=({container:r,element:e,heightFallback:t="auto",isFullScreen:n,shouldUseContainerWidth:i,widthFallback:s="auto"})=>{const o=Bt.useMemo(()=>i||n?"100%":e.width||r.width||s,[r.width,e.width,n,i,s]),l=Bt.useMemo(()=>n&&r.height?r.height:e.height||r.height||t,[n,e.height,r.height,t]);return{width:o,height:l}},NI=`uniform arcUniforms { 2602 bool greatCircle; 2603 bool useShortestPath; 2604 float numSegments; 2605 float widthScale; 2606 float widthMinPixels; 2607 float widthMaxPixels; 2608 highp int widthUnits; 2609} arc; 2610`,Cne={name:"arc",vs:NI,fs:NI,uniformTypes:{greatCircle:"f32",useShortestPath:"f32",numSegments:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",widthUnits:"i32"}},Sne=`#version 300 es 2611#define SHADER_NAME arc-layer-vertex-shader 2612in vec4 instanceSourceColors; 2613in vec4 instanceTargetColors; 2614in vec3 instanceSourcePositions; 2615in vec3 instanceSourcePositions64Low; 2616in vec3 instanceTargetPositions; 2617in vec3 instanceTargetPositions64Low; 2618in vec3 instancePickingColors; 2619in float instanceWidths; 2620in float instanceHeights; 2621in float instanceTilts; 2622out vec4 vColor; 2623out vec2 uv; 2624out float isValid; 2625float paraboloid(float distance, float sourceZ, float targetZ, float ratio) { 2626float deltaZ = targetZ - sourceZ; 2627float dh = distance * instanceHeights; 2628if (dh == 0.0) { 2629return sourceZ + deltaZ * ratio; 2630} 2631float unitZ = deltaZ / dh; 2632float p2 = unitZ * unitZ + 1.0; 2633float dir = step(deltaZ, 0.0); 2634float z0 = mix(sourceZ, targetZ, dir); 2635float r = mix(ratio, 1.0 - ratio, dir); 2636return sqrt(r * (p2 - r)) * dh + z0; 2637} 2638vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) { 2639vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize); 2640dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); 2641return dir_screenspace * offset_direction * width / 2.0; 2642} 2643float getSegmentRatio(float index) { 2644return smoothstep(0.0, 1.0, index / (arc.numSegments - 1.0)); 2645} 2646vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) { 2647float distance = length(source.xy - target.xy); 2648float z = paraboloid(distance, source.z, target.z, segmentRatio); 2649float tiltAngle = radians(instanceTilts); 2650vec2 tiltDirection = normalize(target.xy - source.xy); 2651vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle); 2652return vec3( 2653mix(source.xy, target.xy, segmentRatio) + tilt, 2654z * cos(tiltAngle) 2655); 2656} 2657float getAngularDist (vec2 source, vec2 target) { 2658vec2 sourceRadians = radians(source); 2659vec2 targetRadians = radians(target); 2660vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0); 2661vec2 shd_sq = sin_half_delta * sin_half_delta;
2662float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x; 2663return 2.0 * asin(sqrt(a)); 2664} 2665vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) { 2666vec2 lngLat; 2667if(abs(angularDist - PI) < 0.001) { 2668lngLat = (1.0 - t) * source.xy + t * target.xy; 2669} else { 2670float a = sin((1.0 - t) * angularDist); 2671float b = sin(t * angularDist); 2672vec3 p = source3D.yxz * a + target3D.yxz * b; 2673lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy)))); 2674} 2675float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t); 2676return vec3(lngLat, z); 2677} 2678void main(void) { 2679geometry.worldPosition = instanceSourcePositions; 2680geometry.worldPositionAlt = instanceTargetPositions; 2681float segmentIndex = float(gl_VertexID / 2); 2682float segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.; 2683float segmentRatio = getSegmentRatio(segmentIndex); 2684float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0)); 2685float nextSegmentRatio = getSegmentRatio(min(arc.numSegments - 1.0, segmentIndex + 1.0)); 2686float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0)); 2687isValid = 1.0; 2688uv = vec2(segmentRatio, segmentSide); 2689geometry.uv = uv; 2690geometry.pickingColor = instancePickingColors; 2691vec4 curr; 2692vec4 next; 2693vec3 source; 2694vec3 target; 2695if ((arc.greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 2696source = project_globe_(vec3(instanceSourcePositions.xy, 0.0)); 2697target = project_globe_(vec3(instanceTargetPositions.xy, 0.0)); 2698float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy); 2699vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio); 2700vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio); 2701vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio); 2702if (abs(currPos.x - prevPos.x) > 180.0) { 2703indexDir = -1.0; 2704isValid = 0.0; 2705} else if (abs(currPos.x - nextPos.x) > 180.0) { 2706indexDir = 1.0; 2707isValid = 0.0; 2708} 2709nextPos = indexDir < 0.0 ? prevPos : nextPos; 2710nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio; 2711if (isValid == 0.0) { 2712nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0; 2713float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x); 2714currPos = mix(currPos, nextPos, t); 2715segmentRatio = mix(segmentRatio, nextSegmentRatio, t); 2716} 2717vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio); 2718vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio); 2719curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position); 2720next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0)); 2721} else { 2722vec3 source_world = instanceSourcePositions; 2723vec3 target_world = instanceTargetPositions; 2724if (arc.useShortestPath) {
2725source_world.x = mod(source_world.x + 180., 360.0) - 180.; 2726target_world.x = mod(target_world.x + 180., 360.0) - 180.; 2727float deltaLng = target_world.x - source_world.x; 2728if (deltaLng > 180.) target_world.x -= 360.; 2729if (deltaLng < -180.) source_world.x -= 360.; 2730} 2731source = project_position(source_world, instanceSourcePositions64Low); 2732target = project_position(target_world, instanceTargetPositions64Low); 2733float antiMeridianX = 0.0; 2734if (arc.useShortestPath) { 2735if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 2736antiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE; 2737} 2738float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x); 2739if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) { 2740isValid = 0.0; 2741indexDir = sign(segmentRatio - thresholdRatio); 2742segmentRatio = thresholdRatio; 2743} 2744} 2745nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio; 2746vec3 currPos = interpolateFlat(source, target, segmentRatio); 2747vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio); 2748if (arc.useShortestPath) { 2749if (nextPos.x < antiMeridianX) { 2750currPos.x += TILE_SIZE; 2751nextPos.x += TILE_SIZE; 2752} 2753} 2754curr = project_common_position_to_clipspace(vec4(currPos, 1.0)); 2755next = project_common_position_to_clipspace(vec4(nextPos, 1.0)); 2756geometry.position = vec4(currPos, 1.0); 2757} 2758float widthPixels = clamp( 2759project_size_to_pixel(instanceWidths * arc.widthScale, arc.widthUnits), 2760arc.widthMinPixels, arc.widthMaxPixels 2761); 2762vec3 offset = vec3( 2763getExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels), 27640.0); 2765DECKGL_FILTER_SIZE(offset, geometry); 2766DECKGL_FILTER_GL_POSITION(curr, geometry); 2767gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0); 2768vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio); 2769vColor = vec4(color.rgb, color.a * layer.opacity); 2770DECKGL_FILTER_COLOR(vColor, geometry); 2771} 2772`,Ine=`#version 300 es 2773#define SHADER_NAME arc-layer-fragment-shader 2774precision highp float; 2775in vec4 vColor; 2776in vec2 uv; 2777in float isValid; 2778out vec4 fragColor; 2779void main(void) { 2780if (isValid == 0.0) { 2781discard; 2782} 2783fragColor = vColor; 2784geometry.uv = uv; 2785DECKGL_FILTER_COLOR(fragColor, geometry); 2786} 2787`,l_=[0,0,0,255],Bne={getSourcePosition:{type:"accessor",value:r=>r.sourcePosition},getTargetPosition:{type:"accessor",value:r=>r.targetPosition},getSourceColor:{type:"accessor",value:l_},getTargetColor:{type:"accessor",value:l_},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 yg extends Cs{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:Sne,fs:Ine,modules:[Ls,ma,Cne]})}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:l_},instanceTargetColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getTargetColor",defaultValue:l_},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:l,numSegments:f}=this.props,A={numSegments:f,widthUnits:Po[t],widthScale:n,widthMinPixels:i,widthMaxPixels:s,greatCircle:o,useShortestPath:l},v=this.state.model;v.shaderInputs.setProps({arc:A}),v.setVertexCount(f*2),v.draw(this.context.renderPass)}
2787_getModel(){return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-strip",isInstanced:!0})}}yg.layerName="ArcLayer";yg.defaultProps=Bne;const Pne=new Uint32Array([0,2,1,0,3,2]),Mne=new Float32Array([0,1,0,0,1,0,1,1]);function Rne(r,e){if(!e)return One(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,l=new Uint32Array(o),f=new Float32Array(i*s*2),A=new Float64Array(i*s*3);let v=0,T=0;for(let I=0;I<i;I++){const F=I/(i-1);for(let N=0;N<s;N++){const U=N/(s-1),$=Dne(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,I>0&&N>0&&(l[T++]=v-s,l[T++]=v-s-1,l[T++]=v-1,l[T++]=v-s,l[T++]=v-1,l[T++]=v),v++}}return{vertexCount:o,positions:A,indices:l,texCoords:f}}function One(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:Pne,texCoords:Mne}}function Dne(r,e,t){return wl(wl(r[0],r[1],t),wl(r[3],r[2],t),e)}const UI=`uniform bitmapUniforms { 2788 vec4 bounds; 2789 float coordinateConversion; 2790 float desaturate; 2791 vec3 tintColor; 2792 vec4 transparentColor; 2793} bitmap; 2794`,Fne={name:"bitmap",vs:UI,fs:UI,uniformTypes:{bounds:"vec4<f32>",coordinateConversion:"f32",desaturate:"f32",tintColor:"vec3<f32>",transparentColor:"vec4<f32>"}},Lne=`#version 300 es 2795#define SHADER_NAME bitmap-layer-vertex-shader 2796 2797in vec2 texCoords; 2798in vec3 positions; 2799in vec3 positions64Low; 2800 2801out vec2 vTexCoord; 2802out vec2 vTexPos; 2803 2804const vec3 pickingColor = vec3(1.0, 0.0, 0.0); 2805 2806void main(void) { 2807 geometry.worldPosition = positions; 2808 geometry.uv = texCoords; 2809 geometry.pickingColor = pickingColor; 2810 2811 gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position); 2812 DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2813 2814 vTexCoord = texCoords; 2815 2816 if (bitmap.coordinateConversion < -0.5) { 2817 vTexPos = geometry.position.xy + project.commonOrigin.xy; 2818 } else if (bitmap.coordinateConversion > 0.5) { 2819 vTexPos = geometry.worldPosition.xy; 2820 } 2821 2822 vec4 color = vec4(0.0); 2823 DECKGL_FILTER_COLOR(color, geometry); 2824} 2825`,kne=` 2826vec3 packUVsIntoRGB(vec2 uv) { 2827 // Extract the top 8 bits. We want values to be truncated down so we can add a fraction 2828 vec2 uv8bit = floor(uv * 256.); 2829 2830 // Calculate the normalized remainders of u and v parts that do not fit into 8 bits 2831 // Scale and clamp to 0-1 range 2832 vec2 uvFraction = fract(uv * 256.); 2833 vec2 uvFraction4bit = floor(uvFraction * 16.); 2834 2835 // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates 2836 float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.; 2837 2838 return vec3(uv8bit, fractions) / 255.; 2839} 2840`,Nne=`#version 300 es 2841#define SHADER_NAME bitmap-layer-fragment-shader 2842 2843#ifdef GL_ES 2844precision highp float; 2845#endif 2846 2847uniform sampler2D bitmapTexture; 2848 2849in vec2 vTexCoord; 2850in vec2 vTexPos; 2851 2852out vec4 fragColor; 2853 2854/* projection utils */ 2855const float TILE_SIZE = 512.0; 2856const float PI = 3.1415926536; 2857const float WORLD_SCALE = TILE_SIZE / PI / 2.0; 2858 2859// from degrees to Web Mercator 2860vec2 lnglat_to_mercator(vec2 lnglat) { 2861 float x = lnglat.x; 2862 float y = clamp(lnglat.y, -89.9, 89.9); 2863 return vec2( 2864 radians(x) + PI, 2865 PI + log(tan(PI * 0.25 + radians(y) * 0.5)) 2866 ) * WORLD_SCALE; 2867} 2868 2869// from Web Mercator to degrees 2870vec2 mercator_to_lnglat(vec2 xy) { 2871 xy /= WORLD_SCALE; 2872 return degrees(vec2( 2873 xy.x - PI, 2874 atan(exp(xy.y - PI)) * 2.0 - PI * 0.5 2875 )); 2876} 2877/* End projection utils */ 2878 2879// apply desaturation 2880vec3 color_desaturate(vec3 color) { 2881 float luminance = (color.r + color.g + color.b) * 0.333333333; 2882 return mix(color, vec3(luminance), bitmap.desaturate); 2883} 2884 2885// apply tint 2886vec3 color_tint(vec3 color) { 2887 return color * bitmap.tintColor; 2888} 2889 2890// blend with background color 2891vec4 apply_opacity(vec3 color, float alpha) { 2892 if (bitmap.transparentColor.a == 0.0) { 2893 return vec4(color, alpha); 2894 } 2895 float blendedAlpha = alpha + bitmap.transparentColor.a * (1.0 - alpha); 2896 float highLightRatio = alpha / blendedAlpha; 2897 vec3 blendedRGB = mix(bitmap.transparentColor.rgb, color, highLightRatio); 2898 return vec4(blendedRGB, blendedAlpha); 2899} 2900 2901vec2 getUV(vec2 pos) { 2902 return vec2( 2903 (pos.x - bitmap.bounds[0]) / (bitmap.bounds[2] - bitmap.bounds[0]), 2904 (pos.y - bitmap.bounds[3]) / (bitmap.bounds[1] - bitmap.bounds[3]) 2905 ); 2906} 2907 2908${kne} 2909 2910void main(void) { 2911 vec2 uv = vTexCoord; 2912 if (bitmap.coordinateConversion < -0.5) { 2913 vec2 lnglat = mercator_to_lnglat(vTexPos); 2914 uv = getUV(lnglat); 2915 } else if (bitmap.coordinateConversion > 0.5) { 2916 vec2 commonPos = lnglat_to_mercator(vTexPos); 2917 uv = getUV(commonPos); 2918 } 2919 vec4 bitmapColor = texture(bitmapTexture, uv); 2920 2921 fragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * layer.opacity); 2922 2923 geometry.uv = uv; 2924 DECKGL_FILTER_COLOR(fragColor, geometry); 2925 2926 if (bool(picking.isActive) && !bool(picking.isAttribute)) { 2927 // Since instance information is not used, we can use picking color for pixel index 2928 fragColor.rgb = packUVsIntoRGB(uv); 2929 } 2930} 2931`,Une={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}};class $_ extends Cs{getShaders(){return super.getShaders({vs:Lne,fs:Nne,modules:[Ls,ma,Fne]})}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 l in o)s&&s[l]!==o[l]&&i.invalidate(l);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=zne(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 zI(e)&&(t=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),Rne(t,this.context.viewport.resolution)}
2931_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:l,desaturate:f,transparentColor:A,tintColor:v}=this.props;if(!(t.picking.isActive&&o)&&l&&n){const T={bitmapTexture:l,bounds:s,coordinateConversion:i,desaturate:f,tintColor:v.slice(0,3).map(I=>I/255),transparentColor:A.map(I=>I/255)};n.shaderInputs.setProps({bitmap:T}),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(!zI(s))throw new Error("_imageCoordinateSystem only supports rectangular bounds");const o=this.context.viewport.resolution?e:t;if(i=i===e?e:t,i===e&&o===t)return{coordinateConversion:-1,bounds:s};if(i===t&&o===e){const l=Yc([s[0],s[1]]),f=Yc([s[2],s[3]]);return{coordinateConversion:1,bounds:[l[0],l[1],f[0],f[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}}$_.layerName="BitmapLayer";$_.defaultProps=Une;function zne(r){const[e,t,n]=r,i=(n&240)/256,s=(n&15)/16;return[(e+s)/256,(t+i)/256]}function zI(r){return Number.isFinite(r[0])}const VI=`uniform iconUniforms { 2932 float sizeScale; 2933 vec2 iconsTextureDim; 2934 float sizeMinPixels; 2935 float sizeMaxPixels; 2936 bool billboard; 2937 highp int sizeUnits; 2938 float alphaCutoff; 2939} icon; 2940`,Vne={name:"icon",vs:VI,fs:VI,uniformTypes:{sizeScale:"f32",iconsTextureDim:"vec2<f32>",sizeMinPixels:"f32",sizeMaxPixels:"f32",billboard:"f32",sizeUnits:"i32",alphaCutoff:"f32"}},Gne=`#version 300 es 2941#define SHADER_NAME icon-layer-vertex-shader 2942in vec2 positions; 2943in vec3 instancePositions; 2944in vec3 instancePositions64Low; 2945in float instanceSizes; 2946in float instanceAngles; 2947in vec4 instanceColors; 2948in vec3 instancePickingColors; 2949in vec4 instanceIconFrames; 2950in float instanceColorModes; 2951in vec2 instanceOffsets; 2952in vec2 instancePixelOffset; 2953out float vColorMode; 2954out vec4 vColor; 2955out vec2 vTextureCoords; 2956out vec2 uv; 2957vec2 rotate_by_angle(vec2 vertex, float angle) { 2958float angle_radian = angle * PI / 180.0; 2959float cos_angle = cos(angle_radian); 2960float sin_angle = sin(angle_radian); 2961mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 2962return rotationMatrix * vertex; 2963} 2964void main(void) { 2965geometry.worldPosition = instancePositions; 2966geometry.uv = positions; 2967geometry.pickingColor = instancePickingColors; 2968uv = positions; 2969vec2 iconSize = instanceIconFrames.zw; 2970float sizePixels = clamp( 2971project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
2972icon.sizeMinPixels, icon.sizeMaxPixels 2973); 2974float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y; 2975vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets; 2976pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale; 2977pixelOffset += instancePixelOffset; 2978pixelOffset.y *= -1.0; 2979if (icon.billboard) { 2980gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 2981DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2982vec3 offset = vec3(pixelOffset, 0.0); 2983DECKGL_FILTER_SIZE(offset, geometry); 2984gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 2985} else { 2986vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 2987DECKGL_FILTER_SIZE(offset_common, geometry); 2988gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 2989DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2990} 2991vTextureCoords = mix( 2992instanceIconFrames.xy, 2993instanceIconFrames.xy + iconSize, 2994(positions.xy + 1.0) / 2.0 2995) / icon.iconsTextureDim; 2996vColor = instanceColors; 2997DECKGL_FILTER_COLOR(vColor, geometry); 2998vColorMode = instanceColorModes; 2999} 3000`,jne=`#version 300 es 3001#define SHADER_NAME icon-layer-fragment-shader 3002precision highp float; 3003uniform sampler2D iconsTexture; 3004in float vColorMode; 3005in vec4 vColor; 3006in vec2 vTextureCoords; 3007in vec2 uv; 3008out vec4 fragColor; 3009void main(void) { 3010geometry.uv = uv; 3011vec4 texColor = texture(iconsTexture, vTextureCoords); 3012vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode); 3013float a = texColor.a * layer.opacity * vColor.a; 3014if (a < icon.alphaCutoff) { 3015discard; 3016} 3017fragColor = vec4(color, a); 3018DECKGL_FILTER_COLOR(fragColor, geometry); 3019} 3020`,Hne=1024,Wne=4,GI=()=>{},jI={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},$ne={x:0,y:0,width:0,height:0};function Xne(r){return Math.pow(2,Math.ceil(Math.log2(r)))}function qne(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 ag(r){return r&&(r.id||r.url)}function Jne(r,e,t,n){const{width:i,height:s,device:o}=r,l=o.createTexture({format:"rgba8unorm",width:e,height:t,sampler:n,mipmaps:!0}),f=o.createCommandEncoder();return f.copyTextureToTexture({sourceTexture:r,destinationTexture:l,width:i,height:s}),f.finish(),r.destroy(),l}function HI(r,e,t){for(let n=0;n<e.length;n++){const{icon:i,xOffset:s}=e[n],o=ag(i);r[o]={...i,x:s,y:t}}}function Kne({icons:r,buffer:e,mapping:t={},xOffset:n=0,yOffset:i=0,rowHeight:s=0,canvasWidth:o}){let l=[];for(let f=0;f<r.length;f++){const A=r[f],v=ag(A);if(!t[v]){const{height:T,width:I}=A;n+I+e>o&&(HI(t,l,i),n=0,i=s+i+e,s=0,l=[]),l.push({icon:A,xOffset:n}),n=n+I+e,s=Math.max(s,T)}}return l.length>0&&HI(t,l,i),{mapping:t,rowHeight:s,xOffset:n,yOffset:i,canvasWidth:o,canvasHeight:Xne(s+i+e)}}function Zne(r,e,t){if(!r||!e)return null;t=t||{};const n={},{iterable:i,objectInfo:s}=dc(r);for(const o of i){s.index++;const l=e(o,s),f=ag(l);if(!l)throw new Error("Icon is missing.");if(!l.url)throw new Error("Icon url is missing.");!n[f]&&(!t[f]||l.url!==t[f].url)&&(n[f]={...l,source:o,sourceIndex:s.index})}return n}class Yne{constructor(e,{onUpdate:t=GI,onError:n=GI}){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=Wne,this._canvasWidth=Hne,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?ag(e):e;return this._mapping[t]||$ne}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(Zne(e,t,this._mapping)||{});if(n.length>0){const{mapping:i,xOffset:s,yOffset:o,rowHeight:l,canvasHeight:f}=Kne({icons:n,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=l,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||jI,mipmaps:!0})),this._texture.height!==this._canvasHeight&&(this._texture=Jne(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||jI)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(n)}}_loadIcons(e){const t=this._canvas.getContext("2d",{willReadFrequently:!0});
3020for(const n of e)this._pendingCount++,Kc(n.url,this._loadOptions).then(i=>{const s=ag(n),o=this._mapping[s],{x:l,y:f,width:A,height:v}=o,{image:T,width:I,height:F}=qne(t,i,A,v);this._texture?.copyExternalImage({image:T,x:l+(A-I)/2,y:f+(v-F)/2,width:I,height:F}),o.width=I,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 jF=[0,0,0,255],Qne={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:jF},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 Sp extends Cs{getShaders(){return super.getShaders({vs:Gne,fs:jne,modules:[Ls,ma,Vne]})}initializeState(){this.state={iconManager:new Yne(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:jF},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:l,data:f,getIcon:A,textureParameters:v}=t,{iconManager:T}=this.state;if(typeof o=="string")return;const I=o||this.internalState.isAsyncPropLoading("iconAtlas");T.setProps({loadOptions:t.loadOptions,autoPacking:!I,iconAtlas:o,iconMapping:I?l:null,textureParameters:v}),I?n.iconMapping!==t.iconMapping&&s.invalidate("getIcon"):(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getIcon))&&T.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:l}=this.props,{iconManager:f}=this.state,A=f.getTexture();if(A){const v=this.state.model,T={iconsTexture:A,iconsTextureDim:[A.width,A.height],sizeUnits:Po[s],sizeScale:t,sizeMinPixels:n,sizeMaxPixels:i,billboard:o,alphaCutoff:l};v.shaderInputs.setProps({icon:T}),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 Zs({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):Zr.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]}}Sp.defaultProps=Qne;Sp.layerName="IconLayer";const eie=`struct LineUniforms { 3021 widthScale: f32, 3022 widthMinPixels: f32, 3023 widthMaxPixels: f32, 3024 useShortestPath: f32, 3025 widthUnits: i32, 3026}; 3027 3028@group(0) @binding(1) 3029var<uniform> line: LineUniforms; 3030`,WI=`uniform lineUniforms { 3031 float widthScale; 3032 float widthMinPixels; 3033 float widthMaxPixels;
3034 float useShortestPath; 3035 highp int widthUnits; 3036} line; 3037`,tie={name:"line",source:eie,vs:WI,fs:WI,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",useShortestPath:"f32",widthUnits:"i32"}},rie=`// TODO(ibgreen): Hack for Layer uniforms (move to new "color" module?) 3038struct LayerUniforms { 3039 opacity: f32, 3040}; 3041var<private> layer: LayerUniforms = LayerUniforms(1.0); 3042// @group(0) @binding(1) var<uniform> layer: LayerUniforms; 3043 3044// ---------- Helper Structures & Functions ---------- 3045 3046// Placeholder filter functions. 3047fn deckgl_filter_size(offset: vec3<f32>, geometry: Geometry) -> vec3<f32> { 3048 return offset; 3049} 3050fn deckgl_filter_gl_position(p: vec4<f32>, geometry: Geometry) -> vec4<f32> { 3051 return p; 3052} 3053fn deckgl_filter_color(color: vec4<f32>, geometry: Geometry) -> vec4<f32> { 3054 return color; 3055} 3056 3057// Compute an extrusion offset given a line direction (in clipspace), 3058// an offset direction (-1 or 1), and a width in pixels. 3059// Assumes a uniform "project" with a viewportSize field is available. 3060fn getExtrusionOffset(line_clipspace: vec2<f32>, offset_direction: f32, width: f32) -> vec2<f32> { 3061 // project.viewportSize should be provided as a uniform (not shown here) 3062 let dir_screenspace = normalize(line_clipspace * project.viewportSize); 3063 // Rotate by 90°: (x,y) becomes (-y,x) 3064 let rotated = vec2<f32>(-dir_screenspace.y, dir_screenspace.x); 3065 return rotated * offset_direction * width / 2.0; 3066} 3067 3068// Splits the line between two points at a given x coordinate. 3069// Interpolates the y and z components. 3070fn splitLine(a: vec3<f32>, b: vec3<f32>, x: f32) -> vec3<f32> { 3071 let t: f32 = (x - a.x) / (b.x - a.x); 3072 return vec3<f32>(x, a.yz + t * (b.yz - a.yz)); 3073} 3074 3075// ---------- Uniforms & Global Structures ---------- 3076 3077// Uniforms for line, layer, and project are assumed to be defined elsewhere. 3078// For example: 3079// 3080// @group(0) @binding(0) 3081// var<uniform> line: LineUniform; 3082// 3083// struct LayerUniform { 3084// opacity: f32, 3085// }; 3086// @group(0) @binding(1) 3087// var<uniform> layer: LayerUniform; 3088// 3089// struct ProjectUniform { 3090// viewportSize: vec2<f32>, 3091// }; 3092// @group(0) @binding(2) 3093// var<uniform> project: ProjectUniform; 3094 3095 3096 3097// ---------- Vertex Output Structure ---------- 3098 3099struct Varyings { 3100 @builtin(position) gl_Position: vec4<f32>, 3101 @location(0) vColor: vec4<f32>, 3102 @location(1) uv: vec2<f32>, 3103}; 3104 3105// ---------- Vertex Shader Entry Point ---------- 3106 3107@vertex 3108fn vertexMain( 3109 @location(0) positions: vec3<f32>, 3110 @location(1) instanceSourcePositions: vec3<f32>, 3111 @location(2) instanceTargetPositions: vec3<f32>, 3112 @location(3) instanceSourcePositions64Low: vec3<f32>, 3113 @location(4) instanceTargetPositions64Low: vec3<f32>, 3114 @location(5) instanceColors: vec4<f32>, 3115 @location(6) instancePickingColors: vec3<f32>, 3116 @location(7) instanceWidths: f32 3117) -> Varyings { 3118 var geometry: Geometry; 3119 geometry.worldPosition = instanceSourcePositions; 3120 geometry.worldPositionAlt = instanceTargetPositions; 3121 3122 var source_world: vec3<f32> = instanceSourcePositions; 3123 var target_world: vec3<f32> = instanceTargetPositions; 3124 var source_world_64low: vec3<f32> = instanceSourcePositions64Low; 3125 var target_world_64low: vec3<f32> = instanceTargetPositions64Low; 3126 3127 // Apply shortest-path adjustments if needed. 3128 if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) { 3129 source_world.x = (source_world.x + 180.0 % 360.0) - 180.0; 3130 target_world.x = (target_world.x + 180.0 % 360.0) - 180.0; 3131 let deltaLng: f32 = target_world.x - source_world.x; 3132 3133 if (deltaLng * line.useShortestPath > 180.0) { 3134 source_world.x = source_world.x + 360.0 * line.useShortestPath; 3135 source_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath); 3136 source_world_64low = vec3<f32>(0.0, 0.0, 0.0); 3137 } else if (deltaLng * line.useShortestPath < -180.0) { 3138 target_world.x = target_world.x + 360.0 * line.useShortestPath; 3139 target_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath); 3140 target_world_64low = vec3<f32>(0.0, 0.0, 0.0); 3141 } else if (line.useShortestPath < 0.0) { 3142 var abortOut: Varyings; 3143 abortOut.gl_Position = vec4<f32>(0.0); 3144 abortOut.vColor = vec4<f32>(0.0); 3145 abortOut.uv = vec2<f32>(0.0); 3146 return abortOut; 3147 } 3148 } 3149 3150 // Project Pos and target positions to clip space. 3151 let sourceResult = project_position_to_clipspace_and_commonspace(source_world, source_world_64low, vec3<f32>(0.0)); 3152 let targetResult = project_position_to_clipspace_and_commonspace(target_world, target_world_64low, vec3<f32>(0.0)); 3153 let sourcePos: vec4<f32> = sourceResult.clipPosition; 3154 let targetPos: vec4<f32> = targetResult.clipPosition; 3155 let source_commonspace: vec4<f32> = sourceResult.commonPosition; 3156 let target_commonspace: vec4<f32> = targetResult.commonPosition; 3157 3158 // Interpolate along the line segment. 3159 let segmentIndex: f32 = positions.x; 3160 let p: vec4<f32> = sourcePos + segmentIndex * (targetPos - sourcePos); 3161 geometry.position = source_commonspace + segmentIndex * (target_commonspace - source_commonspace); 3162 let uv: vec2<f32> = positions.xy; 3163 geometry.uv = uv; 3164 geometry.pickingColor = instancePickingColors; 3165 3166 // Determine width in pixels. 3167 let widthPixels: f32 = clamp( 3168 project_unit_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits), 3169 line.widthMinPixels, line.widthMaxPixels 3170 ); 3171 3172 // Compute extrusion offset. 3173 let extrusion: vec2<f32> = getExtrusionOffset(targetPos.xy - sourcePos.xy, positions.y, widthPixels); 3174 let offset: vec3<f32> = vec3<f32>(extrusion, 0.0); 3175 3176 // Apply deck.gl filter functions. 3177 let filteredOffset = deckgl_filter_size(offset, geometry); 3178 let filteredP = deckgl_filter_gl_position(p, geometry); 3179 3180 let clipOffset: vec2<f32> = project_pixel_size_to_clipspace(filteredOffset.xy); 3181 let finalPosition: vec4<f32>
3181 = filteredP + vec4<f32>(clipOffset, 0.0, 0.0); 3182 3183 // Compute color. 3184 var vColor: vec4<f32> = vec4<f32>(instanceColors.rgb, instanceColors.a * layer.opacity); 3185 // vColor = deckgl_filter_color(vColor, geometry); 3186 3187 var output: Varyings; 3188 output.gl_Position = finalPosition; 3189 output.vColor = vColor; 3190 output.uv = uv; 3191 return output; 3192} 3193 3194@fragment 3195fn fragmentMain( 3196 @location(0) vColor: vec4<f32>, 3197 @location(1) uv: vec2<f32> 3198) -> @location(0) vec4<f32> { 3199 // Create and initialize geometry with the provided uv. 3200 var geometry: Geometry; 3201 geometry.uv = uv; 3202 3203 // Start with the input color. 3204 var fragColor: vec4<f32> = vColor; 3205 3206 // Apply the deck.gl filter to the color. 3207 fragColor = deckgl_filter_color(fragColor, geometry); 3208 3209 return fragColor; 3210} 3211`,nie=`#version 300 es 3212#define SHADER_NAME line-layer-vertex-shader 3213in vec3 positions; 3214in vec3 instanceSourcePositions; 3215in vec3 instanceTargetPositions; 3216in vec3 instanceSourcePositions64Low; 3217in vec3 instanceTargetPositions64Low; 3218in vec4 instanceColors; 3219in vec3 instancePickingColors; 3220in float instanceWidths; 3221out vec4 vColor; 3222out vec2 uv; 3223vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) { 3224vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize); 3225dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); 3226return dir_screenspace * offset_direction * width / 2.0; 3227} 3228vec3 splitLine(vec3 a, vec3 b, float x) { 3229float t = (x - a.x) / (b.x - a.x); 3230return vec3(x, mix(a.yz, b.yz, t)); 3231} 3232void main(void) { 3233geometry.worldPosition = instanceSourcePositions; 3234geometry.worldPositionAlt = instanceTargetPositions; 3235vec3 source_world = instanceSourcePositions; 3236vec3 target_world = instanceTargetPositions; 3237vec3 source_world_64low = instanceSourcePositions64Low; 3238vec3 target_world_64low = instanceTargetPositions64Low; 3239if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) {
3240source_world.x = mod(source_world.x + 180., 360.0) - 180.; 3241target_world.x = mod(target_world.x + 180., 360.0) - 180.; 3242float deltaLng = target_world.x - source_world.x; 3243if (deltaLng * line.useShortestPath > 180.) { 3244source_world.x += 360. * line.useShortestPath; 3245source_world = splitLine(source_world, target_world, 180. * line.useShortestPath); 3246source_world_64low = vec3(0.0); 3247} else if (deltaLng * line.useShortestPath < -180.) { 3248target_world.x += 360. * line.useShortestPath; 3249target_world = splitLine(source_world, target_world, 180. * line.useShortestPath); 3250target_world_64low = vec3(0.0); 3251} else if (line.useShortestPath < 0.) { 3252gl_Position = vec4(0.); 3253return; 3254} 3255} 3256vec4 source_commonspace; 3257vec4 target_commonspace; 3258vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace); 3259vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace); 3260float segmentIndex = positions.x; 3261vec4 p = mix(source, target, segmentIndex); 3262geometry.position = mix(source_commonspace, target_commonspace, segmentIndex); 3263uv = positions.xy; 3264geometry.uv = uv; 3265geometry.pickingColor = instancePickingColors; 3266float widthPixels = clamp( 3267project_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits), 3268line.widthMinPixels, line.widthMaxPixels 3269); 3270vec3 offset = vec3( 3271getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels), 32720.0); 3273DECKGL_FILTER_SIZE(offset, geometry); 3274DECKGL_FILTER_GL_POSITION(p, geometry); 3275gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0); 3276vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity); 3277DECKGL_FILTER_COLOR(vColor, geometry); 3278} 3279`,iie=`#version 300 es 3280#define SHADER_NAME line-layer-fragment-shader 3281precision highp float; 3282in vec4 vColor; 3283in vec2 uv; 3284out vec4 fragColor; 3285void main(void) { 3286geometry.uv = uv; 3287fragColor = vColor; 3288DECKGL_FILTER_COLOR(fragColor, geometry); 3289} 3290`,sie=[0,0,0,255],oie={getSourcePosition:{type:"accessor",value:r=>r.sourcePosition},getTargetPosition:{type:"accessor",value:r=>r.targetPosition},getColor:{type:"accessor",value:sie},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 X_ extends Cs{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:nie,fs:iie,source:rie,modules:[Ls,ma,tie]})}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,l=this.state.model,f={widthUnits:Po[t],widthScale:n,widthMinPixels:i,widthMaxPixels:s,useShortestPath:o?1:0};l.shaderInputs.setProps({line:f}),l.draw(this.context.renderPass),o&&(l.shaderInputs.setProps({line:{...f,useShortestPath:-1}}),l.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 Zs({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}}X_.layerName="LineLayer";X_.defaultProps=oie;const $I=`uniform pointCloudUniforms { 3291 float radiusPixels; 3292 highp int sizeUnits; 3293} pointCloud;
3294`,aie={name:"pointCloud",vs:$I,fs:$I,uniformTypes:{radiusPixels:"f32",sizeUnits:"i32"}},lie=`#version 300 es 3295#define SHADER_NAME point-cloud-layer-vertex-shader 3296in vec3 positions; 3297in vec3 instanceNormals; 3298in vec4 instanceColors; 3299in vec3 instancePositions; 3300in vec3 instancePositions64Low; 3301in vec3 instancePickingColors; 3302out vec4 vColor; 3303out vec2 unitPosition; 3304void main(void) { 3305geometry.worldPosition = instancePositions; 3306geometry.normal = project_normal(instanceNormals); 3307unitPosition = positions.xy; 3308geometry.uv = unitPosition; 3309geometry.pickingColor = instancePickingColors; 3310vec3 offset = vec3(positions.xy * project_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0); 3311DECKGL_FILTER_SIZE(offset, geometry); 3312gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position); 3313DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3314gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 3315vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 3316vColor = vec4(lightColor, instanceColors.a * layer.opacity); 3317DECKGL_FILTER_COLOR(vColor, geometry); 3318} 3319`,cie=`#version 300 es 3320#define SHADER_NAME point-cloud-layer-fragment-shader 3321precision highp float; 3322in vec4 vColor; 3323in vec2 unitPosition; 3324out vec4 fragColor; 3325void main(void) { 3326geometry.uv = unitPosition.xy; 3327float distToCenter = length(unitPosition); 3328if (distToCenter > 1.0) { 3329discard; 3330} 3331fragColor = vColor; 3332DECKGL_FILTER_COLOR(fragColor, geometry); 3333} 3334`,HF=[0,0,0,255],WF=[0,0,1],uie={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:r=>r.position},getNormal:{type:"accessor",value:WF},getColor:{type:"accessor",value:HF},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};function fie(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 vg extends Cs{getShaders(){return super.getShaders({vs:lie,fs:cie,modules:[Ls,M_,ma,aie]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:WF},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:HF}})}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&&fie(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 Zs({topology:"triangle-list",attributes:{positions:new Float32Array(e)}}),isInstanced:!0})}}vg.layerName="PointCloudLayer";vg.defaultProps=uie;const XI=`uniform scatterplotUniforms { 3335 float radiusScale; 3336 float radiusMinPixels; 3337 float radiusMaxPixels; 3338 float lineWidthScale; 3339 float lineWidthMinPixels; 3340 float lineWidthMaxPixels; 3341 float stroked; 3342 float filled; 3343 bool antialiasing; 3344 bool billboard; 3345 highp int radiusUnits; 3346 highp int lineWidthUnits; 3347} scatterplot; 3348`,hie={name:"scatterplot",vs:XI,fs:XI,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"}},die=`#version 300 es 3349#define SHADER_NAME scatterplot-layer-vertex-shader 3350in vec3 positions; 3351in vec3 instancePositions; 3352in vec3 instancePositions64Low; 3353in float instanceRadius; 3354in float instanceLineWidths; 3355in vec4 instanceFillColors; 3356in vec4 instanceLineColors; 3357in vec3 instancePickingColors; 3358out vec4 vFillColor; 3359out vec4 vLineColor; 3360out vec2 unitPosition; 3361out float innerUnitRadius; 3362out float outerRadiusPixels; 3363void main(void) { 3364geometry.worldPosition = instancePositions; 3365outerRadiusPixels = clamp( 3366project_size_to_pixel(scatterplot.radiusScale * instanceRadius, scatterplot.radiusUnits), 3367scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels 3368); 3369float lineWidthPixels = clamp( 3370project_size_to_pixel(scatterplot.lineWidthScale * instanceLineWidths, scatterplot.lineWidthUnits), 3371scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels 3372); 3373outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0; 3374float edgePadding = scatterplot.antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0; 3375unitPosition = edgePadding * positions.xy; 3376geometry.uv = unitPosition; 3377geometry.pickingColor = instancePickingColors; 3378innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / outerRadiusPixels; 3379if (scatterplot.billboard) { 3380gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 3381DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3382vec3 offset = edgePadding * positions * outerRadiusPixels; 3383DECKGL_FILTER_SIZE(offset, geometry); 3384gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 3385} else { 3386vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels); 3387DECKGL_FILTER_SIZE(offset, geometry); 3388gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position); 3389DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3390} 3391vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity); 3392DECKGL_FILTER_COLOR(vFillColor, geometry); 3393vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity); 3394DECKGL_FILTER_COLOR(vLineColor, geometry); 3395} 3396`,pie=`#version 300 es 3397#define SHADER_NAME scatterplot-layer-fragment-shader 3398precision highp float; 3399in vec4 vFillColor; 3400in vec4 vLineColor; 3401in vec2 unitPosition; 3402in float innerUnitRadius; 3403in float outerRadiusPixels; 3404out vec4 fragColor; 3405void main(void) { 3406geometry.uv = unitPosition; 3407float distToCenter = length(unitPosition) * outerRadiusPixels; 3408float inCircle = scatterplot.antialiasing ? 3409smoothedge(distToCenter, outerRadiusPixels) : 3410step(distToCenter, outerRadiusPixels); 3411if (inCircle == 0.0) { 3412discard; 3413} 3414if (scatterplot.stroked > 0.5) { 3415float isLine = scatterplot.antialiasing ? 3416smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) : 3417step(innerUnitRadius * outerRadiusPixels, distToCenter); 3418if (scatterplot.filled > 0.5) { 3419fragColor = mix(vFillColor, vLineColor, isLine); 3420} else { 3421if (isLine == 0.0) { 3422discard; 3423} 3424fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine); 3425} 3426} else if (scatterplot.filled < 0.5) { 3427discard; 3428} else { 3429fragColor = vFillColor; 3430} 3431fragColor.a *= inCircle; 3432DECKGL_FILTER_COLOR(fragColor, geometry); 3433} 3434`,Aie=`// TODO(ibgreen): Hack for Layer uniforms (move to new "color" module?) 3435 3436struct LayerUniforms { 3437 opacity: f32, 3438}; 3439 3440var<private> layer: LayerUniforms = LayerUniforms(1.0); 3441// @group(0) @binding(1) var<uniform> layer: LayerUniforms; 3442 3443// Main shaders 3444 3445struct ScatterplotUniforms { 3446 radiusScale: f32, 3447 radiusMinPixels: f32, 3448 radiusMaxPixels: f32, 3449 lineWidthScale: f32, 3450 lineWidthMinPixels: f32, 3451 lineWidthMaxPixels: f32, 3452 stroked: f32, 3453 filled: i32, 3454 antialiasing: i32, 3455 billboard: i32, 3456 radiusUnits: i32, 3457 lineWidthUnits: i32, 3458}; 3459 3460struct ConstantAttributeUniforms { 3461 instancePositions: vec3<f32>, 3462 instancePositions64Low: vec3<f32>, 3463 instanceRadius: f32, 3464 instanceLineWidths: f32, 3465 instanceFillColors: vec4<f32>, 3466 instanceLineColors: vec4<f32>, 3467 instancePickingColors: vec3<f32>, 3468 3469 instancePositionsConstant: i32, 3470 instancePositions64LowConstant: i32, 3471 instanceRadiusConstant: i32, 3472 instanceLineWidthsConstant: i32, 3473 instanceFillColorsConstant: i32, 3474 instanceLineColorsConstant: i32, 3475 instancePickingColorsConstant: i32 3476}; 3477 3478@group(0) @binding(2) var<uniform> scatterplot: ScatterplotUniforms; 3479 3480struct ConstantAttributes { 3481 instancePositions: vec3<f32>, 3482 instancePositions64Low: vec3<f32>, 3483 instanceRadius: f32, 3484 instanceLineWidths: f32, 3485 instanceFillColors: vec4<f32>, 3486 instanceLineColors: vec4<f32>, 3487 instancePickingColors: vec3<f32> 3488}; 3489 3490const constants = ConstantAttributes( 3491 vec3<f32>(0.0), 3492 vec3<f32>(0.0), 3493 0.0, 3494 0.0, 3495 vec4<f32>(0.0, 0.0, 0.0, 1.0), 3496 vec4<f32>(0.0, 0.0, 0.0, 1.0), 3497 vec3<f32>(0.0) 3498); 3499 3500struct Attributes { 3501 @builtin(instance_index) instanceIndex : u32, 3502 @builtin(vertex_index) vertexIndex : u32, 3503 @location(0) positions: vec3<f32>, 3504 @location(1) instancePositions: vec3<f32>, 3505 @location(2) instancePositions64Low: vec3<f32>, 3506 @location(3) instanceRadius: f32, 3507 @location(4) instanceLineWidths: f32, 3508 @location(5) instanceFillColors: vec4<f32>, 3509 @location(6) instanceLineColors: vec4<f32>, 3510 @location(7) instancePickingColors: vec3<f32> 3511}; 3512
3513struct Varyings { 3514 @builtin(position) position: vec4<f32>, 3515 @location(0) vFillColor: vec4<f32>, 3516 @location(1) vLineColor: vec4<f32>, 3517 @location(2) unitPosition: vec2<f32>, 3518 @location(3) innerUnitRadius: f32, 3519 @location(4) outerRadiusPixels: f32, 3520}; 3521 3522@vertex 3523fn vertexMain(attributes: Attributes) -> Varyings { 3524 var varyings: Varyings; 3525 3526 // Draw an inline geometry constant array clip space triangle to verify that rendering works. 3527 // var positions = array<vec2<f32>, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5)); 3528 // if (attributes.instanceIndex == 0) { 3529 // varyings.position = vec4<f32>(positions[attributes.vertexIndex], 0.0, 1.0); 3530 // return varyings; 3531 // } 3532 3533 // var geometry: Geometry; 3534 // geometry.worldPosition = instancePositions; 3535 3536 // Multiply out radius and clamp to limits 3537 varyings.outerRadiusPixels = clamp( 3538 project_unit_size_to_pixel(scatterplot.radiusScale * attributes.instanceRadius, scatterplot.radiusUnits), 3539 scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels 3540 ); 3541 3542 // Multiply out line width and clamp to limits 3543 let lineWidthPixels = clamp( 3544 project_unit_size_to_pixel(scatterplot.lineWidthScale * attributes.instanceLineWidths, scatterplot.lineWidthUnits), 3545 scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels 3546 ); 3547 3548 // outer radius needs to offset by half stroke width 3549 varyings.outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0; 3550 // Expand geometry to accommodate edge smoothing 3551 let edgePadding = select( 3552 (varyings.outerRadiusPixels + SMOOTH_EDGE_RADIUS) / varyings.outerRadiusPixels, 3553 1.0, 3554 scatterplot.antialiasing != 0 3555 ); 3556 3557 // position on the containing square in [-1, 1] space 3558 varyings.unitPosition = edgePadding * attributes.positions.xy; 3559 geometry.uv = varyings.unitPosition; 3560 geometry.pickingColor = attributes.instancePickingColors; 3561 3562 varyings.innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / varyings.outerRadiusPixels; 3563 3564 if (scatterplot.billboard != 0) { 3565 varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, vec3<f32>(0.0)); // TODO , geometry.position); 3566 // DECKGL_FILTER_GL_POSITION(varyings.position, geometry); 3567 let offset = attributes.positions; // * edgePadding * varyings.outerRadiusPixels; 3568 // DECKGL_FILTER_SIZE(offset, geometry); 3569 let clipPixels = project_pixel_size_to_clipspace(offset.xy); 3570 varyings.position.x = clipPixels.x; 3571 varyings.position.y = clipPixels.y; 3572 } else { 3573 let offset = edgePadding * attributes.positions * project_pixel_size_float(varyings.outerRadiusPixels); 3574 // DECKGL_FILTER_SIZE(offset, geometry); 3575 varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, offset); // TODO , geometry.position); 3576 // DECKGL_FILTER_GL_POSITION(varyings.position, geometry); 3577 } 3578 3579 // Apply opacity to instance color, or return instance picking color 3580 varyings.vFillColor = vec4<f32>(attributes.instanceFillColors.rgb, attributes.instanceFillColors.a * layer.opacity); 3581 // DECKGL_FILTER_COLOR(varyings.vFillColor, geometry); 3582 varyings.vLineColor = vec4<f32>(attributes.instanceLineColors.rgb, attributes.instanceLineColors.a * layer.opacity); 3583 // DECKGL_FILTER_COLOR(varyings.vLineColor, geometry); 3584 3585 return varyings; 3586} 3587 3588@fragment 3589fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> { 3590 // var geometry: Geometry; 3591 // geometry.uv = unitPosition; 3592 3593 let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels; 3594 let inCircle = select( 3595 smoothedge(distToCenter, varyings.outerRadiusPixels), 3596 step(distToCenter, varyings.outerRadiusPixels), 3597 scatterplot.antialiasing != 0 3598 ); 3599 3600 if (inCircle == 0.0) { 3601 // discard; 3602 } 3603 3604 var fragColor: vec4<f32>; 3605 3606 if (scatterplot.stroked != 0) { 3607 let isLine = select( 3608 smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter), 3609 step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter), 3610 scatterplot.antialiasing != 0 3611 ); 3612 3613 if (scatterplot.filled != 0) { 3614 fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine); 3615 } else { 3616 if (isLine == 0.0) { 3617 // discard; 3618 } 3619 fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine); 3620 } 3621 } else if (scatterplot.filled == 0) { 3622 // discard; 3623 } else { 3624 fragColor = varyings.vFillColor; 3625 } 3626 3627 fragColor.a *= inCircle; 3628 // DECKGL_FILTER_COLOR(fragColor, geometry); 3629 3630 return fragColor; 3631 // return vec4<f32>(0, 0, 1, 1); 3632} 3633`,qI=[0,0,0,255],gie={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:qI},getLineColor:{type:"accessor",value:qI},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class bg extends Cs{getShaders(){return super.getShaders({vs:die,fs:pie,source:Aie,modules:[Ls,ma,hie]})}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:l,billboard:f,antialiasing:A,lineWidthUnits:v,lineWidthScale:T,lineWidthMinPixels:I,lineWidthMaxPixels:F}=this.props,N={stroked:o,filled:l,billboard:f,antialiasing:A,radiusUnits:Po[t],radiusScale:n,radiusMinPixels:i,radiusMaxPixels:s,lineWidthUnits:Po[v],lineWidthScale:T,lineWidthMinPixels:I,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];
3633return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zs({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}}bg.defaultProps=gie;bg.layerName="ScatterplotLayer";const uw={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function fw(r,e,t={}){return mie(r,t)!==e?(yie(r,t),!0):!1}function mie(r,e={}){return Math.sign(_ie(r,e))}const JI={x:0,y:1,z:2};function _ie(r,e={}){const{start:t=0,end:n=r.length,plane:i="xy"}=e,s=e.size||2;let o=0;const l=JI[i[0]],f=JI[i[1]];for(let A=t,v=n-s;A<n;A+=s)o+=(r[A+l]-r[v+l])*(r[A+f]+r[v+f]),v=A;return o/2}function yie(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 l=0;l<o;++l){const f=t+l*i,A=t+(s-1-l)*i;for(let v=0;v<i;++v){const T=r[f+v];r[f+v]=r[A+v],r[A+v]=T}}}function bl(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 p2(r,e){const t=e.length;for(let n=0;n<t;n++)r[n]=e[n]}function lg(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 A2(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 l=0;l<r.length;l++)i[l]=(o&1)===l?n[o]:s*(e[l]-r[l])+r[l];return i}function wm(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 $F(r,e){const{size:t=2,broken:n=!1,gridResolution:i=10,gridOffset:s=[0,0],startIndex:o=0,endIndex:l=r.length}=e||{},f=(l-o)/t;let A=[];const v=[A],T=lg(r,0,t,o);let I,F;const N=qF(T,i,s,[]),U=[];bl(A,T);for(let $=1;$<f;$++){for(I=lg(r,$,t,o,I),F=wm(I,N);F;){A2(T,I,F,N,U);const V=wm(U,N);V&&(A2(T,U,V,N,U),F=V),bl(A,U),p2(T,U),bie(N,i,F),n&&A.length>t&&(A=[],v.push(A),bl(A,T)),F=wm(I,N)}bl(A,I),p2(T,I)}return n?v:v[0]}const KI=0,vie=1;function XF(r,e=null,t){if(!r.length)return[];const{size:n=2,gridResolution:i=10,gridOffset:s=[0,0],edgeTypes:o=!1}=t||{},l=[],f=[{pos:r,types:o?new Array(r.length/n).fill(vie):null,holes:e||[]}],A=[[],[]];let v=[];for(;f.length;){const{pos:T,types:I,holes:F}=f.shift();xie(T,n,F[0]||T.length,A),v=qF(A[0],i,s,v);const N=wm(A[1],v);if(N){let U=ZI(T,I,n,0,F[0]||T.length,v,N);const $={pos:U[0].pos,types:U[0].types,holes:[]},V={pos:U[1].pos,types:U[1].types,holes:[]};f.push($,V);for(let j=0;j<F.length;j++)U=ZI(T,I,n,F[j],F[j+1]||T.length,v,N),U[0]&&($.holes.push($.pos.length),$.pos=F0($.pos,U[0].pos),o&&($.types=F0($.types,U[0].types))),U[1]&&(V.holes.push(V.pos.length),V.pos=F0(V.pos,U[1].pos),o&&(V.types=F0(V.types,U[1].types)))}else{const U={positions:T};o&&(U.edgeTypes=I),F.length&&(U.holeIndices=F),l.push(U)}}return l}function ZI(r,e,t,n,i,s,o){const l=(i-n)/t,f=[],A=[],v=[],T=[],I=[];let F,N,U;const $=lg(r,l-1,t,n);let V=Math.sign(o&8?$[1]-s[3]:$[0]-s[2]),j=e&&e[l-1],X=0,ue=0;for(let K=0;K<l;K++)F=lg(r,K,t,n,F),N=Math.sign(o&8?F[1]-s[3]:F[0]-s[2]),U=e&&e[n/t+K],N&&V&&V!==N&&(A2($,F,o,s,I),bl(f,I)&&v.push(j),bl(A,I)&&T.push(j)),N<=0?(bl(f,F)&&v.push(U),X-=N):v.length&&(v[v.length-1]=KI),N>=0?(bl(A,F)&&T.push(U),ue+=N):T.length&&(T[T.length-1]=KI),p2($,F),V=N,j=U;return[X?{pos:f,types:e&&v}:null,ue?{pos:A,types:e&&T}:null]}function qF(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 bie(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 xie(r,e,t,n){let i=1/0,s=-1/0,o=1/0,l=-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,l=v>l?v:l}return n[0][0]=i,n[0][1]=o,n[1][0]=s,n[1][1]=l,n}function F0(r,e){for(let t=0;t<e.length;t++)r.push(e[t]);return r}const wie=85.051129;function Tie(r,e){const{size:t=2,startIndex:n=0,endIndex:i=r.length,normalize:s=!0}=e||{},o=r.slice(n,i);JF(o,t,0,i-n);const l=$F(o,{size:t,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(s)for(const f of l)KF(f,t);return l}function Eie(r,e=null,t){const{size:n=2,normalize:i=!0,edgeTypes:s=!1}=t||{};e=e||[];const o=[],l=[];let f=0,A=0;for(let T=0;T<=e.length;T++){const I=e[T]||r.length,F=A,N=Cie(r,n,f,I);for(let U=N;U<I;U++)o[A++]=r[U];for(let U=f;U<N;U++)o[A++]=r[U];JF(o,n,F,A),Sie(o,n,F,A,t?.maxLatitude),f=I,l[T]=A}l.pop();const v=XF(o,l,{size:n,gridResolution:360,gridOffset:[-180,-180],edgeTypes:s});if(i)for(const T of v)KF(T.positions,n);return v}function Cie(r,e,t,n){let i=-1,s=-1;for(let o=t+1;o<n;o+=e){const l=Math.abs(r[o]);l>i&&(i=l,s=o-1)}return s}function Sie(r,e,t,n,i=wie){const s=r[t],o=r[n-e];if(Math.abs(s-o)>180){const l=lg(r,0,e,t);l[0]+=Math.round((o-s)/360)*360,bl(r,l),l[1]=Math.sign(l[1])*i,bl(r,l),l[0]=s,bl(r,l)}}function JF(r,e,t,n){let i=r[0],s;for(let o=t;o<n;o+=e){s=r[o];const l=s-i;(l>180||l<-180)&&(s-=Math.round(l/360)*360),r[o]=i=s}}function KF(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 Iie extends Zs{constructor(e){const{indices:t,attributes:n}=Bie(e);super({...e,indices:t,attributes:n}
3633)}}function Bie(r){const{radius:e,height:t=1,nradial:n=10}=r;let{vertices:i}=r;i&&(Zr.assert(i.length>=n),i=i.flatMap(F=>[F[0],F[1]]),fw(i,uw.COUNTER_CLOCKWISE));const s=t>0,o=n+1,l=s?o*3+1:n,f=Math.PI*2/n,A=new Uint16Array(s?n*3*2:0),v=new Float32Array(l*3),T=new Float32Array(l*3);let I=0;if(s){for(let F=0;F<o;F++){const N=F*f,U=F%n,$=Math.sin(N),V=Math.cos(N);for(let j=0;j<2;j++)v[I+0]=i?i[U*2]:V*e,v[I+1]=i?i[U*2+1]:$*e,v[I+2]=(1/2-j)*t,T[I+0]=i?i[U*2]:V,T[I+1]=i?i[U*2+1]:$,I+=3}v[I+0]=v[I-3],v[I+1]=v[I-2],v[I+2]=v[I-1],I+=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,V=Math.sin(U),j=Math.cos(U);v[I+0]=i?i[$*2]:j*e,v[I+1]=i?i[$*2+1]:V*e,v[I+2]=t/2,T[I+2]=1,I+=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:T}}}}const YI=`uniform columnUniforms { 3634 float radius; 3635 float angle; 3636 vec2 offset; 3637 bool extruded; 3638 bool stroked; 3639 bool isStroke; 3640 float coverage; 3641 float elevationScale; 3642 float edgeDistance; 3643 float widthScale; 3644 float widthMinPixels; 3645 float widthMaxPixels; 3646 highp int radiusUnits; 3647 highp int widthUnits; 3648} column; 3649`,Pie={name:"column",vs:YI,fs:YI,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"}},Mie=`#version 300 es 3650#define SHADER_NAME column-layer-vertex-shader 3651in vec3 positions; 3652in vec3 normals; 3653in vec3 instancePositions; 3654in float instanceElevations; 3655in vec3 instancePositions64Low; 3656in vec4 instanceFillColors; 3657in vec4 instanceLineColors; 3658in float instanceStrokeWidths; 3659in vec3 instancePickingColors; 3660out vec4 vColor; 3661#ifdef FLAT_SHADING 3662out vec3 cameraPosition; 3663out vec4 position_commonspace; 3664#endif 3665void main(void) { 3666geometry.worldPosition = instancePositions; 3667vec4 color = column.isStroke ? instanceLineColors : instanceFillColors; 3668mat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle)); 3669float elevation = 0.0; 3670float strokeOffsetRatio = 1.0; 3671if (column.extruded) { 3672elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale; 3673} else if (column.stroked) { 3674float widthPixels = clamp( 3675project_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits), 3676column.widthMinPixels, column.widthMaxPixels) / 2.0; 3677float halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius); 3678if (column.isStroke) { 3679strokeOffsetRatio -= sign(positions.z) * halfOffset; 3680} else { 3681strokeOffsetRatio -= halfOffset; 3682} 3683} 3684float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0); 3685float dotRadius = column.radius * column.coverage * shouldRender; 3686geometry.pickingColor = instancePickingColors; 3687vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation); 3688vec3 centroidPosition64Low = instancePositions64Low; 3689vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius; 3690if (column.radiusUnits == UNIT_METERS) { 3691offset = project_size(offset); 3692} 3693vec3 pos = vec3(offset, 0.); 3694DECKGL_FILTER_SIZE(pos, geometry); 3695gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position); 3696geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z)); 3697DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3698if (column.extruded && !column.isStroke) { 3699#ifdef FLAT_SHADING 3700cameraPosition = project.cameraPosition; 3701position_commonspace = geometry.position; 3702vColor = vec4(color.rgb, color.a * layer.opacity); 3703#else 3704vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 3705vColor = vec4(lightColor, color.a * layer.opacity); 3706#endif 3707} else { 3708vColor = vec4(color.rgb, color.a * layer.opacity); 3709} 3710DECKGL_FILTER_COLOR(vColor, geometry); 3711} 3712`,Rie=`#version 300 es 3713#define SHADER_NAME column-layer-fragment-shader 3714precision highp float; 3715out vec4 fragColor; 3716in vec4 vColor; 3717#ifdef FLAT_SHADING 3718in vec3 cameraPosition; 3719in vec4 position_commonspace; 3720#endif 3721void main(void) { 3722fragColor = vColor; 3723geometry.uv = vec2(0.); 3724#ifdef FLAT_SHADING 3725if (column.extruded && !column.isStroke && !bool(picking.isActive)) { 3726vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); 3727fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal); 3728} 3729#endif 3730DECKGL_FILTER_COLOR(fragColor, geometry); 3731} 3732`,c_=[0,0,0,255],Oie={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:c_},getLineColor:{type:"accessor",value:c_},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class pc extends Cs{getShaders(){const e={},{flatShading:t}=this.props;return t&&(e.FLAT_SHADING=1),super.getShaders({vs:Mie,fs:Rie,defines:e,modules:[Ls,t?Tx:M_,ma,Pie]})}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:c_},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:c_},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(l=>l.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 Iie({radius:1,height:n?2:0,vertices:t,nradial:e});let s=0;if(t)for(let o=0;o<e;o++){const l=t[o],f=Math.sqrt(l[0]*l[0]+l[1]*l[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,l=this.state.wireframeModel;o.setGeometry(s),o.setTopology("triangle-strip"),o.setIndexBuffer(null),l.setGeometry(s),l.setTopology("line-list")}draw({uniforms:e}){const{lineWidthUnits:t,lineWidthScale:n,lineWidthMinPixels:i,lineWidthMaxPixels:s,radiusUnits:o,elevationScale:l,extruded:f,filled:A,stroked:v,wireframe:T,offset:I,c
3732overage:F,radius:N,angle:U}=this.props,$=this.state.fillModel,V=this.state.wireframeModel,{fillVertexCount:j,edgeDistance:X}=this.state,ue={radius:N,angle:U/180*Math.PI,offset:I,extruded:f,stroked:v,coverage:F,elevationScale:l,edgeDistance:X,radiusUnits:Po[o],widthUnits:Po[t],widthScale:n,widthMinPixels:i,widthMaxPixels:s};f&&T&&(V.shaderInputs.setProps({column:{...ue,isStroke:!0}}),V.draw(this.context.renderPass)),A&&($.setVertexCount(j),$.shaderInputs.setProps({column:{...ue,isStroke:!1}}),$.draw(this.context.renderPass)),!f&&v&&($.setVertexCount(j*2/3),$.shaderInputs.setProps({column:{...ue,isStroke:!0}}),$.draw(this.context.renderPass))}}pc.layerName="ColumnLayer";pc.defaultProps=Oie;const Die={cellSize:{type:"number",min:0,value:1e3},offset:{type:"array",value:[1,1]}};let hw=class extends pc{_updateGeometry(){const e=new fD;this.state.fillModel.setGeometry(e)}draw({uniforms:e}){const{elevationScale:t,extruded:n,offset:i,coverage:s,cellSize:o,angle:l,radiusUnits:f}=this.props,A=this.state.fillModel,v={radius:o/2,radiusUnits:Po[f],angle:l,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)}};hw.layerName="GridCellLayer";hw.defaultProps=Die;function Fie(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 l=0;l<e;l++)i[o*e+l]=r[o][l]||0}else i=r;return t?$F(i,{size:e,gridResolution:t}):n?Tie(i,{size:e}):i}const Lie=1,kie=2,eb=4;class Nie extends WD{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?Fie(e,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):e}getGeometrySize(e){if(QI(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&&QI(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]=eb,n[s+o-2]=eb):(n[s]+=Lie,n[s+o-2]+=kie),n[s+o-1]=eb}_updatePositions(e,t){const{positions:n}=this.attributes;if(!n||!e)return;const{vertexStart:i,geometrySize:s}=t,o=new Array(3);for(let l=i,f=0;f<s;l++,f++)this.getPointOnPath(e,f,o),n[l*3]=o[0],n[l*3+1]=o[1],n[l*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 QI(r){return Array.isArray(r[0])}const eB=`uniform pathUniforms { 3733 float widthScale; 3734 float widthMinPixels; 3735 float widthMaxPixels; 3736 float jointType; 3737 float capType; 3738 float miterLimit; 3739 bool billboard; 3740 highp int widthUnits; 3741} path; 3742`,Uie={name:"path",vs:eB,fs:eB,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",jointType:"f32",capType:"f32",miterLimit:"f32",billboard:"f32",widthUnits:"i32"}},zie=`#version 300 es 3743#define SHADER_NAME path-layer-vertex-shader 3744in vec2 positions; 3745in float instanceTypes; 3746in vec3 instanceStartPositions; 3747in vec3 instanceEndPositions; 3748in vec3 instanceLeftPositions; 3749in vec3 instanceRightPositions; 3750in vec3 instanceLeftPositions64Low; 3751in vec3 instanceStartPositions64Low; 3752in vec3 instanceEndPositions64Low; 3753in vec3 instanceRightPositions64Low; 3754in float instanceStrokeWidths; 3755in vec4 instanceColors; 3756in vec3 instancePickingColors; 3757uniform float opacity; 3758out vec4 vColor; 3759out vec2 vCornerOffset; 3760out float vMiterLength; 3761out vec2 vPathPosition; 3762out float vPathLength; 3763out float vJointType; 3764const float EPSILON = 0.001; 3765const vec3 ZERO_OFFSET = vec3(0.0); 3766float flipIfTrue(bool flag) { 3767return -(float(flag) * 2. - 1.); 3768} 3769vec3 getLineJoinOffset( 3770vec3 prevPoint, vec3 currPoint, vec3 nextPoint, 3771vec2 width 3772) { 3773bool isEnd = positions.x > 0.0; 3774float sideOfPath = positions.y; 3775float isJoint = float(sideOfPath == 0.0); 3776vec3 deltaA3 = (currPoint - prevPoint); 3777vec3 deltaB3 = (nextPoint - currPoint); 3778mat3 rotationMatrix; 3779bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix); 3780if (needsRotation) { 3781deltaA3 = deltaA3 * rotationMatrix; 3782deltaB3 = deltaB3 * rotationMatrix; 3783} 3784vec2 deltaA = deltaA3.xy / width; 3785vec2 deltaB = deltaB3.xy / width; 3786float lenA = length(deltaA); 3787float lenB = length(deltaB); 3788vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0); 3789vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0); 3790vec2 perpA = vec2(-dirA.y, dirA.x); 3791vec2 perpB = vec2(-dirB.y, dirB.x); 3792vec2 tangent = dirA + dirB; 3793tangent = length(tangent) > 0. ? normalize(tangent) : perpA; 3794vec2 miterVec = vec2(-tangent.y, tangent.x); 3795vec2 dir = isEnd ? dirA : dirB; 3796vec2 perp = isEnd ? perpA : perpB; 3797float L = isEnd ? lenA : lenB; 3798float sinHalfA = abs(dot(miterVec, perp));
3799float cosHalfA = abs(dot(dirA, miterVec)); 3800float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x); 3801float cornerPosition = sideOfPath * turnDirection; 3802float miterSize = 1.0 / max(sinHalfA, EPSILON); 3803miterSize = mix( 3804min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)), 3805miterSize, 3806step(0.0, cornerPosition) 3807); 3808vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition)) 3809* (sideOfPath + isJoint * turnDirection); 3810bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0)); 3811bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0)); 3812bool isCap = isStartCap || isEndCap; 3813if (isCap) { 3814offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint); 3815vJointType = path.capType; 3816} else { 3817vJointType = path.jointType; 3818} 3819vPathLength = L; 3820vCornerOffset = offsetVec; 3821vMiterLength = dot(vCornerOffset, miterVec * turnDirection); 3822vMiterLength = isCap ? isJoint : vMiterLength; 3823vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd); 3824vPathPosition = vec2( 3825dot(offsetFromStartOfPath, perp), 3826dot(offsetFromStartOfPath, dir) 3827); 3828geometry.uv = vPathPosition; 3829float isValid = step(instanceTypes, 3.5); 3830vec3 offset = vec3(offsetVec * width * isValid, 0.0); 3831if (needsRotation) { 3832offset = rotationMatrix * offset; 3833} 3834return offset; 3835} 3836void clipLine(inout vec4 position, vec4 refPosition) { 3837if (position.w < EPSILON) { 3838float r = (EPSILON - refPosition.w) / (position.w - refPosition.w); 3839position = refPosition + (position - refPosition) * r; 3840} 3841} 3842void main() { 3843geometry.pickingColor = instancePickingColors; 3844vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity); 3845float isEnd = positions.x; 3846vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd); 3847vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd); 3848vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd); 3849vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd); 3850vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd); 3851vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd); 3852geometry.worldPosition = currPosition; 3853vec2 widthPixels = vec2(clamp( 3854project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits), 3855path.widthMinPixels, path.widthMaxPixels) / 2.0); 3856vec3 width; 3857if (path.billboard) { 3858vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET); 3859vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position); 3860vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET); 3861clipLine(prevPositionScreen, currPositionScreen); 3862clipLine(nextPositionScreen, currPositionScreen); 3863clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd)); 3864width = vec3(widthPixels, 0.0); 3865DECKGL_FILTER_SIZE(width, geometry); 3866vec3 offset = getLineJoinOffset( 3867prevPositionScreen.xyz / prevPositionScreen.w, 3868currPositionScreen.xyz / currPositionScreen.w, 3869nextPositionScreen.xyz / nextPositionScreen.w, 3870project_pixel_size_to_clipspace(width.xy) 3871); 3872DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry); 3873gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w); 3874} else { 3875prevPosition = project_position(prevPosition, prevPosition64Low); 3876currPosition = project_position(currPosition, currPosition64Low); 3877nextPosition = project_position(nextPosition, nextPosition64Low); 3878width = vec3(project_pixel_size(widthPixels), 0.0); 3879DECKGL_FILTER_SIZE(width, geometry); 3880vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy); 3881geometry.position = vec4(currPosition + offset, 1.0); 3882gl_Position = project_common_position_to_clipspace(geometry.position); 3883DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3884} 3885DECKGL_FILTER_COLOR(vColor, geometry); 3886} 3887`,Vie=`#version 300 es 3888#define SHADER_NAME path-layer-fragment-shader 3889precision highp float; 3890in vec4 vColor; 3891in vec2 vCornerOffset; 3892in float vMiterLength; 3893in vec2 vPathPosition; 3894in float vPathLength; 3895in float vJointType; 3896out vec4 fragColor; 3897void main(void) { 3898geometry.uv = vPathPosition; 3899if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) { 3900if (vJointType > 0.5 && length(vCornerOffset) > 1.0) { 3901discard; 3902} 3903if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) { 3904discard; 3905} 3906} 3907fragColor = vColor; 3908DECKGL_FILTER_COLOR(fragColor, geometry); 3909} 3910`,ZF=[0,0,0,255],Gie={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:ZF},getWidth:{type:"accessor",value:1}
3910,rounded:{deprecatedFor:["jointRounded","capRounded"]}},tb={enter:(r,e)=>e.length?e.subarray(e.length-r.length):r};class sf extends Cs{getShaders(){return super.getShaders({vs:zie,fs:Vie,modules:[Ls,ma,Uie]})}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:tb,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:tb,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:tb,defaultValue:ZF},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 Nie({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,l=t.data.attributes||{};o.updateGeometry({data:t.data,geometryBuffer:l.getPath,buffers:l,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:l,widthMinPixels:f,widthMaxPixels:A}=this.props,v=this.state.model,T={jointType:Number(t),capType:Number(n),billboard:i,widthUnits:Po[o],widthScale:l,miterLimit:s,widthMinPixels:f,widthMaxPixels:A};v.shaderInputs.setProps({path:T}),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 Zs({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")}}sf.defaultProps=Gie;sf.layerName="PathLayer";var L0={exports:{}},tB;function jie(){if(tB)return L0.exports;tB=1,L0.exports=r,L0.exports.default=r;function r(_e,Le,Ve){Ve=Ve||2;var Ye=Le&&Le.length,tt=Ye?Le[0]*Ve:_e.length,rt=e(_e,0,tt,Ve,!0),ut=[];if(!rt||rt.next===rt.prev)return ut;var vt,It,st,dr,er,Jt,Nt;if(Ye&&(rt=f(_e,Le,rt,Ve)),_e.length>80*Ve){vt=st=_e[0],It=dr=_e[1];for(var Ar=Ve;Ar<tt;Ar+=Ve)er=_e[Ar],Jt=_e[Ar+1],er<vt&&(vt=er),Jt<It&&(It=Jt),er>st&&(st=er),Jt>dr&&(dr=Jt);Nt=Math.max(st-vt,dr-It),Nt=Nt!==0?32767/Nt:0}return n(rt,ut,Ve,vt,It,Nt,0),ut}function e(_e,Le,Ve,Ye,tt){var rt,ut;if(tt===et(_e,Le,Ve,Ye)>0)for(rt=Le;rt<Ve;rt+=Ye)ut=W(rt,_e[rt],_e[rt+1],ut);else for(rt=Ve-Ye;rt>=Le;rt-=Ye)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 Ve=_e,Ye;do if(Ye=!1,!Ve.steiner&&(ue(Ve,Ve.next)||X(Ve.prev,Ve,Ve.next)===0)){if(re(Ve),Ve=Le=Ve.prev,Ve===Ve.next)break;Ye=!0}else Ve=Ve.next;while(Ye||Ve!==Le);return Le}function n(_e,Le,Ve,Ye,tt,rt,ut){if(_e){!ut&&rt&&F(_e,Ye,tt,rt);for(var vt=_e,It,st;
vendor: 7,845 bytes, line 3910
3910_e.prev!==_e.next;){if(It=_e.prev,st=_e.next,rt?s(_e,Ye,tt,rt):i(_e)){Le.push(It.i/Ve|0),Le.push(_e.i/Ve|0),Le.push(st.i/Ve|0),re(_e),_e=st.next,vt=st.next;continue}if(_e=st,_e===vt){ut?ut===1?(_e=o(t(_e),Le,Ve),n(_e,Le,Ve,Ye,tt,rt,2)):ut===2&&l(_e,Le,Ve,Ye,tt,rt):n(t(_e),Le,Ve,Ye,tt,rt,1);break}}}}function i(_e){var Le=_e.prev,Ve=_e,Ye=_e.next;if(X(Le,Ve,Ye)>=0)return!1;for(var tt=Le.x,rt=Ve.x,ut=Ye.x,vt=Le.y,It=Ve.y,st=Ye.y,dr=tt<rt?tt<ut?tt:ut:rt<ut?rt:ut,er=vt<It?vt<st?vt:st:It<st?It:st,Jt=tt>rt?tt>ut?tt:ut:rt>ut?rt:ut,Nt=vt>It?vt>st?vt:st:It>st?It:st,Ar=Ye.next;Ar!==Le;){if(Ar.x>=dr&&Ar.x<=Jt&&Ar.y>=er&&Ar.y<=Nt&&V(tt,vt,rt,It,ut,st,Ar.x,Ar.y)&&X(Ar.prev,Ar,Ar.next)>=0)return!1;Ar=Ar.next}return!0}function s(_e,Le,Ve,Ye){var tt=_e.prev,rt=_e,ut=_e.next;if(X(tt,rt,ut)>=0)return!1;for(var vt=tt.x,It=rt.x,st=ut.x,dr=tt.y,er=rt.y,Jt=ut.y,Nt=vt<It?vt<st?vt:st:It<st?It:st,Ar=dr<er?dr<Jt?dr:Jt:er<Jt?er:Jt,cn=vt>It?vt>st?vt:st:It>st?It:st,Mr=dr>er?dr>Jt?dr:Jt:er>Jt?er:Jt,xr=U(Nt,Ar,Le,Ve,Ye),jn=U(cn,Mr,Le,Ve,Ye),_r=_e.prevZ,yr=_e.nextZ;_r&&_r.z>=xr&&yr&&yr.z<=jn;){if(_r.x>=Nt&&_r.x<=cn&&_r.y>=Ar&&_r.y<=Mr&&_r!==tt&&_r!==ut&&V(vt,dr,It,er,st,Jt,_r.x,_r.y)&&X(_r.prev,_r,_r.next)>=0||(_r=_r.prevZ,yr.x>=Nt&&yr.x<=cn&&yr.y>=Ar&&yr.y<=Mr&&yr!==tt&&yr!==ut&&V(vt,dr,It,er,st,Jt,yr.x,yr.y)&&X(yr.prev,yr,yr.next)>=0))return!1;yr=yr.nextZ}for(;_r&&_r.z>=xr;){if(_r.x>=Nt&&_r.x<=cn&&_r.y>=Ar&&_r.y<=Mr&&_r!==tt&&_r!==ut&&V(vt,dr,It,er,st,Jt,_r.x,_r.y)&&X(_r.prev,_r,_r.next)>=0)return!1;_r=_r.prevZ}for(;yr&&yr.z<=jn;){if(yr.x>=Nt&&yr.x<=cn&&yr.y>=Ar&&yr.y<=Mr&&yr!==tt&&yr!==ut&&V(vt,dr,It,er,st,Jt,yr.x,yr.y)&&X(yr.prev,yr,yr.next)>=0)return!1;yr=yr.nextZ}return!0}function o(_e,Le,Ve){var Ye=_e;do{var tt=Ye.prev,rt=Ye.next.next;!ue(tt,rt)&&K(tt,Ye,Ye.next,rt)&&de(tt,rt)&&de(rt,tt)&&(Le.push(tt.i/Ve|0),Le.push(Ye.i/Ve|0),Le.push(rt.i/Ve|0),re(Ye),re(Ye.next),Ye=_e=rt),Ye=Ye.next}while(Ye!==_e);return t(Ye)}function l(_e,Le,Ve,Ye,tt,rt){var ut=_e;do{for(var vt=ut.next.next;vt!==ut.prev;){if(ut.i!==vt.i&&j(ut,vt)){var It=pe(ut,vt);ut=t(ut,ut.next),It=t(It,It.next),n(ut,Le,Ve,Ye,tt,rt,0),n(It,Le,Ve,Ye,tt,rt,0);return}vt=vt.next}ut=ut.next}while(ut!==_e)}function f(_e,Le,Ve,Ye){var tt=[],rt,ut,vt,It,st;for(rt=0,ut=Le.length;rt<ut;rt++)vt=Le[rt]*Ye,It=rt<ut-1?Le[rt+1]*Ye:_e.length,st=e(_e,vt,It,Ye,!1),st===st.next&&(st.steiner=!0),tt.push($(st));for(tt.sort(A),rt=0;rt<tt.length;rt++)Ve=v(tt[rt],Ve);return Ve}function A(_e,Le){return _e.x-Le.x}function v(_e,Le){var Ve=T(_e,Le);if(!Ve)return Le;var Ye=pe(Ve,_e);return t(Ye,Ye.next),t(Ve,Ve.next)}function T(_e,Le){var Ve=Le,Ye=_e.x,tt=_e.y,rt=-1/0,ut;do{if(tt<=Ve.y&&tt>=Ve.next.y&&Ve.next.y!==Ve.y){var vt=Ve.x+(tt-Ve.y)*(Ve.next.x-Ve.x)/(Ve.next.y-Ve.y);if(vt<=Ye&&vt>rt&&(rt=vt,ut=Ve.x<Ve.next.x?Ve:Ve.next,vt===Ye))return ut}Ve=Ve.next}while(Ve!==Le);if(!ut)return null;var It=ut,st=ut.x,dr=ut.y,er=1/0,Jt;Ve=ut;do Ye>=Ve.x&&Ve.x>=st&&Ye!==Ve.x&&V(tt<dr?Ye:rt,tt,st,dr,tt<dr?rt:Ye,tt,Ve.x,Ve.y)&&(Jt=Math.abs(tt-Ve.y)/(Ye-Ve.x),de(Ve,_e)&&(Jt<er||Jt===er&&(Ve.x>ut.x||Ve.x===ut.x&&I(ut,Ve)))&&(ut=Ve,er=Jt)),Ve=Ve.next;while(Ve!==It);return ut}function I(_e,Le){return X(_e.prev,_e,Le.prev)<0&&X(Le.next,_e,_e.next)<0}function F(_e,Le,Ve,Ye){var tt=_e;do tt.z===0&&(tt.z=U(tt.x,tt.y,Le,Ve,Ye)),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,Ve,Ye,tt,rt,ut,vt,It,st=1;do{for(Ve=_e,_e=null,rt=null,ut=0;Ve;){for(ut++,Ye=Ve,vt=0,Le=0;Le<st&&(vt++,Ye=Ye.nextZ,!!Ye);Le++);for(It=st;vt>0||It>0&&Ye;)vt!==0&&(It===0||!Ye||Ve.z<=Ye.z)?(tt=Ve,Ve=Ve.nextZ,vt--):(tt=Ye,Ye=Ye.nextZ,It--),rt?rt.nextZ=tt:_e=tt,tt.prevZ=rt,rt=tt;Ve=Ye}rt.nextZ=null,st*=2}while(ut>1);return _e}function U(_e,Le,Ve,Ye,tt){return _e=(_e-Ve)*tt|0,Le=(Le-Ye)*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,Ve=_e;do(Le.x<Ve.x||Le.x===Ve.x&&Le.y<Ve.y)&&(Ve=Le),Le=Le.next;while(Le!==_e);return Ve}function V(_e,Le,Ve,Ye,tt,rt,ut,vt){return(tt-ut)*(Le-vt)>=(_e-ut)*(rt-vt)&&(_e-ut)*(Ye-vt)>=(Ve-ut)*(Le-vt)&&(Ve-ut)*(rt-vt)>=(tt-ut)*(Ye-vt)}function j(_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)&&(X(_e.prev,_e,Le.prev)||X(_e,Le.prev,Le))||ue(_e,Le)&&X(_e.prev,_e,_e.next)>0&&X(Le.prev,Le,Le.next)>0)}function X(_e,Le,Ve){return(Le.y-_e.y)*(Ve.x-Le.x)-(Le.x-_e.x)*(Ve.y-Le.y)}function ue(_e,Le){return _e.x===Le.x&&_e.y===Le.y}function K(_e,Le,Ve,Ye){var tt=Ee(X(_e,Le,Ve)),rt=Ee(X(_e,Le,Ye)),ut=Ee(X(Ve,Ye,_e)),vt=Ee(X(Ve,Ye,Le));return!!(tt!==rt&&ut!==vt||tt===0&&se(_e,Ve,Le)||rt===0&&se(_e,Ye,Le)||ut===0&&se(Ve,_e,Ye)||vt===0&&se(Ve,Le,Ye))}function se(_e,Le,Ve){return Le.x<=Math.max(_e.x,Ve.x)&&Le.x>=Math.min(_e.x,Ve.x)&&Le.y<=Math.max(_e.y,Ve.y)&&Le.y>=Math.min(_e.y,Ve.y)}function Ee(_e){return _e>0?1:_e<0?-1:0}function Ue(_e,Le){var Ve=_e;do{if(Ve.i!==_e.i&&Ve.next.i!==_e.i&&Ve.i!==Le.i&&Ve.next.i!==Le.i&&K(Ve,Ve.next,_e,Le))return!0;Ve=Ve.next}while(Ve!==_e);return!1}function de(_e,Le){return X(_e.prev,_e,_e.next)<0?X(_e,Le,_e.next)>=0&&X(_e,_e.prev,Le)>=0:X(_e,Le,_e.prev)<0||X(_e,_e.next,Le)<0}function me(_e,Le){var Ve=_e,Ye=!1,tt=(_e.x+Le.x)/2,rt=(_e.y+Le.y)/2;do Ve.y>rt!=Ve.next.y>rt&&Ve.next.y!==Ve.y&&tt<(Ve.next.x-Ve.x)*(rt-Ve.y)/(Ve.next.y-Ve.y)+Ve.x&&(Ye=!Ye),Ve=Ve.next;while(Ve!==_e);return Ye}function pe(_e,Le){var Ve=new Ce(_e.i,_e.x,_e.y),Ye=new Ce(Le.i,Le.x,Le.y),tt=_e.next,rt=Le.prev;return _e.next=Le,Le.prev=_e,Ve.next=tt,tt.prev=Ve,Ye.next=Ve,Ve.prev=Ye,rt.next=Ye,Ye.prev=rt,Ye}function W(_e,Le,Ve,Ye){var tt=new Ce(_e,Le,Ve);return Ye?(tt.next=Ye.next,tt.prev=Ye,Ye.next.prev=tt,Ye.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 Ce(_e,Le,Ve){this.i=_e,this.x=Le,this.y=Ve,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(_e,Le,Ve,Ye){var tt=Le&&Le.length,rt=tt?Le[0]*Ve:_e.length,ut=Math.abs(et(_e,0,rt,Ve));if(tt)for(var vt=0,It=Le.length;vt<It;vt++){var st=Le[vt]*Ve,dr=vt<It-1?Le[vt+1]*Ve:_e.length;ut-=Math.abs(et(_e,st,dr,Ve))}var er=0;for(vt=0;vt<Ye.length;vt+=3){var Jt=Ye[vt]*Ve,Nt=Ye[vt+1]*Ve,Ar=Ye[vt+2]*Ve;er+=Math.abs((_e[Jt]-_e[Ar])*(_e[Nt+1]-_e[Jt+1])-(_e[Jt]-_e[Nt])*(_e[Ar+1]-_e[Jt+1]))}return ut===0&&er===0?0:Math.abs((er-ut)/ut)};function et(_e,Le,Ve,Ye){for(var tt=0,rt=Le,ut=Ve-Ye;rt<Ve;rt+=Ye)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,Ve={vertices:[],holes:[],dimensions:Le},Ye=0,tt=0;tt<_e.length;tt++){for(var rt=0;rt<_e[tt].length;rt++)for(var ut=0;ut<Le;ut++)Ve.vertices.push(_e[tt][rt][ut]);tt>0&&(Ye+=_e[tt-1].length,Ve.holes.push(Ye))}return Ve},L0.exports}var Hie=jie();const YF=uh(Hie),k0=uw.CLOCKWISE,rB=uw.COUNTER_CLOCKWISE,ju={};function Wie(r){if(r=r&&r.positions||r,!Array.isArray(r)&&!ArrayBuffer.isView(r))throw new Error("invalid polygon")}function BA(r){return"positions"in r?r.positions:r}function Tm(r){return"holeIndices"in r?r.holeIndices:null}function $ie(r){return Array.isArray(r[0])}function Xie(r){return r.length>=1&&r[0].length>=2&&Number.isFinite(r[0][0])}function qie(r){const e=r[0],t=r[r.length-1];return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Jie(r,e,t,n){for(let i=0;i<e;i++)if(r[t+i]!==r[n-e+i])return!1;return!0}function nB(r,e,t,n,i){let s=e;const o=t.length;for(let l=0;l<o;l++)for(let f=0;f<n;f++)r[s++]=t[l][f]||0;if(!qie(t))for(let l=0;l<n;l++)r[s++]=t[0][l]||0;return ju.start=e,ju.end=s,ju.size=n,fw(r,i,ju),s}function iB(r,e,t,n,i=0,s,o){s=s||t.length;const l=s-i;if(l<=0)return e;let f=e;for(let A=0;A<l;A++)r[f++]=t[i+A];
3910if(!Jie(t,n,i,s))for(let A=0;A<n;A++)r[f++]=t[i+A];return ju.start=e,ju.end=f,ju.size=n,fw(r,o,ju),f}function QF(r,e){Wie(r);const t=[],n=[];if("positions"in r){const{positions:i,holeIndices:s}=r;if(s){let o=0;for(let l=0;l<=s.length;l++)o=iB(t,o,i,e,s[l-1],s[l],l===0?k0:rB),n.push(o);return n.pop(),{positions:t,holeIndices:n}}r=i}if(!$ie(r))return iB(t,0,r,e,0,t.length,k0),t;if(!Xie(r)){let i=0;for(const[s,o]of r.entries())i=nB(t,i,o,e,s===0?k0:rB),n.push(i);return n.pop(),{positions:t,holeIndices:n}}return nB(t,0,r,e,k0),t}function rb(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 sB(r,e,t,n){const i=r.length/3;for(let s=0;s<i;s++){const o=s*3,l=r[o+0],f=r[o+1],A=r[o+2];r[o+e]=l,r[o+t]=f,r[o+n]=A}}function Kie(r,e,t,n){let i=Tm(r);i&&(i=i.map(l=>l/e));let s=BA(r);const o=n&&e===3;if(t){const l=s.length;s=s.slice();const f=[];for(let A=0;A<l;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 l=rb(s,0,1),f=rb(s,0,2),A=rb(s,1,2);if(!l&&!f&&!A)return[];l>f&&l>A||(f>A?(t||(s=s.slice()),sB(s,0,2,1)):(t||(s=s.slice()),sB(s,2,0,1)))}return YF(s,i,e)}class Zie extends WD{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=QF(e,this.positionSize);return this.opts.resolution?XF(BA(t),Tm(t),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?Eie(BA(t),Tm(t),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):t}return e}getGeometrySize(e){if(oB(e)){let t=0;for(const n of e)t+=this.getGeometrySize(n);return t}return BA(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,t){if(e&&oB(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:l}=this;let f=s.indices;if(!f||!e)return;let A=i;const v=Kie(e,this.positionSize,this.opts.preproject,this.opts.full3d);f=l.allocate(f,i+v.length,{copy:!0});for(let T=0;T<v.length;T++)f[A++]=v[T]+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=BA(e);for(let l=t,f=0;f<n;l++,f++){const A=o[f*s],v=o[f*s+1],T=s>2?o[f*s+2]:0;i[l*3]=A,i[l*3+1]=v,i[l*3+2]=T}}_updateVertexValid(e,{vertexStart:t,geometrySize:n}){const{positionSize:i}=this,s=this.attributes.vertexValid,o=e&&Tm(e);if(e&&e.edgeTypes?s.set(e.edgeTypes,t):s.fill(1,t,t+n),o)for(let l=0;l<o.length;l++)s[t+o[l]/i-1]=0;s[t+n-1]=0}}function oB(r){return Array.isArray(r)&&r.length>0&&!Number.isFinite(r[0])}const aB=`uniform solidPolygonUniforms { 3911 bool extruded; 3912 bool isWireframe; 3913 float elevationScale; 3914} solidPolygon; 3915`,Yie={name:"solidPolygon",vs:aB,fs:aB,uniformTypes:{extruded:"f32",isWireframe:"f32",elevationScale:"f32"}},eL=`in vec4 fillColors; 3916in vec4 lineColors; 3917in vec3 pickingColors; 3918out vec4 vColor; 3919struct PolygonProps { 3920vec3 positions; 3921vec3 positions64Low; 3922vec3 normal; 3923float elevations; 3924}; 3925vec3 project_offset_normal(vec3 vector) { 3926if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 3927project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) { 3928return normalize(vector * project.commonUnitsPerWorldUnit); 3929} 3930return project_normal(vector); 3931} 3932void calculatePosition(PolygonProps props) { 3933vec3 pos = props.positions; 3934vec3 pos64Low = props.positions64Low; 3935vec3 normal = props.normal; 3936vec4 colors = solidPolygon.isWireframe ? lineColors : fillColors; 3937geometry.worldPosition = props.positions; 3938geometry.pickingColor = pickingColors; 3939if (solidPolygon.extruded) { 3940pos.z += props.elevations * solidPolygon.elevationScale; 3941} 3942gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position); 3943DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3944if (solidPolygon.extruded) { 3945#ifdef IS_SIDE_VERTEX 3946normal = project_offset_normal(normal); 3947#else 3948normal = project_normal(normal); 3949#endif 3950geometry.normal = normal; 3951vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 3952vColor = vec4(lightColor, colors.a * layer.opacity); 3953} else { 3954vColor = vec4(colors.rgb, colors.a * layer.opacity); 3955} 3956DECKGL_FILTER_COLOR(vColor, geometry); 3957} 3958`,Qie=`#version 300 es 3959#define SHADER_NAME solid-polygon-layer-vertex-shader 3960in vec3 vertexPositions; 3961in vec3 vertexPositions64Low; 3962in float elevations; 3963${eL} 3964void main(void) { 3965PolygonProps props; 3966props.positions = vertexPositions; 3967props.positions64Low = vertexPositions64Low; 3968props.elevations = elevations; 3969props.normal = vec3(0.0, 0.0, 1.0); 3970calculatePosition(props); 3971} 3972`,ese=`#version 300 es 3973#define SHADER_NAME solid-polygon-layer-vertex-shader-side 3974#define IS_SIDE_VERTEX 3975in vec2 positions; 3976in vec3 vertexPositions; 3977in vec3 nextVertexPositions; 3978in vec3 vertexPositions64Low; 3979in vec3 nextVertexPositions64Low; 3980in float elevations; 3981in float instanceVertexValid; 3982${eL} 3983void main(void) { 3984if(instanceVertexValid < 0.5){ 3985gl_Position = vec4(0.); 3986return; 3987} 3988PolygonProps props; 3989vec3 pos; 3990vec3 pos64Low; 3991vec3 nextPos; 3992vec3 nextPos64Low; 3993#if RING_WINDING_ORDER_CW == 1 3994pos = vertexPositions; 3995pos64Low = vertexPositions64Low;
3996nextPos = nextVertexPositions; 3997nextPos64Low = nextVertexPositions64Low; 3998#else 3999pos = nextVertexPositions; 4000pos64Low = nextVertexPositions64Low; 4001nextPos = vertexPositions; 4002nextPos64Low = vertexPositions64Low; 4003#endif 4004props.positions = mix(pos, nextPos, positions.x); 4005props.positions64Low = mix(pos64Low, nextPos64Low, positions.x); 4006props.normal = vec3( 4007pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y), 4008nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x), 40090.0); 4010props.elevations = elevations * positions.y; 4011calculatePosition(props); 4012} 4013`,tse=`#version 300 es 4014#define SHADER_NAME solid-polygon-layer-fragment-shader 4015precision highp float; 4016in vec4 vColor; 4017out vec4 fragColor; 4018void main(void) { 4019fragColor = vColor; 4020geometry.uv = vec2(0.); 4021DECKGL_FILTER_COLOR(fragColor, geometry); 4022} 4023`,u_=[0,0,0,255],rse={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:u_},getLineColor:{type:"accessor",value:u_},material:!0},N0={enter:(r,e)=>e.length?e.subarray(e.length-r.length):r};class of extends Cs{getShaders(e){return super.getShaders({vs:e==="top"?Qie:ese,fs:tse,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[Ls,M_,ma,Yie]})}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 Zie({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:N0,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:N0,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:N0,accessor:"getFillColor",defaultValue:u_},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:N0,accessor:"getLineColor",defaultValue:u_},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(l,{index:f,target:A})=>this.encodePickingColor(l&&l.__source?l.__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:l,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)),l&&n&&(l.setInstanceCount(A.instanceCount-1),l.shaderInputs.setProps({solidPolygon:v}),l.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(l=>l.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 l=this.getShaders("top");l.defines.NON_INSTANCED_MODEL=1;const f=this.getAttributeManager().getBufferLayouts({isInstanced:!1});i=new Di(this.context.device,{...l,id:`${e}-top`,topology:"triangle-list",bufferLayout:f,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(n){const l=this.getAttributeManager().getBufferLayouts({isInstanced:!0});
4023s=new Di(this.context.device,{...this.getShaders("side"),id:`${e}-side`,bufferLayout:l,geometry:new Zs({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),o=new Di(this.context.device,{...this.getShaders("side"),id:`${e}-wireframe`,bufferLayout:l,geometry:new Zs({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")}}of.defaultProps=rse;of.layerName="SolidPolygonLayer";function tL({data:r,getIndex:e,dataRange:t,replace:n}){const{startRow:i=0,endRow:s=1/0}=t,o=r.length;let l=o,f=o;for(let I=0;I<o;I++){const F=e(r[I]);if(l>I&&F>=i&&(l=I),F>=s){f=I;break}}let A=l;const T=f-l!==n.length?r.slice(f):void 0;for(let I=0;I<n.length;I++)r[A++]=n[I];if(T){for(let I=0;I<T.length;I++)r[A++]=T[I];r.length=A}return{startRow:l,endRow:l+n.length}}const rL=[0,0,0,255],nse=[0,0,0,255],ise={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:nse},getLineColor:{type:"accessor",value:rL},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class af extends Ss{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&Zr.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=>tL({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=[],l=i==="XY"?2:3,{startRow:f,endRow:A}=e,{iterable:v,objectInfo:T}=dc(t,f,A);for(const I of v){T.index++;let F=n(I,T);s&&(F=QF(F,l));const{holeIndices:N}=F,U=F.positions||F;if(N)for(let $=0;$<=N.length;$++){const V=U.slice(N[$-1]||0,N[$]||U.length);o.push(this.getSubLayerRow({path:V},I,T.index))}else o.push(this.getSubLayerRow({path:U},I,T.index))}return o}renderLayers(){const{data:e,_dataDiff:t,stroked:n,filled:i,extruded:s,wireframe:o,_normalize:l,_windingOrder:f,elevationScale:A,transitions:v,positionFormat:T}=this.props,{lineWidthUnits:I,lineWidthScale:F,lineWidthMinPixels:N,lineWidthMaxPixels:U,lineJointRounded:$,lineMiterLimit:V,lineDashJustified:j}=this.props,{getFillColor:X,getLineColor:ue,getLineWidth:K,getLineDashArray:se,getElevation:Ee,getPolygon:Ue,updateTriggers:de,material:me}=this.props,{paths:pe,pathsDiff:W}=this.state,re=this.getSubLayerClass("fill",of),Ce=this.getSubLayerClass("stroke",sf),et=this.shouldRenderSubLayer("fill",pe)&&new re({_dataDiff:t,extruded:s,elevationScale:A,filled:i,wireframe:o,_normalize:l,_windingOrder:f,getElevation:Ee,getFillColor:X,getLineColor:s&&o?ue:rL,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:T,getPolygon:Ue}),_e=!s&&n&&this.shouldRenderSubLayer("stroke",pe)&&new Ce({_dataDiff:W&&(()=>W),widthUnits:I,widthScale:F,widthMinPixels:N,widthMaxPixels:U,jointRounded:$,miterLimit:V,dashJustified:j,_pathType:"loop",transitions:v&&{getWidth:v.getLineWidth,getColor:v.getLineColor,getPath:v.getPolygon},getColor:this.getSubLayerAccessor(ue),getWidth:this.getSubLayerAccessor(K),getDashArray:this.getSubLayerAccessor(se)}
4023,this.getSubLayerProps({id:"stroke",updateTriggers:de&&{getWidth:de.getLineWidth,getColor:de.getLineColor,getDashArray:de.getLineDashArray}}),{data:pe,positionFormat:T,getPath:Le=>Le.path});return[!s&&et,_e,s&&et]}}af.layerName="PolygonLayer";af.defaultProps=ise;function sse(r,e){if(!r)return null;const t="startIndices"in r?r.startIndices[e]:e,n=r.featureIds.value[t];return t!==-1?ose(r,n,t):null}function ose(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 ase(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 lB=`uniform sdfUniforms { 4024 float gamma; 4025 bool enabled; 4026 float buffer; 4027 float outlineBuffer; 4028 vec4 outlineColor; 4029} sdf; 4030`,lse={name:"sdf",vs:lB,fs:lB,uniformTypes:{gamma:"f32",enabled:"f32",buffer:"f32",outlineBuffer:"f32",outlineColor:"vec4<f32>"}},cse=`#version 300 es 4031#define SHADER_NAME multi-icon-layer-fragment-shader 4032precision highp float; 4033uniform sampler2D iconsTexture; 4034in vec4 vColor; 4035in vec2 vTextureCoords; 4036in vec2 uv; 4037out vec4 fragColor; 4038void main(void) { 4039geometry.uv = uv; 4040if (!bool(picking.isActive)) { 4041float alpha = texture(iconsTexture, vTextureCoords).a; 4042vec4 color = vColor; 4043if (sdf.enabled) { 4044float distance = alpha; 4045alpha = smoothstep(sdf.buffer - sdf.gamma, sdf.buffer + sdf.gamma, distance); 4046if (sdf.outlineBuffer > 0.0) { 4047float inFill = alpha; 4048float inBorder = smoothstep(sdf.outlineBuffer - sdf.gamma, sdf.outlineBuffer + sdf.gamma, distance); 4049color = mix(sdf.outlineColor, vColor, inFill); 4050alpha = inBorder; 4051} 4052} 4053float a = alpha * color.a; 4054if (a < icon.alphaCutoff) { 4055discard; 4056} 4057fragColor = vec4(color.rgb, a * layer.opacity); 4058} 4059DECKGL_FILTER_COLOR(fragColor, geometry); 4060} 4061`,nb=192/256,cB=[],use={getIconOffsets:{type:"accessor",value:r=>r.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}};class q_ extends Sp{getShaders(){const e=super.getShaders();return{...e,modules:[...e.modules,lse],fs:cse}}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&&Zr.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,nb*(1-i)):-1,l=this.state.model,f={buffer:nb,outlineBuffer:o,gamma:n,enabled:!!t,outlineColor:s};if(l.shaderInputs.setProps({sdf:f}),super.draw(e),t&&i){const{iconManager:A}=this.state;A.getTexture()&&(l.shaderInputs.setProps({sdf:{...f,outlineBuffer:nb}}),l.draw(this.context.renderPass))}}getInstanceOffset(e){return e?Array.from(e).flatMap(t=>super.getInstanceOffset(t)):cB}getInstanceColorMode(e){return 1}getInstanceIconFrame(e){return e?Array.from(e).flatMap(t=>super.getInstanceIconFrame(t)):cB}}q_.defaultProps=use;q_.layerName="MultiIconLayer";const WA=1e20;class fse{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:i=.25,fontFamily:s="sans-serif",fontWeight:o="normal",fontStyle:l="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=`${l} ${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),l=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,l+Math.ceil(i)),T=A+2*this.buffer,I=v+2*this.buffer,F=Math.max(T*I,0),N=new Uint8ClampedArray(F),U={data:N,width:T,height:I,glyphWidth:A,glyphHeight:v,glyphTop:l,glyphLeft:f,glyphAdvance:t};if(A===0||v===0)return U;const{ctx:$,buffer:V,gridInner:j,gridOuter:X}=this;$.clearRect(V,V,A,v),$.fillText(e,V,V+l);const ue=$.getImageData(V,V,A,v);X.fill(WA,0,F),j.fill(0,0,F);for(let K=0;K<v;K++)for(let se=0;se<A;se++){const Ee=ue.data[4*(K*A+se)+3]/255;if(Ee===0)continue;const Ue=(K+V)*T+se+V;if(Ee===1)X[Ue]=0,j[Ue]=WA;else{const de=.5-Ee;X[Ue]=de>0?de*de:0,j[Ue]=de<0?de*de:0}}uB(X,0,0,T,I,T,this.f,this.v,this.z),uB(j,V,V,A,v,T,this.f,this.v,this.z);for(let K=0;K<F;K++){const se=Math.sqrt(X[K])-Math.sqrt(j[K]);N[K]=Math.round(255-255*(se/this.radius+this.cutoff))}return U}}function uB(r,e,t,n,i,s,o,l,f){for(let A=e;A<e+n;A++)fB(r,t*s+A,s,i,o,l,f);for(let A=t;A<t+i;A++)fB(r,A*s+e,1,n,o,l,f)}function fB(r,e,t,n,i,s,o){s[0]=0,o[0]=-WA,o[1]=WA,i[0]=r[e];for(let l=1,f=0,A=0;l<n;l++){i[l]=r[e+l*t];const v=l*l;do{const T=s[f];A=(i[l]-i[T]+v-T*T)/(l-T)/2}while(A<=o[f]&&--f>-1);f++,s[f]=l,o[f]=A,o[f+1]=WA}for(let l=0,f=0;l<n;l++){for(;o[f+1]<l;)f++;const A=s[f],v=l-A;r[e+l*t]=i[A]+v*v}}const hse=32,dse=[];function pse(r){return Math.pow(2,Math.ceil(Math.log2(r)))}function Ase({characterSet:r,getFontWidth:e,fontHeight:t,buffer:n,maxCanvasWidth:i,mapping:s={},xOffset:o=0,yOffset:l=0}){let f=0,A=o;const v=t+n*2;for(const T of r)if(!s[T]){const I=e(T);A+I+n*2>i&&(A=0,f++),s[T]={x:A+n,y:l+f*v+n,width:I,height:v,layoutWidth:I,layoutHeight:t},A+=I+n*2}return{mapping:s,xOffset:A,yOffset:l+f*v,canvasHeight:pse(l+(f+1)*v)}}function nL(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 iL(r,e,t,n,i,s){let o=e,l=0;for(let f=e;f<t;f++){const A=nL(r,f,f+1,i);l+A>n&&(o<f&&s.push(f),o=f,l=0),l+=A}return l}function gse(r,e,t,n,i,s){let o=e,l=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>l){let T=nL(r,l,f,i);A+T>n&&(o<l&&(s.push(l),o=l,A=0),T>n&&(T=iL(r,l,f,n,i,s),o=s[s.length-1])),l=f,A+=T}return A}function mse(r,e,t,n,i=0,s){s===void 0&&(s=r.length);const o=[];return e==="break-all"?iL(r,i,s,t,n,o):gse(r,i,s,t,n,o),o}function _se(r,e,t,n,i,s){let o=0,l=0;for(let f=e;f<t;f++){const A=r[f],v=n[A];v?(l||(l=v.layoutHeight),i[f]=o+v.layoutWidth/2,o+=v.layoutWidth):(Zr.warn(`Missing character: ${A} (${A.codePointAt(0)})`)(),i[f]=o,o+=hse)}s[0]=o,s[1]=l}function yse(r,e,t,n,i){const s=Array.from(r),o=s.length,l=new Array(o),f=new Array(o),A=new Array(o),v=(t==="break-word"||t==="break-all")&&isFinite(n)&&n>0,T=[0,0],I=[0,0];let F=0,N=0,U=0;for(let $=0;$<=o;$++){const V=s[$];if((V===` 4062`||$===o)&&(U=$),U>N){const j=v?mse(s,t,n,i,N,U):dse;for(let X=0;X<=j.length;X++){const ue=X===0?N:j[X-1],K=X<j.length?j[X]:U;_se(s,ue,K,i,l,I);for(let se=ue;se<K;se++){l[se]-I[0]/2;const Ee=s[se],Ue=i[Ee]?.layoutOffsetY||0;f[se]=F+I[1]/2+Ue,A[se]=I[0]}F=F+I[1]*e,T[0]=Math.max(T[0],I[0])}N=U}V===` 4063`&&(l[N]=0,f[N]=0,A[N]=0,N++)}return T[1]=F,{x:l,y:f,rowWidth:A,size:T}}function vse({value:r,length:e,stride:t,offset:n,startIndices:i,characterSet:s}){const o=r.BYTES_PER_ELEMENT,l=t?t/o:1,f=n?n/o:0,A=i[e]||Math.ceil((r.length-f)/l),v=s&&new Set,T=new Array(e);let I=r;if(l>1||f>0){const F=r.constructor;I=new F(A);for(let N=0;N<A;N++)I[N]=r[N*l+f]}for(let F=0;F<e;F++){const N=i[F],U=i[F+1]||A,$=I.subarray(N,U);T[F]=String.fromCodePoint.apply(null,$),v&&$.forEach(v.add,v)}if(v)for(const F of v)s.add(String.fromCodePoint(F));return{texts:T,characterCount:A}}class sL{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 bse(){const r=[];for(let e=32;e<128;e++)r.push(String.fromCharCode(e));return r}const ip={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:bse(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},hB=1024,dB=.9,pB=1.2,oL=3;let f_=new sL(oL);function xse(r,e){let t;typeof e=="string"?t=new Set(Array.from(e)):t=new Set(e);const n=f_.get(r);if(!n)return t;for(const i in n.mapping)t.has(i)&&t.delete(i);return t}function wse(r,e){for(let t=0;t<r.length;t++)e.data[4*t+3]=r[t]}function AB(r,e,t,n){r.font=`${n} ${t}px ${e}`,r.fillStyle="#000",r.textBaseline="alphabetic",r.textAlign="left"}function Tse(r){Zr.assert(Number.isFinite(r)&&r>
4063=oL,"Invalid cache limit"),f_=new sL(r)}class Ese{constructor(){this.props={...ip}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){const{fontSize:e,buffer:t}=this.props;return(e*pB+t*2)/e}setProps(e={}){Object.assign(this.props,e),this._key=this._getKey();const t=xse(this._key,this.props.characterSet),n=f_.get(this._key);if(n&&t.size===0){this._atlas!==n&&(this._atlas=n);return}const i=this._generateFontAtlas(t,n);this._atlas=i,f_.set(this._key,i)}_generateFontAtlas(e,t){const{fontFamily:n,fontWeight:i,fontSize:s,buffer:o,sdf:l,radius:f,cutoff:A}=this.props;let v=t&&t.data;v||(v=document.createElement("canvas"),v.width=hB);const T=v.getContext("2d",{willReadFrequently:!0});AB(T,n,s,i);const{mapping:I,canvasHeight:F,xOffset:N,yOffset:U}=Ase({getFontWidth:$=>T.measureText($).width,fontHeight:s*pB,buffer:o,characterSet:e,maxCanvasWidth:hB,...t&&{mapping:t.mapping,xOffset:t.xOffset,yOffset:t.yOffset}});if(v.height!==F){const $=T.getImageData(0,0,v.width,v.height);v.height=F,T.putImageData($,0,0)}if(AB(T,n,s,i),l){const $=new fse({fontSize:s,buffer:o,radius:f,cutoff:A,fontFamily:n,fontWeight:`${i}`});for(const V of e){const{data:j,width:X,height:ue,glyphTop:K}=$.draw(V);I[V].width=X,I[V].layoutOffsetY=s*dB-K;const se=T.createImageData(X,ue);wse(j,se),T.putImageData(se,I[V].x,I[V].y)}}else for(const $ of e)T.fillText($,I[$].x,I[$].y+o+s*dB);return{xOffset:N,yOffset:U,mapping:I,data:v,width:v.width,height:v.height}}_getKey(){const{fontFamily:e,fontWeight:t,fontSize:n,buffer:i,sdf:s,radius:o,cutoff:l}=this.props;return s?`${e} ${t} ${n} ${i} ${o} ${l}`:`${e} ${t} ${n} ${i}`}}const gB=`uniform textBackgroundUniforms { 4064 bool billboard; 4065 float sizeScale; 4066 float sizeMinPixels; 4067 float sizeMaxPixels; 4068 vec4 borderRadius; 4069 vec4 padding; 4070 highp int sizeUnits; 4071 bool stroked; 4072} textBackground; 4073`,Cse={name:"textBackground",vs:gB,fs:gB,uniformTypes:{billboard:"f32",sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",borderRadius:"vec4<f32>",padding:"vec4<f32>",sizeUnits:"i32",stroked:"f32"}},Sse=`#version 300 es 4074#define SHADER_NAME text-background-layer-vertex-shader 4075in vec2 positions; 4076in vec3 instancePositions; 4077in vec3 instancePositions64Low; 4078in vec4 instanceRects; 4079in float instanceSizes; 4080in float instanceAngles; 4081in vec2 instancePixelOffsets; 4082in float instanceLineWidths; 4083in vec4 instanceFillColors; 4084in vec4 instanceLineColors; 4085in vec3 instancePickingColors; 4086out vec4 vFillColor; 4087out vec4 vLineColor; 4088out float vLineWidth; 4089out vec2 uv; 4090out vec2 dimensions; 4091vec2 rotate_by_angle(vec2 vertex, float angle) { 4092float angle_radian = radians(angle); 4093float cos_angle = cos(angle_radian); 4094float sin_angle = sin(angle_radian); 4095mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 4096return rotationMatrix * vertex; 4097} 4098void main(void) { 4099geometry.worldPosition = instancePositions; 4100geometry.uv = positions; 4101geometry.pickingColor = instancePickingColors; 4102uv = positions; 4103vLineWidth = instanceLineWidths; 4104float sizePixels = clamp( 4105project_size_to_pixel(instanceSizes * textBackground.sizeScale, textBackground.sizeUnits), 4106textBackground.sizeMinPixels, textBackground.sizeMaxPixels 4107); 4108dimensions = instanceRects.zw * sizePixels + textBackground.padding.xy + textBackground.padding.zw; 4109vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-textBackground.padding.xy, textBackground.padding.zw, positions); 4110pixelOffset = rotate_by_angle(pixelOffset, instanceAngles); 4111pixelOffset += instancePixelOffsets; 4112pixelOffset.y *= -1.0; 4113if (textBackground.billboard) { 4114gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 4115DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4116vec3 offset = vec3(pixelOffset, 0.0); 4117DECKGL_FILTER_SIZE(offset, geometry); 4118gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 4119} else { 4120vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 4121DECKGL_FILTER_SIZE(offset_common, geometry); 4122gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 4123DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4124} 4125vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity); 4126DECKGL_FILTER_COLOR(vFillColor, geometry); 4127vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity); 4128DECKGL_FILTER_COLOR(vLineColor, geometry); 4129} 4130`,Ise=`#version 300 es 4131#define SHADER_NAME text-background-layer-fragment-shader 4132precision highp float; 4133in vec4 vFillColor; 4134in vec4 vLineColor; 4135in float vLineWidth; 4136in vec2 uv; 4137in vec2 dimensions; 4138out vec4 fragColor;
4139float round_rect(vec2 p, vec2 size, vec4 radii) { 4140vec2 pixelPositionCB = (p - 0.5) * size; 4141vec2 sizeCB = size * 0.5; 4142float maxBorderRadius = min(size.x, size.y) * 0.5; 4143vec4 borderRadius = vec4(min(radii, maxBorderRadius)); 4144borderRadius.xy = 4145(pixelPositionCB.x > 0.0) ? borderRadius.xy : borderRadius.zw; 4146borderRadius.x = (pixelPositionCB.y > 0.0) ? borderRadius.x : borderRadius.y; 4147vec2 q = abs(pixelPositionCB) - sizeCB + borderRadius.x; 4148return -(min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - borderRadius.x); 4149} 4150float rect(vec2 p, vec2 size) { 4151vec2 pixelPosition = p * size; 4152return min(min(pixelPosition.x, size.x - pixelPosition.x), 4153min(pixelPosition.y, size.y - pixelPosition.y)); 4154} 4155vec4 get_stroked_fragColor(float dist) { 4156float isBorder = smoothedge(dist, vLineWidth); 4157return mix(vFillColor, vLineColor, isBorder); 4158} 4159void main(void) { 4160geometry.uv = uv; 4161if (textBackground.borderRadius != vec4(0.0)) { 4162float distToEdge = round_rect(uv, dimensions, textBackground.borderRadius); 4163if (textBackground.stroked) { 4164fragColor = get_stroked_fragColor(distToEdge); 4165} else { 4166fragColor = vFillColor; 4167} 4168float shapeAlpha = smoothedge(-distToEdge, 0.0); 4169fragColor.a *= shapeAlpha; 4170} else { 4171if (textBackground.stroked) { 4172float distToEdge = rect(uv, dimensions); 4173fragColor = get_stroked_fragColor(distToEdge); 4174} else { 4175fragColor = vFillColor; 4176} 4177} 4178DECKGL_FILTER_COLOR(fragColor, geometry); 4179} 4180`,Bse={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 xg extends Cs{getShaders(){return super.getShaders({vs:Sse,fs:Ise,modules:[Ls,ma,Cse]})}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}
4180){const{billboard:t,sizeScale:n,sizeUnits:i,sizeMinPixels:s,sizeMaxPixels:o,getLineWidth:l}=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,T={billboard:t,stroked:!!l,borderRadius:A,padding:f,sizeUnits:Po[i],sizeScale:n,sizeMinPixels:s,sizeMaxPixels:o};v.shaderInputs.setProps({textBackground:T}),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 Zs({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}}xg.defaultProps=Bse;xg.layerName="TextBackgroundLayer";const mB={start:1,middle:0,end:-1},_B={top:1,center:0,bottom:-1},ib=[0,0,0,255],Pse=1,Mse={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:ib},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:ip.characterSet},fontFamily:ip.fontFamily,fontWeight:ip.fontWeight,lineHeight:Pse,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:ib},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:ib},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 _h extends Ss{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:l}=this.props,f=mB[typeof o=="function"?o(e,t):o],A=_B[typeof l=="function"?l(e,t):l];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:l,size:[f,A]}=this.transformParagraph(e,t),v=mB[typeof n=="function"?n(e,t):n],T=_B[typeof i=="function"?i(e,t):i],I=s.length,F=new Array(I*2);let N=0;for(let U=0;U<I;U++){const $=(1-v)*(f-l[U])/2;F[N++]=(v-1)*f/2+$+s[U],F[N++]=(T-1)*A/2+o[U]}return F}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new Ese},this.props.maxWidth>0&&Zr.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 l in o)if(o[l]!==i.props[l])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 l=t==="auto"&&new Set;if(n&&s){const{texts:f,characterCount:A}=vse({...ArrayBuffer.isView(n)?{value:n}:n,length:e.length,startIndices:s,characterSet:l});o=A,i=(v,{index:T})=>f[T]}else{const{iterable:f,objectInfo:A}=dc(e);s=[0],o=0;for(const v of f){A.index++;const T=Array.from(i(v,A)||"");l&&T.forEach(l.add,l),o+=T.length,s.push(o)}}this.setState({getText:i,startIndices:s,numInstances:o,characterSet:l||t})}transformParagraph(e,t){const{fontAtlasManager:n}=this.state,i=n.mapping,s=this.state.getText,{wordBreak:o,lineHeight:l,maxWidth:f}=this.props,A=s(e,t)||"";return yse(A,l,o,f*n.props.fontSize,i)}renderLayers(){const{startIndices:e,numInstances:t,getText:n,fontAtlasManager:{scale:i,atlas:s,mapping:o},styleVersion:l}=this.state,{data:f,_dataDiff:A,getPosition:v,getColor:T,getSize:I,getAngle:F,getPixelOffset:N,getBackgroun
4180dColor:U,getBorderColor:$,getBorderWidth:V,backgroundBorderRadius:j,backgroundPadding:X,background:ue,billboard:K,fontSettings:se,outlineWidth:Ee,outlineColor:Ue,sizeScale:de,sizeUnits:me,sizeMinPixels:pe,sizeMaxPixels:W,transitions:re,updateTriggers:Ce}=this.props,et=this.getSubLayerClass("characters",q_),_e=this.getSubLayerClass("background",xg);return[ue&&new _e({getFillColor:U,getLineColor:$,getLineWidth:V,borderRadius:j,padding:X,getPosition:v,getSize:I,getAngle:F,getPixelOffset:N,billboard:K,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:Ce.getPosition,getAngle:Ce.getAngle,getSize:Ce.getSize,getFillColor:Ce.getBackgroundColor,getLineColor:Ce.getBorderColor,getLineWidth:Ce.getBorderWidth,getPixelOffset:Ce.getPixelOffset,getBoundingRect:{getText:Ce.getText,getTextAnchor:Ce.getTextAnchor,getAlignmentBaseline:Ce.getAlignmentBaseline,styleVersion:l}}}),{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:ip.smoothing,outlineWidth:Ee/(se.radius||ip.radius),outlineColor:Ue,iconAtlas:s,iconMapping:o,getPosition:v,getColor:T,getSize:I,getAngle:F,getPixelOffset:N,billboard:K,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:Ce.getText,getPosition:Ce.getPosition,getAngle:Ce.getAngle,getColor:Ce.getColor,getSize:Ce.getSize,getPixelOffset:Ce.getPixelOffset,getIconOffsets:{getTextAnchor:Ce.getTextAnchor,getAlignmentBaseline:Ce.getAlignmentBaseline,styleVersion:l}}}),{data:f,_dataDiff:A,startIndices:e,numInstances:t,getIconOffsets:this.getIconOffsets,getIcon:n})]}static set fontAtlasCacheLimit(e){Tse(e)}}_h.defaultProps=Mse;_h.layerName="TextLayer";const Em={circle:{type:bg,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:Sp,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:_h,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPi
4180xels:"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"}}},Cm={type:sf,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},g2={type:of,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function AA({type:r,props:e}){const t={};for(const n in e)t[n]=r.defaultProps[e[n]];return t}function sb(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 l=r.props[s];s.startsWith("get")&&(l=r.getSubLayerAccessor(l),i.updateTriggers[o]=n[s],t&&(i.transitions[o]=t[s])),i[o]=l}return i}function Rse(r){if(Array.isArray(r))return r;switch(Zr.assert(r.type,"GeoJSON does not have type"),r.type){case"Feature":return[r];case"FeatureCollection":return Zr.assert(Array.isArray(r.features),"GeoJSON does not have features array"),r.features;default:return[{geometry:r}]}}function yB(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 l=r[o],{geometry:f}=l;if(f)if(f.type==="GeometryCollection"){Zr.assert(Array.isArray(f.geometries),"GeoJSON does not have geometries array");const{geometries:A}=f;for(let v=0;v<A.length;v++){const T=A[v];vB(T,n,e,l,o)}}else vB(f,n,e,l,o)}return n}function vB(r,e,t,n,i){const{type:s,coordinates:o}=r,{pointFeatures:l,lineFeatures:f,polygonFeatures:A,polygonOutlineFeatures:v}=e;if(!Dse(s,o)){Zr.warn(`${s} coordinates are malformed`)();return}switch(s){case"Point":l.push(t({geometry:r},n,i));break;case"MultiPoint":o.forEach(T=>{l.push(t({geometry:{type:"Point",coordinates:T}},n,i))});break;case"LineString":f.push(t({geometry:r},n,i));break;case"MultiLineString":o.forEach(T=>{f.push(t({geometry:{type:"LineString",coordinates:T}},n,i))});break;case"Polygon":A.push(t({geometry:r},n,i)),o.forEach(T=>{v.push(t({geometry:{type:"LineString",coordinates:T}},n,i))});break;case"MultiPolygon":o.forEach(T=>{A.push(t({geometry:{type:"Polygon",coordinates:T}},n,i)),T.forEach(I=>{v.push(t({geometry:{type:"LineString",coordinates:I}},n,i))})});break}}const Ose={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function Dse(r,e){let t=Ose[r];for(Zr.assert(t,`Unknown GeoJSON type ${r}`);e&&--t>0;)e=e[0];return e&&Number.isFinite(e[0])}function aL(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function U0(r){return r.geometry.coordinates}function Fse(r,e){const t=aL(),{pointFeatures:n,lineFeatures:i,polygonFeatures:s,polygonOutlineFeatures:o}=r;return t.points.data=n,t.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),t.points.getPosition=U0,t.lines.data=i,t.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),t.lines.getPath=U0,t.polygons.data=s,t.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),t.polygons.getPolygon=U0,t.polygonsOutline.data=o,t.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),t.polygonsOutline.getPath=U0,t}function Lse(r,e){const t=aL(),{points:n,lines:i,polygons:s}=r,o=ase(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 kse=["points","linestrings","polygons"],Nse={...AA(Em.circle),...AA(Em.icon),...AA(Em.text),...AA(Cm),...AA(g2),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 ru extends Ss{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=Lse(e.data,this.encodePickingColor);this.setState({layerProps:n})}_updateStateJSON({props:e,changeFlags:t}){const n=Rse(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=yB(n,i,A);for(const T in f)o[T].push(tL({data:s[T],getIndex:I=>I.__source.index,dataRange:A,replace:v[T]}))}}else s=yB(n,i);const l=Fse(s,o);this.setState({features:s,featuresDiff:o,layerProps:l})}getPickingInfo(e){const t=super.getPickingInfo(e),{index:n,sourceLayer:i}=t;return t.featureType=kse.find(s=>
4180i.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,g2.type);if(s){const o=sb(this,g2.props),l=e&&t;return l||delete o.getLineColor,o.updateTriggers.lineColors=l,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,Cm.type),l=this.shouldRenderSubLayer(s,n.lines?.data)&&this.getSubLayerClass(s,Cm.type);if(o||l){const f=sb(this,Cm.props);return[o&&new o(f,this.getSubLayerProps({id:i,updateTriggers:f.updateTriggers}),n.polygonsOutline),l&&new l(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(l=>l.__source.index===i));const s=new Set(e.split("+")),o=[];for(const l of s){const f=`points-${l}`,A=Em[l],v=A&&this.shouldRenderSubLayer(f,t.points?.data)&&this.getSubLayerClass(f,A.type);if(v){const T=sb(this,A.props);let I=t.points;if(l==="text"&&n){const{instancePickingColors:F,...N}=I.data.attributes;I={...I,data:{...I.data,attributes:N}}}o.push(new v(T,this.getSubLayerProps({id:f,updateTriggers:T.updateTriggers,highlightedObjectIndex:i}),I))}}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,l=sse(s,o);return e(l,i)}}}ru.layerName="GeoJsonLayer";ru.defaultProps=Nse;const Use=Object.freeze(Object.defineProperty({__proto__:null,ArcLayer:yg,BitmapLayer:$_,ColumnLayer:pc,GeoJsonLayer:ru,GridCellLayer:hw,IconLayer:Sp,LineLayer:X_,PathLayer:sf,PointCloudLayer:vg,PolygonLayer:af,ScatterplotLayer:bg,SolidPolygonLayer:of,TextLayer:_h,_MultiIconLayer:q_,_TextBackgroundLayer:xg},Symbol.toStringTag,{value:"Module"}));function zse(r){return typeof r=="string"?r.charAt(0).toLowerCase()+r.slice(1):r}function m2(r){if(Array.isArray(r))return r.map(e=>m2(e));if(r&&typeof r=="object"){const e={};for(const[t,n]of Object.entries(r))e[zse(t)]=m2(n);return e}return r}var ob={},ab={},bB;function dw(){return bB||(bB=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(l,f){const A=[];let v=f.exec(l);for(;v;){const T=[];T.startIndex=f.lastIndex-v[0].length;const I=v.length;for(let F=0;F<I;F++)T.push(v[F]);A.push(T),v=f.exec(l)}return A},o=function(l){const f=i.exec(l);return!(f===null||typeof f>"u")};r.isExist=function(l){return typeof l<"u"},r.isEmptyObject=function(l){return Object.keys(l).length===0},r.merge=function(l,f,A){if(f){const v=Object.keys(f),T=v.length;for(let I=0;I<T;I++)A==="strict"?l[v[I]]=[f[v[I]]]:l[v[I]]=f[v[I]]}},r.getValue=function(l){return r.isExist(l)?l:""},r.isName=o,r.getAllMatches=s,r.nameRegexp=n})(ab)),ab}var xB;function lL(){if(xB)return ob;xB=1;const r=dw(),e={allowBooleanAttributes:!1,unpairedTags:[]};ob.validate=function(V,j){j=Object.assign({},e,j);const X=[];let ue=!1,K=!1;V[0]==="\uFEFF"&&(V=V.substr(1));for(let se=0;se<V.length;se++)if(V[se]==="<"&&V[se+1]==="?"){if(se+=2,se=n(V,se),se.err)return se}else if(V[se]==="<"){let Ee=se;if(se++,V[se]==="!"){se=i(V,se);continue}else{let Ue=!1;V[se]==="/"&&(Ue=!0,se++);let de="";for(;se<V.length&&V[se]!==">"&&V[se]!==" "&&V[se]!==" "&&V[se]!==` 4181`&&V[se]!=="\r";se++)de+=V[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
4181d name.",I("InvalidTag",W,U(V,se))}const me=l(V,se);if(me===!1)return I("InvalidAttr","Attributes for '"+de+"' have open quote.",U(V,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,j);if(re===!0)ue=!0;else return I(re.err.code,re.err.msg,U(V,W+re.err.line))}else if(Ue)if(me.tagClosed){if(pe.trim().length>0)return I("InvalidTag","Closing tag '"+de+"' can't have attributes or invalid starting.",U(V,Ee));if(X.length===0)return I("InvalidTag","Closing tag '"+de+"' has not been opened.",U(V,Ee));{const W=X.pop();if(de!==W.tagName){let re=U(V,W.tagStartPos);return I("InvalidTag","Expected closing tag '"+W.tagName+"' (opened in line "+re.line+", col "+re.col+") instead of closing tag '"+de+"'.",U(V,Ee))}X.length==0&&(K=!0)}}else return I("InvalidTag","Closing tag '"+de+"' doesn't have proper closing.",U(V,se));else{const W=A(pe,j);if(W!==!0)return I(W.err.code,W.err.msg,U(V,se-pe.length+W.err.line));if(K===!0)return I("InvalidXml","Multiple possible root nodes found.",U(V,se));j.unpairedTags.indexOf(de)!==-1||X.push({tagName:de,tagStartPos:Ee}),ue=!0}for(se++;se<V.length;se++)if(V[se]==="<")if(V[se+1]==="!"){se++,se=i(V,se);continue}else if(V[se+1]==="?"){if(se=n(V,++se),se.err)return se}else break;else if(V[se]==="&"){const W=T(V,se);if(W==-1)return I("InvalidChar","char '&' is not expected.",U(V,se));se=W}else if(K===!0&&!t(V[se]))return I("InvalidXml","Extra text at the end",U(V,se));V[se]==="<"&&se--}}else{if(t(V[se]))continue;return I("InvalidChar","char '"+V[se]+"' is not expected.",U(V,se))}if(ue){if(X.length==1)return I("InvalidTag","Unclosed tag '"+X[0].tagName+"'.",U(V,X[0].tagStartPos));if(X.length>0)return I("InvalidXml","Invalid '"+JSON.stringify(X.map(se=>se.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return I("InvalidXml","Start tag expected.",1);return!0};function t(V){return V===" "||V===" "||V===` 4182`||V==="\r"}function n(V,j){const X=j;for(;j<V.length;j++)if(V[j]=="?"||V[j]==" "){const ue=V.substr(X,j-X);if(j>5&&ue==="xml")return I("InvalidXml","XML declaration allowed only at the start of the document.",U(V,j));if(V[j]=="?"&&V[j+1]==">"){j++;break}else continue}return j}function i(V,j){if(V.length>j+5&&V[j+1]==="-"&&V[j+2]==="-"){for(j+=3;j<V.length;j++)if(V[j]==="-"&&V[j+1]==="-"&&V[j+2]===">"){j+=2;break}}else if(V.length>j+8&&V[j+1]==="D"&&V[j+2]==="O"&&V[j+3]==="C"&&V[j+4]==="T"&&V[j+5]==="Y"&&V[j+6]==="P"&&V[j+7]==="E"){let X=1;for(j+=8;j<V.length;j++)if(V[j]==="<")X++;else if(V[j]===">"&&(X--,X===0))break}else if(V.length>j+9&&V[j+1]==="["&&V[j+2]==="C"&&V[j+3]==="D"&&V[j+4]==="A"&&V[j+5]==="T"&&V[j+6]==="A"&&V[j+7]==="["){for(j+=8;j<V.length;j++)if(V[j]==="]"&&V[j+1]==="]"&&V[j+2]===">"){j+=2;break}}return j}const s='"',o="'";function l(V,j){let X="",ue="",K=!1;for(;j<V.length;j++){if(V[j]===s||V[j]===o)ue===""?ue=V[j]:ue!==V[j]||(ue="");else if(V[j]===">"&&ue===""){K=!0;break}X+=V[j]}return ue!==""?!1:{value:X,index:j,tagClosed:K}}const f=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function A(V,j){const X=r.getAllMatches(V,f),ue={};for(let K=0;K<X.length;K++){if(X[K][1].length===0)return I("InvalidAttr","Attribute '"+X[K][2]+"' has no space in starting.",$(X[K]));if(X[K][3]!==void 0&&X[K][4]===void 0)return I("InvalidAttr","Attribute '"+X[K][2]+"' is without value.",$(X[K]));if(X[K][3]===void 0&&!j.allowBooleanAttributes)return I("InvalidAttr","boolean attribute '"+X[K][2]+"' is not allowed.",$(X[K]));const se=X[K][2];if(!F(se))return I("InvalidAttr","Attribute '"+se+"' is an invalid name.",$(X[K]));if(!ue.hasOwnProperty(se))ue[se]=1;else return I("InvalidAttr","Attribute '"+se+"' is repeated.",$(X[K]))}return!0}function v(V,j){let X=/\d/;for(V[j]==="x"&&(j++,X=/[\da-fA-F]/);j<V.length;j++){if(V[j]===";")return j;if(!V[j].match(X))break}return-1}function T(V,j){if(j++,V[j]===";")return-1;if(V[j]==="#")return j++,v(V,j);let X=0;for(;j<V.length;j++,X++)if(!(V[j].match(/\w/)&&X<20)){if(V[j]===";")break;return-1}return j}function I(V,j,X){return{err:{code:V,msg:j,line:X.line||X,col:X.col}}}function F(V){return r.isName(V)}function N(V){return r.isName(V)}function U(V,j){const X=V.substring(0,j).split(/\r?\n/);return{line:X.length,col:X[X.length-1].length+1}}function $(V){return V.startIndex+V[1].length}return ob}var z0={},wB;function Vse(){if(wB)return z0;wB=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 z0.buildOptions=e,z0.defaultOptions=r,z0}var lb,TB;function Gse(){if(TB)return lb;TB=1;
4182class 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 lb=r,lb}var cb,EB;function jse(){if(EB)return cb;EB=1;const r=dw();function e(A,v){const T={};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 I=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&&(T[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&&l(A,v))v+=9;else if(n)N=!0;else throw new Error("Invalid DOCTYPE");I++,U=""}else if(A[v]===">"){if(N?A[v-1]==="-"&&A[v-2]==="-"&&(N=!1,I--):I--,I===0)break}else A[v]==="["?F=!0:U+=A[v];if(I!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:T,i:v}}function t(A,v){let T="";for(;v<A.length&&A[v]!=="'"&&A[v]!=='"';v++)T+=A[v];if(T=T.trim(),T.indexOf(" ")!==-1)throw new Error("External entites are not supported");const I=A[v++];let F="";for(;v<A.length&&A[v]!==I;v++)F+=A[v];return[T,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 l(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 cb=e,cb}var ub,CB;function Hse(){if(CB)return ub;CB=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 l=s.trim();if(o.skipLike!==void 0&&o.skipLike.test(l))return s;if(o.hex&&r.test(l))return Number.parseInt(l,16);{const f=e.exec(l);if(f){const A=f[1],v=f[2];let T=i(f[3]);const I=f[4]||f[6];if(!o.leadingZeros&&v.length>0&&A&&l[2]!==".")return s;if(!o.leadingZeros&&v.length>0&&!A&&l[1]!==".")return s;{const F=Number(l),N=""+F;return N.search(/[eE]/)!==-1||I?o.eNotation?F:s:l.indexOf(".")!==-1?N==="0"&&T===""||N===T||A&&N==="-"+T?F:s:v?T===N||A+T===N?F:s:l===N||l===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 ub=n,ub}var fb,SB;function cL(){if(SB)return fb;SB=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 fb=r,fb}var hb,IB;function Wse(){if(IB)return hb;IB=1;const r=dw(),e=Gse(),t=jse(),n=Hse(),i=cL();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:(Ee,Ue)=>String.fromCharCode(Number.parseInt(Ue,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(Ee,Ue)=>String.fromCharCode(Number.parseInt(Ue,16))}},this.addExternalEntities=o,this.parseXml=T,this.parseTextData=l,this.resolveNameSpace=f,this.buildAttributesMap=v,this.isItStopNode=U,this.replaceEntitiesValue=F,this.readStopNodeData=X,this.saveTextToParentTag=N,this.addChild=I,this.ignoreAttributesFn=i(this.options.ignoreAttributes)}}function o(K){const se=Object.keys(K);for(let Ee=0;Ee<se.length;Ee++){const Ue=se[Ee];this.lastEntities[Ue]={regex:new RegExp("&"+Ue+";","g"),val:K[Ue]}}}function l(K,se,Ee,Ue,de,me,pe){if(K!==void 0&&(this.options.trimValues&&!Ue&&(K=K.trim()),K.length>0)){pe||(K=this.replaceEntitiesValue(K));const W=this.options.tagValueProcessor(se,K,Ee,de,me);
4182return W==null?K:typeof W!=typeof K||W!==K?W:this.options.trimValues?ue(K,this.options.parseTagValue,this.options.numberParseOptions):K.trim()===K?ue(K,this.options.parseTagValue,this.options.numberParseOptions):K}}function f(K){if(this.options.removeNSPrefix){const se=K.split(":"),Ee=K.charAt(0)==="/"?"/":"";if(se[0]==="xmlns")return"";se.length===2&&(K=Ee+se[1])}return K}const A=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function v(K,se,Ee){if(this.options.ignoreAttributes!==!0&&typeof K=="string"){const Ue=r.getAllMatches(K,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],Ce=this.options.attributeNamePrefix+W;if(W.length)if(this.options.transformAttributeName&&(Ce=this.options.transformAttributeName(Ce)),Ce==="__proto__"&&(Ce="#__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[Ce]=re:typeof et!=typeof re||et!==re?me[Ce]=et:me[Ce]=ue(re,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(me[Ce]=!0)}if(!Object.keys(me).length)return;if(this.options.attributesGroupName){const pe={};return pe[this.options.attributesGroupName]=me,pe}return me}}const T=function(K){K=K.replace(/\r\n?/g,` 4183`);const se=new e("!xml");let Ee=se,Ue="",de="";for(let me=0;me<K.length;me++)if(K[me]==="<")if(K[me+1]==="/"){const W=V(K,">",me,"Closing Tag is not closed.");let re=K.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)),Ee&&(Ue=this.saveTextToParentTag(Ue,Ee,de));const Ce=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;Ce&&this.options.unpairedTags.indexOf(Ce)!==-1?(et=de.lastIndexOf(".",de.lastIndexOf(".")-1),this.tagsNodeStack.pop()):et=de.lastIndexOf("."),de=de.substring(0,et),Ee=this.tagsNodeStack.pop(),Ue="",me=W}else if(K[me+1]==="?"){let W=j(K,me,!1,"?>");if(!W)throw new Error("Pi Tag is not closed.");if(Ue=this.saveTextToParentTag(Ue,Ee,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(Ee,re,de)}me=W.closeIndex+1}else if(K.substr(me+1,3)==="!--"){const W=V(K,"-->",me+4,"Comment is not closed.");if(this.options.commentPropName){const re=K.substring(me+4,W-2);Ue=this.saveTextToParentTag(Ue,Ee,de),Ee.add(this.options.commentPropName,[{[this.options.textNodeName]:re}])}me=W}else if(K.substr(me+1,2)==="!D"){const W=t(K,me);this.docTypeEntities=W.entities,me=W.i}else if(K.substr(me+1,2)==="!["){const W=V(K,"]]>",me,"CDATA is not closed.")-2,re=K.substring(me+9,W);Ue=this.saveTextToParentTag(Ue,Ee,de);let Ce=this.parseTextData(re,Ee.tagname,de,!0,!1,!0,!0);Ce==null&&(Ce=""),this.options.cdataPropName?Ee.add(this.options.cdataPropName,[{[this.options.textNodeName]:re}]):Ee.add(this.options.textNodeName,Ce),me=W+2}else{let W=j(K,me,this.options.removeNSPrefix),re=W.tagName;const Ce=W.rawTagName;let et=W.tagExp,_e=W.attrExpPresent,Le=W.closeIndex;this.options.transformTagName&&(re=this.options.transformTagName(re)),Ee&&Ue&&Ee.tagname!=="!xml"&&(Ue=this.saveTextToParentTag(Ue,Ee,de,!1));const Ve=Ee;if(Ve&&this.options.unpairedTags.indexOf(Ve.tagname)!==-1&&(Ee=this.tagsNodeStack.pop(),de=de.substring(0,de.lastIndexOf("."))),re!==se.tagname&&(de+=de?"."+re:re),this.isItStopNode(this.options.stopNodes,de,re)){let Ye="";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(K,Ce,Le+1);if(!rt)throw new Error(`Unexpected end of ${Ce}`);me=rt.i,Ye=rt.tagContent}const tt=new e(re);re!==et&&_e&&(tt[":@"]=this.buildAttributesMap(et,de,re)),Ye&&(Ye=this.parseTextData(Ye,re,de,!0,_e,!0,!0)),de=de.substr(0,de.lastIndexOf(".")),tt.add(this.options.textNodeName,Ye),this.addChild(Ee,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 Ye=new e(re);re!==et&&_e&&(Ye[":@"]=this.buildAttributesMap(et,de,re)),this.addChild(Ee,Ye,de),de=de.substr(0,de.lastIndexOf("."))}else{const Ye=new e(re);this.tagsNodeStack.push(Ee),re!==et&&_e&&(Ye[":@"]=this.buildAttributesMap(et,de,re)),this.addChild(Ee,Ye,de),Ee=Ye}Ue="",me=Le}}else Ue+=K[me];return se.child};function I(K,se,Ee){const Ue=this.options.updateTag(se.tagname,Ee,se[":@"]);Ue===!1||(typeof Ue=="string"&&(se.tagname=Ue),K.addChild(se))}const F=function(K){if(this.options.processEntities){for(let se in this.docTypeEntities){const Ee=this.docTypeEntities[se];K=K.replace(Ee.regx,Ee.val)}for(let se in this.lastEntities){const Ee=this.lastEntities[se];K=K.replace(Ee.regex,Ee.val)}if(this.options.htmlEntities)for(let se in this.htmlEntities){const Ee=this.htmlEntities[se];K=K.replace(Ee.regex,Ee.val)}K=K.replace(this.ampEntity.regex,this.ampEntity.val)}return K};function N(K,se,Ee,Ue){return K&&(Ue===void 0&&(Ue=Object.keys(se.child).length===0),K=this.parseTextData(K,se.tagname,Ee,!1,se[":@"]?Object.keys(se[":@"]).length!==0:!1,Ue),K!==void 0&&K!==""&&se.add(this.options.textNodeName,K),K=""),K}function U(K,se,Ee){const Ue="*."+Ee;for(const de in K){const me=K[de];if(Ue===me||se===me)return!0}return!1}function $(K,se,Ee=">"){let Ue,de="";for(let me=se;me<K.length;me++){let pe=K[me];if(Ue)pe===Ue&&(Ue="");else if(pe==='"'||pe==="'")Ue=pe;else if(pe===Ee[0])if(Ee[1]){if(K[me+1]===Ee[1])return{data:de,index:me}}else return{data:de,index:me};else pe===" "&&(pe=" ");de+=pe}}function V(K,se,Ee,Ue){const de=K.indexOf(se,Ee);if(de===-1)throw new Error(Ue);return de+se.length-1}function j(K,se,Ee,Ue=">"){const de=$(K,se+1,Ue);if(!de)return;let me=de.data;const pe=de.index,W=me.search(/\s/);let re=me,Ce=!0;W!==-1&&(re=me.substring(0,W),me=me.substring(W+1).trimStart());const et=re;if(Ee){const _e=re.indexOf(":");_e!==-1&&(re=re.substr(_e+1),Ce=re!==de.data.substr(_e+1))}return{tagName:re,tagExp:me,closeIndex:pe,attrExpPresent:Ce,rawTagName:et}}function X(K,se,Ee){const Ue=Ee;let de=1;for(;Ee<K.length;Ee++)if(K[Ee]==="<")if(K[Ee+1]==="/"){const me=V(K,">",Ee,`${se} is not closed`);if(K.substring(Ee+2,me).trim()===se&&(de--,de===0))return{tagContent:K.substring(Ue,Ee),i:me};Ee=me}else if(K[Ee+1]==="?")Ee=V(K,"?>",Ee+1,"StopNode is not closed.");else if(K.substr(Ee+1,3)==="!--")Ee=V(K,"-->",Ee+3,"StopNode is not closed.");else if(K.substr(Ee+1,2)==="![")Ee=V(K,"]]>",Ee,"StopNode is not closed.")-2;else{const me=j(K,Ee,">");me&&((me&&me.tagName)===se&&me.tagExp[me.tagExp.length-1]!=="/"&&de++,Ee=me.closeIndex)}}function ue(K,se,Ee){if(se&&typeof K=="string"){const Ue=K.trim();return Ue==="true"?!0:Ue==="false"?!1:n(K,Ee)}else return r.isExist(K)?K:""}return hb=s,hb}var db={},BB;function $se(){if(BB)return db;BB=1;function r(s,o){return e(s,o)}function e(s,o,l){let f;const A={};for(let v=0;v<s.length;v++){const T=s[v],I=t(T);let F="";if(l===void 0?F=I:F=l+"."+I,I===o.textNodeName)f===void 0?f=T[I]:f+=""+T[I];else{if(I===void 0)continue;if(T[I]){let N=e(T[I],o,F);const U=i(N,o);T[":@"]?n(N,T[":@"],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[I]!==void 0&&A.hasOwnProperty(I)?(Array.isArray(A[I])||(A[I]=[A[I]]),A[I].push(N)):o.isArray(I,F,U)?A[I]=[N]:A[I]=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 l=0;l<o.length;l++){const f=o[l];if(f!==":@")return f}}function n(s,o,l,f){if(o){const A=Object.keys(o),v=A.length;for(let T=0;T<v;T++){const I=A[T];f.isArray(I,l+"."+I,!0,!0)?s[I]=[o[I]]:s[I]=o[I]}}}function i(s,o){const{textNodeName:l}=o,f=Object.keys(s).length;return!!(f===0||f===1&&(s[l]||typeof s[l]=="boolean"||s[l]===0))}return db.prettify=r,db}var pb,PB;function Xse(){if(PB)return pb;PB=1;const{buildOptions:r}=Vse(),e=Wse(),{prettify:t}=$se(),n=lL();class i{constructor(o){this.externalEntities={},this.options=r(o)}parse(o,l){if(typeof o!="string")if(o.toString)o=o.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(l){l===!0&&(l={});const v=n.validate(o,l);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,l){if(l.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 '
'");if(l==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[o]=l}}return pb=i,pb}var Ab,MB;
4183function qse(){if(MB)return Ab;MB=1;const r=` 4184`;function e(l,f){let A="";return f.format&&f.indentBy.length>0&&(A=r),t(l,f,"",A)}function t(l,f,A,v){let T="",I=!1;for(let F=0;F<l.length;F++){const N=l[F],U=n(N);if(U===void 0)continue;let $="";if(A.length===0?$=U:$=`${A}.${U}`,U===f.textNodeName){let K=N[U];s($,f)||(K=f.tagValueProcessor(U,K),K=o(K,f)),I&&(T+=v),T+=K,I=!1;continue}else if(U===f.cdataPropName){I&&(T+=v),T+=`<![CDATA[${N[U][0][f.textNodeName]}]]>`,I=!1;continue}else if(U===f.commentPropName){T+=v+`<!--${N[U][0][f.textNodeName]}-->`,I=!0;continue}else if(U[0]==="?"){const K=i(N[":@"],f),se=U==="?xml"?"":v;let Ee=N[U][0][f.textNodeName];Ee=Ee.length!==0?" "+Ee:"",T+=se+`<${U}${Ee}${K}?>`,I=!0;continue}let V=v;V!==""&&(V+=f.indentBy);const j=i(N[":@"],f),X=v+`<${U}${j}`,ue=t(N[U],f,$,V);f.unpairedTags.indexOf(U)!==-1?f.suppressUnpairedNode?T+=X+">":T+=X+"/>":(!ue||ue.length===0)&&f.suppressEmptyNode?T+=X+"/>":ue&&ue.endsWith(">")?T+=X+`>${ue}${v}</${U}>`:(T+=X+">",ue&&v!==""&&(ue.includes("/>")||ue.includes("</"))?T+=v+f.indentBy+ue+v:T+=ue,T+=`</${U}>`),I=!0}return T}function n(l){const f=Object.keys(l);for(let A=0;A<f.length;A++){const v=f[A];if(l.hasOwnProperty(v)&&v!==":@")return v}}function i(l,f){let A="";if(l&&!f.ignoreAttributes)for(let v in l){if(!l.hasOwnProperty(v))continue;let T=f.attributeValueProcessor(v,l[v]);T=o(T,f),T===!0&&f.suppressBooleanAttributes?A+=` ${v.substr(f.attributeNamePrefix.length)}`:A+=` ${v.substr(f.attributeNamePrefix.length)}="${T}"`}return A}function s(l,f){l=l.substr(0,l.length-f.textNodeName.length-1);let A=l.substr(l.lastIndexOf(".")+1);for(let v in f.stopNodes)if(f.stopNodes[v]===l||f.stopNodes[v]==="*."+A)return!0;return!1}function o(l,f){if(l&&l.length>0&&f.processEntities)for(let A=0;A<f.entities.length;A++){const v=f.entities[A];l=l.replace(v.regex,v.val)}return l}return Ab=e,Ab}var gb,RB;function Jse(){if(RB)return gb;RB=1;const r=qse(),e=cL(),t={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(l,f){return f},attributeValueProcessor:function(l,f){return f},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function n(l){this.options=Object.assign({},t,l),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=`> 4185`,this.newLine=` 4186`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}n.prototype.build=function(l){return this.options.preserveOrder?r(l,this.options):(Array.isArray(l)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(l={[this.options.arrayNodeName]:l}),this.j2x(l,0,[]).val)},n.prototype.j2x=function(l,f,A){let v="",T="";const I=A.join(".");for(let F in l)if(Object.prototype.hasOwnProperty.call(l,F))if(typeof l[F]>"u")this.isAttribute(F)&&(T+="");else if(l[F]===null)this.isAttribute(F)?T+="":F[0]==="?"?T+=this.indentate(f)+"<"+F+"?"+this.tagEndChar:T+=this.indentate(f)+"<"+F+"/"+this.tagEndChar;else if(l[F]instanceof Date)T+=this.buildTextValNode(l[F],F,"",f);else if(typeof l[F]!="object"){const N=this.isAttribute(F);if(N&&!this.ignoreAttributesFn(N,I))v+=this.buildAttrPairStr(N,""+l[F]);else if(!N)if(F===this.options.textNodeName){let U=this.options.tagValueProcessor(F,""+l[F]);T+=this.replaceEntitiesValue(U)}else T+=this.buildTextValNode(l[F],F,"",f)}else if(Array.isArray(l[F])){const N=l[F].length;let U="",$="";for(let V=0;V<N;V++){const j=l[F][V];if(!(typeof j>"u"))if(j===null)F[0]==="?"?T+=this.indentate(f)+"<"+F+"?"+this.tagEndChar:T+=this.indentate(f)+"<"+F+"/"+this.tagEndChar;else if(typeof j=="object")if(this.options.oneListGroup){const X=this.j2x(j,f+1,A.concat(F));U+=X.val,this.options.attributesGroupName&&j.hasOwnProperty(this.options.attributesGroupName)&&($+=X.attrStr)}else U+=this.processTextOrObjNode(j,F,f,A);else if(this.options.oneListGroup){let X=this.options.tagValueProcessor(F,j);X=this.replaceEntitiesValue(X),U+=X}
4186else U+=this.buildTextValNode(j,F,"",f)}this.options.oneListGroup&&(U=this.buildObjectNode(U,F,$,f)),T+=U}else if(this.options.attributesGroupName&&F===this.options.attributesGroupName){const N=Object.keys(l[F]),U=N.length;for(let $=0;$<U;$++)v+=this.buildAttrPairStr(N[$],""+l[F][N[$]])}else T+=this.processTextOrObjNode(l[F],F,f,A);return{attrStr:v,val:T}},n.prototype.buildAttrPairStr=function(l,f){return f=this.options.attributeValueProcessor(l,""+f),f=this.replaceEntitiesValue(f),this.options.suppressBooleanAttributes&&f==="true"?" "+l:" "+l+'="'+f+'"'};function i(l,f,A,v){const T=this.j2x(l,A+1,v.concat(f));return l[this.options.textNodeName]!==void 0&&Object.keys(l).length===1?this.buildTextValNode(l[this.options.textNodeName],f,T.attrStr,A):this.buildObjectNode(T.val,f,T.attrStr,A)}n.prototype.buildObjectNode=function(l,f,A,v){if(l==="")return f[0]==="?"?this.indentate(v)+"<"+f+A+"?"+this.tagEndChar:this.indentate(v)+"<"+f+A+this.closeTag(f)+this.tagEndChar;{let T="</"+f+this.tagEndChar,I="";return f[0]==="?"&&(I="?",T=""),(A||A==="")&&l.indexOf("<")===-1?this.indentate(v)+"<"+f+A+I+">"+l+T:this.options.commentPropName!==!1&&f===this.options.commentPropName&&I.length===0?this.indentate(v)+`<!--${l}-->`+this.newLine:this.indentate(v)+"<"+f+A+I+this.tagEndChar+l+this.indentate(v)+T}},n.prototype.closeTag=function(l){let f="";return this.options.unpairedTags.indexOf(l)!==-1?this.options.suppressUnpairedNode||(f="/"):this.options.suppressEmptyNode?f="/":f=`></${l}`,f},n.prototype.buildTextValNode=function(l,f,A,v){if(this.options.cdataPropName!==!1&&f===this.options.cdataPropName)return this.indentate(v)+`<![CDATA[${l}]]>`+this.newLine;if(this.options.commentPropName!==!1&&f===this.options.commentPropName)return this.indentate(v)+`<!--${l}-->`+this.newLine;if(f[0]==="?")return this.indentate(v)+"<"+f+A+"?"+this.tagEndChar;{let T=this.options.tagValueProcessor(f,l);return T=this.replaceEntitiesValue(T),T===""?this.indentate(v)+"<"+f+A+this.closeTag(f)+this.tagEndChar:this.indentate(v)+"<"+f+A+">"+T+"</"+f+this.tagEndChar}},n.prototype.replaceEntitiesValue=function(l){if(l&&l.length>0&&this.options.processEntities)for(let f=0;f<this.options.entities.length;f++){const A=this.options.entities[f];l=l.replace(A.regex,A.val)}return l};function s(l){return this.options.indentBy.repeat(l)}function o(l){return l.startsWith(this.options.attributeNamePrefix)&&l!==this.options.textNodeName?l.substr(this.attrPrefixLen):!1}return gb=n,gb}var mb,OB;function Kse(){if(OB)return mb;OB=1;const r=lL(),e=Xse(),t=Jse();return mb={XMLParser:e,XMLValidator:r,XMLBuilder:t},mb}var Zse=Kse();function DB(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,l)=>!!e?.arrayPaths?.some(A=>s===A),...e?._fastXML},n=Yse(r,t);return e?.uncapitalizeKeys?m2(n):n}function Yse(r,e){return new Zse.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(r)}const Qse="4.2.4",mp={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:Qse,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:eoe,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(r,e)=>DB(new TextDecoder().decode(r),{...mp.options.xml,...e?.xml}),parseTextSync:(r,e)=>DB(r,{...mp.options.xml,...e?.xml})};function eoe(r){return r.startsWith("<?xml")}async function wg(r,e,t,n){return n._parse(r,e,t,n)}function Ri(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const uL=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),FB=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);FB&&parseFloat(FB[1]);function toe(r,e){return fL(r||{},e)}function fL(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]=fL(n[i]||{},e[i],t+1):n[i]=e[i];return n}function roe(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function noe(r){return globalThis.loaders?.modules?.[r]||null}
vendor: 4,315 bytes, line 4186
4186function ioe(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.4"),globalThis._loadersgl_.version}const soe=ioe();function ooe(r,e){if(!r)throw new Error("loaders.gl assertion failed.")}const Tg=typeof process!="object"||String(process)!=="[object process]"||process.browser,pw=typeof importScripts=="function",LB=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);LB&&parseFloat(LB[1]);const _b={};async function eh(r,e=null,t={},n=null){return e&&(r=aoe(r,e,t,n)),_b[r]=_b[r]||loe(r),await _b[r]}function aoe(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]:Tg?t.CDN?(ooe(t.CDN.startsWith("http")),`${t.CDN}/${e}@${soe}/dist/libs/${n}`):pw?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function loe(r){if(r.endsWith("wasm"))return await uoe(r);if(!Tg)try{const{requireFromFile:t}=globalThis.loaders||{};return await t?.(r)}catch(t){return console.error(t),null}if(pw)return importScripts(r);const e=await foe(r);return coe(e,r)}function coe(r,e){if(!Tg){const{requireFromString:n}=globalThis.loaders||{};return n?.(r,e)}if(pw)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 uoe(r){const{readFileAsArrayBuffer:e}=globalThis.loaders||{};return Tg||!e||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await e(r)}async function foe(r){const{readFileAsText:e}=globalThis.loaders||{};return Tg||!e||r.startsWith("http")?await(await fetch(r)).text():await e(r)}function hoe(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?kB(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?kB(r,0,e):""}function kB(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 doe(r){try{return JSON.parse(r)}catch{throw new Error(`Failed to parse JSON from data starting with "${hoe(r)}"`)}}function Aw(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 Eg(r,e){return Ri(r>=0),Ri(e>0),r+(e-1)&-4}function poe(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+Eg(n.byteLength,4)}const Aoe="Queued Requests",goe="Active Requests",moe="Cancelled Requests",_oe="Queued Requests Ever",yoe="Active Requests Ever",voe={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};let boe=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...voe,...e},this.stats=new hh({id:this.props.id}),this.stats.get(Aoe),this.stats.get(goe),this.stats.get(moe),this.stats.get(_oe),this.stats.get(yoe)}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}};
4186function xoe(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();const r=window.location?.pathname;return r?.slice(0,r.lastIndexOf("/")+1)||""}function hL(r){const e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(0,e):""}function woe(...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=xoe()),o=i),o.length!==0&&(t=`${o}/${t}`,n=o.charCodeAt(0)===PA)}return t=Toe(t,!n),n?`/${t}`:t.length>0?t:"."}const PA=47,yb=46;function Toe(r,e){let t="",n=-1,i=0,s,o=!1;for(let l=0;l<=r.length;++l){if(l<r.length)s=r.charCodeAt(l);else{if(s===PA)break;s=PA}if(s===PA){if(!(n===l-1||i===1))if(n!==l-1&&i===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==yb||t.charCodeAt(t.length-2)!==yb){if(t.length>2){const f=t.length-1;let A=f;for(;A>=0&&t.charCodeAt(A)!==PA;--A);if(A!==f){t=A===-1?"":t.slice(0,A),n=l,i=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",n=l,i=0,o=!1;continue}}e&&(t.length>0?t+="/..":t="..",o=!0)}else{const f=r.slice(n+1,l);t.length>0?t+=`/${f}`:t=f,o=!1}n=l,i=0}else s===yb&&i!==-1?++i:i=-1}return t}class Eoe{fetch;loadOptions;_needsRefresh=!0;props;constructor(e){this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Coe(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 Coe(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 gw extends Eoe{static type="template";static testURL=e=>!1}function Soe(r,e){const t=mp.parseTextSync?.(r,e),n=t?.ServiceExceptionReport?.ServiceException||t?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}const Ioe="4.2.4",Sm={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:Ioe,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:Boe,options:{wms:{throwOnError:!1}},parse:async(r,e)=>vb(new TextDecoder().decode(r),e),parseSync:(r,e)=>vb(new TextDecoder().decode(r),e),parseTextSync:(r,e)=>vb(r,e)};function Boe(r){return r.startsWith("<?xml")}function vb(r,e){const t={...Sm.options.wms,...e?.wms},n=Soe(r,t),i=t.minimalErrors?n:`WMS Service error: ${n}`;if(t.throwOnError)throw new Error(i);return i}function _p(r){return Array.isArray(r)?r:r?[r]:[]}function J_(r){const e=_p(r);return e.length>0&&e.every(t=>typeof t=="string")?e:[]}function V0(r,e=void 0){switch(typeof r){case"number":return r;case"string":return parseFloat(r);default:return}}function bb(r,e=void 0){switch(typeof r){case"number":return r;case"string":return parseInt(r,10);default:return}}function sp(r){switch(r){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function NB(r,e){const t=mp.parseTextSync?.(r,e),n=t.WMT_MS_Capabilities||t.WMS_Capabilities||t,i=Poe(n);if(e?.inheritedLayerProps)for(const s of i.layers)pL(s,null);return e?.includeRawJSON&&(i.json=n),e?.includeXMLText&&(i.xml=r),i}function Poe(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:J_(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:bb(r.Service?.LayerLimit),maxWidth:bb(r.Service?.maxWidth),maxHeight:bb(r.Service?.maxHeight),layers:[],requests:Moe(r.Capability?.Request),exceptions:Roe(r.Exception)},t=_p(r.Capability?.Layer);for(const n of t)e.layers.push(dL(n));for(const[n,i]of Object.entries(e))i===void 0&&delete e[n];return e}function Moe(r){const e={};for(const[t,n]of Object.entries(r||{})){const i=J_(n?.Format);e[t]={mimeTypes:i}}return e}function Roe(r){if(_p(r?.Format).length>0)return{mimeTypes:J_(r)}}
4186function dL(r){const e={title:String(r?.Title||""),name:r?.Name&&String(r?.Name),abstract:r?.Name&&String(r?.Abstract),keywords:J_(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&&Ooe(r?.EX_GeographicBoundingBox);n&&(e.geographicBoundingBox=n),n=r?.LatLonBoundingBox&&Doe(r?.LatLonBoundingBox),n&&(e.geographicBoundingBox=n);const i=r?.BoundingBox&&Foe(r?.BoundingBox);i&&i.length>0&&(e.boundingBoxes=i);const o=_p(r?.Dimension).map(A=>koe(A));o.length&&(e.dimensions=o),r?.opaque&&(e.opaque=sp(r?.opaque)),r?.cascaded&&(e.cascaded=sp(r?.cascaded)),r?.queryable&&(e.queryable=sp(r?.queryable));const l=_p(r?.Layer),f=[];for(const A of l)f.push(dL(A));f.length>0&&(e.layers=f);for(const[A,v]of Object.entries(e))v===void 0&&delete e[A];return e}function Ooe(r){const{westBoundLongitude:e,northBoundLatitude:t,eastBoundLongitude:n,southBoundLatitude:i}=r;return[[e,i],[n,t]]}function Doe(r){const{minx:e,miny:t,maxx:n,maxy:i}=r;return[[e,t],[n,i]]}function Foe(r){return _p(r).map(t=>Loe(t))}function Loe(r){const{CRS:e,SRS:t,minx:n,miny:i,maxx:s,maxy:o,resx:l,resy:f}=r,A={crs:e||t,boundingBox:[[V0(n),V0(i)],[V0(s),V0(o)]]};return l&&(A.xResolution=l),f&&(A.yResolution=f),A}function koe(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=sp(r.multipleValues)),r.nearestValue&&(i.nearestValue=sp(r.nearestValue)),r.current&&(i.current=sp(r.current)),i}function pL(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||[])pL(t,r)}const Noe="4.2.4",mw={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:Noe,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Uoe,options:{wms:{}},parse:async(r,e)=>NB(new TextDecoder().decode(r),e?.wms),parseTextSync:(r,e)=>NB(r,e?.wms)};function Uoe(r){return r.startsWith("<?xml")}function UB(r,e){const n=(mp.parseTextSync?.(r,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(s=>zoe(s))}}function zoe(r){return{attributes:r||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}const Voe={...mw,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(r,e)=>UB(new TextDecoder().decode(r),e),parseTextSync:(r,e)=>UB(r,e)};function zB(r,e){return mp.parseTextSync?.(r,e)}const Goe={...mw,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(r,e)=>zB(new TextDecoder().decode(r),e),parseTextSync:(r,e)=>zB(r,e)};function joe(r,e){const{type:t="auto"}=r,n=t==="auto"?Woe(r.url,e):Hoe(t,e);if(!n)throw new Error("Not a valid image source type");return n.create(r)}function Hoe(r,e){for(const t of e)if(t.type===r)return t;return null}function Woe(r,e){for(const t of e)if(t.testURL&&t.testURL(r))return t;return null}const $oe="4.2.4",Xoe=globalThis.loaders?.parseImageNode,_2=typeof Image<"u",y2=typeof ImageBitmap<"u",qoe=!!Xoe,v2=uL?!0:qoe;function Joe(r){switch(r){case"auto":return y2||_2||v2;case"imagebitmap":return y2;case"image":return _2;case"data":return v2;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function Koe(){if(y2)return"imagebitmap";if(_2)return"image";if(v2)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Zoe(r){const e=Yoe(r);if(!e)throw new Error("Not an image");return e}function AL(r){switch(Zoe(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 Yoe(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 Qoe=/^data:image\/svg\+xml/,eae=/\.svg((\?|#).*)?$/;function _w(r){return r&&(Qoe.test(r)||eae.test(r))}function tae(r,e){if(_w(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 gL(r,e)}function gL(r,e){if(_w(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}
4186async function mL(r,e,t){const n=tae(r,t),i=self.URL||self.webkitURL,s=typeof n!="string"&&i.createObjectURL(n);try{return await rae(s||n,e)}finally{s&&i.revokeObjectURL(s)}}async function rae(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 nae={};let VB=!0;async function iae(r,e,t){let n;_w(t)?n=await mL(r,e,t):n=gL(r,t);const i=e&&e.imagebitmap;return await sae(n,i)}async function sae(r,e=null){if((oae(e)||!VB)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),VB=!1}return await createImageBitmap(r)}function oae(r){for(const e in r||nae)return!1;return!0}function aae(r){return!fae(r,"ftyp",4)||(r[8]&96)===0?null:lae(r)}function lae(r){switch(cae(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function cae(r,e,t){return String.fromCharCode(...r.slice(e,t))}function uae(r){return[...r].map(e=>e.charCodeAt(0))}function fae(r,e,t=0){const n=uae(e);for(let i=0;i<n.length;++i)if(n[i]!==r[i+t])return!1;return!0}const ic=!1,$A=!0;function yw(r){const e=Cg(r);return dae(e)||gae(e)||pae(e)||Aae(e)||hae(e)}function hae(r){const e=new Uint8Array(r instanceof DataView?r.buffer:r),t=aae(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function dae(r){const e=Cg(r);return e.byteLength>=24&&e.getUint32(0,ic)===2303741511?{mimeType:"image/png",width:e.getUint32(16,ic),height:e.getUint32(20,ic)}:null}function pae(r){const e=Cg(r);return e.byteLength>=10&&e.getUint32(0,ic)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,$A),height:e.getUint16(8,$A)}:null}function Aae(r){const e=Cg(r);return e.byteLength>=14&&e.getUint16(0,ic)===16973&&e.getUint32(2,$A)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,$A),height:e.getUint32(22,$A)}:null}function gae(r){const e=Cg(r);if(!(e.byteLength>=3&&e.getUint16(0,ic)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:n,sofMarkers:i}=mae();let s=2;for(;s+9<e.byteLength;){const o=e.getUint16(s,ic);if(i.has(o))return{mimeType:"image/jpeg",height:e.getUint16(s+5,ic),width:e.getUint16(s+7,ic)};if(!n.has(o))return null;s+=2,s+=e.getUint16(s,ic)}return null}function mae(){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 Cg(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 _ae(r,e){const{mimeType:t}=yw(r)||{},n=globalThis.loaders?.parseImageNode;return Ri(n),await n(r,t)}async function yae(r,e,t){e=e||{};const i=(e.image||{}).type||"auto",{url:s}=t||{},o=vae(i);let l;switch(o){case"imagebitmap":l=await iae(r,e,s);break;case"image":l=await mL(r,e,s);break;case"data":l=await _ae(r);break;default:Ri(!1)}return i==="data"&&(l=AL(l)),l}function vae(r){switch(r){case"auto":case"data":return Koe();default:return Joe(r),r}}const bae=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],xae=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],wae={image:{type:"auto",decode:!0}},h_={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:$oe,mimeTypes:xae,extensions:bae,parse:yae,tests:[r=>!!yw(new DataView(r))],options:wae},xb={};function Tae(r){if(xb[r]===void 0){const e=uL?Cae(r):Eae(r);xb[r]=e}return xb[r]}function Eae(r){const e=["image/png","image/jpeg","image/gif"],t=globalThis.loaders?.imageFormatsNode||e;return!!globalThis.loaders?.parseImageNode&&t.includes(r)}function Cae(r){switch(r){case"image/avif":case"image/webp":return Sae(r);default:return!0}}function Sae(r){try{return document.createElement("canvas").toDataURL(r).indexOf(`data:${r}`)===0}catch{return!1}}const Iae={type:"wms",testURL:r=>r.toLowerCase().includes("wms"),create:r=>new Bae(r)};class Bae extends gw{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 mw.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 h_.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 Voe.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 Goe.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 h_.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[l,f]=o.split("=");s[l]=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},l=["transparent","time","elevation"];for(const[f,A]of Object.entries(o))(!l.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}
4186=${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||Sm.mimeTypes.includes(n)){const i=toe(this.loadOptions,{wms:{throwOnError:!0}}),s=Sm.parseSync?.(t,i);throw new Error(s)}}_parseError(e){const t=Sm.parseSync?.(e,this.loadOptions);return new Error(t)}}class Pae extends gw{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 h_.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 Mae extends Pae{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,l]of Object.entries(t))i+=s?"?":"&",s=!1,Array.isArray(l)?i+=`${o.toUpperCase()}=${l.join(",")}`:i+=`${o.toUpperCase()}=${l?String(l):""}`;return i}async checkResponse(e){if(!e.ok)throw new Error("error")}}const Rae={type:"arcgis-image-server",testURL:r=>r.toLowerCase().includes("ImageServer"),create:r=>new Mae(r)},Oae=[Iae,Rae];function Dae(r){return joe(r,Oae)}const GB=6378137*Math.PI;function jB(r){const e=Yc(r);return e[0]=(e[0]/256-1)*GB,e[1]=(e[1]/256-1)*GB,e}const Fae={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 vw extends Ss{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 $_({...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 gw)return e.data;if(typeof e.data=="string")return Dae({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:l}=e,f=this.getRequestId();let{srs:A}=this.props;A==="auto"&&(A=e.resolution?"EPSG:4326":"EPSG:3857");const v={width:o,height:l,boundingBox:[[s[0],s[1]],[s[2],s[3]]],layers:n,crs:A};if(A==="EPSG:3857"){const T=jB([s[0],s[1]]),I=jB([s[2],s[3]]);
vendor: 10,874 bytes, line 4186
4186v.boundingBox=[T,I]}try{this.state.loadCounter++,this.props.onImageLoadStart(f);const T=await this.state.imageSource.getImage(v);this.state.lastRequestId<f&&(this.getCurrentLayer()?.props.onImageLoad(f),this.setState({image:T,bounds:s,lastRequestParameters:v,lastRequestId:f}))}catch(T){this.raiseError(T,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(f,T)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,t=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),t)}}vw.layerName="WMSLayer";vw.defaultProps=Fae;const Lae={getHeight:{type:"accessor",value:0},greatCircle:!0};class bw extends yg{}bw.layerName="GreatCircleLayer";bw.defaultProps=Lae;const kae={...af.defaultProps};class lf extends Ss{indexToBounds(){return null}renderLayers(){const{elevationScale:e,extruded:t,wireframe:n,filled:i,stroked:s,lineWidthUnits:o,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:A,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:I,getElevation:F,getFillColor:N,getLineColor:U,getLineWidth:$}=this.props,{updateTriggers:V,material:j,transitions:X}=this.props,ue=this.getSubLayerClass("cell",af),{updateTriggers:K,...se}=this.indexToBounds()||{};return new ue({filled:i,wireframe:n,extruded:t,elevationScale:e,stroked:s,lineWidthUnits:o,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:A,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:I,material:j,transitions:X,getElevation:F,getFillColor:N,getLineColor:U,getLineWidth:$},this.getSubLayerProps({id:"cell",updateTriggers:V&&{...K,getElevation:V.getElevation,getFillColor:V.getFillColor,getLineColor:V.getLineColor,getLineWidth:V.getLineWidth}}),se)}}lf.layerName="GeoCellLayer";lf.defaultProps=kae;function Nae(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 Im={exports:{}},Uae=Im.exports,HB;function zae(){return HB||(HB=1,(function(r){(function(e,t){typeof Nae=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Uae,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,Ce;return pe?(me>>>=0,(Ce=0<=me&&me<256)&&(re=i[me],re)?re:(W=l(me,(me|0)<0?-1:0,!0),Ce&&(i[me]=W),W)):(me|=0,(Ce=-128<=me&&me<128)&&(re=n[me],re)?re:(W=l(me,me<0?-1:0,!1),Ce&&(n[me]=W),W))}e.fromInt=s;function o(me,pe){if(isNaN(me)||!isFinite(me))return pe?j:V;if(pe){if(me<0)return j;if(me>=N)return Ee}else{if(me<=-U)return Ue;if(me+1>=U)return se}return me<0?o(-me,pe).neg():l(me%F|0,me/F|0,pe)}e.fromNumber=o;function l(me,pe,W){return new e(me,pe,W)}e.fromBits=l;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 V;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 Ce=o(f(W,8)),et=V,_e=0;_e<me.length;_e+=8){var Le=Math.min(8,me.length-_e),Ve=parseInt(me.substring(_e,_e+Le),W);if(Le<8){var Ye=o(f(W,Le));et=et.mul(Ye).add(o(Ve))}else et=et.mul(Ce),et=et.add(o(Ve))}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):l(me.low,me.high,me.unsigned)}e.fromValue=v;var T=65536,I=1<<24,F=T*T,N=F*F,U=N/2,$=s(I),V=s(0);e.ZERO=V;var j=s(0,!0);e.UZERO=j;var X=s(1);e.ONE=X;var ue=s(1,!0);e.UONE=ue;var K=s(-1);e.NEG_ONE=K;var se=l(-1,2147483647,!1);e.MAX_VALUE=se;var Ee=l(-1,-1,!0);e.MAX_UNSIGNED_VALUE=Ee;var Ue=l(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),Ce=re.mul(W).sub(this);return re.toString(pe)+Ce.toInt().toString(pe)}else return"-"+this.neg().toString(pe);for(var et=o(f(pe,6),this.unsigned),_e=this,Le="";;){var Ve=_e.div(et),Ye=_e.sub(Ve.mul(et)).toInt()>>>0,tt=Ye.toString(pe);if(_e=Ve,_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(X)},de.neg=de.negate,de.add=function(pe){t(pe)||(pe=v(pe));var W=this.high>>>16,re=this.high&65535,Ce=this.low>>>16,et=this.low&65535,_e=pe.high>>>16,Le=pe.high&65535,Ve=pe.low>>>16,Ye=pe.low&65535,tt=0,rt=0,ut=0,vt=0;return vt+=et+Ye,ut+=vt>>>16,vt&=65535,ut+=Ce+Ve,rt+=ut>>>16,ut&=65535,rt+=re+Le,tt+=rt>>>16,rt&=65535,tt+=W+_e,tt&=65535,l(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 V;if(this.eq(Ue))return pe.isOdd()?Ue:V;if(pe.eq(Ue))return this.isOdd()?Ue:V;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,Ce=this.low>>>16,et=this.low&65535,_e=pe.high>>>16,Le=pe.high&65535,Ve=pe.low>>>16,Ye=pe.low&65535,tt=0,rt=0,ut=0,vt=0;return vt+=et*Ye,ut+=vt>>>16,vt&=65535,ut+=Ce*Ye,rt+=ut>>>16,ut&=65535,ut+=et*Ve,rt+=ut>>>16,ut&=65535,rt+=re*Ye,tt+=rt>>>16,rt&=65535,rt+=Ce*Ve,tt+=rt>>>16,rt&=65535,rt+=et*Le,tt+=rt>>>16,rt&=65535,tt+=W*Ye+re*Ve+Ce*Le+et*_e,tt&=65535,l(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?j:V;var W,re,Ce;if(this.unsigned){if(pe.unsigned||(pe=pe.toUnsigned()),pe.gt(this))return j;if(pe.gt(this.shru(1)))return ue;Ce=j}else{if(this.eq(Ue)){if(pe.eq(X)||pe.eq(K))return Ue;if(pe.eq(Ue))return X;var et=this.shr(1);return W=et.div(pe).shl(1),W.eq(V)?pe.isNegative()?X:K:(re=this.sub(pe.mul(W)),Ce=W.add(re.div(pe)),Ce)}else if(pe.eq(Ue))return this.unsigned?j:V;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();Ce=V}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),Ve=o(W),Ye=Ve.mul(pe);Ye.isNegative()||Ye.gt(re);)W-=Le,Ve=o(W,this.unsigned),Ye=Ve.mul(pe);Ve.isZero()&&(Ve=X),Ce=Ce.add(Ve),re=re.sub(Ye)}return Ce},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 l(~this.low,~this.high,this.unsigned)},de.and=function(pe){return t(pe)||(pe=v(pe)),l(this.low&pe.low,this.high&pe.high,this.unsigned)},de.or=function(pe){return t(pe)||(pe=v(pe)),l(this.low|pe.low,this.high|pe.high,this.unsigned)},de.xor=function(pe){return t(pe)||(pe=v(pe)),l(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?l(this.low<<pe,this.high<<pe|this.low>>>32-pe,this.unsigned):l(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?l(this.low>>>pe|this.high<<32-pe,this.high>>pe,this.unsigned):l(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 l(re>>>pe|W<<32-pe,W>>>pe,this.unsigned)}else return pe===32?l(W,0,this.unsigned):l(W>>>pe-32,0,this.unsigned)},de.shru=de.shiftRightUnsigned,de.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},de.toUnsigned=function(){return this.unsigned?this:l(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})})(Im)),Im.exports}var Vae=zae();const Bm=uh(Vae),Gae=3,jae=30,Hae=2*jae+1,WB=180/Math.PI;function Wae(r,e,t){const n=1<<e;return[(r[0]+t[0])/n,(r[1]+t[1])/n]}function $B(r){return r>=.5?1/3*(4*r*r-1):1/3*(1-4*(1-r)*(1-r))}function $ae(r){return[$B(r[0]),$B(r[1])]}function Xae(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 qae([r,e,t]){const n=Math.atan2(t,Math.sqrt(r*r+e*e));return[Math.atan2(e,r)*WB,n*WB]}function Jae(r){let e=Bm.fromString(r,!0,10).toString(2);for(;e.length<Gae+Hae;)e="0"+e;const t=e.lastIndexOf("1"),n=e.substring(0,3),i=e.substring(3,t),s=i.length/2,o=Bm.fromString(n,!0,2).toString(10);
4186let l=Bm.fromString(i,!0,2).toString(4);for(;l.length<s;)l="0"+l;return`${o}/${l}`}function Kae(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 Zae(r){const e=r.split("/"),t=parseInt(e[0],10),n=e[1],i=n.length,s=[0,0];let o;for(let l=i-1;l>=0;l--){o=i-l;const f=n[l];let A=0,v=0;f==="1"?v=1:f==="2"?(A=1,v=1):f==="3"&&(A=1);const T=Math.pow(2,o-1);Kae(T,s,A,v),s[0]+=T*A,s[1]+=T*v}if(t%2===1){const l=s[0];s[0]=s[1],s[1]=l}return{face:t,ij:s,level:o}}function Yae(r){const e=r.padEnd(16,"0");return Bm.fromString(e,16)}const Qae=100;function ele({face:r,ij:e,level:t}){const n=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(Qae*Math.pow(2,-t))),s=new Float64Array(4*i*2+2);let o=0,l=0;for(let f=0;f<4;f++){const A=n[f].slice(0),v=n[f+1],T=(v[0]-A[0])/i,I=(v[1]-A[1])/i;for(let F=0;F<i;F++){A[0]+=T,A[1]+=I;const N=Wae(e,t,A),U=$ae(N),$=Xae(r,U),V=qae($);Math.abs(V[1])>89.999&&(V[0]=l);const j=V[0]-l;V[0]+=j>180?-360:j<-180?360:0,s[o++]=V[0],s[o++]=V[1],l=V[0]}}return s[o++]=s[0],s[o++]=s[1],s}function tle(r){if(typeof r=="string"){if(r.indexOf("/")>0)return r;r=Yae(r)}return Jae(r.toString())}function rle(r){const e=tle(r),t=Zae(e);return ele(t)}const nle={getS2Token:{type:"accessor",value:r=>r.token}};class K_ extends lf{indexToBounds(){const{data:e,getS2Token:t}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,i)=>rle(t(n,i))}}}K_.layerName="S2Layer";K_.defaultProps=nle;const wb=512;function ile(r,e){let t=0,n=0,i=1<<r.length;const s=i/wb;for(let o=0;o<r.length;o++){i>>=1;const l=parseInt(r[o]);l%2&&(t|=i),l>1&&(n|=i)}return[[t/s,wb-n/s],[(t+e)/s,wb-(n+e)/s]]}function sle(r,e=1){const[t,n]=ile(r,e),[i,s]=uc(t),[o,l]=uc(n);return[o,s,o,l,i,l,i,s,o,s]}const ole={getQuadkey:{type:"accessor",value:r=>r.quadkey}};class Z_ extends lf{indexToBounds(){const{data:e,extruded:t,getQuadkey:n}=this.props,i=t?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(s,o)=>sle(n(s,o),i),updateTriggers:{getPolygon:i}}}}Z_.layerName="QuadkeyLayer";Z_.defaultProps=ole;const ale="Queued Requests",lle="Active Requests",cle="Cancelled Requests",ule="Queued Requests Ever",fle="Active Requests Ever",hle={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class dle{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...hle,...e},this.stats=new hh({id:this.props.id}),this.stats.get(ale),this.stats.get(lle),this.stats.get(cle),this.stats.get(ule),this.stats.get(fle)}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}}class _L{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:l,userData:f,zoom:A}=this,v=this._loaderId;this._abortController=new AbortController;const{signal:T}=this._abortController,I=await t.scheduleRequest(this,U=>U.isSelected?1:-1);if(!I){this._isCancelled=!0;return}if(this._isCancelled){I.done();return}let F=null,N;try{F=await e({index:s,id:o,bbox:l,userData:f,zoom:A,signal:T})}catch(U){N=U||!0}finally{I.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},XB=new dt,ple=new dt;class xw{constructor(e=[0,0,0],t=[0,0,0],n){n=n||XB.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 xw(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=ple.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=XB.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 gA=new dt,qB=new dt;class Sg{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=gA.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 Sg(this.center,this.radius)}union(e){const t=this.center,n=this.radius,i=e.center,s=e.radius,o=gA.copy(i).subtract(t),l=o.magnitude();if(n>=l+s)return this.clone();if(s>=l+n)return e.clone();const f=(n+l+s)*.5;return qB.copy(o).scale((-n+f)/l).add(t),this.center.copy(qB),this.radius=f,this}expand(e){const n=gA.from(e).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(e){this.center.transform(e);const t=aV(gA,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=gA.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 Ale=new dt,gle=new dt,G0=new dt,j0=new dt,H0=new dt,mle=new dt,_le=new dt,zc={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8};class Ig{constructor(e=[0,0,0],t=[0,0,0,0,0,0,0,0,0]){this.center=new dt().from(e),this.halfAxes=new Oi(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 YA().fromMatrix3(new Oi([...i,...s,...o]))}fromCenterHalfSizeQuaternion(e,t,n){const i=new YA(n),s=new Oi().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 Ig(this.center,this.halfAxes)}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Sg){const t=this.halfAxes,n=t.getColumn(0,G0),i=t.getColumn(1,j0),s=t.getColumn(2,H0),o=Ale.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,l=n.z,f=Math.abs(s*i[zc.COLUMN0ROW0]+o*i[zc.COLUMN0ROW1]+l*i[zc.COLUMN0ROW2])+Math.abs(s*i[zc.COLUMN1ROW0]+o*i[zc.COLUMN1ROW1]+l*i[zc.COLUMN1ROW2])+Math.abs(s*i[zc.COLUMN2ROW0]+o*i[zc.COLUMN2ROW1]+l*i[zc.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=gle.from(e).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,G0),s=n.getColumn(1,j0),o=n.getColumn(2,H0),l=i.magnitude(),f=s.magnitude(),A=o.magnitude();i.normalize(),s.normalize(),o.normalize();let v=0,T;return T=Math.abs(t.dot(i))-l,T>0&&(v+=T*T),T=Math.abs(t.dot(s))-f,T>0&&(v+=T*T),T=Math.abs(t.dot(o))-A,T>0&&(v+=T*T),v}computePlaneDistances(e,t,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const o=this.center,l=this.halfAxes,f=l.getColumn(0,G0),A=l.getColumn(1,j0),v=l.getColumn(2,H0),T=mle.copy(f).add(A).add(v).add(o),I=_le.copy(T).subtract(e);let F=t.dot(I);return i=Math.min(F,i),s=Math.max(F,s),T.copy(o).add(f).add(A).subtract(v),I.copy(T).subtract(e),F=t.dot(I),i=Math.min(F,i),s=Math.max(F,s),T.copy(o).add(f).subtract(A).add(v),I.copy(T).subtract(e),F=t.dot(I),i=Math.min(F,i),s=Math.max(F,s),T.copy(o).add(f).subtract(A).subtract(v),I.copy(T).subtract(e),F=t.dot(I),i=Math.min(F,i),s=Math.max(F,s),o.copy(T).subtract(f).add(A).add(v),I.copy(T).subtract(e),F=t.dot(I),i=Math.min(F,i),s=Math.max(F,s),o.copy(T).subtract(f).add(A).subtract(v),I.copy(T).subtract(e),F=t.dot(I),i=Math.min(F,i),s=Math.max(F,s),o.copy(T).subtract(f).subtract(A).add(v),I.copy(T).subtract(e),F=t.dot(I),i=Math.min(F,i),s=Math.max(F,s),o.copy(T).subtract(f).subtract(A).subtract(v),I.copy(T).subtract(e),F=t.dot(I),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,G0);t.transformAsPoint(e);const n=this.halfAxes.getColumn(1,j0);n.transformAsPoint(e);const i=this.halfAxes.getColumn(2,H0);return i.transformAsPoint(e),this.halfAxes=new Oi([...t,...n,...i]),this}getTransform(){throw new Error("not implemented")}}const JB=new dt,KB=new dt;class Al{constructor(e=[0,0,1],t=0){this.normal=new dt,this.distance=-0,this.fromNormalDistance(e,t)}fromNormalDistance(e,t){return gl(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}fromPointNormal(e,t){e=JB.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),gl(ga(this.normal.len(),1)),this.distance=i,this}clone(){return new Al(this.normal,this.distance)}equals(e){return ga(this.distance,e.distance)&&ga(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const t=KB.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=JB.from(e),i=this.getPointDistance(n),s=KB.copy(this.normal).scale(i);return n.subtract(s).to(t)}}const ZB=[new dt([1,0,0]),new dt([0,1,0]),new dt([0,0,1])],YB=new dt,yle=new dt;class pa{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*ZB.length;const t=e.center,n=e.radius;let i=0;for(const s of ZB){let o=this.planes[i],l=this.planes[i+1];o||(o=this.planes[i]=new Al),l||(l=this.planes[i+1]=new Al);const f=YB.copy(s).scale(-n).add(t);o.fromPointNormal(f,s);const A=YB.copy(s).scale(n).add(t),v=yle.copy(s).negate();l.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(gl(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 l=i[s],f=e.intersectPlane(l);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;const ec=new Oi,vle=new Oi,ble=new Oi,W0=new Oi,QB=new Oi;function xle(r,e={}){const t=$V,n=10;let i=0,s=0;const o=vle,l=ble;o.identity(),l.copy(r);const f=t*wle(l);for(;s<n&&Tle(l)>f;)Ele(l,W0),QB.copy(W0).transpose(),l.multiplyRight(W0),l.multiplyLeft(QB),o.multiplyRight(W0),++i>2&&(++s,i=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=l.toTarget(e.diagonal),e}function wle(r){let e=0;for(let t=0;t<9;++t){const n=r[t];e+=n*n}return Math.sqrt(e)}const b2=[1,0,0],x2=[2,2,1];function Tle(r){let e=0;for(let t=0;t<3;++t){const n=r[ec.getElementIndex(x2[t],b2[t])];e+=2*n*n}return Math.sqrt(e)}function Ele(r,e){const t=LO;let n=0,i=1;for(let A=0;A<3;++A){const v=Math.abs(r[ec.getElementIndex(x2[A],b2[A])]);v>n&&(i=A,n=v)}const s=b2[i],o=x2[i];let l=1,f=0;if(Math.abs(r[ec.getElementIndex(o,s)])>
4186t){const A=r[ec.getElementIndex(o,o)],v=r[ec.getElementIndex(s,s)],T=r[ec.getElementIndex(o,s)],I=(A-v)/2/T;let F;I<0?F=-1/(-I+Math.sqrt(1+I*I)):F=1/(I+Math.sqrt(1+I*I)),l=1/Math.sqrt(1+F*F),f=F*l}return Oi.IDENTITY.to(e),e[ec.getElementIndex(s,s)]=e[ec.getElementIndex(o,o)]=l,e[ec.getElementIndex(o,s)]=f,e[ec.getElementIndex(s,o)]=-f,e}const Fu=new dt,Cle=new dt,Sle=new dt,Ile=new dt,Ble=new dt,Ple=new Oi,Mle={diagonal:new Oi,unitary:new Oi};function yL(r,e=new Ig){if(!r||r.length===0)return e.halfAxes=new Oi([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,l=0,f=0,A=0,v=0;for(const de of r){const me=Fu.copy(de).subtract(n);s+=me.x*me.x,o+=me.x*me.y,l+=me.x*me.z,f+=me.y*me.y,A+=me.y*me.z,v+=me.z*me.z}s*=i,o*=i,l*=i,f*=i,A*=i,v*=i;const T=Ple;T[0]=s,T[1]=o,T[2]=l,T[3]=o,T[4]=f,T[5]=A,T[6]=l,T[7]=A,T[8]=v;const{unitary:I}=xle(T,Mle),F=e.halfAxes.copy(I);let N=F.getColumn(0,Sle),U=F.getColumn(1,Ile),$=F.getColumn(2,Ble),V=-Number.MAX_VALUE,j=-Number.MAX_VALUE,X=-Number.MAX_VALUE,ue=Number.MAX_VALUE,K=Number.MAX_VALUE,se=Number.MAX_VALUE;for(const de of r)Fu.copy(de),V=Math.max(Fu.dot(N),V),j=Math.max(Fu.dot(U),j),X=Math.max(Fu.dot($),X),ue=Math.min(Fu.dot(N),ue),K=Math.min(Fu.dot(U),K),se=Math.min(Fu.dot($),se);N=N.multiplyByScalar(.5*(ue+V)),U=U.multiplyByScalar(.5*(K+j)),$=$.multiplyByScalar(.5*(se+X)),e.center.copy(N).add(U).add($);const Ee=Cle.set(V-ue,j-K,X-se).multiplyByScalar(.5),Ue=new Oi([Ee[0],0,0,0,Ee[1],0,0,0,Ee[2]]);return e.halfAxes.multiplyRight(Ue),e}const $d=512,eP=3,vL=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],bL=vL.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Rle=bL.concat([[.25,.5],[.75,.5]]);class Xd{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 Xd(e,t,n),new Xd(e,t+1,n),new Xd(e+1,t,n),new Xd(e+1,t+1,n)]}return this._children}update(e){const{viewport:t,cullingVolume:n,elevationBounds:i,minZ:s,maxZ:o,bounds:l,offset:f,project:A}=e,v=this.getBoundingVolume(i,f,A);if(l&&!this.insideBounds(l)||n.computeVisibility(v)<0)return!1;if(!this.childVisible){let{z:I}=this;if(I<o&&I>=s){const F=v.distanceTo(t.cameraPosition)*t.scale/t.height;I+=Math.floor(Math.log2(F))}if(I>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const I of this.children)I.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=$d/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?Rle:this.z<2?bL:vL,A=[];for(const v of f){const T=T2(this.x+v[0],this.y+v[1],this.z);T[2]=e[0],A.push(n(T)),e[0]!==e[1]&&(T[2]=e[1],A.push(n(T)))}return yL(A)}const i=Math.pow(2,this.z),s=$d/i,o=this.x*s+t*$d,l=$d-(this.y+1)*s;return new xw([o,l,e[0]],[o+s,l+s,e[1]])}}function Ole(r,e,t,n){const i=r instanceof _J&&r.resolution?r.projectPosition:null,s=Object.values(r.getFrustumPlanes()).map(({normal:F,distance:N})=>new Al(F.clone().negate(),N)),o=new pa(s),l=r.distanceScales.unitsPerMeter[2],f=t&&t[0]*l||0,A=t&&t[1]*l||0,v=r instanceof tg&&r.pitch<=60?e:0;if(n){const[F,N,U,$]=n,V=Yc([F,$]),j=Yc([U,N]);n=[V[0],$d-V[1],j[0],$d-j[1]]}const T=new Xd(0,0,0),I={viewport:r,project:i,cullingVolume:o,elevationBounds:[f,A],minZ:v,maxZ:e,bounds:n,offset:0};if(T.update(I),r instanceof tg&&r.subViewports&&r.subViewports.length>1){for(I.offset=-1;T.update(I)&&!(--I.offset<-eP););for(I.offset=1;T.update(I)&&!(++I.offset>eP););}return T.getSelected()}const Qc=512,Dle=[-1/0,-1/0,1/0,1/0],d_={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 xL(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]
4186])];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 Fle(r){return Math.abs(r.split("").reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0))}function oh(r,e){if(!r||!r.length)return null;const{index:t,id:n}=e;if(Array.isArray(r)){const s=Fle(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 Lle(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 kle({viewport:r,z:e,cullRect:t}){return(r.subViewports||[r]).map(i=>w2(i,e||0,t))}function w2(r,e,t){if(!Array.isArray(e)){const s=t.x-r.x,o=t.y-r.y,{width:l,height:f}=t,A={targetZ:e},v=r.unproject([s,o],A),T=r.unproject([s+l,o],A),I=r.unproject([s,o+f],A),F=r.unproject([s+l,o+f],A);return[Math.min(v[0],T[0],I[0],F[0]),Math.min(v[1],T[1],I[1],F[1]),Math.max(v[0],T[0],I[0],F[0]),Math.max(v[1],T[1],I[1],F[1])]}const n=w2(r,e[0],t),i=w2(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 Nle(r,e,t){return t?xL(r,t).map(i=>i*e/Qc):r.map(n=>n*e/Qc)}function ww(r,e){return Math.pow(2,r)*Qc/e}function T2(r,e,t){const n=ww(t,Qc),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 tP(r,e,t,n){const i=ww(t,n);return[r/i*Qc,e/i*Qc]}function Ule(r,e,t,n,i=Qc){if(r.isGeospatial){const[A,v]=T2(e,t,n),[T,I]=T2(e+1,t+1,n);return{west:A,north:v,east:T,south:I}}const[s,o]=tP(e,t,n,i),[l,f]=tP(e+1,t+1,n,i);return{left:s,top:o,right:l,bottom:f}}function zle(r,e,t,n,i){const s=Lle(r,null,n),o=ww(e,t),[l,f,A,v]=Nle(s,o,i),T=[];for(let I=Math.floor(l);I<A;I++)for(let F=Math.floor(f);F<v;F++)T.push({x:I,y:F,z:e});return T}function Vle({viewport:r,maxZoom:e,minZoom:t,zRange:n,extent:i,tileSize:s=Qc,modelMatrix:o,modelMatrixInverse:l,zoomOffset:f=0}){let A=r.isGeospatial?Math.round(r.zoom+Math.log2(Qc/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&&l&&i&&!r.isGeospatial&&(v=xL(i,o)),r.isGeospatial?Ole(r,A,n,i):zle(r,A,s,v||Dle,l)}function Gle(r){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(r)}function jle(r){return Number.isFinite(r.west)&&Number.isFinite(r.north)&&Number.isFinite(r.east)&&Number.isFinite(r.south)}function Hle(r){let e={},t;return n=>{for(const i in n)if(!Wle(n[i],e[i])){t=r(n),e=n;break}return t}}function Wle(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 rP=1,Y_=2,$le="never",Xle="no-overlap",Tw="best-available",qle=5,Jle={[Tw]:Zle,[Xle]:Yle,[$le]:()=>{}},Kle={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}};class Q_{constructor(e){this._getCullBounds=Hle(kle),this.opts={...Kle,...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 dle({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)||!ga(this._zRange,t)||s){s&&(this._modelMatrixInverse=i.clone().invert(),this._modelMatrix=i),this._viewport=e,this._zRange=t;const l=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:t,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(f=>this._getTile(f,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(l
4186=>this._getTile(l.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,l,f]of n){let A;if("west"in i)A=i.west<l&&i.east>s&&i.south<f&&i.north>o;else{const v=Math.min(i.top,i.bottom),T=Math.max(i.top,i.bottom);A=i.left<l&&i.right>s&&v<f&&T>o}if(A)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:t,minZoom:n,zRange:i,modelMatrix:s,modelMatrixInverse:o}){const{tileSize:l,extent:f,zoomOffset:A}=this.opts;return Vle({viewport:e,maxZoom:t,minZoom:n,zRange:i,tileSize:l,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:Ule(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||Tw,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:Jle[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:qle*this.selectedTiles.length),i=t.maxCacheByteSize??1/0;if(e.size>n||this._cacheByteSize>i){for(const[o,l]of e)if(!l.isVisible&&!l.isSelected&&(this._cacheByteSize-=t.maxCacheByteSize!==null?l.byteLength:0,e.delete(o),this.opts.onTileUnload?.(l)),e.size<=n&&this._cacheByteSize<=i)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,l)=>o.zoom-l.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 _L(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 Zle(r){for(const e of r)e.state=0;for(const e of r)e.isSelected&&!wL(e)&&Ew(e);for(const e of r)e.isVisible=!!(e.state&Y_)}function Yle(r){for(const t of r)t.state=0;for(const t of r)t.isSelected&&wL(t);const e=Array.from(r).sort((t,n)=>t.zoom-n.zoom);for(const t of e)if(t.isVisible=!!(t.state&Y_),t.children&&(t.isVisible||t.state&rP))for(const n of t.children)n.state=rP;else t.isSelected&&Ew(t)}function wL(r){let e=r;for(;e;){if(e.isLoaded||e.content)return e.state|=Y_,!0;e=e.parent}return!1}function Ew(r){for(const e of r.children)e.isLoaded||e.content?e.state|=Y_:Ew(e)}const Qle={TilesetClass:Q_,data:{type:"data",value:[]},dataComparator:d_.equal,renderSubLayers:{type:"function",value:r=>new ru(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:Tw,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0};
4186class nu extends Ss{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:l,maxRequests:f,debounceTime:A,zoomOffset:v}=this.props;return{maxCacheSize:t,maxCacheByteSize:n,maxZoom:o,minZoom:l,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,l=this.state.frameNumber!==i;s&&(o||l)&&this._onViewportLoad(),l&&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)?oh(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=F_(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)}}nu.defaultProps=Qle;nu.layerName="TileLayer";const nP=`uniform tripsUniforms { 4187 bool fadeTrail; 4188 float trailLength; 4189 float currentTime; 4190} trips; 4191`,ece={name:"trips",vs:nP,fs:nP,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}},tce={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:r=>r.timestamps}};class ey extends sf{getShaders(){const e=super.getShaders();return e.inject={"vs:#decl":`in float instanceTimestamps; 4192in float instanceNextTimestamps; 4193out float vTime; 4194`,"vs:#main-end":`vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength; 4195`,"fs:#decl":`in float vTime; 4196`,"fs:#main-start":`if(vTime > trips.currentTime || (trips.fadeTrail && (vTime < trips.currentTime - trips.trailLength))) { 4197 discard; 4198} 4199`,"fs:DECKGL_FILTER_COLOR":`if(trips.fadeTrail) { 4200 color.a *= 1.0 - (trips.currentTime - vTime) / trips.trailLength; 4201} 4202`},e.modules=[...e.modules,ece],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)}}ey.layerName="TripsLayer";ey.defaultProps=tce;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,Se){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}Se()},g.onerror=Se,g.send(null)};var l=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},T=function(){return A},I=8;function F(he,be,ae,Se){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":Ce[he>>1]=be;break;case"i32":et[he>>2]=be;break;case"i64":Qn=[be>>>0,(Sn=be,+xr(Sn)>=1?Sn>0?(yr(+_r(Sn/4294967296),4294967295)|0)>>>0:~~+jn((Sn-+(~~Sn>>>0))/4294967296)>>>0:0)],et[he>>2]=Qn[0],et[he+4>>2]=Qn[1];break;case"float":_e[he>>2]=be;break;case"double":Le[he>>3]=be;break;default:Fe("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 Ce[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:Fe("invalid type for getValue: "+be)}return null}var U=!1;function $(he,be){he||Fe("Assertion failed: "+be)}function V(he){var be=e["_"+he];return $(be,"Cannot call unknown function "+he+", make sure it is exported"),be}function j(he,be,ae,Se,g){var le={string:function(Pt){var jt=0;if(Pt!=null&&Pt!==0){var Ur=(Pt.length<<2)+1;jt=bt(Ur),Ue(Pt,jt,Ur)}return jt},array:function(Pt){var jt=bt(Pt.length);return de(Pt,jt),jt}};function xt(Pt){return be==="string"?se(Pt):be==="boolean"?!!Pt:Pt}var Je=V(he),Ct=[],Mt=0;if(Se)for(var Ft=0;Ft<Se.length;
4202Ft++){var ht=le[ae[Ft]];ht?(Mt===0&&(Mt=Te()),Ct[Ft]=ht(Se[Ft])):Ct[Ft]=Se[Ft]}var Lt=Je.apply(null,Ct);return Lt=xt(Lt),Mt!==0&&St(Mt),Lt}function X(he,be,ae,Se){ae=ae||[];var g=ae.every(function(xt){return xt==="number"}),le=be!=="string";return le&&g&&!Se?V(he):function(){return j(he,be,ae,arguments)}}var ue=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function K(he,be,ae){for(var Se=be+ae,g=be;he[g]&&!(g>=Se);)++g;if(g-be>16&&he.subarray&&ue)return ue.decode(he.subarray(be,g));for(var le="";be<g;){var xt=he[be++];if(!(xt&128)){le+=String.fromCharCode(xt);continue}var Je=he[be++]&63;if((xt&224)==192){le+=String.fromCharCode((xt&31)<<6|Je);continue}var Ct=he[be++]&63;if((xt&240)==224?xt=(xt&15)<<12|Je<<6|Ct:xt=(xt&7)<<18|Je<<12|Ct<<6|he[be++]&63,xt<65536)le+=String.fromCharCode(xt);else{var Mt=xt-65536;le+=String.fromCharCode(55296|Mt>>10,56320|Mt&1023)}}return le}function se(he,be){return he?K(re,he,be):""}function Ee(he,be,ae,Se){if(!(Se>0))return 0;for(var g=ae,le=ae+Se-1,xt=0;xt<he.length;++xt){var Je=he.charCodeAt(xt);if(Je>=55296&&Je<=57343){var Ct=he.charCodeAt(++xt);Je=65536+((Je&1023)<<10)|Ct&1023}if(Je<=127){if(ae>=le)break;be[ae++]=Je}else if(Je<=2047){if(ae+1>=le)break;be[ae++]=192|Je>>6,be[ae++]=128|Je&63}else if(Je<=65535){if(ae+2>=le)break;be[ae++]=224|Je>>12,be[ae++]=128|Je>>6&63,be[ae++]=128|Je&63}else{if(ae+3>=le)break;be[ae++]=240|Je>>18,be[ae++]=128|Je>>12&63,be[ae++]=128|Je>>6&63,be[ae++]=128|Je&63}}return be[ae]=0,ae-g}function Ue(he,be,ae){return Ee(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,Ce,et,_e,Le;function Ve(he){pe=he,e.HEAP8=W=new Int8Array(he),e.HEAP16=Ce=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 Ye=5267040,tt=24128,rt=e.TOTAL_MEMORY||33554432;e.buffer?pe=e.buffer:pe=new ArrayBuffer(rt),rt=pe.byteLength,Ve(pe),et[tt>>2]=Ye;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=[],It=[],st=[],dr=[];function er(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)cn(e.preRun.shift());ut(vt)}function Jt(){ut(It)}function Nt(){ut(st)}function Ar(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Mr(e.postRun.shift());ut(dr)}function cn(he){vt.unshift(he)}function Mr(he){dr.unshift(he)}var xr=Math.abs,jn=Math.ceil,_r=Math.floor,yr=Math.min,un=0,Dr=null;function li(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,ri="data:application/octet-stream;base64,";function Hn(he){return String.prototype.startsWith?he.startsWith(ri):he.indexOf(ri)===0}var Sn,Qn;mn
vendor: 19,357 bytes, line 4202
4202="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 4202
42024AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/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=";
4202var Gt=24144;function mr(he,be,ae,Se){Fe("Assertion failed: "+se(he)+", at: "+[be?se(be):"unknown filename",ae,Se?se(Se):"unknown function"])}function Rr(){return W.length}function nn(he,be,ae){re.set(re.subarray(be,be+ae),he)}function gi(he){return e.___errno_location&&(et[e.___errno_location()>>2]=he),he}function Pe(he){Fe("OOM")}function kt(he){try{var be=new ArrayBuffer(he);return be.byteLength!=he?void 0:(new Int8Array(be).set(W),H(be),Ve(be),1)}catch{}}function Wt(he){var be=Rr(),ae=16777216,Se=2147483648-ae;if(he>Se)return!1;for(var g=16777216,le=Math.max(be,g);le<he;)le<=536870912?le=me(2*le,ae):le=Math.min(me((3*le+2147483648)/4,ae),Se);var xt=kt(le);return!!xt}var cr=typeof atob=="function"?atob:function(he){var be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
4202+/=",ae="",Se,g,le,xt,Je,Ct,Mt,Ft=0;he=he.replace(/[^A-Za-z0-9\+\/\=]/g,"");do xt=be.indexOf(he.charAt(Ft++)),Je=be.indexOf(he.charAt(Ft++)),Ct=be.indexOf(he.charAt(Ft++)),Mt=be.indexOf(he.charAt(Ft++)),Se=xt<<2|Je>>4,g=(Je&15)<<4|Ct>>2,le=(Ct&3)<<6|Mt,ae=ae+String.fromCharCode(Se),Ct!==64&&(ae=ae+String.fromCharCode(g)),Mt!==64&&(ae=ae+String.fromCharCode(le));while(Ft<he.length);return ae};function Ze(he){try{for(var be=cr(he),ae=new Uint8Array(be.length),Se=0;Se<be.length;++Se)ae[Se]=be.charCodeAt(Se);return ae}catch{throw new Error("Converting base64 string to bytes failed.")}}function Rt(he){if(Hn(he))return Ze(he.slice(ri.length))}var Ae={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},Vt={b:v,c:T,d:mr,e:gi,f:Rr,g:nn,h:Wt,i:Pe,o:Gt,p:tt},Et=(function(he,be,ae){"almost asm";var Se=new he.Int8Array(ae),g=new he.Int32Array(ae);new he.Uint8Array(ae),new he.Float32Array(ae);var le=new he.Float64Array(ae),xt=be.o|0,Je=be.p|0,Ct=he.Math.floor,Mt=he.Math.abs,Ft=he.Math.sqrt,ht=he.Math.pow,Lt=he.Math.cos,Pt=he.Math.sin,jt=he.Math.tan,Ur=he.Math.acos,Qt=he.Math.asin,en=he.Math.atan,ln=he.Math.atan2,$r=he.Math.ceil,Xr=he.Math.imul,Gr=he.Math.min,mi=he.Math.max,qr=he.Math.clz32,pr=be.b,Be=be.c,qt=be.d,tn=be.e,Wi=be.f,_a=be.g,ci=be.h,Wn=be.i,Ie=24160;function Ho(y){return Se=new Int8Array(y),g=new Int32Array(y),le=new Float64Array(y),ae=y,!0}function $n(y){y=y|0;var _=0;return _=Ie,Ie=Ie+y|0,Ie=Ie+15&-16,_|0}function Wo(){return Ie|0}function Fi(y){y=y|0,Ie=y}function ui(y,_){y=y|0,Ie=y}function Si(y,_){y=y|0,_=_|0;var b=0,w=0,S=0;return(y|0)<0?(_=2,_|0):(y|0)>13780509?(_=Yo(15,_)|0,_|0):(b=((y|0)<0)<<31>>31,S=di(y|0,b|0,3,0)|0,w=Be()|0,b=An(y|0,b|0,1,0)|0,b=di(S|0,w|0,b|0,Be()|0)|0,b=An(b|0,Be()|0,1,0)|0,y=Be()|0,g[_>>2]=b,g[_+4>>2]=y,_=0,_|0)}function Rn(y,_,b,w){return y=y|0,_=_|0,b=b|0,w=w|0,ms(y,_,b,w,0)|0}function ms(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0;if(d=Ie,Ie=Ie+16|0,D=d,!($i(y,_,b,w,S)|0))return w=0,Ie=d,w|0;do if((b|0)>=0){if((b|0)>13780509){if(P=Yo(15,D)|0,P|0)break;c=D,D=g[c>>2]|0,c=g[c+4>>2]|0}else P=((b|0)<0)<<31>>31,h=di(b|0,P|0,3,0)|0,c=Be()|0,P=An(b|0,P|0,1,0)|0,P=di(h|0,c|0,P|0,Be()|0)|0,P=An(P|0,Be()|0,1,0)|0,c=Be()|0,g[D>>2]=P,g[D+4>>2]=c,D=P;if(na(w|0,0,D<<3|0)|0,S|0){na(S|0,0,D<<2|0)|0,P=Ns(y,_,b,w,S,D,c,0)|0;break}P=oo(D,4)|0,P?(h=Ns(y,_,b,w,P,D,c,0)|0,zr(P),P=h):P=13}else P=2;while(!1);return h=P,Ie=d,h|0}function $i(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0;if(z=Ie,Ie=Ie+16|0,R=z,L=z+8|0,M=R,g[M>>2]=y,g[M+4>>2]=_,(b|0)<0)return L=2,Ie=z,L|0;if(P=w,g[P>>2]=y,g[P+4>>2]=_,P=(S|0)!=0,P&&(g[S>>2]=0),On(y,_)|0)return L=9,Ie=z,L|0;g[L>>2]=0;e:do if((b|0)>=1)if(P)for(m=1,h=0,E=0,M=1,P=y;;){if(!(h|E)){if(P=In(P,_,4,L,R)|0,P|0)break e;if(_=R,P=g[_>>2]|0,_=g[_+4>>2]|0,On(P,_)|0){P=9;break e}}if(P=In(P,_,g[22384+(E<<2)>>2]|0,L,R)|0,P|0)break e;if(_=R,P=g[_>>2]|0,_=g[_+4>>2]|0,y=w+(m<<3)|0,g[y>>2]=P,g[y+4>>2]=_,g[S+(m<<2)>>2]=M,y=h+1|0,D=(y|0)==(M|0),c=E+1|0,d=(c|0)==6,On(P,_)|0){P=9;break e}if(M=M+(d&D&1)|0,(M|0)>(b|0)){P=0;break}else m=m+1|0,h=D?0:y,E=D?d?0:c:E}else for(m=1,h=0,E=0,M=1,P=y;;){if(!(h|E)){if(P=In(P,_,4,L,R)|0,P|0)break e;if(_=R,P=g[_>>2]|0,_=g[_+4>>2]|0,On(P,_)|0){P=9;break e}}if(P=In(P,_,g[22384+(E<<2)>>2]|0,L,R)|0,P|0)break e;if(_=R,P=g[_>>2]|0,_=g[_+4>>2]|0,y=w+(m<<3)|0,g[y>>2]=P,g[y+4>>2]=_,y=h+1|0,D=(y|0)==(M|0),c=E+1|0,d=(c|0)==6,On(P,_)|0){P=9;break e}if(M=M+(d&D&1)|0,(M|0)>(b|0)){P=0;break}else m=m+1|0,h=D?0:y,E=D?d?0:c:E}else P=0;while(!1);return L=P,Ie=z,L|0}function Ns(y,_,b,w,S,P,D,c){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0,P=P|0,D=D|0,c=c|0;var d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0;if(z=Ie,Ie=Ie+16|0,R=z+8|0,L=z,d=To(y|0,_|0,P|0,D|0)|0,m=Be()|0,E=w+(d<<3)|0,q=E,ee=g[q>>2]|0,q=g[q+4>>2]|0,h=(ee|0)==(y|0)&(q|0)==(_|0),!((ee|0)==0&(q|0)==0|h))do d=An(d|0,m|0,1,0)|0,d=os(d|0,Be()|0,P|0,D|0)|0,m=Be()|0,E=w+(d<<3)|0,ee=E,q=g[ee>>2]|0,ee=g[ee+4>>2]|0,h=(q|0)==(y|0)&(ee|0)==(_|0);while(!((q|0)==0&(ee|0)==0|h));if(d=S+(d<<2)|0,h&&(g[d>>2]|0)<=(c|0)||(ee=E,g[ee>>2]=y,g[ee+4>>2]=_,g[d>>2]=c,(c|0)>=(b|0)))return ee=0,Ie=z,ee|0;switch(h=c+1|0,g[R>>2]=0,d=In(y,_,2,R,L)|0,d|0){case 9:{M=9;break}case 0:{d=L,d=Ns(g[d>>2]|0,g[d+4>>2]|0,b,w,S,P,D,h)|0,d||(M=9);break}}e:do if((M|0)==9){switch(g[R>>2]=0,d=In(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,w,S,P,D,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=In(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,w,S,P,D,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=In(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,w,S,P,D,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=In(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,w,S,P,D,h)|0,d|0)break e;break}default:break e}switch(g[R>>2]=0,d=In(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,w,S,P,D,h)|0,d|0)break e;break}default:break e}return ee=0,Ie=z,ee|0}while(!1);return ee=d,Ie=z,ee|0}function In(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0;if(b>>>0>6)return S=1,S|0;if(E=(g[w>>2]|0)%6|0,g[w>>2]=E,(E|0)>0){P=0;do b=bo(b)|0,P=P+1|0;while((P|0)<(g[w>>2]|0))}if(E=Xt(y|0,_|0,45)|0,Be()|0,m=E&127,m>>>0>121)return S=5,S|0;d=ns(y,_)|0,P=Xt(y|0,_|0,52)|0,Be()|0,P=P&15;e:do if(!P)h=8;else{for(;;){if(D=(15-P|0)*3|0,c=Xt(y|0,_|0,D|0)|0,Be()|0,c=c&7,(c|0)==7){_=5;break}if(L=(zs(P)|0)==0,P=P+-1|0,M=rr(7,0,D|0)|0,_=_&~(Be()|0),R=rr(g[(L?432:16)+(c*28|0)+(b<<2)>>2]|0,0,D|0)|0,D=Be()|0,b=g[(L?640:224)+(c*28|0)+(b<<2)>>2]|0,y=R|y&~M,_=D|_,!b){b=0;break e}if(!P){h=8;break e}}return _|0}while(!1);(h|0)==8&&(L=g[848+(m*28|0)+(b<<2)>>2]|0,R=rr(L|0,0,45)|0,y=R|y,_=Be()|0|_&-1040385,b=g[4272+(m*28|0)+(b<<2)>>2]|0,(L&127|0)==127&&(L=rr(g[848+(m*28|0)+20>>2]|0,0,45)|0,_=Be()|0|_&-1040385,b=g[4272+(m*28|0)+20>>2]|0,y=xo(L|y,_)|0,_=Be()|0,g[w>>2]=(g[w>>2]|0)+1)),c=Xt(y|0,_|0,45)|0,Be()|0,c=c&127;e:do if(Br(c)|0){t:do if((ns(y,_)|0)==1){if((m|0)!=(c|0))if(uf(c,g[7696+(m*28|0)>>2]|0)|0){y=Za(y,_)|0,D=1,_=Be()|0;break}else qt(23313,22416,436,22424);switch(d|0){case 3:{y=xo(y,_)|0,_=Be()|0,g[w>>2]=(g[w>>2]|0)+1,D=0;break t}case 5:{y=Za(y,_)|0,_=Be()|0,g[w>>2]=(g[w>>2]|0)+5,D=0;break t}case 0:return L=9,L|0;default:return L=1,L|0}}else D=0;while(!1);if((b|0)>0){P=0;
4202do y=Sa(y,_)|0,_=Be()|0,P=P+1|0;while((P|0)!=(b|0))}if((m|0)!=(c|0)){if(!(fi(c)|0)){if((D|0)!=0|(ns(y,_)|0)!=5)break;g[w>>2]=(g[w>>2]|0)+1;break}switch(E&127){case 8:case 118:break e}(ns(y,_)|0)!=3&&(g[w>>2]=(g[w>>2]|0)+1)}}else if((b|0)>0){P=0;do y=xo(y,_)|0,_=Be()|0,P=P+1|0;while((P|0)!=(b|0))}while(!1);return g[w>>2]=((g[w>>2]|0)+b|0)%6|0,L=S,g[L>>2]=y,g[L+4>>2]=_,L=0,L|0}function gc(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0;for(c=Ie,Ie=Ie+16|0,P=c,D=c+8|0,S=(On(y,_)|0)==0,S=S?1:2;;){if(g[D>>2]=0,h=(In(y,_,S,D,P)|0)==0,d=P,h&((g[d>>2]|0)==(b|0)?(g[d+4>>2]|0)==(w|0):0)){y=4;break}if(S=S+1|0,S>>>0>=7){S=7,y=4;break}}return(y|0)==4?(Ie=c,S|0):0}function xe(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0;if(L=Ie,Ie=Ie+16|0,M=L,R=L+8|0,E=M,g[E>>2]=y,g[E+4>>2]=_,!b)return R=w,g[R>>2]=y,g[R+4>>2]=_,R=0,Ie=L,R|0;g[R>>2]=0;e:do if(On(y,_)|0)y=9;else{if(P=(b|0)>0,P){S=0,E=y;do{if(y=In(E,_,4,R,M)|0,y|0)break e;if(_=M,E=g[_>>2]|0,_=g[_+4>>2]|0,S=S+1|0,On(E,_)|0){y=9;break e}}while((S|0)<(b|0));if(m=w,g[m>>2]=E,g[m+4>>2]=_,m=b+-1|0,P){h=0,y=1;do{if(S=22384+(h<<2)|0,(h|0)==5)for(D=g[S>>2]|0,P=0,S=y;;){if(y=M,y=In(g[y>>2]|0,g[y+4>>2]|0,D,R,M)|0,y|0)break e;if((P|0)!=(m|0))if(d=M,c=g[d>>2]|0,d=g[d+4>>2]|0,y=w+(S<<3)|0,g[y>>2]=c,g[y+4>>2]=d,!(On(c,d)|0))y=S+1|0;else{y=9;break e}else y=S;if(P=P+1|0,(P|0)>=(b|0))break;S=y}else for(D=M,d=g[S>>2]|0,c=0,S=y,P=g[D>>2]|0,D=g[D+4>>2]|0;;){if(y=In(P,D,d,R,M)|0,y|0)break e;if(D=M,P=g[D>>2]|0,D=g[D+4>>2]|0,y=w+(S<<3)|0,g[y>>2]=P,g[y+4>>2]=D,y=S+1|0,On(P,D)|0){y=9;break e}if(c=c+1|0,(c|0)>=(b|0))break;S=y}h=h+1|0}while(h>>>0<6);y=M,D=E,S=g[y>>2]|0,P=_,y=g[y+4>>2]|0}else D=E,S=E,P=_,y=_}else D=w,g[D>>2]=y,g[D+4>>2]=_,D=y,S=y,P=_,y=_;y=(D|0)==(S|0)&(P|0)==(y|0)?0:9}while(!1);return R=y,Ie=L,R|0}function Me(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0;if(c=Ie,Ie=Ie+48|0,S=c+16|0,P=c+8|0,D=c,b|0)return D=15,Ie=c,D|0;if(h=y,d=g[h+4>>2]|0,b=P,g[b>>2]=g[h>>2],g[b+4>>2]=d,_s(P,S),_=$o(S,_,D)|0,!_){if(b=g[P>>2]|0,P=g[y+8>>2]|0,(P|0)>0){S=g[y+12>>2]|0,_=0;do b=(g[S+(_<<3)>>2]|0)+b|0,_=_+1|0;while((_|0)<(P|0))}_=D,S=g[_>>2]|0,_=g[_+4>>2]|0,P=((b|0)<0)<<31>>31,(_|0)<(P|0)|(_|0)==(P|0)&S>>>0<b>>>0?(_=D,g[_>>2]=b,g[_+4>>2]=P,_=P):b=S,d=An(b|0,_|0,12,0)|0,h=Be()|0,_=D,g[_>>2]=d,g[_+4>>2]=h,_=w,g[_>>2]=d,g[_+4>>2]=h,_=0}return h=_,Ie=c,h|0}function We(y,_,b,w,S,P,D){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0,P=P|0,D=D|0;var c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0,Re=0,je=0,$e=0,nt=0,qe=0,Qe=0,pt=0,Dt=0,Tt=0,zt=0,sr=0,Cr=0;if(Dt=Ie,Ie=Ie+64|0,nt=Dt+48|0,qe=Dt+32|0,Qe=Dt+24|0,we=Dt+8|0,Oe=Dt,d=g[y>>2]|0,(d|0)<=0)return pt=0,Ie=Dt,pt|0;for(ge=y+4|0,Re=nt+8|0,je=qe+8|0,$e=we+8|0,c=0,te=0;;){h=g[ge>>2]|0,Y=h+(te<<4)|0,g[nt>>2]=g[Y>>2],g[nt+4>>2]=g[Y+4>>2],g[nt+8>>2]=g[Y+8>>2],g[nt+12>>2]=g[Y+12>>2],(te|0)==(d+-1|0)?(g[qe>>2]=g[h>>2],g[qe+4>>2]=g[h+4>>2],g[qe+8>>2]=g[h+8>>2],g[qe+12>>2]=g[h+12>>2]):(Y=h+(te+1<<4)|0,g[qe>>2]=g[Y>>2],g[qe+4>>2]=g[Y+4>>2],g[qe+8>>2]=g[Y+8>>2],g[qe+12>>2]=g[Y+12>>2]),d=va(nt,qe,w,Qe)|0;e:do if(d)h=0,c=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,Y=0;t:for(;;){if(Cr=+le[nt>>3],q=Jr(d|0,h|0,ee|0,Y|0)|0,sr=+(q>>>0)+4294967296*+(Be()|0),Tt=+(d>>>0)+4294967296*+(h|0),zt=+(ee>>>0)+4294967296*+(Y|0),le[we>>3]=Cr*sr/Tt+ +le[qe>>3]*zt/Tt,le[$e>>3]=+le[Re>>3]*sr/Tt+ +le[je>>3]*zt/Tt,d=Ya(we,w,Oe)|0,d|0){c=d;break}q=Oe,z=g[q>>2]|0,q=g[q+4>>2]|0,M=To(z|0,q|0,_|0,b|0)|0,m=Be()|0,d=D+(M<<3)|0,E=d,h=g[E>>2]|0,E=g[E+4>>2]|0;r:do if((h|0)==0&(E|0)==0)oe=d,pt=16;else for(R=0,L=0;;){if((R|0)>(b|0)|(R|0)==(b|0)&L>>>0>_>>>0){c=1;break t}if((h|0)==(z|0)&(E|0)==(q|0))break r;if(d=An(M|0,m|0,1,0)|0,M=os(d|0,Be()|0,_|0,b|0)|0,m=Be()|0,L=An(L|0,R|0,1,0)|0,R=Be()|0,d=D+(M<<3)|0,E=d,h=g[E>>2]|0,E=g[E+4>>2]|0,(h|0)==0&(E|0)==0){oe=d,pt=16;break}}while(!1);if((pt|0)==16&&(pt=0,!((z|0)==0&(q|0)==0))&&(L=oe,g[L>>2]=z,g[L+4>>2]=q,L=P+(g[S>>2]<<3)|0,g[L>>2]=z,g[L+4>>2]=q,L=S,L=An(g[L>>2]|0,g[L+4>>2]|0,1,0)|0,z=Be()|0,q=S,g[q>>2]=L,g[q+4>>2]=z),ee=An(ee|0,Y|0,1,0)|0,Y=Be()|0,h=Qe,d=g[h>>2]|0,h=g[h+4>>2]|0,!((h|0)>(Y|0)|(h|0)==(Y|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)){c=0,pt=21;break}}return(pt|0)==21?(Ie=Dt,c|0):0}function gt(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0,Re=0,je=0,$e=0,nt=0,qe=0,Qe=0,pt=0,Dt=0,Tt=0,zt=0,sr=0;if(sr=Ie,Ie=Ie+112|0,pt=sr+80|0,d=sr+72|0,Dt=sr,Tt=sr+56|0,b|0)return zt=15,Ie=sr,zt|0;if(h=y+8|0,zt=qn((g[h>>2]<<5)+32|0)|0,!zt)return zt=13,Ie=sr,zt|0;if(_f(y,zt),qe=y,Qe=g[qe+4>>2]|0,b=d,g[b>>2]=g[qe>>2],g[b+4>>2]=Qe,_s(d,pt),b=$o(pt,_,Dt)|0,b)qe=0,Qe=0;else{if(b=g[d>>2]|0,P=g[h>>2]|0,(P|0)>0){D=g[y+12>>2]|0,S=0;do b=(g[D+(S<<3)>>2]|0)+b|0,S=S+1|0;while((S|0)!=(P|0));S=b}else S=b;b=Dt,P=g[b>>2]|0,b=g[b+4>>2]|0,D=((S|0)<0)<<31>>31,(b|0)<(D|0)|(b|0)==(D|0)&P>>>0<S>>>0?(b=Dt,g[b>>2]=S,g[b+4>>2]=D,b=D):S=P,qe=An(S|0,b|0,12,0)|0,Qe=Be()|0,b=Dt,g[b>>2]=qe,g[b+4>>2]=Qe,b=0}if(b|0)return zr(zt),zt=b,Ie=sr,zt|0;if(S=oo(qe,8)|0,!S)return zr(zt),zt=13,Ie=sr,zt|0;if(c=oo(qe,8)|0,!c)return zr(zt),zr(S),zt=13,Ie=sr,zt|0;$e=pt,g[$e>>2]=0,g[$e+4>>2]=0,$e=y,nt=g[$e+4>>2]|0,b=d,g[b>>2]=g[$e>>2],g[b+4>>2]=nt,b=We(d,qe,Qe,_,pt,S,c)|0;e:do if(b)zr(S),zr(c),zr(zt);else{t:do if((g[h>>2]|0)>0){for(D=y+12|0,P=0;b=We((g[D>>2]|0)+(P<<3)|0,qe,Qe,_,pt,S,c)|0,P=P+1|0,!(b|0);)if((P|0)>=(g[h>>2]|0))break t;zr(S),zr(c),zr(zt);break e}while(!1);(Qe|0)>0|(Qe|0)==0&qe>>>0>0&&na(c|0,0,qe<<3|0)|0,nt=pt,$e=g[nt+4>>2]|0;
4202t:do if(($e|0)>0|($e|0)==0&(g[nt>>2]|0)>>>0>0){ge=S,Re=c,je=S,$e=c,nt=S,b=S,oe=S,we=c,Oe=c,S=c;r:for(;;){for(q=0,ee=0,Y=0,te=0,P=0,D=0;;){c=Dt,d=c+56|0;do g[c>>2]=0,c=c+4|0;while((c|0)<(d|0));if(_=ge+(q<<3)|0,h=g[_>>2]|0,_=g[_+4>>2]|0,$i(h,_,1,Dt,0)|0){c=Dt,d=c+56|0;do g[c>>2]=0,c=c+4|0;while((c|0)<(d|0));c=oo(7,4)|0,c|0&&(Ns(h,_,1,Dt,c,7,0,0)|0,zr(c))}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)c=P,d=D;else{if(m=To(R|0,L|0,qe|0,Qe|0)|0,h=Be()|0,c=w+(m<<3)|0,_=c,d=g[_>>2]|0,_=g[_+4>>2]|0,!((d|0)==0&(_|0)==0)){E=0,M=0;do{if((E|0)>(Qe|0)|(E|0)==(Qe|0)&M>>>0>qe>>>0)break r;if((d|0)==(R|0)&(_|0)==(L|0)){c=P,d=D;break n}c=An(m|0,h|0,1,0)|0,m=os(c|0,Be()|0,qe|0,Qe|0)|0,h=Be()|0,M=An(M|0,E|0,1,0)|0,E=Be()|0,c=w+(m<<3)|0,_=c,d=g[_>>2]|0,_=g[_+4>>2]|0}while(!((d|0)==0&(_|0)==0))}(R|0)==0&(L|0)==0?(c=P,d=D):(Ol(R,L,Tt)|0,Zt(y,zt,Tt)|0&&(M=An(P|0,D|0,1,0)|0,D=Be()|0,E=c,g[E>>2]=R,g[E+4>>2]=L,P=Re+(P<<3)|0,g[P>>2]=R,g[P+4>>2]=L,P=M),c=P,d=D)}while(!1);if(z=z+1|0,z>>>0>=7)break;P=c,D=d}if(q=An(q|0,ee|0,1,0)|0,ee=Be()|0,Y=An(Y|0,te|0,1,0)|0,te=Be()|0,D=pt,P=g[D>>2]|0,D=g[D+4>>2]|0,(te|0)<(D|0)|(te|0)==(D|0)&Y>>>0<P>>>0)P=c,D=d;else break}if((D|0)>0|(D|0)==0&P>>>0>0){P=0,D=0;do te=ge+(P<<3)|0,g[te>>2]=0,g[te+4>>2]=0,P=An(P|0,D|0,1,0)|0,D=Be()|0,te=pt,Y=g[te+4>>2]|0;while((D|0)<(Y|0)|((D|0)==(Y|0)?P>>>0<(g[te>>2]|0)>>>0:0))}if(te=pt,g[te>>2]=c,g[te+4>>2]=d,(d|0)>0|(d|0)==0&c>>>0>0)z=S,q=Oe,ee=nt,Y=we,te=Re,S=oe,Oe=b,we=je,oe=z,b=q,nt=$e,$e=ee,je=Y,Re=ge,ge=te;else break t}zr(je),zr($e),zr(zt),b=1;break e}else b=c;while(!1);zr(zt),zr(S),zr(b),b=0}while(!1);return zt=b,Ie=sr,zt|0}function $t(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0;if(m=Ie,Ie=Ie+176|0,d=m,(_|0)<1)return Ia(b,0,0),h=0,Ie=m,h|0;for(c=y,c=Xt(g[c>>2]|0,g[c+4>>2]|0,52)|0,Be()|0,Ia(b,(_|0)>6?_:6,c&15),c=0;w=y+(c<<3)|0,w=Dl(g[w>>2]|0,g[w+4>>2]|0,d)|0,!(w|0);){if(w=g[d>>2]|0,(w|0)>0){D=0;do P=d+8+(D<<4)|0,D=D+1|0,w=d+8+(((D|0)%(w|0)|0)<<4)|0,S=wr(b,w,P)|0,S?ss(b,S)|0:Bc(b,P,w)|0,w=g[d>>2]|0;while((D|0)<(w|0))}if(c=c+1|0,(c|0)>=(_|0)){w=0,h=13;break}}return(h|0)==13?(Ie=m,w|0):(ta(b),h=w,Ie=m,h|0)}function vr(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0;if(P=Ie,Ie=Ie+32|0,w=P,S=P+16|0,y=$t(y,_,S)|0,y|0)return b=y,Ie=P,b|0;if(g[b>>2]=0,g[b+4>>2]=0,g[b+8>>2]=0,y=so(S)|0,y|0)do{_=Np(b)|0;do Up(_,y)|0,D=y+16|0,g[w>>2]=g[D>>2],g[w+4>>2]=g[D+4>>2],g[w+8>>2]=g[D+8>>2],g[w+12>>2]=g[D+12>>2],ss(S,y)|0,y=ur(S,w)|0;while((y|0)!=0);y=so(S)|0}while((y|0)!=0);return ta(S),y=Ic(b)|0,y?(Nl(b),D=y,Ie=P,D|0):(D=0,Ie=P,D|0)}function Br(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 Xi(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 xh(y,_){y=y|0,_=_|0;var b=0,w=0;if(_>>>0>20)return _=-1,_|0;do if((g[11120+(_*216|0)>>
42022]|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,w=2;else{if((g[11120+(_*216|0)+144>>2]|0)==(y|0)){y=0,b=2,w=0;break}if((g[11120+(_*216|0)+152>>2]|0)==(y|0)){y=0,b=2,w=1;break}if((g[11120+(_*216|0)+160>>2]|0)==(y|0)){y=0,b=2,w=2;break}if((g[11120+(_*216|0)+168>>2]|0)==(y|0)){y=1,b=2,w=0;break}if((g[11120+(_*216|0)+176>>2]|0)==(y|0)){y=1,b=2,w=1;break}if((g[11120+(_*216|0)+184>>2]|0)==(y|0)){y=1,b=2,w=2;break}if((g[11120+(_*216|0)+192>>2]|0)==(y|0)){y=2,b=2,w=0;break}if((g[11120+(_*216|0)+200>>2]|0)==(y|0)){y=2,b=2,w=1;break}if((g[11120+(_*216|0)+208>>2]|0)==(y|0)){y=2,b=2,w=2;break}else y=-1;return y|0}else y=2,b=1,w=1;else y=2,b=1,w=0;else y=1,b=1,w=2;else y=1,b=1,w=1;else y=1,b=1,w=0;else y=0,b=1,w=2;else y=0,b=1,w=1;else y=0,b=1,w=0;else y=2,b=0,w=2;else y=2,b=0,w=1;else y=2,b=0,w=0;else y=1,b=0,w=2;else y=1,b=0,w=1;else y=1,b=0,w=0;else y=0,b=0,w=2;else y=0,b=0,w=1;else y=0,b=0,w=0;while(!1);return _=g[11120+(_*216|0)+(b*72|0)+(y*24|0)+(w<<3)+4>>2]|0,_|0}function uf(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 ya(y,_){return y=y|0,_=_|0,g[848+(y*28|0)+(_<<2)>>2]|0}function mc(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 _c(){return 122}function wh(y){y=y|0;var _=0,b=0,w=0;_=0;do rr(_|0,0,45)|0,w=Be()|0|134225919,b=y+(_<<3)|0,g[b>>2]=-1,g[b+4>>2]=w,_=_+1|0;while((_|0)!=122);return 0}function yc(y){return y=y|0,+le[y+16>>3]<+le[y+24>>3]|0}function Us(y,_){y=y|0,_=_|0;var b=0,w=0,S=0;return b=+le[_>>3],!(b>=+le[y+8>>3])||!(b<=+le[y>>3])?(_=0,_|0):(w=+le[y+16>>3],b=+le[y+24>>3],S=+le[_+8>>3],_=S>=b,y=S<=w&1,w<b?_&&(y=1):_||(y=0),_=(y|0)!=0,_|0)}function $o(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0;L=Ie,Ie=Ie+288|0,m=L+264|0,E=L+96|0,h=L,c=h,d=c+96|0;do g[c>>2]=0,c=c+4|0;while((c|0)<(d|0));return _=wc(_,h)|0,_|0?(R=_,Ie=L,R|0):(d=h,h=g[d>>2]|0,d=g[d+4>>2]|0,Ol(h,d,m)|0,Dl(h,d,E)|0,D=+rl(m,E+8|0),le[m>>3]=+le[y>>3],d=m+8|0,le[d>>3]=+le[y+16>>3],le[E>>3]=+le[y+8>>3],h=E+8|0,le[h>>3]=+le[y+24>>3],S=+rl(m,E),q=+le[d>>3]-+le[h>>3],P=+Mt(+q),z=+le[m>>3]-+le[E>>3],w=+Mt(+z),!(q==0|z==0)&&(q=+Vl(+P,+w),q=+$r(+(S*S/+Pc(+(q/+Pc(+P,+w)),3)/(D*(D*2.59807621135)*.8))),le[xt>>3]=q,M=~~q>>>0,R=+Mt(q)>=1?q>0?~~+Gr(+Ct(q/4294967296),4294967295)>>>0:~~+$r((q-+(~~q>>>0))/4294967296)>>>0:0,(g[xt+4>>2]&2146435072|0)!=2146435072)?(E=(M|0)==0&(R|0)==0,_=b,g[_>>2]=E?1:M,g[_+4>>2]=E?0:R,_=0):_=1,R=_,Ie=L,R|0)}function va(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0;h=Ie,Ie=Ie+288|0,D=h+264|0,c=h+96|0,d=h,S=d,P=S+96|0;do g[S>>2]=0,S=S+4|0;while((S|0)<(P|0));return b=wc(b,d)|0,b|0?(w=b,Ie=h,w|0):(b=d,S=g[b>>2]|0,b=g[b+4>>2]|0,Ol(S,b,D)|0,Dl(S,b,c)|0,m=+rl(D,c+8|0),m=+$r(+(+rl(y,_)/(m*2))),le[xt>>3]=m,b=~~m>>>0,S=+Mt(m)>=1?m>0?~~+Gr(+Ct(m/4294967296),4294967295)>>>0:~~+$r((m-+(~~m>>>0))/4294967296)>>>0:0,(g[xt+4>>2]&2146435072|0)==2146435072?(w=1,Ie=h,w|0):(d=(b|0)==0&(S|0)==0,g[w>>2]=d?1:b,g[w+4>>2]=d?0:S,w=0,Ie=h,w|0))}function Wa(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0,g[y>>2]=_,g[y+4>>2]=b,g[y+8>>2]=w}function ba(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0;E=_+8|0,g[E>>2]=0,d=+le[y>>3],D=+Mt(+d),h=+le[y+8>>3],c=+Mt(+h)/.8660254037844386,D=D+c*.5,b=~~D,y=~~c,D=D-+(b|0),c=c-+(y|0);do if(D<.5)if(D<.3333333333333333)if(g[_>>2]=b,c<(D+1)*.5){g[_+4>>2]=y;break}else{y=y+1|0,g[_+4>>2]=y;break}else if(M=1-D,y=(!(c<M)&1)+y|0,g[_+4>>2]=y,M<=c&c<D*2){b=b+1|0,g[_>>2]=b;break}else{g[_>>2]=b;break}else{if(!(D<.6666666666666666))if(b=b+1|0,g[_>>2]=b,c<D*.5){g[_+4>>2]=y;break}else{y=y+1|0,g[_+4>>2]=y;break}
4202if(c<1-D){if(g[_+4>>2]=y,D*2+-1<c){g[_>>2]=b;break}}else y=y+1|0,g[_+4>>2]=y;b=b+1|0,g[_>>2]=b}while(!1);do if(d<0)if(y&1){m=(y+1|0)/2|0,m=Jr(b|0,((b|0)<0)<<31>>31|0,m|0,((m|0)<0)<<31>>31|0)|0,b=~~(+(b|0)-((+(m>>>0)+4294967296*+(Be()|0))*2+1)),g[_>>2]=b;break}else{m=(y|0)/2|0,m=Jr(b|0,((b|0)<0)<<31>>31|0,m|0,((m|0)<0)<<31>>31|0)|0,b=~~(+(b|0)-(+(m>>>0)+4294967296*+(Be()|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),w=y-b|0,(b|0)<0?(S=0-b|0,g[m>>2]=w,g[E>>2]=S,g[_>>2]=0,y=w,b=0):S=0,(y|0)<0&&(b=b-y|0,g[_>>2]=b,S=S-y|0,g[E>>2]=S,g[m>>2]=0,y=0),P=b-S|0,w=y-S|0,(S|0)<0&&(g[_>>2]=P,g[m>>2]=w,g[E>>2]=0,y=w,b=P,S=0),w=(y|0)<(b|0)?y:b,w=(S|0)<(w|0)?S:w,!((w|0)<=0)&&(g[_>>2]=b-w,g[m>>2]=y-w,g[E>>2]=S-w)}function _i(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0;_=g[y>>2]|0,D=y+4|0,b=g[D>>2]|0,(_|0)<0&&(b=b-_|0,g[D>>2]=b,P=y+8|0,g[P>>2]=(g[P>>2]|0)-_,g[y>>2]=0,_=0),(b|0)<0?(_=_-b|0,g[y>>2]=_,P=y+8|0,S=(g[P>>2]|0)-b|0,g[P>>2]=S,g[D>>2]=0,b=0):(S=y+8|0,P=S,S=g[S>>2]|0),(S|0)<0&&(_=_-S|0,g[y>>2]=_,b=b-S|0,g[D>>2]=b,g[P>>2]=0,S=0),w=(b|0)<(_|0)?b:_,w=(S|0)<(w|0)?S:w,!((w|0)<=0)&&(g[y>>2]=_-w,g[D>>2]=b-w,g[P>>2]=S-w)}function Mo(y,_){y=y|0,_=_|0;var b=0,w=0;w=g[y+8>>2]|0,b=+((g[y+4>>2]|0)-w|0),le[_>>3]=+((g[y>>2]|0)-w|0)-b*.5,le[_+8>>3]=b*.8660254037844386}function Vn(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 $a(y,_){y=y|0,_=_|0;var b=0,w=0;b=Xr(g[y>>2]|0,_)|0,g[y>>2]=b,b=y+4|0,w=Xr(g[b>>2]|0,_)|0,g[b>>2]=w,y=y+8|0,_=Xr(g[y>>2]|0,_)|0,g[y>>2]=_}function vc(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;D=g[y>>2]|0,c=(D|0)<0,w=(g[y+4>>2]|0)-(c?D:0)|0,P=(w|0)<0,S=(P?0-w|0:0)+((g[y+8>>2]|0)-(c?D:0))|0,b=(S|0)<0,y=b?0:S,_=(P?0:w)-(b?S:0)|0,S=(c?0:D)-(P?w:0)-(b?S:0)|0,b=(_|0)<(S|0)?_:S,b=(y|0)<(b|0)?y:b,w=(b|0)>0,y=y-(w?b:0)|0,_=_-(w?b:0)|0;e:do switch(S-(w?b:0)|0){case 0:switch(_|0){case 0:return c=(y|0)==0?0:(y|0)==1?1:7,c|0;case 1:return c=(y|0)==0?2:(y|0)==1?3:7,c|0;default:break e}case 1:switch(_|0){case 0:return c=(y|0)==0?4:(y|0)==1?5:7,c|0;case 1:{if(!y)y=6;else break e;return y|0}default:break e}}while(!1);return c=7,c|0}function Op(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;D=y+8|0,S=g[D>>2]|0,P=(g[y>>2]|0)-S|0,c=y+4|0,S=(g[c>>2]|0)-S|0;do if(P>>>0>715827881|S>>>0>715827881){if(b=(P|0)>0,b){if((2147483647-P|0)<(P|0)||(2147483647-(P<<1)|0)<(P|0))return c=1,c|0}else if((-2147483648-P|0)>(P|0)||(-2147483648-(P<<1)|0)>(P|0))return c=1,c|0;if(_=P*3|0,(S|0)>0){if((2147483647-S|0)<(S|0))return c=1,c|0}else if((-2147483648-S|0)>(S|0))return c=1,c|0;if(w=S<<1,(P|0)>-1){if((_|-2147483648|0)>=(S|0))return c=1,c|0}else if((_^-2147483648|0)<(S|0))return c=1,c|0;if(b){if((2147483647-P|0)<(w|0))_=1;else{b=w;break}return _|0}else{if((-2147483648-P|0)>(w|0))_=1;else{b=w;break}return _|0}}else b=S<<1,_=P*3|0;while(!1);w=Ji(+(_-S|0)/7)|0,g[y>>2]=w,S=Ji(+(b+P|0)/7)|0,g[c>>2]=S,g[D>>2]=0,b=(S|0)<(w|0),_=b?w:S,b=b?S:w;do if((b|0)<0){if((_|0)>0){if((_|-2147483648|0)<(b|0)&((b|0)!=-2147483648&(2147483647-_|0)>=(b|0)))break;qt(23313,22444,355,22455)}if((b|0)==-2147483648|(-2147483648-_|0)>(b|0)&&qt(23313,22444,355,22455),(_|0)>-1){if((_|-2147483648|0)<(b|0))break;qt(23313,22444,355,22455)}else{if((_^-2147483648|0)>=(b|0))break;qt(23313,22444,355,22455)}}while(!1);return _=S-w|0,(w|0)<0?(b=0-w|0,g[c>>2]=_,g[D>>2]=b,g[y>>2]=0,w=0):(_=S,b=0),(_|0)<0&&(w=w-_|0,g[y>>2]=w,b=b-_|0,g[D>>2]=b,g[c>>2]=0,_=0),P=w-b|0,S=_-b|0,(b|0)<0?(g[y>>2]=P,g[c>>2]=S,g[D>>2]=0,_=S,S=P,b=0):S=w,w=(_|0)<(S|0)?_:S,w=(b|0)<(w|0)?b:w,(w|0)<=0?(c=0,c|0):(g[y>>2]=S-w,g[c>>2]=_-w,g[D>>2]=b-w,c=0,c|0)}function Dp(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;D=y+8|0,S=g[D>>2]|0,P=(g[y>>2]|0)-S|0,c=y+4|0,S=(g[c>>2]|0)-S|0;do if(P>>>0>715827881|S>>>0>715827881){if(b=(P|0)>0,b){if((2147483647-P|0)<(P|0))return c=1,c|0}else if((-2147483648-P|0)>(P|0))return c=1,c|0;if(_=P<<1,(S|0)>
42020){if((2147483647-S|0)<(S|0)||(2147483647-(S<<1)|0)<(S|0))return c=1,c|0}else if((-2147483648-S|0)>(S|0)||(-2147483648-(S<<1)|0)>(S|0))return c=1,c|0;if(w=S*3|0,b){if((2147483647-_|0)<(S|0))return c=1,c|0}else if((-2147483648-_|0)>(S|0))return c=1,c|0;if((S|0)>-1){if((w|-2147483648|0)<(P|0)){b=w;break}else _=1;return _|0}else{if((w^-2147483648|0)<(P|0))_=1;else{b=w;break}return _|0}}else b=S*3|0,_=P<<1;while(!1);w=Ji(+(_+S|0)/7)|0,g[y>>2]=w,S=Ji(+(b-P|0)/7)|0,g[c>>2]=S,g[D>>2]=0,b=(S|0)<(w|0),_=b?w:S,b=b?S:w;do if((b|0)<0){if((_|0)>0){if((_|-2147483648|0)<(b|0)&((b|0)!=-2147483648&(2147483647-_|0)>=(b|0)))break;qt(23313,22444,404,22469)}if((b|0)==-2147483648|(-2147483648-_|0)>(b|0)&&qt(23313,22444,404,22469),(_|0)>-1){if((_|-2147483648|0)<(b|0))break;qt(23313,22444,404,22469)}else{if((_^-2147483648|0)>=(b|0))break;qt(23313,22444,404,22469)}}while(!1);return _=S-w|0,(w|0)<0?(b=0-w|0,g[c>>2]=_,g[D>>2]=b,g[y>>2]=0,w=0):(_=S,b=0),(_|0)<0&&(w=w-_|0,g[y>>2]=w,b=b-_|0,g[D>>2]=b,g[c>>2]=0,_=0),P=w-b|0,S=_-b|0,(b|0)<0?(g[y>>2]=P,g[c>>2]=S,g[D>>2]=0,_=S,S=P,b=0):S=w,w=(_|0)<(S|0)?_:S,w=(b|0)<(w|0)?b:w,(w|0)<=0?(c=0,c|0):(g[y>>2]=S-w,g[c>>2]=_-w,g[D>>2]=b-w,c=0,c|0)}function ff(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;D=y+8|0,b=g[D>>2]|0,_=(g[y>>2]|0)-b|0,c=y+4|0,b=(g[c>>2]|0)-b|0,w=Ji(+((_*3|0)-b|0)/7)|0,g[y>>2]=w,_=Ji(+((b<<1)+_|0)/7)|0,g[c>>2]=_,g[D>>2]=0,b=_-w|0,(w|0)<0?(P=0-w|0,g[c>>2]=b,g[D>>2]=P,g[y>>2]=0,_=b,w=0,b=P):b=0,(_|0)<0&&(w=w-_|0,g[y>>2]=w,b=b-_|0,g[D>>2]=b,g[c>>2]=0,_=0),P=w-b|0,S=_-b|0,(b|0)<0?(g[y>>2]=P,g[c>>2]=S,g[D>>2]=0,_=S,S=P,b=0):S=w,w=(_|0)<(S|0)?_:S,w=(b|0)<(w|0)?b:w,!((w|0)<=0)&&(g[y>>2]=S-w,g[c>>2]=_-w,g[D>>2]=b-w)}function iu(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;D=y+8|0,b=g[D>>2]|0,_=(g[y>>2]|0)-b|0,c=y+4|0,b=(g[c>>2]|0)-b|0,w=Ji(+((_<<1)+b|0)/7)|0,g[y>>2]=w,_=Ji(+((b*3|0)-_|0)/7)|0,g[c>>2]=_,g[D>>2]=0,b=_-w|0,(w|0)<0?(P=0-w|0,g[c>>2]=b,g[D>>2]=P,g[y>>2]=0,_=b,w=0,b=P):b=0,(_|0)<0&&(w=w-_|0,g[y>>2]=w,b=b-_|0,g[D>>2]=b,g[c>>2]=0,_=0),P=w-b|0,S=_-b|0,(b|0)<0?(g[y>>2]=P,g[c>>2]=S,g[D>>2]=0,_=S,S=P,b=0):S=w,w=(_|0)<(S|0)?_:S,w=(b|0)<(w|0)?b:w,!((w|0)<=0)&&(g[y>>2]=S-w,g[c>>2]=_-w,g[D>>2]=b-w)}function Bl(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;_=g[y>>2]|0,D=y+4|0,b=g[D>>2]|0,c=y+8|0,w=g[c>>2]|0,S=b+(_*3|0)|0,g[y>>2]=S,b=w+(b*3|0)|0,g[D>>2]=b,_=(w*3|0)+_|0,g[c>>2]=_,w=b-S|0,(S|0)<0?(_=_-S|0,g[D>>2]=w,g[c>>2]=_,g[y>>
42022]=0,b=w,w=0):w=S,(b|0)<0&&(w=w-b|0,g[y>>2]=w,_=_-b|0,g[c>>2]=_,g[D>>2]=0,b=0),P=w-_|0,S=b-_|0,(_|0)<0?(g[y>>2]=P,g[D>>2]=S,g[c>>2]=0,w=P,_=0):S=b,b=(S|0)<(w|0)?S:w,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=w-b,g[D>>2]=S-b,g[c>>2]=_-b)}function Xo(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;S=g[y>>2]|0,D=y+4|0,_=g[D>>2]|0,c=y+8|0,b=g[c>>2]|0,w=(_*3|0)+S|0,S=b+(S*3|0)|0,g[y>>2]=S,g[D>>2]=w,_=(b*3|0)+_|0,g[c>>2]=_,b=w-S|0,(S|0)<0?(_=_-S|0,g[D>>2]=b,g[c>>2]=_,g[y>>2]=0,S=0):b=w,(b|0)<0&&(S=S-b|0,g[y>>2]=S,_=_-b|0,g[c>>2]=_,g[D>>2]=0,b=0),P=S-_|0,w=b-_|0,(_|0)<0?(g[y>>2]=P,g[D>>2]=w,g[c>>2]=0,S=P,_=0):w=b,b=(w|0)<(S|0)?w:S,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=S-b,g[D>>2]=w-b,g[c>>2]=_-b)}function hf(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0;(_+-1|0)>>>0>=6||(S=(g[15440+(_*12|0)>>2]|0)+(g[y>>2]|0)|0,g[y>>2]=S,c=y+4|0,w=(g[15440+(_*12|0)+4>>2]|0)+(g[c>>2]|0)|0,g[c>>2]=w,D=y+8|0,_=(g[15440+(_*12|0)+8>>2]|0)+(g[D>>2]|0)|0,g[D>>2]=_,b=w-S|0,(S|0)<0?(_=_-S|0,g[c>>2]=b,g[D>>2]=_,g[y>>2]=0,w=0):(b=w,w=S),(b|0)<0&&(w=w-b|0,g[y>>2]=w,_=_-b|0,g[D>>2]=_,g[c>>2]=0,b=0),P=w-_|0,S=b-_|0,(_|0)<0?(g[y>>2]=P,g[c>>2]=S,g[D>>2]=0,w=P,_=0):S=b,b=(S|0)<(w|0)?S:w,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=w-b,g[c>>2]=S-b,g[D>>2]=_-b))}function df(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;S=g[y>>2]|0,D=y+4|0,_=g[D>>2]|0,c=y+8|0,b=g[c>>2]|0,w=_+S|0,S=b+S|0,g[y>>2]=S,g[D>>2]=w,_=b+_|0,g[c>>2]=_,b=w-S|0,(S|0)<0?(_=_-S|0,g[D>>2]=b,g[c>>2]=_,g[y>>2]=0,w=0):(b=w,w=S),(b|0)<0&&(w=w-b|0,g[y>>2]=w,_=_-b|0,g[c>>2]=_,g[D>>2]=0,b=0),P=w-_|0,S=b-_|0,(_|0)<0?(g[y>>2]=P,g[D>>2]=S,g[c>>2]=0,w=P,_=0):S=b,b=(S|0)<(w|0)?S:w,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=w-b,g[D>>2]=S-b,g[c>>2]=_-b)}function su(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;_=g[y>>2]|0,D=y+4|0,w=g[D>>2]|0,c=y+8|0,b=g[c>>2]|0,S=w+_|0,g[y>>2]=S,w=b+w|0,g[D>>2]=w,_=b+_|0,g[c>>2]=_,b=w-S|0,(S|0)<0?(_=_-S|0,g[D>>2]=b,g[c>>2]=_,g[y>>2]=0,w=0):(b=w,w=S),(b|0)<0&&(w=w-b|0,g[y>>2]=w,_=_-b|0,g[c>>2]=_,g[D>>2]=0,b=0),P=w-_|0,S=b-_|0,(_|0)<0?(g[y>>2]=P,g[D>>2]=S,g[c>>2]=0,w=P,_=0):S=b,b=(S|0)<(w|0)?S:w,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=w-b,g[D>>2]=S-b,g[c>>2]=_-b)}function bo(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 pf(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;_=g[y>>2]|0,D=y+4|0,b=g[D>>2]|0,c=y+8|0,w=g[c>>2]|0,S=b+(_<<1)|0,g[y>>2]=S,b=w+(b<<1)|0,g[D>>2]=b,_=(w<<1)+_|0,g[c>>2]=_,w=b-S|0,(S|0)<0?(_=_-S|0,g[D>>2]=w,g[c>>2]=_,g[y>>
42022]=0,b=w,w=0):w=S,(b|0)<0&&(w=w-b|0,g[y>>2]=w,_=_-b|0,g[c>>2]=_,g[D>>2]=0,b=0),P=w-_|0,S=b-_|0,(_|0)<0?(g[y>>2]=P,g[D>>2]=S,g[c>>2]=0,w=P,_=0):S=b,b=(S|0)<(w|0)?S:w,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=w-b,g[D>>2]=S-b,g[c>>2]=_-b)}function zi(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;S=g[y>>2]|0,D=y+4|0,_=g[D>>2]|0,c=y+8|0,b=g[c>>2]|0,w=(_<<1)+S|0,S=b+(S<<1)|0,g[y>>2]=S,g[D>>2]=w,_=(b<<1)+_|0,g[c>>2]=_,b=w-S|0,(S|0)<0?(_=_-S|0,g[D>>2]=b,g[c>>2]=_,g[y>>2]=0,S=0):b=w,(b|0)<0&&(S=S-b|0,g[y>>2]=S,_=_-b|0,g[c>>2]=_,g[D>>2]=0,b=0),P=S-_|0,w=b-_|0,(_|0)<0?(g[y>>2]=P,g[D>>2]=w,g[c>>2]=0,S=P,_=0):w=b,b=(w|0)<(S|0)?w:S,b=(_|0)<(b|0)?_:b,!((b|0)<=0)&&(g[y>>2]=S-b,g[D>>2]=w-b,g[c>>2]=_-b)}function bc(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0;return D=(g[y>>2]|0)-(g[_>>2]|0)|0,c=(D|0)<0,w=(g[y+4>>2]|0)-(g[_+4>>2]|0)-(c?D:0)|0,P=(w|0)<0,S=(c?0-D|0:0)+(g[y+8>>2]|0)-(g[_+8>>2]|0)+(P?0-w|0:0)|0,y=(S|0)<0,_=y?0:S,b=(P?0:w)-(y?S:0)|0,S=(c?0:D)-(P?w:0)-(y?S:0)|0,y=(b|0)<(S|0)?b:S,y=(_|0)<(y|0)?_:y,w=(y|0)>0,_=_-(w?y:0)|0,b=b-(w?y:0)|0,y=S-(w?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 xa(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 wa(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0;w=g[y>>2]|0,g[_>>2]=w,S=g[y+4>>2]|0,D=_+4|0,g[D>>2]=S,c=_+8|0,g[c>>2]=0,b=(S|0)<(w|0),y=b?w:S,b=b?S:w;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=S-w|0,(w|0)<0?(b=0-w|0,g[D>>2]=y,g[c>>2]=b,g[_>>2]=0,w=0):(y=S,b=0),(y|0)<0&&(w=w-y|0,g[_>>2]=w,b=b-y|0,g[c>>2]=b,g[D>>2]=0,y=0),P=w-b|0,S=y-b|0,(b|0)<0?(g[_>>2]=P,g[D>>2]=S,g[c>>2]=0,y=S,S=P,b=0):S=w,w=(y|0)<(S|0)?y:S,w=(b|0)<(w|0)?b:w,(w|0)<=0?(_=0,_|0):(g[_>>2]=S-w,g[D>>2]=y-w,g[c>>2]=b-w,_=0,_|0)}function Ta(y){y=y|0;var _=0,b=0,w=0,S=0;_=y+8|0,S=g[_>>2]|0,b=S-(g[y>>2]|0)|0,g[y>>2]=b,w=y+4|0,y=(g[w>>2]|0)-S|0,g[w>>2]=y,g[_>>2]=0-(y+b)}function Xa(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;b=g[y>>2]|0,_=0-b|0,g[y>>2]=_,D=y+8|0,g[D>>2]=0,c=y+4|0,w=g[c>>2]|0,S=w+b|0,(b|0)>0?(g[c>>2]=S,g[D>>2]=b,g[y>>2]=0,_=0,w=S):b=0,(w|0)<0?(P=_-w|0,g[y>>2]=P,b=b-w|0,g[D>>2]=b,g[c>>2]=0,S=P-b|0,_=0-b|0,(b|0)<0?(g[y>>2]=S,g[c>>2]=_,g[D>>2]=0,w=_,b=0):(w=0,S=P)):S=_,_=(w|0)<(S|0)?w:S,_=(b|0)<(_|0)?b:_,!((_|0)<=0)&&(g[y>>2]=S-_,g[c>>2]=w-_,g[D>>2]=b-_)}function Ea(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0;if(E=Ie,Ie=Ie+64|0,m=E,c=E+56|0,!(!0&(_&2013265920|0)==134217728&(!0&(w&2013265920|0)==134217728)))return S=5,Ie=E,S|0;if((y|0)==(b|0)&(_|0)==(w|0))return g[S>>2]=0,S=0,Ie=E,S|0;if(D=Xt(y|0,_|0,52)|0,Be()|0,D=D&15,h=Xt(b|0,w|0,52)|0,Be()|0,(D|0)!=(h&15|0))return S=12,Ie=E,S|0;if(P=D+-1|0,D>>>0>1){Zo(y,_,P,m)|0,Zo(b,w,P,c)|0,h=m,d=g[h>>2]|0,h=g[h+4>>2]|0;e:do if((d|0)==(g[c>>2]|0)&&(h|0)==(g[c+4>>2]|0)){D=(D^15)*3|0,P=Xt(y|0,_|0,D|0)|0,Be()|0,P=P&7,D=Xt(b|0,w|0,D|0)|0,Be()|0,D=D&7;do if((P|0)==0|(D|0)==0)g[S>>2]=1,P=0;else if((P|0)==7)P=5;else{if((P|0)==1|(D|0)==1&&On(d,h)|0){P=5;break}if((g[15536+(P<<2)>>2]|0)!=(D|0)&&(g[15568+(P<<2)>>2]|0)!=(D|0))break e;g[S>>2]=1,P=0}while(!1);return S=P,Ie=E,S|0}while(!1)}P=m,D=P+56|0;do g[P>>2]=0,P=P+4|0;while((P|0)<(D|0));return Rn(y,_,1,m)|0,_=m,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(w|0))&&(_=m+8|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(w|0)))&&(_=m+16|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(w|0)))&&(_=m+24|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(w|0)))&&(_=m+32|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(w|0)))&&(_=m+40|0,!((g[_>>2]|0)==(b|0)&&(g[_+4>>2]|0)==(w|0)))?(P=m+48|0,P=((g[P>>2]|0)==(b|0)?(g[P+4>>2]|0)==(w|0):0)&1):P=1,g[S>>2]=P,S=0,Ie=E,S|0}function qa(y,_,b,w,S){return y=y|0,_=_|0,b=b|0,w=w|0,S=S|0,b=gc(y,_,b,w)|0,(b|0)==7?(S=11,S|0):(w=rr(b|0,0,56)|0,_=_&-2130706433|(Be()|0)|268435456,g[S>>2]=y|w,g[S+4>>2]=_,S=0,S|0)}function Ja(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 Ca(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;
4202return S=Ie,Ie=Ie+16|0,w=S,g[w>>2]=0,!0&(_&2013265920|0)==268435456?(P=Xt(y|0,_|0,56)|0,Be()|0,w=In(y,_&-2130706433|134217728,P&7,w,b)|0,Ie=S,w|0):(w=6,Ie=S,w|0)}function Th(y,_){y=y|0,_=_|0;var b=0;switch(b=Xt(y|0,_|0,56)|0,Be()|0,b&7){case 0:case 7:return b=0,b|0}return b=_&-2130706433|134217728,!(!0&(_&2013265920|0)==268435456)||!0&(_&117440512|0)==16777216&(On(y,b)|0)!=0?(b=0,b|0):(b=Ko(y,b)|0,b|0)}function Eh(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0;return S=Ie,Ie=Ie+16|0,w=S,!0&(_&2013265920|0)==268435456?(P=_&-2130706433|134217728,D=b,g[D>>2]=y,g[D+4>>2]=P,g[w>>2]=0,_=Xt(y|0,_|0,56)|0,Be()|0,w=In(y,P,_&7,w,b+8|0)|0,Ie=S,w|0):(w=6,Ie=S,w|0)}function Bn(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0;return S=(On(y,_)|0)==0,_=_&-2130706433,w=b,g[w>>2]=S?y:0,g[w+4>>2]=S?_|285212672:0,w=b+8|0,g[w>>2]=y,g[w+4>>2]=_|301989888,w=b+16|0,g[w>>2]=y,g[w+4>>2]=_|318767104,w=b+24|0,g[w>>2]=y,g[w+4>>2]=_|335544320,w=b+32|0,g[w>>2]=y,g[w+4>>2]=_|352321536,b=b+40|0,g[b>>2]=y,g[b+4>>2]=_|369098752,0}function ou(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0;return D=Ie,Ie=Ie+16|0,S=D,P=_&-2130706433|134217728,!0&(_&2013265920|0)==268435456?(w=Xt(y|0,_|0,56)|0,Be()|0,w=wo(y,P,w&7)|0,(w|0)==-1?(g[b>>2]=0,P=6,Ie=D,P|0):(Qa(y,P,S)|0&&qt(23313,22484,282,22499),_=Xt(y|0,_|0,52)|0,Be()|0,_=_&15,On(y,P)|0?qo(S,_,w,2,b):lu(S,_,w,2,b),P=0,Ie=D,P|0)):(P=6,Ie=D,P|0)}function au(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0;w=Ie,Ie=Ie+16|0,S=w,Ch(y,_,b,S),ba(S,b+4|0),Ie=w}function Ch(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0;if(c=Ie,Ie=Ie+16|0,d=c,Sh(y,b,d),P=+Ur(+(1-+le[d>>3]*.5)),P<1e-16){g[w>>2]=0,g[w+4>>2]=0,g[w+8>>2]=0,g[w+12>>2]=0,Ie=c;return}if(d=g[b>>2]|0,S=+le[15920+(d*24|0)>>3],S=+Ll(S-+Ll(+mf(15600+(d<<4)|0,y))),zs(_)|0?D=+Ll(S+-.3334731722518321):D=S,S=+jt(+P)/.381966011250105,(_|0)>0){y=0;do S=S*2.6457513110645907,y=y+1|0;while((y|0)!=(_|0))}P=+Lt(+D)*S,le[w>>3]=P,D=+Pt(+D)*S,le[w+8>>3]=D,Ie=c}function Sh(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;if(P=Ie,Ie=Ie+32|0,S=P,xf(y,S),g[_>>2]=0,le[b>>3]=5,w=+wi(16400,S),w<+le[b>>3]&&(g[_>>2]=0,le[b>>3]=w),w=+wi(16424,S),w<+le[b>>3]&&(g[_>>2]=1,le[b>>3]=w),w=+wi(16448,S),w<+le[b>>3]&&(g[_>>2]=2,le[b>>3]=w),w=+wi(16472,S),w<+le[b>>3]&&(g[_>>2]=3,le[b>>3]=w),w=+wi(16496,S),w<+le[b>>3]&&(g[_>>2]=4,le[b>>3]=w),w=+wi(16520,S),w<+le[b>>3]&&(g[_>>2]=5,le[b>>3]=w),w=+wi(16544,S),w<+le[b>>3]&&(g[_>>2]=6,le[b>>3]=w),w=+wi(16568,S),w<+le[b>>3]&&(g[_>>2]=7,le[b>>3]=w),w=+wi(16592,S),w<+le[b>>3]&&(g[_>>2]=8,le[b>>3]=w),w=+wi(16616,S),w<+le[b>>3]&&(g[_>>2]=9,le[b>>3]=w),w=+wi(16640,S),w<+le[b>>3]&&(g[_>>2]=10,le[b>>3]=w),w=+wi(16664,S),w<+le[b>>3]&&(g[_>>2]=11,le[b>>3]=w),w=+wi(16688,S),w<+le[b>>3]&&(g[_>>2]=12,le[b>>3]=w),w=+wi(16712,S),w<+le[b>>3]&&(g[_>>2]=13,le[b>>3]=w),w=+wi(16736,S),w<+le[b>>3]&&(g[_>>2]=14,le[b>>3]=w),w=+wi(16760,S),w<+le[b>>3]&&(g[_>>2]=15,le[b>>3]=w),w=+wi(16784,S),w<+le[b>>3]&&(g[_>>2]=16,le[b>>3]=w),w=+wi(16808,S),w<+le[b>>3]&&(g[_>>2]=17,le[b>>3]=w),w=+wi(16832,S),w<+le[b>>3]&&(g[_>>2]=18,le[b>>3]=w),w=+wi(16856,S),!(w<+le[b>>3])){Ie=P;return}g[_>>2]=19,le[b>>3]=w,Ie=P}function Pl(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0;if(P=+ea(y),P<1e-16){_=15600+(_<<4)|0,g[S>>2]=g[_>>2],g[S+4>>2]=g[_+4>>2],g[S+8>>2]=g[_+8>>2],g[S+12>>2]=g[_+12>>2];return}if(D=+ln(+ +le[y+8>>3],+ +le[y>>3]),(b|0)>0){y=0;do P=P/2.6457513110645907,y=y+1|0;while((y|0)!=(b|0))}w?(P=P/3,b=(zs(b)|0)==0,P=+en(+((b?P:P/2.6457513110645907)*.381966011250105))):(P=+en(+(P*.381966011250105)),zs(b)|0&&(D=+Ll(D+.3334731722518321))),Ec(15600+(_<<4)|0,+Ll(+le[15920+(_*24|0)>>3]-D),P,S)}function Ih(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0;w=Ie,Ie=Ie+16|0,S=w,Mo(y+4|0,S),Pl(S,g[y>>2]|0,_,0,b),Ie=w}function qo(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0,Re=0,je=0,$e=0,nt=0,qe=0,Qe=0,pt=0,Dt=0,Tt=0;if(pt=Ie,Ie=Ie+272|0,P=pt+256|0,Y=pt+240|0,nt=pt,qe=pt+224|0,Qe=pt+208|0,te=pt+176|0,oe=pt+160|0,we=pt+192|0,Oe=pt+144|0,ge=pt+128|0,Re=pt+112|0,je=pt+96|0,$e=pt+80|0,g[P>>2]=_,g[Y>>2]=g[y>>2],g[Y+4>>2]=g[y+4>>2],g[Y+8>>2]=g[y+8>>2],g[Y+12>>2]=g[y+12>>2],Jo(Y,P,nt),g[S>>2]=0,Y=w+b+((w|0)==5&1)|0,(Y|0)<=(b|0)){Ie=pt;return}d=g[P>>2]|0,h=qe+4|0,m=te+4|0,E=b+5|0,M=16880+(d<<2)|0,R=16960+(d<<2)|0,L=ge+8|0,z=Re+8|0,q=je+8|0,ee=Qe+4|0,c=b;e:for(;;){D=nt+(((c|0)%5|0)<<4)|0,g[Qe>>2]=g[D>>2],g[Qe+4>>2]=g[D+4>>2],g[Qe+8>>2]=g[D+8>>2],g[Qe+12>>2]=g[D+12>>2];do;while((to(Qe,d,0,1)|0)==2);if((c|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],Mo(h,oe),w=g[te>>2]|0,P=g[17040+(w*80|0)+(g[qe>>2]<<2)>>2]|0,g[te>>2]=g[18640+(w*80|0)+(P*20|0)>>2],D=g[18640+(w*80|0)+(P*20|0)+16>>2]|0,(D|0)>0){y=0;do df(m),y=y+1|0;while((y|0)<(D|0))}switch(D=18640+(w*80|0)+(P*20|0)+4|0,g[we>>2]=g[D>>2],g[we+4>>2]=g[D+4>>2],g[we+8>>2]=g[D+8>>2],$a(we,(g[M>>2]|0)*3|0),Vn(m,we,m),_i(m),Mo(m,Oe),Dt=+(g[R>>2]|0),le[ge>>3]=Dt*3,le[L>>3]=0,Tt=Dt*-1.5,le[Re>>3]=Tt,le[z>>3]=Dt*2.598076211353316,le[je>>3]=Tt,le[q>>3]=Dt*-2.598076211353316,g[17040+((g[te>>2]|0)*80|0)+(g[Qe>>2]<<2)>>2]|0){case 1:{y=Re,w=ge;break}case 3:{y=je,w=Re;break}case 2:{y=ge,w=je;break}default:{y=12;break e}}bf(oe,Oe,w,y,$e),Pl($e,g[te>>2]|0,d,1,S+8+(g[S>>2]<<4)|0),g[S>>2]=(g[S>>2]|0)+1}if((c|0)<(E|0)&&(Mo(ee,te),Pl(te,g[Qe>>2]|0,d,1,S+8+(g[S>>2]<<4)|0),g[S>>2]=(g[S>>2]|0)+1),g[qe>>2]=g[Qe>>2],g[qe+4>>2]=g[Qe+4>>2],g[qe+8>>2]=g[Qe+8>>2],g[qe+12>>2]=g[Qe+12>>2],c=c+1|0,(c|0)>=(Y|0)){y=3;break}}if((y|0)==3){Ie=pt;return}else(y|0)==12&&qt(22522,22569,571,22579)}function Jo(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0;d=Ie,Ie=Ie+128|0,w=d+64|0,S=d,P=w,D=20240,c=P+60|0;do g[P>>2]=g[D>>2],P=P+4|0,D=D+4|0;while((P|0)<(c|0));P=S,D=20304,c=P+60|0;do g[P>>2]=g[D>>2],P=P+4|0,D=D+4|0;while((P|0)<(c|0));c=(zs(g[_>>2]|0)|0)==0,w=c?w:S,S=y+4|0,pf(S),zi(S),zs(g[_>>2]|0)|0&&(Xo(S),g[_>>2]=(g[_>>2]|0)+1),g[b>>2]=g[y>>2],_=b+4|0,Vn(S,w,_),_i(_),g[b+16>>2]=g[y>>2],_=b+20|0,Vn(S,w+12|0,_),_i(_),g[b+32>>2]=g[y>>2],_=b+36|0,Vn(S,w+24|0,_),_i(_),g[b+48>>2]=g[y>>2],_=b+52|0,Vn(S,w+36|0,_),_i(_),g[b+64>>2]=g[y>>2],b=b+68|0,Vn(S,w+48|0,b),_i(b),Ie=d}function to(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0;if(L=Ie,Ie=Ie+32|0,M=L+12|0,c=L,R=y+4|0,E=g[16960+(_<<2)>>2]|0,m=(w|0)!=0,E=m?E*3|0:E,S=g[R>>2]|0,h=y+8|0,D=g[h>>2]|0,m){if(P=y+12|0,w=g[P>>2]|0,S=D+S+w|0,(S|0)==(E|0))return R=1,Ie=L,R|0;d=P}else d=y+12|0,w=g[d>>2]|0,S=D+S+w|0;if((S|0)<=(E|0))return R=0,Ie=L,R|0;do if((w|0)>0){if(w=g[y>>2]|0,(D|0)>0){P=18640+(w*80|0)+60|0,w=y;break}w=18640+(w*80|0)+40|0,b?(Wa(M,E,0,0),hi(R,M,c),su(c),Vn(c,M,R),P=w,w=y):(P=w,w=y)}else P=18640+((g[y>>2]|0)*80|0)+20|0,w=y;while(!1);if(g[w>>2]=g[P>>2],S=P+16|0,(g[S>>2]|0)>0){w=0;do df(R),w=w+1|0;while((w|0)<(g[S>>2]|0))}return y=P+4|0,g[M>>2]=g[y>>2],g[M+4>>2]=g[y+4>>2],g[M+8>>2]=g[y+8>>2],_=g[16880+(_<<2)>>2]|0,$a(M,m?_*3|0:_),Vn(R,M,R),_i(R),m?w=((g[h>>2]|0)+(g[R>>2]|0)+(g[d>>2]|0)|0)==(E|0)?1:2:w=2,R=w,Ie=L,R|0}function Bh(y,_){y=y|0,_=_|0;var b=0;do b=to(y,_,0,1)|0;while((b|0)==2);return b|0}function lu(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0,Re=0,je=0,$e=0,nt=0;if(je=Ie,Ie=Ie+240|0,P=je+224|0,we=je+208|0,Oe=je,ge=je+192|0,Re=je+176|0,q=je+160|0,ee=je+144|0,Y=je+128|0,te=je+112|0,oe=je+96|0,g[P>>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],cu(we,P,Oe),g[S>>2]=0,z=w+b+((w|0)==6&1)|0,(z|0)<=(b|0)){Ie=je;return}d=g[P>>2]|0,h=b+6|0,m=16960+(d<<2)|0,E=ee+8|0,M=Y+8|0,R=te+8|0,L=ge+4|0,D=0,c=b,w=-1;e:for(;;){if(P=(c|0)%6|0,y=Oe+(P<<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=D,D=to(ge,d,0,1)|0,(c|0)>(b|0)&(zs(_)|0)!=0&&(y|0)!=1&&(g[ge>>2]|0)!=(w|0)){switch(Mo(Oe+(((P+5|0)%6|0)<<4)+4|0,Re),Mo(Oe+(P<<4)+4|0,q),$e=+(g[m>>2]|0),le[ee>>3]=$e*3,le[E>>3]=0,nt=$e*-1.5,le[Y>>3]=nt,le[M>>3]=$e*2.598076211353316,le[te>>3]=nt,le[R>>3]=$e*-2.598076211353316,P=g[we>>2]|0,g[17040+(P*80|0)+(((w|0)==(P|0)?g[ge>>2]|0:w)<<2)>>2]|0){case 1:{y=Y,w=ee;break}case 3:{y=te,w=Y;break}
4202case 2:{y=ee,w=te;break}default:{y=8;break e}}bf(Re,q,w,y,oe),!(zl(Re,oe)|0)&&!(zl(q,oe)|0)&&(Pl(oe,g[we>>2]|0,d,1,S+8+(g[S>>2]<<4)|0),g[S>>2]=(g[S>>2]|0)+1)}if((c|0)<(h|0)&&(Mo(L,Re),Pl(Re,g[ge>>2]|0,d,1,S+8+(g[S>>2]<<4)|0),g[S>>2]=(g[S>>2]|0)+1),c=c+1|0,(c|0)>=(z|0)){y=3;break}else w=g[ge>>2]|0}if((y|0)==3){Ie=je;return}else(y|0)==8&&qt(22606,22569,736,22651)}function cu(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0;d=Ie,Ie=Ie+160|0,w=d+80|0,S=d,P=w,D=20368,c=P+72|0;do g[P>>2]=g[D>>2],P=P+4|0,D=D+4|0;while((P|0)<(c|0));P=S,D=20448,c=P+72|0;do g[P>>2]=g[D>>2],P=P+4|0,D=D+4|0;while((P|0)<(c|0));c=(zs(g[_>>2]|0)|0)==0,w=c?w:S,S=y+4|0,pf(S),zi(S),zs(g[_>>2]|0)|0&&(Xo(S),g[_>>2]=(g[_>>2]|0)+1),g[b>>2]=g[y>>2],_=b+4|0,Vn(S,w,_),_i(_),g[b+16>>2]=g[y>>2],_=b+20|0,Vn(S,w+12|0,_),_i(_),g[b+32>>2]=g[y>>2],_=b+36|0,Vn(S,w+24|0,_),_i(_),g[b+48>>2]=g[y>>2],_=b+52|0,Vn(S,w+36|0,_),_i(_),g[b+64>>2]=g[y>>2],_=b+68|0,Vn(S,w+48|0,_),_i(_),g[b+80>>2]=g[y>>2],b=b+84|0,Vn(S,w+60|0,b),_i(b),Ie=d}function Ka(y,_){return y=y|0,_=_|0,_=Xt(y|0,_|0,52)|0,Be()|0,_&15|0}function Af(y,_){return y=y|0,_=_|0,_=Xt(y|0,_|0,45)|0,Be()|0,_&127|0}function Ko(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0;if(!(!0&(_&-16777216|0)==134217728)||(D=Xt(y|0,_|0,45)|0,Be()|0,D=D&127,D>>>0>121))return _=0,_|0;b=Xt(y|0,_|0,52)|0,Be()|0,b=b&15;do if(b|0){for(S=1,w=0;;){if(P=Xt(y|0,_|0,(15-S|0)*3|0)|0,Be()|0,P=P&7,(P|0)!=0&(w^1))if((P|0)==1&(Br(D)|0)!=0){c=0,w=13;break}else w=1;if((P|0)==7){c=0,w=13;break}if(S>>>0<b>>>0)S=S+1|0;else{w=9;break}}if((w|0)==9){if((b|0)==15)c=1;else break;return c|0}else if((w|0)==13)return c|0}while(!1);for(;;){if(c=Xt(y|0,_|0,(14-b|0)*3|0)|0,Be()|0,!((c&7|0)==7&!0)){c=0,w=13;break}if(b>>>0<14)b=b+1|0;else{c=1,w=13;break}}return(w|0)==13?c|0:0}function Zo(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0;if(P=Xt(y|0,_|0,52)|0,Be()|0,P=P&15,b>>>0>15)return w=4,w|0;if((P|0)<(b|0))return w=12,w|0;if((P|0)==(b|0))return g[w>>2]=y,g[w+4>>2]=_,w=0,w|0;if(S=rr(b|0,0,52)|0,S=S|y,y=Be()|0|_&-15728641,(P|0)>(b|0))do _=rr(7,0,(14-b|0)*3|0)|0,b=b+1|0,S=_|S,y=Be()|0|y;while((b|0)<(P|0));return g[w>>2]=S,g[w+4>>2]=y,w=0,w|0}function xc(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0;if(P=Xt(y|0,_|0,52)|0,Be()|0,P=P&15,!((b|0)<16&(P|0)<=(b|0)))return w=4,w|0;S=b-P|0,b=Xt(y|0,_|0,45)|0,Be()|0;e:do if(!(Br(b&127)|0))b=js(7,0,S,((S|0)<0)<<31>>31)|0,S=Be()|0;else{t:do if(P|0){for(b=1;D=rr(7,0,(15-b|0)*3|0)|0,!!((D&y|0)==0&((Be()|0)&_|0)==0);)if(b>>>0<P>>>0)b=b+1|0;else break t;b=js(7,0,S,((S|0)<0)<<31>>31)|0,S=Be()|0;break e}while(!1);b=js(7,0,S,((S|0)<0)<<31>>31)|0,b=di(b|0,Be()|0,5,0)|0,b=An(b|0,Be()|0,-5,-1)|0,b=Hs(b|0,Be()|0,6,0)|0,b=An(b|0,Be()|0,1,0)|0,S=Be()|0}while(!1);return D=w,g[D>>2]=b,g[D+4>>2]=S,D=0,D|0}function On(y,_){y=y|0,_=_|0;var b=0,w=0,S=0;if(S=Xt(y|0,_|0,45)|0,Be()|0,!(Br(S&127)|0))return S=0,S|0;S=Xt(y|0,_|0,52)|0,Be()|0,S=S&15;e:do if(!S)b=0;else for(w=1;;){if(b=Xt(y|0,_|0,(15-w|0)*3|0)|0,Be()|0,b=b&7,b|0)break e;if(w>>>0<S>>>0)w=w+1|0;else{b=0;break}}while(!1);return S=(b|0)==0&1,S|0}function Fn(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0;if(D=Ie,Ie=Ie+16|0,P=D,Tc(P,y,_,b),_=P,y=g[_>>2]|0,_=g[_+4>>2]|0,(y|0)==0&(_|0)==0)return Ie=D,0;S=0,b=0;do c=w+(S<<3)|0,g[c>>2]=y,g[c+4>>2]=_,S=An(S|0,b|0,1,0)|0,b=Be()|0,pu(P),c=P,y=g[c>>2]|0,_=g[c+4>>2]|0;while(!((y|0)==0&(_|0)==0));return Ie=D,0}function uu(y,_,b,w){return y=y|0,_=_|0,b=b|0,w=w|0,(w|0)<(b|0)?(b=_,w=y,pr(b|0),w|0):(b=rr(-1,-1,((w-b|0)*3|0)+3|0)|0,w=rr(~b|0,~(Be()|0)|0,(15-w|0)*3|0)|0,b=~(Be()|0)&_,w=~w&y,pr(b|0),w|0)}function Fp(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0;return S=Xt(y|0,_|0,52)|0,Be()|0,S=S&15,(b|0)<16&(S|0)<=(b|0)?((S|0)<(b|0)&&(S=rr(-1,-1,((b+-1-S|0)*3|0)+3|0)|0,S=rr(~S|0,~(Be()|0)|0,(15-b|0)*3|0)|0,_=~(Be()|0)&_,y=~S&y),S=rr(b|0,0,52)|0,b=_&-15728641|(Be()|0),g[w>>2]=y|S,g[w+4>>2]=b,w=0,w|0):(w=4,w|0)}function Ml(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0,Re=0;if((b|0)==0&(w|0)==0)return ge=0,ge|0;if(S=y,P=g[S>>2]|0,S=g[S+4>>2]|0,!0&(S&15728640|0)==0){if(!((w|0)>0|(w|0)==0&b>>>0>0)||(ge=_,g[ge>>2]=P,g[ge+4>>2]=S,(b|0)==1&(w|0)==0))return ge=0,ge|0;S=1;do we=y+(S<<3)|0,Oe=g[we+4>>2]|0,ge=_+(S<<3)|0,g[ge>>2]=g[we>>2],g[ge+4>>2]=Oe,S=S+1|0;while(0<(w|0)|(w|0)==0&S>>>0<b>>>0);return S=0,S|0}if(oe=b<<3,Oe=qn(oe)|0,!Oe)return ge=13,ge|0;
4202if(Do(Oe|0,y|0,oe|0)|0,we=oo(b,8)|0,!we)return zr(Oe),ge=13,ge|0;e:do if(b|0){t:for(;;){S=Oe,ee=g[S>>2]|0,S=g[S+4>>2]|0,Y=Xt(ee|0,S|0,52)|0,Be()|0,Y=Y&15,te=Y+-1|0,q=(b|0)>0;r:do if((Y|0)!=0&q){if(R=((b|0)<0)<<31>>31,L=rr(te|0,0,52)|0,z=Be()|0,te>>>0>15){if(!((ee|0)==0&(S|0)==0)){ge=17;break t}for(P=0;;){if(P=P+1|0,(P|0)>=(b|0))break r;if(w=Oe+(P<<3)|0,z=g[w>>2]|0,w=g[w+4>>2]|0,!((z|0)==0&(w|0)==0)){S=w,ge=17;break t}}}for(P=0,y=ee,w=S;;){if(!((y|0)==0&(w|0)==0)){if(!(!0&(w&117440512|0)==0)){ge=22;break t}if(c=Xt(y|0,w|0,52)|0,Be()|0,c=c&15,(c|0)<(te|0)){S=12,ge=28;break t}if((c|0)!=(te|0)&&(y=y|L,w=w&-15728641|z,c>>>0>=Y>>>0)){D=te;do M=rr(7,0,(14-D|0)*3|0)|0,D=D+1|0,y=M|y,w=Be()|0|w;while(D>>>0<c>>>0)}if(D=To(y|0,w|0,b|0,R|0)|0,Be()|0,h=we+(D<<3)|0,c=h,d=g[c>>2]|0,c=g[c+4>>2]|0,(d|0)==0&(c|0)==0)D=h;else for(M=0;;){if((M|0)>(b|0)){ge=32;break t}if((d|0)==(y|0)&(c&-117440513|0)==(w|0)){m=Xt(d|0,c|0,56)|0,Be()|0,m=m&7,E=m+1|0,Re=Xt(d|0,c|0,45)|0,Be()|0;n:do if(!(Br(Re&127)|0))c=7;else{if(d=Xt(d|0,c|0,52)|0,Be()|0,d=d&15,!d){c=6;break}for(c=1;;){if(Re=rr(7,0,(15-c|0)*3|0)|0,!((Re&y|0)==0&((Be()|0)&w|0)==0)){c=7;break n}if(c>>>0<d>>>0)c=c+1|0;else{c=6;break}}}while(!1);if((m+2|0)>>>0>c>>>0){ge=42;break t}Re=rr(E|0,0,56)|0,w=Be()|0|w&-117440513,E=h,g[E>>2]=0,g[E+4>>2]=0,y=Re|y}else D=(D+1|0)%(b|0)|0;if(h=we+(D<<3)|0,c=h,d=g[c>>2]|0,c=g[c+4>>2]|0,(d|0)==0&(c|0)==0){D=h;break}else M=M+1|0}Re=D,g[Re>>2]=y,g[Re+4>>2]=w}if(P=P+1|0,(P|0)>=(b|0))break r;w=Oe+(P<<3)|0,y=g[w>>2]|0,w=g[w+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(q){M=0,E=0;do{if(c=we+(M<<3)|0,w=c,P=g[w>>2]|0,w=g[w+4>>2]|0,!((P|0)==0&(w|0)==0)){d=Xt(P|0,w|0,56)|0,Be()|0,d=d&7,y=d+1|0,h=w&-117440513,Re=Xt(P|0,w|0,45)|0,Be()|0;n:do if(Br(Re&127)|0){if(m=Xt(P|0,w|0,52)|0,Be()|0,m=m&15,m|0)for(D=1;;){if(Re=rr(7,0,(15-D|0)*3|0)|0,!((P&Re|0)==0&(h&(Be()|0)|0)==0))break n;if(D>>>0<m>>>0)D=D+1|0;else break}w=rr(y|0,0,56)|0,P=w|P,w=Be()|0|h,y=c,g[y>>2]=P,g[y+4>>2]=w,y=d+2|0}while(!1);(y|0)==7&&(Re=z+(E<<3)|0,g[Re>>2]=P,g[Re+4>>2]=w&-117440513,E=E+1|0)}M=M+1|0}while((M|0)!=(b|0));if(q){if(M=((b|0)<0)<<31>>31,R=rr(te|0,0,52)|0,L=Be()|0,te>>>0>15){if(!((ee|0)==0&(S|0)==0)){S=4,ge=84;break t}for(S=0;;){if(S=S+1|0,(S|0)>=(b|0)){P=0,S=E;break r}if(Re=Oe+(S<<3)|0,!((g[Re>>2]|0)==0&(g[Re+4>>2]|0)==0)){S=4,ge=84;break t}}}for(m=0,P=0,h=ee;;){do if(!((h|0)==0&(S|0)==0)){if(c=Xt(h|0,S|0,52)|0,Be()|0,c=c&15,(c|0)<(te|0)){S=12,ge=84;break t}do if((c|0)==(te|0))w=h,c=S;else{if(w=h|R,y=S&-15728641|L,c>>>0<Y>>>0){c=y;break}D=te;do Re=rr(7,0,(14-D|0)*3|0)|0,D=D+1|0,w=Re|w,y=Be()|0|y;while(D>>>0<c>>>0);c=y}while(!1);for(D=To(w|0,c|0,b|0,M|0)|0,Be()|0,y=0;;){if((y|0)>(b|0)){ge=77;break t}if(Re=we+(D<<3)|0,d=g[Re+4>>2]|0,(d&-117440513|0)==(c|0)&&(g[Re>>2]|0)==(w|0)){ge=79;break}if(D=(D+1|0)%(b|0)|0,Re=we+(D<<3)|0,(g[Re>>2]|0)==(w|0)&&(g[Re+4>>2]|0)==(c|0))break;y=y+1|0}if((ge|0)==79&&(ge=0,!0&(d&117440512|0)==100663296))break;Re=_+(P<<3)|0,g[Re>>2]=h,g[Re+4>>2]=S,P=P+1|0}while(!1);if(S=m+1|0,(S|0)>=(b|0)){S=E;break r}Re=Oe+(S<<3)|0,m=S,h=g[Re>>2]|0,S=g[Re+4>>2]|0}}else P=0,S=E}else P=0,S=0;while(!1);if(na(we|0,0,oe|0)|0,Do(Oe|0,z|0,S<<3|0)|0,zr(z),S)_=_+(P<<3)|0,b=S;else break e}if((ge|0)==17)!0&(S&117440512|0)==0?(S=4,ge=28):ge=22;else if((ge|0)==32)qt(23313,22674,362,22684);else{if((ge|0)==42)return zr(Oe),zr(we),Re=10,Re|0;if((ge|0)==49)return zr(Oe),zr(we),Re=13,Re|0;if((ge|0)==77)qt(23313,22674,462,22684);else{if((ge|0)==84)return zr(z),zr(Oe),zr(we),Re=S,Re|0;if((ge|0)==85){Do(_|0,Oe|0,b<<3|0)|0;break}}}if((ge|0)==22)return zr(Oe),zr(we),Re=5,Re|0;if((ge|0)==28)return zr(Oe),zr(we),Re=S,Re|0}while(!1);return zr(Oe),zr(we),Re=0,Re|0}function Ph(y,_,b,w,S,P,D){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0,P=P|0,D=D|0;var c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0;if(z=Ie,Ie=Ie+16|0,L=z,!((b|0)>0|(b|0)==0&_>>>0>0))return L=0,Ie=z,L|0;if((D|0)>=16)return L=12,Ie=z,L|0;M=0,R=0,E=0,c=0;e:for(;;){if(h=y+(M<<3)|0,d=g[h>>2]|0,h=g[h+4>>2]|0,m=Xt(d|0,h|0,52)|0,Be()|0,(m&15|0)>(D|0)){c=12,d=11;break}if(Tc(L,d,h,D),m=L,h=g[m>>2]|0,m=g[m+4>>2]|0,(h|0)==0&(m|0)==0)d=E;else{d=E;do{if(!((c|0)<(P|0)|(c|0)==(P|0)&d>>>0<S>>>0)){d=10;break e}E=w+(d<<3)|0,g[E>>2]=h,g[E+4>>2]=m,d=An(d|0,c|0,1,0)|0,c=Be()|0,pu(L),E=L,h=g[E>>2]|0,m=g[E+4>>2]|0}while(!((h|0)==0&(m|0)==0))}if(M=An(M|0,R|0,1,0)|0,R=Be()|0,(R|0)<(b|0)|(R|0)==(b|0)&M>>>0<_>>>0)E=d;else{c=0,d=11;break}}return(d|0)==10?(L=14,Ie=z,L|0):(d|0)==11?(Ie=z,c|0):0}function Lp(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0;M=Ie,Ie=Ie+16|0,E=M;e:do if((b|0)>0|(b|0)==0&_>>>0>0){for(h=0,D=0,P=0,m=0;;){if(d=y+(h<<3)|0,c=g[d>>2]|0,d=g[d+4>>2]|0,!((c|0)==0&(d|0)==0)&&(d=(xc(c,d,w,E)|0)==0,c=E,D=An(g[c>>2]|0,g[c+4>>2]|0,D|0,P|0)|0,P=Be()|0,!d)){P=12;break}if(h=An(h|0,m|0,1,0)|0,m=Be()|0,!((m|0)<(b|0)|(m|0)==(b|0)&h>>>0<_>>>0))break e}return Ie=M,P|0}else D=0,P=0;while(!1);return g[S>>2]=D,g[S+4>>2]=P,S=0,Ie=M,S|0}function Mh(y,_){return y=y|0,_=_|0,_=Xt(y|0,_|0,52)|0,Be()|0,_&1|0}function ns(y,_){y=y|0,_=_|0;var b=0,w=0,S=0;if(S=Xt(y|0,_|0,52)|0,Be()|0,S=S&15,!S)return S=0,S|0;for(w=1;;){if(b=Xt(y|0,_|0,(15-w|0)*3|0)|0,Be()|0,b=b&7,b|0){w=5;break}if(w>>>0<S>>>0)w=w+1|0;else{b=0,w=5;break}}return(w|0)==5?b|0:0}function Sa(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0,d=0;if(d=Xt(y|0,_|0,52)|0,Be()|0,d=d&15,!d)return c=_,d=y,pr(c|0),d|0;for(c=1,b=0;;){P=(15-c|0)*3|0,w=rr(7,0,P|0)|0,S=Be()|0,D=Xt(y|0,_|0,P|0)|0,Be()|0,P=rr(bo(D&7)|0,0,P|0)|0,D=Be()|0,y=P|y&~w,_=D|_&~S;e:do if(!b)if((P&w|0)==0&(D&S|0)==0)b=0;else if(w=Xt(y|0,_|0,52)|0,Be()|0,w=w&15,!w)b=1;else{b=1;t:for(;;){switch(D=Xt(y|0,_|0,(15-b|0)*3|0)|0,Be()|0,D&7){case 1:break t;case 0:break;default:{b=1;break e}}if(b>>>0<w>>>0)b=b+1|0;else{b=1;break e}}for(b=1;;)if(D=(15-b|0)*3|0,S=Xt(y|0,_|0,D|0)|0,Be()|0,P=rr(7,0,D|0)|0,_=_&~(Be()|0),D=rr(bo(S&7)|0,0,D|0)|0,y=y&~P|D,_=_|(Be()|0),b>>>0<w>>>0)b=b+1|0;else{b=1;break}}while(!1);if(c>>>0<d>>>0)c=c+1|0;else break}return pr(_|0),y|0}function xo(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0;if(w=Xt(y|0,_|0,52)|0,Be()|0,w=w&15,!w)return b=_,w=y,pr(b|0),w|0;for(b=1;P=(15-b|0)*3|0,D=Xt(y|0,_|0,P|0)|0,Be()|0,S=rr(7,0,P|0)|0,_=_&~(Be()|0),P=rr(bo(D&7)|0,0,P|0)|0,y=P|y&~S,_=Be()|0|_,b>>>0<w>>>0;)b=b+1|0;return pr(_|0),y|0}function fu(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0,d=0;if(d=Xt(y|0,_|0,52)|0,Be()|0,d=d&15,!d)return c=_,d=y,pr(c|0),d|0;for(c=1,b=0;;){P=(15-c|0)*3|0,w=rr(7,0,P|0)|0,S=Be()|0,D=Xt(y|0,_|0,P|0)|0,Be()|0,P=rr(eo(D&7)|0,0,P|0)|0,D=Be()|0,y=P|y&~w,_=D|_&~S;e:do if(!b)if((P&w|0)==0&(D&S|0)==0)b=0;else if(w=Xt(y|0,_|0,52)|0,Be()|0,w=w&15,!w)b=1;else{b=1;t:for(;;){switch(D=Xt(y|0,_|0,(15-b|0)*3|0)|0,Be()|0,D&7){case 1:break t;case 0:break;default:{b=1;break e}}if(b>>>0<w>>>0)b=b+1|0;else{b=1;break e}}for(b=1;;)if(S=(15-b|0)*3|0,P=rr(7,0,S|0)|0,D=_&~(Be()|0),_=Xt(y|0,_|0,S|0)|0,Be()|0,_=rr(eo(_&7)|0,0,S|0)|0,y=y&~P|_,_=D|(Be()|0),b>>>0<w>>>0)b=b+1|0;else{b=1;break}}while(!1);if(c>>>0<d>>>0)c=c+1|0;else break}return pr(_|0),y|0}function Za(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0;if(w=Xt(y|0,_|0,52)|0,Be()|0,w=w&15,!w)return b=_,w=y,pr(b|0),w|0;for(b=1;D=(15-b|0)*3|0,P=rr(7,0,D|0)|0,S=_&~(Be()|0),_=Xt(y|0,_|0,D|0)|0,Be()|0,_=rr(eo(_&7)|0,0,D|0)|0,y=_|y&~P,_=Be()|0|S,b>>>0<w>>>0;)b=b+1|0;return pr(_|0),y|0}function Rl(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0;
4202if(d=Ie,Ie=Ie+64|0,c=d+40|0,w=d+24|0,S=d+12|0,P=d,rr(_|0,0,52)|0,b=Be()|0|134225919,!_)return(g[y+4>>2]|0)>2||(g[y+8>>2]|0)>2||(g[y+12>>2]|0)>2?(D=0,c=0,pr(D|0),Ie=d,c|0):(rr(Li(y)|0,0,45)|0,D=Be()|0|b,c=-1,pr(D|0),Ie=d,c|0);if(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],D=c+4|0,(_|0)>0)for(y=-1;g[w>>2]=g[D>>2],g[w+4>>2]=g[D+4>>2],g[w+8>>2]=g[D+8>>2],_&1?(ff(D),g[S>>2]=g[D>>2],g[S+4>>2]=g[D+4>>2],g[S+8>>2]=g[D+8>>2],Bl(S)):(iu(D),g[S>>2]=g[D>>2],g[S+4>>2]=g[D+4>>2],g[S+8>>2]=g[D+8>>2],Xo(S)),hi(w,S,P),_i(P),m=(15-_|0)*3|0,h=rr(7,0,m|0)|0,b=b&~(Be()|0),m=rr(vc(P)|0,0,m|0)|0,y=m|y&~h,b=Be()|0|b,(_|0)>1;)_=_+-1|0;else y=-1;e:do if((g[D>>2]|0)<=2&&(g[c+8>>2]|0)<=2&&(g[c+12>>2]|0)<=2){if(w=Li(c)|0,_=rr(w|0,0,45)|0,_=_|y,y=Be()|0|b&-1040385,P=Xi(c)|0,!(Br(w)|0)){if((P|0)<=0)break;for(S=0;;){if(w=Xt(_|0,y|0,52)|0,Be()|0,w=w&15,w)for(b=1;m=(15-b|0)*3|0,c=Xt(_|0,y|0,m|0)|0,Be()|0,h=rr(7,0,m|0)|0,y=y&~(Be()|0),m=rr(bo(c&7)|0,0,m|0)|0,_=_&~h|m,y=y|(Be()|0),b>>>0<w>>>0;)b=b+1|0;if(S=S+1|0,(S|0)==(P|0))break e}}S=Xt(_|0,y|0,52)|0,Be()|0,S=S&15;t:do if(S){b=1;r:for(;;){switch(m=Xt(_|0,y|0,(15-b|0)*3|0)|0,Be()|0,m&7){case 1:break r;case 0:break;default:break t}if(b>>>0<S>>>0)b=b+1|0;else break t}if(uf(w,g[c>>2]|0)|0)for(b=1;c=(15-b|0)*3|0,h=rr(7,0,c|0)|0,m=y&~(Be()|0),y=Xt(_|0,y|0,c|0)|0,Be()|0,y=rr(eo(y&7)|0,0,c|0)|0,_=_&~h|y,y=m|(Be()|0),b>>>0<S>>>0;)b=b+1|0;else for(b=1;m=(15-b|0)*3|0,c=Xt(_|0,y|0,m|0)|0,Be()|0,h=rr(7,0,m|0)|0,y=y&~(Be()|0),m=rr(bo(c&7)|0,0,m|0)|0,_=_&~h|m,y=y|(Be()|0),b>>>0<S>>>0;)b=b+1|0}while(!1);if((P|0)>0){b=0;do _=Sa(_,y)|0,y=Be()|0,b=b+1|0;while((b|0)!=(P|0))}}else _=0,y=0;while(!1);return h=y,m=_,pr(h|0),Ie=d,m|0}function zs(y){return y=y|0,(y|0)%2|0|0}function Ya(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0;return S=Ie,Ie=Ie+16|0,w=S,_>>>0>15?(w=4,Ie=S,w|0):(g[y+4>>2]&2146435072|0)==2146435072||(g[y+8+4>>2]&2146435072|0)==2146435072?(w=3,Ie=S,w|0):(au(y,_,w),_=Rl(w,_)|0,w=Be()|0,g[b>>2]=_,g[b+4>>2]=w,(_|0)==0&(w|0)==0&&qt(23313,22674,786,22697),w=0,Ie=S,w|0)}function Vs(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0;if(S=b+4|0,P=Xt(y|0,_|0,52)|0,Be()|0,P=P&15,D=Xt(y|0,_|0,45)|0,Be()|0,w=(P|0)==0,Br(D&127)|0){if(w)return D=1,D|0;w=1}else{if(w)return D=0,D|0;(g[S>>2]|0)==0&&(g[b+8>>2]|0)==0?w=(g[b+12>>2]|0)!=0&1:w=1}for(b=1;b&1?Bl(S):Xo(S),D=Xt(y|0,_|0,(15-b|0)*3|0)|0,Be()|0,hf(S,D&7),b>>>0<P>>>0;)b=b+1|0;return w|0}function Qa(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0;if(m=Ie,Ie=Ie+16|0,d=m,h=Xt(y|0,_|0,45)|0,Be()|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,Ie=m,h|0;e:do if((Br(h)|0)!=0&&(P=Xt(y|0,_|0,52)|0,Be()|0,P=P&15,(P|0)!=0)){w=1;t:for(;;){switch(c=Xt(y|0,_|0,(15-w|0)*3|0)|0,Be()|0,c&7){case 5:break t;case 0:break;default:{w=_;break e}}if(w>>>0<P>>>0)w=w+1|0;else{w=_;break e}}for(S=1,w=_;_=(15-S|0)*3|0,D=rr(7,0,_|0)|0,c=w&~(Be()|0),w=Xt(y|0,w|0,_|0)|0,Be()|0,w=rr(eo(w&7)|0,0,_|0)|0,y=y&~D|w,w=c|(Be()|0),S>>>0<P>>>0;)S=S+1|0}else w=_;while(!1);if(c=7696+(h*28|0)|0,g[b>>2]=g[c>>2],g[b+4>>2]=g[c+4>>2],g[b+8>>2]=g[c+8>>2],g[b+12>>2]=g[c+12>>2],!(Vs(y,w,b)|0))return h=0,Ie=m,h|0;if(D=b+4|0,g[d>>2]=g[D>>2],g[d+4>>2]=g[D+4>>2],g[d+8>>2]=g[D+8>>2],P=Xt(y|0,w|0,52)|0,Be()|0,c=P&15,P&1?(Xo(D),P=c+1|0):P=c,!(Br(h)|0))w=0;else{e:do if(!c)w=0;else for(_=1;;){if(S=Xt(y|0,w|0,(15-_|0)*3|0)|0,Be()|0,S=S&7,S|0){w=S;break e}if(_>>>0<c>>>0)_=_+1|0;else{w=0;break}}while(!1);w=(w|0)==4&1}if(!(to(b,P,w,0)|0))(P|0)!=(c|0)&&(g[D>>2]=g[d>>2],g[D+4>>2]=g[d+4>>2],g[D+8>>2]=g[d+8>>2]);else{if(Br(h)|0)do;while((to(b,P,0,0)|0)!=0);
4202(P|0)!=(c|0)&&iu(D)}return h=0,Ie=m,h|0}function Ol(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;return P=Ie,Ie=Ie+16|0,w=P,S=Qa(y,_,w)|0,S|0?(Ie=P,S|0):(S=Xt(y|0,_|0,52)|0,Be()|0,Ih(w,S&15,b),S=0,Ie=P,S|0)}function Dl(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0;if(D=Ie,Ie=Ie+16|0,P=D,w=Qa(y,_,P)|0,w|0)return P=w,Ie=D,P|0;w=Xt(y|0,_|0,45)|0,Be()|0,w=(Br(w&127)|0)==0,S=Xt(y|0,_|0,52)|0,Be()|0,S=S&15;e:do if(!w){if(S|0)for(w=1;;){if(c=rr(7,0,(15-w|0)*3|0)|0,!((c&y|0)==0&((Be()|0)&_|0)==0))break e;if(w>>>0<S>>>0)w=w+1|0;else break}return qo(P,S,0,5,b),c=0,Ie=D,c|0}while(!1);return lu(P,S,0,6,b),c=0,Ie=D,c|0}function el(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;if(S=Xt(y|0,_|0,45)|0,Be()|0,!(Br(S&127)|0))return S=2,g[b>>2]=S,0;if(S=Xt(y|0,_|0,52)|0,Be()|0,S=S&15,!S)return S=5,g[b>>2]=S,0;for(w=1;;){if(P=rr(7,0,(15-w|0)*3|0)|0,!((P&y|0)==0&((Be()|0)&_|0)==0)){w=2,y=6;break}if(w>>>0<S>>>0)w=w+1|0;else{w=5,y=6;break}}return(y|0)==6&&(g[b>>2]=w),0}function Fl(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0;E=Ie,Ie=Ie+128|0,h=E+112|0,P=E+96|0,m=E,S=Xt(y|0,_|0,52)|0,Be()|0,c=S&15,g[h>>2]=c,D=Xt(y|0,_|0,45)|0,Be()|0,D=D&127;e:do if(Br(D)|0){if(c|0)for(w=1;;){if(d=rr(7,0,(15-w|0)*3|0)|0,!((d&y|0)==0&((Be()|0)&_|0)==0)){S=0;break e}if(w>>>0<c>>>0)w=w+1|0;else break}if(S&1)S=1;else return d=rr(c+1|0,0,52)|0,m=Be()|0|_&-15728641,h=rr(7,0,(14-c|0)*3|0)|0,m=Fl((d|y)&~h,m&~(Be()|0),b)|0,Ie=E,m|0}else S=0;while(!1);if(w=Qa(y,_,P)|0,!w){S?(Jo(P,h,m),d=5):(cu(P,h,m),d=6);e:do if(Br(D)|0)if(!c)y=5;else for(w=1;;){if(D=rr(7,0,(15-w|0)*3|0)|0,!((D&y|0)==0&((Be()|0)&_|0)==0)){y=2;break e}if(w>>>0<c>>>0)w=w+1|0;else{y=5;break}}else y=2;while(!1);na(b|0,-1,y<<2|0)|0;e:do if(S)for(P=0;;){if(D=m+(P<<4)|0,Bh(D,g[h>>2]|0)|0,D=g[D>>2]|0,c=g[b>>2]|0,(c|0)==-1|(c|0)==(D|0))w=b;else{S=0;do{if(S=S+1|0,S>>>0>=y>>>0){w=1;break e}w=b+(S<<2)|0,c=g[w>>2]|0}while(!((c|0)==-1|(c|0)==(D|0)))}if(g[w>>2]=D,P=P+1|0,P>>>0>=d>>>0){w=0;break}}else for(P=0;;){if(D=m+(P<<4)|0,to(D,g[h>>2]|0,0,1)|0,D=g[D>>2]|0,c=g[b>>2]|0,(c|0)==-1|(c|0)==(D|0))w=b;else{S=0;do{if(S=S+1|0,S>>>0>=y>>>0){w=1;break e}w=b+(S<<2)|0,c=g[w>>2]|0}while(!((c|0)==-1|(c|0)==(D|0)))}if(g[w>>2]=D,P=P+1|0,P>>>0>=d>>>0){w=0;break}}while(!1)}return m=w,Ie=E,m|0}function hu(){return 12}function wc(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0,d=0;if(y>>>0>15)return c=4,c|0;if(rr(y|0,0,52)|0,c=Be()|0|134225919,!y){b=0,w=0;do Br(w)|0&&(rr(w|0,0,45)|0,D=c|(Be()|0),y=_+(b<<3)|0,g[y>>2]=-1,g[y+4>>2]=D,b=b+1|0),w=w+1|0;while((w|0)!=122);return b=0,b|0}b=0,D=0;do{if(Br(D)|0){for(rr(D|0,0,45)|0,w=1,S=-1,P=c|(Be()|0);d=rr(7,0,(15-w|0)*3|0)|0,S=S&~d,P=P&~(Be()|0),(w|0)!=(y|0);)w=w+1|0;d=_+(b<<3)|0,g[d>>2]=S,g[d+4>>2]=P,b=b+1|0}D=D+1|0}while((D|0)!=122);return b=0,b|0}function du(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0;if(Y=Ie,Ie=Ie+16|0,q=Y,ee=Xt(y|0,_|0,52)|0,Be()|0,ee=ee&15,b>>>0>15)return ee=4,Ie=Y,ee|0;if((ee|0)<(b|0))return ee=12,Ie=Y,ee|0;if((ee|0)!=(b|0))if(P=rr(b|0,0,52)|0,P=P|y,c=Be()|0|_&-15728641,(ee|0)>(b|0)){d=b;do z=rr(7,0,(14-d|0)*3|0)|0,d=d+1|0,P=z|P,c=Be()|0|c;while((d|0)<(ee|0));z=P}else z=P;else z=y,c=_;L=Xt(z|0,c|0,45)|0,Be()|0;e:do if(Br(L&127)|0){if(d=Xt(z|0,c|0,52)|0,Be()|0,d=d&15,d|0)for(P=1;;){if(L=rr(7,0,(15-P|0)*3|0)|0,!((L&z|0)==0&((Be()|0)&c|0)==0)){h=33;break e}if(P>>>0<d>>>0)P=P+1|0;else break}if(L=w,g[L>>2]=0,g[L+4>>2]=0,(ee|0)>(b|0)){for(L=_&-15728641,R=ee;;){if(M=R,R=R+-1|0,R>>>0>15|(ee|0)<(R|0)){h=19;break}if((ee|0)!=(R|0))if(P=rr(R|0,0,52)|0,P=P|y,d=Be()|0|L,(ee|0)<(M|0))E=P;else{h=R;do E=rr(7,0,(14-h|0)*3|0)|0,h=h+1|0,P=E|P,d=Be()|0|d;while((h|0)<(ee|0));E=P}else E=y,d=_;if(m=Xt(E|0,d|0,45)|0,Be()|0,!(Br(m&127)|0))P=0;else{m=Xt(E|0,d|0,52)|0,Be()|0,m=m&15;t:do if(!m)P=0;else for(h=1;;){if(P=Xt(E|0,d|0,(15-h|0)*3|0)|0,Be()|0,P=P&7,P|0)break t;if(h>>>0<m>>>0)h=h+1|0;else{P=0;break}}while(!1);P=(P|0)==0&1}if(d=Xt(y|0,_|0,(15-M|0)*3|0)|0,Be()|0,d=d&7,(d|0)==7){S=5,h=42;break}if(P=(P|0)!=0,(d|0)==1&P){S=5,h=42;break}if(E=d+(((d|0)!=0&P)<<31>>31)|0,E|0&&(h=ee-M|0,h=js(7,0,h,((h|0)<0)<<31>>31)|0,m=Be()|0,P?(P=di(h|0,m|0,5,0)|0,P=An(P|0,Be()|0,-5,-1)|0,P=Hs(P|0,Be()|0,6,0)|0,P=An(P|0,Be()|0,1,0)|0,d=Be()|0):(P=h,d=m),M=E+-1|0,M=di(h|0,m|0,M|0,((M|0)<0)<<31>>31|0)|0,M=An(P|0,d|0,M|0,Be()|0)|0,E=Be()|0,m=w,m=An(M|0,E|0,g[m>>2]|0,g[m+4>>2]|0)|0,E=Be()|0,M=w,g[M>>2]=m,g[M+4>>2]=E),(R|0)<=(b|0)){h=37;break}}if((h|0)==19)qt(23313,22674,1099,22710);else if((h|0)==37){D=w,S=g[D+4>>2]|0,D=g[D>>2]|0;break}else if((h|0)==42)return Ie=Y,S|0}else S=0,D=0}else h=33;while(!1);e:do if((h|0)==33)if(L=w,g[L>>2]=0,g[L+4>>2]=0,(ee|0)>(b|0)){for(P=ee;;){if(S=Xt(y|0,_|0,(15-P|0)*3|0)|0,Be()|0,S=S&7,(S|0)==7){S=5;break}if(D=ee-P|0,D=js(7,0,D,((D|0)<0)<<31>>31)|0,S=di(D|0,Be()|0,S|0,0)|0,D=Be()|0,L=w,D=An(g[L>>2]|0,g[L+4>>2]|0,S|0,D|0)|0,S=Be()|0,L=w,g[L>>2]=D,g[L+4>>2]=S,P=P+-1|0,(P|0)<=(b|0))break e}return Ie=Y,S|0}else S=0,D=0;while(!1);return xc(z,c,ee,q)|0&&qt(23313,22674,1063,22725),ee=q,q=g[ee+4>>2]|0,((S|0)>-1|(S|0)==-1&D>>>0>4294967295)&((q|0)>(S|0)|((q|0)==(S|0)?(g[ee>>2]|0)>>>0>D>>>0:0))?(ee=0,Ie=Y,ee|0):(qt(23313,22674,1139,22710),0)}function kp(y,_,b,w,S,P){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0,P=P|0;var D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0;if(E=Ie,Ie=Ie+16|0,D=E,S>>>0>15)return P=4,Ie=E,P|0;if(c=Xt(b|0,w|0,52)|0,Be()|0,c=c&15,(c|0)>(S|0))return P=12,Ie=E,P|0;if(xc(b,w,S,D)|0&&qt(23313,22674,1063,22725),m=D,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 P=2,Ie=E,P|0;m=S-c|0,S=rr(S|0,0,52)|0,d=Be()|0|w&-15728641,h=P,g[h>>2]=S|b,g[h+4>>2]=d,h=Xt(b|0,w|0,45)|0,Be()|0;
4202e:do if(Br(h&127)|0){if(c|0)for(D=1;;){if(h=rr(7,0,(15-D|0)*3|0)|0,!((h&b|0)==0&((Be()|0)&w|0)==0))break e;if(D>>>0<c>>>0)D=D+1|0;else break}if((m|0)<1)return P=0,Ie=E,P|0;for(h=c^15,w=-1,d=1,D=1;;){c=m-d|0,c=js(7,0,c,((c|0)<0)<<31>>31)|0,b=Be()|0;do if(D)if(D=di(c|0,b|0,5,0)|0,D=An(D|0,Be()|0,-5,-1)|0,D=Hs(D|0,Be()|0,6,0)|0,S=Be()|0,(_|0)>(S|0)|(_|0)==(S|0)&y>>>0>D>>>0){_=An(y|0,_|0,-1,-1)|0,_=Jr(_|0,Be()|0,D|0,S|0)|0,D=Be()|0,M=P,L=g[M>>2]|0,M=g[M+4>>2]|0,z=(h+w|0)*3|0,R=rr(7,0,z|0)|0,M=M&~(Be()|0),w=Hs(_|0,D|0,c|0,b|0)|0,y=Be()|0,S=An(w|0,y|0,2,0)|0,z=rr(S|0,Be()|0,z|0)|0,M=Be()|0|M,S=P,g[S>>2]=z|L&~R,g[S+4>>2]=M,y=di(w|0,y|0,c|0,b|0)|0,y=Jr(_|0,D|0,y|0,Be()|0)|0,D=0,_=Be()|0;break}else{z=P,R=g[z>>2]|0,z=g[z+4>>2]|0,L=rr(7,0,(h+w|0)*3|0)|0,z=z&~(Be()|0),D=P,g[D>>2]=R&~L,g[D+4>>2]=z,D=1;break}else R=P,S=g[R>>2]|0,R=g[R+4>>2]|0,w=(h+w|0)*3|0,M=rr(7,0,w|0)|0,R=R&~(Be()|0),z=Hs(y|0,_|0,c|0,b|0)|0,D=Be()|0,w=rr(z|0,D|0,w|0)|0,R=Be()|0|R,L=P,g[L>>2]=w|S&~M,g[L+4>>2]=R,D=di(z|0,D|0,c|0,b|0)|0,y=Jr(y|0,_|0,D|0,Be()|0)|0,D=0,_=Be()|0;while(!1);if((m|0)>(d|0))w=~d,d=d+1|0;else{_=0;break}}return Ie=E,_|0}while(!1);if((m|0)<1)return z=0,Ie=E,z|0;for(S=c^15,D=1;;)if(L=m-D|0,L=js(7,0,L,((L|0)<0)<<31>>31)|0,z=Be()|0,d=P,b=g[d>>2]|0,d=g[d+4>>2]|0,c=(S-D|0)*3|0,w=rr(7,0,c|0)|0,d=d&~(Be()|0),M=Hs(y|0,_|0,L|0,z|0)|0,R=Be()|0,c=rr(M|0,R|0,c|0)|0,d=Be()|0|d,h=P,g[h>>2]=c|b&~w,g[h+4>>2]=d,z=di(M|0,R|0,L|0,z|0)|0,y=Jr(y|0,_|0,z|0,Be()|0)|0,_=Be()|0,(m|0)<=(D|0)){_=0;break}else D=D+1|0;return Ie=E,_|0}function Tc(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0;S=Xt(_|0,b|0,52)|0,Be()|0,S=S&15,(_|0)==0&(b|0)==0|((w|0)>15|(S|0)>(w|0))?(w=-1,S=-1,_=0,b=0):(P=uu(_,b,S+1|0,w)|0,b=(Be()|0)&-15728641,_=rr(w|0,0,52)|0,_=P|_,b=b|(Be()|0),P=(On(_,b)|0)==0,w=P?-1:w),P=y,g[P>>2]=_,g[P+4>>2]=b,g[y+8>>2]=S,g[y+12>>2]=w}function pu(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0,d=0,h=0;if(b=y,_=g[b>>2]|0,b=g[b+4>>2]|0,!((_|0)==0&(b|0)==0)&&(w=Xt(_|0,b|0,52)|0,Be()|0,w=w&15,c=rr(1,0,(w^15)*3|0)|0,_=An(c|0,Be()|0,_|0,b|0)|0,b=Be()|0,c=y,g[c>>2]=_,g[c+4>>2]=b,c=y+8|0,D=g[c>>2]|0,!((w|0)<(D|0)))){for(d=y+12|0,P=w;;){if((P|0)==(D|0)){w=5;break}if(h=(P|0)==(g[d>>2]|0),S=(15-P|0)*3|0,w=Xt(_|0,b|0,S|0)|0,Be()|0,w=w&7,h&((w|0)==1&!0)){w=7;break}if(!((w|0)==7&!0)){w=10;break}if(h=rr(1,0,S|0)|0,_=An(_|0,b|0,h|0,Be()|0)|0,b=Be()|0,h=y,g[h>>2]=_,g[h+4>>2]=b,(P|0)>(D|0))P=P+-1|0;else{w=10;break}}if((w|0)==5){h=y,g[h>>2]=0,g[h+4>>2]=0,g[c>>2]=-1,g[d>>2]=-1;return}else if((w|0)==7){D=rr(1,0,S|0)|0,D=An(_|0,b|0,D|0,Be()|0)|0,c=Be()|0,h=y,g[h>>2]=D,g[h+4>>2]=c,g[d>>2]=P+-1;return}else if((w|0)==10)return}}function Ll(y){y=+y;var _=0;return _=y<0?y+6.283185307179586:y,+(y>=6.283185307179586?_+-6.283185307179586:_)}function tl(y,_){return y=y|0,_=_|0,+Mt(+(+le[y>>3]-+le[_>>3]))<17453292519943298e-27?(_=+Mt(+(+le[y+8>>3]-+le[_+8>>3]))<17453292519943298e-27,_|0):(_=0,_|0)}function Au(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0;return S=+le[_>>3],w=+le[y>>3],P=+Pt(+((S-w)*.5)),b=+Pt(+((+le[_+8>>3]-+le[y+8>>3])*.5)),b=P*P+b*(+Lt(+S)*+Lt(+w)*b),+(+ln(+ +Ft(+b),+ +Ft(+(1-b)))*2)}function rl(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0;return S=+le[_>>3],w=+le[y>>3],P=+Pt(+((S-w)*.5)),b=+Pt(+((+le[_+8>>3]-+le[y+8>>3])*.5)),b=P*P+b*(+Lt(+S)*+Lt(+w)*b),+(+ln(+ +Ft(+b),+ +Ft(+(1-b)))*2*6371.007180918475)}function gf(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0;return S=+le[_>>3],w=+le[y>>3],P=+Pt(+((S-w)*.5)),b=+Pt(+((+le[_+8>>3]-+le[y+8>>3])*.5)),b=P*P+b*(+Lt(+S)*+Lt(+w)*b),+(+ln(+ +Ft(+b),+ +Ft(+(1-b)))*2*6371.007180918475*1e3)}function mf(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0;return P=+le[_>>3],w=+Lt(+P),S=+le[_+8>>3]-+le[y+8>>3],D=w*+Pt(+S),b=+le[y>>3],+ +ln(+D,+(+Pt(+P)*+Lt(+b)-+Lt(+S)*(w*+Pt(+b))))}function Ec(y,_,b,w){y=y|0,_=+_,b=+b,w=w|0;var S=0,P=0,D=0,c=0;if(b<1e-16){g[w>>2]=g[y>>2],g[w+4>>2]=g[y+4>>2],g[w+8>>2]=g[y+8>>2],g[w+12>>2]=g[y+12>>2];return}P=_<0?_+6.283185307179586:_,P=_>=6.283185307179586?P+-6.283185307179586:P;do if(P<1e-16)_=+le[y>>3]+b,le[w>>3]=_,S=w;else{if(S=+Mt(+(P+-3.141592653589793))<1e-16,_=+le[y>>3],S){_=_-b,le[w>>3]=_,S=w;break}if(D=+Lt(+b),b=+Pt(+b),_=D*+Pt(+_)+ +Lt(+P)*(b*+Lt(+_)),_=_>1?1:_,_=+Qt(+(_<-1?-1:_)),le[w>>3]=_,+Mt(+(_+-1.5707963267948966))<1e-16){le[w>>3]=1.5707963267948966,le[w+8>>3]=0;return}if(+Mt(+(_+1.5707963267948966))<1e-16){le[w>>3]=-1.5707963267948966,le[w+8>>3]=0;return}if(c=+Lt(+_),P=b*+Pt(+P)/c,b=+le[y>>3],_=(D-+Pt(+_)*+Pt(+b))/+Lt(+b)/c,D=P>1?1:P,_=_>1?1:_,_=+le[y+8>>3]+ +ln(+(D<-1?-1:D),+(_<-1?-1:_)),_>3.141592653589793)do _=_+-6.283185307179586;while(_>3.141592653589793);if(_<-3.141592653589793)do _=_+6.283185307179586;while(_<-3.141592653589793);le[w+8>>3]=_;return}while(!1);if(+Mt(+(_+-1.5707963267948966))<1e-16){le[S>>3]=1.5707963267948966,le[w+8>>3]=0;return}if(+Mt(+(_+1.5707963267948966))<1e-16){le[S>>3]=-1.5707963267948966,le[w+8>>3]=0;return}if(_=+le[y+8>>3],_>3.141592653589793)do _=_+-6.283185307179586;while(_>3.141592653589793);if(_<-3.141592653589793)do _=_+6.283185307179586;while(_<-3.141592653589793);le[w+8>>3]=_}function Rh(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(le[_>>3]=+le[20528+(y<<3)>>3],_=0,_|0)}function nl(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(le[_>>3]=+le[20656+(y<<3)>>3],_=0,_|0)}function Xn(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(le[_>>3]=+le[20784+(y<<3)>>3],_=0,_|0)}function gu(y,_){return y=y|0,_=_|0,y>>>0>15?(_=4,_|0):(le[_>>3]=+le[20912+(y<<3)>>3],_=0,_|0)}function Yo(y,_){y=y|0,_=_|0;var b=0;return y>>>0>15?(_=4,_|0):(b=js(7,0,y,((y|0)<0)<<31>>31)|0,b=di(b|0,Be()|0,120,0)|0,y=Be()|0,g[_>>2]=b|2,g[_+4>>2]=y,_=0,_|0)}function Qo(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0;return M=+le[_>>3],m=+le[y>>3],d=+Pt(+((M-m)*.5)),P=+le[_+8>>3],h=+le[y+8>>3],D=+Pt(+((P-h)*.5)),c=+Lt(+m),E=+Lt(+M),D=d*d+D*(E*c*D),D=+ln(+ +Ft(+D),+ +Ft(+(1-D)))*2,d=+le[b>>3],M=+Pt(+((d-M)*.5)),w=+le[b+8>>3],P=+Pt(+((w-P)*.5)),S=+Lt(+d),P=M*M+P*(E*S*P),P=+ln(+ +Ft(+P),+ +Ft(+(1-P)))*2,d=+Pt(+((m-d)*.5)),w=+Pt(+((h-w)*.5)),w=d*d+w*(c*S*w),w=+ln(+ +Ft(+w),+ +Ft(+(1-w)))*2,S=(D+P+w)*.5,+(+en(+ +Ft(+(+jt(+(S*.5))*+jt(+((S-D)*.5))*+jt(+((S-P)*.5))*+jt(+((S-w)*.5)))))*4)}function fn(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0;if(c=Ie,Ie=Ie+192|0,P=c+168|0,D=c,S=Ol(y,_,P)|0,S|0)return b=S,Ie=c,b|0;if(Dl(y,_,D)|0&&qt(23313,22742,386,22751),_=g[D>>2]|0,(_|0)>0){if(w=+Qo(D+8|0,D+8+(((_|0)!=1&1)<<4)|0,P)+0,(_|0)!=1){y=1;do S=y,y=y+1|0,w=w+ +Qo(D+8+(S<<4)|0,D+8+(((y|0)%(_|0)|0)<<4)|0,P);while((y|0)<(_|0))}}else w=0;return le[b>>3]=w,b=0,Ie=c,b|0}function Ln(y,_,b){return y=y|0,_=_|0,b=b|0,y=fn(y,_,b)|0,y|0||(le[b>>3]=+le[b>>3]*6371.007180918475*6371.007180918475),y|0}function Gs(y,_,b){return y=y|0,_=_|0,b=b|0,y=fn(y,_,b)|0,y|0||(le[b>>3]=+le[b>>3]*6371.007180918475*6371.007180918475*1e3*1e3),y|0}function Cc(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0;if(c=Ie,Ie=Ie+176|0,D=c,y=ou(y,_,D)|0,y|0)return D=y,Ie=c,D|0;if(le[b>>3]=0,y=g[D>>2]|0,(y|0)<=1)return D=0,Ie=c,D|0;_=y+-1|0,y=0,w=+le[D+8>>3],S=+le[D+16>>3],P=0;do y=y+1|0,h=w,w=+le[D+8+(y<<4)>>3],m=+Pt(+((w-h)*.5)),d=S,S=+le[D+8+(y<<4)+8>>3],d=+Pt(+((S-d)*.5)),d=m*m+d*(+Lt(+w)*+Lt(+h)*d),P=P+ +ln(+ +Ft(+d),+ +Ft(+(1-d)))*2;while((y|0)<(_|0));return le[b>>3]=P,D=0,Ie=c,D|0}
4202function kl(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0;if(c=Ie,Ie=Ie+176|0,D=c,y=ou(y,_,D)|0,y|0)return D=y,P=+le[b>>3],P=P*6371.007180918475,le[b>>3]=P,Ie=c,D|0;if(le[b>>3]=0,y=g[D>>2]|0,(y|0)<=1)return D=0,P=0,P=P*6371.007180918475,le[b>>3]=P,Ie=c,D|0;_=y+-1|0,y=0,w=+le[D+8>>3],S=+le[D+16>>3],P=0;do y=y+1|0,h=w,w=+le[D+8+(y<<4)>>3],m=+Pt(+((w-h)*.5)),d=S,S=+le[D+8+(y<<4)+8>>3],d=+Pt(+((S-d)*.5)),d=m*m+d*(+Lt(+h)*+Lt(+w)*d),P=P+ +ln(+ +Ft(+d),+ +Ft(+(1-d)))*2;while((y|0)!=(_|0));return le[b>>3]=P,D=0,m=P,m=m*6371.007180918475,le[b>>3]=m,Ie=c,D|0}function Sc(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0;if(c=Ie,Ie=Ie+176|0,D=c,y=ou(y,_,D)|0,y|0)return D=y,P=+le[b>>3],P=P*6371.007180918475,P=P*1e3,le[b>>3]=P,Ie=c,D|0;if(le[b>>3]=0,y=g[D>>2]|0,(y|0)<=1)return D=0,P=0,P=P*6371.007180918475,P=P*1e3,le[b>>3]=P,Ie=c,D|0;_=y+-1|0,y=0,w=+le[D+8>>3],S=+le[D+16>>3],P=0;do y=y+1|0,h=w,w=+le[D+8+(y<<4)>>3],m=+Pt(+((w-h)*.5)),d=S,S=+le[D+8+(y<<4)+8>>3],d=+Pt(+((S-d)*.5)),d=m*m+d*(+Lt(+h)*+Lt(+w)*d),P=P+ +ln(+ +Ft(+d),+ +Ft(+(1-d)))*2;while((y|0)!=(_|0));return le[b>>3]=P,D=0,m=P,m=m*6371.007180918475,m=m*1e3,le[b>>3]=m,Ie=c,D|0}function Np(y){y=y|0;var _=0,b=0,w=0;return _=oo(1,12)|0,_||qt(22832,22787,49,22845),b=y+4|0,w=g[b>>2]|0,w|0?(w=w+8|0,g[w>>2]=_,g[b>>2]=_,_|0):(g[y>>2]|0&&qt(22862,22787,61,22885),w=y,g[w>>2]=_,g[b>>2]=_,_|0)}function Up(y,_){y=y|0,_=_|0;var b=0,w=0;return w=qn(24)|0,w||qt(22899,22787,78,22913),g[w>>2]=g[_>>2],g[w+4>>2]=g[_+4>>2],g[w+8>>2]=g[_+8>>2],g[w+12>>2]=g[_+12>>2],g[w+16>>2]=0,_=y+4|0,b=g[_>>2]|0,b|0?(g[b+16>>2]=w,g[_>>2]=w,w|0):(g[y>>2]|0&&qt(22928,22787,82,22913),g[y>>2]=w,g[_>>2]=w,w|0)}function Nl(y){y=y|0;var _=0,b=0,w=0,S=0;if(y)for(w=1;;){if(_=g[y>>2]|0,_|0)do{if(b=g[_>>2]|0,b|0)do S=b,b=g[b+16>>2]|0,zr(S);while((b|0)!=0);S=_,_=g[_+8>>2]|0,zr(S)}while((_|0)!=0);if(_=y,y=g[y+8>>2]|0,w||zr(_),y)w=0;else break}}function Ic(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0,Re=0,je=0,$e=0,nt=0,qe=0,Qe=0,pt=0,Dt=0,Tt=0;if(S=y+8|0,g[S>>2]|0)return Tt=1,Tt|0;if(w=g[y>>2]|0,!w)return Tt=0,Tt|0;_=w,b=0;do b=b+1|0,_=g[_+8>>2]|0;while((_|0)!=0);if(b>>>0<2)return Tt=0,Tt|0;pt=qn(b<<2)|0,pt||qt(22948,22787,317,22967),Qe=qn(b<<5)|0,Qe||qt(22989,22787,321,22967),g[y>>2]=0,Oe=y+4|0,g[Oe>>2]=0,g[S>>2]=0,b=0,qe=0,we=0,E=0;e:for(;;){if(m=g[w>>2]|0,m){P=0,D=m;do{if(d=+le[D+8>>3],_=D,D=g[D+16>>2]|0,h=(D|0)==0,S=h?m:D,c=+le[S+8>>3],+Mt(+(d-c))>3.141592653589793){Tt=14;break}P=P+(c-d)*(+le[_>>3]+ +le[S>>3])}while(!h);if((Tt|0)==14){Tt=0,P=0,_=m;do oe=+le[_+8>>3],nt=_+16|0,$e=g[nt>>2]|0,$e=($e|0)==0?m:$e,te=+le[$e+8>>3],P=P+(+le[_>>3]+ +le[$e>>3])*((te<0?te+6.283185307179586:te)-(oe<0?oe+6.283185307179586:oe)),_=g[((_|0)==0?w:nt)>>2]|0;while((_|0)!=0)}P>0?(g[pt+(qe<<2)>>2]=w,qe=qe+1|0,S=we,_=E):Tt=19}else Tt=19;if((Tt|0)==19){Tt=0;do if(b){if(_=b+8|0,g[_>>2]|0){Tt=21;break e}if(b=oo(1,12)|0,!b){Tt=23;break e}g[_>>2]=b,S=b+4|0,D=b,_=E}else if(E){S=Oe,D=E+8|0,_=w,b=y;break}else if(g[y>>2]|0){Tt=27;break e}else{S=Oe,D=y,_=w,b=y;break}while(!1);if(g[D>>2]=w,g[S>>2]=w,D=Qe+(we<<5)|0,h=g[w>>2]|0,h){for(m=Qe+(we<<5)+8|0,le[m>>3]=17976931348623157e292,E=Qe+(we<<5)+24|0,le[E>>3]=17976931348623157e292,le[D>>3]=-17976931348623157e292,M=Qe+(we<<5)+16|0,le[M>>3]=-17976931348623157e292,ee=17976931348623157e292,Y=-17976931348623157e292,S=0,R=h,d=17976931348623157e292,z=17976931348623157e292,q=-17976931348623157e292,c=-17976931348623157e292;P=+le[R>>3],oe=+le[R+8>>3],R=g[R+16>>2]|0,L=(R|0)==0,te=+le[(L?h:R)+8>>3],P<d&&(le[m>>3]=P,d=P),oe<z&&(le[E>>3]=oe,z=oe),P>q?le[D>>3]=P:P=q,oe>c&&(le[M>>3]=oe,c=oe),ee=oe>0&oe<ee?oe:ee,Y=oe<0&oe>Y?oe:Y,S=S|+Mt(+(oe-te))>3.141592653589793,!L;)q=P;S&&(le[M>>3]=Y,le[E>>3]=ee)}else g[D>>2]=0,g[D+4>>2]=0,g[D+8>>2]=0,g[D+12>>2]=0,g[D+16>>2]=0,g[D+20>>2]=0,g[D+24>>2]=0,g[D+28>>2]=0;S=we+1|0}if(nt=w+8|0,w=g[nt>>2]|0,g[nt>>2]=0,w)we=S,E=_;else{Tt=45;break}}if((Tt|0)==21)qt(22765,22787,35,22799);else if((Tt|0)==23)qt(22819,22787,37,22799);else if((Tt|0)==27)qt(22862,22787,61,22885);else if((Tt|0)==45){e:do if((qe|0)>0){for(nt=(S|0)==0,je=S<<2,$e=(y|0)==0,Re=0,_=0;;){if(ge=g[pt+(Re<<2)>>2]|0,nt)Tt=73;else{if(we=qn(je)|0,!we){Tt=50;break}if(Oe=qn(je)|0,!Oe){Tt=52;break}t:do if($e)b=0;else{for(S=0,b=0,D=y;w=Qe+(S<<5)|0,Ro(g[D>>2]|0,w,g[ge>>2]|0)|0?(g[we+(b<<2)>>2]=D,g[Oe+(b<<2)>>2]=w,L=b+1|0):L=b,D=g[D+8>>2]|0,D;)S=S+1|0,b=L;if((L|0)>0)if(w=g[we>>2]|0,(L|0)==1)b=w;else for(M=0,R=-1,b=w,E=w;;){for(h=g[E>>2]|0,w=0,D=0;S=g[g[we+(D<<2)>>2]>>2]|0,(S|0)==(h|0)?m=w:m=w+((Ro(S,g[Oe+(D<<2)>>2]|0,g[h>>2]|0)|0)&1)|0,D=D+1|0,(D|0)!=(L|0);)w=m;if(S=(m|0)>(R|0),b=S?E:b,w=M+1|0,(w|0)==(L|0))break t;M=w,R=S?m:R,E=g[we+(w<<2)>>2]|0}else b=0}while(!1);if(zr(we),zr(Oe),b){if(S=b+4|0,w=g[S>>2]|0,w)b=w+8|0;else if(g[b>>2]|0){Tt=70;break}g[b>>2]=ge,g[S>>2]=ge}else Tt=73}if((Tt|0)==73){if(Tt=0,_=g[ge>>2]|0,_|0)do Oe=_,_=g[_+16>>2]|0,zr(Oe);while((_|0)!=0);zr(ge),_=1}if(Re=Re+1|0,(Re|0)>=(qe|0)){Dt=_;break e}}(Tt|0)==50?qt(23004,22787,249,23023):(Tt|0)==52?qt(23042,22787,252,23023):(Tt|0)==70&&qt(22862,22787,61,22885)}else Dt=0;while(!1);return zr(pt),zr(Qe),Tt=Dt,Tt|0}return 0}function Ro(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0;if(!(Us(_,b)|0)||(_=yc(_)|0,w=+le[b>>3],S=+le[b+8>>3],S=_&S<0?S+6.283185307179586:S,y=g[y>>2]|0,!y))return y=0,y|0;if(_){_=0,h=S,b=y;e:for(;;){for(;D=+le[b>>3],S=+le[b+8>>3],b=b+16|0,m=g[b>>
42022]|0,m=(m|0)==0?y:m,P=+le[m>>3],c=+le[m+8>>3],D>P?(d=D,D=c):(d=P,P=D,D=S,S=c),w=w==P|w==d?w+2220446049250313e-31:w,!!(w<P|w>d);)if(b=g[b>>2]|0,!b){b=22;break e}if(c=D<0?D+6.283185307179586:D,D=S<0?S+6.283185307179586:S,h=c==h|D==h?h+-2220446049250313e-31:h,d=c+(D-c)*((w-P)/(d-P)),(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=S,b=y;e:for(;;){for(;D=+le[b>>3],S=+le[b+8>>3],b=b+16|0,m=g[b>>2]|0,m=(m|0)==0?y:m,P=+le[m>>3],c=+le[m+8>>3],D>P?(d=D,D=c):(d=P,P=D,D=S,S=c),w=w==P|w==d?w+2220446049250313e-31:w,!!(w<P|w>d);)if(b=g[b>>2]|0,!b){b=22;break e}if(h=D==h|S==h?h+-2220446049250313e-31:h,D+(S-D)*((w-P)/(d-P))>h&&(_=_^1),b=g[b>>2]|0,!b){b=22;break}}if((b|0)==22)return _|0}return 0}function kn(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0;if(Y=Ie,Ie=Ie+32|0,ee=Y+16|0,q=Y,P=Xt(y|0,_|0,52)|0,Be()|0,P=P&15,R=Xt(b|0,w|0,52)|0,Be()|0,(P|0)!=(R&15|0))return ee=12,Ie=Y,ee|0;if(h=Xt(y|0,_|0,45)|0,Be()|0,h=h&127,m=Xt(b|0,w|0,45)|0,Be()|0,m=m&127,h>>>0>121|m>>>0>121)return ee=5,Ie=Y,ee|0;if(R=(h|0)!=(m|0),R){if(c=mc(h,m)|0,(c|0)==7)return ee=1,Ie=Y,ee|0;d=mc(m,h)|0,(d|0)==7?qt(23066,23090,161,23100):(L=c,D=d)}else L=0,D=0;E=Br(h)|0,M=Br(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,c=(m|0)>0,M)if(c){h=0,d=b,c=w;do d=fu(d,c)|0,c=Be()|0,D=eo(D)|0,(D|0)==1&&(D=eo(1)|0),h=h+1|0;while((h|0)!=(m|0));m=D,h=d,d=c}else m=D,h=b,d=w;else if(c){h=0,d=b,c=w;do d=Za(d,c)|0,c=Be()|0,D=eo(D)|0,h=h+1|0;while((h|0)!=(m|0));m=D,h=d,d=c}else m=D,h=b,d=w;if(Vs(h,d,ee)|0,R||qt(23115,23090,191,23100),c=(E|0)!=0,D=(M|0)!=0,c&D&&qt(23142,23090,192,23100),c){if(D=ns(y,_)|0,(D|0)==7){P=5;break}if(Se[21872+(D*7|0)+L>>0]|0){P=1;break}d=g[21040+(D*28|0)+(L<<2)>>2]|0,h=d}else if(D){if(D=ns(h,d)|0,(D|0)==7){P=5;break}if(Se[21872+(D*7|0)+m>>0]|0){P=1;break}h=0,d=g[21040+(m*28|0)+(D<<2)>>2]|0}else h=0,d=0;if((h|d|0)<0)P=5;else{if((d|0)>0){c=ee+4|0,D=0;do su(c),D=D+1|0;while((D|0)!=(d|0))}if(g[q>>2]=0,g[q+4>>2]=0,g[q+8>>2]=0,hf(q,L),P|0)for(;zs(P)|0?Bl(q):Xo(q),(P|0)>1;)P=P+-1|0;if((h|0)>0){P=0;do su(q),P=P+1|0;while((P|0)!=(h|0))}z=ee+4|0,Vn(z,q,z),_i(z),z=51}}else if(Vs(b,w,ee)|0,(E|0)!=0&(M|0)!=0)if((m|0)!=(h|0)&&qt(23173,23090,261,23100),D=ns(y,_)|0,P=ns(b,w)|0,(D|0)==7|(P|0)==7)P=5;else if(Se[21872+(D*7|0)+P>>0]|0)P=1;else if(D=g[21040+(D*28|0)+(P<<2)>>2]|0,(D|0)>0){c=ee+4|0,P=0;do su(c),P=P+1|0;while((P|0)!=(D|0));z=51}else z=51;else z=51;while(!1);return(z|0)==51&&(P=ee+4|0,g[S>>2]=g[P>>2],g[S+4>>2]=g[P+4>>2],g[S+8>>2]=g[P+8>>2],P=0),ee=P,Ie=Y,ee|0}function Ul(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0;
4202if(z=Ie,Ie=Ie+48|0,h=z+36|0,D=z+24|0,c=z+12|0,d=z,S=Xt(y|0,_|0,52)|0,Be()|0,S=S&15,M=Xt(y|0,_|0,45)|0,Be()|0,M=M&127,M>>>0>121)return w=5,Ie=z,w|0;if(m=Br(M)|0,rr(S|0,0,52)|0,q=Be()|0|134225919,P=w,g[P>>2]=-1,g[P+4>>2]=q,!S)return S=vc(b)|0,(S|0)==7||(S=ya(M,S)|0,(S|0)==127)?(q=1,Ie=z,q|0):(R=rr(S|0,0,45)|0,L=Be()|0,M=w,L=g[M+4>>2]&-1040385|L,q=w,g[q>>2]=g[M>>2]|R,g[q+4>>2]=L,q=0,Ie=z,q|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=S;;){if(P=b,b=b+-1|0,g[D>>2]=g[h>>2],g[D+4>>2]=g[h+4>>2],g[D+8>>2]=g[h+8>>2],zs(P)|0){if(S=Op(h)|0,S|0){b=13;break}g[c>>2]=g[h>>2],g[c+4>>2]=g[h+4>>2],g[c+8>>2]=g[h+8>>2],Bl(c)}else{if(S=Dp(h)|0,S|0){b=13;break}g[c>>2]=g[h>>2],g[c+4>>2]=g[h+4>>2],g[c+8>>2]=g[h+8>>2],Xo(c)}if(hi(D,c,d),_i(d),S=w,Y=g[S>>2]|0,S=g[S+4>>2]|0,te=(15-P|0)*3|0,ee=rr(7,0,te|0)|0,S=S&~(Be()|0),te=rr(vc(d)|0,0,te|0)|0,S=Be()|0|S,q=w,g[q>>2]=te|Y&~ee,g[q+4>>2]=S,(P|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=vc(h)|0,S=ya(M,b)|0,(S|0)==127?d=0:d=Br(S)|0;t:do if(b){if(m){if(S=ns(y,_)|0,(S|0)==7){S=5;break e}if(P=g[21248+(S*28|0)+(b<<2)>>2]|0,(P|0)>0){S=b,b=0;do S=bo(S)|0,b=b+1|0;while((b|0)!=(P|0))}else S=b;if((S|0)==1){S=9;break e}b=ya(M,S)|0,(b|0)==127&&qt(23200,23090,411,23230),Br(b)|0?qt(23245,23090,412,23230):(L=b,R=P,E=S)}else L=S,R=0,E=b;if(c=g[4272+(M*28|0)+(E<<2)>>2]|0,(c|0)<=-1&&qt(23276,23090,419,23230),!d){if((R|0)<0){S=5;break e}if(R|0){P=w,S=0,b=g[P>>2]|0,P=g[P+4>>2]|0;do b=xo(b,P)|0,P=Be()|0,te=w,g[te>>2]=b,g[te+4>>2]=P,S=S+1|0;while((S|0)<(R|0))}if((c|0)<=0){S=L,b=58;break}for(P=w,S=0,b=g[P>>2]|0,P=g[P+4>>2]|0;;)if(b=xo(b,P)|0,P=Be()|0,te=w,g[te>>2]=b,g[te+4>>2]=P,S=S+1|0,(S|0)==(c|0)){S=L,b=58;break t}}if(D=mc(L,M)|0,(D|0)==7&&qt(23066,23090,428,23230),S=w,b=g[S>>2]|0,S=g[S+4>>2]|0,(c|0)>0){P=0;do b=xo(b,S)|0,S=Be()|0,te=w,g[te>>2]=b,g[te+4>>2]=S,P=P+1|0;while((P|0)!=(c|0))}if(S=ns(b,S)|0,(S|0)==7&&qt(23313,23090,440,23230),b=fi(L)|0,b=g[(b?21664:21456)+(D*28|0)+(S<<2)>>2]|0,(b|0)<0&&qt(23313,23090,454,23230),!b)S=L,b=58;else{D=w,S=0,P=g[D>>2]|0,D=g[D+4>>2]|0;do P=Sa(P,D)|0,D=Be()|0,te=w,g[te>>2]=P,g[te+4>>2]=D,S=S+1|0;while((S|0)<(b|0));S=L,b=58}}else if((m|0)!=0&(d|0)!=0){if(b=ns(y,_)|0,P=w,P=ns(g[P>>2]|0,g[P+4>>2]|0)|0,(b|0)==7|(P|0)==7){S=5;break e}if(P=g[21248+(b*28|0)+(P<<2)>>2]|0,(P|0)<0){S=5;break e}if(!P)b=59;else{c=w,b=0,D=g[c>>2]|0,c=g[c+4>>2]|0;do D=xo(D,c)|0,c=Be()|0,te=w,g[te>>2]=D,g[te+4>>2]=c,b=b+1|0;while((b|0)<(P|0));b=58}}else b=58;while(!1);if((b|0)==58&&d&&(b=59),(b|0)==59&&(te=w,(ns(g[te>>2]|0,g[te+4>>2]|0)|0)==1)){S=9;break}te=w,ee=g[te>>2]|0,te=g[te+4>>2]&-1040385,Y=rr(S|0,0,45)|0,te=te|(Be()|0),S=w,g[S>>2]=ee|Y,g[S+4>>2]=te,S=0}else S=1;while(!1);return te=S,Ie=z,te|0}function Oh(y,_,b,w,S,P){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0,P=P|0;var D=0,c=0;return c=Ie,Ie=Ie+16|0,D=c,S?y=15:(y=kn(y,_,b,w,D)|0,y||(xa(D,P),y=0)),Ie=c,y|0}function xi(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0;return D=Ie,Ie=Ie+16|0,P=D,w?b=15:(b=wa(b,P)|0,b||(b=Ul(y,_,P,S)|0)),Ie=D,b|0}function or(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0;return d=Ie,Ie=Ie+32|0,D=d+12|0,c=d,P=kn(y,_,y,_,D)|0,P|0?(c=P,Ie=d,c|0):(y=kn(y,_,b,w,c)|0,y|0?(c=y,Ie=d,c|0):(D=bc(D,c)|0,c=S,g[c>>2]=D,g[c+4>>2]=((D|0)<0)<<31>>31,c=0,Ie=d,c|0))}function Is(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0;return d=Ie,Ie=Ie+32|0,D=d+12|0,c=d,P=kn(y,_,y,_,D)|0,!P&&(P=kn(y,_,b,w,c)|0,!P)?(w=bc(D,c)|0,w=An(w|0,((w|0)<0)<<31>>31|0,1,0)|0,D=Be()|0,c=S,g[c>>2]=w,g[c+4>>2]=D,c=0,Ie=d,c|0):(c=P,Ie=d,c|0)}function mu(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0,Re=0;if(ge=Ie,Ie=Ie+48|0,D=ge+24|0,c=ge+12|0,Oe=ge,P=kn(y,_,y,_,D)|0,!P&&(P=kn(y,_,b,w,c)|0,!P)){oe=bc(D,c)|0,we=((oe|0)<0)<<31>>31,g[D>>2]=0,g[D+4>>2]=0,g[D+8>>2]=0,g[c>>2]=0,g[c+4>>2]=0,g[c+8>>2]=0,kn(y,_,y,_,D)|0&&qt(23313,23090,691,23299),kn(y,_,b,w,c)|0&&qt(23313,23090,696,23299),Ta(D),Ta(c),oe?(E=g[D>>2]|0,L=+(oe|0),ee=D+4|0,M=g[ee>>2]|0,Y=D+8|0,R=g[Y>>2]|0,te=D,w=E,P=M,b=R,z=+((g[c>>2]|0)-E|0)/L,q=+((g[c+4>>2]|0)-M|0)/L,L=+((g[c+8>>2]|0)-R|0)/L):(P=D+4|0,b=D+8|0,ee=P,Y=b,te=D,w=g[D>>2]|0,P=g[P>>2]|0,b=g[b>>2]|0,z=0,q=0,L=0),g[Oe>>2]=w,R=Oe+4|0,g[R>>2]=P,M=Oe+8|0,g[M>>2]=b;e:do if((oe|0)<0)P=0;else for(m=0,E=0,P=w;;){h=+(E>>>0)+4294967296*+(m|0),Re=z*h+ +(P|0),d=q*h+ +(g[ee>>2]|0),h=L*h+ +(g[Y>>2]|0),b=~~+ra(+Re),D=~~+ra(+d),P=~~+ra(+h),Re=+Mt(+(+(b|0)-Re)),d=+Mt(+(+(D|0)-d)),h=+Mt(+(+(P|0)-h));do if(Re>d&Re>h)b=0-(D+P)|0,w=D;else if(c=0-b|0,d>h){w=c-P|0;break}else{w=D,P=c-D|0;break}while(!1);if(g[Oe>>2]=b,g[R>>2]=w,g[M>>2]=P,Xa(Oe),P=Ul(y,_,Oe,S+(E<<3)|0)|0,P|0)break e;if(!((m|0)<(we|0)|(m|0)==(we|0)&E>>>0<oe>>>0)){P=0;break e}P=An(E|0,m|0,1,0)|0,c=Be()|0,m=c,E=P,P=g[te>>2]|0}while(!1);return Oe=P,Ie=ge,Oe|0}return Oe=P,Ie=ge,Oe|0}function js(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0;if((b|0)==0&(w|0)==0)return S=0,P=1,pr(S|0),P|0;P=y,S=_,y=1,_=0;do D=(b&1|0)==0&!0,y=di((D?1:P)|0,(D?0:S)|0,y|0,_|0)|0,_=Be()|0,b=Eo(b|0,w|0,1)|0,w=Be()|0,P=di(P|0,S|0,P|0,S|0)|0,S=Be()|0;while(!((b|0)==0&(w|0)==0));return pr(_|0),y|0}function ro(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0;if(!(Us(_,b)|0)||(_=yc(_)|0,w=+le[b>>3],S=+le[b+8>>3],S=_&S<0?S+6.283185307179586:S,M=g[y>>2]|0,(M|0)<=0))return M=0,M|0;if(E=g[y+4>>2]|0,_){_=0,m=S,b=-1,y=0;e:for(;;){for(h=y;D=+le[E+(h<<4)>>3],S=+le[E+(h<<4)+8>>3],y=(b+2|0)%(M|0)|0,P=+le[E+(y<<4)>>3],c=+le[E+(y<<4)+8>>3],D>P?(d=D,D=c):(d=P,P=D,D=S,S=c),w=w==P|w==d?w+2220446049250313e-31:w,!!(w<P|w>d);)if(b=h+1|0,(b|0)>=(M|0)){b=22;break e}else y=h,h=b,b=y;if(c=D<0?D+6.283185307179586:D,D=S<0?S+6.283185307179586:S,m=c==m|D==m?m+-2220446049250313e-31:m,d=c+(D-c)*((w-P)/(d-P)),(d<0?d+6.283185307179586:d)>m&&(_=_^1),y=h+1|0,(y|0)>=(M|0)){b=22;break}else b=h}if((b|0)==22)return _|0}else{_=0,m=S,b=-1,y=0;e:for(;;){for(h=y;D=+le[E+(h<<4)>>3],S=+le[E+(h<<4)+8>>3],y=(b+2|0)%(M|0)|0,P=+le[E+(y<<4)>>3],c=+le[E+(y<<4)+8>>3],D>P?(d=D,D=c):(d=P,P=D,D=S,S=c),w=w==P|w==d?w+2220446049250313e-31:w,!!(w<P|w>d);)if(b=h+1|0,(b|0)>=(M|0)){b=22;break e}else y=h,h=b,b=y;if(m=D==m|S==m?m+-2220446049250313e-31:m,D+(S-D)*((w-P)/(d-P))>m&&(_=_^1),y=h+1|0,(y|0)>=(M|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,w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0;
4202if(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,le[z>>3]=17976931348623157e292,q=_+24|0,le[q>>3]=17976931348623157e292,le[_>>3]=-17976931348623157e292,ee=_+16|0,le[ee>>3]=-17976931348623157e292,!((L|0)<=0)){for(M=g[y+4>>2]|0,h=17976931348623157e292,m=-17976931348623157e292,E=0,y=-1,P=17976931348623157e292,D=17976931348623157e292,d=-17976931348623157e292,w=-17976931348623157e292,R=0;b=+le[M+(R<<4)>>3],c=+le[M+(R<<4)+8>>3],y=y+2|0,S=+le[M+(((y|0)==(L|0)?0:y)<<4)+8>>3],b<P&&(le[z>>3]=b,P=b),c<D&&(le[q>>3]=c,D=c),b>d?le[_>>3]=b:b=d,c>w&&(le[ee>>3]=c,w=c),h=c>0&c<h?c:h,m=c<0&c>m?c:m,E=E|+Mt(+(c-S))>3.141592653589793,y=R+1|0,(y|0)!=(L|0);)Y=R,d=b,R=y,y=Y;E&&(le[ee>>3]=m,le[q>>3]=h)}}function _f(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0,Oe=0,ge=0;if(L=g[y>>2]|0,L){if(z=_+8|0,le[z>>3]=17976931348623157e292,q=_+24|0,le[q>>3]=17976931348623157e292,le[_>>3]=-17976931348623157e292,ee=_+16|0,le[ee>>3]=-17976931348623157e292,(L|0)>0){for(S=g[y+4>>2]|0,M=17976931348623157e292,R=-17976931348623157e292,w=0,b=-1,d=17976931348623157e292,h=17976931348623157e292,E=-17976931348623157e292,D=-17976931348623157e292,Y=0;P=+le[S+(Y<<4)>>3],m=+le[S+(Y<<4)+8>>3],Oe=b+2|0,c=+le[S+(((Oe|0)==(L|0)?0:Oe)<<4)+8>>3],P<d&&(le[z>>3]=P,d=P),m<h&&(le[q>>3]=m,h=m),P>E?le[_>>3]=P:P=E,m>D&&(le[ee>>3]=m,D=m),M=m>0&m<M?m:M,R=m<0&m>R?m:R,w=w|+Mt(+(m-c))>3.141592653589793,b=Y+1|0,(b|0)!=(L|0);)Oe=Y,E=P,Y=b,b=Oe;w&&(le[ee>>3]=R,le[q>>3]=M)}}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(Oe=y+8|0,b=g[Oe>>2]|0,!((b|0)<=0)){we=y+12|0,oe=0;do if(S=g[we>>2]|0,w=oe,oe=oe+1|0,q=_+(oe<<5)|0,ee=g[S+(w<<3)>>2]|0,ee){if(Y=_+(oe<<5)+8|0,le[Y>>3]=17976931348623157e292,y=_+(oe<<5)+24|0,le[y>>3]=17976931348623157e292,le[q>>3]=-17976931348623157e292,te=_+(oe<<5)+16|0,le[te>>3]=-17976931348623157e292,(ee|0)>0){for(L=g[S+(w<<3)+4>>2]|0,M=17976931348623157e292,R=-17976931348623157e292,S=0,w=-1,z=0,d=17976931348623157e292,h=17976931348623157e292,m=-17976931348623157e292,D=-17976931348623157e292;P=+le[L+(z<<4)>>3],E=+le[L+(z<<4)+8>>3],w=w+2|0,c=+le[L+(((w|0)==(ee|0)?0:w)<<4)+8>>3],P<d&&(le[Y>>3]=P,d=P),E<h&&(le[y>>3]=E,h=E),P>m?le[q>>3]=P:P=m,E>D&&(le[te>>3]=E,D=E),M=E>0&E<M?E:M,R=E<0&E>R?E:R,S=S|+Mt(+(E-c))>3.141592653589793,w=z+1|0,(w|0)!=(ee|0);)ge=z,z=w,m=P,w=ge;S&&(le[te>>3]=R,le[y>>3]=M)}}else g[q>>2]=0,g[q+4>>2]=0,g[q+8>>2]=0,g[q+12>>2]=0,g[q+16>>2]=0,g[q+20>>2]=0,g[q+24>>2]=0,g[q+28>>2]=0,b=g[Oe>>2]|0;while((oe|0)<(b|0))}}function Zt(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;if(!(ro(y,_,b)|0))return S=0,S|0;if(S=y+8|0,(g[S>>2]|0)<=0)return S=1,S|0;for(w=y+12|0,y=0;;){if(P=y,y=y+1|0,ro((g[w>>2]|0)+(P<<3)|0,_+(y<<5)|0,b)|0){y=0,w=6;break}if((y|0)>=(g[S>>2]|0)){y=1,w=6;break}}return(w|0)==6?y|0:0}function yf(){return 8}function _u(){return 16}function vf(){return 168}function no(){return 8}function Bs(){return 16}function yu(){return 12}function vu(){return 8}function Ps(y){return y=y|0,+(+((g[y>>2]|0)>>>0)+4294967296*+(g[y+4>>2]|0))}function ea(y){y=y|0;var _=0,b=0;return b=+le[y>>3],_=+le[y+8>>3],+ +Ft(+(b*b+_*_))}function bf(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0;h=+le[y>>3],d=+le[_>>3]-h,c=+le[y+8>>3],D=+le[_+8>>3]-c,E=+le[b>>3],P=+le[w>>3]-E,M=+le[b+8>>3],m=+le[w+8>>3]-M,P=(P*(c-M)-(h-E)*m)/(d*m-D*P),le[S>>3]=h+d*P,le[S+8>>3]=c+D*P}function zl(y,_){return y=y|0,_=_|0,+Mt(+(+le[y>>3]-+le[_>>3]))<11920928955078125e-23?(_=+Mt(+(+le[y+8>>3]-+le[_+8>>3]))<11920928955078125e-23,_|0):(_=0,_|0)}function wi(y,_){y=y|0,_=_|0;var b=0,w=0,S=0;return S=+le[y>>3]-+le[_>>3],w=+le[y+8>>3]-+le[_+8>>3],b=+le[y+16>>3]-+le[_+16>>3],+(S*S+w*w+b*b)}function xf(y,_){y=y|0,_=_|0;var b=0,w=0,S=0;b=+le[y>>3],w=+Lt(+b),b=+Pt(+b),le[_+16>>3]=b,b=+le[y+8>>3],S=w*+Lt(+b),le[_>>3]=S,b=w*+Pt(+b),le[_+8>>3]=b}function wo(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;if(P=Ie,Ie=Ie+16|0,S=P,w=On(y,_)|0,(b+-1|0)>>>0>5||(w=(w|0)!=0,(b|0)==1&w))return S=-1,Ie=P,S|0;do if(is(y,_,S)|0)w=-1;else if(w){w=((g[21936+(b<<2)>>2]|0)+5-(g[S>>2]|0)|0)%5|0;break}else{w=((g[21968+(b<<2)>>2]|0)+6-(g[S>>2]|0)|0)%6|0;break}while(!1);return S=w,Ie=P,S|0}function is(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0,h=0;if(h=Ie,Ie=Ie+32|0,D=h+16|0,c=h,w=Qa(y,_,D)|0,w|0)return b=w,Ie=h,b|0;P=Af(y,_)|0,d=ns(y,_)|0,Qs(P,c),w=xh(P,g[D>>2]|0)|0;e:do if(Br(P)|0){do switch(P|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:{w=1;break e}}while(!1);if(S=g[22e3+(y*24|0)+8>>2]|0,_=g[22e3+(y*24|0)+16>>2]|0,y=g[D>
4202>2]|0,(y|0)!=(g[c>>2]|0)&&(c=fi(P)|0,y=g[D>>2]|0,c|(y|0)==(_|0)&&(w=(w+1|0)%6|0)),(d|0)==3&(y|0)==(_|0)){w=(w+5|0)%6|0,S=22;break}(d|0)==5&(y|0)==(S|0)&&(w=(w+1|0)%6|0),S=22}else S=22;while(!1);return(S|0)==22&&(g[b>>2]=w,w=0),b=w,Ie=h,b|0}function jr(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0;if(te=Ie,Ie=Ie+32|0,Y=te+24|0,q=te+20|0,L=te+8|0,R=te+16|0,M=te,d=(On(y,_)|0)==0,d=d?6:5,m=Xt(y|0,_|0,52)|0,Be()|0,m=m&15,d>>>0<=b>>>0)return w=2,Ie=te,w|0;E=(m|0)==0,!E&&(z=rr(7,0,(m^15)*3|0)|0,(z&y|0)==0&((Be()|0)&_|0)==0)?S=b:P=4;e:do if((P|0)==4){if(S=(On(y,_)|0)!=0,((S?4:5)|0)<(b|0)||is(y,_,Y)|0||(P=(g[Y>>2]|0)+b|0,S?S=22288+(((P|0)%5|0)<<2)|0:S=22320+(((P|0)%6|0)<<2)|0,z=g[S>>2]|0,(z|0)==7))return w=1,Ie=te,w|0;g[q>>2]=0,S=In(y,_,z,q,L)|0;do if(!S){if(c=L,h=g[c>>2]|0,c=g[c+4>>2]|0,D=c>>>0<_>>>0|(c|0)==(_|0)&h>>>0<y>>>0,P=D?h:y,D=D?c:_,!E&&(E=rr(7,0,(m^15)*3|0)|0,(h&E|0)==0&(c&(Be()|0)|0)==0))S=b;else{if(c=(b+-1+d|0)%(d|0)|0,S=On(y,_)|0,(c|0)<0&&qt(23313,23315,245,23324),d=(S|0)!=0,((d?4:5)|0)<(c|0)&&qt(23313,23315,245,23324),is(y,_,Y)|0&&qt(23313,23315,245,23324),S=(g[Y>>2]|0)+c|0,d?S=22288+(((S|0)%5|0)<<2)|0:S=22320+(((S|0)%6|0)<<2)|0,c=g[S>>2]|0,(c|0)==7&&qt(23313,23315,245,23324),g[R>>2]=0,S=In(y,_,c,R,M)|0,S|0)break;h=M,d=g[h>>2]|0,h=g[h+4>>2]|0;do if(h>>>0<D>>>0|(h|0)==(D|0)&d>>>0<P>>>0){if(On(d,h)|0?P=gc(d,h,y,_)|0:P=g[22384+((((g[R>>2]|0)+(g[22352+(c<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,S=On(d,h)|0,(P+-1|0)>>>0>5){S=-1,P=d,D=h;break}if(S=(S|0)!=0,(P|0)==1&S){S=-1,P=d,D=h;break}do if(is(d,h,Y)|0)S=-1;else if(S){S=((g[21936+(P<<2)>>2]|0)+5-(g[Y>>2]|0)|0)%5|0;break}else{S=((g[21968+(P<<2)>>2]|0)+6-(g[Y>>2]|0)|0)%6|0;break}while(!1);P=d,D=h}else S=b;while(!1);c=L,h=g[c>>2]|0,c=g[c+4>>2]|0}if((P|0)==(h|0)&(D|0)==(c|0)){if(d=(On(h,c)|0)!=0,d?y=gc(h,c,y,_)|0:y=g[22384+((((g[q>>2]|0)+(g[22352+(z<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,S=On(h,c)|0,(y+-1|0)>>>0<=5&&(ee=(S|0)!=0,!((y|0)==1&ee)))do if(is(h,c,Y)|0)S=-1;else if(ee){S=((g[21936+(y<<2)>>2]|0)+5-(g[Y>>2]|0)|0)%5|0;break}else{S=((g[21968+(y<<2)>>2]|0)+6-(g[Y>>2]|0)|0)%6|0;break}while(!1);else S=-1;S=S+1|0,S=(S|0)==6|d&(S|0)==5?0:S}_=D,y=P;break e}while(!1);return w=S,Ie=te,w|0}while(!1);return ee=rr(S|0,0,56)|0,Y=Be()|0|_&-2130706433|536870912,g[w>>2]=ee|y,g[w+4>>2]=Y,w=0,Ie=te,w|0}function Oo(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;return P=(On(y,_)|0)==0,w=jr(y,_,0,b)|0,S=(w|0)==0,P?!S||(w=jr(y,_,1,b+8|0)|0,w|0)||(w=jr(y,_,2,b+16|0)|0,w|0)||(w=jr(y,_,3,b+24|0)|0,w|0)||(w=jr(y,_,4,b+32|0)|0,w)?(P=w,P|0):jr(y,_,5,b+40|0)|0:!S||(w=jr(y,_,1,b+8|0)|0,w|0)||(w=jr(y,_,2,b+16|0)|0,w|0)||(w=jr(y,_,3,b+24|0)|0,w|0)||(w=jr(y,_,4,b+32|0)|0,w|0)?(P=w,P|0):(P=b+40|0,g[P>>2]=0,g[P+4>>2]=0,P=0,P|0)}function io(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0,c=0,d=0;return d=Ie,Ie=Ie+192|0,S=d,P=d+168|0,D=Xt(y|0,_|0,56)|0,Be()|0,D=D&7,c=_&-2130706433|134217728,w=Qa(y,c,P)|0,w|0?(c=w,Ie=d,c|0):(_=Xt(y|0,_|0,52)|0,Be()|0,_=_&15,On(y,c)|0?qo(P,_,D,1,S):lu(P,_,D,1,S),c=S+8|0,g[b>>2]=g[c>>2],g[b+4>>2]=g[c+4>>2],g[b+8>>2]=g[c+8>>2],g[b+12>>2]=g[c+12>>2],c=0,Ie=d,c|0)}function qi(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0;return S=Ie,Ie=Ie+16|0,b=S,!(!0&(_&2013265920|0)==536870912)||(w=_&-2130706433|134217728,!(Ko(y,w)|0))?(w=0,Ie=S,w|0):(P=Xt(y|0,_|0,56)|0,Be()|0,P=(jr(y,w,P&7,b)|0)==0,w=b,w=P&((g[w>>2]|0)==(y|0)?(g[w+4>>2]|0)==(_|0):0)&1,Ie=S,w|0)}function Ia(y,_,b){y=y|0,_=_|0,b=b|0;var w=0;(_|0)>0?(w=oo(_,4)|0,g[y>>2]=w,w||qt(23337,23360,40,23374)):g[y>>2]=0,g[y+4>>2]=_,g[y+8>>2]=0,g[y+12>>2]=b}function ta(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0;S=y+4|0,P=y+12|0,D=y+8|0;e:for(;;){for(b=g[S>>2]|0,_=0;;){if((_|0)>=(b|0))break e;if(w=g[y>>2]|0,c=g[w+(_<<2)>>2]|0,!c)_=_+1|0;else break}_=w+(~~(+Mt(+(+ht(10,+ +(15-(g[P>>2]|0)|0))*(+le[c>>3]+ +le[c+8>>3])))%+(b|0))>>>0<<2)|0,b=g[_>>2]|0;t:do if(b|0){if(w=c+32|0,(b|0)==(c|0))g[_>>2]=g[w>>2];else{if(b=b+32|0,_=g[b>>2]|0,!_)break;for(;(_|0)!=(c|0);)if(b=_+32|0,_=g[b>>2]|0,!_)break t;g[b>>2]=g[w>>2]}zr(c),g[D>>2]=(g[D>>2]|0)+-1}while(!1)}zr(g[y>>2]|0)}function so(y){y=y|0;var _=0,b=0,w=0;for(w=g[y+4>>2]|0,b=0;;){if((b|0)>=(w|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,w=0,S=0,P=0;if(b=~~(+Mt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+le[_>>3]+ +le[_+8>>3])))%+(g[y+4>>2]|0))>>>0,b=(g[y>>2]|0)+(b<<2)|0,w=g[b>>2]|0,!w)return P=1,P|0;P=_+32|0;do if((w|0)!=(_|0)){if(b=g[w+32>>2]|0,!b)return P=1,P|0;for(S=b;;){if((S|0)==(_|0)){S=8;break}if(b=g[S+32>>2]|0,b)w=S,S=b;else{b=1,S=10;break}}if((S|0)==8){g[w+32>>2]=g[P>>2];break}else if((S|0)==10)return b|0}else g[b>>2]=g[P>>2];while(!1);return zr(_),P=y+8|0,g[P>>2]=(g[P>>2]|0)+-1,P=0,P|0}function Bc(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0;P=qn(40)|0,P||qt(23390,23360,98,23403),g[P>>2]=g[_>>2],g[P+4>>2]=g[_+4>>2],g[P+8>>2]=g[_+8>>2],g[P+12>>2]=g[_+12>>2],S=P+16|0,g[S>>2]=g[b>>2],g[S+4>>2]=g[b+4>>2],g[S+8>>2]=g[b+8>>2],g[S+12>>2]=g[b+12>>2],g[P+32>>2]=0,S=~~(+Mt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+le[_>>3]+ +le[_+8>>3])))%+(g[y+4>>2]|0))>>>0,S=(g[y>>2]|0)+(S<<2)|0,w=g[S>>2]|0;do if(!w)g[S>>2]=P;else{for(;!(tl(w,_)|0&&tl(w+16|0,b)|0);)if(S=g[w+32>>2]|0,w=(S|0)==0?w:S,!(g[w+32>>2]|0)){D=10;break}if((D|0)==10){g[w+32>>2]=P;break}return zr(P),D=w,D|0}while(!1);return D=y+8|0,g[D>>2]=(g[D>>2]|0)+1,D=P,D|0}
4202function wr(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0;if(S=~~(+Mt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+le[_>>3]+ +le[_+8>>3])))%+(g[y+4>>2]|0))>>>0,S=g[(g[y>>2]|0)+(S<<2)>>2]|0,!S)return b=0,b|0;if(!b){for(y=S;;){if(tl(y,_)|0){w=10;break}if(y=g[y+32>>2]|0,!y){y=0,w=10;break}}if((w|0)==10)return y|0}for(y=S;;){if(tl(y,_)|0&&tl(y+16|0,b)|0){w=10;break}if(y=g[y+32>>2]|0,!y){y=0,w=10;break}}return(w|0)==10?y|0:0}function ur(y,_){y=y|0,_=_|0;var b=0;if(b=~~(+Mt(+(+ht(10,+ +(15-(g[y+12>>2]|0)|0))*(+le[_>>3]+ +le[_+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(tl(y,_)|0){_=5;break}if(y=g[y+32>>2]|0,!y){y=0,_=5;break}}return(_|0)==5?y|0:0}function bu(){return 23424}function fs(y){return y=+y,+ +ia(+y)}function Ji(y){return y=+y,~~+fs(y)|0}function qn(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0,z=0,q=0,ee=0,Y=0,te=0,oe=0,we=0;we=Ie,Ie=Ie+16|0,M=we;do if(y>>>0<245){if(h=y>>>0<11?16:y+11&-8,y=h>>>3,E=g[5857]|0,b=E>>>y,b&3|0)return _=(b&1^1)+y|0,y=23468+(_<<1<<2)|0,b=y+8|0,w=g[b>>2]|0,S=w+8|0,P=g[S>>2]|0,(P|0)==(y|0)?g[5857]=E&~(1<<_):(g[P+12>>2]=y,g[b>>2]=P),oe=_<<3,g[w+4>>2]=oe|3,oe=w+oe+4|0,g[oe>>2]=g[oe>>2]|1,oe=S,Ie=we,oe|0;if(m=g[5859]|0,h>>>0>m>>>0){if(b|0)return _=2<<y,_=b<<y&(_|0-_),_=(_&0-_)+-1|0,c=_>>>12&16,_=_>>>c,b=_>>>5&8,_=_>>>b,P=_>>>2&4,_=_>>>P,y=_>>>1&2,_=_>>>y,w=_>>>1&1,w=(b|c|P|y|w)+(_>>>w)|0,_=23468+(w<<1<<2)|0,y=_+8|0,P=g[y>>2]|0,c=P+8|0,b=g[c>>2]|0,(b|0)==(_|0)?(y=E&~(1<<w),g[5857]=y):(g[b+12>>2]=_,g[y>>2]=b,y=E),oe=w<<3,D=oe-h|0,g[P+4>>2]=h|3,S=P+h|0,g[S+4>>2]=D|1,g[P+oe>>2]=D,m|0&&(w=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]=w,g[_+12>>2]=w,g[w+8>>2]=_,g[w+12>>2]=b),g[5859]=D,g[5862]=S,oe=c,Ie=we,oe|0;if(P=g[5858]|0,P){for(b=(P&0-P)+-1|0,S=b>>>12&16,b=b>>>S,w=b>>>5&8,b=b>>>w,D=b>>>2&4,b=b>>>D,c=b>>>1&2,b=b>>>c,d=b>>>1&1,d=g[23732+((w|S|D|c|d)+(b>>>d)<<2)>>2]|0,b=d,c=d,d=(g[d+4>>2]&-8)-h|0;y=g[b+16>>2]|0,!(!y&&(y=g[b+20>>2]|0,!y));)D=(g[y+4>>2]&-8)-h|0,S=D>>>0<d>>>0,b=y,c=S?y:c,d=S?D:d;if(D=c+h|0,D>>>0>c>>>0){S=g[c+24>>2]|0,_=g[c+12>>2]|0;do if((_|0)==(c|0)){if(y=c+20|0,_=g[y>>2]|0,!_&&(y=c+16|0,_=g[y>>2]|0,!_)){b=0;break}for(;;)if(w=_+20|0,b=g[w>>2]|0,b)_=b,y=w;else if(w=_+16|0,b=g[w>>2]|0,b)_=b,y=w;else break;g[y>>2]=0,b=_}else b=g[c+8>>2]|0,g[b+12>>2]=_,g[_+8>>2]=b,b=_;while(!1);do if(S|0){if(_=g[c+28>>2]|0,y=23732+(_<<2)|0,(c|0)==(g[y>>2]|0)){if(g[y>>2]=b,!b){g[5858]=P&~(1<<_);break}}else if(oe=S+16|0,g[((g[oe>>2]|0)==(c|0)?oe:S+20|0)>>2]=b,!b)break;g[b+24>>2]=S,_=g[c+16>>2]|0,_|0&&(g[b+16>>2]=_,g[_+24>>2]=b),_=g[c+20>>2]|0,_|0&&(g[b+20>>2]=_,g[_+24>>2]=b)}while(!1);return d>>>0<16?(oe=d+h|0,g[c+4>>2]=oe|3,oe=c+oe+4|0,g[oe>>2]=g[oe>>2]|1):(g[c+4>>2]=h|3,g[D+4>>2]=d|1,g[D+d>>2]=d,m|0&&(w=g[5862]|0,_=m>>>3,b=23468+(_<<1<<2)|0,_=1<<_,_&E?(y=b+8|0,_=g[y>>2]|0):(g[5857]=_|E,_=b,y=b+8|0),g[y>>2]=w,g[_+12>>2]=w,g[w+8>>2]=_,g[w+12>>2]=b),g[5859]=d,g[5862]=D),oe=c+8|0,Ie=we,oe|0}else E=h}else E=h}else E=h}else if(y>>>0<=4294967231)if(y=y+11|0,h=y&-8,w=g[5858]|0,w){S=0-h|0,y=y>>>8,y?h>>>0>16777215?d=31:(E=(y+1048320|0)>>>16&8,z=y<<E,c=(z+520192|0)>>>16&4,z=z<<c,d=(z+245760|0)>>>16&2,d=14-(c|E|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,c=h<<((d|0)==31?0:25-(d>>>1)|0),P=0;;){if(D=(g[b+4>>2]&-8)-h|0,D>>>0<S>>>0)if(D)y=b,S=D;else{y=b,S=0,z=65;break e}if(z=g[b+20>>2]|0,b=g[b+16+(c>>>31<<2)>>2]|0,P=(z|0)==0|(z|0)==(b|0)?P:z,b)c=c<<1;else{b=P,z=61;break}}while(!1);if((z|0)==61){if((b|0)==0&(y|0)==0){if(y=2<<d,y=(y|0-y)&w,!y){E=h;break}E=(y&0-y)+-1|0,D=E>>>12&16,E=E>>>D,P=E>>>5&8,E=E>>>P,c=E>>>2&4,E=E>>>c,d=E>>>1&2,E=E>>>d,b=E>>>1&1,y=0,b=g[23732+((P|D|c|d|b)+(E>>>b)<<2)>>2]|0}b?z=65:(c=y,D=S)}if((z|0)==65)for(P=b;;)if(E=(g[P+4>>2]&-8)-h|0,b=E>>>0<S>>>0,S=b?E:S,y=b?P:y,b=g[P+16>>2]|0,b||(b=g[P+20>>2]|0),b)P=b;else{c=y,D=S;break}if((c|0)!=0&&D>>>0<((g[5859]|0)-h|0)>>>0&&(m=c+h|0,m>>>0>c>>>0)){P=g[c+24>>2]|0,_=g[c+12>>2]|0;do if((_|0)==(c|0)){if(y=c+20|0,_=g[y>>2]|0,!_&&(y=c+16|0,_=g[y>>2]|0,!_)){_=0;break}for(;;)if(S=_+20|0,b=g[S>>2]|0,b)_=b,y=S;else if(S=_+16|0,b=g[S>>2]|0,b)_=b,y=S;else break;g[y>>2]=0}else oe=g[c+8>>2]|0,g[oe+12>>2]=_,g[_+8>>2]=oe;while(!1);do if(P){if(y=g[c+28>>2]|0,b=23732+(y<<2)|0,(c|0)==(g[b>>2]|0)){if(g[b>>2]=_,!_){w=w&~(1<<y),g[5858]=w;break}}else if(oe=P+16|0,g[((g[oe>>2]|0)==(c|0)?oe:P+20|0)>>2]=_,!_)break;g[_+24>>2]=P,y=g[c+16>>2]|0,y|0&&(g[_+16>>2]=y,g[y+24>>2]=_),y=g[c+20>>2]|0,y&&(g[_+20>>2]=y,g[y+24>>2]=_)}while(!1);e:do if(D>>>0<16)oe=D+h|0,g[c+4>>2]=oe|3,oe=c+oe+4|0,g[oe>>2]=g[oe>>2]|1;else{if(g[c+4>>2]=h|3,g[m+4>>2]=D|1,g[m+D>>2]=D,_=D>>>3,D>>>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(_=D>>>8,_?D>>>0>16777215?b=31:(te=(_+1048320|0)>>>16&8,oe=_<<te,Y=(oe+520192|0)>>>16&4,oe=oe<<Y,b=(oe+245760|0)>>>16&2,b=14-(Y|te|b)+(oe<<b>>>15)|0,b=D>>>(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,!(w&y)){g[5858]=w|y,g[_>>2]=m,g[m+24>>2]=_,g[m+12>>2]=m,g[m+8>>2]=m;break}_=g[_>>2]|0;
4202t:do if((g[_+4>>2]&-8|0)!=(D|0)){for(w=D<<((b|0)==31?0:25-(b>>>1)|0);b=_+16+(w>>>31<<2)|0,y=g[b>>2]|0,!!y;)if((g[y+4>>2]&-8|0)==(D|0)){_=y;break t}else w=w<<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=c+8|0,Ie=we,oe|0}else E=h}else E=h;else E=-1;while(!1);if(b=g[5859]|0,b>>>0>=E>>>0)return _=b-E|0,y=g[5862]|0,_>>>0>15?(oe=y+E|0,g[5862]=oe,g[5859]=_,g[oe+4>>2]=_|1,g[y+b>>2]=_,g[y+4>>2]=E|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,Ie=we,oe|0;if(D=g[5860]|0,D>>>0>E>>>0)return Y=D-E|0,g[5860]=Y,oe=g[5863]|0,te=oe+E|0,g[5863]=te,g[te+4>>2]=Y|1,g[oe+4>>2]=E|3,oe=oe+8|0,Ie=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]=M&-16^1431655768,y=4096),c=E+48|0,d=E+47|0,P=y+d|0,S=0-y|0,h=P&S,h>>>0<=E>>>0||(y=g[5967]|0,y|0&&(m=g[5965]|0,M=m+h|0,M>>>0<=m>>>0|M>>>0>y>>>0)))return oe=0,Ie=we,oe|0;e:do if(g[5968]&4)_=0,z=143;else{b=g[5863]|0;t:do if(b){for(w=23876;M=g[w>>2]|0,!(M>>>0<=b>>>0&&(M+(g[w+4>>2]|0)|0)>>>0>b>>>0);)if(y=g[w+8>>2]|0,y)w=y;else{z=128;break t}if(_=P-D&S,_>>>0<2147483647)if(y=ys(_|0)|0,(y|0)==((g[w>>2]|0)+(g[w+4>>2]|0)|0)){if((y|0)!=-1){D=_,P=y,z=145;break e}}else w=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>E>>>0&_>>>0<2147483647)){if(M=g[5967]|0,M|0&&L>>>0<=R>>>0|L>>>0>M>>>0){_=0;break}if(y=ys(_|0)|0,(y|0)==(b|0)){D=_,P=b,z=145;break e}else w=y,z=136}else _=0;while(!1);do if((z|0)==136){if(b=0-_|0,!(c>>>0>_>>>0&(_>>>0<2147483647&(w|0)!=-1)))if((w|0)==-1){_=0;break}else{D=_,P=w,z=145;break e}if(y=g[5977]|0,y=d-_+y&0-y,y>>>0>=2147483647){D=_,P=w,z=145;break e}if((ys(y|0)|0)==-1){ys(b|0)|0,_=0;break}else{D=y+_|0,P=w,z=145;break e}}while(!1);g[5968]=g[5968]|4,z=143}while(!1);if((z|0)==143&&h>>>0<2147483647&&(Y=ys(h|0)|0,L=ys(0)|0,q=L-Y|0,ee=q>>>0>(E+40|0)>>>0,!((Y|0)==-1|ee^1|Y>>>0<L>>>0&((Y|0)!=-1&(L|0)!=-1)^1))&&(D=ee?q:_,P=Y,z=145),(z|0)==145){_=(g[5965]|0)+D|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,(P|0)==(y+b|0)){z=154;break}if(w=g[_+8>>2]|0,w)_=w;else break}if((z|0)==154&&(te=_+4|0,(g[_+12>>2]&8|0)==0)&&P>>>0>d>>>0&y>>>0<=d>>>0){g[te>>2]=b+D,oe=(g[5860]|0)+D|0,Y=d+8|0,Y=(Y&7|0)==0?0:0-Y&7,te=d+Y|0,Y=oe-Y|0,g[5863]=te,g[5860]=Y,g[te+4>>2]=Y|1,g[d+oe+4>>2]=40,g[5864]=g[5979];break}for(P>>>0<(g[5861]|0)>>>0&&(g[5861]=P),b=P+D|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]=P,m=_+4|0,g[m>>2]=(g[m>>2]|0)+D,m=P+8|0,m=P+((m&7|0)==0?0:0-m&7)|0,_=b+8|0,_=b+((_&7|0)==0?0:0-_&7)|0,h=m+E|0,c=_-m-E|0,g[m+4>>2]=E|3;t:do if((d|0)==(_|0))oe=(g[5860]|0)+c|0,g[5860]=oe,g[5863]=h,g[h+4>>2]=oe|1;else{if((g[5862]|0)==(_|0)){oe=(g[5859]|0)+c|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){D=y&-8,w=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<<w);break}else{g[y+12>>2]=b,g[b+8>>2]=y;break}else{P=g[_+24>>2]|0,y=g[_+12>>2]|0;do if((y|0)==(_|0)){if(b=_+16|0,w=b+4|0,y=g[w>>2]|0,y)b=w;else if(y=g[b>>2]|0,!y){y=0;break}for(;;)if(S=y+20|0,w=g[S>>2]|0,w)y=w,b=S;else if(S=y+16|0,w=g[S>>2]|0,w)y=w,b=S;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(!P)break;b=g[_+28>>2]|0,w=23732+(b<<2)|0;do if((g[w>>2]|0)!=(_|0)){if(oe=P+16|0,g[((g[oe>>2]|0)==(_|0)?oe:P+20|0)>>2]=y,!y)break r}else{if(g[w>>2]=y,y|0)break;g[5858]=g[5858]&~(1<<b);break r}while(!1);if(g[y+24>>2]=P,b=_+16|0,w=g[b>>2]|0,w|0&&(g[y+16>>2]=w,g[w+24>>2]=y),b=g[b+4>>2]|0,!b)break;g[y+20>>2]=b,g[b+24>>2]=y}while(!1);_=_+D|0,S=D+c|0}else S=c;if(_=_+4|0,g[_>>2]=g[_>>2]&-2,g[h+4>>2]=S|1,g[h+S>>2]=S,_=S>>>3,S>>>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}_=S>>>8;do if(!_)w=0;else{if(S>>>0>16777215){w=31;break}te=(_+1048320|0)>>>16&8,oe=_<<te,Y=(oe+520192|0)>>>16&4,oe=oe<<Y,w=(oe+245760|0)>>>16&2,w=14-(Y|te|w)+(oe<<w>>>15)|0,w=S>>>(w+7|0)&1|w<<1}while(!1);if(_=23732+(w<<2)|0,g[h+28>>2]=w,y=h+16|0,g[y+4>>2]=0,g[y>>2]=0,y=g[5858]|0,b=1<<w,!(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>>
42022]&-8|0)!=(S|0)){for(w=S<<((w|0)==31?0:25-(w>>>1)|0);b=_+16+(w>>>31<<2)|0,y=g[b>>2]|0,!!y;)if((g[y+4>>2]&-8|0)==(S|0)){_=y;break r}else w=w<<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,Ie=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;S=oe+-47|0,y=S+8|0,y=S+((y&7|0)==0?0:0-y&7)|0,S=d+16|0,y=y>>>0<S>>>0?d:y,_=y+8|0,b=D+-40|0,Y=P+8|0,Y=(Y&7|0)==0?0:0-Y&7,te=P+Y|0,Y=b-Y|0,g[5863]=te,g[5860]=Y,g[te+4>>2]=Y|1,g[P+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]=P,g[5970]=D,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(P=y-d|0,g[b>>2]=g[b>>2]&-2,g[d+4>>2]=P|1,g[y>>2]=P,_=P>>>3,P>>>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(_=P>>>8,_?P>>>0>16777215?w=31:(te=(_+1048320|0)>>>16&8,oe=_<<te,Y=(oe+520192|0)>>>16&4,oe=oe<<Y,w=(oe+245760|0)>>>16&2,w=14-(Y|te|w)+(oe<<w>>>15)|0,w=P>>>(w+7|0)&1|w<<1):w=0,b=23732+(w<<2)|0,g[d+28>>2]=w,g[d+20>>2]=0,g[S>>2]=0,_=g[5858]|0,y=1<<w,!(_&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)!=(P|0)){for(w=P<<((w|0)==31?0:25-(w>>>1)|0);b=_+16+(w>>>31<<2)|0,y=g[b>>2]|0,!!y;)if((g[y+4>>2]&-8|0)==(P|0)){_=y;break t}else w=w<<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|P>>>0<oe>>>0&&(g[5861]=P),g[5969]=P,g[5970]=D,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=D+-40|0,Y=P+8|0,Y=(Y&7|0)==0?0:0-Y&7,te=P+Y|
42020,Y=oe-Y|0,g[5863]=te,g[5860]=Y,g[te+4>>2]=Y|1,g[P+oe+4>>2]=40,g[5864]=g[5979];while(!1);if(_=g[5860]|0,_>>>0>E>>>0)return Y=_-E|0,g[5860]=Y,oe=g[5863]|0,te=oe+E|0,g[5863]=te,g[te+4>>2]=Y|1,g[oe+4>>2]=E|3,oe=oe+8|0,Ie=we,oe|0}return oe=bu()|0,g[oe>>2]=12,oe=0,Ie=we,oe|0}function zr(y){y=y|0;var _=0,b=0,w=0,S=0,P=0,D=0,c=0,d=0;if(y){b=y+-8|0,S=g[5861]|0,y=g[y+-4>>2]|0,_=y&-8,d=b+_|0;do if(y&1)c=b,D=b;else{if(w=g[b>>2]|0,!(y&3)||(D=b+(0-w)|0,P=w+_|0,D>>>0<S>>>0))return;if((g[5862]|0)==(D|0)){if(y=d+4|0,_=g[y>>2]|0,(_&3|0)!=3){c=D,_=P;break}g[5859]=P,g[y>>2]=_&-2,g[D+4>>2]=P|1,g[D+P>>2]=P;return}if(b=w>>>3,w>>>0<256)if(y=g[D+8>>2]|0,_=g[D+12>>2]|0,(_|0)==(y|0)){g[5857]=g[5857]&~(1<<b),c=D,_=P;break}else{g[y+12>>2]=_,g[_+8>>2]=y,c=D,_=P;break}S=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){y=0;break}for(;;)if(w=y+20|0,b=g[w>>2]|0,b)y=b,_=w;else if(w=y+16|0,b=g[w>>2]|0,b)y=b,_=w;else break;g[_>>2]=0}else c=g[D+8>>2]|0,g[c+12>>2]=y,g[y+8>>2]=c;while(!1);if(S){if(_=g[D+28>>2]|0,b=23732+(_<<2)|0,(g[b>>2]|0)==(D|0)){if(g[b>>2]=y,!y){g[5858]=g[5858]&~(1<<_),c=D,_=P;break}}else if(c=S+16|0,g[((g[c>>2]|0)==(D|0)?c:S+20|0)>>2]=y,!y){c=D,_=P;break}g[y+24>>2]=S,_=D+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,c=D,_=P):(c=D,_=P)}else c=D,_=P}while(!1);if(!(D>>>0>=d>>>0)&&(y=d+4|0,w=g[y>>2]|0,!!(w&1))){if(w&2)g[y>>2]=w&-2,g[c+4>>2]=_|1,g[D+_>>2]=_,S=_;else{if((g[5863]|0)==(d|0)){if(d=(g[5860]|0)+_|0,g[5860]=d,g[5863]=c,g[c+4>>2]=d|1,(c|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]=D,g[c+4>>2]=d|1,g[D+d>>2]=d;return}S=(w&-8)+_|0,b=w>>>3;do if(w>>>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{P=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(w=y+20|0,b=g[w>>2]|0,b)y=b,_=w;else if(w=y+16|0,b=g[w>>2]|0,b)y=b,_=w;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(P|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(w=P+16|0,g[((g[w>>2]|0)==(d|0)?w:P+20|0)>>2]=b,!b)break;g[b+24>>2]=P,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[c+4>>2]=S|1,g[D+S>>2]=S,(c|0)==(g[5862]|0)){g[5859]=S;return}}if(y=S>>>3,S>>>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]=c,g[y+12>>2]=c,g[c+8>>2]=y,g[c+12>>2]=b;return}y=S>>>8,y?S>>>0>16777215?w=31:(D=(y+1048320|0)>>>16&8,d=y<<D,P=(d+520192|0)>>>16&4,d=d<<P,w=(d+245760|0)>>>16&2,w=14-(P|D|w)+(d<<w>>>15)|0,w=S>>>(w+7|0)&1|w<<1):w=0,y=23732+(w<<2)|0,g[c+28>>2]=w,g[c+20>>2]=0,g[c+16>>2]=0,_=g[5858]|0,b=1<<w;e:do if(!(_&b))g[5858]=_|b,g[y>>2]=c,g[c+24>>2]=y,g[c+12>>2]=c,g[c+8>>2]=c;else{y=g[y>>2]|0;t:do if((g[y+4>>2]&-8|0)!=(S|0)){for(w=S<<((w|0)==31?0:25-(w>>>1)|0);b=y+16+(w>>>31<<2)|0,_=g[b>>2]|0,!!_;)if((g[_+4>>2]&-8|0)==(S|0)){y=_;break t}else w=w<<1,y=_;g[b>>2]=c,g[c+24>>2]=y,g[c+12>>2]=c,g[c+8>>2]=c;break e}while(!1);D=y+8|0,d=g[D>>2]|0,g[d+12>>2]=c,g[D>>2]=c,g[c+8>>2]=d,g[c+12>>2]=y,g[c+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=Xr(_,y)|0,(_|y)>>>0>65535&&(b=((b>>>0)/(y>>>0)|0|0)==(_|0)?b:-1)):b=0,y=qn(b)|0,!y||!(g[y+-4>>2]&3)||na(y|0,0,b|0)|0,y|0}function An(y,_,b,w){return y=y|0,_=_|0,b=b|0,w=w|0,b=y+b>>>0,pr(_+w+(b>>>0<y>>>0|0)>>>0|0),b|0|0}function Jr(y,_,b,w){return y=y|0,_=_|0,b=b|0,w=w|0,w=_-w-(b>>>0>y>>>0|0)>>>0,pr(w|0),y-b>>>0|0|0}function ki(y){return y=y|0,(y?31-(qr(y^y-1)|0)|0:32)|0}function xu(y,_,b,w,S){y=y|0,_=_|0,b=b|0,w=w|0,S=S|0;var P=0,D=0,c=0,d=0,h=0,m=0,E=0,M=0,R=0,L=0;if(m=y,d=_,h=d,D=b,M=w,c=M,!h)return P=(S|0)!=0,c?P?(g[S>>2]=y|0,g[S+4>>2]=_&0,M=0,S=0,pr(M|0),S|0):(M=0,S=0,pr(M|0),S|0):(P&&(g[S>>2]=(m>>>0)%(D>>>0),g[S+4>>2]=0),M=0,S=(m>>>0)/(D>>>0)>>>0,pr(M|0),S|0);P=(c|0)==0;do if(D){if(!P){if(P=(qr(c|0)|0)-(qr(h|0)|0)|0,P>>>0<=31){E=P+1|0,c=31-P|0,_=P-31>>31,D=E,y=m>>>(E>>>0)&_|h<<c,_=h>>>(E>>>0)&_,P=0,c=m<<c;break}return S?(g[S>>2]=y|0,g[S+4>>2]=d|_&0,M=0,S=0,pr(M|0),S|0):(M=0,S=0,pr(M|0),S|0)}
4202if(P=D-1|0,P&D|0){c=(qr(D|0)|0)+33-(qr(h|0)|0)|0,L=64-c|0,E=32-c|0,d=E>>31,R=c-32|0,_=R>>31,D=c,y=E-1>>31&h>>>(R>>>0)|(h<<E|m>>>(c>>>0))&_,_=_&h>>>(c>>>0),P=m<<L&d,c=(h<<L|m>>>(R>>>0))&d|m<<E&c-33>>31;break}return S|0&&(g[S>>2]=P&m,g[S+4>>2]=0),(D|0)==1?(R=d|_&0,L=y|0|0,pr(R|0),L|0):(L=ki(D|0)|0,R=h>>>(L>>>0)|0,L=h<<32-L|m>>>(L>>>0)|0,pr(R|0),L|0)}else{if(P)return S|0&&(g[S>>2]=(h>>>0)%(D>>>0),g[S+4>>2]=0),R=0,L=(h>>>0)/(D>>>0)>>>0,pr(R|0),L|0;if(!m)return S|0&&(g[S>>2]=0,g[S+4>>2]=(h>>>0)%(c>>>0)),R=0,L=(h>>>0)/(c>>>0)>>>0,pr(R|0),L|0;if(P=c-1|0,!(P&c))return S|0&&(g[S>>2]=y|0,g[S+4>>2]=P&h|_&0),R=0,L=h>>>((ki(c|0)|0)>>>0),pr(R|0),L|0;if(P=(qr(c|0)|0)-(qr(h|0)|0)|0,P>>>0<=30){_=P+1|0,c=31-P|0,D=_,y=h<<c|m>>>(_>>>0),_=h>>>(_>>>0),P=0,c=m<<c;break}return S?(g[S>>2]=y|0,g[S+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(!D)h=c,d=0,c=0;else{E=b|0|0,m=M|w&0,h=An(E|0,m|0,-1,-1)|0,b=Be()|0,d=c,c=0;do w=d,d=P>>>31|d<<1,P=c|P<<1,w=y<<1|w>>>31|0,M=y>>>31|_<<1|0,Jr(h|0,b|0,w|0,M|0)|0,L=Be()|0,R=L>>31|((L|0)<0?-1:0)<<1,c=R&1,y=Jr(w|0,M|0,R&E|0,(((L|0)<0?-1:0)>>31|((L|0)<0?-1:0)<<1)&m|0)|0,_=Be()|0,D=D-1|0;while((D|0)!=0);h=d,d=0}return D=0,S|0&&(g[S>>2]=y,g[S+4>>2]=_),R=(P|0)>>>31|(h|D)<<1|(D<<1|P>>>31)&0|d,L=(P<<1|0)&-2|c,pr(R|0),L|0}function Hs(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0;return h=_>>31|((_|0)<0?-1:0)<<1,d=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,P=w>>31|((w|0)<0?-1:0)<<1,S=((w|0)<0?-1:0)>>31|((w|0)<0?-1:0)<<1,c=Jr(h^y|0,d^_|0,h|0,d|0)|0,D=Be()|0,y=P^h,_=S^d,Jr((xu(c,D,Jr(P^b|0,S^w|0,P|0,S|0)|0,Be()|0,0)|0)^y|0,(Be()|0)^_|0,y|0,_|0)|0}function wf(y,_){y=y|0,_=_|0;var b=0,w=0,S=0,P=0;return P=y&65535,S=_&65535,b=Xr(S,P)|0,w=y>>>16,y=(b>>>16)+(Xr(S,w)|0)|0,S=_>>>16,_=Xr(S,P)|0,pr((y>>>16)+(Xr(S,w)|0)+(((y&65535)+_|0)>>>16)|0),y+_<<16|b&65535|0|0}function di(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0;return S=y,P=b,b=wf(S,P)|0,y=Be()|0,pr((Xr(_,P)|0)+(Xr(w,S)|0)+y|y&0|0),b|0|0|0}function os(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0,D=0,c=0,d=0,h=0;return S=Ie,Ie=Ie+16|0,c=S|0,D=_>>31|((_|0)<0?-1:0)<<1,P=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,h=w>>31|((w|0)<0?-1:0)<<1,d=((w|0)<0?-1:0)>>31|((w|0)<0?-1:0)<<1,y=Jr(D^y|0,P^_|0,D|0,P|0)|0,_=Be()|0,xu(y,_,Jr(h^b|0,d^w|0,h|0,d|0)|0,Be()|0,c)|0,w=Jr(g[c>>2]^D|0,g[c+4>>2]^P|0,D|0,P|0)|0,b=Be()|0,Ie=S,pr(b|0),w|0}function To(y,_,b,w){y=y|0,_=_|0,b=b|0,w=w|0;var S=0,P=0;return P=Ie,Ie=Ie+16|0,S=P|0,xu(y,_,b,w,S)|0,Ie=P,pr(g[S+4>>2]|0),g[S>>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 Xt(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 rr(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 Vl(y,_){return y=+y,_=+_,y!=y?+_:_!=_?+y:+mi(+y,+_)}function Pc(y,_){return y=+y,_=+_,y!=y?+_:_!=_?+y:+Gr(+y,+_)}function ra(y){return y=+y,y>=0?+Ct(y+.5):+$r(y-.5)}function Do(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0;if((b|0)>=8192)return _a(y|0,_|0,b|0)|0,y|0;if(P=y|0,S=y+b|0,(y&3)==(_&3)){for(;y&3;){if(!b)return P|0;Se[y>>0]=Se[_>>0]|0,y=y+1|0,_=_+1|0,b=b-1|0}for(b=S&-4|0,w=b-64|0;(y|0)<=(w|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=S-4|0;(y|0)<(b|0);)Se[y>>0]=Se[_>>0]|0,Se[y+1>>0]=Se[_+1>>0]|0,Se[y+2>>0]=Se[_+2>>0]|0,Se[y+3>>0]=Se[_+3>>0]|0,y=y+4|0,_=_+4|0;for(;(y|0)<(S|0);)Se[y>>0]=Se[_>>0]|0,y=y+1|0,_=_+1|0;return P|0}function na(y,_,b){y=y|0,_=_|0,b=b|0;var w=0,S=0,P=0,D=0;if(P=y+b|0,_=_&255,(b|0)>=67){for(;y&3;)Se[y>>0]=_,y=y+1|0;for(w=P&-4|0,D=_|_<<8|_<<16|_<<24,S=w-64|0;(y|0)<=(S|0);)g[y>>2]=D,g[y+4>>2]=D,g[y+8>>2]=D,g[y+12>>2]=D,g[y+16>>2]=D,g[y+20>>2]=D,g[y+24>>2]=D,g[y+28>>2]=D,g[y+32>>2]=D,g[y+36>>
42022]=D,g[y+40>>2]=D,g[y+44>>2]=D,g[y+48>>2]=D,g[y+52>>2]=D,g[y+56>>2]=D,g[y+60>>2]=D,y=y+64|0;for(;(y|0)<(w|0);)g[y>>2]=D,y=y+4|0}for(;(y|0)<(P|0);)Se[y>>0]=_,y=y+1|0;return P-b|0}function ia(y){return y=+y,y>=0?+Ct(y+.5):+$r(y-.5)}function ys(y){y=y|0;var _=0,b=0,w=0;return w=Wi()|0,b=g[Je>>2]|0,_=b+y|0,(y|0)>0&(_|0)<(b|0)|(_|0)<0?(Wn(_|0)|0,tn(12),-1):(_|0)>(w|0)&&!(ci(_|0)|0)?(tn(12),-1):(g[Je>>2]=_,b|0)}return{___divdi3:Hs,___muldi3:di,___remdi3:os,___uremdi3:To,_areNeighborCells:Ea,_bitshift64Ashr:Eo,_bitshift64Lshr:Xt,_bitshift64Shl:rr,_calloc:oo,_cellAreaKm2:Ln,_cellAreaM2:Gs,_cellAreaRads2:fn,_cellToBoundary:Dl,_cellToCenterChild:Fp,_cellToChildPos:du,_cellToChildren:Fn,_cellToChildrenSize:xc,_cellToLatLng:Ol,_cellToLocalIj:Oh,_cellToParent:Zo,_cellToVertex:jr,_cellToVertexes:Oo,_cellsToDirectedEdge:qa,_cellsToLinkedMultiPolygon:vr,_childPosToCell:kp,_compactCells:Ml,_destroyLinkedMultiPolygon:Nl,_directedEdgeToBoundary:ou,_directedEdgeToCells:Eh,_edgeLengthKm:kl,_edgeLengthM:Sc,_edgeLengthRads:Cc,_emscripten_replace_memory:Ho,_free:zr,_getBaseCellNumber:Af,_getDirectedEdgeDestination:Ca,_getDirectedEdgeOrigin:Ja,_getHexagonAreaAvgKm2:Rh,_getHexagonAreaAvgM2:nl,_getHexagonEdgeLengthAvgKm:Xn,_getHexagonEdgeLengthAvgM:gu,_getIcosahedronFaces:Fl,_getNumCells:Yo,_getPentagons:wc,_getRes0Cells:wh,_getResolution:Ka,_greatCircleDistanceKm:rl,_greatCircleDistanceM:gf,_greatCircleDistanceRads:Au,_gridDisk:Rn,_gridDiskDistances:ms,_gridDistance:or,_gridPathCells:mu,_gridPathCellsSize:Is,_gridRingUnsafe:xe,_i64Add:An,_i64Subtract:Jr,_isPentagon:On,_isResClassIII:Mh,_isValidCell:Ko,_isValidDirectedEdge:Th,_isValidVertex:qi,_latLngToCell:Ya,_llvm_maxnum_f64:Vl,_llvm_minnum_f64:Pc,_llvm_round_f64:ra,_localIjToCell:xi,_malloc:qn,_maxFaceCount:el,_maxGridDiskSize:Si,_maxPolygonToCellsSize:Me,_memcpy:Do,_memset:na,_originToDirectedEdges:Bn,_pentagonCount:hu,_polygonToCells:gt,_readInt64AsDoubleFromPointer:Ps,_res0CellCount:_c,_round:ia,_sbrk:ys,_sizeOfCellBoundary:vf,_sizeOfCoordIJ:vu,_sizeOfGeoLoop:no,_sizeOfGeoPolygon:Bs,_sizeOfH3Index:yf,_sizeOfLatLng:_u,_sizeOfLinkedGeoPolygon:yu,_uncompactCells:Ph,_uncompactCellsSize:Lp,_vertexToLatLng:io,establishStackSpace:ui,stackAlloc:$n,stackRestore:Fi,stackSave:Wo}})(Ae,Vt,pe);e.___divdi3=Et.___divdi3,e.___muldi3=Et.___muldi3,e.___remdi3=Et.___remdi3,e.___uremdi3=Et.___uremdi3,e._areNeighborCells=Et._areNeighborCells,e._bitshift64Ashr=Et._bitshift64Ashr,e._bitshift64Lshr=Et._bitshift64Lshr,e._bitshift64Shl=Et._bitshift64Shl,e._calloc=Et._calloc,e._cellAreaKm2=Et._cellAreaKm2,e._cellAreaM2=Et._cellAreaM2,e._cellAreaRads2=Et._cellAreaRads2,e._cellToBoundary=Et._cellToBoundary,e._cellToCenterChild=Et._cellToCenterChild,e._cellToChildPos=Et._cellToChildPos,e._cellToChildren=Et._cellToChildren,e._cellToChildrenSize=Et._cellToChildrenSize,e._cellToLatLng=Et._cellToLatLng,e._cellToLocalIj=Et._cellToLocalIj,e._cellToParent=Et._cellToParent,e._cellToVertex=Et._cellToVertex,e._cellToVertexes=Et._cellToVertexes,e._cellsToDirectedEdge=Et._cellsToDirectedEdge,e._cellsToLinkedMultiPolygon=Et._cellsToLinkedMultiPolygon,e._childPosToCell=Et._childPosToCell,e._compactCells=Et._compactCells,e._destroyLinkedMultiPolygon=Et._destroyLinkedMultiPolygon,e._directedEdgeToBoundary=Et._directedEdgeToBoundary,e._directedEdgeToCells=Et._directedEdgeToCells,e._edgeLengthKm=Et._edgeLengthKm,e._edgeLengthM=Et._edgeLengthM,e._edgeLengthRads=Et._edgeLengthRads;var H=e._emscripten_replace_memory=Et._emscripten_replace_memory;e._free=Et._free,e._getBaseCellNumber=Et._getBaseCellNumber,e._getDirectedEdgeDestination=Et._getDirectedEdgeDestination,e._getDirectedEdgeOrigin=Et._getDirectedEdgeOrigin,e._getHexagonAreaAvgKm2=Et._getHexagonAreaAvgKm2,e._getHexagonAreaAvgM2=Et._getHexagonAreaAvgM2,e._getHexagonEdgeLengthAvgKm=Et._getHexagonEdgeLengthAvgKm,e._getHexagonEdgeLengthAvgM=Et._getHexagonEdgeLengthAvgM,e._getIcosahedronFaces=Et._getIcosahedronFaces,e._getNumCells=Et._getNumCells,e._getPentagons=Et._getPentagons,e._getRes0Cells=Et._getRes0Cells,e._getResolution=Et._getResolution,e._greatCircleDistanceKm=Et._greatCircleDistanceKm,e._greatCircleDistanceM=Et._greatCircleDistanceM,e._greatCircleDistanceRads=Et._greatCircleDistanceRads,e._gridDisk=Et._gridDisk,e._gridDiskDistances=Et._gridDiskDistances,e._gridDistance=Et._gridDistance,e._gridPathCells=Et._gridPathCells,e._gridPathCellsSize=Et._gridPathCellsSize,e._gridRingUnsafe=Et._gridRingUnsafe,e._i64Add=Et._i64Add,e._i64Subtract=Et._i64Subtract,e._isPentagon=Et._isPentagon,e._isResClassIII=Et._isResClassIII,e._isValidCell=Et._isValidCell,e._isValidDirectedEdge=Et._isValidDirectedEdge,e._isValidVertex=Et._isValidVertex,e._latLngToCell=Et._latLngToCell,e._llvm_maxnum_f64=Et._llvm_maxnum_f64,e._llvm_minnum_f64=Et._llvm_minnum_f64,e._llvm_round_f64=Et._llvm_round_f64,e._localIjToCell=Et._localIjToCell,e._malloc=Et._malloc,e._maxFaceCount=Et._maxFaceCount,e._maxGridDiskSize=Et._maxGridDiskSize,e._maxPolygonToCellsSize=Et._maxPolygonToCellsSize,e._memcpy=Et._memcpy,e._memset=Et._memset,e._originToDirectedEdges=Et._originToDirectedEdges,e._pentagonCount=Et._pentagonCount,e._polygonToCells=Et._polygonToCells,e._readInt64AsDoubleFromPointer=Et._readInt64AsDoubleFromPointer,e._res0CellCount=Et._res0CellCount,e._round=Et._round,e._sbrk=Et._sbrk,e._sizeOfCellBoundary=Et._sizeOfCellBoundary,e._sizeOfCoordIJ=Et._sizeOfCoordIJ,e._sizeOfGeoLoop=Et._sizeOfGeoLoop,e._sizeOfGeoPolygon=Et._sizeOfGeoPolygon,e._sizeOfH3Index=Et._sizeOfH3Index,e._sizeOfLatLng=Et._sizeOfLatLng,e._sizeOfLinkedGeoPolygon=Et._sizeOfLinkedGeoPolygon,e._uncompactCells=Et._uncompactCells,e._uncompactCellsSize=Et._uncompactCellsSize,e._vertexToLatLng=Et._vertexToLatLng,e.establishStackSpace=Et.establishStackSpace;var bt=e.stackAlloc=Et.stackAlloc,St=e.stackRestore=Et.stackRestore,Te=e.stackSave=Et.stackSave;if(e.asm=Et,e.cwrap=X,e.setValue=F,e.getValue=N,mn){Hn(mn)||(mn=s(mn));{li();var Xe=function(he){he.byteLength&&(he=new Uint8Array(he)),re.set(he,I),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,Yn()},ct=function(){o(mn,Xe,function(){throw"could not load memory initializer "+mn})},Z=Rt(mn);if(Z)Xe(Z.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),ct();return}}Xe(be)};e.memoryInitializerRequest.response?setTimeout(ne,0):e.memoryInitializerRequest.addEventListener("load",ne)}else ct()}}var ce;Dr=function he(){ce||ve(),ce||(Dr=he)};function ve(he){if(un>0||(er(),un>0))return;function be(){ce||(ce=!0,!U&&(Jt(),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 Fe(he){throw e.onAbort&&e.onAbort(he),he+="",l(he),f(he),U=!0,"abort("+he+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Fe,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,mA=_n,dn=_n,pn=_n,ho=_n,Or=_n,rce=[["sizeOfH3Index",_n],["sizeOfLatLng",_n],["sizeOfCellBoundary",_n],["sizeOfGeoLoop",_n],["sizeOfGeoPolygon",_n],["sizeOfLinkedGeoPolygon",_n],["sizeOfCoordIJ",_n],["readInt64AsDoubleFromPointer",_n],["isValidCell",mA,[dn,pn]],["latLngToCell",an,[_n,_n,ho,Or]],["cellToLatLng",an,[dn,pn,Or]],["cellToBoundary",an,[dn,pn,Or]],["maxGridDiskSize",an,[_n,Or]],["gridDisk",an,[dn,pn,_n,Or]],["gridDiskDistances",an,[dn,pn,_n,Or,Or]],["gridRingUnsafe",an,[dn,pn,_n,Or]],["maxPolygonToCellsSize",an,[Or,ho,_n,Or]],["polygonToCells",an,[Or,ho,_n,Or]],["cellsToLinkedMultiPolygon",an,[Or,_n,Or]],["destroyLinkedMultiPolygon",null,[Or]],["compactCells",an,[Or,Or,_n,_n]],["uncompactCells",an,[Or,_n,_n,Or,_n,ho]],["uncompactCellsSize",an,[Or,_n,_n,ho,Or]],["isPentagon",mA,[dn,pn]],["isResClassIII",mA,[dn,pn]],["getBaseCellNumber",_n,[dn,pn]],["getResolution",_n,[dn,pn]],["maxFaceCount",an,[dn,pn,Or]],["getIcosahedronFaces",an,[dn,pn,Or]],["cellToParent",an,[dn,pn,ho,Or]],["cellToChildren",an,[dn,pn,ho,Or]],["cellToCenterChild",an,[dn,pn,ho,Or]],["cellToChildrenSize",an,[dn,pn,ho,Or]],["cellToChildPos",an,[dn,pn,ho,Or]],["childPosToCell",an,[_n,_n,dn,pn,ho,Or]],["areNeighborCells",an,[dn,pn,dn,pn,Or]],["cellsToDirectedEdge",an,[dn,pn,dn,pn,Or]],["getDirectedEdgeOrigin",an,[dn,pn,Or]],["getDirectedEdgeDestination",an,[dn,pn,Or]],["isValidDirectedEdge",mA,[dn,pn]],["directedEdgeToCells",an,[dn,pn,Or]],["originToDirectedEdges",an,[dn,pn,Or]],["directedEdgeToBoundary",an,[dn,pn,Or]],["gridDistance",an,[dn,pn,dn,pn,Or]],["gridPathCells",an,[dn,pn,dn,pn,Or]],["gridPathCellsSize",an,[dn,pn,dn,pn,Or]],["cellToLocalIj",an,[dn,pn,dn,pn,_n,Or]],["localIjToCell",an,[dn,pn,Or,_n,Or]],["getHexagonAreaAvgM2",an,[ho,Or]],["getHexagonAreaAvgKm2",an,[ho,Or]],["getHexagonEdgeLengthAvgM",an,[ho,Or]],["getHexagonEdgeLengthAvgKm",an,[ho,Or]],["greatCircleDistanceM",_n,[Or,Or]],["greatCircleDistanceKm",_n,[Or,Or]],["greatCircleDistanceRads",_n,[Or,Or]],["cellAreaM2",an,[dn,pn,Or]],["cellAreaKm2",an,[dn,pn,Or]],["cellAreaRads2",an,[dn,pn,Or]],["edgeLengthM",an,[dn,pn,Or]],["edgeLengthKm",an,[dn,pn,Or]],["edgeLengthRads",an,[dn,pn,Or]],["getNumCells",an,[ho,Or]],["getRes0Cells",an,[Or]],["res0CellCount",_n],["getPentagons",an,[_n,Or]],["pentagonCount",_n],["cellToVertex",an,[dn,pn,_n,Or]],["cellToVertexes",an,[dn,pn,Or]],["vertexToLatLng",an,[dn,pn,Or]],["isValidVertex",mA,[dn,pn]]],nce=0,ice=1,sce=2,oce=3,TL=4,ace=5,lce=6,cce=7,uce=8,fce=9,hce=10,dce=11,pce=12,Ace=13,gce=14,mce=15,Ys={};Ys[nce]="Success";Ys[ice]="The operation failed but a more specific error is not available";Ys[sce]="Argument was outside of acceptable range";Ys[oce]="Latitude or longitude arguments were outside of acceptable range";Ys[TL]="Resolution argument was outside of acceptable range";
4202Ys[ace]="Cell argument was not valid";Ys[lce]="Directed edge argument was not valid";Ys[cce]="Undirected edge argument was not valid";Ys[uce]="Vertex argument was not valid";Ys[fce]="Pentagon distortion was encountered";Ys[hce]="Duplicate input";Ys[dce]="Cell arguments were not neighbors";Ys[pce]="Cell arguments had incompatible resolutions";Ys[Ace]="Memory allocation failed";Ys[gce]="Bounds of provided memory were insufficient";Ys[mce]="Mode or flags argument was not valid";var Cw=1e3,EL=1001,CL=1002,ty={};ty[Cw]="Unknown unit";ty[EL]="Array length out of bounds";ty[CL]="Got unexpected null value for H3 index";var _ce="Unknown error";function SL(r,e,t){var n=t&&"value"in t,i=new Error((r[e]||_ce)+" (code: "+e+(n?", value: "+t.value:"")+")");return i.code=e,i}function IL(r,e){var t=arguments.length===2?{value:e}:{};return SL(Ys,r,t)}function ry(r,e){var t=arguments.length===2?{value:e}:{};return SL(ty,r,t)}function _o(r){if(r!==0)throw IL(r)}var ai={};rce.forEach(function(e){ai[e[0]]=Nr.cwrap.apply(Nr,e)});var qd=16,yp=4,iP=4,hc=8,Sw=8,Yu=ai.sizeOfH3Index(),Iw=ai.sizeOfLatLng(),yce=ai.sizeOfCellBoundary(),vce=ai.sizeOfGeoPolygon(),XA=ai.sizeOfGeoLoop(),bce=ai.sizeOfLinkedGeoPolygon();ai.sizeOfCoordIJ();var op={m:"m",m2:"m2",km:"km",km2:"km2",rads:"rads",rads2:"rads2"};function BL(r){if(typeof r!="number"||r<0||r>15||Math.floor(r)!==r)throw IL(TL,r);return r}function PL(r){if(!r)throw ry(CL);return r}var xce=Math.pow(2,32)-1;function ML(r){if(r>xce)throw ry(EL,r);return r}var wce=/[^0-9a-fA-F]/;function Cl(r){if(Array.isArray(r)&&r.length===2&&Number.isInteger(r[0])&&Number.isInteger(r[1]))return r;if(typeof r!="string"||wce.test(r))return[0,0];var e=parseInt(r.substring(0,r.length-8),qd),t=parseInt(r.substring(r.length-8),qd);return[t,e]}function sP(r){if(r>=0)return r.toString(qd);r=r&2147483647;var e=RL(8,r.toString(qd)),t=(parseInt(e[0],qd)+8).toString(qd);return e=t+e.substring(1),e}function Tce(r,e){return sP(e)+RL(8,sP(r))}function RL(r,e){for(var t=r-e.length,n="",i=0;i<t;i++)n+="0";return n=n+e,n}function oP(r,e,t){for(var n=r.length,i=Nr._calloc(n,Iw),s=t?1:0,o=t?0:1,l=0;l<n*2;l+=2)Nr.HEAPF64.set([r[l/2][s],r[l/2][o]].map(kL),i/hc+l);return Nr.HEAPU32.set([n,i],e/yp),e}function Ece(r,e){var t=r.length-1,n=Nr._calloc(vce),i=0,s=i+XA,o=s+yp;oP(r[0],n+i,e);var l;if(t>0){l=Nr._calloc(t,XA);for(var f=0;f<t;f++)oP(r[f+1],l+XA*f,e)}return Nr.setValue(n+s,t,"i32"),Nr.setValue(n+o,l,"i32"),n}function Cce(r){var e=0,t=e+XA,n=t+yp,i=yp;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"),l=0;l<s;l++)Nr._free(Nr.getValue(o+XA*l+i,"i8*"));Nr._free(o)}Nr._free(r)}function Bw(r,e){e===void 0&&(e=0);var t=Nr.getValue(r+Yu*e,"i32"),n=Nr.getValue(r+Yu*e+yp,"i32");return n?Tce(t,n):null}function OL(r,e){return e===void 0&&(e=0),Nr.getValue(r+hc*e,"double")}function Pw(r){return ai.readInt64AsDoubleFromPointer(r)}function Sce(r,e,t){Nr.HEAPU32.set(Cl(r),e/yp+2*t)}function Mw(r,e){for(var t=[],n=0;n<e;n++){var i=Bw(r,n);i!==null&&t.push(i)}return t}function Ice(r,e){for(var t=e.length,n=0;n<t;n++)Sce(e[n],r,n)}function p_(r){return zce(Nr.getValue(r,"double"))}function DL(r){return[p_(r),p_(r+hc)]}function FL(r){return[p_(r+hc),p_(r)]}function Bce(r,e,t){for(var n=Nr.getValue(r,"i32"),i=r+hc,s=[],o=e?FL:DL,l=0;l<n*2;l+=2)s.push(o(i+hc*l));return t&&s.push(s[0]),s}function Pce(r,e){for(var t=[],n=FL,i,s,o,l;r;){for(t.push(i=[]),s=Nr.getValue(r,"i8*");s;){for(i.push(o=[]),l=Nr.getValue(s,"i8*");l;)o.push(n(l)),l=Nr.getValue(l+hc*2,"i8*");o.push(o[0]),s=Nr.getValue(s+iP*2,"i8*")}r=Nr.getValue(r+iP*2,"i8*")}return t}function Mce(r){var e=Cl(r),t=e[0],n=e[1];return!!ai.isPentagon(t,n)}function A_(r){var e=Cl(r),t=e[0],n=e[1];return ai.isValidCell(t,n)?ai.getResolution(t,n):-1}function Rw(r,e,t){var n=Nr._malloc(Iw);Nr.HEAPF64.set([r,e].map(kL),n/hc);var i=Nr._malloc(Yu);try{return _o(ai.latLngToCell(n,t,i)),PL(Bw(i))}finally{Nr._free(i),Nr._free(n)}}function Ow(r){var e=Nr._malloc(Iw),t=Cl(r),n=t[0],i=t[1];try{return _o(ai.cellToLatLng(n,i,e)),DL(e)}finally{Nr._free(e)}}function LL(r,e){var t=Nr._malloc(yce),n=Cl(r),i=n[0],s=n[1];try{return _o(ai.cellToBoundary(i,s,t)),Bce(t,e,e)}finally{Nr._free(t)}}function Rce(r,e){var t=Cl(r),n=t[0],i=t[1],s=Nr._malloc(Yu);try{return _o(ai.cellToParent(n,i,e,s)),PL(Bw(s))}finally{Nr._free(s)}}function Oce(r,e){var t=Cl(r),n=t[0],i=t[1],s=Nr._malloc(Sw);try{_o(ai.maxGridDiskSize(e,s));var o=ML(Pw(s)),l=Nr._calloc(o,Yu);try{return _o(ai.gridDisk(n,i,e,l)),Mw(l,o)}finally{Nr._free(l)}}finally{Nr._free(s)}}function Dce(r,e,t){if(BL(e),t=!!t,r.length===0||r[0].length===0)return[];var n=typeof r[0][0]=="number"?[r]:r,i=Ece(n,t),s=Nr._malloc(Sw);try{_o(ai.maxPolygonToCellsSize(i,e,0,s));var o=ML(Pw(s)),l=Nr._calloc(o,Yu);try{return _o(ai.polygonToCells(i,e,0,l)),Mw(l,o)}finally{Nr._free(l)}}finally{Nr._free(s),Cce(i)}}function Fce(r,e){if(!r||!r.length)return[];var t=r.length,n=Nr._calloc(t,Yu);Ice(n,r);var i=Nr._calloc(bce);try{return _o(ai.cellsToLinkedMultiPolygon(n,t,i)),Pce(i,e)}finally{ai.destroyLinkedMultiPolygon(i),Nr._free(i),Nr._free(n)}}function Lce(r){var e=Cl(r),t=e[0],n=e[1],i=6,s=Nr._calloc(i,Yu);
4202try{return _o(ai.originToDirectedEdges(t,n,s)),Mw(s,i)}finally{Nr._free(s)}}function kce(r,e){var t=Cl(r),n=t[0],i=t[1],s=Cl(e),o=s[0],l=s[1],f=Nr._malloc(Sw);try{return _o(ai.gridDistance(n,i,o,l,f)),Pw(f)}finally{Nr._free(f)}}function Nce(r,e){var t=Cl(r),n=t[0],i=t[1],s=Nr._malloc(hc);try{switch(e){case op.m:_o(ai.edgeLengthM(n,i,s));break;case op.km:_o(ai.edgeLengthKm(n,i,s));break;case op.rads:_o(ai.edgeLengthRads(n,i,s));break;default:throw ry(Cw,e)}return OL(s)}finally{Nr._free(s)}}function Uce(r,e){BL(r);var t=Nr._malloc(hc);try{switch(e){case op.m:_o(ai.getHexagonEdgeLengthAvgM(r,t));break;case op.km:_o(ai.getHexagonEdgeLengthAvgKm(r,t));break;default:throw ry(Cw,e)}return OL(t)}finally{Nr._free(t)}}function kL(r){return r*Math.PI/180}function zce(r){return r*180/Math.PI}function Dw(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 Vce(r,e,t){const[n,i]=Ow(r),s=e.length;Dw(e,i);const o=e[0]===e[s-1]?s-1:s;for(let l=0;l<o;l++)e[l][0]=wl(i,e[l][0],t),e[l][1]=wl(n,e[l][1],t)}function Gce(r,e,t){const n=r(e,t),[i,s]=Ow(n);return[s,i]}function aP(r,e=1){const t=LL(r,!0);return e!==1?Vce(r,t,e):Dw(t),t}function jce(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 Hce=10;function Wce(r,e){let t;return r==null?t=e:typeof r=="object"?t={...r,coverage:e}:t={getHexagon:r,coverage:e},t}const $ce={...af.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:r=>r.hexagon},extruded:!0};class Ac extends Ss{initializeState(){Ac._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}=dc(this.props.data);for(const o of i){s.index++;const l=this.props.getHexagon(o,s),f=A_(l);if(e<0){if(e=f,!this.props.highPrecision)break}else if(e!==f){n=!0;break}if(Mce(l)){t=!0;break}}return{resolution:e,edgeLengthKM:e>=0?Uce(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||Rw(e.latitude,e.longitude,t);if(i===s)return;if(i)try{if(kce(i,s)*n<Hce)return}catch{}const{unitsPerMeter:o}=e.distanceScales;let l=aP(s);const[f,A]=Ow(s),[v,T]=e.projectFlat([A,f]);l=l.map(I=>{const F=e.projectFlat(I);return[(F[0]-v)/o[0],(F[1]-T)/o[1]]}),this.setState({centerHex:s,vertices:l})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){const{elevationScale:e,material:t,coverage:n,extruded:i,wireframe:s,stroked:o,filled:l,lineWidthUnits:f,lineWidthScale:A,lineWidthMinPixels:v,lineWidthMaxPixels:T,getFillColor:I,getElevation:F,getLineColor:N,getLineWidth:U,transitions:$,updateTriggers:V}=this.props;return{elevationScale:e,extruded:i,coverage:n,wireframe:s,stroked:o,filled:l,lineWidthUnits:f,lineWidthScale:A,lineWidthMinPixels:v,lineWidthMaxPixels:T,material:t,getElevation:F,getFillColor:I,getLineColor:N,getLineWidth:U,transitions:$,updateTriggers:{getFillColor:V.getFillColor,getElevation:V.getElevation,getLineColor:V.getLineColor,getLineWidth:V.getLineWidth}}}_renderPolygonLayer(){const{data:e,getHexagon:t,updateTriggers:n,coverage:i}=this.props,s=this.getSubLayerClass("hexagon-cell-hifi",af),o=this._getForwardProps();return o.updateTriggers.getPolygon=Wce(n.getHexagon,i),new s(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(l,f)=>{const A=t(l,f);return jce(aP(A,i))}})}_renderColumnLayer(){const{data:e,getHexagon:t,updateTriggers:n}=this.props,i=this.getSubLayerClass("hexagon-cell",pc),s=this._getForwardProps();return s.updateTriggers.getPosition=n.getHexagon,new i(s,this.get
4202SubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:s.updateTriggers}),{data:e,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Gce.bind(null,t)})}}Ac.defaultProps=$ce;Ac.layerName="H3HexagonLayer";Ac._checkH3Lib=()=>{};const Xce={getHexagons:{type:"accessor",value:r=>r.hexagons}};class ny extends lf{initializeState(){Ac._checkH3Lib()}updateState({props:e,changeFlags:t}){if(t.dataChanged||t.updateTriggersChanged&&t.updateTriggersChanged.getHexagons){const{data:n,getHexagons:i}=e,s=[],{iterable:o,objectInfo:l}=dc(n);for(const f of o){l.index++;const A=i(f,l),v=Fce(A,!0);for(const T of v){for(const I of T)Dw(I);s.push(this.getSubLayerRow({polygon:T},f,l.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)}}}ny.layerName="H3ClusterLayer";ny.defaultProps=Xce;const Tb=Math.PI/180,$0=new Float32Array(16),lP=new Float32Array(12);function cP(r,e,t){const n=e[0]*Tb,i=e[1]*Tb,s=e[2]*Tb,o=Math.sin(s),l=Math.sin(n),f=Math.sin(i),A=Math.cos(s),v=Math.cos(n),T=Math.cos(i),I=t[0],F=t[1],N=t[2];r[0]=I*T*v,r[1]=I*f*v,r[2]=I*-l,r[3]=F*(-f*A+T*l*o),r[4]=F*(T*A+f*l*o),r[5]=F*v*o,r[6]=N*(f*o+T*l*A),r[7]=N*(-T*o+f*l*A),r[8]=N*v*A}function uP(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 NL={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:l}=this.props,f=Array.isArray(l),A=f&&l.length===16,v=Array.isArray(s),T=Array.isArray(i),I=Array.isArray(o),F=A||!f&&!!l(n[0]);F?r.constant=A:r.constant=T&&v&&I;const N=r.value;if(r.constant){let U;F?($0.set(l),U=uP($0)):(U=lP,cP(U,i,s),U.set(o,9)),r.value=new Float32Array(U)}else{let U=e*r.size;const{iterable:$,objectInfo:V}=dc(n,e,t);for(const j of $){V.index++;let X;
vendor: 15,585 bytes, lines 4202-4368
4202if(F)$0.set(A?l:l(j,V)),X=uP($0);else{X=lP;const ue=T?i:i(j,V),K=v?s:s(j,V);cP(X,ue,K),X.set(I?o:o(j,V),9)}N[U++]=X[0],N[U++]=X[1],N[U++]=X[2],N[U++]=X[3],N[U++]=X[4],N[U++]=X[5],N[U++]=X[6],N[U++]=X[7],N[U++]=X[8],N[U++]=X[9],N[U++]=X[10],N[U++]=X[11]}}}};function UL(r,e){return e===Qr.CARTESIAN||e===Qr.METER_OFFSETS||e===Qr.DEFAULT&&!r.isGeospatial}const fP=`uniform simpleMeshUniforms { 4203 float sizeScale; 4204 bool composeModelMatrix; 4205 bool hasTexture; 4206 bool flatShading; 4207} simpleMesh; 4208`,qce={name:"simpleMesh",vs:fP,fs:fP,uniformTypes:{sizeScale:"f32",composeModelMatrix:"f32",hasTexture:"f32",flatShading:"f32"}},Jce=`#version 300 es 4209#define SHADER_NAME simple-mesh-layer-vs 4210in vec3 positions; 4211in vec3 normals; 4212in vec3 colors; 4213in vec2 texCoords; 4214in vec3 instancePositions; 4215in vec3 instancePositions64Low; 4216in vec4 instanceColors; 4217in vec3 instancePickingColors; 4218in vec3 instanceModelMatrixCol0; 4219in vec3 instanceModelMatrixCol1; 4220in vec3 instanceModelMatrixCol2; 4221in vec3 instanceTranslation; 4222out vec2 vTexCoord; 4223out vec3 cameraPosition; 4224out vec3 normals_commonspace; 4225out vec4 position_commonspace; 4226out vec4 vColor; 4227void main(void) { 4228geometry.worldPosition = instancePositions; 4229geometry.uv = texCoords; 4230geometry.pickingColor = instancePickingColors; 4231vTexCoord = texCoords; 4232cameraPosition = project.cameraPosition; 4233vColor = vec4(colors * instanceColors.rgb, instanceColors.a); 4234mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); 4235vec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale + instanceTranslation; 4236if (simpleMesh.composeModelMatrix) { 4237DECKGL_FILTER_SIZE(pos, geometry); 4238normals_commonspace = project_normal(instanceModelMatrix * normals); 4239geometry.worldPosition += pos; 4240gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace); 4241geometry.position = position_commonspace; 4242} 4243else { 4244pos = project_size(pos); 4245DECKGL_FILTER_SIZE(pos, geometry); 4246gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace); 4247geometry.position = position_commonspace; 4248normals_commonspace = project_normal(instanceModelMatrix * normals); 4249} 4250geometry.normal = normals_commonspace; 4251DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4252DECKGL_FILTER_COLOR(vColor, geometry); 4253} 4254`,Kce=`#version 300 es 4255#define SHADER_NAME simple-mesh-layer-fs 4256precision highp float; 4257uniform sampler2D sampler; 4258in vec2 vTexCoord; 4259in vec3 cameraPosition; 4260in vec3 normals_commonspace; 4261in vec4 position_commonspace; 4262in vec4 vColor; 4263out vec4 fragColor; 4264void main(void) { 4265geometry.uv = vTexCoord; 4266vec3 normal; 4267if (simpleMesh.flatShading) { 4268normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); 4269} else { 4270normal = normals_commonspace; 4271} 4272vec4 color = simpleMesh.hasTexture ? texture(sampler, vTexCoord) : vColor; 4273DECKGL_FILTER_COLOR(color, geometry); 4274vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal); 4275fragColor = vec4(lightColor, color.a * layer.opacity); 4276} 4277`;function Eb(r){const e=r.positions||r.POSITION;Zr.assert(e,'no "postions" or "POSITION" attribute in mesh');const t=e.value.length/e.size;let n=r.COLOR_0||r.colors;n||(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 hP(r){return r instanceof Zs?(r.attributes=Eb(r.attributes),r):r.attributes?new Zs({...r,topology:"triangle-list",attributes:Eb(r.attributes)}):new Zs({topology:"triangle-list",attributes:Eb(r)})}const Zce=[0,0,0,255],Yce={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:Zce},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 Cs{getShaders(){return super.getShaders({vs:Jce,fs:Kce,modules:[Ls,Tx,ma,qce]})}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}=hP(t);n.POSITION=n.POSITION||n.positions,e=E4(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:NL}),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 oi&&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:l}=this.props,f={sizeScale:s,composeModelMatrix:!l||UL(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:hP(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=Yce;ah.layerName="SimpleMeshLayer";var ml;(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"})(ml||(ml={}));function zL(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&&Qce(r,e,i),i}function Qce(r,e,t){if(t.uniforms.unlit=!!e.unlit,e.pbrMetallicRoughness&&eue(r,e.pbrMetallicRoughness,t),e.normalTexture){qA(r,e.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",t);const{scale:n=1}=e.normalTexture;t.uniforms.normalScale=n}if(e.occlusionTexture){qA(r,e.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",t);const{strength:n=1}=e.occlusionTexture;t.uniforms.occlusionStrength=n}switch(e.emissiveTexture&&(qA(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":Yt.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=ml.FUNC_ADD,t.glParameters.blendFunc=[ml.SRC_ALPHA,ml.ONE_MINUS_SRC_ALPHA,ml.ONE,ml.ONE_MINUS_SRC_ALPHA];break}}function eue(r,e,t){e.baseColorTexture&&qA(r,e.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",t),t.uniforms.baseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&qA(r,e.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",t);const{metallicFactor:n=1,roughnessFactor:i=1}=e;t.uniforms.metallicRoughnessValues=[n,i]}function qA(r,e,t,n=null,i){const s=e?.texture?.sampler?.parameters||{},o=e.texture.source.image;let l,f={};o.compressed?(l=o,f={[ml.TEXTURE_MIN_FILTER]:o.data.length>1?ml.LINEAR_MIPMAP_NEAREST:ml.LINEAR}):l={data:o};const A=r.createTexture({id:e.uniformName||e.id,parameters:{...s,...f},pixelStore:{[ml.UNPACK_FLIP_Y_WEBGL]:!1},...l});i.bindings[t]=A,n&&(i.defines[n]=1),i.generatedTextures.push(A)}const tue={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rue={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};class nue{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})=>{uue(n,i,s,o),oue(s,s._node)})}}class iue{animations;constructor(e){this.animations=e.animations.map((t,n)=>{const i=t.name||`Animation-${n}`,s=t.samplers.map(({input:l,interpolation:f="LINEAR",output:A})=>({input:dP(e.accessors[l]),interpolation:f,output:dP(e.accessors[A])})),o=t.channels.map(({sampler:l,target:f})=>({sampler:s[l],target:e.nodes[f.node],path:f.path}));return new nue({name:i,channels:o})})}animate(e){this.setTime(e)}setTime(e){this.animations.forEach(t=>t.animate(e))}getAnimations(){return this.animations}}function dP(r){if(!r._animation){const e=rue[r.componentType],t=tue[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 l=[];for(let f=0;f<o.length;f+=t)l.push(Array.from(o.slice(f,f+t)));r._animation=l}}return r._animation}const sue=new vn;function oue(r,e){if(e.matrix.identity(),r.translation&&e.matrix.translate(r.translation),r.rotation){const t=sue.fromQuaternion(r.rotation);e.matrix.multiplyRight(t)}r.scale&&e.matrix.scale(r.scale)}const Cb=new YA;function aue(r,e,t,n,i){if(e==="rotation"){Cb.slerp({start:t,target:n,ratio:i});for(let s=0;s<Cb.length;s++)r[e][s]=Cb[s]}else for(let s=0;s<t.length;s++)r[e][s]=i*n[s]+(1-i)*t[s]}function lue(r,e,{p0:t,outTangent0:n,inTangent1:i,p1:s,tDiff:o,ratio:l}){for(let f=0;f<r[e].length;f++){const A=n[f]*o,v=i[f]*o;r[e][f]=(2*Math.pow(l,3)-3*Math.pow(l,2)+1)*t[f]+(Math.pow(l,3)-2*Math.pow(l,2)+l)*A+(-2*Math.pow(l,3)+3*Math.pow(l,2))*s[f]+(Math.pow(l,3)-Math.pow(l,2))*v}}function cue(r,e,t){for(let n=0;n<t.length;n++)r[e][n]=t[n]}function uue(r,{input:e,interpolation:t,output:n},i,s){const o=e[e.length-1],l=r%o,f=e.findIndex(I=>I>=l),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:Yt.warn(`Bad animation path ${s}`)()}const v=e[A],T=e[f];switch(t){case"STEP":cue(i,s,n[A]);break;case"LINEAR":if(T>v){const I=(l-v)/(T-v);aue(i,s,n[A],n[f],I)}break;case"CUBICSPLINE":if(T>v){const I=(l-v)/(T-v),F=T-v,N=n[3*A+1],U=n[3*A+2],$=n[3*f+0],V=n[3*f+1];lue(i,s,{p0:N,outTangent0:U,inTangent1:$,p1:V,tDiff:F,ratio:I})}break;default:Yt.warn(`Interpolation ${t} not supported`)();break}}const fue=` 4278layout(0) positions: vec4; // in vec4 POSITION; 4279 4280 #ifdef HAS_NORMALS 4281 in vec4 normals; // in vec4 NORMAL; 4282 #endif 4283 4284 #ifdef HAS_TANGENTS 4285 in vec4 TANGENT; 4286 #endif 4287 4288 #ifdef HAS_UV 4289 // in vec2 TEXCOORD_0; 4290 in vec2 texCoords; 4291 #endif 4292 4293@vertex 4294 void main(void) { 4295 vec4 _NORMAL = vec4(0.); 4296 vec4 _TANGENT = vec4(0.); 4297 vec2 _TEXCOORD_0 = vec2(0.); 4298 4299 #ifdef HAS_NORMALS 4300 _NORMAL = normals; 4301 #endif 4302 4303 #ifdef HAS_TANGENTS 4304 _TANGENT = TANGENT; 4305 #endif 4306 4307 #ifdef HAS_UV 4308 _TEXCOORD_0 = texCoords; 4309 #endif 4310 4311 pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0); 4312 gl_Position = u_MVPMatrix * positions; 4313 } 4314 4315@fragment 4316 out vec4 fragmentColor; 4317 4318 void main(void) { 4319 vec3 pos = pbr_vPosition; 4320 fragmentColor = pbr_filterColor(vec4(1.0)); 4321 } 4322`,hue=`#version 300 es 4323 4324 // in vec4 POSITION; 4325 in vec4 positions; 4326 4327 #ifdef HAS_NORMALS 4328 // in vec4 NORMAL; 4329 in vec4 normals; 4330 #endif 4331 4332 #ifdef HAS_TANGENTS 4333 in vec4 TANGENT; 4334 #endif 4335 4336 #ifdef HAS_UV 4337 // in vec2 TEXCOORD_0; 4338 in vec2 texCoords; 4339 #endif 4340 4341 void main(void) { 4342 vec4 _NORMAL = vec4(0.); 4343 vec4 _TANGENT = vec4(0.); 4344 vec2 _TEXCOORD_0 = vec2(0.); 4345 4346 #ifdef HAS_NORMALS 4347 _NORMAL = normals; 4348 #endif 4349 4350 #ifdef HAS_TANGENTS 4351 _TANGENT = TANGENT; 4352 #endif 4353 4354 #ifdef HAS_UV 4355 _TEXCOORD_0 = texCoords; 4356 #endif 4357 4358 pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0); 4359 gl_Position = pbrProjection.modelViewProjectionMatrix * positions; 4360 } 4361`,due=`#version 300 es 4362 out vec4 fragmentColor; 4363 4364 void main(void) { 4365 vec3 pos = pbr_vPosition; 4366 fragmentColor = pbr_filterColor(vec4(1.0)); 4367 } 4368`;function pue(r,e){const{id:t,geometry:n,material:i,vertexCount:s,materialOptions:o,modelOptions:l}=e,f=zL(r,i,n.attributes,o);Yt.info(4,"createGLTFModel defines: ",f.defines)();const A=[],v={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},T={id:t,source:fue,vs:hue,fs:due,geometry:n,topology:n.topology,vertexCount:s,modules:[Ex],...l,defines:{...f.defines,...l.defines},parameters:{...v,...f.parameters,...l.parameters}},I=new Di(r,T),{camera:F,...N}={...f.uniforms,...l.uniforms,...f.bindings,...l.bindings};return I.shaderInputs.setProps({pbrMaterial:N,pbrProjection:{camera:F}}),new U1({managedResources:A,model:I})}var Hf;(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"})(Hf||(Hf={}));function Aue(r){switch(r){case Hf.POINTS:return"point-list";case Hf.LINES:return"line-list";case Hf.LINE_STRIP:return"line-strip";case Hf.TRIANGLES:return"triangle-list";case Hf.TRIANGLE_STRIP:return"triangle-strip";default:throw new Error(String(r))}}const gue={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1};class mue{device;options;gltf;constructor(e,t={}){this.device=e,this.options={...gue,...t}}instantiate(e){return this.gltf=E2(e),(this.gltf.scenes||[]).map(n=>this.createScene(n))}createAnimator(){return Array.isArray(this.gltf.animations)?new iue(this.gltf):null}createScene(e){const n=(e.nodes||[]).map(s=>this.createNode(s));
4368return new Qd({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 Qd({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)=>this.createPrimitive(s,o,e)),i=new Qd({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=Aue(e.mode||4),o=e.indices?e.indices.count:this.getVertexCount(e.attributes),l=pue(this.device,{id:i,geometry:this.createGeometry(i,e,s),material:e.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:o});return l.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],l}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:l,size:f,value:A}=o;i[s]={size:f??l,value:A}}return new Zs({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 E2(r){if(ArrayBuffer.isView(r)||r instanceof ArrayBuffer||r instanceof ImageBitmap)return r;if(Array.isArray(r))return r.map(E2);if(r&&typeof r=="object"){const e={};for(const t in r)e[t]=E2(r[t]);return e}return r}function _ue(r,e,t){const n=new mue(r,t),i=n.instantiate(e),s=n.createAnimator();return{scenes:i,animator:s}}async function yue(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 vue(()=>e.some(t=>!t.loaded))}async function vue(r){for(;r();)await new Promise(e=>requestAnimationFrame(e))}const pP=`uniform scenegraphUniforms { 4369 float sizeScale; 4370 float sizeMinPixels; 4371 float sizeMaxPixels; 4372 mat4 sceneModelMatrix; 4373 bool composeModelMatrix; 4374} scenegraph; 4375`,bue={name:"scenegraph",vs:pP,fs:pP,uniformTypes:{sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",sceneModelMatrix:"mat4x4<f32>",composeModelMatrix:"f32"}},xue=`#version 300 es 4376#define SHADER_NAME scenegraph-layer-vertex-shader 4377in vec3 instancePositions; 4378in vec3 instancePositions64Low; 4379in vec4 instanceColors; 4380in vec3 instancePickingColors; 4381in vec3 instanceModelMatrixCol0; 4382in vec3 instanceModelMatrixCol1; 4383in vec3 instanceModelMatrixCol2; 4384in vec3 instanceTranslation; 4385in vec3 positions; 4386#ifdef HAS_UV 4387in vec2 texCoords; 4388#endif 4389#ifdef LIGHTING_PBR 4390#ifdef HAS_NORMALS 4391in vec3 normals; 4392#endif 4393#endif 4394out vec4 vColor; 4395#ifndef LIGHTING_PBR 4396#ifdef HAS_UV 4397out vec2 vTEXCOORD_0; 4398#endif 4399#endif 4400void main(void) { 4401#if defined(HAS_UV) && !defined(LIGHTING_PBR) 4402vTEXCOORD_0 = texCoords; 4403geometry.uv = texCoords; 4404#endif 4405geometry.worldPosition = instancePositions; 4406geometry.pickingColor = instancePickingColors; 4407mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); 4408vec3 normal = vec3(0.0, 0.0, 1.0); 4409#ifdef LIGHTING_PBR 4410#ifdef HAS_NORMALS 4411normal = instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(normals, 0.0)).xyz; 4412#endif 4413#endif 4414float originalSize = project_size_to_pixel(scenegraph.sizeScale); 4415float clampedSize = clamp(originalSize, scenegraph.sizeMinPixels, scenegraph.sizeMaxPixels); 4416vec3 pos = (instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(positions, 1.0)).xyz) * scenegraph.sizeScale * (clampedSize / originalSize) + instanceTranslation; 4417if(scenegraph.composeModelMatrix) { 4418DECKGL_FILTER_SIZE(pos, geometry); 4419geometry.normal = project_normal(normal); 4420geometry.worldPosition += pos; 4421gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 4422} 4423else { 4424pos = project_size(pos); 4425DECKGL_FILTER_SIZE(pos, geometry); 4426gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position); 4427geometry.normal = project_normal(normal); 4428} 4429DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4430#ifdef LIGHTING_PBR 4431pbr_vPosition = geometry.position.xyz; 4432#ifdef HAS_NORMALS 4433pbr_vNormal = geometry.normal; 4434#endif 4435#ifdef HAS_UV 4436pbr_vUV = texCoords; 4437#else 4438pbr_vUV = vec2(0., 0.); 4439#endif 4440geometry.uv = pbr_vUV; 4441#endif 4442vColor = instanceColors; 4443DECKGL_FILTER_COLOR(vColor, geometry); 4444} 4445`,wue=`#version 300 es 4446#define SHADER_NAME scenegraph-layer-fragment-shader 4447in vec4 vColor; 4448out vec4 fragColor; 4449#ifndef LIGHTING_PBR 4450#if defined(HAS_UV) && defined(HAS_BASECOLORMAP) 4451in vec2 vTEXCOORD_0; 4452uniform sampler2D pbr_baseColorSampler; 4453#endif 4454#endif 4455void main(void) { 4456#ifdef LIGHTING_PBR 4457fragColor = vColor * pbr_filterColor(vec4(0)); 4458geometry.uv = pbr_vUV; 4459#else 4460#if defined(HAS_UV) && defined(HAS_BASECOLORMAP) 4461fragColor = vColor * texture(pbr_baseColorSampler, vTEXCOORD_0); 4462geometry.uv = vTEXCOORD_0; 4463#else 4464fragColor = vColor; 4465#endif 4466#endif 4467fragColor.a *= layer.opacity; 4468DECKGL_FILTER_COLOR(fragColor, geometry); 4469} 4470`,VL=[255,255,255,255],Tue={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 4470-4510
4470,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:VL},_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:[i_]};class Bg extends Cs{getShaders(){const e={};let t;this.props._lighting==="pbr"?(t=Ex,e.LIGHTING_PBR=1):t={name:"pbrMaterial"};const n=[Ls,ma,bue,t];return super.getShaders({defines:e,vs:xue,fs:wue,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:VL,transition:!0},instanceModelMatrix:NL})}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 Jm)n={scenes:[e.scenegraph]};else if(e.scenegraph&&typeof e.scenegraph=="object"){const l=e.scenegraph,f=l.json?wee(l):l,A=_ue(t,f,this._getModelOptions());n={gltf:f,...A},yue(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 Qd){this.state.scenegraph?.destroy(),this._applyAnimationsProp(o,e._animations);const l=[];s.traverse(f=>{f instanceof U1&&l.push(f.model)}),this.setState({scenegraph:s,animator:o,models:l}),this.getAttributeManager().invalidateAll()}else s!==null&&Zr.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):Zr.warn(`animation ${i} not found`)()}else{const o=n.find(({name:l})=>l===i);o?Object.assign(o,s):Zr.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:l}=this.props,f=this.getNumInstances();this.state.scenegraph.traverse((A,{worldMatrix:v})=>{if(A instanceof U1){const{model:T}=A;T.setInstanceCount(f);const I={camera:T.uniforms.cameraPosition},F={sizeScale:i,sizeMinPixels:s,sizeMaxPixels:o,composeModelMatrix:UL(t,l),sceneModelMatrix:v};T.shaderInputs.setProps({pbrProjection:I,scenegraph:F}),T.draw(n)}})}}Bg.defaultProps=Tue;Bg.layerName="ScenegraphLayer";const Eue=Object.freeze(Object.defineProperty({__proto__:null,ScenegraphLayer:Bg,SimpleMeshLayer:ah},Symbol.toStringTag,{value:"Module"})),AP=`uniform meshUniforms { 4471 bool pickFeatureIds; 4472} mesh; 4473`,Cue={name:"mesh",vs:AP,fs:AP,uniformTypes:{pickFeatureIds:"f32"}},Sue=`#version 300 es 4474#define SHADER_NAME simple-mesh-layer-vs 4475in vec3 positions; 4476in vec3 normals; 4477in vec3 colors; 4478in vec2 texCoords; 4479in vec4 uvRegions; 4480in vec3 featureIdsPickingColors; 4481in vec4 instanceColors; 4482in vec3 instancePickingColors; 4483in vec3 instanceModelMatrixCol0; 4484in vec3 instanceModelMatrixCol1; 4485in vec3 instanceModelMatrixCol2; 4486out vec2 vTexCoord; 4487out vec3 cameraPosition; 4488out vec3 normals_commonspace; 4489out vec4 position_commonspace; 4490out vec4 vColor; 4491vec2 applyUVRegion(vec2 uv) { 4492#ifdef HAS_UV_REGIONS 4493return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy; 4494#else 4495return uv; 4496#endif 4497} 4498void main(void) { 4499vec2 uv = applyUVRegion(texCoords); 4500geometry.uv = uv; 4501if (mesh.pickFeatureIds) { 4502geometry.pickingColor = featureIdsPickingColors; 4503} else { 4504geometry.pickingColor = instancePickingColors; 4505} 4506mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); 4507vTexCoord = uv; 4508cameraPosition = project.cameraPosition; 4509vColor = vec4(colors * instanceColors.rgb, instanceColors.a); 4510vec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale;
4511vec3 projectedPosition = project_position(positions); 4512position_commonspace = vec4(projectedPosition, 1.0); 4513gl_Position = project_common_position_to_clipspace(position_commonspace); 4514geometry.position = position_commonspace; 4515normals_commonspace = project_normal(instanceModelMatrix * normals); 4516geometry.normal = normals_commonspace; 4517DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4518#ifdef MODULE_PBRMATERIAL 4519pbr_vPosition = geometry.position.xyz; 4520#ifdef HAS_NORMALS 4521pbr_vNormal = geometry.normal; 4522#endif 4523#ifdef HAS_UV 4524pbr_vUV = uv; 4525#else 4526pbr_vUV = vec2(0., 0.); 4527#endif 4528geometry.uv = pbr_vUV; 4529#endif 4530DECKGL_FILTER_COLOR(vColor, geometry); 4531} 4532`,Iue=`#version 300 es 4533#define SHADER_NAME simple-mesh-layer-fs 4534precision highp float; 4535uniform sampler2D sampler; 4536in vec2 vTexCoord; 4537in vec3 cameraPosition; 4538in vec3 normals_commonspace; 4539in vec4 position_commonspace; 4540in vec4 vColor; 4541out vec4 fragColor; 4542void main(void) { 4543#ifdef MODULE_PBRMATERIAL 4544fragColor = vColor * pbr_filterColor(vec4(0)); 4545geometry.uv = pbr_vUV; 4546fragColor.a *= layer.opacity; 4547#else 4548geometry.uv = vTexCoord; 4549vec3 normal; 4550if (simpleMesh.flatShading) { 4551normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); 4552} else { 4553normal = normals_commonspace; 4554} 4555vec4 color = simpleMesh.hasTexture ? texture(sampler, vTexCoord) : vColor; 4556vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal); 4557fragColor = vec4(lightColor, color.a * layer.opacity); 4558#endif 4559DECKGL_FILTER_COLOR(fragColor, geometry); 4560} 4561`;function Bue(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 Pue={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}};class Fw extends ah{getShaders(){const e=super.getShaders();return e.modules.push(Ex,Cue),{...e,vs:Sue,fs:Iue}}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 Bue(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,l={sampler:s||o,hasTexture:!!s},{camera:f,...A}={...i.bindings,...i.uniforms};t.shaderInputs.setProps({simpleMesh:l,pbrMaterial:A})}}parseMaterial(e,t){const n=!!(e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture);return zL(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})}}Fw.layerName="MeshLayer";Fw.defaultProps=Pue;const Mue=6378137,Rue=6378137,Oue=6356752314245179e-9;function iy(r){return r}new dt;function Due(r,e=[],t=iy){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 Fue(r,e=[]){return Due(r,e,Es._cartographicRadians?iy:E7)}function Lue(r,e,t=iy){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 kue(r,e){return Lue(r,e,Es._cartographicRadians?iy:C7)}const gP=1e-14,Nue=new dt,mP={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"}},Sb={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_A={east:new dt,north:new dt,up:new dt,west:new dt,south:new dt,down:new dt},Uue=new dt,zue=new dt,Vue=new dt;function _P(r,e,t,n,i,s){const o=mP[e]&&mP[e][t];gl(o&&(!n||n===o));let l,f,A;
vendor: 38,318 bytes, line 4561
4561const v=Nue.copy(i);if(ga(v.x,0,gP)&&ga(v.y,0,gP)){const I=Math.sign(v.z);l=Uue.fromArray(Sb[e]),e!=="east"&&e!=="west"&&l.scale(I),f=zue.fromArray(Sb[t]),t!=="east"&&t!=="west"&&f.scale(I),A=Vue.fromArray(Sb[n]),n!=="east"&&n!=="west"&&A.scale(I)}else{const{up:I,east:F,north:N}=_A;F.set(-v.y,v.x,0).normalize(),r.geodeticSurfaceNormal(v,I),N.copy(I).cross(F);const{down:U,west:$,south:V}=_A;U.copy(I).scale(-1),$.copy(F).scale(-1),V.copy(N).scale(-1),l=_A[e],f=_A[t],A=_A[n]}return s[0]=l.x,s[1]=l.y,s[2]=l.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}const md=new dt,Gue=new dt,jue=new dt;function Hue(r,e,t=[]){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:s}=e;md.from(r);const o=md.x,l=md.y,f=md.z,A=n.x,v=n.y,T=n.z,I=o*o*A*A,F=l*l*v*v,N=f*f*T*T,U=I+F+N,$=Math.sqrt(1/U);if(!Number.isFinite($))return;const V=Gue;if(V.copy(r).scale($),U<s)return V.to(t);const j=i.x,X=i.y,ue=i.z,K=jue;K.set(V.x*j*2,V.y*X*2,V.z*ue*2);let se=(1-$)*md.len()/(.5*K.len()),Ee=0,Ue,de,me,pe;do{se-=Ee,Ue=1/(1+se*j),de=1/(1+se*X),me=1/(1+se*ue);const W=Ue*Ue,re=de*de,Ce=me*me,et=W*Ue,_e=re*de,Le=Ce*me;pe=I*W+F*re+N*Ce-1;const Ye=-2*(I*et*j+F*_e*X+N*Le*ue);Ee=pe/Ye}while(Math.abs(pe)>WV);return md.scale([Ue,de,me]).to(t)}const X0=new dt,yP=new dt,Wue=new dt,cl=new dt,$ue=new dt,q0=new dt;class bi{constructor(e=0,t=0,n=0){this.centerToleranceSquared=HV,gl(e>=0),gl(t>=0),gl(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=yP,i=Wue,[,,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]){q0.from(e);const n=this.scaleToGeodeticSurface(q0,cl);if(!n)return;const i=this.geodeticSurfaceNormal(n,yP),s=$ue;s.copy(q0).subtract(n);const o=Math.atan2(i.y,i.x),l=Math.asin(i.z),f=Math.sign(yx(s,q0))*EO(s);return kue([o,l,f],t)}eastNorthUpToFixedFrame(e,t=new vn){return _P(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,n,i,s=new vn){return _P(this,e,t,n,i,s)}geocentricSurfaceNormal(e,t=[0,0,0]){return X0.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const n=Fue(e),i=n[0],s=n[1],o=Math.cos(s);return X0.set(o*Math.cos(i),o*Math.sin(i),Math.sin(s)).normalize(),X0.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return X0.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return Hue(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){cl.from(e);const n=cl.x,i=cl.y,s=cl.z,o=this.oneOverRadiiSquared,l=1/Math.sqrt(n*n*o.x+i*i*o.y+s*s*o.z);return cl.multiplyScalar(l).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return cl.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return cl.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,n=[0,0,0]){gl(ga(this.radii.x,this.radii.y,LO)),gl(this.radii.z>0),cl.from(e);const i=cl.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-t))return cl.set(0,0,i).to(n)}}bi.WGS84=new bi(Mue,Rue,Oue);class Xue{item;previous;next;constructor(e,t,n){this.item=e,this.previous=t,this.next=n}}class que{head=null;tail=null;_length=0;get length(){return this._length}add(e){const t=new Xue(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 Jue{_list;_sentinel;_trimTiles;constructor(){this._list=new que,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 l=i.head;for(;l!==o&&(e.gpuMemoryUsageInBytes>s||n);){const f=l.item;l=l.next,this.unloadTile(e,f,t)}}trim(){this._trimTiles=!0}}function Kue(r,e){Ri(r),Ri(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 T=new vn().rotateX(Math.PI/2);o=o.multiplyRight(T);break;case"X":const I=new vn().rotateY(-Math.PI/2);o=o.multiplyRight(I);break}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const l=new dt(s);e.cartesianModelMatrix=o,e.cartesianOrigin=l;const f=bi.WGS84.cartesianToCartographic(l,new dt),v=bi.WGS84.eastNorthUpToFixedFrame(l).invert();e.cartographicModelMatrix=v.multiplyRight(o),e.cartographicOrigin=f,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}const vP=new dt,Ib=new dt,C2=new pa([new Al,new Al,new Al,new Al,new Al,new Al]);function Zue(r,e){const{cameraDirection:t,cameraUp:n,height:i}=r,{metersPerUnit:s}=r.distanceScales,o=Pm(r,r.center),l=bi.WGS84.eastNorthUpToFixedFrame(o),f=r.unprojectPosition(r.cameraPosition),A=bi.WGS84.cartographicToCartesian(f,new dt),v=new dt(l.transformAsVector(new dt(t).scale(s))).normalize(),T=new dt(l.transformAsVector(new dt(n).scale(s))).normalize();Que(r);const I=r.constructor,{longitude:F,latitude:N,width:U,bearing:$,zoom:V}=r,j=new I({longitude:F,latitude:N,height:i,width:U,bearing:$,zoom:V,pitch:0});return{camera:{position:A,direction:v,up:T},viewport:r,topDownViewport:j,height:i,cullingVolume:C2,frameNumber:e,sseDenominator:1.15}}function Yue(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[T,I]=v.header.mbs,F=Math.abs(i-T),N=Math.abs(s-I),U=Math.sqrt(N*N+F*F);n.push([A,U])}const o=n.sort((A,v)=>A[1]-v[1]),l=[];for(let A=0;A<t;A++)l.push(r[o[A][0]]);const f=[];for(let A=t;A<o.length;A++)f.push(r[o[A][0]]);return[l,f]}function Que(r){const e=r.getFrustumPlanes(),t=bP(e.near,r.cameraPosition),n=Pm(r,t),i=Pm(r,r.cameraPosition,Ib);let s=0;C2.planes[s++].fromPointNormal(n,vP.copy(n).subtract(i));for(const o in e){if(o==="near")continue;const l=e[o],f=bP(l,t,Ib),A=Pm(r,f,Ib);C2.planes[s++].fromPointNormal(A,vP.copy(n).subtract(A))}}function bP(r,e,t=new dt){const n=r.normal.dot(e);return t.copy(r.normal).scale(r.distance-n).add(e),t}function Pm(r,e,t=new dt){const n=r.unprojectPosition(e);return bi.WGS84.cartographicToCartesian(n,t)}const efe=6378137,tfe=6378137,S2=6356752314245179e-9,Jd=new dt;function rfe(r,e){if(r instanceof Ig){const{halfAxes:t}=r,n=ife(t);return Math.log2(S2/(n+e[2]))}else if(r instanceof Sg){const{radius:t}=r;return Math.log2(S2/(t+e[2]))}else if(r.width&&r.height){const{width:t,height:n}=r,i=Math.log2(efe/t),s=Math.log2(tfe/n);return(i+s)/2}return 1}function jL(r,e,t){bi.WGS84.cartographicToCartesian([r.xmax,r.ymax,r.zmax],Jd);const n=Math.sqrt(Math.pow(Jd[0]-t[0],2)+Math.pow(Jd[1]-t[1],2)+Math.pow(Jd[2]-t[2],2));return Math.log2(S2/(n+e[2]))}function nfe(r,e,t){const[n,i,s,o]=r;return jL({xmax:s,ymax:o,zmax:0},e,t)}function ife(r){r.getColumn(0,Jd);const e=r.getColumn(1),t=r.getColumn(2);return Jd.add(e).add(t).len()}const ca={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5};var Tl;(function(r){r[r.ADD=1]="ADD",r[r.REPLACE=2]="REPLACE"})(Tl||(Tl={}));var qc;(function(r){r.EMPTY="empty",r.SCENEGRAPH="scenegraph",r.POINTCLOUD="pointcloud",r.MESH="mesh"})(qc||(qc={}));var zo;(function(r){r.I3S="I3S",r.TILES3D="TILES3D"})(zo||(zo={}));var vp;(function(r){r.GEOMETRIC_ERROR="geometricError",r.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(vp||(vp={}));const sfe={USE_OPTIMIZATION:1};function HL(r){return r!=null}const mo=new dt,Mm=new dt,ofe=new dt,afe=new dt,Nf=new dt,xP=new dt,wP=new dt,TP=new dt;function Bb(r,e,t){if(Ri(r,"3D Tile: boundingVolume must be defined"),r.box)return WL(r.box,e,t);if(r.region)return ufe(r.region);if(r.sphere)return cfe(r.sphere,e,t);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function lfe(r,e){if(r.box)return ffe(e);if(r.region){const[t,n,i,s,o,l]=r.region;return[[pl(t),pl(n),o],[pl(i),pl(s),l]]}if(r.sphere)return hfe(e);throw new Error("Unkown boundingVolume type")}function WL(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 YA;v.fromArray(r,6);const T=new dt([1,0,0]),I=new dt([0,1,0]),F=new dt([0,0,1]);T.transformByQuaternion(v),T.scale(A[0]),I.transformByQuaternion(v),I.scale(A[1]),F.transformByQuaternion(v),F.scale(A[2]),i=[...T.toArray(),...I.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)),l=e.transformAsVector(i.slice(6,9)),f=new Oi([s[0],s[1],s[2],o[0],o[1],o[2],l[0],l[1],l[2]]);return HL(t)?(t.center=n,t.halfAxes=f,t):new Ig(n,f)}function cfe(r,e,t){const n=new dt(r[0],r[1],r[2]);e.transform(n,n);const i=e.getScale(Mm),s=Math.max(Math.max(i[0],i[1]),i[2]),o=r[3]*s;return HL(t)?(t.center=n,t.radius=o,t):new Sg(n,o)}function ufe(r){const[e,t,n,i,s,o]=r,l=bi.WGS84.cartographicToCartesian([pl(e),pl(i),s],ofe),f=bi.WGS84.cartographicToCartesian([pl(n),pl(t),o],afe),A=new dt().addVectors(l,f).multiplyByScalar(.5);return bi.WGS84.cartesianToCartographic(A,Nf),bi.WGS84.cartographicToCartesian([pl(n),Nf[1],Nf[2]],xP),bi.WGS84.cartographicToCartesian([Nf[0],pl(i),Nf[2]],wP),bi.WGS84.cartographicToCartesian([Nf[0],Nf[1],o],TP),WL([...A,...xP.subtract(A),...wP.subtract(A),...TP.subtract(A)],new vn)}function ffe(r){const e=$L(),{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 l=0;l<2;l++){for(let f=0;f<2;f++)mo.copy(r.center),mo.add(n),mo.add(i),mo.add(s),XL(e,mo),s.negate();i.negate()}n.negate()}return e}function hfe(r){const e=$L(),{center:t,radius:n}=r,i=bi.WGS84.scaleToGeodeticSurface(t,mo);let s;i?s=bi.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 l=o.clone().cross(s);for(const f of[o,l,s]){Mm.copy(f).scale(n);for(let A=0;A<2;A++)mo.copy(t),mo.add(Mm),XL(e,mo),Mm.negate()}return e}function $L(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function XL(r,e){bi.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 dfe(r,e){const t=r*e;return 1-Math.exp(-(t*t))}function pfe(r,e){if(r.dynamicScreenSpaceError&&r.dynamicScreenSpaceErrorComputedDensity){const t=r.dynamicScreenSpaceErrorComputedDensity,n=r.dynamicScreenSpaceErrorFactor;return dfe(e,t)*n}return 0}function Afe(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:l,sseDenominator:f}=e,{viewDistanceScale:A}=n.options;let v=s*l*(A||1)/(o*f);return v-=pfe(n,o),v}const Pb=new dt,EP=new dt,Lu=new dt,CP=new dt,gfe=new dt,Mb=new vn,SP=new vn;function mfe(r,e){if(r.lodMetricValue===0||isNaN(r.lodMetricValue))return"DIG";const t=2*qL(r,e);return t<2?"OUT":!r.header.children||t<=r.lodMetricValue?"DRAW":r.header.children?"DIG":"OUT"}function qL(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],l=[...r.boundingVolume.center],f=t.unprojectPosition(t.cameraPosition);bi.WGS84.cartographicToCartesian(f,Pb),EP.copy(Pb).subtract(l).normalize(),bi.WGS84.eastNorthUpToFixedFrame(l,Mb),SP.copy(Mb).invert(),Lu.copy(Pb).transform(SP);const A=Math.sqrt(Lu[0]*Lu[0]+Lu[1]*Lu[1]),v=A*A/Lu[2];CP.copy([Lu[0],Lu[1],v]);const I=CP.transform(Mb).subtract(l).normalize(),N=EP.cross(I).normalize().scale(o).add(l),U=bi.WGS84.cartesianToCartographic(N),$=t.project([i,n,s]),V=t.project(U);return gfe.copy($).subtract(V).magnitude()}function _fe(r){return{assetGltfUpAxis:r.asset&&r.asset.gltfUpAxis||"Y"}}class IP{_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 Ri(e<this._array.length),this._array[e]}set(e,t){Ri(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){Ri(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){Ri(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 yfe={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class sy{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new IP;_emptyTraversalStack=new IP;_frameNumber=null;traversalFinished(e){return!0}constructor(e){this.options={...yfe,...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 l=s.parent,f=!!(!l||l._shouldRefine),A=!o;s.hasRenderContent?s.refine===Tl.ADD?(this.loadTile(s,t),this.selectTile(s,t)):s.refine===Tl.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,l=e.children;l.sort(this.compareDistanceToCamera.bind(this));const f=e.refine===Tl.REPLACE&&e.hasRenderContent&&!o;let A=!1,v=!0;for(const T of l)if(T._selectionDepth=i,T.isVisibleAndInRequestVolume?(n.find(T)&&n.delete(T),n.push(T),A=!0):(f||s)&&(this.loadTile(T,t),this.touchTile(T,t)),f){let I;if(T._inRequestVolume?T.hasRenderContent?I=T.contentAvailable:I=this.executeEmptyTraversal(T,t):I=!1,v=v&&I,!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._getPriority(),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),l=!s.hasRenderContent&&s.children.length===0;if(!o&&!s.contentAvailable&&!l&&(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 BP=new dt;function vfe(r){return r!=null}class I2{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=ca.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new vn;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new sy({});_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===ca.READY||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===ca.UNLOADED}get contentExpired(){return this.contentState===ca.EXPIRED}get contentFailed(){return this.contentState===ca.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=lfe(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(e,t){switch(this.tileset.type){case zo.I3S:return qL(this,e);case zo.TILES3D:return Afe(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===Tl.ADD||t;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===ca.UNLOADED)return-1;const i=this.parent,o=i&&(!n||this._screenSpaceError===0||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,l=e.root?e.root._screenSpaceError:0;return Math.max(l-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=ca.LOADING;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=ca.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 Kc(n,i,s),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=ca.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=ca.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=ca.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 BP.subVectors(t.center,e.position),e.direction.dot(BP)}insideViewerRequestVolume(e){const t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(vfe(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){const e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=ca.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=ca.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||Tl.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=Bb(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Bb(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Bb(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 _fe(this.tileset.tileset)}}}class bfe extends sy{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===Tl.REPLACE,s=e._optimChildrenWithinParent===sfe.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!==Tl.ADD?!1:!this.shouldRefine(e,t,!0)}}class xfe{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 Rb={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"};class wfe{_statusMap;pendingTilesRegister=new xfe;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:Rb.REQUESTED},this.pendingTilesRegister.register(o,s),e().then(l=>{this._statusMap[t].status=Rb.COMPLETED;const{frameNumber:f,viewport:{id:A}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(A,f),this._statusMap[t].callback(l,i)}).catch(l=>{this._statusMap[t].status=Rb.ERROR;const{frameNumber:f,viewport:{id:A}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(A,f),n(l)})}}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 Tfe extends sy{_tileManager;constructor(e){super(e),this._tileManager=new wfe}traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}shouldRefine(e,t){return e._lodJudge=mfe(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 l=`${o.id}-${t.viewport.id}`,f=i&&i.find(A=>A.id===l);if(f)f&&this.updateTile(f,t);else{let A=()=>this._loadTile(o.id,s);this._tileManager.find(l)?this._tileManager.update(l,t):(s.tileset.nodePages&&(A=()=>s.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(A,l,T=>this._onTileLoad(T,e,l),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 Kc(i,n,s)}_onTileLoad(e,t,n){const i=new I2(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 Efe={description:"",ellipsoid:bi.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:{}},J0="Tiles In Tileset(s)",Ob="Tiles In Memory",PP="Tiles In View",MP="Tiles To Render",RP="Tiles Loaded",Db="Tiles Loading",OP="Tiles Unloaded",DP="Failed Tile Loads",FP="Points/Vertices",Fb="Tile Memory Use",LP="Maximum Screen Space Error";class Cfe{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 Jue;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(e,t){this.options={...Efe,...t},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||hL(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 boe({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 hh({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=Zue(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]=Yue(i,e,this.options.maximumTilesSelected);n.selectedTiles=s;for(const l of o)l.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(PP).count=this.selectedTiles.length,this.stats.get(MP).count=e,this.stats.get(FP).count=t,this.stats.get(LP).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(e){this.type===zo.I3S&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===zo.TILES3D&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===zo.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){const e=this.tileset.fullExtent;if(e){const{xmin:n,xmax:i,ymin:s,ymax:o,zmin:l,zmax:f}=e;this.cartographicCenter=new dt(n+(i-n)/2,s+(o-s)/2,l+(f-l)/2),this.cartesianCenter=new dt,bi.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=jL(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,bi.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=nfe(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,bi.WGS84.cartesianToCartographic(t,this.cartographicCenter)):this.cartographicCenter=new dt(0,0,-bi.WGS84.radii[0]),this.cartesianCenter=t,this.zoom=rfe(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(J0),this.stats.get(Db),this.stats.get(Ob),this.stats.get(PP),this.stats.get(MP),this.stats.get(RP),this.stats.get(OP),this.stats.get(DP),this.stats.get(FP),this.stats.get(Fb,"memory"),this.stats.get(LP)}_initializeTileHeaders(e,t){const n=new I2(this,e.root,t);if(t&&(t.children.push(n),n.depth=t.depth+1),this.type===zo.TILES3D){const i=[];for(i.push(n);i.length>0;){const s=i.pop();this.stats.get(J0).incrementCount();const o=s.header.children||[];for(const l of o){const f=new I2(this,l,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 zo.TILES3D:e=bfe;break;case zo.I3S:e=Tfe;break;default:e=sy}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(DP).incrementCount();const n=t.message||t.toString(),i=e.url;console.error(`A 3D tile failed to load: ${e.url} ${n}
4561`),this.options.onTileError(e,n,i)}_onTileLoad(e,t){if(t){if(this.type===zo.I3S){const n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(J0).reset(),this.stats.get(J0).addCount(n)}e&&e.content&&Kue(e,e.content),this.updateContentTypes(e),this._addTileToCache(e),this.options.onTileLoad(e)}}updateContentTypes(e){if(this.type===zo.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===zo.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(Db).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Db).decrementCount()}_addTileToCache(e){this._cache.add(this,e,t=>t._updateCacheStats(e))}_updateCacheStats(e){this.stats.get(RP).incrementCount(),this.stats.get(Ob).incrementCount(),this.gpuMemoryUsageInBytes+=e.gpuMemoryUsageInBytes||0,this.stats.get(Fb).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.gpuMemoryUsageInBytes||0,this.stats.get(Ob).decrementCount(),this.stats.get(OP).incrementCount(),this.stats.get(Fb).count=this.gpuMemoryUsageInBytes,this.options.onT
vendor: 45,721 bytes, line 4561
4561ileUnload(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 JL="4.2.4",yA={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GLTF:"glTF"};function KL(r,e,t){Ri(r instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(r,e,t);return n.decode(i)}function Sfe(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 Ife="4.2.4",Bfe={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:Ife,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 Pfe(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 Mfe(r){let e=1/0,t=1/0,n=1/0,i=-1/0,s=-1/0,o=-1/0;const l=r.POSITION?r.POSITION.value:[],f=l&&l.length;for(let A=0;A<f;A+=3){const v=l[A],T=l[A+1],I=l[A+2];e=v<e?v:e,t=T<t?T:t,n=I<n?I:n,i=v>i?v:i,s=T>s?T:s,o=I>o?I:o}return[[e,t,n],[i,s,o]]}function Rfe(r,e,t){const n=Pfe(e.value),i=t||Ofe(e);return{name:r,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:i}}function Ofe(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 Dfe(r,e,t){const n=ZL(e.metadata),i=[],s=Ffe(e.attributes);for(const o in r){const l=r[o],f=kP(o,l,s[o]);i.push(f)}if(t){const o=kP("indices",t);i.push(o)}return{fields:i,metadata:n}}function Ffe(r){const e={};for(const t in r){const n=r[t];e[n.name||"undefined"]=n}return e}function kP(r,e,t){const n=t?ZL(t.metadata):void 0;return Rfe(r,e,n)}function ZL(r){Object.entries(r);const e={};for(const t in r)e[`${t}.string`]=JSON.stringify(r[t]);return e}const NP={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Lfe={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},kfe=4;class Nfe{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 I=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(I)}const l=this._getDracoLoaderData(s,i,t),f=this._getMeshData(s,l,t),A=Mfe(f.attributes),v=Dfe(f.attributes,l,f.indices);return{loader:"draco",loaderData:l,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 l=this._getQuantizationTransform(s,t);l&&(n[s.unique_id()].quantization_transform=l);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 l=this._getAttributeValues(t,s);if(l){const{value:f,size:A}=l;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*kfe,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),Vfe(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const n=Lfe[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,l=o*n.BYTES_PER_ELEMENT,f=Ufe(this.draco,n);let A;const v=this.draco._malloc(l);try{const T=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,T,f,l,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,l]of Object.entries(t.extraAttributes||{}))if(l===n)return o;const i=e.attribute_type;for(const o in NP)if(this.draco[o]===i)return NP[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=zfe(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(l=>o.min_value(l))}}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 Ufe(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 zfe(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function Vfe(r){const e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}const Gfe="1.5.6",jfe="1.4.1",Lb=`https://www.gstatic.com/draco/versioned/decoders/${Gfe}`,Go={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},kb={[Go.DECODER]:`${Lb}/${Go.DECODER}`,[Go.DECODER_WASM]:`${Lb}/${Go.DECODER_WASM}`,[Go.FALLBACK_DECODER]:`${Lb}/${Go.FALLBACK_DECODER}`,[Go.ENCODER]:`https://raw.githubusercontent.com/google/draco/${jfe}/javascript/${Go.ENCODER}`};let Nb;async function Hfe(r){const e=r.modules||{};return e.draco3d?Nb||=e.draco3d.createDecoderModule({}).then(t=>({draco:t})):Nb||=Wfe(r),await Nb}async function Wfe(r){let e,t;switch(r.draco&&r.draco.decoderType){case"js":e=await eh(kb[Go.FALLBACK_DECODER],"draco",r,Go.FALLBACK_DECODER);break;case"wasm":default:[e,t]=await Promise.all([await eh(kb[Go.DECODER],"draco",r,Go.DECODER),await eh(kb[Go.DECODER_WASM],"draco",r,Go.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await $fe(e,t)}function $fe(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r({...t,onModuleLoaded:i=>n({draco:i})})})}const YL={...Bfe,parse:Xfe};async function Xfe(r,e){const{draco:t}=await Hfe(e),n=new Nfe(t);try{return n.parseSync(r,e?.draco)}finally{n.destroy()}}const qfe={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={...qfe,...ps},Ub={[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},Jfe={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},zb="Failed to convert GL type";class ac{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in Ub)if(Ub[t]===e)return t;throw new Error(zb)}static fromName(e){const t=Jfe[e];if(!t)throw new Error(zb);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=Ub[e];if(!t)throw new Error(zb);return t}}static getByteSize(e){return ac.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return!!ac.getArrayType(e)}static createTypedArray(e,t,n=0,i){i===void 0&&(i=(t.byteLength-n)/ac.getByteSize(e));const s=ac.getArrayType(e);return new s(t,n,i)}}function Kfe(r,e){if(!r)throw new Error(`math.gl assertion failed. ${e}`)}function Zfe(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 _x;new dt;new _x;new _x;function UP(r,e=255){return $c(r,0,e)/e*2-1}function zP(r){return r<0?-1:1}function Yfe(r,e,t,n){if(Kfe(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=UP(r,t),n.y=UP(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))*zP(i),n.y=(1-Math.abs(i))*zP(n.y)}return n.normalize()}function Qfe(r,e,t){return Yfe(r,e,255,t)}class Lw{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=ac.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 l=this.getPropertyArray(e,t,n);if(n===1)return l[i];for(let f=0;f<n;++f)s[f]=l[n*i+f];return s}_getTypedArrayFromBinary(e,t,n,i,s){const o=this._cachedTypedArrays;let l=o[e];return l||(l=ac.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+s,i*n),o[e]=l),l}_getTypedArrayFromArray(e,t,n){const i=this._cachedTypedArrays;let s=i[e];return s||(s=ac.createTypedArray(t,n),i[e]=s),s}}const ehe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},the={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]]},rhe={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 nhe(r,e,t,n){const{componentType:i}=r;Ri(r.componentType);const s=typeof i=="string"?ac.fromName(i):i,o=ehe[r.type],l=the[r.type],f=rhe[r.type];return t+=r.byteOffset,{values:ac.createTypedArray(s,e,t,o*n),type:s,size:o,unpacker:l,packer:f}}const sc=r=>r!==void 0;function ihe(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?she(n,t):null}function she(r,e){let t,n,i;const s=r.instancesLength,o=r.classes;let l=r.classIds,f=r.parentCounts,A=r.parentIds,v=s;sc(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,i=getBinaryAccessor(l),l=i.createArrayBufferView(e.buffer,e.byteOffset+l.byteOffset,s));let T;if(sc(f))for(sc(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)),T=new Uint16Array(s),v=0,t=0;t<s;++t)T[t]=v,v+=f[t];sc(A)&&sc(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 I=o.length;for(t=0;t<I;++t){const $=o[t].length,V=o[t].instances,j=getBinaryProperties($,V,e);o[t].instances=combine(j,V)}const F=new Array(I).fill(0),N=new Uint16Array(s);for(t=0;t<s;++t)n=l[t],N[t]=F[n],++F[n];const U={classes:o,classIds:l,classIndexes:N,parentCounts:f,parentIndexes:T,parentIds:A};return lhe(U),U}function vA(r,e,t){if(!r)return;const n=r.parentCounts;return r.parentIds?t(r,e):n>0?ohe(r,e,t):ahe(r,e,t)}function ohe(r,e,t){const n=r.classIds,i=r.parentCounts,s=r.parentIds,o=r.parentIndexes,l=n.length,f=scratchVisited;f.length=Math.max(f.length,l);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 T=t(r,e);if(sc(T))return T;const I=i[e],F=o[e];for(let N=0;N<I;++N){const U=s[F+N];U!==e&&v.push(U)}}return null}function ahe(r,e,t){let n=!0;for(;n;){const i=t(r,e);if(sc(i))return i;const s=r.parentIds[e];n=s!==e,e=s}throw new Error("traverseHierarchySingleParent")}function lhe(r){const t=r.classIds.length;for(let n=0;n<t;++n)QL(r,n,stack)}function QL(r,e,t){const n=r.parentCounts,i=r.parentIds,s=r.parentIndexes,l=r.classIds.length;if(!sc(i))return;assert(e<l,`Parent index ${e} exceeds the total number of instances: ${l}`),assert(t.indexOf(e)===-1,"Circular dependency detected in the batch table hierarchy."),t.push(e);const f=sc(n)?n[e]:1,A=sc(n)?s[e]:e;for(let v=0;v<f;++v){const T=i[A+v];T!==e&&QL(r,T,t)}t.pop(e)}function Uo(r){return r!=null}const K0=(r,e)=>r,che={HIERARCHY:!0,extensions:!0,extras:!0};class e6{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(e,t,n,i={}){Ri(n>=0),this.json=e||{},this.binary=t,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(const s in this.json)che[s]||(this._properties[s]=this.json[s]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=ihe(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),Ri(typeof t=="string",t),this._hierarchy){const n=vA(this._hierarchy,e,(i,s)=>{const o=i.classIds[s];return i.classes[o].name===t});return Uo(n)}return!1}isExactClass(e,t){return Ri(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),Ri(typeof t=="string",t),Uo(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),t=Uo(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),Ri(typeof t=="string",t),this._binaryProperties){const i=this._binaryProperties[t];if(Uo(i))return this._getBinaryProperty(i,e)}const n=this._properties[t];if(Uo(n))return K0(n[e]);if(this._hierarchy){const i=this._getHierarchyProperty(e,t);if(Uo(i))return i}}setProperty(e,t,n){const i=this.featureCount;if(this._checkBatchId(e),Ri(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];Uo(s)||(this._properties[t]=new Array(i),s=this._properties[t]),s[e]=K0(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;Ri(this.binary,`Property ${e} requires a batch table binary.`),Ri(n.type,`Property ${e} requires a type.`);const i=nhe(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=vA(this._hierarchy,e,(i,s)=>{const o=i.classIds[s],l=i.classes[o].instances;return Uo(l[t])});return Uo(n)}_getPropertyNamesInHierarchy(e,t){vA(this._hierarchy,e,(n,i)=>{const s=n.classIds[i],o=n.classes[s].instances;for(const l in o)o.hasOwnProperty(l)&&t.indexOf(l)===-1&&t.push(l)})}_getHierarchyProperty(e,t){return vA(this._hierarchy,e,(n,i)=>{const s=n.classIds[i],o=n.classes[s],l=n.classIndexes[i],f=o.instances[t];return Uo(f)?Uo(f.typedArray)?this._getBinaryProperty(f,l):K0(f[l]):null})}_setHierarchyProperty(e,t,n,i){const s=vA(this._hierarchy,t,(o,l)=>{const f=o.classIds[l],A=o.classes[f],v=o.classIndexes[l],T=A.instances[n];return Uo(T)?(Ri(l===t,`Inherited property "${n}" is read-only.`),Uo(T.typedArray)?this._setBinaryProperty(T,v,i):T[v]=K0(i),!0):!1});return Uo(s)}}const Vb=4;function oy(r,e,t=0){const n=new DataView(e);if(r.magic=n.getUint32(t,!0),t+=Vb,r.version=n.getUint32(t,!0),t+=Vb,r.byteLength=n.getUint32(t,!0),t+=Vb,r.version!==1)throw new Error(`3D Tile Version ${r.version} not supported`);return t}const _d=4,VP="b3dm tile in legacy format.";function kw(r,e,t){const n=new DataView(e);let i;r.header=r.header||{};let s=n.getUint32(t,!0);t+=_d;let o=n.getUint32(t,!0);t+=_d;let l=n.getUint32(t,!0);t+=_d;let f=n.getUint32(t,!0);return t+=_d,l>=570425344?(t-=_d*2,i=s,l=o,f=0,s=0,o=0,console.warn(VP)):f>=570425344&&(t-=_d,i=l,l=s,f=o,s=0,o=0,console.warn(VP)),r.header.featureTableJsonByteLength=s,r.header.featureTableBinaryByteLength=o,r.header.batchTableJsonByteLength=l,r.header.batchTableBinaryByteLength=f,r.header.batchLength=i,t}function Nw(r,e,t,n){return t=uhe(r,e,t),t=fhe(r,e,t),t}function uhe(r,e,t,n){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:s,batchLength:o}=r.header||{};if(r.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){const l=KL(e,t,i);r.featureTableJson=JSON.parse(l)}return t+=i||0,r.featureTableBinary=new Uint8Array(e,t,s),t+=s||0,t}function fhe(r,e,t,n){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:s}=r.header||{};if(i&&i>0){const o=KL(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 t6(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 l=0;l<s;l++){const f=n[l],v=t.getProperty(f,"dimensions").map(T=>T*255);o[l*3]=v[0],o[l*3+1]=v[1],o[l*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 l=0;l<s;l++){const f=Zfe(e[l]);o[l*3]=f[0],o[l*3+1]=f[1],o[l*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 GP=new dt;function hhe(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++)Qfe(e[n*2],e[n*2+1],GP),GP.toArray(t,n*3);return{type:Un.FLOAT,size:2,value:t}}return{type:Un.FLOAT,size:2,value:e}}function dhe(r,e,t){return r.isQuantized?t["3d-tiles"]&&t["3d-tiles"].decodeQuantizedPositions?(r.isQuantized=!1,phe(r,e)):{type:Un.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}function phe(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 Ahe(r,e,t,n,i){t=oy(r,e,t),t=kw(r,e,t),t=Nw(r,e,t),ghe(r);const{featureTable:s,batchTable:o}=mhe(r);return await xhe(r,s,o,n,i),_he(r,s,n),yhe(r,s,o),vhe(r,s),t}function ghe(r){r.attributes={positions:null,colors:null,normals:null,batchIds:null},r.isQuantized=!1,r.isTranslucent=!1,r.isRGB565=!1,r.isOctEncoded16P=!1}function mhe(r){const e=new Lw(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=bhe(r,e);return{featureTable:e,batchTable:n}}function _he(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=dhe(r,n,t)}}if(!r.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function yhe(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=t6(r,n,t)}e.hasProperty("CONSTANT_RGBA")&&(r.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",Un.UNSIGNED_BYTE,4))}function vhe(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=hhe(r,t)}}function bhe(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 e6(i,s,n)}return t}async function xhe(r,e,t,n,i){let s,o,l;const f=r.batchTableJson&&r.batchTableJson.extensions&&r.batchTableJson.extensions["3DTILES_draco_point_compression"];f&&(l=f.properties);const A=e.getExtension("3DTILES_draco_point_compression");if(A){o=A.properties;const T=A.byteOffset,I=A.byteLength;if(!o||!Number.isFinite(T)||!I)throw new Error("Draco properties, byteOffset, and byteLength must be defined");s=(r.featureTableBinary||[]).slice(T,T+I),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,...l},batchTableProperties:l};return await whe(r,v,n,i)}async function whe(r,e,t,n){if(!n)return;const i={...t,draco:{...t?.draco,extraAttributes:e.batchTableProperties||{}}};delete i["3d-tiles"];const s=await wg(e.buffer,YL,i,n),o=s.attributes.POSITION&&s.attributes.POSITION.value,l=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,T=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}T&&(r.octEncodedRange=(1<<s.NORMAL.data.quantization.quantizationBits)-1,r.isOctEncodedDraco=!0);const I={};if(e.batchTableProperties)for(const F of Object.keys(e.batchTableProperties))s.attributes[F]&&s.attributes[F].value&&(I[F.toLowerCase()]=s.attributes[F].value);r.attributes={positions:o,colors:t6(r,l,void 0),normals:f,batchIds:A,...I}}function Aa(r,e){if(!r)throw new Error(e||"assert failed: gltf")}const r6={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},n6={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},The=1.33,jP=["SCALAR","VEC2","VEC3","VEC4"],Ehe=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Che=new Map(Ehe),She={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ihe={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Bhe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function i6(r){return jP[r-1]||jP[0]}function Uw(r){const e=Che.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function zw(r,e){const t=Bhe[r.componentType],n=She[r.type],i=Ihe[r.componentType],s=r.count*n,o=r.count*n*i;Aa(o>=0&&o<=e.byteLength);const l=n6[r.componentType],f=r6[r.type];return{ArrayType:t,length:s,byteLength:o,componentByteSize:l,numberOfComponentsInElement:f}}function s6(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,l)=>o+l.byteLength,0),s=e.reduce((o,l)=>{const{width:f,height:A}=l.image;return o+f*A},0);return i+Math.ceil(4*s*The)}function Phe(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 Mhe(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],l=(o||0)+(n.byteOffset||0)+(i.byteOffset||0),{ArrayType:f,length:A,componentByteSize:v,numberOfComponentsInElement:T}=zw(n,i),I=v*T,F=i.byteStride||I;if(typeof i.byteStride>"u"||i.byteStride===I)return new f(s,l,A);const N=new f(A);for(let U=0;U<n.count;U++){const $=new f(s,l+U*F,T);N.set($,U*T)}return N}function Rhe(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}class yo{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||Rhe(),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 Mhe(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,l={primitives:[{attributes:this._addAttributes(t),mode:s}]};if(n){const f=this._addIndices(n);l.primitives[0].indices=f}return Number.isFinite(i)&&(l.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(l),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=yw(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+=Eg(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:i6(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:Uw(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=poe(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 HP(r){return(r%1+1)%1}const o6={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},Ohe={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},a6={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Vw(r,e){return a6[e]*o6[r]}function ay(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;const i=r.getTypedArrayForBufferView(e),s=ly(i,"SCALAR",t,n+1);return s instanceof BigInt64Array||s instanceof BigUint64Array?null:s}function ly(r,e,t,n=1){const i=o6[e],s=Ohe[t],o=a6[t],l=n*i,f=l*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,l)}function Gw(r,e,t){const n=`TEXCOORD_${e.texCoord||0}`,i=t.attributes[n],s=r.getTypedArrayForAccessor(i),o=r.gltf.json,l=e.index,f=o.textures?.[l]?.source;if(typeof f<"u"){const A=o.images?.[f]?.mimeType,v=r.gltf.images?.[f];if(v&&typeof v.width<"u"){const T=[];for(let I=0;I<s.length;I+=2){const F=Dhe(v,A,s,I,e.channels);T.push(F)}return T}}return[]}function l6(r,e,t,n,i){if(!t?.length)return;const s=[];for(const v of t){let T=n.findIndex(I=>I===v);T===-1&&(T=n.push(v)-1),s.push(T)}const o=new Uint32Array(s),l=r.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,f=r.addBufferView(o,l,0),A=r.addAccessor(f,{size:1,componentType:Uw(o),count:o.length});i.attributes[e]=A}function Dhe(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],l=t[n+1];let f=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(f=4);const A=Fhe(o,l,r,f);let v=0;for(const T of i){const I=typeof T=="number"?Object.values(s)[T]:s[T],F=A+I.offset,N=AL(r);if(N.data.length<=F)throw new Error(`${N.data.length} <= ${F}`);const U=N.data[F];v|=U<<I.shift}return v}function Fhe(r,e,t,n=1){const i=t.width,s=HP(r)*(i-1),o=Math.round(s),l=t.height,f=HP(e)*(l-1),A=Math.round(f),v=t.components?t.components:n;return(A*i+o)*v}function c6(r,e,t,n,i){const s=[];for(let o=0;o<e;o++){const l=t[o],f=t[o+1]-t[o];if(f+l>n)break;const A=l/i,v=f/i;s.push(r.slice(A,A+v))}return s}function u6(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 f6(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 l=0;l<r;l++){const f=n[l+1]-n[l];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 h6="EXT_mesh_features",Lhe=h6;async function khe(r,e){const t=new yo(r);Nhe(t,e)}function Nhe(r,e){const t=r.gltf.json;if(t.meshes)for(const n of t.meshes)for(const i of n.primitives)Uhe(r,i,e)}function Uhe(r,e,t){if(!t?.gltf?.loadBuffers)return;const i=e.extensions?.[h6]?.featureIds;if(i)for(const s of i){let o;if(typeof s.attribute<"u"){const l=`_FEATURE_ID_${s.attribute}`,f=e.attributes[l];o=r.getTypedArrayForAccessor(f)}else typeof s.texture<"u"&&t?.gltf?.loadImages?o=Gw(r,s.texture,e):o=[];s.data=o}}const zhe=Object.freeze(Object.defineProperty({__proto__:null,decode:khe,name:Lhe},Symbol.toStringTag,{value:"Module"})),jw="EXT_structural_metadata",Vhe=jw;async function Ghe(r,e){const t=new yo(r);jhe(t,e)}function jhe(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(jw);t&&(e.gltf?.loadImages&&Hhe(r,t),Whe(r,t))}function Hhe(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)Xhe(r,t,s,e)}function Whe(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=$he(i,s);o&&Jhe(r,t,o)}}function $he(r,e){for(const t of r)if(t.class===e)return t;return null}function Xhe(r,e,t,n){if(!e)return;const s=t.extensions?.[jw]?.propertyTextures;if(s)for(const o of s){const l=e[o];qhe(r,l,t,n)}}function qhe(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}`,l=e.properties?.[s];if(!l)continue;l.data||(l.data=[]);const f=l.data,A=Gw(r,l,t);A!==null&&(l6(r,o,A,f,t),l.data=f,n.dataAttributeNames.push(o))}}function Jhe(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],l=t.properties?.[s];if(l){const f=Khe(r,e,o,i,l);l.data=f}}}function Khe(r,e,t,n,i){let s=[];const o=i.values,l=r.getTypedArrayForBufferView(o),f=Zhe(r,t,i,n),A=Yhe(r,i,n);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{s=Qhe(t,n,l,f);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${t.type}`);case"STRING":{s=f6(n,l,f,A);break}case"ENUM":{s=ede(e,t,n,l,f);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return s}function Zhe(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?ay(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function Yhe(r,e,t){return typeof e.stringOffsets<"u"?ay(r,e.stringOffsets,e.stringOffsetType||"UINT32",t):null}function Qhe(r,e,t,n){const i=r.array,s=r.count,o=Vw(r.type,r.componentType),l=t.byteLength/o;let f;return r.componentType?f=ly(t,r.type,r.componentType,l):f=t,i?n?c6(f,e,n,t.length,o):s?u6(f,e,s):[]:f}function ede(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 l=o.valueType||"UINT16",f=Vw(e.type,l),A=n.byteLength/f;let v=ly(n,e.type,l,A);if(v||(v=n),e.array){if(i)return tde({valuesData:v,numberOfElements:t,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:f,enumEntry:o});const T=e.count;return T?rde(v,t,T,o):[]}return Hw(v,0,t,o)}function tde(r){const{valuesData:e,numberOfElements:t,arrayOffsets:n,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=r,l=[];for(let f=0;f<t;f++){const A=n[f],v=n[f+1]-n[f];if(v+A>i)break;const T=A/s,I=v/s,F=Hw(e,T,I,o);l.push(F)}return l}function rde(r,e,t,n){const i=[];for(let s=0;s<e;s++){const o=t*s,l=Hw(r,o,t,n);i.push(l)}return i}function Hw(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],l=nde(n,o);l?i.push(l.name):i.push("")}return i}function nde(r,e){for(const t of r.values)if(t.value===e)return t;return null}const ide=Object.freeze(Object.defineProperty({__proto__:null,decode:Ghe,name:Vhe},Symbol.toStringTag,{value:"Module"})),d6="EXT_feature_metadata",sde=d6;async function ode(r,e){const t=new yo(r);ade(t,e)}function ade(r,e){if(!e.gltf?.loadBuffers)return;const t=r.getExtension(d6);t&&(e.gltf?.loadImages&&lde(r,t),cde(r,t))}function lde(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],l=fde(i,s);l&&dde(r,l,o)}}function cde(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=ude(i,s);o&&hde(r,t,o)}}function ude(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function fde(r,e){for(const t in r){const n=r[t];if(n.class===e)return n}return null}function hde(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
4561name ${t.class}`);const i=t.count;for(const s in n.properties){const o=n.properties[s],l=t.properties?.[s];if(l){const f=pde(r,e,o,i,l);l.data=f}}}function dde(r,e,t){const n=e.class;for(const i in t.properties){const s=e?.properties?.[i];if(s){const o=yde(r,s,n);s.data=o}}}function pde(r,e,t,n,i){let s=[];const o=i.bufferView,l=r.getTypedArrayForBufferView(o),f=Ade(r,t,i,n),A=gde(r,t,i,n);return t.type==="STRING"||t.componentType==="STRING"?s=f6(n,l,f,A):mde(t)&&(s=_de(t,n,l,f)),s}function Ade(r,e,t,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof t.arrayOffsetBufferView<"u"?ay(r,t.arrayOffsetBufferView,t.offsetType||"UINT32",n):null}function gde(r,e,t,n){return typeof t.stringOffsetBufferView<"u"?ay(r,t.stringOffsetBufferView,t.offsetType||"UINT32",n):null}function mde(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 _de(r,e,t,n){const i=r.type==="ARRAY",s=r.componentCount,o="SCALAR",l=r.componentType||r.type,f=Vw(o,l),A=t.byteLength/f,v=ly(t,o,l,A);return i?n?c6(v,e,n,t.length,f):s?u6(v,e,s):[]:v}function yde(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)vde(r,t,e,i,o);return i}function vde(r,e,t,n,i){const s={channels:t.channels,...t.texture},o=Gw(r,s,i);o&&l6(r,e,o,n,i)}const bde=Object.freeze(Object.defineProperty({__proto__:null,decode:ode,name:sde},Symbol.toStringTag,{value:"Module"})),xde="4.2.4",wde="4.2.4",g_={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"};let WP;async function $P(r){roe(r.modules);const e=noe("basis");return e||(WP||=Tde(r),await WP)}async function Tde(r){let e=null,t=null;return[e,t]=await Promise.all([await eh(g_.TRANSCODER,"textures",r),await eh(g_.TRANSCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await Ede(e,t)}function Ede(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 Gb;async function XP(r){const e=r.modules||{};return e.basisEncoder?e.basisEncoder:(Gb=Gb||Cde(r),await Gb)}async function Cde(r){let e=null,t=null;return[e,t]=await Promise.all([await eh(g_.ENCODER,"textures",r),await eh(g_.ENCODER_WASM,"textures",r)]),e=e||globalThis.BASIS,await Sde(e,t)}function Sde(r,e){const t={};return e&&(t.wasmBinary=e),new Promise(n=>{r(t).then(i=>{const{BasisFile:s,KTX2File:o,initializeBasis:l,BasisEncoder:f}=i;l(),n({BasisFile:s,KTX2File:o,BasisEncoder:f})})})}const yd={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},Ide=["","WEBKIT_","MOZ_"],qP={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 Z0=null;function Bde(r){if(!Z0){r=r||Pde()||void 0,Z0=new Set;for(const e of Ide)for(const t in qP)if(r&&r.getExtension(`${e}${t}`)){const n=qP[t];Z0.add(n)}}return Z0}function Pde(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var JP,KP,ZP,YP,QP,eM,tM,rM;(function(r){r[r.NONE=0]="NONE",r[r.BASISLZ=1]="BASISLZ",r[r.ZSTD=2]="ZSTD",r[r.ZLIB=3]="ZLIB"})(JP||(JP={})),(function(r){r[r.BASICFORMAT=0]="BASICFORMAT"})(KP||(KP={})),(function(r){r[r.UNSPECIFIED=0]="UNSPECIFIED",r[r.ETC1S=163]="ETC1S",r[r.UASTC=166]="UASTC"})(ZP||(ZP={})),(function(r){r[r.UNSPECIFIED=0]="UNSPECIFIED",r[r.SRGB=1]="SRGB"})(YP||(YP={})),(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"})(QP||(QP={})),(function(r){r[r.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",r[r.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"})(eM||(eM={})),(function(r){r[r.RGB=0]="RGB",r[r.RRR=3]="RRR",r[r.GGG=4]="GGG",r[r.AAA=15]="AAA"})(tM||(tM={})),(function(r){r[r.RGB=0]="RGB",r[r.RGBA=3]="RGBA",r[r.RRR=4]="RRR",r[r.RRRG=5]="RRRG"})(rM||(rM={}));const ua=[171,75,84,88,32,50,48,187,13,10,26,10];function Mde(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 Rde={etc1:{basisFormat:0,compressed:!0,format:yd.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:yd.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:yd.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:yd.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:yd.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:yd.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 Ode(r,e){if(e.basis.containerFormat==="auto"){if(Mde(r)){const n=await XP(e);return nM(n.KTX2File,r,e)}const{BasisFile:t}=await $P(e);return jb(t,r,e)}switch(e.basis.module){case"encoder":const t=await XP(e);switch(e.basis.containerFormat){case"ktx2":return nM(t.KTX2File,r,e);case"basis":default:return jb(t.BasisFile,r,e)}case"transcoder":default:const{BasisFile:n}=await $P(e);return jb(n,r,e)}}function jb(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 l=n.getNumLevels(o),f=[];for(let A=0;A<l;A++)f.push(Dde(n,o,A,t));s.push(f)}return s}finally{n.close(),n.delete()}}function Dde(r,e,t,n){const i=r.getImageWidth(e,t),s=r.getImageHeight(e,t),o=r.getHasAlpha(),{compressed:l,format:f,basisFormat:A}=p6(n,o),v=r.getImageTranscodedSizeInBytes(e,t,A),T=new Uint8Array(v);if(!r.transcodeImage(T,e,t,A,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:s,data:T,compressed:l,format:f,hasAlpha:o}}function nM(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(Fde(n,o,t));break}return[s]}finally{n.close(),n.delete()}}function Fde(r,e,t){const{alphaFlag:n,height:i,width:s}=r.getImageLevelInfo(e,0,0),{compressed:o,format:l,basisFormat:f}=p6(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:l}}function p6(r,e){let t=r&&r.basis&&r.basis.format;return t==="auto"&&(t=A6()),typeof t=="object"&&(t=e?t.alpha:t.noAlpha),t=t.toLowerCase(),Rde[t]}function A6(){const r=Bde();return r.has("astc")?"astc-4x4":r.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}
vendor: 2,235 bytes, line 4561
4561:r.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:r.has("etc1")?"etc1":r.has("etc2")?"etc2":"rgb565"}const Lde={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:wde,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"}}},kde={...Lde,parse:Ode},bp=!0,iM=1735152710,Ww=12,m_=8,Nde=1313821514,Ude=5130562,zde=0,Vde=0,Gde=1;function jde(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 Hde(r,e=0,t={}){const n=new DataView(r),{magic:i=iM}=t,s=n.getUint32(e,!1);return s===i||s===iM}function Wde(r,e,t=0,n={}){const i=new DataView(e),s=jde(i,t+0),o=i.getUint32(t+4,bp),l=i.getUint32(t+8,bp);switch(Object.assign(r,{header:{byteOffset:t,byteLength:l,hasBinChunk:!1},type:s,version:o,json:{},binChunks:[]}),t+=Ww,r.version){case 1:return $de(r,i,t);case 2:return Xde(r,i,t,n={});default:throw new Error(`Invalid GLB version ${r.version}. Only supports version 1 and 2.`)}}function $de(r,e,t){Ri(r.header.byteLength>Ww+m_);const n=e.getUint32(t+0,bp),i=e.getUint32(t+4,bp);return t+=m_,Ri(i===zde),B2(r,e,t,n),t+=n,t+=P2(r,e,t,r.header.byteLength),t}function Xde(r,e,t,n){return Ri(r.header.byteLength>Ww+m_),qde(r,e,t,n),t+r.header.byteLength}function qde(r,e,t,n){for(;t+8<=r.header.byteLength;){const i=e.getUint32(t+0,bp),s=e.getUint32(t+4,bp);switch(t+=m_,s){case Nde:B2(r,e,t,i);break;case Ude:P2(r,e,t,i);break;case Vde:n.strict||B2(r,e,t,i);break;case Gde:n.strict||P2(r,e,t,i);break}t+=Eg(i,4)}return t}function B2(r,e,t,n){const i=new Uint8Array(e.buffer,t,n),o=new TextDecoder("utf8").decode(i);return r.json=JSON.parse(o),Eg(n,4)}function P2(r,e,t,n){return r.header.hasBinChunk=!0,r.binChunks.push({byteOffset:t,byteLength:n,arrayBuffer:e.buffer}),Eg(n,4)}function g6(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}
4561const Jde="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIA
4561LAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/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",Kd
vendor: 10,663 bytes, line 4561
4561e="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,058 bytes, line 4561
4561Zde=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]),Yde=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]),Qde={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},epe={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function tpe(r,e,t,n,i,s="NONE"){const o=await rpe();spe(o,o.exports[epe[i]],r,e,t,n,o.exports[Qde[s||"NONE"]])}let Hb;async function rpe(){return Hb||(Hb=npe()),Hb}async function npe(){let r=Jde;WebAssembly.validate(Zde)&&(r=Kde,console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(ipe(r),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function ipe(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?Yde[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,t)}function spe(r,e,t,n,i,s,o){const l=r.exports.sbrk,f=n+3&-4,A=l(f*i),v=l(s.length),T=new Uint8Array(r.exports.memory.buffer);T.set(s,v);const I=e(A,n,i,v,s.length);if(I===0&&o&&o(A,f,i),t.set(T.subarray(A,A+n*i)),l(A-l(0)),I!==0)throw new Error(`Malformed buffer data: ${I}`)}const __="EXT_meshopt_compression",ope=__;async function ape(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(lpe(t,i));await Promise.all(n),t.removeExtension(__)}async function lpe(r,e){const t=r.getObjectExtension(e,__);if(t){const{byteOffset:n=0,byteLength:i=0,byteStride:s,count:o,mode:l,filter:f="NONE",buffer:A}=t,v=r.gltf.buffers[A],T=new Uint8Array(v.arrayBuffer,v.byteOffset+n,i),I=new Uint8Array(r.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await tpe(I,o,s,T,l,f),r.removeObjectExtension(e,__)}}const cpe=Object.freeze(Object.defineProperty({__proto__:null,decode:ape,name:ope},Symbol.toStringTag,{value:"Module"})),Fd="EXT_texture_webp",upe=Fd;function fpe(r,e){const t=new yo(r);if(!Tae("image/webp")){if(t.getRequiredExtensions().includes(Fd))throw new Error(`gltf: Required extension ${Fd} not supported by browser`);return}const{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,Fd);s&&(i.source=s.source),t.removeObjectExtension(i,Fd)}t.removeExtension(Fd)}const hpe=Object.freeze(Object.defineProperty({__proto__:null,name:upe,preprocess:fpe},Symbol.toStringTag,{value:"Module"})),Rm="KHR_texture_basisu",dpe=Rm;function ppe(r,e){const t=new yo(r),{json:n}=t;for(const i of n.textures||[]){const s=t.getObjectExtension(i,Rm);s&&(i.source=s.source,t.removeObjectExtension(i,Rm))}t.removeExtension(Rm)}const Ape=Object.freeze(Object.defineProperty({__proto__:null,name:dpe,preprocess:ppe},Symbol.toStringTag,{value:"Module"}));function gpe(r){const e={};for(const t in r){const n=r[t];if(t!=="indices"){const i=m6(n);e[t]=i}}return e}function m6(r){const{buffer:e,size:t,count:n}=mpe(r);return{value:e,size:t,byteOffset:0,count:n,type:i6(t),componentType:Uw(e)}}function mpe(r){let e=r,t=1,n=0;return r&&r.value&&(e=r.value,t=r.size||1),e&&(ArrayBuffer.isView(e)||(e=_pe(e,Float32Array)),n=e.length/t),{buffer:e,size:t,count:n}}function _pe(r,e,t=!1){return r?Array.isArray(r)?new e(r):t&&!(r instanceof e)?new e(r):r:null}const Qu="KHR_draco_mesh_compression",ype=Qu;function vpe(r,e,t){const n=new yo(r);for(const i of _6(n))n.getObjectExtension(i,Qu)}async function bpe(r,e,t){if(!e?.gltf?.decompressMeshes)return;const n=new yo(r),i=[];for(const s of _6(n))n.getObjectExtension(s,Qu)&&i.push(wpe(n,s,e,t));await Promise.all(i),n.removeExtension(Qu)}function xpe(r,e={}){const t=new yo(r);for(const n of t.json.meshes||[])Tpe(n),t.addRequiredExtension(Qu)}async function wpe(r,e,t,n){const i=r.getObjectExtension(e,Qu);if(!i)return;const s=r.getTypedArrayForBufferView(i.bufferView),o=Aw(s.buffer,s.byteOffset),l={...t};delete l["3d-tiles"];const f=await wg(o,YL,l,n),A=gpe(f.attributes);for(const[v,T]of Object.entries(A))if(v in e.attributes){const I=e.attributes[v],F=r.getAccessor(I);F?.min&&F?.max&&(T.min=F.min,T.max=F.max)}e.attributes=A,f.indices&&(e.indices=m6(f.indices)),r.removeObjectExtension(e,Qu),Epe(e)}function Tpe(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}),l=n._addFauxAttributes(o.attributes),f=n.addBufferView(s);return{primitives:[{attributes:l,mode:t,extensions:{[Qu]:{bufferView:f,attributes:l}}}]}}function Epe(r){if(!r.attributes&&Object.keys(r.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*_6(r){for(const e of r.json.meshes||[])for(const t of e.primitives)yield t}const Cpe=Object.freeze(Object.defineProperty({__proto__:null,decode:bpe,encode:xpe,name:ype,preprocess:vpe},Symbol.toStringTag,{value:"Module"})),cy="KHR_texture_transform",Spe=cy,Y0=new dt,Ipe=new Oi,Bpe=new Oi;async function Ppe(r,e){if(!new yo(r).hasExtension(cy)||!e.gltf?.loadBuffers)return;const i=r.json.materials||[];for(let s=0;s<i.length;s++)Mpe(s,r)}function Mpe(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?.[cy]&&Rpe(e,r,s,i)}function Rpe(r,e,t,n){const i=Ope(t,n);if(!i)return;const s=r.json.meshes||[];for(const o of s)for(const l of o.primitives){const f=l.material;Number.isFinite(f)&&e===f&&Dpe(r,l,i)}}function Ope(r,e){const t=r.extensions?.[cy],{texCoord:n=0}=r,{texCoord:i=n}=t;if(!(e.findIndex(([o,l])=>o===n&&l===i)!==-1)){const o=kpe(t);return n!==i&&(r.texCoord=i),e.push([n,i]),{originalTexCoord:n,texCoord:i,matrix:o}}return null}function Dpe(r,e,t){const{originalTexCoord:n,texCoord:i,matrix:s}=t,o=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){const l=r.json.accessors?.[o];if(l&&l.bufferView){const f=r.json.bufferViews?.[l.bufferView];if(f){const{arrayBuffer:A,byteOffset:v}=r.buffers[f.buffer],T=(v||0)+(l.byteOffset||0)+(f.byteOffset||0),{ArrayType:I,length:F}=zw(l,f),N=n6[l.componentType],U=r6[l.type],$=f.byteStride||N*U,V=new Float32Array(F);for(let j=0;j<l.count;j++){const X=new I(A,T+j*$,2);Y0.set(X[0],X[1],1),Y0.transformByMatrix3(s),V.set([Y0[0],Y0[1]],j*U)}n===i?Fpe(l,f,r.buffers,V):Lpe(i,l,e,r,V)}}}}function Fpe(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 Lpe(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 kpe(r){const{offset:e=[0,0],rotation:t=0,scale:n=[1,1]}=r,i=new Oi().set(1,0,0,0,1,0,e[0],e[1],1),s=Ipe.set(Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0,0,0,1),o=Bpe.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}const Npe=Object.freeze(Object.defineProperty({__proto__:null,decode:Ppe,name:Spe},Symbol.toStringTag,{value:"Module"})),Jf="KHR_lights_punctual",Upe=Jf;async function zpe(r){const e=new yo(r),{json:t}=e,n=e.getExtension(Jf);n&&(e.json.lights=n.lights,e.removeExtension(Jf));for(const i of t.nodes||[]){const s=e.getObjectExtension(i,Jf);s&&(i.light=s.light),e.removeObjectExtension(i,Jf)}}async function Vpe(r){const e=new yo(r),{json:t}=e;if(t.lights){const n=e.addExtension(Jf);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,Jf,n)}delete e.json.lights}}const Gpe=Object.freeze(Object.defineProperty({__proto__:null,decode:zpe,encode:Vpe,name:Upe},Symbol.toStringTag,{value:"Module"})),cg="KHR_materials_unlit",jpe=cg;async function Hpe(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,cg);e.removeExtension(cg)}function Wpe(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,cg,{}),e.addExtension(cg))}const $pe=Object.freeze(Object.defineProperty({__proto__:null,decode:Hpe,encode:Wpe,name:jpe},Symbol.toStringTag,{value:"Module"})),MA="KHR_techniques_webgl",Xpe=MA;async function qpe(r){const e=new yo(r),{json:t}=e,n=e.getExtension(MA);if(n){const i=Kpe(n,e);for(const s of t.materials||[]){const o=e.getObjectExtension(s,MA);o&&(s.technique=Object.assign({},o,i[o.technique]),s.technique.values=Zpe(s.technique,e)),e.removeObjectExtension(s,MA)}e.removeExtension(MA)}}async function Jpe(r,e){}function Kpe(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 Zpe(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 Ype=Object.freeze(Object.defineProperty({__proto__:null,decode:qpe,encode:Jpe,name:Xpe},Symbol.toStringTag,{value:"Module"})),y6=[ide,zhe,cpe,hpe,Ape,Cpe,Gpe,$pe,Ype,Npe,bde];function Qpe(r,e={},t){const n=y6.filter(i=>v6(i.name,e));for(const i of n)i.preprocess?.(r,e,t)}async function eAe(r,e={},t){const n=y6.filter(i=>v6(i.name,e));for(const i of n)await i.decode?.(r,e,t)}function v6(r,e){const t=e?.gltf?.excludeExtensions||{};return!(r in t&&!t[r])}const Wb="KHR_binary_glTF";function tAe(r){const e=new yo(r),{json:t}=e;for(const n of t.images||[]){const i=e.getObjectExtension(n,Wb);i&&Object.assign(n,i),e.removeObjectExtension(n,Wb)}t.buffers&&t.buffers[0]&&delete t.buffers[0].uri,e.removeExtension(Wb)}const sM={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},rAe={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 nAe{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),tAe(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 sM)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 sM)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=rAe[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 iAe(r,e={}){return new nAe().normalize(r,e)}async function sAe(r,e,t=0,n,i){return oAe(r,e,t,n),iAe(r,{normalize:n?.gltf?.normalize}),Qpe(r,n,i),n?.gltf?.loadBuffers&&r.json.buffers&&await aAe(r,n,i),n?.gltf?.loadImages&&await lAe(r,n,i),await eAe(r,n,i),r}function oAe(r,e,t,n){if(n.uri&&(r.baseUri=n.uri),e instanceof ArrayBuffer&&!Hde(e,t,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")r.json=doe(e);else if(e instanceof ArrayBuffer){const o={};t=Wde(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 aAe(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 l=g6(s.uri,e),A=await(await t?.fetch?.(l))?.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 lAe(r,e,t){const n=cAe(r),i=r.json.images||[],s=[];for(const o of n)s.push(uAe(r,i[o],o,e,t));return await Promise.all(s)}function cAe(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 uAe(r,e,t,n,i){let s;if(e.uri&&!e.hasOwnProperty("bufferView")){const l=g6(e.uri,n),{fetch:f}=i;s=await(await f(l)).arrayBuffer(),e.bufferView={data:s}}if(Number.isFinite(e.bufferView)){const l=Phe(r.json,r.buffers,e.bufferView);s=Aw(l.buffer,l.byteOffset,l.byteLength)}Aa(s,"glTF image has no data");let o=await wg(s,[h_,kde],{...n,mimeType:e.mimeType,basis:n.basis||{format:A6()}},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:xde,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:fAe,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function fAe(r,e={},t){e={...y_.options,...e},e.gltf={...y_.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await sAe({},r,n,e,t)}const hAe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},dAe={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},pAe={magFilter:Da.TEXTURE_MAG_FILTER,minFilter:Da.TEXTURE_MIN_FILTER,wrapS:Da.TEXTURE_WRAP_S,wrapT:Da.TEXTURE_WRAP_T},AAe={[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 gAe(){return{id:"default-sampler",parameters:AAe}}function mAe(r){return dAe[r]}function _Ae(r){return hAe[r]}class yAe{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 l in o)s.attributes[l]=this.getAccessor(o[l]);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=mAe(e.componentType),i=_Ae(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 l=o.bufferView.buffer,{ArrayType:f,byteLength:A}=zw(o,o.bufferView),v=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+l.byteOffset;let T=l.arrayBuffer.slice(v,v+A);o.bufferView.byteStride&&(T=this._getValueFromInterleavedBuffer(l,v,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new f(T)}return o}_getValueFromInterleavedBuffer(e,t,n,i,s){const o=new Uint8Array(s*i);for(let l=0;l<s;l++){const f=t+l*n;o.set(new Uint8Array(e.arrayBuffer.slice(f,f+i)),l*i)}return o.buffer}_resolveTexture(e,t){return{...e,id:e.id||`texture-${t}
4561`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):gAe(),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 pAe[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 b6(r,e){return new yAe().postProcess(r,e)}const M2={URI:0,EMBEDDED:1};function x6(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=Aw(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 w6(r,e,t,n){const i=t?.["3d-tiles"]||{};if(vAe(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 wg(r.gltfArrayBuffer,y_,t,n);r.gltf=b6(s),r.gpuMemoryUsageInBytes=s6(r.gltf),delete r.gltfArrayBuffer,delete r.gltfByteOffset,delete r.gltfByteLength}}}function vAe(r,e,t){switch(e){case M2.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 M2.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function bAe(r,e,t,n,i){t=xAe(r,e,t,n),await w6(r,M2.EMBEDDED,n,i);const s=r?.gltf?.extensions;return s&&s.CESIUM_RTC&&(r.rtcCenter=s.CESIUM_RTC.center),t}function xAe(r,e,t,n,i){t=oy(r,e,t),t=kw(r,e,t),t=Nw(r,e,t),t=x6(r,e,t,n);const s=new Lw(r.featureTableJson,r.featureTableBinary);return r.rtcCenter=s.getGlobalProperty("RTC_CENTER",Un.FLOAT,3),t}async function wAe(r,e,t,n,i){return t=TAe(r,e,t,n),await w6(r,r.gltfFormat||0,n,i),t}function TAe(r,e,t,n,i){if(t=oy(r,e,t),r.version!==1)throw new Error(`Instanced 3D Model version ${r.version} is not supported`);t=kw(r,e,t);const s=new DataView(e);if(r.gltfFormat=s.getUint32(t,!0),t+=4,t=Nw(r,e,t),t=x6(r,e,t,n),!r?.header?.featureTableJsonByteLength||r.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new Lw(r.featureTableJson,r.featureTableBinary),l=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=l,!Number.isFinite(l))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 e6(r.batchTableJson,r.batchTableBinary,l);return EAe(r,o,f,l),t}function EAe(r,e,t,n){const i=new Array(n),s=new dt;new dt,new dt,new dt;const o=new Oi,l=new YA,f=new dt,A={},v=new vn,T=[],I=[],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 Ee=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Un.FLOAT,3);if(!Ee)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*Ee[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,T),r.normalRight=e.getProperty("NORMAL_RIGHT",Un.FLOAT,3,U,I),r.n
vendor: 2,025 bytes, line 4561
4561ormalUp){if(!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,T),r.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",Un.UNSIGNED_SHORT,2,U,I),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?(bi.WGS84.eastNorthUpToFixedFrame(s,v),v.getRotationMatrix3(o)):o.identity()}l.fromMatrix3(o),A.rotation=l,f.set(1,1,1);const V=e.getProperty("SCALE",Un.FLOAT,1,U,F);Number.isFinite(V)&&f.multiplyByScalar(V);const j=e.getProperty("SCALE_NON_UNIFORM",Un.FLOAT,3,U,T);j&&f.scale(j),A.scale=f;let X=e.getProperty("BATCH_ID",Un.UNSIGNED_SHORT,1,U,N);X===void 0&&(X=U);const ue=new vn().fromQuaternion(A.rotation);v.identity(),v.translate(A.translation),v.multiplyRight(ue),v.scale(A.scale);const K=v.clone();i[U]={modelMatrix:K,batchId:X}}r.instances=i}async function CAe(r,e,t,n,i,s){t=oy(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 l={shape:"tile3d"};r.tiles.push(l),t=await s(e,t,n,i,l)}return t}async function SAe(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 wg(e,y_,t,n);r.gltf=b6(i),r.gpuMemoryUsageInBytes=s6(r.gltf)}else r.gltfArrayBuffer=e;return e.byteLength}async function T6(r,e=0,t,n,i={shape:"tile3d"}){switch(i.byteOffset=e,i.type=Sfe(r,e),i.type){case yA.COMPOSITE:return await CAe(i,r,e,t,n,T6);case yA.BATCHED_3D_MODEL:return await bAe(i,r,e,t,n);case yA.GLTF:return await SAe(i,r,t,n);case yA.INSTANCED_3D_MODEL:return await wAe(i,r,e,t,n);case yA.POINT_CLOUD:return await Ahe(i,r,e,t,n);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}const IAe=1952609651,BAe=1;
vendor: 5,967 bytes, line 4561
4561async function PAe(r,e,t){if(new Uint32Array(r.slice(0,4))[0]!==IAe)throw new Error("Wrong subtree file magic number");if(new Uint32Array(r.slice(4,8))[0]!==BAe)throw new Error("Wrong subtree file verson, must be 1");const s=oM(r.slice(8,16)),o=new Uint8Array(r,24,s),f=new TextDecoder("utf8").decode(o),A=JSON.parse(f),v=oM(r.slice(16,24));let T=new ArrayBuffer(0);if(v&&(T=r.slice(24+s)),await Q0(A,A.tileAvailability,T,t),Array.isArray(A.contentAvailability))for(const I of A.contentAvailability)await Q0(A,I,T,t);else await Q0(A,A.contentAvailability,T,t);return await Q0(A,A.childSubtreeAvailability,T,t),A}async function Q0(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 l=r.buffers.slice(0,s.buffer).reduce((f,A)=>f+A.byteLength,0);e.explicitBitstream=new Uint8Array(t.slice(l,l+o.byteLength),s.byteOffset,s.byteLength)}function oM(r){const e=new DataView(r),t=e.getUint32(0,!0),n=e.getUint32(4,!0);return t+2**32*n}const E6={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:JL,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:PAe,options:{}};var ka=null;try{ka=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 Gn(r,e,t){this.low=r|0,this.high=e|0,this.unsigned=!!t}Gn.prototype.__isLong__;Object.defineProperty(Gn.prototype,"__isLong__",{value:!0});function vo(r){return(r&&r.__isLong__)===!0}function aM(r){var e=Math.clz32(r&-r);return r?31-e:e}Gn.isLong=vo;var lM={},cM={};function yh(r,e){var t,n,i;return e?(r>>>=0,(i=0<=r&&r<256)&&(n=cM[r],n)?n:(t=zn(r,0,!0),i&&(cM[r]=t),t)):(r|=0,(i=-128<=r&&r<128)&&(n=lM[r],n)?n:(t=zn(r,r<0?-1:0,!1),i&&(lM[r]=t),t))}Gn.fromInt=yh;function Na(r,e){if(isNaN(r))return e?Jc:xl;if(e){if(r<0)return Jc;if(r>=C6)return B6}else{if(r<=-fM)return jo;if(r+1>=fM)return I6}return r<0?Na(-r,e).neg():zn(r%xp|0,r/xp|0,e)}Gn.fromNumber=Na;function zn(r,e,t){return new Gn(r,e,t)}Gn.fromBits=zn;var v_=Math.pow;function $w(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?Jc:xl;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 $w(r.substring(1),e,t).neg();for(var i=Na(v_(t,8)),s=xl,o=0;o<r.length;o+=8){var l=Math.min(8,r.length-o),f=parseInt(r.substring(o,o+l),t);if(l<8){var A=Na(v_(t,l));s=s.mul(A).add(Na(f))}else s=s.mul(i),s=s.add(Na(f))}return s.unsigned=e,s}Gn.fromString=$w;function Ha(r,e){return typeof r=="number"?Na(r,e):typeof r=="string"?$w(r,e):zn(r.low,r.high,typeof e=="boolean"?e:r.unsigned)}Gn.fromValue=Ha;var uM=65536,MAe=1<<24,xp=uM*uM,C6=xp*xp,fM=C6/2,hM=yh(MAe),xl=yh(0);Gn.ZERO=xl;var Jc=yh(0,!0);Gn.UZERO=Jc;var Kd=yh(1);Gn.ONE=Kd;var S6=yh(1,!0);Gn.UONE=S6;var R2=yh(-1);Gn.NEG_ONE=R2;var I6=zn(-1,2147483647,!1);Gn.MAX_VALUE=I6;var B6=zn(-1,-1,!0);Gn.MAX_UNSIGNED_VALUE=B6;var jo=zn(0,-2147483648,!1);Gn.MIN_VALUE=jo;var tr=Gn.prototype;tr.toInt=function(){return this.unsigned?this.low>>>0:this.low};tr.toNumber=function(){return this.unsigned?(this.high>>>0)*xp+(this.low>>>0):this.high*xp+(this.low>>>0)};tr.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=Na(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=Na(v_(e,6),this.unsigned),o=this,l="";;){var f=o.div(s),A=o.sub(f.mul(s)).toInt()>>>0,v=A.toString(e);if(o=f,o.isZero())return v+l;for(;v.length<6;)v="0"+v;l=""+v+l}};tr.getHighBits=function(){return this.high};tr.getHighBitsUnsigned=function(){return this.high>>>0};tr.getLowBits=function(){return this.low};tr.getLowBitsUnsigned=function(){return this.low>>>0};tr.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};tr.isSafeInteger=function(){var e=this.high>>21;return e?this.unsigned?!1:e===-1&&!(this.low===0&&this.high===-2097152):!0};tr.isZero=function(){return this.high===0&&this.low===0};tr.eqz=tr.isZero;tr.isNegative=function(){return!this.unsigned&&this.high<0};tr.isPositive=function(){return this.unsigned||this.high>=0};tr.isOdd=function(){return(this.low&1)===1};tr.isEven=function(){return(this.low&1)===0};tr.equals=function(e){return vo(e)||(e=Ha(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};tr.eq=tr.equals;tr.notEquals=function(e){return!this.eq(e)};tr.neq=tr.notEquals;tr.ne=tr.notEquals;tr.lessThan=function(e){return this.comp(e)<0}
vendor: 5,521 bytes, line 4561
4561;tr.lt=tr.lessThan;tr.lessThanOrEqual=function(e){return this.comp(e)<=0};tr.lte=tr.lessThanOrEqual;tr.le=tr.lessThanOrEqual;tr.greaterThan=function(e){return this.comp(e)>0};tr.gt=tr.greaterThan;tr.greaterThanOrEqual=function(e){return this.comp(e)>=0};tr.gte=tr.greaterThanOrEqual;tr.ge=tr.greaterThanOrEqual;tr.compare=function(e){if(vo(e)||(e=Ha(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};tr.comp=tr.compare;tr.negate=function(){return!this.unsigned&&this.eq(jo)?jo:this.not().add(Kd)};tr.neg=tr.negate;tr.add=function(e){vo(e)||(e=Ha(e));var t=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,l=e.high&65535,f=e.low>>>16,A=e.low&65535,v=0,T=0,I=0,F=0;return F+=s+A,I+=F>>>16,F&=65535,I+=i+f,T+=I>>>16,I&=65535,T+=n+l,v+=T>>>16,T&=65535,v+=t+o,v&=65535,zn(I<<16|F,v<<16|T,this.unsigned)};tr.subtract=function(e){return vo(e)||(e=Ha(e)),this.add(e.neg())};tr.sub=tr.subtract;tr.multiply=function(e){if(this.isZero())return this;if(vo(e)||(e=Ha(e)),ka){var t=ka.mul(this.low,this.high,e.low,e.high);return zn(t,ka.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?Jc:xl;if(this.eq(jo))return e.isOdd()?jo:xl;if(e.eq(jo))return this.isOdd()?jo:xl;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(hM)&&e.lt(hM))return Na(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,l=e.high>>>16,f=e.high&65535,A=e.low>>>16,v=e.low&65535,T=0,I=0,F=0,N=0;return N+=o*v,F+=N>>>16,N&=65535,F+=s*v,I+=F>>>16,F&=65535,F+=o*A,I+=F>>>16,F&=65535,I+=i*v,T+=I>>>16,I&=65535,I+=s*A,T+=I>>>16,I&=65535,I+=o*f,T+=I>>>16,I&=65535,T+=n*v+i*A+s*f+o*l,T&=65535,zn(F<<16|N,T<<16|I,this.unsigned)};tr.mul=tr.multiply;tr.divide=function(e){if(vo(e)||(e=Ha(e)),e.isZero())throw Error("division by zero");if(ka){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var t=(this.unsigned?ka.div_u:ka.div_s)(this.low,this.high,e.low,e.high);return zn(t,ka.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Jc:xl;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Jc;if(e.gt(this.shru(1)))return S6;s=Jc}else{if(this.eq(jo)){if(e.eq(Kd)||e.eq(R2))return jo;if(e.eq(jo))return Kd;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(xl)?e.isNegative()?Kd:R2:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else if(e.eq(jo))return this.unsigned?Jc:xl;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=xl}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var l=Math.ceil(Math.log(n)/Math.LN2),f=l<=48?1:v_(2,l-48),A=Na(n),v=A.mul(e);v.isNegative()||v.gt(i);)n-=f,A=Na(n,this.unsigned),v=A.mul(e);A.isZero()&&(A=Kd),s=s.add(A),i=i.sub(v)}return s};tr.div=tr.divide;tr.modulo=function(e){if(vo(e)||(e=Ha(e)),ka){var t=(this.unsigned?ka.rem_u:ka.rem_s)(this.low,this.high,e.low,e.high);return zn(t,ka.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};tr.mod=tr.modulo;tr.rem=tr.modulo;tr.not=function(){return zn(~this.low,~this.high,this.unsigned)};tr.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};tr.clz=tr.countLeadingZeros;tr.countTrailingZeros=function(){return this.low?aM(this.low):aM(this.high)+32};tr.ctz=tr.countTrailingZeros;tr.and=function(e){return vo(e)||(e=Ha(e)),zn(this.low&e.low,this.high&e.high,this.unsigned)};tr.or=function(e){return vo(e)||(e=Ha(e)),zn(this.low|e.low,this.high|e.high,this.unsigned)};tr.xor=function(e){return vo(e)||(e=Ha(e)),zn(this.low^e.low,this.high^e.high,this.unsigned)};tr.shiftLeft=function(e){return vo(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?zn(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):zn(0,this.low<<e-32,this.unsigned)};tr.shl=tr.shiftLeft;tr.shiftRight=function(e){return vo(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?zn(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):zn(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};tr.shr=tr.shiftRight;tr.shiftRightUnsigned=function(e){return vo(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?zn(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?zn(this.high,0,this.unsigned):zn(this.high>>>e-32,0,this.unsigned)};tr.shru=tr.shiftRightUnsigned;tr.shr_u=tr.shiftRightUnsigned;tr.rotateLeft=function(e){var t;return vo(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?zn(this.high,this.low,this.unsigned):e<32?(t=32-e,zn(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(e-=32,t=32-e,zn(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))};tr.rotl=tr.rotateLeft;tr.rotateRight=function(e){var t;return vo(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?zn(this.high,this.low,this.unsigned):e<32?(t=32-e,zn(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(e-=32,t=32-e,zn(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))};tr.rotr=tr.rotateRight;tr.toSigned=function(){return this.unsigned?zn(this.low,this.high,!1):this};tr.toUnsigned=function(){return this.unsigned?this:zn(this.low,this.high,!0)};tr.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};tr.toBytesLE=function(){var e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>
4561>8&255,e>>>16&255,e>>>24]};tr.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]};Gn.fromBytes=function(e,t,n){return n?Gn.fromBytesLE(e,t):Gn.fromBytesBE(e,t)};Gn.fromBytesLE=function(e,t){return new Gn(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)};Gn.fromBytesBE=function(e,t){return new Gn(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};typeof BigInt=="function"&&(Gn.fromBigInt=function(e,t){var n=Number(BigInt.asIntN(32,e)),i=Number(BigInt.asIntN(32,e>>BigInt(32)));return zn(n,i,t)},Gn.fromValue=function(e,t){return typeof e=="bigint"?Gn.fromBigInt(e,t):Ha(e,t)},tr.toBigInt=function(){var e=BigInt(this.low>>>0),t=BigInt(this.unsigned?this.high>>>0:this.high);return t<<BigInt(32)|e});const RAe=16;function P6(r){r==="X"&&(r="");const e=r.padEnd(RAe,"0");return Gn.fromString(e,!0,16)}function OAe(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 DAe(r,e){const t=FAe(r).shiftRightUnsigned(2);return r.add(Gn.fromNumber(2*e+1-4).multiply(t))}function FAe(r){return r.and(r.not().add(1))}const LAe=3,kAe=30,NAe=2*kAe+1,dM=180/Math.PI;function UAe(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 l=i-1;l>=0;l--){s=i-l;const f=n[l];let A=0,v=0;f==="1"?v=1:f==="2"?(A=1,v=1):f==="3"&&(A=1);const T=Math.pow(2,s-1);VAe(T,o,A,v),o[0]+=T*A,o[1]+=T*v}if(t%2===1){const l=o[0];o[0]=o[1],o[1]=l}return{face:t,ij:o,level:s}}function zAe(r){if(r.isZero())return"";let e=r.toString(2);for(;e.length<LAe+NAe;)e="0"+e;const t=e.lastIndexOf("1"),n=e.substring(0,3),i=e.substring(3,t),s=i.length/2,o=Gn.fromString(n,!0,2).toString(10);let l="";if(s!==0)for(l=Gn.fromString(i,!0,2).toString(4);l.length<s;)l="0"+l;return`${o}/${l}`}function M6(r,e,t){const n=1<<e;return[(r[0]+t[0])/n,(r[1]+t[1])/n]}function pM(r){return r>=.5?1/3*(4*r*r-1):1/3*(1-4*(1-r)*(1-r))}function R6(r){return[pM(r[0]),pM(r[1])]}function O6(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 D6([r,e,t]){const n=Math.atan2(t,Math.sqrt(r*r+e*e));return[Math.atan2(e,r)*dM,n*dM]}function VAe(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 GAe(r){const e=M6(r.ij,r.level,[.5,.5]),t=R6(e),n=O6(r.face,t);return D6(n)}const jAe=100;function AM(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(jAe*Math.pow(2,-n))),o=new Float64Array(4*s*2+2);let l=0,f=0;for(let A=0;A<4;A++){const v=i[A].slice(0),T=i[A+1],I=(T[0]-v[0])/s,F=(T[1]-v[1])/s;for(let N=0;N<s;N++){v[0]+=I,v[1]+=F;const U=M6(t,n,v),$=R6(U),V=O6(e,$),j=D6(V);Math.abs(j[1])>89.999&&(j[0]=f);const X=j[0]-f;j[0]+=X>180?-360:X<-180?360:0,o[l++]=j[0],o[l++]=j[1],f=j[0]}}return o[l++]=o[0],o[l++]=o[1],o}function Xw(r){const e=HAe(r);return UAe(e)}function HAe(r){if(r.indexOf("/")>0)return r;const e=P6(r);return zAe(e)}function WAe(r){const e=Xw(r);return GAe(e)}function $Ae(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=Xw(s),l=AM(o);(typeof t>"u"||t===null)&&(t=new Float64Array(4*l.length)),t.set(l,n),n+=l.length}e=gM(t)}else{const t=AM(r);e=gM(t)}return e}function gM(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 XAe(r,e){const t=e?.minimumHeight||0,n=e?.maximumHeight||0,i=Xw(r),s=$Ae(i),o=s.west,l=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,l,t)),v.push(new dt(o,l,t)),v.push(new dt(o,A,n)),v.push(new dt(f,A,n)),v.push(new dt(f,l,n)),v.push(new dt(o,l,n)),v}function F6(r){const e=r.token,t={minimumHeight:r.minimumHeight,maximumHeight:r.maximumHeight},n=XAe(e,t),i=WAe(e),s=i[0],o=i[1],l=bi.WGS84.cartographicToCartesian([s,o,t.maximumHeight]),f=new dt(l[0],l[1],l[2]);n.push(f);const A=yL(n);return[...A.center,...A.halfAxes]}const qAe=4,JAe=8,KAe={QUADTREE:qAe,OCTREE:JAe};function ZAe(r,e,t){if(r?.box){const n=P6(r.s2VolumeInfo.token),i=DAe(n,e),s=OAe(i),o={...r.s2VolumeInfo};switch(o.token=s,t){case"OCTREE":const A=r.s2VolumeInfo,v=A.maximumHeight-A.minimumHeight,T=v/2,I=A.minimumHeight+v/2;A.minimumHeight=I-T,A.maximumHeight=I+T;break}return{box:F6(o),s2VolumeInfo:o}}}async function L6(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:l=0,globalData:f={level:0,mortonIndex:0,x:0,y:0,z:0}}=r;const{subdivisionScheme:A,subtreeLevels:v,maximumLevel:T,contentUrlTemplate:I,subtreesUriTemplate:F,basePath:N}=e,U={children:[],lodMetricValue:0,contentUrl:""};if(!T)return s4.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${I} won't be loaded...`),U;const $=l+f.level;if($>T)return U;const V=KAe[A],j=Math.log2(V),X=n&1,ue=n>>1&1,K=n>>2&1,se=(V**l-1)/(V-1);let Ee=Uf(t.mortonIndex,n,j),Ue=se+Ee,de=Uf(t.x,X,1),me=Uf(t.y,ue,1),pe=Uf(t.z,K,1),W=!1;l>=v&&(W=$b(o.childSubtreeAvailability,Ee));const re=Uf(f.x,de,l),Ce=Uf(f.y,me,l),et=Uf(f.z,pe,l);if(W){const tt=`${N}/${F}`,rt=O2(tt,$,re,Ce,et);o=await Kc(rt,E6,s),f={mortonIndex:Ee,x:de,y:me,z:pe,level:l},Ee=0,Ue=0,de=0,me=0,pe=0,l=0}if(!$b(o.tileAvailability,Ue))return U;$b(o.contentAvailability,Ue)&&(U.contentUrl=O2(I,$,re,Ce,et));const Ve=l+1,Ye={mortonIndex:Ee,x:de,y:me,z:pe};for(let tt=0;tt<V;tt++){const rt=ZAe(i,tt,A),ut=await L6({subtree:o,implicitOptions:e,loaderOptions:s,parentData:Ye,childIndex:tt,level:Ve,globalData:{...f},s2VolumeBox:rt});if(ut.contentUrl||ut.children.length){const vt=$+1,st=YAe(ut,vt,{childTileX:de,childTileY:me,childTileZ:pe},e,i);U.children.push(st)}}return U}function $b(r,e){let t;return Array.isArray(r)?(t=r[0],r.length>1&&s4.once('Not supported extension "3DTILES_multiple_contents" has been detected')):t=r,"constant"in t?!!t.constant:t.explicitBitstream?tge(e,t.explicitBitstream):!1}function YAe(r,e,t,n,i){const{basePath:s,refine:o,getRefine:l,lodMetricType:f,getTileType:A,rootLodMetricValue:v,rootBoundingVolume:T}=n,I=r.contentUrl&&r.contentUrl.replace(`${s}/`,""),F=v/2**e,N=i?.box?{box:i.box}:T,U=QAe(e,N,t);return{children:r.children,contentUrl:r.contentUrl,content:{uri:I},id:r.contentUrl,refine:l(o),type:A(r),lodMetricType:f,lodMetricValue:F,geometricError:F,transform:r.transform,boun
4561dingVolume:U}}function QAe(r,e,t){if(e.region){const{childTileX:n,childTileY:i,childTileZ:s}=t,[o,l,f,A,v,T]=e.region,I=2**r,F=(f-o)/I,N=(A-l)/I,U=(T-v)/I,[$,V]=[o+F*n,o+F*(n+1)],[j,X]=[l+N*i,l+N*(i+1)],[ue,K]=[v+U*s,v+U*(s+1)];return{region:[$,j,V,X,ue,K]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function Uf(r,e,t){return(r<<t)+e}function O2(r,e,t,n,i){const s=ege({level:e,x:t,y:n,z:i});return r.replace(/{level}|{x}|{y}|{z}/gi,o=>s[o])}function ege(r){const e={};for(const t in r)e[`{${t}}`]=r[t];return e}function tge(r,e){const t=Math.floor(r/8),n=r%8;return(e[t]>>n&1)===1}function qw(r,e=""){if(!e)return qc.EMPTY;const n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return qc.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return qc.SCENEGRAPH;default:return n||qc.EMPTY}}function Jw(r){switch(r){case"REPLACE":case"replace":return Tl.REPLACE;case"ADD":case"add":return Tl.ADD;default:return r}}function D2(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 woe(e,r)}function mM(r,e){if(!r)return null;let t;if(r.content){const i=r.content.uri||r.content?.url;typeof i<"u"&&(t=D2(i,e))}return{...r,id:t,contentUrl:t,lodMetricType:vp.GEOMETRIC_ERROR,lodMetricValue:r.geometricError,transformMatrix:r.transform,type:qw(r,t),refine:Jw(r.refine)}}async function rge(r,e,t){let n=null;const i=yM(r.root);i&&r.root?n=await _M(r.root,r,e,i,t):n=mM(r.root,e);const s=[];for(s.push(n);s.length>0;){const o=s.pop()||{},l=o.children||[],f=[];for(const A of l){const v=yM(A);let T;v?T=await _M(A,r,e,v,t):T=mM(A,e),T&&(f.push(T),s.push(T))}o.children=f}return n}async function _M(r,e,t,n,i){const{subdivisionScheme:s,maximumLevel:o,availableLevels:l,subtreeLevels:f,subtrees:{uri:A}}=n,v=O2(A,0,0,0,0),T=D2(v,t),I=await Kc(T,E6,i),F=r.content?.uri,N=F?D2(F,t):"",U=e?.root?.refine,$=r.geometricError,V=r.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(V){const K={box:F6(V),s2VolumeInfo:V};r.boundingVolume=K}const j=r.boundingVolume,X={contentUrlTemplate:N,subtreesUriTemplate:A,subdivisionScheme:s,subtreeLevels:f,maximumLevel:Number.isFinite(l)?l-1:o,refine:U,basePath:t,lodMetricType:vp.GEOMETRIC_ERROR,rootLodMetricValue:$,rootBoundingVolume:j,getTileType:qw,getRefine:Jw};return await nge(r,t,I,X,i)}async function nge(r,e,t,n,i){if(!r)return null;const{children:s,contentUrl:o}=await L6({subtree:t,implicitOptions:n,loaderOptions:i});let l,f=null;return o&&(l=o,f={uri:o.replace(`${e}/`,"")}),{...r,id:l,contentUrl:l,lodMetricType:vp.GEOMETRIC_ERROR,lodMetricValue:r.geometricError,transformMatrix:r.transform,type:qw(r,l),refine:Jw(r.refine),content:f||r.content,children:s}}function yM(r){return r?.extensions?.["3DTILES_implicit_tiling"]||r?.implicitTiling}const k6={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:JL,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:ige,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function ige(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?sge(r,e,t):oge(r,e,t)}async function sge(r,e,t){const n=JSON.parse(new TextDecoder().decode(r)),i=t?.url||"",s=age(i),o=await rge(n,s,e||{});return{...n,shape:"tileset3d",loader:k6,url:i,queryString:t?.queryString||"",basePath:s,root:o||n.root,type:zo.TILES3D,lodMetricType:vp.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function oge(r,e,t){const n={content:{shape:"tile3d",featureIds:null}};return await T6(r,0,e,t,n.content),n.content}function age(r){return hL(r)}var Xb={},vM;function cf(){return vM||(vM=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 l=o.shift();if(l){if(typeof l!="object")throw new TypeError(l+"must be non-object");for(var f in l)t(l,f)&&(s[f]=l[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,l,f,A){if(o.subarray&&s.subarray){s.set(o.subarray(l,l+f),A);return}for(var v=0;v<f;v++)s[A+v]=o[l+v]},flattenChunks:function(s){var o,l,f,A,v,T;for(f=0,o=0,l=s.length;o<l;o++)f+=s[o].length;for(T=new Uint8Array(f),A=0,o=0,l=s.length;o<l;o++)v=s[o],T.set(v,A),A+=v.length;return T}},i={arraySet:function(s,o,l,f,A){for(var v=0;v<f;v++)s[A+v]=o[l+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)})(Xb)),Xb}var vd={},ul={},zf={},bM;function lge(){if(bM)return zf;bM=1;var r=cf(),e=4,t=0,n=1,i=2;function s(Pe){for(var kt=Pe.length;--kt>=0;)Pe[kt]=0}var o=0,l=1,f=2,A=3,v=258,T=29,I=256,F=I+1+T,N=30,U=19,$=2*F+1,V=15,j=16,X=7,ue=256,K=16,se=17,Ee=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 Ce=new Array(N*2);s(Ce);var et=new Array(W);s(et);var _e=new Array(v-A+1);s(_e);var Le=new Array(T);s(Le);var Ve=new Array(N);s(Ve);function Ye(Pe,kt,Wt,cr,Ze){this.static_tree=Pe,this.extra_bits=kt,this.extra_base=Wt,this.elems=cr,this.max_length=Ze,this.has_stree=Pe&&Pe.length}var tt,rt,ut;function vt(Pe,kt){this.dyn_tree=Pe,this.max_code=0,this.stat_desc=kt}function It(Pe){return Pe<256?et[Pe]:et[256+(Pe>>>7)]}function st(Pe,kt){Pe.pending_buf[Pe.pending++]=kt&255,Pe.pending_buf[Pe.pending++]=kt>>>8&255}function dr(Pe,kt,Wt){Pe.bi_valid>j-Wt?(Pe.bi_buf|=kt<<Pe.bi_valid&65535,st(Pe,Pe.bi_buf),Pe.bi_buf=kt>>j-Pe.bi_valid,Pe.bi_valid+=Wt-j):(Pe.bi_buf|=kt<<Pe.bi_valid&65535,Pe.bi_valid+=Wt)}function er(Pe,kt,Wt){dr(Pe,Wt[kt*2],Wt[kt*2+1])}function Jt(Pe,kt){var Wt=0;do Wt|=Pe&1,Pe>>>=1,Wt<<=1;while(--kt>0);return Wt>>>1}function Nt(Pe){Pe.bi_valid===16?(st(Pe,Pe.bi_buf),Pe.bi_buf=0,Pe.bi_valid=0):Pe.bi_valid>=8&&(Pe.pending_buf[Pe.pending++]=Pe.bi_buf&255,Pe.bi_buf>>=8,Pe.bi_valid-=8)}function Ar(Pe,kt){var Wt=kt.dyn_tree,cr=kt.max_code,Ze=kt.stat_desc.static_tree,Rt=kt.stat_desc.has_stree,Ae=kt.stat_desc.extra_bits,Vt=kt.stat_desc.extra_base,Et=kt.stat_desc.max_length,H,bt,St,Te,Xe,ct,Z=0;for(Te=0;Te<=V;Te++)Pe.bl_count[Te]=0;
vendor: 7,515 bytes, line 4561
4561for(Wt[Pe.heap[Pe.heap_max]*2+1]=0,H=Pe.heap_max+1;H<$;H++)bt=Pe.heap[H],Te=Wt[Wt[bt*2+1]*2+1]+1,Te>Et&&(Te=Et,Z++),Wt[bt*2+1]=Te,!(bt>cr)&&(Pe.bl_count[Te]++,Xe=0,bt>=Vt&&(Xe=Ae[bt-Vt]),ct=Wt[bt*2],Pe.opt_len+=ct*(Te+Xe),Rt&&(Pe.static_len+=ct*(Ze[bt*2+1]+Xe)));if(Z!==0){do{for(Te=Et-1;Pe.bl_count[Te]===0;)Te--;Pe.bl_count[Te]--,Pe.bl_count[Te+1]+=2,Pe.bl_count[Et]--,Z-=2}while(Z>0);for(Te=Et;Te!==0;Te--)for(bt=Pe.bl_count[Te];bt!==0;)St=Pe.heap[--H],!(St>cr)&&(Wt[St*2+1]!==Te&&(Pe.opt_len+=(Te-Wt[St*2+1])*Wt[St*2],Wt[St*2+1]=Te),bt--)}}function cn(Pe,kt,Wt){var cr=new Array(V+1),Ze=0,Rt,Ae;for(Rt=1;Rt<=V;Rt++)cr[Rt]=Ze=Ze+Wt[Rt-1]<<1;for(Ae=0;Ae<=kt;Ae++){var Vt=Pe[Ae*2+1];Vt!==0&&(Pe[Ae*2]=Jt(cr[Vt]++,Vt))}}function Mr(){var Pe,kt,Wt,cr,Ze,Rt=new Array(V+1);for(Wt=0,cr=0;cr<T-1;cr++)for(Le[cr]=Wt,Pe=0;Pe<1<<Ue[cr];Pe++)_e[Wt++]=cr;for(_e[Wt-1]=cr,Ze=0,cr=0;cr<16;cr++)for(Ve[cr]=Ze,Pe=0;Pe<1<<de[cr];Pe++)et[Ze++]=cr;for(Ze>>=7;cr<N;cr++)for(Ve[cr]=Ze<<7,Pe=0;Pe<1<<de[cr]-7;Pe++)et[256+Ze++]=cr;for(kt=0;kt<=V;kt++)Rt[kt]=0;for(Pe=0;Pe<=143;)re[Pe*2+1]=8,Pe++,Rt[8]++;for(;Pe<=255;)re[Pe*2+1]=9,Pe++,Rt[9]++;for(;Pe<=279;)re[Pe*2+1]=7,Pe++,Rt[7]++;for(;Pe<=287;)re[Pe*2+1]=8,Pe++,Rt[8]++;for(cn(re,F+1,Rt),Pe=0;Pe<N;Pe++)Ce[Pe*2+1]=5,Ce[Pe*2]=Jt(Pe,5);tt=new Ye(re,Ue,I+1,F,V),rt=new Ye(Ce,de,0,N,V),ut=new Ye(new Array(0),me,0,U,X)}function xr(Pe){var kt;for(kt=0;kt<F;kt++)Pe.dyn_ltree[kt*2]=0;for(kt=0;kt<N;kt++)Pe.dyn_dtree[kt*2]=0;for(kt=0;kt<U;kt++)Pe.bl_tree[kt*2]=0;Pe.dyn_ltree[ue*2]=1,Pe.opt_len=Pe.static_len=0,Pe.last_lit=Pe.matches=0}function jn(Pe){Pe.bi_valid>8?st(Pe,Pe.bi_buf):Pe.bi_valid>0&&(Pe.pending_buf[Pe.pending++]=Pe.bi_buf),Pe.bi_buf=0,Pe.bi_valid=0}function _r(Pe,kt,Wt,cr){jn(Pe),st(Pe,Wt),st(Pe,~Wt),r.arraySet(Pe.pending_buf,Pe.window,kt,Wt,Pe.pending),Pe.pending+=Wt}function yr(Pe,kt,Wt,cr){var Ze=kt*2,Rt=Wt*2;return Pe[Ze]<Pe[Rt]||Pe[Ze]===Pe[Rt]&&cr[kt]<=cr[Wt]}function un(Pe,kt,Wt){for(var cr=Pe.heap[Wt],Ze=Wt<<1;Ze<=Pe.heap_len&&(Ze<Pe.heap_len&&yr(kt,Pe.heap[Ze+1],Pe.heap[Ze],Pe.depth)&&Ze++,!yr(kt,cr,Pe.heap[Ze],Pe.depth));)Pe.heap[Wt]=Pe.heap[Ze],Wt=Ze,Ze<<=1;Pe.heap[Wt]=cr}function Dr(Pe,kt,Wt){var cr,Ze,Rt=0,Ae,Vt;if(Pe.last_lit!==0)do cr=Pe.pending_buf[Pe.d_buf+Rt*2]<<8|Pe.pending_buf[Pe.d_buf+Rt*2+1],Ze=Pe.pending_buf[Pe.l_buf+Rt],Rt++,cr===0?er(Pe,Ze,kt):(Ae=_e[Ze],er(Pe,Ae+I+1,kt),Vt=Ue[Ae],Vt!==0&&(Ze-=Le[Ae],dr(Pe,Ze,Vt)),cr--,Ae=It(cr),er(Pe,Ae,Wt),Vt=de[Ae],Vt!==0&&(cr-=Ve[Ae],dr(Pe,cr,Vt)));while(Rt<Pe.last_lit);er(Pe,ue,kt)}function li(Pe,kt){var Wt=kt.dyn_tree,cr=kt.stat_desc.static_tree,Ze=kt.stat_desc.has_stree,Rt=kt.stat_desc.elems,Ae,Vt,Et=-1,H;for(Pe.heap_len=0,Pe.heap_max=$,Ae=0;Ae<Rt;Ae++)Wt[Ae*2]!==0?(Pe.heap[++Pe.heap_len]=Et=Ae,Pe.depth[Ae]=0):Wt[Ae*2+1]=0;for(;Pe.heap_len<2;)H=Pe.heap[++Pe.heap_len]=Et<2?++Et:0,Wt[H*2]=1,Pe.depth[H]=0,Pe.opt_len--,Ze&&(Pe.static_len-=cr[H*2+1]);for(kt.max_code=Et,Ae=Pe.heap_len>>1;Ae>=1;Ae--)un(Pe,Wt,Ae);H=Rt;do Ae=Pe.heap[1],Pe.heap[1]=Pe.heap[Pe.heap_len--],un(Pe,Wt,1),Vt=Pe.heap[1],Pe.heap[--Pe.heap_max]=Ae,Pe.heap[--Pe.heap_max]=Vt,Wt[H*2]=Wt[Ae*2]+Wt[Vt*2],Pe.depth[H]=(Pe.depth[Ae]>=Pe.depth[Vt]?Pe.depth[Ae]:Pe.depth[Vt])+1,Wt[Ae*2+1]=Wt[Vt*2+1]=H,Pe.heap[1]=H++,un(Pe,Wt,1);while(Pe.heap_len>=2);Pe.heap[--Pe.heap_max]=Pe.heap[1],Ar(Pe,kt),cn(Wt,Et,Pe.bl_count)}function Yn(Pe,kt,Wt){var cr,Ze=-1,Rt,Ae=kt[1],Vt=0,Et=7,H=4;for(Ae===0&&(Et=138,H=3),kt[(Wt+1)*2+1]=65535,cr=0;cr<=Wt;cr++)Rt=Ae,Ae=kt[(cr+1)*2+1],!(++Vt<Et&&Rt===Ae)&&(Vt<H?Pe.bl_tree[Rt*2]+=Vt:Rt!==0?(Rt!==Ze&&Pe.bl_tree[Rt*2]++,Pe.bl_tree[K*2]++):Vt<=10?Pe.bl_tree[se*2]++:Pe.bl_tree[Ee*2]++,Vt=0,Ze=Rt,Ae===0?(Et=138,H=3):Rt===Ae?(Et=6,H=3):(Et=7,H=4))}function mn(Pe,kt,Wt){var cr,Ze=-1,Rt,Ae=kt[1],Vt=0,Et=7,H=4;for(Ae===0&&(Et=138,H=3),cr=0;cr<=Wt;cr++)if(Rt=Ae,Ae=kt[(cr+1)*2+1],!(++Vt<Et&&Rt===Ae)){if(Vt<H)do er(Pe,Rt,Pe.bl_tree);while(--Vt!==0);else Rt!==0?(Rt!==Ze&&(er(Pe,Rt,Pe.bl_tree),Vt--),er(Pe,K,Pe.bl_tree),dr(Pe,Vt-3,2)):Vt<=10?(er(Pe,se,Pe.bl_tree),dr(Pe,Vt-3,3)):(er(Pe,Ee,Pe.bl_tree),dr(Pe,Vt-11,7));Vt=0,Ze=Rt,Ae===0?(Et=138,H=3):Rt===Ae?(Et=6,H=3):(Et=7,H=4)}}function ri(Pe){var kt;for(Yn(Pe,Pe.dyn_ltree,Pe.l_desc.max_code),Yn(Pe,Pe.dyn_dtree,Pe.d_desc.max_code),li(Pe,Pe.bl_desc),kt=U-1;kt>=3&&Pe.bl_tree[pe[kt]*2+1]===0;kt--);return Pe.opt_len+=3*(kt+1)+5+5+4,kt}function Hn(Pe,kt,Wt,cr){var Ze;for(dr(Pe,kt-257,5),dr(Pe,Wt-1,5),dr(Pe,cr-4,4),Ze=0;Ze<cr;Ze++)dr(Pe,Pe.bl_tree[pe[Ze]*2+1],3);mn(Pe,Pe.dyn_ltree,kt-1),mn(Pe,Pe.dyn_dtree,Wt-1)}function Sn(Pe){var kt=4093624447,Wt;for(Wt=0;Wt<=31;Wt++,kt>>>=1)if(kt&1&&Pe.dyn_ltree[Wt*2]!==0)return t;if(Pe.dyn_ltree[18]!==0||Pe.dyn_ltree[20]!==0||Pe.dyn_ltree[26]!==0)return n;for(Wt=32;Wt<I;Wt++)if(Pe.dyn_ltree[Wt*2]!==0)return n;return t}var Qn=!1;function Gt(Pe){Qn||(Mr(),Qn=!0),Pe.l_desc=new vt(Pe.dyn_ltree,tt),Pe.d_desc=new vt(Pe.dyn_dtree,rt),Pe.bl_desc=new vt(Pe.bl_tree,ut),Pe.bi_buf=0,Pe.bi_valid=0,xr(Pe)}function mr(Pe,kt,Wt,cr){dr(Pe,(o<<1)+(cr?1:0),3),_r(Pe,kt,Wt)}function Rr(Pe){dr(Pe,l<<1,3),er(Pe,ue,re),Nt(Pe)}function nn(Pe,kt,Wt,cr){var Ze,Rt,Ae=0;Pe.level>0?(Pe.strm.data_type===i&&(Pe.strm.data_type=Sn(Pe)),li(Pe,Pe.l_desc),li(Pe,Pe.d_desc),Ae=ri(Pe),Ze=Pe.opt_len+3+7>>>3,Rt=Pe.static_len+3+7>>>3,Rt<=Ze&&(Ze=Rt)):Ze=Rt=Wt+5,Wt+4<=Ze&&kt!==-1?mr(Pe,kt,Wt,cr):Pe.strategy===e||Rt===Ze?(dr(Pe,(l<<1)+(cr?1:0),3),Dr(Pe,re,Ce)):(dr(Pe,(f<<1)+(cr?1:0),3),Hn(Pe,Pe.l_desc.max_code+1,Pe.d_desc.max_code+1,Ae+1),Dr(Pe,Pe.dyn_ltree,Pe.dyn_dtree)),xr(Pe),cr&&jn(Pe)}function gi(Pe,kt,Wt){return Pe.pending_buf[Pe.d_buf+Pe.last_lit*2]=kt>>>8&255,Pe.pending_buf[Pe.d_buf+Pe.last_lit*2+1]=kt&255,Pe.pending_buf[Pe.l_buf+Pe.last_lit]=Wt&255,Pe.last_lit++,kt===0?Pe.dyn_ltree[Wt*2]++:(Pe.matches++,kt--,Pe.dyn_ltree[(_e[Wt]+I+1)*2]++,Pe.dyn_dtree[It(kt)*2]++),Pe.last_lit===Pe.lit_bufsize-1}return zf._tr_init=Gt,zf._tr_stored_block=mr,zf._tr_flush_block=nn,zf._tr_tally=gi,zf._tr_align=Rr,zf}var qb,xM;function N6(){if(xM)return qb;xM=1;function r(e,t,n,i){for(var s=e&65535|0,o=e>>>16&65535|0,l=0;n!==0;){l=n>2e3?2e3:n,n-=l;do s=s+t[i++]|0,o=o+s|0;while(--l);s%=65521,o%=65521}return s|o<<16|0}return qb=r,qb}var Jb,wM;function U6(){if(wM)return Jb;wM=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 l=e,f=o+s;n^=-1;for(var A=o;A<f;A++)n=n>>>8^l[(n^i[A])&255];return n^-1}return Jb=t,Jb}var Kb,TM;function Kw(){return TM||(TM=1,Kb={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"}),Kb}var EM;function cge(){if(EM)return ul;EM=1;var r=cf(),e=lge(),t=N6(),n=U6(),i=Kw(),s=0,o=1,l=3,f=4,A=5,v=0,T=1,I=-2,F=-3,N=-5,U=-1,$=1,V=2,j=3,X=4,ue=0,K=2,se=8,Ee=9,Ue=15,de=8,me=29,pe=256,W=pe+1+me,re=30,Ce=19,et=2*W+1,_e=15,Le=3,Ve=258,Ye=Ve+Le+1,tt=32,rt=42,ut=69,vt=73,It=91,st=103,dr=113,er=666,Jt=1,Nt=2,Ar=3,cn=4,Mr=3;function xr(H,bt){return H.msg=i[bt],bt}function jn(H){return(H<<1)-(H>4?9:0)}function _r(H){for(var bt=H.length;--bt>=0;)H[bt]=0}function yr(H){var bt=H.state,St=bt.pending;St>H.avail_out&&(St=H.avail_out),St!==0&&(r.arraySet(H.output,bt.pending_buf,bt.pending_out,St,H.next_out),H.next_out+=St,bt.pending_out+=St,H.total_out+=St,H.avail_out-=St,bt.pending-=St,bt.pending===0&&(bt.pending_out=0))}function un(H,bt){e._tr_flush_block(H,H.block_start>=0?H.block_start:-1,H.strstart-H.block_start,bt),H.block_start=H.strstart,yr(H.strm)}function Dr(H,bt){H.pending_buf[H.pending++]=bt}
vendor: 10,482 bytes, line 4561
4561function li(H,bt){H.pending_buf[H.pending++]=bt>>>8&255,H.pending_buf[H.pending++]=bt&255}function Yn(H,bt,St,Te){var Xe=H.avail_in;return Xe>Te&&(Xe=Te),Xe===0?0:(H.avail_in-=Xe,r.arraySet(bt,H.input,H.next_in,Xe,St),H.state.wrap===1?H.adler=t(H.adler,bt,Xe,St):H.state.wrap===2&&(H.adler=n(H.adler,bt,Xe,St)),H.next_in+=Xe,H.total_in+=Xe,Xe)}function mn(H,bt){var St=H.max_chain_length,Te=H.strstart,Xe,ct,Z=H.prev_length,ne=H.nice_match,ce=H.strstart>H.w_size-Ye?H.strstart-(H.w_size-Ye):0,ve=H.window,Fe=H.w_mask,he=H.prev,be=H.strstart+Ve,ae=ve[Te+Z-1],Se=ve[Te+Z];H.prev_length>=H.good_match&&(St>>=2),ne>H.lookahead&&(ne=H.lookahead);do if(Xe=bt,!(ve[Xe+Z]!==Se||ve[Xe+Z-1]!==ae||ve[Xe]!==ve[Te]||ve[++Xe]!==ve[Te+1])){Te+=2,Xe++;do;while(ve[++Te]===ve[++Xe]&&ve[++Te]===ve[++Xe]&&ve[++Te]===ve[++Xe]&&ve[++Te]===ve[++Xe]&&ve[++Te]===ve[++Xe]&&ve[++Te]===ve[++Xe]&&ve[++Te]===ve[++Xe]&&ve[++Te]===ve[++Xe]&&Te<be);if(ct=Ve-(be-Te),Te=be-Ve,ct>Z){if(H.match_start=bt,Z=ct,ct>=ne)break;ae=ve[Te+Z-1],Se=ve[Te+Z]}}while((bt=he[bt&Fe])>ce&&--St!==0);return Z<=H.lookahead?Z:H.lookahead}function ri(H){var bt=H.w_size,St,Te,Xe,ct,Z;do{if(ct=H.window_size-H.lookahead-H.strstart,H.strstart>=bt+(bt-Ye)){r.arraySet(H.window,H.window,bt,bt,0),H.match_start-=bt,H.strstart-=bt,H.block_start-=bt,Te=H.hash_size,St=Te;do Xe=H.head[--St],H.head[St]=Xe>=bt?Xe-bt:0;while(--Te);Te=bt,St=Te;do Xe=H.prev[--St],H.prev[St]=Xe>=bt?Xe-bt:0;while(--Te);ct+=bt}if(H.strm.avail_in===0)break;if(Te=Yn(H.strm,H.window,H.strstart+H.lookahead,ct),H.lookahead+=Te,H.lookahead+H.insert>=Le)for(Z=H.strstart-H.insert,H.ins_h=H.window[Z],H.ins_h=(H.ins_h<<H.hash_shift^H.window[Z+1])&H.hash_mask;H.insert&&(H.ins_h=(H.ins_h<<H.hash_shift^H.window[Z+Le-1])&H.hash_mask,H.prev[Z&H.w_mask]=H.head[H.ins_h],H.head[H.ins_h]=Z,Z++,H.insert--,!(H.lookahead+H.insert<Le)););}while(H.lookahead<Ye&&H.strm.avail_in!==0)}function Hn(H,bt){var St=65535;for(St>H.pending_buf_size-5&&(St=H.pending_buf_size-5);;){if(H.lookahead<=1){if(ri(H),H.lookahead===0&&bt===s)return Jt;if(H.lookahead===0)break}H.strstart+=H.lookahead,H.lookahead=0;var Te=H.block_start+St;if((H.strstart===0||H.strstart>=Te)&&(H.lookahead=H.strstart-Te,H.strstart=Te,un(H,!1),H.strm.avail_out===0)||H.strstart-H.block_start>=H.w_size-Ye&&(un(H,!1),H.strm.avail_out===0))return Jt}return H.insert=0,bt===f?(un(H,!0),H.strm.avail_out===0?Ar:cn):(H.strstart>H.block_start&&(un(H,!1),H.strm.avail_out===0),Jt)}function Sn(H,bt){for(var St,Te;;){if(H.lookahead<Ye){if(ri(H),H.lookahead<Ye&&bt===s)return Jt;if(H.lookahead===0)break}if(St=0,H.lookahead>=Le&&(H.ins_h=(H.ins_h<<H.hash_shift^H.window[H.strstart+Le-1])&H.hash_mask,St=H.prev[H.strstart&H.w_mask]=H.head[H.ins_h],H.head[H.ins_h]=H.strstart),St!==0&&H.strstart-St<=H.w_size-Ye&&(H.match_length=mn(H,St)),H.match_length>=Le)if(Te=e._tr_tally(H,H.strstart-H.match_start,H.match_length-Le),H.lookahead-=H.match_length,H.match_length<=H.max_lazy_match&&H.lookahead>=Le){H.match_length--;do H.strstart++,H.ins_h=(H.ins_h<<H.hash_shift^H.window[H.strstart+Le-1])&H.hash_mask,St=H.prev[H.strstart&H.w_mask]=H.head[H.ins_h],H.head[H.ins_h]=H.strstart;while(--H.match_length!==0);H.strstart++}else H.strstart+=H.match_length,H.match_length=0,H.ins_h=H.window[H.strstart],H.ins_h=(H.ins_h<<H.hash_shift^H.window[H.strstart+1])&H.hash_mask;else Te=e._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++;if(Te&&(un(H,!1),H.strm.avail_out===0))return Jt}return H.insert=H.strstart<Le-1?H.strstart:Le-1,bt===f?(un(H,!0),H.strm.avail_out===0?Ar:cn):H.last_lit&&(un(H,!1),H.strm.avail_out===0)?Jt:Nt}function Qn(H,bt){for(var St,Te,Xe;;){if(H.lookahead<Ye){if(ri(H),H.lookahead<Ye&&bt===s)return Jt;if(H.lookahead===0)break}if(St=0,H.lookahead>=Le&&(H.ins_h=(H.ins_h<<H.hash_shift^H.window[H.strstart+Le-1])&H.hash_mask,St=H.prev[H.strstart&H.w_mask]=H.head[H.ins_h],H.head[H.ins_h]=H.strstart),H.prev_length=H.match_length,H.prev_match=H.match_start,H.match_length=Le-1,St!==0&&H.prev_length<H.max_lazy_match&&H.strstart-St<=H.w_size-Ye&&(H.match_length=mn(H,St),H.match_length<=5&&(H.strategy===$||H.match_length===Le&&H.strstart-H.match_start>4096)&&(H.match_length=Le-1)),H.prev_length>=Le&&H.match_length<=H.prev_length){Xe=H.strstart+H.lookahead-Le,Te=e._tr_tally(H,H.strstart-1-H.prev_match,H.prev_length-Le),H.lookahead-=H.prev_length-1,H.prev_length-=2;do++H.strstart<=Xe&&(H.ins_h=(H.ins_h<<H.hash_shift^H.window[H.strstart+Le-1])&H.hash_mask,St=H.prev[H.strstart&H.w_mask]=H.head[H.ins_h],H.head[H.ins_h]=H.strstart);while(--H.prev_length!==0);if(H.match_available=0,H.match_length=Le-1,H.strstart++,Te&&(un(H,!1),H.strm.avail_out===0))return Jt}else if(H.match_available){if(Te=e._tr_tally(H,0,H.window[H.strstart-1]),Te&&un(H,!1),H.strstart++,H.lookahead--,H.strm.avail_out===0)return Jt}else H.match_available=1,H.strstart++,H.lookahead--}return H.match_available&&(Te=e._tr_tally(H,0,H.window[H.strstart-1]),H.match_available=0),H.insert=H.strstart<Le-1?H.strstart:Le-1,bt===f?(un(H,!0),H.strm.avail_out===0?Ar:cn):H.last_lit&&(un(H,!1),H.strm.avail_out===0)?Jt:Nt}function Gt(H,bt){for(var St,Te,Xe,ct,Z=H.window;;){if(H.lookahead<=Ve){if(ri(H),H.lookahead<=Ve&&bt===s)return Jt;if(H.lookahead===0)break}if(H.match_length=0,H.lookahead>=Le&&H.strstart>0&&(Xe=H.strstart-1,Te=Z[Xe],Te===Z[++Xe]&&Te===Z[++Xe]&&Te===Z[++Xe])){ct=H.strstart+Ve;do;while(Te===Z[++Xe]&&Te===Z[++Xe]&&Te===Z[++Xe]&&Te===Z[++Xe]&&Te===Z[++Xe]&&Te===Z[++Xe]&&Te===Z[++Xe]&&Te===Z[++Xe]&&Xe<ct);H.match_length=Ve-(ct-Xe),H.match_length>H.lookahead&&(H.match_length=H.lookahead)}if(H.match_length>=Le?(St=e._tr_tally(H,1,H.match_length-Le),H.lookahead-=H.match_length,H.strstart+=H.match_length,H.match_length=0):(St=e._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++),St&&(un(H,!1),H.strm.avail_out===0))return Jt}return H.insert=0,bt===f?(un(H,!0),H.strm.avail_out===0?Ar:cn):H.last_lit&&(un(H,!1),H.strm.avail_out===0)?Jt:Nt}function mr(H,bt){for(var St;;){if(H.lookahead===0&&(ri(H),H.lookahead===0)){if(bt===s)return Jt;break}if(H.match_length=0,St=e._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++,St&&(un(H,!1),H.strm.avail_out===0))return Jt}return H.insert=0,bt===f?(un(H,!0),H.strm.avail_out===0?Ar:cn):H.last_lit&&(un(H,!1),H.strm.avail_out===0)?Jt:Nt}function Rr(H,bt,St,Te,Xe){this.good_length=H,this.max_lazy=bt,this.nice_length=St,this.max_chain=Te,this.func=Xe}var nn;nn=[new Rr(0,0,0,0,Hn),new Rr(4,4,8,4,Sn),new Rr(4,5,16,8,Sn),new Rr(4,6,32,32,Sn),new Rr(4,4,16,16,Qn),new Rr(8,16,32,32,Qn),new Rr(8,16,128,128,Qn),new Rr(8,32,128,256,Qn),new Rr(32,128,258,1024,Qn),new Rr(32,258,258,4096,Qn)];function gi(H){H.window_size=2*H.w_size,_r(H.head),H.max_lazy_match=nn[H.level].max_lazy,H.good_match=nn[H.level].good_length,H.nice_match=nn[H.level].nice_length,H.max_chain_length=nn[H.level].max_chain,H.strstart=0,H.block_start=0,H.lookahead=0,H.insert=0,H.match_length=H.prev_length=Le-1,H.match_available=0,H.ins_h=0}function Pe(){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*Ce+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(H){var bt;return!H||!H.state?xr(H,I):(H.total_in=H.total_out=0,H.data_type=K,bt=H.state,bt.pending=0,bt.pending_out=0,bt.wrap<0&&(bt.wrap=-bt.wrap),bt.status=bt.wrap?rt:dr,H.adler=bt.wrap===2?0:1,bt.last_flush=s,e._tr_init(bt),v)}function Wt(H){var bt=kt(H);return bt===v&&gi(H.state),bt}function cr(H,bt){return!H||!H.state||H.state.wrap!==2?I:(H.state.gzhead=bt,v)}function Ze(H,bt,St,Te,Xe,ct){if(!H)return I;var Z=1;if(bt===U&&(bt=6),Te<0?(Z=0,Te=-Te):Te>15&&(Z=2,Te-=16),Xe<1||Xe>Ee||St!==se||Te<8||Te>15||bt<0||bt>9||ct<0||ct>X)return xr(H,I);Te===8&&(Te=9);var ne=new Pe;return H.state=ne,ne.strm=H,ne.wrap=Z,ne.gzhead=null,ne.w_bits=Te,ne.w_size=1<<ne.w_bits,ne.w_mask=ne.w_size-1,ne.hash_bits=Xe+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<<Xe+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=ct,ne.method=St,Wt(H)}function Rt(H,bt){return Ze(H,bt,se,Ue,de,ue)}function Ae(H,bt){var St,Te,Xe,ct;if(!H||!H.state||bt>A||bt<0)return H?xr(H,I):I;if(Te=H.state,!H.output||!H.input&&H.avail_in!==0||Te.status===er&&bt!==f)return xr(H,H.avail_out===0?N:I);if(Te.strm=H,St=Te.last_flush,Te.last_flush=bt,Te.status===rt)if(Te.wrap===2)H.adler=0,Dr(Te,31),Dr(Te,139),Dr(Te,8),Te.gzhead?(Dr(Te,(Te.gzhead.text?1:0)+(Te.gzhead.hcrc?2:0)+(Te.gzhead.extra?4:0)+(Te.gzhead.name?8:0)+(Te.gzhead.comment?16:0)),Dr(Te,Te.gzhead.time&255),Dr(Te,Te.gzhead.time>>8&255),Dr(Te,Te.gzhead.time>>16&255),Dr(Te,Te.gzhead.time>>24&255),Dr(Te,Te.level===9?2:Te.strategy>=V||Te.level<2?4:0),Dr(Te,Te.gzhead.os&255),Te.gzhead.extra&&Te.gzhead.extra.length&&(Dr(Te,Te.gzhead.extra.length&255),Dr(Te,Te.gzhead.extra.length>>8&255)),Te.gzhead.hcrc&&(H.adler=n(H.adler,Te.pending_buf,Te.pending,0)),Te.gzindex=0,Te.status=ut):(Dr(Te,0),Dr(Te,0),Dr(Te,0),Dr(Te,0),Dr(Te,0),Dr(Te,Te.level===9?2:Te.strategy>=V||Te.level<2?4:0),Dr(Te,Mr),Te.status=dr);else{var Z=se+(Te.w_bits-8<<4)<<8,ne=-1;Te.strategy>=V||Te.level<2?ne=0:Te.level<6?ne=1:Te.level===6?ne=2:ne=3,Z|=ne<<6,Te.strstart!==0&&(Z|=tt),Z+=31-Z%31,Te.status=dr,li(Te,Z),Te.strstart!==0&&(li(Te,H.adler>>>16),li(Te,H.adler&65535)),H.adler=1}
vendor: 7,067 bytes, line 4561
4561if(Te.status===ut)if(Te.gzhead.extra){for(Xe=Te.pending;Te.gzindex<(Te.gzhead.extra.length&65535)&&!(Te.pending===Te.pending_buf_size&&(Te.gzhead.hcrc&&Te.pending>Xe&&(H.adler=n(H.adler,Te.pending_buf,Te.pending-Xe,Xe)),yr(H),Xe=Te.pending,Te.pending===Te.pending_buf_size));)Dr(Te,Te.gzhead.extra[Te.gzindex]&255),Te.gzindex++;Te.gzhead.hcrc&&Te.pending>Xe&&(H.adler=n(H.adler,Te.pending_buf,Te.pending-Xe,Xe)),Te.gzindex===Te.gzhead.extra.length&&(Te.gzindex=0,Te.status=vt)}else Te.status=vt;if(Te.status===vt)if(Te.gzhead.name){Xe=Te.pending;do{if(Te.pending===Te.pending_buf_size&&(Te.gzhead.hcrc&&Te.pending>Xe&&(H.adler=n(H.adler,Te.pending_buf,Te.pending-Xe,Xe)),yr(H),Xe=Te.pending,Te.pending===Te.pending_buf_size)){ct=1;break}Te.gzindex<Te.gzhead.name.length?ct=Te.gzhead.name.charCodeAt(Te.gzindex++)&255:ct=0,Dr(Te,ct)}while(ct!==0);Te.gzhead.hcrc&&Te.pending>Xe&&(H.adler=n(H.adler,Te.pending_buf,Te.pending-Xe,Xe)),ct===0&&(Te.gzindex=0,Te.status=It)}else Te.status=It;if(Te.status===It)if(Te.gzhead.comment){Xe=Te.pending;do{if(Te.pending===Te.pending_buf_size&&(Te.gzhead.hcrc&&Te.pending>Xe&&(H.adler=n(H.adler,Te.pending_buf,Te.pending-Xe,Xe)),yr(H),Xe=Te.pending,Te.pending===Te.pending_buf_size)){ct=1;break}Te.gzindex<Te.gzhead.comment.length?ct=Te.gzhead.comment.charCodeAt(Te.gzindex++)&255:ct=0,Dr(Te,ct)}while(ct!==0);Te.gzhead.hcrc&&Te.pending>Xe&&(H.adler=n(H.adler,Te.pending_buf,Te.pending-Xe,Xe)),ct===0&&(Te.status=st)}else Te.status=st;if(Te.status===st&&(Te.gzhead.hcrc?(Te.pending+2>Te.pending_buf_size&&yr(H),Te.pending+2<=Te.pending_buf_size&&(Dr(Te,H.adler&255),Dr(Te,H.adler>>8&255),H.adler=0,Te.status=dr)):Te.status=dr),Te.pending!==0){if(yr(H),H.avail_out===0)return Te.last_flush=-1,v}else if(H.avail_in===0&&jn(bt)<=jn(St)&&bt!==f)return xr(H,N);if(Te.status===er&&H.avail_in!==0)return xr(H,N);if(H.avail_in!==0||Te.lookahead!==0||bt!==s&&Te.status!==er){var ce=Te.strategy===V?mr(Te,bt):Te.strategy===j?Gt(Te,bt):nn[Te.level].func(Te,bt);if((ce===Ar||ce===cn)&&(Te.status=er),ce===Jt||ce===Ar)return H.avail_out===0&&(Te.last_flush=-1),v;if(ce===Nt&&(bt===o?e._tr_align(Te):bt!==A&&(e._tr_stored_block(Te,0,0,!1),bt===l&&(_r(Te.head),Te.lookahead===0&&(Te.strstart=0,Te.block_start=0,Te.insert=0))),yr(H),H.avail_out===0))return Te.last_flush=-1,v}return bt!==f?v:Te.wrap<=0?T:(Te.wrap===2?(Dr(Te,H.adler&255),Dr(Te,H.adler>>8&255),Dr(Te,H.adler>>16&255),Dr(Te,H.adler>>24&255),Dr(Te,H.total_in&255),Dr(Te,H.total_in>>8&255),Dr(Te,H.total_in>>16&255),Dr(Te,H.total_in>>24&255)):(li(Te,H.adler>>>16),li(Te,H.adler&65535)),yr(H),Te.wrap>0&&(Te.wrap=-Te.wrap),Te.pending!==0?v:T)}function Vt(H){var bt;return!H||!H.state?I:(bt=H.state.status,bt!==rt&&bt!==ut&&bt!==vt&&bt!==It&&bt!==st&&bt!==dr&&bt!==er?xr(H,I):(H.state=null,bt===dr?xr(H,F):v))}function Et(H,bt){var St=bt.length,Te,Xe,ct,Z,ne,ce,ve,Fe;if(!H||!H.state||(Te=H.state,Z=Te.wrap,Z===2||Z===1&&Te.status!==rt||Te.lookahead))return I;for(Z===1&&(H.adler=t(H.adler,bt,St,0)),Te.wrap=0,St>=Te.w_size&&(Z===0&&(_r(Te.head),Te.strstart=0,Te.block_start=0,Te.insert=0),Fe=new r.Buf8(Te.w_size),r.arraySet(Fe,bt,St-Te.w_size,Te.w_size,0),bt=Fe,St=Te.w_size),ne=H.avail_in,ce=H.next_in,ve=H.input,H.avail_in=St,H.next_in=0,H.input=bt,ri(Te);Te.lookahead>=Le;){Xe=Te.strstart,ct=Te.lookahead-(Le-1);do Te.ins_h=(Te.ins_h<<Te.hash_shift^Te.window[Xe+Le-1])&Te.hash_mask,Te.prev[Xe&Te.w_mask]=Te.head[Te.ins_h],Te.head[Te.ins_h]=Xe,Xe++;while(--ct);Te.strstart=Xe,Te.lookahead=Le-1,ri(Te)}return Te.strstart+=Te.lookahead,Te.block_start=Te.strstart,Te.insert=Te.lookahead,Te.lookahead=0,Te.match_length=Te.prev_length=Le-1,Te.match_available=0,H.next_in=ce,H.input=ve,H.avail_in=ne,Te.wrap=Z,v}return ul.deflateInit=Rt,ul.deflateInit2=Ze,ul.deflateReset=Wt,ul.deflateResetKeep=kt,ul.deflateSetHeader=cr,ul.deflate=Ae,ul.deflateEnd=Vt,ul.deflateSetDictionary=Et,ul.deflateInfo="pako deflate (from Nodeca project)",ul}var Vf={},CM;function z6(){if(CM)return Vf;CM=1;var r=cf(),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,Vf.string2buf=function(o){var l,f,A,v,T,I=o.length,F=0;for(v=0;v<I;v++)f=o.charCodeAt(v),(f&64512)===55296&&v+1<I&&(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(l=new r.Buf8(F),T=0,v=0;T<F;v++)f=o.charCodeAt(v),(f&64512)===55296&&v+1<I&&(A=o.charCodeAt(v+1),(A&64512)===56320&&(f=65536+(f-55296<<10)+(A-56320),v++)),f<128?l[T++]=f:f<2048?(l[T++]=192|f>>>6,l[T++]=128|f&63):f<65536?(l[T++]=224|f>>>12,l[T++]=128|f>>>6&63,l[T++]=128|f&63):(l[T++]=240|f>>>18,l[T++]=128|f>>>12&63,l[T++]=128|f>>>6&63,l[T++]=128|f&63);return l};function s(o,l){if(l<65534&&(o.subarray&&t||!o.subarray&&e))return String.fromCharCode.apply(null,r.shrinkBuf(o,l));for(var f="",A=0;A<l;A++)f+=String.fromCharCode(o[A]);return f}return Vf.buf2binstring=function(o){return s(o,o.length)},Vf.binstring2buf=function(o){for(var l=new r.Buf8(o.length),f=0,A=l.length;f<A;f++)l[f]=o.charCodeAt(f);return l},Vf.buf2string=function(o,l){var f,A,v,T,I=l||o.length,F=new Array(I*2);for(A=0,f=0;f<I;){if(v=o[f++],v<128){F[A++]=v;continue}if(T=n[v],T>4){F[A++]=65533,f+=T-1;continue}for(v&=T===2?31:T===3?15:7;T>1&&f<I;)v=v<<6|o[f++]&63,T--;if(T>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)},Vf.utf8border=function(o,l){var f;for(l=l||o.length,l>o.length&&(l=o.length),f=l-1;f>=0&&(o[f]&192)===128;)f--;return f<0||f===0?l:f+n[o[f]]>l?f:l},Vf}var Zb,SM;function V6(){if(SM)return Zb;SM=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 Zb=r,Zb}var IM;function uge(){if(IM)return vd;IM=1;var r=cge(),e=cf(),t=z6(),n=Kw(),i=V6(),s=Object.prototype.toString,o=0,l=4,f=0,A=1,v=2,T=-1,I=0,F=8;function N(j){if(!(this instanceof N))return new N(j);this.options=e.assign({level:T,method:F,chunkSize:16384,windowBits:15,memLevel:8,strategy:I,to:""},j||{});var X=this.options;X.raw&&X.windowBits>0?X.windowBits=-X.windowBits:X.gzip&&X.windowBits>0&&X.windowBits<16&&(X.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,X.level,X.method,X.windowBits,X.memLevel,X.strategy);if(ue!==f)throw new Error(n[ue]);if(X.header&&r.deflateSetHeader(this.strm,X.header),X.dictionary){var K;if(typeof X.dictionary=="string"?K=t.string2buf(X.dictionary):s.call(X.dictionary)==="[object ArrayBuffer]"?K=new Uint8Array(X.dictionary):K=X.dictionary,ue=r.deflateSetDictionary(this.strm,K),ue!==f)throw new Error(n[ue]);this._dict_set=!0}}N.prototype.push=function(j,X){var ue=this.strm,K=this.options.chunkSize,se,Ee;if(this.ended)return!1;Ee=X===~~X?X:X===!0?l:o,typeof j=="string"?ue.input=t.string2buf(j):s.call(j)==="[object ArrayBuffer]"?ue.
vendor: 15,966 bytes, line 4561
4561input=new Uint8Array(j):ue.input=j,ue.next_in=0,ue.avail_in=ue.input.length;do{if(ue.avail_out===0&&(ue.output=new e.Buf8(K),ue.next_out=0,ue.avail_out=K),se=r.deflate(ue,Ee),se!==A&&se!==f)return this.onEnd(se),this.ended=!0,!1;(ue.avail_out===0||ue.avail_in===0&&(Ee===l||Ee===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 Ee===l?(se=r.deflateEnd(this.strm),this.onEnd(se),this.ended=!0,se===f):(Ee===v&&(this.onEnd(f),ue.avail_out=0),!0)},N.prototype.onData=function(j){this.chunks.push(j)},N.prototype.onEnd=function(j){j===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=j,this.msg=this.strm.msg};function U(j,X){var ue=new N(X);if(ue.push(j,!0),ue.err)throw ue.msg||n[ue.err];return ue.result}function $(j,X){return X=X||{},X.raw=!0,U(j,X)}function V(j,X){return X=X||{},X.gzip=!0,U(j,X)}return vd.Deflate=N,vd.deflate=U,vd.deflateRaw=$,vd.gzip=V,vd}var bd={},Ra={},Yb,BM;function fge(){if(BM)return Yb;BM=1;var r=30,e=12;return Yb=function(n,i){var s,o,l,f,A,v,T,I,F,N,U,$,V,j,X,ue,K,se,Ee,Ue,de,me,pe,W,re;s=n.state,o=n.next_in,W=n.input,l=o+(n.avail_in-5),f=n.next_out,re=n.output,A=f-(i-n.avail_out),v=f+(n.avail_out-257),T=s.dmax,I=s.wsize,F=s.whave,N=s.wnext,U=s.window,$=s.hold,V=s.bits,j=s.lencode,X=s.distcode,ue=(1<<s.lenbits)-1,K=(1<<s.distbits)-1;e:do{V<15&&($+=W[o++]<<V,V+=8,$+=W[o++]<<V,V+=8),se=j[$&ue];t:for(;;){if(Ee=se>>>24,$>>>=Ee,V-=Ee,Ee=se>>>16&255,Ee===0)re[f++]=se&65535;else if(Ee&16){Ue=se&65535,Ee&=15,Ee&&(V<Ee&&($+=W[o++]<<V,V+=8),Ue+=$&(1<<Ee)-1,$>>>=Ee,V-=Ee),V<15&&($+=W[o++]<<V,V+=8,$+=W[o++]<<V,V+=8),se=X[$&K];r:for(;;){if(Ee=se>>>24,$>>>=Ee,V-=Ee,Ee=se>>>16&255,Ee&16){if(de=se&65535,Ee&=15,V<Ee&&($+=W[o++]<<V,V+=8,V<Ee&&($+=W[o++]<<V,V+=8)),de+=$&(1<<Ee)-1,de>T){n.msg="invalid distance too far back",s.mode=r;break e}if($>>>=Ee,V-=Ee,Ee=f-A,de>Ee){if(Ee=de-Ee,Ee>F&&s.sane){n.msg="invalid distance too far back",s.mode=r;break e}if(me=0,pe=U,N===0){if(me+=I-Ee,Ee<Ue){Ue-=Ee;do re[f++]=U[me++];while(--Ee);me=f-de,pe=re}}else if(N<Ee){if(me+=I+N-Ee,Ee-=N,Ee<Ue){Ue-=Ee;do re[f++]=U[me++];while(--Ee);if(me=0,N<Ue){Ee=N,Ue-=Ee;do re[f++]=U[me++];while(--Ee);me=f-de,pe=re}}}else if(me+=N-Ee,Ee<Ue){Ue-=Ee;do re[f++]=U[me++];while(--Ee);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((Ee&64)===0){se=X[(se&65535)+($&(1<<Ee)-1)];continue r}else{n.msg="invalid distance code",s.mode=r;break e}break}}else if((Ee&64)===0){se=j[(se&65535)+($&(1<<Ee)-1)];continue t}else if(Ee&32){s.mode=e;break e}else{n.msg="invalid literal/length code",s.mode=r;break e}break}}while(o<l&&f<v);Ue=V>>3,o-=Ue,V-=Ue<<3,$&=(1<<V)-1,n.next_in=o,n.next_out=f,n.avail_in=o<l?5+(l-o):5-(o-l),n.avail_out=f<v?257+(v-f):257-(f-v),s.hold=$,s.bits=V},Yb}var Qb,PM;function hge(){if(PM)return Qb;PM=1;var r=cf(),e=15,t=852,n=592,i=0,s=1,o=2,l=[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 Qb=function(I,F,N,U,$,V,j,X){var ue=X.bits,K=0,se=0,Ee=0,Ue=0,de=0,me=0,pe=0,W=0,re=0,Ce=0,et,_e,Le,Ve,Ye,tt=null,rt=0,ut,vt=new r.Buf16(e+1),It=new r.Buf16(e+1),st=null,dr=0,er,Jt,Nt;for(K=0;K<=e;K++)vt[K]=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 $[V++]=1<<24|64<<16|0,$[V++]=1<<24|64<<16|0,X.bits=1,0;for(Ee=1;Ee<Ue&&vt[Ee]===0;Ee++);for(de<Ee&&(de=Ee),W=1,K=1;K<=e;K++)if(W<<=1,W-=vt[K],W<0)return-1;if(W>0&&(I===i||Ue!==1))return-1;for(It[1]=0,K=1;K<e;K++)It[K+1]=It[K]+vt[K];for(se=0;se<U;se++)F[N+se]!==0&&(j[It[F[N+se]]++]=se);if(I===i?(tt=st=j,ut=19):I===s?(tt=l,rt-=257,st=f,dr-=257,ut=256):(tt=A,st=v,ut=-1),Ce=0,se=0,K=Ee,Ye=V,me=de,pe=0,Le=-1,re=1<<de,Ve=re-1,I===s&&re>t||I===o&&re>n)return 1;for(;;){er=K-pe,j[se]<ut?(Jt=0,Nt=j[se]):j[se]>ut?(Jt=st[dr+j[se]],Nt=tt[rt+j[se]]):(Jt=96,Nt=0),et=1<<K-pe,_e=1<<me,Ee=_e;do _e-=et,$[Ye+(Ce>>pe)+_e]=er<<24|Jt<<16|Nt|0;while(_e!==0);for(et=1<<K-1;Ce&et;)et>>=1;if(et!==0?(Ce&=et-1,Ce+=et):Ce=0,se++,--vt[K]===0){if(K===Ue)break;K=F[N+j[se]]}if(K>de&&(Ce&Ve)!==Le){for(pe===0&&(pe=de),Ye+=Ee,me=K-pe,W=1<<me;me+pe<Ue&&(W-=vt[me+pe],!(W<=0));)me++,W<<=1;if(re+=1<<me,I===s&&re>t||I===o&&re>n)return 1;Le=Ce&Ve,$[Le]=de<<24|me<<16|Ye-V|0}}return Ce!==0&&($[Ye+Ce]=K-pe<<24|64<<16|0),X.bits=de,0},Qb}var MM;function dge(){if(MM)return Ra;MM=1;var r=cf(),e=N6(),t=U6(),n=fge(),i=hge(),s=0,o=1,l=2,f=4,A=5,v=6,T=0,I=1,F=2,N=-2,U=-3,$=-4,V=-5,j=8,X=1,ue=2,K=3,se=4,Ee=5,Ue=6,de=7,me=8,pe=9,W=10,re=11,Ce=12,et=13,_e=14,Le=15,Ve=16,Ye=17,tt=18,rt=19,ut=20,vt=21,It=22,st=23,dr=24,er=25,Jt=26,Nt=27,Ar=28,cn=29,Mr=30,xr=31,jn=32,_r=852,yr=592,un=15,Dr=un;function li(Ze){return(Ze>>>24&255)+(Ze>>>8&65280)+((Ze&65280)<<8)+((Ze&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(Ze){var Rt;return!Ze||!Ze.state?N:(Rt=Ze.state,Ze.total_in=Ze.total_out=Rt.total=0,Ze.msg="",Rt.wrap&&(Ze.adler=Rt.wrap&1),Rt.mode=X,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,T)}function ri(Ze){var Rt;return!Ze||!Ze.state?N:(Rt=Ze.state,Rt.wsize=0,Rt.whave=0,Rt.wnext=0,mn(Ze))}function Hn(Ze,Rt){var Ae,Vt;return!Ze||!Ze.state||(Vt=Ze.state,Rt<0?(Ae=0,Rt=-Rt):(Ae=(Rt>>4)+1,Rt<48&&(Rt&=15)),Rt&&(Rt<8||Rt>15))?N:(Vt.window!==null&&Vt.wbits!==Rt&&(Vt.window=null),Vt.wrap=Ae,Vt.wbits=Rt,ri(Ze))}function Sn(Ze,Rt){var Ae,Vt;return Ze?(Vt=new Yn,Ze.state=Vt,Vt.window=null,Ae=Hn(Ze,Rt),Ae!==T&&(Ze.state=null),Ae):N}function Qn(Ze){return Sn(Ze,Dr)}var Gt=!0,mr,Rr;function nn(Ze){if(Gt){var Rt;for(mr=new r.Buf32(512),Rr=new r.Buf32(32),Rt=0;Rt<144;)Ze.lens[Rt++]=8;for(;Rt<256;)Ze.lens[Rt++]=9;for(;Rt<280;)Ze.lens[Rt++]=7;for(;Rt<288;)Ze.lens[Rt++]=8;for(i(o,Ze.lens,0,288,mr,0,Ze.work,{bits:9}),Rt=0;Rt<32;)Ze.lens[Rt++]=5;i(l,Ze.lens,0,32,Rr,0,Ze.work,{bits:5}),Gt=!1}Ze.lencode=mr,Ze.lenbits=9,Ze.distcode=Rr,Ze.distbits=5}function gi(Ze,Rt,Ae,Vt){var Et,H=Ze.state;return H.window===null&&(H.wsize=1<<H.wbits,H.wnext=0,H.whave=0,H.window=new r.Buf8(H.wsize)),Vt>=H.wsize?(r.arraySet(H.window,Rt,Ae-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):(Et=H.wsize-H.wnext,Et>Vt&&(Et=Vt),r.arraySet(H.window,Rt,Ae-Vt,Et,H.wnext),Vt-=Et,Vt?(r.arraySet(H.window,Rt,Ae-Vt,Vt,0),H.wnext=Vt,H.whave=H.wsize):(H.wnext+=Et,H.wnext===H.wsize&&(H.wnext=0),H.whave<H.wsize&&(H.whave+=Et))),0}function Pe(Ze,Rt){var Ae,Vt,Et,H,bt,St,Te,Xe,ct,Z,ne,ce,ve,Fe,he=0,be,ae,Se,g,le,xt,Je,Ct,Mt=new r.Buf8(4),Ft,ht,Lt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Ze||!Ze.state||!Ze.output||!Ze.input&&Ze.avail_in!==0)return N;Ae=Ze.state,Ae.mode===Ce&&(Ae.mode=et),bt=Ze.next_out,Et=Ze.output,Te=Ze.avail_out,H=Ze.next_in,Vt=Ze.input,St=Ze.avail_in,Xe=Ae.hold,ct=Ae.bits,Z=St,ne=Te,Ct=T;e:for(;;)switch(Ae.mode){case X:if(Ae.wrap===0){Ae.mode=et;break}for(;ct<16;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(Ae.wrap&2&&Xe===35615){Ae.check=0,Mt[0]=Xe&255,Mt[1]=Xe>>>8&255,Ae.check=t(Ae.check,Mt,2,0),Xe=0,ct=0,Ae.mode=ue;break}if(Ae.flags=0,Ae.head&&(Ae.head.done=!1),!(Ae.wrap&1)||(((Xe&255)<<8)+(Xe>>8))%31){Ze.msg="incorrect header check",Ae.mode=Mr;break}if((Xe&15)!==j){Ze.msg="unknown compression method",Ae.mode=Mr;break}if(Xe>>>=4,ct-=4,Je=(Xe&15)+8,Ae.wbits===0)Ae.wbits=Je;else if(Je>Ae.wbits){Ze.msg="invalid window size",Ae.mode=Mr;break}Ae.dmax=1<<Je,Ze.adler=Ae.check=1,Ae.mode=Xe&512?W:Ce,Xe=0,ct=0;break;case ue:for(;ct<16;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(Ae.flags=Xe,(Ae.flags&255)!==j){Ze.msg="unknown compression method",Ae.mode=Mr;break}if(Ae.flags&57344){Ze.msg="unknown header flags set",Ae.mode=Mr;break}Ae.head&&(Ae.head.text=Xe>>8&1),Ae.flags&512&&(Mt[0]=Xe&255,Mt[1]=Xe>>>8&255,Ae.check=t(Ae.check,Mt,2,0)),Xe=0,ct=0,Ae.mode=K;case K:for(;ct<32;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Ae.head&&(Ae.head.time=Xe),Ae.flags&512&&(Mt[0]=Xe&255,Mt[1]=Xe>>>8&255,Mt[2]=Xe>>>16&255,Mt[3]=Xe>>>24&255,Ae.check=t(Ae.check,Mt,4,0)),Xe=0,ct=0,Ae.mode=se;case se:for(;ct<16;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Ae.head&&(Ae.head.xflags=Xe&255,Ae.head.os=Xe>>8),Ae.flags&512&&(Mt[0]=Xe&255,Mt[1]=Xe>>>8&255,Ae.check=t(Ae.check,Mt,2,0)),Xe=0,ct=0,Ae.mode=Ee;case Ee:if(Ae.flags&1024){for(;ct<16;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Ae.length=Xe,Ae.head&&(Ae.head.extra_len=Xe),Ae.flags&512&&(Mt[0]=Xe&255,Mt[1]=Xe>>>8&255,Ae.check=t(Ae.check,Mt,2,0)),Xe=0,ct=0}else Ae.head&&(Ae.head.extra=null);Ae.mode=Ue;case Ue:if(Ae.flags&1024&&(ce=Ae.length,ce>St&&(ce=St),ce&&(Ae.head&&(Je=Ae.head.extra_len-Ae.length,Ae.head.extra||(Ae.head.extra=new Array(Ae.head.extra_len)),r.arraySet(Ae.head.extra,Vt,H,ce,Je)),Ae.flags&512&&(Ae.check=t(Ae.check,Vt,ce,H)),St-=ce,H+=ce,Ae.length-=ce),Ae.length))break e;Ae.length=0,Ae.mode=de;case de:if(Ae.flags&2048){if(St===0)break e;ce=0;do Je=Vt[H+ce++],Ae.head&&Je&&Ae.length<65536&&(Ae.head.name+=String.fromCharCode(Je));while(Je&&ce<St);if(Ae.flags&512&&(Ae.check=t(Ae.check,Vt,ce,H)),St-=ce,H+=ce,Je)break e}else Ae.head&&(Ae.head.name=null);Ae.length=0,Ae.mode=me;case me:if(Ae.flags&4096){if(St===0)break e;ce=0;do Je=Vt[H+ce++],Ae.head&&Je&&Ae.length<65536&&(Ae.head.comment+=String.fromCharCode(Je));while(Je&&ce<St);if(Ae.flags&512&&(Ae.check=t(Ae.check,Vt,ce,H)),St-=ce,H+=ce,Je)break e}else Ae.head&&(Ae.head.comment=null);Ae.mode=pe;case pe:if(Ae.flags&512){for(;ct<16;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(Xe!==(Ae.check&65535)){Ze.msg="header crc mismatch",Ae.mode=Mr;break}Xe=0,ct=0}Ae.head&&(Ae.head.hcrc=Ae.flags>>9&1,Ae.head.done=!0),Ze.adler=Ae.check=0,Ae.mode=Ce;break;case W:for(;ct<32;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Ze.adler=Ae.check=li(Xe),Xe=0,ct=0,Ae.mode=re;case re:if(Ae.havedict===0)return Ze.next_out=bt,Ze.avail_out=Te,Ze.next_in=H,Ze.avail_in=St,Ae.hold=Xe,Ae.bits=ct,F;Ze.adler=Ae.check=1,Ae.mode=Ce;case Ce:if(Rt===A||Rt===v)break e;case et:if(Ae.last){Xe>>>=ct&7,ct-=ct&7,Ae.mode=Nt;break}for(;ct<3;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}switch(Ae.last=Xe&1,Xe>>>=1,ct-=1,Xe&3){case 0:Ae.mode=_e;break;case 1:if(nn(Ae),Ae.mode=ut,Rt===v){Xe>>>=2,ct-=2;break e}break;case 2:Ae.mode=Ye;break;case 3:Ze.msg="invalid block type",Ae.mode=Mr}Xe>>>=2,ct-=2;break;case _e:for(Xe>>>=ct&7,ct-=ct&7;ct<32;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if((Xe&65535)!==(Xe>>>16^65535)){Ze.msg="invalid stored block lengths",Ae.mode=Mr;break}if(Ae.length=Xe&65535,Xe=0,ct=0,Ae.mode=Le,Rt===v)break e;case Le:Ae.mode=Ve;case Ve:if(ce=Ae.length,ce){if(ce>St&&(ce=St),ce>Te&&(ce=Te),ce===0)break e;r.arraySet(Et,Vt,H,ce,bt),St-=ce,H+=ce,Te-=ce,bt+=ce,Ae.length-=ce;break}Ae.mode=Ce;break;case Ye:for(;ct<14;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(Ae.nlen=(Xe&31)+257,Xe>>>=5,ct-=5,Ae.ndist=(Xe&31)+1,Xe>>>=5,ct-=5,Ae.ncode=(Xe&15)+4,Xe>>>=4,ct-=4,Ae.nlen>286||Ae.ndist>30){Ze.msg="too many length or distance symbols",Ae.mode=Mr;break}Ae.have=0,Ae.mode=tt;case tt:for(;Ae.have<Ae.ncode;){for(;ct<3;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Ae.lens[Lt[Ae.have++]]=Xe&7,Xe>>>=3,ct-=3}for(;Ae.have<19;)Ae.lens[Lt[Ae.have++]]=0;if(Ae.lencode=Ae.lendyn,Ae.lenbits=7,Ft={bits:Ae.lenbits},Ct=i(s,Ae.lens,0,19,Ae.lencode,0,Ae.work,Ft),Ae.lenbits=Ft.bits,Ct){Ze.msg="invalid code lengths set",Ae.mode=Mr;break}Ae.have=0,Ae.mode=rt;case rt:for(;Ae.have<Ae.nlen+Ae.ndist;){for(;he=Ae.lencode[Xe&(1<<Ae.lenbits)-1],be=he>>>24,ae=he>>>16&255,Se=he&65535,!(be<=ct);){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(Se<16)Xe>>>=be,ct-=be,Ae.lens[Ae.have++]=Se;else{if(Se===16){for(ht=be+2;ct<ht;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(Xe>>>=be,ct-=be,Ae.have===0){Ze.msg="invalid bit length repeat",Ae.mode=Mr;break}Je=Ae.lens[Ae.have-1],ce=3+(Xe&3),Xe>>>=2,ct-=2}else if(Se===17){for(ht=be+3;ct<ht;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Xe>>>=be,ct-=be,Je=0,ce=3+(Xe&7),Xe>>>=3,ct-=3}else{for(ht=be+7;ct<ht;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Xe>>>=be,ct-=be,Je=0,ce=11+(Xe&127),Xe>>>=7,ct-=7}if(Ae.have+ce>Ae.nlen+Ae.ndist){Ze.msg="invalid bit length repeat",Ae.mode=Mr;break}for(;ce--;)Ae.lens[Ae.have++]=Je}}if(Ae.mode===Mr)break;if(Ae.lens[256]===0){Ze.msg="invalid code -- missing end-of-block",Ae.mode=Mr;break}if(Ae.lenbits=9,Ft={bits:Ae.lenbits},Ct=i(o,Ae.lens,0,Ae.nlen,Ae.lencode,0,Ae.work,Ft),Ae.lenbits=Ft.bits,Ct){Ze.msg="invalid literal/lengths set",Ae.mode=Mr;break}if(Ae.distbits=6,Ae.distcode=Ae.distdyn,Ft={bits:Ae.distbits},Ct=i(l,Ae.lens,Ae.nlen,Ae.ndist,Ae.distcode,0,Ae.work,Ft),Ae.distbits=Ft.bits,Ct){Ze.msg="invalid distances set",Ae.mode=Mr;break}if(Ae.mode=ut,Rt===v)break e;case ut:Ae.mode=vt;case vt:if(St>=6&&Te>=258){Ze.next_out=bt,Ze.avail_out=Te,Ze.next_in=H,Ze.avail_in=St,Ae.hold=Xe,Ae.bits=ct,n(Ze,ne),bt=Ze.next_out,Et=Ze.output,Te=Ze.avail_out,H=Ze.next_in,Vt=Ze.input,St=Ze.avail_in,Xe=Ae.hold,ct=Ae.bits,Ae.mode===Ce&&(Ae.back=-1);break}for(Ae.back=0;he=Ae.lencode[Xe&(1<<Ae.lenbits)-1],be=he>>>24,ae=he>>>16&255,Se=he&65535,!(be<=ct);){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(ae&&(ae&240)===0){for(g=be,le=ae,xt=Se;he=Ae.lencode[xt+((Xe&(1<<g+le)-1)>>g)],be=he>>>24,ae=he>>>16&255,Se=he&65535,!(g+be<=ct);){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Xe>>>=g,ct-=g,Ae.back+=g}if(Xe>>>=be,ct-=be,Ae.back+=be,Ae.length=Se,ae===0){Ae.mode=Jt;break}if(ae&32){Ae.back=-1,Ae.mode=Ce;break}if(ae&64){Ze.msg="invalid literal/length code",Ae.mode=Mr;break}Ae.extra=ae&15,Ae.mode=It;case It:if(Ae.extra){for(ht=Ae.extra;ct<ht;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Ae.length+=Xe&(1<<Ae.extra)-1,Xe>>>=Ae.extra,ct-=Ae.extra,Ae.back+=Ae.extra}Ae.was=Ae.length,Ae.mode=st;case st:for(;he=Ae.distcode[Xe&(1<<Ae.distbits)-1],be=he>>>24,ae=he>>>16&255,Se=he&65535,!(be<=ct);){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if((ae&240)===0){for(g=be,le=ae,xt=Se;he=Ae.distcode[xt+((Xe&(1<<g+le)-1)>>g)],be=he>>>24,ae=he>>>16&255,Se=he&65535,!(g+be<=ct);){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Xe>>>=g,ct-=g,Ae.back+=g}if(Xe>>>=be,ct-=be,Ae.back+=be,ae&64){Ze.msg="invalid distance code",Ae.mode=Mr;break}Ae.offset=Se,Ae.extra=ae&15,Ae.mode=dr;case dr:if(Ae.extra){for(ht=Ae.extra;ct<ht;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}Ae.offset+=Xe&(1<<Ae.extra)-1,Xe>>>=Ae.extra,ct-=Ae.extra,Ae.back+=Ae.extra}if(Ae.offset>Ae.dmax){Ze.msg="invalid distance too far back",Ae.mode=Mr;break}Ae.mode=er;case er:if(Te===0)break e;if(ce=ne-Te,Ae.offset>ce){if(ce=Ae.offset-ce,ce>Ae.whave&&Ae.sane){Ze.msg="invalid distance too far back",Ae.mode=Mr;break}ce>Ae.wnext?(ce-=Ae.wnext,ve=Ae.wsize-ce):ve=Ae.wnext-ce,ce>Ae.length&&(ce=Ae.length),Fe=Ae.window}else Fe=Et,ve=bt-Ae.offset,ce=Ae.length;ce>Te&&(ce=Te),Te-=ce,Ae.length-=ce;do Et[bt++]=Fe[ve++];while(--ce);Ae.length===0&&(Ae.mode=vt);break;case Jt:if(Te===0)break e;Et[bt++]=Ae.length,Te--,Ae.mode=vt;break;case Nt:if(Ae.wrap){for(;ct<32;){if(St===0)break e;
4561St--,Xe|=Vt[H++]<<ct,ct+=8}if(ne-=Te,Ze.total_out+=ne,Ae.total+=ne,ne&&(Ze.adler=Ae.check=Ae.flags?t(Ae.check,Et,ne,bt-ne):e(Ae.check,Et,ne,bt-ne)),ne=Te,(Ae.flags?Xe:li(Xe))!==Ae.check){Ze.msg="incorrect data check",Ae.mode=Mr;break}Xe=0,ct=0}Ae.mode=Ar;case Ar:if(Ae.wrap&&Ae.flags){for(;ct<32;){if(St===0)break e;St--,Xe+=Vt[H++]<<ct,ct+=8}if(Xe!==(Ae.total&4294967295)){Ze.msg="incorrect length check",Ae.mode=Mr;break}Xe=0,ct=0}Ae.mode=cn;case cn:Ct=I;break e;case Mr:Ct=U;break e;case xr:return $;case jn:default:return N}return Ze.next_out=bt,Ze.avail_out=Te,Ze.next_in=H,Ze.avail_in=St,Ae.hold=Xe,Ae.bits=ct,(Ae.wsize||ne!==Ze.avail_out&&Ae.mode<Mr&&(Ae.mode<Nt||Rt!==f))&&gi(Ze,Ze.output,Ze.next_out,ne-Ze.avail_out),Z-=Ze.avail_in,ne-=Ze.avail_out,Ze.total_in+=Z,Ze.total_out+=ne,Ae.total+=ne,Ae.wrap&&ne&&(Ze.adler=Ae.check=Ae.flags?t(Ae.check,Et,ne,Ze.next_out-ne):e(Ae.check,Et,ne,Ze.next_out-ne)),Ze.data_type=Ae.bits+(Ae.last?64:0)+(Ae.mode===Ce?128:0)+(Ae.mode===ut||Ae.mode===Le?256:0),(Z===0&&ne===0||Rt===f)&&Ct===T&&(Ct=V),Ct}function kt(Ze){if(!Ze||!Ze.state)return N;var Rt=Ze.state;return Rt.window&&(Rt.window=null),Ze.state=null,T}function Wt(Ze,Rt){var Ae;return!Ze||!Ze.state||(Ae=Ze.state,(Ae.wrap&2)===0)?N:(Ae.head=Rt,Rt.done=!1,T)}function cr(Ze,Rt){var Ae=Rt.length,Vt,Et,H;return!Ze||!Ze.state||(Vt=Ze.state,Vt.wrap!==0&&Vt.mode!==re)?N:Vt.mode===re&&(Et=1,Et=e(Et,Rt,Ae,0),Et!==Vt.check)?U:(H=gi(Ze,Rt,Ae,Ae),H?(Vt.mode=xr,$):(Vt.havedict=1,T))}return Ra.inflateReset=ri,Ra.inflateReset2=Hn,Ra.inflateResetKeep=mn,Ra.inflateInit=Qn,Ra.inflateInit2=Sn,Ra.inflate=Pe,Ra.inflateEnd=kt,Ra.inflateGetHeader=Wt,Ra.inflateSetDictionary=cr,Ra.inflateInfo="pako inflate (from Nodeca project)",Ra}var e1,RM;function G6(){return RM||(RM=1,e1={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}),e1}var t1,OM;function pge(){if(OM)return t1;OM=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 t1=r,t1}var DM;function Age(){if(DM)return bd;DM=1;var r=dge(),e=cf(),t=z6(),n=G6(),i=Kw(),s=V6(),o=pge(),l=Object.prototype.toString;function f(T){if(!(this instanceof f))return new f(T);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},T||{});var I=this.options;I.raw&&I.windowBits>=0&&I.windowBits<16&&(I.windowBits=-I.windowBits,I.windowBits===0&&(I.windowBits=-15)),I.windowBits>=0&&I.windowBits<16&&!(T&&T.windowBits)&&(I.windowBits+=32),I.windowBits>15&&I.windowBits<48&&(I.windowBits&15)===0&&(I.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,I.windowBits);if(F!==n.Z_OK)throw new Error(i[F]);if(this.header=new o,r.inflateGetHeader(this.strm,this.header),I.dictionary&&(typeof I.dictionary=="string"?I.dictionary=t.string2buf(I.dictionary):l.call(I.dictionary)==="[object ArrayBuffer]"&&(I.dictionary=new Uint8Array(I.dictionary)),I.raw&&(F=r.inflateSetDictionary(this.strm,I.dictionary),F!==n.Z_OK)))throw new Error(i[F])}f.prototype.push=function(T,I){var F=this.strm,N=this.options.chunkSize,U=this.options.dictionary,$,V,j,X,ue,K=!1;if(this.ended)return!1;V=I===~~I?I:I===!0?n.Z_FINISH:n.Z_NO_FLUSH,typeof T=="string"?F.input=t.binstring2buf(T):l.call(T)==="[object ArrayBuffer]"?F.input=new Uint8Array(T):F.input=T,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&&K===!0&&($=n.Z_OK,K=!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&&(V===n.Z_FINISH||V===n.Z_SYNC_FLUSH))&&(this.options.to==="string"?(j=t.utf8border(F.output,F.next_out),X=F.next_out-j,ue=t.buf2string(F.output,j),F.next_out=X,F.avail_out=N-X,X&&e.arraySet(F.output,F.output,j,X,0),this.onData(ue)):this.onData(e.shrinkBuf(F.output,F.next_out))),F.avail_in===0&&F.avail_out===0&&(K=!0)}while((F.avail_in>0||F.avail_out===0)&&$!==n.Z_STREAM_END);return $===n.Z_STREAM_END&&(V=n.Z_FINISH),V===n.Z_FINISH?($=r.inflateEnd(this.strm),this.onEnd($),this.ended=!0,$===n.Z_OK):(V===n.Z_SYNC_FLUSH&&(this.onEnd(n.Z_OK),F.avail_out=0),!0)},f.prototype.onData=function(T){this.chunks.push(T)},f.prototype.onEnd=function(T){T===n.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=T,this.msg=this.strm.msg};function A(T,I){var F=new f(I);if(F.push(T,!0),F.err)throw F.msg||i[F.err];return F.result}function v(T,I){return I=I||{},I.raw=!0,A(T,I)}return bd.Inflate=f,bd.inflate=A,bd.inflateRaw=v,bd.ungzip=A,bd}var r1,FM;function gge(){if(FM)return r1;FM=1;var r=cf().assign,e=uge(),t=Age(),n=G6(),i={};return r(i,e,t,n),r1=i,r1}var mge=gge();const xd=uh(mge),LM=[0],_ge={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:k6,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 Zw extends Ss{initializeState(){"onTileLoadFail"in this.props&&Zr.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 l=await Kc(o,i,s.loadOptions),f=new Cfe(l,{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 qc.POINTCLOUD:return this._makePointCloudLayer(e,t);case qc.SCENEGRAPH:return this._make3DModelLayer(e);case qc.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:l}=e.content,{positions:f,normals:A,colors:v}=n;if(!f)return null;const T=t&&t.props.data||{header:{vertexCount:i},attributes:{POSITION:f,NORMAL:A,COLOR_0:v}},{pointSize:I,getPointColor:F}=this.props,N=this.getSubLayerClass("pointcloud",vg);return new N({pointSize:I}
4561,this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:T,coordinateSystem:Qr.METER_OFFSETS,coordinateOrigin:o,modelMatrix:l,getColor:s||F,_offset:0})}_make3DModelLayer(e){const{gltf:t,instances:n,cartographicOrigin:i,modelMatrix:s}=e.content,o=this.getSubLayerClass("scenegraph",Bg);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:n||LM,scenegraph:t,coordinateSystem:Qr.METER_OFFSETS,coordinateOrigin:i,modelMatrix:s,getTransformMatrix:l=>l.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,t){const n=e.content,{attributes:i,indices:s,modelMatrix:o,cartographicOrigin:l,coordinateSystem:f=Qr.METER_OFFSETS,material:A,featureIds:v}=n,{_getMeshColor:T}=this.props,I=t&&t.props.mesh||new Zs({topology:"triangle-list",attributes:yge(i),indices:s}),F=this.getSubLayerClass("mesh",Fw);return new F(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:I,data:LM,getColor:T(e),pbrMaterial:A,modelMatrix:o,coordinateOrigin:l,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}}Zw.defaultProps=_ge;Zw.layerName="Tile3DLayer";function yge(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 vge="4.2.4",j6={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:vge,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};({...j6});const kM=[1],bge={...nu.defaultProps,elevationData:d_,texture:{...d_,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:[j6]};function NM(r){return Array.isArray(r)?r.join(";"):r||""}class Yw extends Ss{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&&Zr.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:l}=this.props;return l(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:l}=this.context,f=oh(t,e),A=i&&oh(i,e),{signal:v}=e;let T=[0,0],I=[0,0];if(l.isGeospatial){const $=e.bbox;T=l.projectFlat([$.west,$.south]),I=l.projectFlat([$.east,$.north])}else{const $=e.bbox;T=[$.left,$.bottom],I=[$.right,$.top]}const F=[T[0],T[1],I[0],I[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[l,f]=o;return new t(e,{data:kM,mesh:l,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=>
4561o.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:l,tileSize:f,maxZoom:A,minZoom:v,extent:T,maxRequests:I,onTileLoad:F,onTileUnload:N,onTileError:U,maxCacheSize:$,maxCacheByteSize:V,refinementStrategy:j}=this.props;if(this.state.isTiled)return new nu(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:NM(n),texture:NM(i),meshMaxError:o,elevationDecoder:l}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:f,maxZoom:A,minZoom:v,extent:T,maxRequests:I,onTileLoad:F,onTileUnload:N,onTileError:U,maxCacheSize:$,maxCacheByteSize:V,refinementStrategy:j});if(!n)return null;const X=this.getSubLayerClass("mesh",ah);return new X(this.getSubLayerProps({id:"mesh"}),{data:kM,mesh:this.state.terrain,texture:i,_instanced:!1,getPosition:ue=>[0,0,0],getColor:e,material:t,wireframe:s})}}Yw.defaultProps=bge;Yw.layerName="TerrainLayer";const xge={clipBounds:[0,0,1,1],clipByInstance:void 0},H6=` 4562uniform clipUniforms { 4563 vec4 bounds; 4564} clip; 4565 4566bool clip_isInBounds(vec2 position) { 4567 return position.x >= clip.bounds[0] && position.y >= clip.bounds[1] && position.x < clip.bounds[2] && position.y < clip.bounds[3]; 4568} 4569`,wge={name:"clip",vs:H6,uniformTypes:{bounds:"vec4<f32>"}},Tge={"vs:#decl":` 4570out float clip_isVisible; 4571`,"vs:DECKGL_FILTER_GL_POSITION":` 4572 clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy)); 4573`,"fs:#decl":` 4574in float clip_isVisible; 4575`,"fs:DECKGL_FILTER_COLOR":` 4576 if (clip_isVisible < 0.5) discard; 4577`},Ege={name:"clip",fs:H6,uniformTypes:{bounds:"vec4<f32>"}},Cge={"vs:#decl":` 4578out vec2 clip_commonPosition; 4579`,"vs:DECKGL_FILTER_GL_POSITION":` 4580 clip_commonPosition = geometry.position.xy; 4581`,"fs:#decl":` 4582in vec2 clip_commonPosition; 4583`,"fs:DECKGL_FILTER_COLOR":` 4584 if (!clip_isInBounds(clip_commonPosition)) discard; 4585`};class uy extends U_{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=!!this.props.clipByInstance),this.state.clipByInstance=e,e?{modules:[wge],inject:Tge}:{modules:[Ege],inject:Cge}}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})}}uy.defaultProps=xge;uy.extensionName="ClipExtension";const Sge=` 4586in float collisionPriorities; 4587 4588uniform sampler2D collision_texture; 4589 4590uniform collisionUniforms { 4591 bool sort; 4592 bool enabled; 4593} collision; 4594 4595vec2 collision_getCoords(vec4 position) { 4596 vec4 collision_clipspace = project_common_position_to_clipspace(position); 4597 return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0; 4598} 4599 4600float collision_match(vec2 tex, vec3 pickingColor) { 4601 vec4 collision_pickingColor = texture(collision_texture, tex); 4602 float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0)); 4603 float e = 0.001; 4604 return step(delta, e); 4605} 4606 4607float collision_isVisible(vec2 texCoords, vec3 pickingColor) { 4608 if (!collision.enabled) { 4609 return 1.0; 4610 } 4611 4612 // Visibility test, sample area of 5x5 pixels in order to fade in/out. 4613 // Due to the locality, the lookups will be cached 4614 // This reduces the flicker present when objects are shown/hidden 4615 const int N = 2; 4616 float accumulator = 0.0; 4617 vec2 step = vec2(1.0 / project.viewportSize); 4618 4619 const float floatN = float(N); 4620 vec2 delta = -floatN * step; 4621 for(int i = -N; i <= N; i++) { 4622 delta.x = -step.x * floatN; 4623 for(int j = -N; j <= N; j++) { 4624 accumulator += collision_match(texCoords + delta, pickingColor); 4625 delta.x += step.x; 4626 } 4627 delta.y += step.y; 4628 } 4629 4630 float W = 2.0 * floatN + 1.0; 4631 return pow(accumulator / (W * W), 2.2); 4632} 4633`,Ige={"vs:#decl":` 4634 float collision_fade = 1.0; 4635`,"vs:DECKGL_FILTER_GL_POSITION":` 4636 if (collision.sort) { 4637 float collisionPriority = collisionPriorities; 4638 position.z = -0.001 * collisionPriority * position.w;
4638 // Support range -1000 -> 1000 4639 } 4640 4641 if (collision.enabled) { 4642 vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0)); 4643 vec2 collision_texCoords = collision_getCoords(collision_common_position); 4644 collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0); 4645 if (collision_fade < 0.0001) { 4646 // Position outside clip space bounds to discard 4647 position = vec4(0.0, 0.0, 2.0, 1.0); 4648 } 4649 } 4650 `,"vs:DECKGL_FILTER_COLOR":` 4651 color.a *= collision_fade; 4652 `},Bge=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}},Pge={name:"collision",dependencies:[O_],vs:Sge,inject:Ige,getUniforms:Bge,uniformTypes:{sort:"i32",enabled:"i32"}};class Mge extends D_{renderCollisionMap(e,t){const i=[0,0,0,0],s=[1,1,e.width-2,e.height-2];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 n1=2;class Rge{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 Mge(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:n,viewports:i,onViewportActive:s,views:o,isPicking:l,preRenderStats:f={}}){const{device:A}=this.context;if(l)return;const v=t.filter(({props:{visible:$,collisionEnabled:V}})=>$&&V);if(v.length===0){this.channels={};return}const T=e?.filter($=>$.useInPicking&&f[$.id]),I=f["mask-effect"]?.didRender,F=this._groupByCollisionGroup(A,v),N=i[0],U=!this.lastViewport||!this.lastViewport.equals(N)||I;for(const $ in F){const V=this.collisionFBOs[$],j=F[$],[X,ue]=A.canvasContext.getPixelSize();V.resize({width:X/n1,height:ue/n1}),this._render(j,{effects:T,layerFilter:n,onViewportActive:s,views:o,viewport:N,viewportChanged:U})}}_render(e,{effects:t,layerFilter:n,onViewportActive:i,views:s,viewport:o,viewportChanged:l}){const{collisionGroup:f}=e,A=this.channels[f];if(!A)return;const v=l||e===A||!rs(A.layers,e.layers,1)||e.layerBounds.some((T,I)=>!ga(T,A.layerBounds[I]))||e.allLayersLoaded!==A.allLayersLoaded||e.layers.some(T=>T.props.transitions);if(this.channels[f]=e,v){this.lastViewport=o;const T=this.collisionFBOs[f];this.collisionFilterPass.renderCollisionMap(T,{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:T.device.canvasContext.getDevicePixelRatio()/n1}}})}}_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});
4652this.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 Oge={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}};class Qw extends U_{getShaders(){return{modules:[Pge]}}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 Rge),this.getAttributeManager().add({collisionPriorities:{size:1,stepMode:"dynamic",accessor:"getCollisionPriority"}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}}Qw.defaultProps=Oge;Qw.extensionName="CollisionFilterExtension";function F2(r,e){const t=e?.globalFeatureId;return t!==void 0?Dge(r,t):Fge(r,e?.type)}function Dge(r,e){const t=W6(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 l=n.featureIds.value[o];if(l!==s){if(e===n.globalFeatureIds.value[i])return b_(n,i,o);i=o,s=l}}if(e===n.globalFeatureIds.value[i])return b_(n,i,n.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function Fge(r,e){const t=W6(r);return kge(t)}function Lge(r,e,t){switch(r.type){case"Point":return Vge(r,e,t);case"LineString":return zge(r,e,t);case"Polygon":return $6(r,e,t);default:const n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function W6(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 kge(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(b_(t,n,s)),n=s,i=o)}e.push(b_(t,n,t.featureIds.value.length))}return e}function b_(r,e,t){const n=Lge(r,e,t),i=Uge(r,e),s=Nge(r,e);return{type:"Feature",geometry:n,properties:i,...s}}function Nge(r,e=0,t){return r.fields&&r.fields[r.featureIds.value[e]]}function Uge(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 $6(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],T=s[A+1],I=x_(n,v,T);f.push(I)}return{type:"Polygon",coordinates:f}}const l=[];for(let f=0;f<i.length-1;f++){const A=i[f],v=i[f+1],T=$6(r,A,v).coordinates;l.push(T)}return{type:"MultiPolygon",coordinates:l}}function zge(r,e=-1/0,t=1/0){const{positions:n}=r,i=r.pathIndices.value.filter(l=>l>=e&&l<=t);if(!(i.length>2))return{type:"LineString",coordinates:x_(n,i[0],i[1])};const o=[];for(let l=0;l<i.length-1;l++){const f=x_(n,i[l],i[l+1]);o.push(f)}return{type:"MultiLineString",coordinates:o}}function Vge(r,e,t){const{positions:n}=r,i=x_(n,e,t);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function x_(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 em={};var UM;function Gge(){return UM||(UM=1,em.read=function(r,e,t,n,i){var s,o,l=i*8-n-1,f=(1<<l)-1,A=f>>1,v=-7,T=t?i-1:0,I=t?-1:1,F=r[e+T];for(T+=I,s=F&(1<<-v)-1,F>>=-v,v+=l;v>0;s=s*256+r[e+T],T+=I,v-=8);for(o=s&(1<<-v)-1,s>>=-v,v+=n;v>0;o=o*256+r[e+T],T+=I,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)},em.write=function(r,e,t,n,i,s){var o,l,f,A=s*8-i-1,v=(1<<A)-1,T=v>>1,I=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?(l=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+T>=1?e+=I/f:e+=I*Math.pow(2,1-T),e*f>=2&&(o++,f/=2),o+T>=v?(l=0,o=v):o+T>=1?(l=(e*f-1)*Math.pow(2,i),o=o+T):(l=e*Math.pow(2,T-1)*Math.pow(2,i),o=0));i>=8;r[t+F]=l&255,F+=N,l/=256,i-=8);for(o=o<<i|l,A+=i;A>0;r[t+F]=o&255,F+=N,o/=256,A-=8);r[t+F-N]|=U*128}),em}var i1,zM;function jge(){if(zM)return i1;zM=1,i1=e;var r=Gge();function e(W){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(W)?W:new
vendor: 6,282 bytes, line 4652
4652Uint8Array(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,Ce){for(Ce=Ce||this.length;this.pos<Ce;){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,Ce,et;return et=re[this.pos++],Ce=et&127,et<128||(et=re[this.pos++],Ce|=(et&127)<<7,et<128)||(et=re[this.pos++],Ce|=(et&127)<<14,et<128)||(et=re[this.pos++],Ce|=(et&127)<<21,et<128)?Ce:(et=re[this.pos],Ce|=(et&15)<<28,o(Ce,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 Ce=l(this);for(W=W||[];this.pos<Ce;)W.push(this.readVarint(re));return W},readPackedSVarint:function(W){if(this.type!==e.Bytes)return W.push(this.readSVarint());var re=l(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=l(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=l(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=l(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=l(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=l(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=l(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=l(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 Ce=new Uint8Array(re);Ce.set(this.buf),this.buf=Ce,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),Ee(this.buf,W,this.pos),this.pos+=4},writeSFixed32:function(W){this.realloc(4),Ee(this.buf,W,this.pos),this.pos+=4},writeFixed64:function(W){this.realloc(8),Ee(this.buf,W&-1,this.pos),Ee(this.buf,Math.floor(W*n),this.pos+4),this.pos+=8},writeSFixed64:function(W){this.realloc(8),Ee(this.buf,W&-1,this.pos),Ee(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 Ce=this.pos-re;Ce>=128&&I(re,Ce,this),this.pos=re-1,this.writeVarint(Ce),this.pos+=Ce},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 Ce=0;Ce<re;Ce++)this.buf[this.pos++]=W[Ce]},writeRawMessage:function(W,re){this.pos++;var Ce=this.pos;W(re,this);var et=this.pos-Ce;et>=128&&I(Ce,et,this),this.pos=Ce-1,this.writeVarint(et),this.pos+=et},writeMessage:function(W,re,Ce){this.writeTag(W,e.Bytes),this.writeRawMessage(re,Ce)},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,V,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,j,re)},writePackedSFixed32:function(W,re){re.length&&this.writeMessage(W,X,re)},writePackedFixed64:function(W,re){re.length&&this.writeMessage(W,ue,re)},writePackedSFixed64:function(W,re){re.length&&this.writeMessage(W,K,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 4652
4652(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,Ce){var et=Ce.buf,_e,Le;if(Le=et[Ce.pos++],_e=(Le&112)>>4,Le<128||(Le=et[Ce.pos++],_e|=(Le&127)<<3,Le<128)||(Le=et[Ce.pos++],_e|=(Le&127)<<10,Le<128)||(Le=et[Ce.pos++],_e|=(Le&127)<<17,Le<128)||(Le=et[Ce.pos++],_e|=(Le&127)<<24,Le<128)||(Le=et[Ce.pos++],_e|=(Le&1)<<31,Le<128))return f(W,_e,re);throw new Error("Expected varint not more than 10 bytes")}function l(W){return W.type===e.Bytes?W.readVarint()+W.pos:W.pos+1}function f(W,re,Ce){return Ce?re*4294967296+(W>>>0):(re>>>0)*4294967296+(W>>>0)}function A(W,re){var Ce,et;if(W>=0?(Ce=W%4294967296|0,et=W/4294967296|0):(Ce=~(-W%4294967296),et=~(-W/4294967296),Ce^4294967295?Ce=Ce+1|0:(Ce=0,et=et+1|0)),W>=18446744073709552e3||W<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");re.realloc(10),v(Ce,et,re),T(et,re)}function v(W,re,Ce){Ce.buf[Ce.pos++]=W&127|128,W>>>=7,Ce.buf[Ce.pos++]=W&127|128,W>>>=7,Ce.buf[Ce.pos++]=W&127|128,W>>>=7,Ce.buf[Ce.pos++]=W&127|128,W>>>=7,Ce.buf[Ce.pos]=W&127}function T(W,re){var Ce=(W&7)<<4;re.buf[re.pos++]|=Ce|((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 I(W,re,Ce){var et=re<=16383?1:re<=2097151?2:re<=268435455?3:Math.floor(Math.log(re)/(Math.LN2*7));Ce.realloc(et);for(var _e=Ce.pos-1;_e>=W;_e--)Ce.buf[_e+et]=Ce.buf[_e]}function F(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeVarint(W[Ce])}function N(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeSVarint(W[Ce])}function U(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeFloat(W[Ce])}function $(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeDouble(W[Ce])}function V(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeBoolean(W[Ce])}function j(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeFixed32(W[Ce])}function X(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeSFixed32(W[Ce])}function ue(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeFixed64(W[Ce])}function K(W,re){for(var Ce=0;Ce<W.length;Ce++)re.writeSFixed64(W[Ce])}function se(W,re){return(W[re]|W[re+1]<<8|W[re+2]<<16)+W[re+3]*16777216}function Ee(W,re,Ce){W[Ce]=re,W[Ce+1]=re>>>8,W[Ce+2]=re>>>16,W[Ce+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,Ce){for(var et="",_e=re;_e<Ce;){var Le=W[_e],Ve=null,Ye=Le>239?4:Le>223?3:Le>191?2:1;if(_e+Ye>Ce)break;var tt,rt,ut;Ye===1?Le<128&&(Ve=Le):Ye===2?(tt=W[_e+1],(tt&192)===128&&(Ve=(Le&31)<<6|tt&63,Ve<=127&&(Ve=null))):Ye===3?(tt=W[_e+1],rt=W[_e+2],(tt&192)===128&&(rt&192)===128&&(Ve=(Le&15)<<12|(tt&63)<<6|rt&63,(Ve<=2047||Ve>=55296&&Ve<=57343)&&(Ve=null))):Ye===4&&(tt=W[_e+1],rt=W[_e+2],ut=W[_e+3],(tt&192)===128&&(rt&192)===128&&(ut&192)===128&&(Ve=(Le&15)<<18|(tt&63)<<12|(rt&63)<<6|ut&63,(Ve<=65535||Ve>=1114112)&&(Ve=null))),Ve===null?(Ve=65533,Ye=1):Ve>65535&&(Ve-=65536,et+=String.fromCharCode(Ve>>>10&1023|55296),Ve=56320|Ve&1023),et+=String.fromCharCode(Ve),_e+=Ye}return et}function me(W,re,Ce){return s.decode(W.subarray(re,Ce))}function pe(W,re,Ce){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[Ce++]=239,W[Ce++]=191,W[Ce++]=189,Le=_e;continue}else _e=Le-55296<<10|_e-56320|65536,Le=null;else{_e>56319||et+1===re.length?(W[Ce++]=239,W[Ce++]=191,W[Ce++]=189):Le=_e;continue}else Le&&(W[Ce++]=239,W[Ce++]=191,W[Ce++]=189,Le=null);_e<128?W[Ce++]=_e:(_e<2048?W[Ce++]=_e>>6|192:(_e<65536?W[Ce++]=_e>>12|224:(W[Ce++]=_e>>18|240,W[Ce++]=_e>>12&63|128),W[Ce++]=_e>>6&63|128),W[Ce++]=_e&63|128)}return Ce}return i1}var Hge=jge();const Wge=uh(Hge),$ge="4.2.4",X6={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:$ge,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}}};({...X6});const Xge={Point:q6,MultiPoint:qge,LineString:J6,MultiLineString:Jge,Polygon:K6,MultiPolygon:Kge};function q6([r,e],[t,n],i){const s=wl(t[0],n[0],r),o=wl(t[1],n[1],e);return i.unprojectFlat([s,o])}function eT(r,e,t){return r.map(n=>q6(n,e,t))}function qge(r,e,t){return eT(r,e,t)}function J6(r,e,t){return eT(r,e,t)}function Jge(r,e,t){return r.map(n=>J6(n,e,t))}function K6(r,e,t){return r.map(n=>eT(n,e,t))}function Kge(r,e,t){return r.map(n=>K6(n,e,t))}
4652function Zge(r,e,t){const n=t.projectFlat([e.west,e.north]),i=t.projectFlat([e.east,e.south]),s=[n,i];return{...r,coordinates:Xge[r.type](r.coordinates,s,t)}}const Yge=["points","lines","polygons"];function Qge(r,e,t,n){for(const i of Yge){const s=r[i]&&e0e(r[i],e,t,n);if(s>=0)return s}return-1}function e0e(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=t0e(r,n);if(f)s=f[0],o=f[1]+1;else return-1}let l=-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?l=VM(r.properties,f=>f[e]===t,s,o):r.fields&&(l=VM(r.fields,f=>f.id===t,s,o));return l>=0?r0e(r,l):-1}function t0e(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 r0e(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 VM(r,e,t,n){for(let i=t;i<n;i++)if(e(r[i],i))return i;return-1}const s1=512,n0e={...ru.defaultProps,data:d_,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[X6],binary:!0};class Ip extends nu{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"&&!Gle(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=oh(t,e);if(!o)return Promise.reject("Invalid URL");let l=this.getLoadOptions();const{fetch:f}=this.props;return l={...l,mimeType:"application/x-protobuf",mvt:{...l?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:i},gis:n?{format:"binary"}:{}},f(o,{propName:"data",layer:this,loadOptions:l,signal:s})}renderSubLayers(e){const{x:t,y:n,z:i}=e.tile.index,s=Math.pow(2,i),o=s1/s,l=-o,f=s1*t/s,A=s1*(1-n/s),v=new vn().scale([o,l,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 uy]);const T=super.renderSubLayers(e);return this.state.binary&&!(T instanceof ru)&&Zr.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),T}_updateAutoHighlight(e){const{uniqueIdProperty:t}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:i}=this.state,s=e.object;let o=null,l=null;s&&(o=o1(s,t),l=GM(s));let{highlightColor:f}=this.props;typeof f=="function"&&(f=f(e)),(n!==o||i!==l)&&this.setState({highlightColor:f,hoveredFeatureId:o,hoveredFeatureLayerName:l})}_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=F2(n,{globalFeatureId:t.index})}return t.object&&!this._isWGS84()&&(t.object=HM(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,l=e.content,f=jM(o);if(!(jM(t)||f))return-1;const v=f?o:t;return Array.isArray(l)?l.findIndex(T=>
4652{const I=o1(T,s)===v,F=f||GM(T)===n;return I&&F}):l&&i?Qge(l,s,v,f?"":n):-1}_pickObjects(e){const{deck:t,viewport:n}=this.context,i=n.width,s=n.height,o=n.x,l=n.y,f=[this.id];return t.pickObjects({x:o,y:l,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=o1(s.object,this.props.uniqueIdProperty);o===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&&jle(i)){const s=this.state.binary?F2(n.content):n.content;n._contentWGS84=s.map(o=>HM(o,i,this.context.viewport))}return n._contentWGS84}})})}}Ip.layerName="MVTLayer";Ip.defaultProps=n0e;function o1(r,e){if(r.properties&&e)return r.properties[e];if("id"in r)return r.id}function GM(r){return r.properties?.layerName||null}function jM(r){return r!=null&&r!==""}function HM(r,e,t){const n={...r,geometry:{type:r.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>Zge(r.geometry,e,t).coordinates}),n}const WM="0123456789bcdefghjkmnpqrstuvwxyz",Z6={};for(let r=0;r<WM.length;r++)Z6[WM.charAt(r)]=r;const i0e=-90,s0e=90,o0e=-180,a0e=180;function l0e(r){let e=!0,t=s0e,n=i0e,i=a0e,s=o0e,o,l=0;for(let f=0,A=r.length;f<A;f++){const v=r[f].toLowerCase();l=Z6[v];for(let T=4;T>=0;T--){const I=l>>T&1;e?(o=(i+s)/2,I===1?s=o:i=o):(o=(t+n)/2,I===1?n=o:t=o),e=!e}}return[n,s,t,i]}function c0e(r){const[e,t,n,i]=l0e(r);return[i,n,i,e,t,e,t,n,i,n]}const u0e={getGeohash:{type:"accessor",value:r=>r.geohash}};class fy extends lf{indexToBounds(){const{data:e,getGeohash:t}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,i)=>c0e(t(n,i))}}}fy.layerName="GeohashLayer";fy.defaultProps=u0e;const f0e=Object.freeze(Object.defineProperty({__proto__:null,GeohashLayer:fy,GreatCircleLayer:bw,H3ClusterLayer:ny,H3HexagonLayer:Ac,MVTLayer:Ip,QuadkeyLayer:Z_,S2Layer:K_,TerrainLayer:Yw,Tile3DLayer:Zw,TileLayer:nu,TripsLayer:ey,_GeoCellLayer:lf,_Tile2DHeader:_L,_Tileset2D:Q_,_WMSLayer:vw,_getURLFromTemplate:oh},Symbol.toStringTag,{value:"Module"}));function h0e({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 d0e({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 p0e=r=>r.length,Y6=(r,e)=>{let t=0;for(const n of r)t+=e(n);return t},A0e=(r,e)=>r.length===0?NaN:Y6(r,e)/r.length,g0e=(r,e)=>{let t=1/0;for(const n of r){const i=e(n);i<t&&(t=i)}return t},m0e=(r,e)=>{let t=-1/0;for(const n of r){const i=e(n);i>t&&(t=i)}return t},_0e={COUNT:p0e,SUM:Y6,MEAN:A0e,MIN:g0e,MAX:m0e};function y0e({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:l}=r[o];n[o]=t(l,e),n[o]<i&&(i=n[o]),n[o]>s&&(s=n[o])}return{value:n,domain:[i,s]}}function $M(r,e,t){const n={};for(const s of r.sources||[]){const o=e[s];if(o)n[s]=v0e(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 v0e(r){const e=r.value,{offset:t=0,stride:n,size:i}=r.getAccessor(),s=e.BYTES_PER_ELEMENT,o=t/s,l=n?n/s:i;if(i===1)return r.isConstant?()=>e[0]:A=>{const v=o+l*A;return e[v]};let f;return r.isConstant?(f=Array.from(e),()=>f):(f=new Array(i),A=>{const v=o+l*A;for(let T=0;T<i;T++)f[T]=e[v+T];return f})}class Bp{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=h0e({pointCount:this.props.pointCount,getBinId:$M(this.props.getBin,this.props.attributes,this.props.binOptions)});const e=d0e({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]||_0e[this.props.operations[e]],{value:n,domain:i}=y0e({bins:this.bins,getValue:$M(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 Q6(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 b0e=`uniform binSorterUniforms { 4653 ivec4 binIdRange; 4654 ivec2 targetSize; 4655} binSorter; 4656`,x0e={name:"binSorter",vs:b0e,uniformTypes:{binIdRange:"vec4<i32>",targetSize:"vec2<i32>"}},ek=[1,2,4,8],XM=3e38,w0e={SUM:0,MEAN:0,MIN:0,MAX:0,COUNT:0},Om=1024;class T0e{constructor(e,t){this.binsFBO=null,this.device=e,this.model=C0e(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%Om,n=Math.floor(e/Om),i=this.device.readPixelsToArrayWebGL(this.binsFBO,{sourceX:t,sourceY:n,sourceWidth:1,sourceHeight:1}).buffer;return new Float32Array(i)}setDimensions(e,t){const n=Om,i=Math.ceil(e/n);this.binsFBO?this.binsFBO.height<i&&this.binsFBO.resize({width:n,height:i}):this.binsFBO=Q6(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=E0e(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|=ek[3];const n=this.model,i=this.binsFBO,s=e==="MAX"?-XM:e==="MIN"?XM: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 E0e(r){const e={...w0e};for(let t=0;t<r.length;t++){const n=r[t];n&&(e[n]+=ek[t])}return e}function C0e(r,e){let t=e.vs;e.dimensions===2&&(t+=` 4657void getBin(out int binId) { 4658 ivec2 binId2; 4659 getBin(binId2); 4660 if (binId2.x < binSorter.binIdRange.x || binId2.x >= binSorter.binIdRange.y) { 4661 binId = -1; 4662 } else { 4663 binId = (binId2.y - binSorter.binIdRange.z) * (binSorter.binIdRange.y - binSorter.binIdRange.x) + binId2.x; 4664 } 4665} 4666`);const n=`#version 300 es 4667#define SHADER_NAME gpu-aggregation-sort-bins-vertex 4668 4669${t} 4670 4671out vec3 v_Value; 4672 4673void main() { 4674 int binIndex; 4675 getBin(binIndex); 4676 binIndex = binIndex - binSorter.binIdRange.x; 4677 if (binIndex < 0) { 4678 gl_Position = vec4(0.); 4679 return; 4680 } 4681 int row = binIndex / binSorter.targetSize.x; 4682 int col = binIndex - row * binSorter.targetSize.x; 4683 vec2 position = (vec2(col, row) + 0.5) / vec2(binSorter.targetSize) * 2.0 - 1.0; 4684 gl_Position = vec4(position, 0.0, 1.0); 4685 gl_PointSize = 1.0; 4686 4687#if NUM_CHANNELS == 3 4688 getValue(v_Value); 4689#elif NUM_CHANNELS == 2 4690 getValue(v_Value.xy); 4691#else 4692 getValue(v_Value.x); 4693#endif 4694} 4695`,i=`#version 300 es 4696#define SHADER_NAME gpu-aggregation-sort-bins-fragment 4697 4698precision highp float; 4699 4700in vec3 v_Value; 4701out vec4 fragColor; 4702 4703void main() { 4704 fragColor.xyz = v_Value; 4705 4706 #ifdef MODULE_GEOMETRY 4707 geometry.uv = vec2(0.); 4708 DECKGL_FILTER_COLOR(fragColor, geometry); 4709 #endif 4710 4711 fragColor.w = 1.0; 4712} 4713`;return new Di(r,{bufferLayout:e.bufferLayout,modules:[...e.modules||[],x0e],defines:{...e.defines,NON_INSTANCED_MODEL:1,NUM_CHANNELS:e.channelCount},isInstanced:!1,vs:n,fs:i,topology:"point-list",disableWarnings:!0})}const S0e=`uniform aggregatorTransformUniforms { 4714 ivec4 binIdRange; 4715 bvec3 isCount; 4716 bvec3 isMean; 4717 float naN; 4718} aggregatorTransform; 4719`,I0e={name:"aggregatorTransform",vs:S0e,uniformTypes:{binIdRange:"vec4<i32>",isCount:"vec3<f32>",isMean:"vec3<f32>"}};class B0e{constructor(e,t){this.binBuffer=null,this.valueBuffer=null,this._domains=null,this.device=e,this.channelCount=t.channelCount,this.transform=P0e(e,t),this.domainFBO=Q6(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)}
4719return 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 l=e*this.channelCount*4;(!this.valueBuffer||this.valueBuffer.byteLength<l)&&(this.valueBuffer?.destroy(),this.valueBuffer=this.device.createBuffer({byteLength:l}),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),l={isCount:s,isMean:o,bins:e};n.model.shaderInputs.setProps({aggregatorTransform:l}),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 P0e(r,e){const t=`#version 300 es 4720#define SHADER_NAME gpu-aggregation-domain-vertex 4721 4722uniform sampler2D bins; 4723 4724#if NUM_DIMS == 1 4725out float binIds; 4726#else 4727out vec2 binIds; 4728#endif 4729 4730#if NUM_CHANNELS == 1 4731flat out float values; 4732#elif NUM_CHANNELS == 2 4733flat out vec2 values; 4734#else 4735flat out vec3 values; 4736#endif 4737 4738const float NAN = intBitsToFloat(-1); 4739 4740void main() { 4741 int row = gl_VertexID / SAMPLER_WIDTH; 4742 int col = gl_VertexID - row * SAMPLER_WIDTH; 4743 vec4 weights = texelFetch(bins, ivec2(col, row), 0); 4744 vec3 value3 = mix( 4745 mix(weights.rgb, vec3(weights.a), aggregatorTransform.isCount), 4746 weights.rgb / max(weights.a, 1.0), 4747 aggregatorTransform.isMean 4748 ); 4749 if (weights.a == 0.0) { 4750 value3 = vec3(NAN); 4751 } 4752 4753#if NUM_DIMS == 1 4754 binIds = float(gl_VertexID + aggregatorTransform.binIdRange.x); 4755#else 4756 int y = gl_VertexID / (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x); 4757 int x = gl_VertexID - y * (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x); 4758 binIds.y = float(y + aggregatorTransform.binIdRange.z); 4759 binIds.x = float(x + aggregatorTransform.binIdRange.x); 4760#endif 4761 4762#if NUM_CHANNELS == 3 4763 values = value3; 4764#elif NUM_CHANNELS == 2 4765 values = value3.xy; 4766#else 4767 values = value3.x; 4768#endif 4769 4770 gl_Position = vec4(0., 0., 0., 1.); 4771 // This model renders into a 2x1 texture to obtain min and max simultaneously. 4772 // See comments in fragment shader 4773 gl_PointSize = 2.0; 4774} 4775`,n=`#version 300 es 4776#define SHADER_NAME gpu-aggregation-domain-fragment 4777 4778precision highp float; 4779 4780#if NUM_CHANNELS == 1 4781flat in float values; 4782#elif NUM_CHANNELS == 2 4783flat in vec2 values; 4784#else 4785flat in vec3 values; 4786#endif 4787 4788out vec4 fragColor; 4789 4790void main() { 4791 vec3 value3; 4792#if NUM_CHANNELS == 3 4793 value3 = values; 4794#elif NUM_CHANNELS == 2 4795 value3.xy = values; 4796#else 4797 value3.x = values; 4798#endif 4799 if (isnan(value3.x)) discard; 4800 // This shader renders into a 2x1 texture with blending=max 4801 // The left pixel yields the max value of each channel 4802 // The right pixel yields the min value of each channel 4803 if (gl_FragCoord.x < 1.0) { 4804 fragColor = vec4(value3, 1.0); 4805 } else { 4806 fragColor = vec4(-value3, 1.0); 4807 } 4808} 4809`;return new nh(r,{vs:t,fs:n,topology:"point-list",modules:[I0e],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:Om},varyings:["binIds","values"],disableWarnings:!0})}class Ua{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 T0e(e,t),this.aggregationTransform=new B0e(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[[l,f],[A]]=t,v=f-l;n=[e%v+l,Math.floor(e/v)+A]}const i=this.binSorter.getBinValues(e);if(!i)return null;const s=i[3],o=[];for(let l=0;l<this.channelCount;l++){const f=this.props.operations[l];f==="COUNT"?o[l]=s:s===0?o[l]=NaN:o[l]=f==="MEAN"?i[l]/s:i[l]}
4809return{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(Zr.assert(n.length===this.dimensions),this.dimensions===1){const[[i,s]]=n;this.binCount=s-i}else{const[[i,s],[o,l]]=n;this.binCount=(s-i)*(l-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,l]of Object.entries(s.getValue()))ArrayBuffer.isView(l)?i[o]=l:l&&(n[o]=l);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 Pp=class extends Ss{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 k_(this.context.device,{id:this.props.id,stats:this.context.stats})}};Pp.layerName="AggregationLayer";const hy=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function tk(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 w_={linear:"linear",quantile:"nearest",quantize:"nearest",ordinal:"nearest"};function tT(r,e){r.setSampler({minFilter:w_[e],magFilter:w_[e]})}function rT(r,e,t="linear"){const n=tk(e,!1,Uint8Array);return r.createTexture({format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:w_[t],magFilter:w_[t],addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},data:n,width:n.length/4,height:1})}const M0e=`#version 300 es 4810#define SHADER_NAME screen-grid-layer-vertex-shader 4811#define RANGE_COUNT 6 4812in vec2 positions; 4813in vec2 instancePositions; 4814in float instanceWeights; 4815in vec3 instancePickingColors; 4816uniform sampler2D colorRange; 4817out vec4 vColor; 4818vec4 interp(float value, vec2 domain, sampler2D range) { 4819float r = (value - domain.x) / (domain.y - domain.x); 4820return texture(range, vec2(r, 0.5)); 4821} 4822void main(void) { 4823if (isnan(instanceWeights)) { 4824gl_Position = vec4(0.); 4825return; 4826} 4827vec2 pos = instancePositions * screenGrid.gridSizeClipspace + positions * screenGrid.cellSizeClipspace; 4828pos.x = pos.x - 1.0; 4829pos.y = 1.0 - pos.y; 4830gl_Position = vec4(pos, 0., 1.); 4831vColor = interp(instanceWeights, screenGrid.colorDomain, colorRange); 4832vColor.a *= layer.opacity; 4833picking_setPickingColor(instancePickingColors); 4834} 4835`,R0e=`#version 300 es 4836#define SHADER_NAME screen-grid-layer-fragment-shader 4837precision highp float; 4838in vec4 vColor; 4839out vec4 fragColor; 4840void main(void) { 4841fragColor = vColor; 4842DECKGL_FILTER_COLOR(fragColor, geometry); 4843} 4844`,O0e=`uniform screenGridUniforms { 4845 vec2 cellSizeClipspace; 4846 vec2 gridSizeClipspace; 4847 vec2 colorDomain; 4848} screenGrid; 4849`,D0e={name:"screenGrid",vs:O0e,uniformTypes:{cellSizeClipspace:"vec2<f32>",gridSizeClipspace:"vec2<f32>",colorDomain:"vec2<f32>"}};class rk extends Cs{getShaders(){return super.getShaders({vs:M0e,fs:R0e,modules:[ma,D0e]})}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=rT(this.context.device,t.colorRange,t.colorScaleType);const o={colorRange:this.state.colorTexture};s.shaderInputs.setProps({screenGrid:o})}else n.colorScaleType!==t.colorScaleType&&tT(this.state.colorTexture,t.colorScaleType);if(n.cellMarginPixels!==t.cellMarginPixels||n.cellSizePixels!==t.cellSizePixels||i.viewportChanged){const{width:o,height:l}=this.context.viewport,{cellSizePixels:f,cellMarginPixels:A}=this.props,v=Math.max(f-A,0),T={gridSizeClipspace:[f/o*2,f/l*2],cellSizeClipspace:[v/o*2,v/l*2]};s.shaderInputs.setProps({screenGrid:T})}}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)}
4849_getModel(){return new Di(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zs({topology:"triangle-strip",attributes:{positions:{value:new Float32Array([0,0,1,0,0,1,1,1]),size:2}}}),isInstanced:!0})}}rk.layerName="ScreenGridCellLayer";const F0e=`uniform binOptionsUniforms { 4850 float cellSizePixels; 4851} binOptions; 4852`,L0e={name:"binOptions",vs:F0e,uniformTypes:{cellSizePixels:"f32"}},k0e={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0},colorRange:hy,colorScaleType:"linear",getPosition:{type:"accessor",value:r=>r.position},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"};class nT extends Pp{getAggregatorType(){return this.props.gpuAggregation&&Ua.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){return e==="cpu"||!Ua.isSupported(this.context.device)?new Bp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:t},n,i)=>{const s=this.context.viewport,o=s.project(t),l=i.cellSizePixels;return o[0]<0||o[0]>=s.width||o[1]<0||o[1]>=s.height?null:[Math.floor(o[0]/l),Math.floor(o[1]/l)]}},getValue:[{sources:["counts"],getValue:({counts:t})=>t}]}):new Ua(this.context.device,{dimensions:2,channelCount:1,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,L0e],vs:` 4853 in vec3 positions; 4854 in vec3 positions64Low; 4855 in float counts; 4856 4857 void getBin(out ivec2 binId) { 4858 vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0)); 4859 vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio; 4860 vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels); 4861 binId = ivec2(gridCoords); 4862 } 4863 void getValue(out float weight) { 4864 weight = counts; 4865 } 4866 `})})}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:l}=n;if(t||s.dataChanged||s.updateTriggersChanged||s.viewportChanged||l!==i.aggregation||o!==i.cellSizePixels){const{width:f,height:A}=this.context.viewport,{aggregator:v}=this.state;v instanceof Ua&&v.setProps({binIdRange:[[0,Math.ceil(f/o)],[0,Math.ceil(A/o)]]}),v.setProps({pointCount:this.getNumInstances(),operations:[l],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;
4866case"counts":t.setNeedsUpdate(0);break}}renderLayers(){const{aggregator:e}=this.state,t=this.getSubLayerClass("cells",rk),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}}nT.layerName="ScreenGridLayer";nT.defaultProps=k0e;class T_{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=qM(this.input,this.inputLength);this._percentile=U0e(e)}return this._percentile}getScaleOrdinal(){if(!this._ordinal){const e=qM(this.input,this.inputLength);this._ordinal=N0e(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:l}=this.getScaleOrdinal();s=l.findIndex(f=>f>=s),o=l.findIndex(f=>f>o)-1,o===-2&&(o=l.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 N0e(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 U0e(r,e=100){const t=Array.from(r).filter(Number.isFinite).sort(z0e);let n=0;const i=Math.max(1,e),s=new Array(i-1);for(;++n<i;)s[n-1]=V0e(t,n/i);return{attribute:{value:r.map(o=>Number.isFinite(o)?G0e(s,o):NaN),type:"float32",size:1},domain:s}}function qM(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 z0e(r,e){return r-e}function V0e(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 G0e(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 iT({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=>
4866f[0]))-t,s=Math.min(...n.map(f=>f[1]))-t,o=Math.max(...n.map(f=>f[0]))+t+1,l=Math.max(...n.map(f=>f[1]))+t+1;return[[i,o],[s,l]]}const nk=Math.PI/3,dy=2*Math.sin(nk),py=1.5,j0e=Array.from({length:6},(r,e)=>{const t=e*nk;return[Math.sin(t),-Math.cos(t)]});function a1([r,e],t){let n=Math.round(e=e/t/py),i=Math.round(r=r/t/dy-(n&1)/2);const s=e-n;if(Math.abs(s)*3>1){const o=r-i,l=i+(r<i?-1:1)/2,f=n+(e<n?-1:1),A=r-l,v=e-f;o*o+s*s>A*A+v*v&&(i=l+(n&1?1:-1)/2,n=f)}return[i,n]}const H0e=` 4867const vec2 DIST = vec2(${dy}, ${py}); 4868 4869ivec2 pointToHexbin(vec2 p, float radius) { 4870 p /= radius * DIST; 4871 float pj = round(p.y); 4872 float pjm2 = mod(pj, 2.0); 4873 p.x -= pjm2 * 0.5; 4874 float pi = round(p.x); 4875 vec2 d1 = p - vec2(pi, pj); 4876 4877 if (abs(d1.y) * 3. > 1.) { 4878 vec2 v2 = step(0.0, d1) - 0.5; 4879 v2.y *= 2.0; 4880 vec2 d2 = d1 - v2; 4881 if (dot(d1, d1) > dot(d2, d2)) { 4882 pi += v2.x + pjm2 - 0.5; 4883 pj += v2.y; 4884 } 4885 } 4886 return ivec2(pi, pj); 4887} 4888`;function JM([r,e],t){return[(r+(e&1)/2)*t*dy,e*t*py]}const W0e=` 4889const vec2 DIST = vec2(${dy}, ${py}); 4890 4891vec2 hexbinCentroid(vec2 binId, float radius) { 4892 binId.x += fract(binId.y * 0.5); 4893 return binId * DIST * radius; 4894} 4895`,$0e=`#version 300 es 4896#define SHADER_NAME hexagon-cell-layer-vertex-shader 4897in vec3 positions; 4898in vec3 normals; 4899in vec2 instancePositions; 4900in float instanceElevationValues; 4901in float instanceColorValues; 4902in vec3 instancePickingColors; 4903uniform sampler2D colorRange; 4904out vec4 vColor; 4905${W0e} 4906float interp(float value, vec2 domain, vec2 range) { 4907float r = min(max((value - domain.x) / (domain.y - domain.x), 0.), 1.); 4908return mix(range.x, range.y, r); 4909} 4910vec4 interp(float value, vec2 domain, sampler2D range) { 4911float r = (value - domain.x) / (domain.y - domain.x); 4912return texture(range, vec2(r, 0.5)); 4913} 4914void main(void) { 4915geometry.pickingColor = instancePickingColors; 4916if (isnan(instanceColorValues) || 4917instanceColorValues < hexagon.colorDomain.z || 4918instanceColorValues > hexagon.colorDomain.w || 4919instanceElevationValues < hexagon.elevationDomain.z || 4920instanceElevationValues > hexagon.elevationDomain.w 4921) { 4922gl_Position = vec4(0.); 4923return; 4924} 4925vec2 commonPosition = hexbinCentroid(instancePositions, column.radius) + (hexagon.originCommon - project.commonOrigin.xy); 4926commonPosition += positions.xy * column.radius * column.coverage; 4927geometry.position = vec4(commonPosition, 0.0, 1.0); 4928geometry.normal = project_normal(normals); 4929float elevation = 0.0; 4930if (column.extruded) { 4931elevation = interp(instanceElevationValues, hexagon.elevationDomain.xy, hexagon.elevationRange); 4932elevation = project_size(elevation); 4933geometry.position.z = (positions.z + 1.0) / 2.0 * elevation; 4934} 4935gl_Position = project_common_position_to_clipspace(geometry.position); 4936DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4937vColor = interp(instanceColorValues, hexagon.colorDomain.xy, colorRange); 4938vColor.a *= layer.opacity; 4939if (column.extruded) { 4940vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 4941} 4942DECKGL_FILTER_COLOR(vColor, geometry); 4943} 4944`,X0e=`uniform hexagonUniforms { 4945 vec4 colorDomain; 4946 vec4 elevationDomain; 4947 vec2 elevationRange; 4948 vec2 originCommon; 4949} hexagon; 4950`,q0e={name:"hexagon",vs:X0e,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>"}};class ik extends pc{getShaders(){const e=super.getShaders();return e.modules.push(q0e),{...e,vs:$0e}}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=rT(this.context.device,t.colorRange,t.colorScaleType);const s={colorRange:this.state.colorTexture};i.shaderInputs.setProps({hexagon:s})}else n.colorScaleType!==t.colorScaleType&&tT(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:l,colorDomain:f,elevationDomain:A}=this.props,v=this.props.colorCutoff||[-1/0,1/0],T=this.props.elevationCutoff||[-1/0,1/0],I=this.state.fillModel;I.vertexArray.indexBuffer&&I.setIndexBuffer(null),I.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],T[0]),Math.min(A[1],T[1]),Math.max(A[0]-1,T[0]),Math.min(A[1]+1,T[1])],elevationRange:[i[0]*s,i[1]*s],originCommon:n};I.shaderInputs.setProps({column:{extruded:o,coverage:l,radius:t},hexagon:F}),I.draw(this.context.renderPass)}}ik.layerName="HexagonCellLayer";const J0e=`uniform binOptionsUniforms { 4951 vec2 hexOriginCommon; 4952 float radiusCommon; 4953} binOptions;
4954`,K0e={name:"binOptions",vs:J0e,uniformTypes:{hexOriginCommon:"vec2<f32>",radiusCommon:"f32"}};function KM(){}const Z0e={gpuAggregation:!0,colorDomain:null,colorRange:hy,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:KM,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:KM,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 sT extends Pp{getAggregatorType(){const{gpuAggregation:e,hexagonAggregator:t,getColorValue:n,getElevationValue:i}=this.props;return e&&(t||n||i)?(Zr.warn("Features not supported by GPU aggregation, falling back to CPU")(),"cpu"):e&&Ua.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){if(e==="cpu"){const{hexagonAggregator:t,radius:n}=this.props;return new Bp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:i},s,o)=>{if(t)return t(i,n);const f=this.state.aggregatorViewport.projectPosition(i),{radiusCommon:A,hexOriginCommon:v}=o;return a1([f[0]-v[0],f[1]-v[1]],A)}},getValue:[{sources:["colorWeights"],getValue:({colorWeights:i})=>i},{sources:["elevationWeights"],getValue:({elevationWeights:i})=>i}]})}return new Ua(this.context.device,{dimensions:2,channelCount:2,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,K0e],vs:` 4955 in vec3 positions; 4956 in vec3 positions64Low; 4957 in float colorWeights; 4958 in float elevationWeights; 4959 4960 ${H0e} 4961 4962 void getBin(out ivec2 binId) { 4963 vec3 positionCommon = project_position(positions, positions64Low); 4964 binId = pointToHexbin(positionCommon.xy, binOptions.radiusCommon); 4965 } 4966 void getValue(out vec2 value) { 4967 value = vec2(colorWeights, elevationWeights); 4968 } 4969 `})})}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(dc(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:l,hexOriginCommon:f,binIdRange:A,dataAsArray:v}=this.state;if(o.setProps({binIdRange:A,pointCount:this.getNumInstances(),operations:[n.colorAggregation,n.elevationAggregation],binOptions:{radiusCommon:l,hexOriginCommon:f},onUpdate:this._onAggregationUpdate.bind(this)}),v){const{getColorValue:T,getElevationValue:I}=this.props;o.setProps({customOperations:[T&&(F=>T(F.map(N=>v[N]),{indices:F,data:n.data})),I&&(F=>I(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:l}=this.props,{unitsPerMeter:f}=s.getDistanceScales(o);t=f[0]*l;const A=a1(s.projectFlat(o),t);o=s.unprojectFlat(JM(A,t));const v=s.constructor;s=s.isGeospatial?new v({longitude:o[0],latitude:o[1],zoom:12}):new eu({position:[o[0],o[1],0],zoom:12}),n=[Math.fround(s.center[0]),Math.fround(s.center[1])],i=iT({dataBounds:e,getBinId:T=>{const I=s.projectFlat(T);return I[0]-=n[0],I[1]-=n[1],a1(I,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 T_(i,n.binCount)}),t.onSetColorDomain(n.getResultDomain(0))}else if(e===1){const i=n.getResult(1);this.setState({elevations:new T_(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:l,coverage:f,material:A,transitions:v,colorScaleType:T,lowerPercentile:I,upperPercentile:F,colorDomain:N,elevationScaleType:U,elevationLowerPercentile:$,elevationUpperPercentile:V,elevationDomain:j}
4969=this.props,X=this.getSubLayerClass("cells",ik),ue=e.getBins(),K=this.state.colors?.update({scaleType:T,lowerPercentile:I,upperPercentile:F}),se=this.state.elevations?.update({scaleType:U,lowerPercentile:$,upperPercentile:V});return!K||!se?null:new X(this.getSubLayerProps({id:"cells"}),{data:{length:e.binCount,attributes:{getBin:ue,getColorValue:K.attribute,getElevationValue:se.attribute}},dataComparator:(Ee,Ue)=>Ee.length===Ue.length,updateTriggers:{getBin:[ue],getColorValue:[K.attribute],getElevationValue:[se.attribute]},diskResolution:6,vertices:j0e,radius:t,hexOriginCommon:n,elevationScale:i,colorRange:s,colorScaleType:T,elevationRange:o,extruded:l,coverage:f,material:A,colorDomain:K.domain||N||e.getResultDomain(0),elevationDomain:se.domain||j||e.getResultDomain(1),colorCutoff:K.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=JM(i.id,this.state.radiusCommon),l=this.context.viewport.unprojectFlat(o);s={col:i.id[0],row:i.id[1],position:l,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}}sT.layerName="HexagonLayer";sT.defaultProps=Z0e;const lr=.5,Tr=1/6,wt={N:[0,lr],E:[lr,0],S:[0,-lr],W:[-lr,0],NE:[lr,lr],NW:[-lr,lr],SE:[lr,-lr],SW:[-lr,-lr]},wd=[wt.W,wt.SW,wt.S],Td=[wt.S,wt.SE,wt.E],Ed=[wt.E,wt.NE,wt.N],Cd=[wt.NW,wt.W,wt.N],Sd=[[-lr,Tr],[-lr,-Tr],[-Tr,-lr],[Tr,-lr]],Id=[[-Tr,-lr],[Tr,-lr],[lr,-Tr],[lr,Tr]],Bd=[[lr,-Tr],[lr,Tr],[Tr,lr],[-Tr,lr]],Pd=[[-lr,Tr],[-lr,-Tr],[Tr,lr],[-Tr,lr]],ZM=[wt.W,wt.SW,wt.SE,wt.E],YM=[wt.S,wt.SE,wt.NE,wt.N],QM=[wt.NW,wt.W,wt.E,wt.NE],eR=[wt.NW,wt.SW,wt.S,wt.N],tR=[[-lr,Tr],[-lr,-Tr],[lr,-Tr],[lr,Tr]],rR=[[-Tr,-lr],[Tr,-lr],[Tr,lr],[-Tr,lr]],Y0e=[wt.NW,wt.SW,wt.SE,wt.NE],nR=[wt.NW,wt.SW,wt.SE,wt.E,wt.N],iR=[wt.W,wt.SW,wt.SE,wt.NE,wt.N],sR=[wt.NW,wt.W,wt.S,wt.SE,wt.NE],oR=[wt.NW,wt.SW,wt.S,wt.E,wt.NE],aR=[wt.NW,wt.W,[lr,-Tr],[lr,Tr],wt.N],lR=[[-Tr,-lr],[Tr,-lr],wt.E,wt.NE,wt.N],cR=[[-lr,Tr],[-lr,-Tr],wt.S,wt.SE,wt.E],uR=[wt.W,wt.SW,wt.S,[Tr,lr],[-Tr,lr]],fR=[wt.NW,wt.W,[-Tr,-lr],[Tr,-lr],wt.N],hR=[[-lr,Tr],[-lr,-Tr],wt.E,wt.NE,wt.N],dR=[wt.S,wt.SE,wt.E,[Tr,lr],[-Tr,lr]],pR=[wt.W,wt.SW,wt.S,[lr,-Tr],[lr,Tr]],AR=[wt.W,wt.SW,wt.SE,wt.E,[Tr,lr],[-Tr,lr]],gR=[[-lr,Tr],[-lr,-Tr],wt.S,wt.SE,wt.NE,wt.N],mR=[wt.NW,wt.W,[-Tr,-lr],[Tr,-lr],wt.E,wt.NE],_R=[wt.NW,wt.SW,wt.S,[lr,-Tr],[lr,Tr],wt.N],Md=[wt.W,wt.SW,wt.S,wt.E,wt.NE,wt.N],Rd=[wt.NW,wt.W,wt.S,wt.SE,wt.E,wt.N],tm=[[-lr,Tr],[-lr,-Tr],[-Tr,-lr],[Tr,-lr],wt.E,wt.NE,wt.N],rm=[wt.W,wt.SW,wt.S,[lr,-Tr],[lr,Tr],[Tr,lr],[-Tr,lr]],nm=[wt.NW,wt.W,[-Tr,-lr],[Tr,-lr],[lr,-Tr],[lr,Tr],wt.N],im=[[-lr,Tr],[-lr,-Tr],wt.S,wt.SE,wt.E,[Tr,lr],[-Tr,lr]],yR=[[-lr,Tr],[-lr,-Tr],[-Tr,-lr],[Tr,-lr],[lr,-Tr],[lr,Tr],[Tr,lr],[-Tr,lr]],Q0e={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 eme={[fr("0000")]:[],[fr("2222")]:[],[fr("2221")]:[wd],[fr("2212")]:[Td],[fr("2122")]:[Ed],[fr("1222")]:[Cd],[fr("0001")]:[wd],[fr("0010")]:[Td],[fr("0100")]:[Ed],[fr("1000")]:[Cd],[fr("2220")]:[Sd],[fr("2202")]:[Id],[fr("2022")]:[Bd],[fr("0222")]:[Pd],[fr("0002")]:[Sd],[fr("0020")]:[Id],[fr("0200")]:[Bd],[fr("2000")]:[Pd],[fr("0011")]:[ZM],[fr("0110")]:[YM],[fr("1100")]:[QM],[fr("1001")]:[eR],[fr("2211")]:[ZM],[fr("2112")]:[YM],[fr("1122")]:[QM],[fr("1221")]:[eR],[fr("2200")]:[tR],[fr("2002")]:[rR],[fr("0022")]:[tR],[fr("0220")]:[rR],[fr("1111")]:[Y0e],[fr("1211")]:[nR],[fr("2111")]:[iR],[fr("1112")]:[sR],[fr("1121")]:[oR],[fr("1011")]:[nR],[fr("0111")]:[iR],[fr("1110")]:[sR],[fr("1101")]:[oR],[fr("12
496900")]:[aR],[fr("0120")]:[lR],[fr("0012")]:[cR],[fr("2001")]:[uR],[fr("1022")]:[aR],[fr("2102")]:[lR],[fr("2210")]:[cR],[fr("0221")]:[uR],[fr("1002")]:[fR],[fr("2100")]:[hR],[fr("0210")]:[dR],[fr("0021")]:[pR],[fr("1220")]:[fR],[fr("0122")]:[hR],[fr("2012")]:[dR],[fr("2201")]:[pR],[fr("0211")]:[AR],[fr("2110")]:[gR],[fr("1102")]:[mR],[fr("1021")]:[_R],[fr("2011")]:[AR],[fr("0112")]:[gR],[fr("1120")]:[mR],[fr("1201")]:[_R],[fr("2101")]:[Md],[fr("0121")]:[Md],[fr("1012")]:[Rd],[fr("1210")]:[Rd],[fr("0101")]:{0:[wd,Ed],1:[Md],2:[Md]},[fr("1010")]:{0:[Cd,Td],1:[Rd],2:[Rd]},[fr("2121")]:{0:[Md],1:[Md],2:[wd,Ed]},[fr("1212")]:{0:[Rd],1:[Rd],2:[Cd,Td]},[fr("2120")]:{0:[tm],1:[tm],2:[Sd,Ed]},[fr("2021")]:{0:[rm],1:[rm],2:[wd,Bd]},[fr("1202")]:{0:[nm],1:[nm],2:[Cd,Id]},[fr("0212")]:{0:[im],1:[im],2:[Td,Pd]},[fr("0102")]:{0:[Sd,Ed],1:[tm],2:[tm]},[fr("0201")]:{0:[wd,Bd],1:[rm],2:[rm]},[fr("1020")]:{0:[Cd,Id],1:[nm],2:[nm]},[fr("2010")]:{0:[Td,Pd],1:[im],2:[im]},[fr("2020")]:{0:[Pd,Id],1:[yR],2:[Sd,Bd]},[fr("0202")]:{0:[Bd,Sd],1:[yR],2:[Pd,Id]}};function bA(r,e){return Number.isNaN(r)?0:Array.isArray(e)?r<e[0]?0:r<e[1]?1:2:r>=e?1:0}function tme(r){const{x:e,y:t,xRange:n,yRange:i,getValue:s,threshold:o}=r,l=e<n[0],f=e>=n[1]-1,A=t<i[0],v=t>=i[1]-1,T=l||f||A||v;let I=0,F,N,U,$;if(l||v)U=0;else{const X=s(e,t+1);U=bA(X,o),I+=X}if(f||v)$=0;else{const X=s(e+1,t+1);$=bA(X,o),I+=X}if(f||A)N=0;else{const X=s(e+1,t);N=bA(X,o),I+=X}if(l||A)F=0;else{const X=s(e,t);F=bA(X,o),I+=X}let V=-1;Number.isFinite(o)&&(V=U<<3|$<<2|N<<1|F),Array.isArray(o)&&(V=U<<6|$<<4|N<<2|F);let j=0;return T||(j=bA(I/4,o)),{code:V,meanCode:j}}function rme(r){const{x:e,y:t,z:n,code:i,meanCode:s}=r;let o=eme[i];Array.isArray(o)||(o=o[s]);const l=e+1,f=t+1,A=[];return o.forEach(v=>{const T=[];v.forEach(I=>{const F=l+I[0],N=f+I[1];T.push([F,N,n])}),A.push(T)}),A}function nme(r){const{x:e,y:t,z:n,code:i,meanCode:s}=r;let o=Q0e[i];Array.isArray(o)||(o=o[s]);const l=e+1,f=t+1,A=[];return o.forEach(v=>{v.forEach(T=>{const I=l+T[0],F=f+T[1];A.push([I,F,n])})}),A}function ime({contours:r,getValue:e,xRange:t,yRange:n}){const i=[],s=[];let o=0,l=0;for(let f=0;f<r.length;f++){const A=r[f],v=A.zIndex??f,{threshold:T}=A;for(let I=t[0]-1;I<t[1];I++)for(let F=n[0]-1;F<n[1];F++){const{code:N,meanCode:U}=tme({getValue:e,threshold:T,x:I,y:F,xRange:t,yRange:n}),$={x:I,y:F,z:v,code:N,meanCode:U};if(Array.isArray(T)){const V=rme($);for(const j of V)s[l++]={vertices:j,contour:A}}else{const V=nme($);V.length>0&&(i[o++]={vertices:V,contour:A})}}}return{lines:i,polygons:s}}function sme(r){const{aggregator:e,binIdRange:t,channel:n}=r;if(e instanceof Ua){const i=e.getResult(n)?.buffer;if(i){const s=new Float32Array(i.readSyncWebGL().buffer);return ome(s,t)}}if(e instanceof Bp){const i=e.getResult(n)?.value,s=e.getBins()?.value;if(s&&i)return ame(i,s,e.binCount)}return null}function ome(r,e){const[[t,n],[i,s]]=e,o=n-t,l=s-i;return(f,A)=>(f-=t,A-=i,f<0||f>=o||A<0||A>=l?NaN:r[A*o+f])}function ame(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 lme=`uniform binOptionsUniforms { 4970 vec2 cellOriginCommon; 4971 vec2 cellSizeCommon; 4972} binOptions; 4973`,cme={name:"binOptions",vs:lme,uniformTypes:{cellOriginCommon:"vec2<f32>",cellSizeCommon:"vec2<f32>"}},vR=[255,255,255,255],ume=1,fme={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 oT=class extends Pp{getAggregatorType(){return this.props.gpuAggregation&&Ua.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){return e==="cpu"?new Bp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:t},n,i)=>{const o=this.state.aggregatorViewport.projectPosition(t),{cellSizeCommon:l,cellOriginCommon:f}=i;return[Math.floor((o[0]-f[0])/l[0]),Math.floor((o[1]-f[1])/l[1])]}},getValue:[{sources:["counts"],getValue:({counts:t})=>t}],onUpdate:this._onAggregationUpdate.bind(this)}):new Ua(this.context.device,{dimensions:2,channelCount:1,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,cme],vs:` 4974 in vec3 positions; 4975 in vec3 positions64Low; 4976 in float counts; 4977 4978 void getBin(out ivec2 binId) { 4979 vec3 positionCommon = project_position(positions, positions64Low); 4980 vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon); 4981 binId = ivec2(gridCoords); 4982 } 4983 void getValue(out float value) { 4984 value = counts; 4985 } 4986 `}),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:l,cellOriginCommon:f,binIdRange:A}=this.state;o.setProps({binIdRange:A,pointCount:this.getNumInstances(),operations:[n.aggregation],binOptions:{cellSizeCommon:l,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:l,gridOrigin:f}=this.props,{unitsPerMeter:A}=s.getDistanceScales(o);t[0]=A[0]*l,t[1]=A[1]*l;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 T=s.constructor;s=s.isGeospatial?new T({longitude:o[0],latitude:o[1],zoom:12}):new eu({position:[o[0],o[1],0],zoom:12}),n=[Math.fround(s.center[0]),Math.fround(s.center[1])],i=iT({dataBounds:e,getBinId:I=>{const F=s.projectFlat(I);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)}
4986_onAggregationUpdate(){const{aggregator:e,binIdRange:t}=this.state;this.setState({aggregatedValueReader:sme({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=ime({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;case"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,l=this.getSubLayerClass("lines",sf),f=this.getSubLayerClass("bands",of),A=new vn().translate([s[0],s[1],0]).scale([o[0],o[1],i]),v=t&&t.length>0&&new l(this.getSubLayerProps({id:"lines"}),{data:t,coordinateSystem:Qr.CARTESIAN,modelMatrix:A,getPath:I=>I.vertices,getColor:I=>I.contour.color??vR,getWidth:I=>I.contour.strokeWidth??ume,widthUnits:"pixels"}),T=n&&n.length>0&&new f(this.getSubLayerProps({id:"bands"}),{data:n,coordinateSystem:Qr.CARTESIAN,modelMatrix:A,getPolygon:I=>I.vertices,getFillColor:I=>I.contour.color??vR});return[v,T]}getPickingInfo(e){const t=e.info,{object:n}=t;return n&&(t.object={contour:n.contour}),t}};oT.layerName="ContourLayer";oT.defaultProps=fme;const hme=`#version 300 es 4987#define SHADER_NAME grid-cell-layer-vertex-shader 4988in vec3 positions; 4989in vec3 normals; 4990in vec2 instancePositions; 4991in float instanceElevationValues; 4992in float instanceColorValues; 4993in vec3 instancePickingColors; 4994uniform sampler2D colorRange; 4995out vec4 vColor; 4996float interp(float value, vec2 domain, vec2 range) { 4997float r = min(max((value - domain.x) / (domain.y - domain.x), 0.), 1.); 4998return mix(range.x, range.y, r); 4999} 5000vec4 interp(float value, vec2 domain, sampler2D range) { 5001float r = (value - domain.x) / (domain.y - domain.x); 5002return texture(range, vec2(r, 0.5)); 5003} 5004void main(void) { 5005geometry.pickingColor = instancePickingColors; 5006if (isnan(instanceColorValues) || 5007instanceColorValues < grid.colorDomain.z || 5008instanceColorValues > grid.colorDomain.w || 5009instanceElevationValues < grid.elevationDomain.z || 5010instanceElevationValues > grid.elevationDomain.w 5011) { 5012gl_Position = vec4(0.); 5013return; 5014} 5015vec2 commonPosition = (instancePositions + (positions.xy + 1.0) / 2.0 * column.coverage) * grid.sizeCommon + grid.originCommon - project.commonOrigin.xy; 5016geometry.position = vec4(commonPosition, 0.0, 1.0); 5017geometry.normal = project_normal(normals); 5018float elevation = 0.0; 5019if (column.extruded) { 5020elevation = interp(instanceElevationValues, grid.elevationDomain.xy, grid.elevationRange); 5021elevation = project_size(elevation); 5022geometry.position.z = (positions.z + 1.0) / 2.0 * elevation; 5023} 5024gl_Position = project_common_position_to_clipspace(geometry.position); 5025DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 5026vColor = interp(instanceColorValues, grid.colorDomain.xy, colorRange); 5027vColor.a *= layer.opacity; 5028if (column.extruded) { 5029vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 5030} 5031DECKGL_FILTER_COLOR(vColor, geometry); 5032} 5033`,dme=`uniform gridUniforms { 5034 vec4 colorDomain; 5035 vec4 elevationDomain; 5036 vec2 elevationRange; 5037 vec2 originCommon; 5038 vec2 sizeCommon; 5039} grid; 5040`,pme={name:"grid",vs:dme,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>",sizeCommon:"vec2<f32>"}};class sk extends pc{getShaders(){const e=super.getShaders();return e.modules.push(pme),{...e,vs:hme}}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=rT(this.context.device,t.colorRange,t.colorScaleType);const s={colorRange:this.state.colorTexture};i.shaderInputs.setProps({grid:s})}else n.colorScaleType!==t.colorScaleType&&tT(this.state.colorTexture,t.colorScaleType)}finalizeState(e){super.finalizeState(e),this.state.colorTexture?.destroy()}_updateGeometry(){const e=new fD;this.state.fillModel.setGeometry(e)}draw({uniforms:e}){const{cellOriginCommon:t,cellSizeCommon:n,elevationRange:i,elevationScale:s,extruded:o,coverage:l,colorDomain:f,elevationDomain:A}=this.props,v=this.props.colorCutoff||[-1/0,1/0],T=this.props.elevationCutoff||[-1/0,1/0],I=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],T[0]),Math.min(A[1],T[1]),Math.max(A[0]-1,T[0]),Math.min(A[1]+1,T[1])],elevationRange:[i[0]*s,i[1]*s],originCommon:t,sizeCommon:n};I.shaderInputs.setProps({column:{extruded:o,coverage:l},grid:F}),I.draw(this.context.renderPass)}}sk.layerName="GridCellLayer";const Ame=`uniform binOptionsUniforms { 5041 vec2 cellOriginCommon; 5042 vec2 cellSizeCommon; 5043} binOptions; 5044`,gme={name:"binOptions",vs:Ame,uniformTypes:{cellOriginCommon:"vec2<f32>",cellSizeCommon:"vec2<f32>"}};function bR(){}const mme={gpuAggregation:!0,colorDomain:null,colorRange:hy,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:bR,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:bR,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 aT extends Pp{getAggregatorType(){const{gpuAggregation:e,gridAggregator:t,getColorValue:n,getElevationValue:i}=this.props;return e&&(t||n||i)?(Zr.warn("Features not supported by GPU aggregation, falling back to CPU")(),"cpu"):e&&Ua.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){if(e==="cpu"){const{gridAggregator:t,cellSize:n}=this.props;return new Bp({dimensions:2,getBin:{sources:["positions"],getValue:({positions:i},s,o)=>
5044{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 Ua(this.context.device,{dimensions:2,channelCount:2,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Ls,gme],vs:` 5045 in vec3 positions; 5046 in vec3 positions64Low; 5047 in float colorWeights; 5048 in float elevationWeights; 5049 5050 void getBin(out ivec2 binId) { 5051 vec3 positionCommon = project_position(positions, positions64Low); 5052 vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon); 5053 binId = ivec2(gridCoords); 5054 } 5055 void getValue(out vec2 value) { 5056 value = vec2(colorWeights, elevationWeights); 5057 } 5058 `})})}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(dc(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:l,cellOriginCommon:f,binIdRange:A,dataAsArray:v}=this.state;if(o.setProps({binIdRange:A,pointCount:this.getNumInstances(),operations:[n.colorAggregation,n.elevationAggregation],binOptions:{cellSizeCommon:l,cellOriginCommon:f},onUpdate:this._onAggregationUpdate.bind(this)}),v){const{getColorValue:T,getElevationValue:I}=this.props;o.setProps({customOperations:[T&&(F=>T(F.map(N=>v[N]),{indices:F,data:n.data})),I&&(F=>I(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:l}=this.props,{unitsPerMeter:f}=s.getDistanceScales(o);t[0]=f[0]*l,t[1]=f[1]*l;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 eu({position:[o[0],o[1],0],zoom:12}),n=[Math.fround(s.center[0]),Math.fround(s.center[1])],i=iT({dataBounds:e,getBinId:T=>{const I=s.projectFlat(T);return[Math.floor((I[0]-n[0])/t[0]),Math.floor((I[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 T_(i,n.binCount)}),t.onSetColorDomain(n.getResultDomain(0))}else if(e===1){const i=n.getResult(1);this.setState({elevations:new T_(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:l,coverage:f,material:A,transitions:v,colorScaleType:T,lowerPercentile:I,upperPercentile:F,colorDomain:N,elevationScaleType:U,elevationLowerPercentile:$,elevationUpperPercentile:V,elevationDomain:j}
5058=this.props,X=this.getSubLayerClass("cells",sk),ue=e.getBins(),K=this.state.colors?.update({scaleType:T,lowerPercentile:I,upperPercentile:F}),se=this.state.elevations?.update({scaleType:U,lowerPercentile:$,upperPercentile:V});return!K||!se?null:new X(this.getSubLayerProps({id:"cells"}),{data:{length:e.binCount,attributes:{getBin:ue,getColorValue:K.attribute,getElevationValue:se.attribute}},dataComparator:(Ee,Ue)=>Ee.length===Ue.length,updateTriggers:{getBin:[ue],getColorValue:[K.attribute],getElevationValue:[se.attribute]},cellOriginCommon:t,cellSizeCommon:n,elevationScale:i,colorRange:s,colorScaleType:T,elevationRange:o,extruded:l,coverage:f,material:A,colorDomain:K.domain||N||e.getResultDomain(0),elevationDomain:se.domain||j||e.getResultDomain(1),colorCutoff:K.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}}aT.layerName="GridLayer";aT.defaultProps=mme;function _me(r){const e=r.map(l=>l[0]),t=r.map(l=>l[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 yme(r,e){return e[0]>=r[0]&&e[2]<=r[2]&&e[1]>=r[1]&&e[3]<=r[3]}const xR=new Float32Array(12);function wR(r,e=2){let t=0;for(const n of r)for(let i=0;i<e;i++)xR[t++]=n[i]||0;return xR}function vme(r,e,t){const[n,i,s,o]=r,l=s-n,f=o-i;let A=l,v=f;l/f<e/t?A=e/t*f:v=t/e*l,A<e&&(A=e,v=t);const T=(s+n)/2,I=(o+i)/2;return[T-A/2,I-v/2,T+A/2,I+v/2]}function bme(r,e){const[t,n,i,s]=e;return[(r[0]-t)/(i-t),(r[1]-n)/(s-n)]}const xme=`#version 300 es 5059#define SHADER_NAME heatp-map-layer-vertex-shader 5060uniform sampler2D maxTexture; 5061in vec3 positions; 5062in vec2 texCoords; 5063out vec2 vTexCoords; 5064out float vIntensityMin; 5065out float vIntensityMax; 5066void main(void) { 5067gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0)); 5068vTexCoords = texCoords; 5069vec4 maxTexture = texture(maxTexture, vec2(0.5)); 5070float maxValue = triangle.aggregationMode < 0.5 ? maxTexture.r : maxTexture.g; 5071float minValue = maxValue * triangle.threshold; 5072if (triangle.colorDomain[1] > 0.) { 5073maxValue = triangle.colorDomain[1]; 5074minValue = triangle.colorDomain[0]; 5075} 5076vIntensityMax = triangle.intensity / maxValue; 5077vIntensityMin = triangle.intensity / minValue; 5078} 5079`,wme=`#version 300 es 5080#define SHADER_NAME triangle-layer-fragment-shader 5081precision highp float; 5082uniform sampler2D weightsTexture; 5083uniform sampler2D colorTexture; 5084in vec2 vTexCoords; 5085in float vIntensityMin; 5086in float vIntensityMax; 5087out vec4 fragColor; 5088vec4 getLinearColor(float value) { 5089float factor = clamp(value * vIntensityMax, 0., 1.); 5090vec4 color = texture(colorTexture, vec2(factor, 0.5)); 5091color.a *= min(value * vIntensityMin, 1.0); 5092return color; 5093} 5094void main(void) { 5095vec4 weights = texture(weightsTexture, vTexCoords); 5096float weight = weights.r; 5097if (triangle.aggregationMode > 0.5) { 5098weight /= max(1.0, weights.a); 5099} 5100if (weight <= 0.) { 5101discard; 5102} 5103vec4 linearColor = getLinearColor(weight); 5104linearColor.a *= layer.opacity; 5105fragColor = linearColor; 5106} 5107`,TR=`uniform triangleUniforms { 5108 float aggregationMode; 5109 vec2 colorDomain; 5110 float intensity; 5111 float threshold; 5112} triangle; 5113`,Tme={name:"triangle",vs:TR,fs:TR,uniformTypes:{aggregationMode:"f32",colorDomain:"vec2<f32>",intensity:"f32",threshold:"f32"}};class ok extends Cs{getShaders(){return super.getShaders({vs:xme,fs:wme,modules:[Ls,Tme]})}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:l,weightsTexture:f}=this.props,A={aggregationMode:t,colorDomain:n,intensity:i,threshold:s,colorTexture:o,maxTexture:l,weightsTexture:f};e.shaderInputs.setProps({triangle:A}),e.draw(this.context.renderPass)}}ok.layerName="TriangleLayer";function Eme(r,e){const t={};for(const n in r)e.includes(n)||(t[n]=r[n]);return t}class ak extends Ss{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:Eme(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:l}=t,{ignoreProps:f}=this.state,{props:A,accessors:v=[]}=l,{updateTriggersChanged:T}=s;if(s.dataChanged)return!0;
5113if(T){if(T.all)return!0;for(const I of v)if(T[I])return!0}if(o)return s.extensionsChanged?!0:kx({oldProps:i,newProps:n,ignoreProps:f,propTypes:this.constructor._propTypes});for(const I of A)if(n[I]!==i[I])return!0;return!1}isAttributeChanged(e){const{changedAttributes:t}=this.state;return e?t&&t[e]!==void 0:!Cme(t)}_getAttributeManager(){return new k_(this.context.device,{id:this.props.id,stats:this.context.stats})}}ak.layerName="AggregationLayer";function Cme(r){let e=!0;for(const t in r){e=!1;break}return e}const ER=`#version 300 es 5114in vec3 positions; 5115in vec3 positions64Low; 5116in float weights; 5117out vec4 weightsTexture; 5118void main() 5119{ 5120weightsTexture = vec4(weights * weight.weightsScale, 0., 0., 1.); 5121float radiusTexels = project_pixel_size(weight.radiusPixels) * weight.textureWidth / (weight.commonBounds.z - weight.commonBounds.x); 5122gl_PointSize = radiusTexels * 2.; 5123vec3 commonPosition = project_position(positions, positions64Low); 5124gl_Position.xy = (commonPosition.xy - weight.commonBounds.xy) / (weight.commonBounds.zw - weight.commonBounds.xy) ; 5125gl_Position.xy = (gl_Position.xy * 2.) - (1.); 5126gl_Position.w = 1.0; 5127} 5128`,CR=`#version 300 es 5129in vec4 weightsTexture; 5130out vec4 fragColor; 5131float gaussianKDE(float u){ 5132return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666); 5133} 5134void main() 5135{ 5136float dist = length(gl_PointCoord - vec2(0.5, 0.5)); 5137if (dist > 0.5) { 5138discard; 5139} 5140fragColor = weightsTexture * gaussianKDE(2. * dist); 5141DECKGL_FILTER_COLOR(fragColor, geometry); 5142} 5143`,Sme=`#version 300 es 5144uniform sampler2D inTexture; 5145out vec4 outTexture; 5146void main() 5147{ 5148int yIndex = gl_VertexID / int(maxWeight.textureSize); 5149int xIndex = gl_VertexID - (yIndex * int(maxWeight.textureSize)); 5150vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / maxWeight.textureSize; 5151outTexture = texture(inTexture, uv); 5152gl_Position = vec4(0.0, 0.0, 0.0, 1.0); 5153gl_PointSize = 1.0; 5154} 5155`,Ime=`#version 300 es 5156in vec4 outTexture; 5157out vec4 fragColor; 5158void main() { 5159fragColor = outTexture; 5160fragColor.g = outTexture.r / max(1.0, outTexture.a); 5161} 5162`,Bme=`uniform weightUniforms { 5163 vec4 commonBounds; 5164 float radiusPixels; 5165 float textureWidth; 5166 float weightsScale; 5167} weight; 5168`,Pme={name:"weight",vs:Bme,uniformTypes:{commonBounds:"vec4<f32>",radiusPixels:"f32",textureWidth:"f32",weightsScale:"f32"}},Mme={name:"maxWeight",vs:`uniform maxWeightUniforms { 5169 float textureSize; 5170} maxWeight; 5171`,uniformTypes:{textureSize:"f32"}},Rme=2,l1={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},SR=[0,0],Ome={SUM:0,MEAN:1},Dme={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}
5171,colorRange:hy,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}},Fme=["float32-renderable-webgl","texture-blend-float-webgl"],Lme={data:{props:["radiusPixels"]}};class lT extends ak{getShaders(e){let t=[Ls];return e.modules&&(t=[...t,...e.modules]),super.getShaders({...e,modules:t})}initializeState(){super.initializeAggregationLayer(Lme),this.setState({colorDomain:SR}),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:l,intensity:f,threshold:A,aggregation:v}=this.props,T=this.getSubLayerClass("triangle",ok);return new T(this.getSubLayerProps({id:"triangle-layer",updateTriggers:l}),{coordinateSystem:Qr.DEFAULT,data:{attributes:{positions:t,texCoords:n}},vertexCount:4,maxTexture:i,colorTexture:s,aggregationMode:Ome[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:l,colorTexture:f,updateTimer:A}=this.state;t?.destroy(),n?.destroy(),i?.destroy(),s?.destroy(),o?.destroy(),l?.destroy(),f?.destroy(),A&&clearTimeout(A)}_getAttributeManager(){return new k_(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({...l1,width:e,height:e,format:t}),maxWeightsTexture:this.context.device.createTexture({...l1,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=Fme.every(l=>e.features.has(l)),s=i?"rgba32float":"rgba8unorm",o=i?1:1/255;this.setState({textureSize:n,format:s,weightsScale:o}),i||Zr.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 U3(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,Pme]}),this.setState({weightsTransform:t})}_setupResources(){this._createTextures();const{device:e}=this.context,{textureSize:t,weightsTexture:n,maxWeightsTexture:i}=this.state,s=this.getShaders({vs:ER,fs:CR});this._createWeightsTransform(s);const o=this.getShaders({vs:Sme,fs:Ime,modules:[Mme]}),l=new U3(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};l.model.shaderInputs.setProps({maxWeight:f}),this.setState({weightsTexture:n,maxWeightsTexture:i,maxWeightTransform:l,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:ER,fs:CR,...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(l
5171=>l.map(Math.fround)),i=_me(n),s={visibleWorldBounds:i,viewportCorners:n};let o=!1;if(e||!this.state.worldBounds||!yme(this.state.worldBounds,i)){const l=this._worldToCommonBounds(i),f=this._commonToWorldBounds(l);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(wR(i,3));const o=i.map(l=>bme(s.projectPosition(l),n));t.write(wR(o,2))}_updateColorTexture(e){const{colorRange:t}=e.props;let{colorTexture:n}=this.state;const i=tk(t,!1,Uint8Array);n&&n?.width===t.length?n.setTexture2DData({data:i}):(n?.destroy(),n=this.context.device.createTexture({...l1,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:l}=this.state,f=this.state.weightsTransform;this.state.isWeightMapDirty=!1;const A=this._worldToCommonBounds(i,{useLayerCoordinateSystem:!0});if(t&&n==="SUM"){const{viewport:X}=this.context,ue=X.distanceScales.metersPerUnit[2]*(A[2]-A[0])/s;this.state.colorDomain=t.map(K=>K*ue*o)}else this.state.colorDomain=t||SR;const T=this.getAttributeManager().getAttributes(),I=this.getModuleSettings();this._setModelAttributes(f.model,T),f.model.setVertexCount(this.getNumInstances());const F={radiusPixels:e,commonBounds:A,textureWidth:s,weightsScale:o,weightsTexture:l},{viewport:N,devicePixelRatio:U,coordinateSystem:$,coordinateOrigin:V}=I,{modelMatrix:j}=this.props;f.model.shaderInputs.setProps({project:{viewport:N,devicePixelRatio:U,modelMatrix:j,coordinateSystem:$,coordinateOrigin:V},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,l]=e,{viewport:f}=this.context,{textureSize:A}=this.state,{coordinateSystem:v}=this.props,T=n&&(v===Qr.LNGLAT_OFFSETS||v===Qr.METER_OFFSETS),I=T?f.projectPosition(this.props.coordinateOrigin):[0,0],F=A*Rme/f.scale;let N,U;return n&&!T?(N=this.projectPosition([i,s,0]),U=this.projectPosition([o,l,0])):(N=f.projectPosition([i,s,0]),U=f.projectPosition([o,l,0])),vme([N[0]-I[0],N[1]-I[1],U[0]-I[0],U[1]-I[1]],F,F)}_commonToWorldBounds(e){const[t,n,i,s]=e,{viewport:o}=this.context,l=o.unprojectPosition([t,n]),f=o.unprojectPosition([i,s]);return l.slice(0,2).concat(f.slice(0,2))}}lT.layerName="HeatmapLayer";lT.defaultProps=Dme;const kme=Object.freeze(Object.defineProperty({__proto__:null,CPUAggregator:Bp,ContourLayer:oT,GridLayer:aT,HeatmapLayer:lT,HexagonLayer:sT,ScreenGridLayer:nT,WebGLAggregator:Ua,_AggregationLayer:Pp},Symbol.toStringTag,{value:"Module"}));var xA={},c1,IR;function Nme(){if(IR)return c1;IR=1;var r=Math.PI/180,e=180/Math.PI;function t(j){var X=i(j[0]+1,j[2]),ue=i(j[0],j[2]),K=s(j[1]+1,j[2]),se=s(j[1],j[2]);return[ue,K,X,se]}function n(j){var X=t(j),ue={type:"Polygon",coordinates:[[[X[0],X[1]],[X[0],X[3]],[X[2],X[3]],[X[2],X[1]],[X[0],X[1]]]]};return ue}function i(j,X){return j/Math.pow(2,X)*360-180}function s(j,X){var ue=Math.PI-2*Math.PI*j/Math.pow(2,X);return e*Math.atan(.5*(Math.exp(ue)-Math.exp(-ue)))}function o(j,X,ue){var K=V(j,X,ue);return K[0]=Math.floor(K[0]),K[1]=Math.floor(K[1]),K}function l(j){return[[j[0]*2,j[1]*2,j[2]+1],[j[0]*2+1,j[1]*2,j[2]+1],[j[0]*2+1,j[1]*2+1,j[2]+1],[j[0]*2,j[1]*2+1,j[2]+1]]}function f(j){return j[0]%2===0&&j[1]%2===0?[j[0]/2,j[1]/2,j[2]-1]:j[0]%2===0&&!j[1]%2===0?[j[
51710]/2,(j[1]-1)/2,j[2]-1]:!j[0]%2===0&&j[1]%2===0?[(j[0]-1)/2,j[1]/2,j[2]-1]:[(j[0]-1)/2,(j[1]-1)/2,j[2]-1]}function A(j){return l(f(j))}function v(j,X){for(var ue=A(j),K=0;K<ue.length;K++)if(!T(X,ue[K]))return!1;return!0}function T(j,X){for(var ue=0;ue<j.length;ue++)if(I(j[ue],X))return!0;return!1}function I(j,X){return j[0]===X[0]&&j[1]===X[1]&&j[2]===X[2]}function F(j){for(var X="",ue=j[2];ue>0;ue--){var K=0,se=1<<ue-1;(j[0]&se)!==0&&K++,(j[1]&se)!==0&&(K+=2),X+=K.toString()}return X}function N(j){for(var X=0,ue=0,K=j.length,se=K;se>0;se--){var Ee=1<<se-1;switch(j[K-se]){case"0":break;case"1":X|=Ee;break;case"2":ue|=Ee;break;case"3":X|=Ee,ue|=Ee;break}}return[X,ue,K]}function U(j){var X=o(j[0],j[1],32),ue=o(j[2],j[3],32),K=[X[0],X[1],ue[0],ue[1]],se=$(K);if(se===0)return[0,0,0];var Ee=K[0]>>>32-se,Ue=K[1]>>>32-se;return[Ee,Ue,se]}function $(j){for(var X=28,ue=0;ue<X;ue++){var K=1<<32-(ue+1);if((j[0]&K)!=(j[2]&K)||(j[1]&K)!=(j[3]&K))return ue}return X}function V(j,X,ue){var K=Math.sin(X*r),se=Math.pow(2,ue),Ee=se*(j/360+.5),Ue=se*(.5-.25*Math.log((1+K)/(1-K))/Math.PI);return[Ee,Ue,ue]}return c1={tileToGeoJSON:n,tileToBBOX:t,getChildren:l,getParent:f,getSiblings:A,hasTile:T,hasSiblings:v,tilesEqual:I,tileToQuadkey:F,quadkeyToTile:N,pointToTile:o,bboxToTile:U,pointToTileFraction:V},c1}var BR;function Ume(){if(BR)return xA;BR=1;var r=Nme();xA.geojson=function(v,T){return{type:"FeatureCollection",features:t(v,T).map(e)}};function e(v){return{type:"Feature",geometry:r.tileToGeoJSON(v),properties:{}}}xA.tiles=t,xA.indexes=function(v,T){return t(v,T).map(r.tileToQuadkey)};function t(v,T){var I,F,N=v.coordinates,U=T.max_zoom,$={},V=[];if(v.type==="Point")return[r.pointToTile(N[0],N[1],U)];if(v.type==="MultiPoint")for(I=0;I<N.length;I++)F=r.pointToTile(N[I][0],N[I][1],U),$[f(F[0],F[1],F[2])]=!0;else if(v.type==="LineString")o($,N,U);else if(v.type==="MultiLineString")for(I=0;I<N.length;I++)o($,N[I],U);else if(v.type==="Polygon")i($,V,N,U);else if(v.type==="MultiPolygon")for(I=0;I<N.length;I++)i($,V,N[I],U);else throw new Error("Geometry type not implemented");if(T.min_zoom!==U){var j=V.length;for(l($,V),I=0;I<j;I++){var X=V[I];$[f(X[0],X[1],X[2])]=!0}return n($,V,T)}return l($,V),V}function n(v,T,I){for(var F=[],N=I.max_zoom;N>I.min_zoom;N--){for(var U={},$=[],V=0;V<T.length;V++){var j=T[V];if(j[0]%2===0&&j[1]%2===0){var X=f(j[0]+1,j[1],N),ue=f(j[0],j[1]+1,N),K=f(j[0]+1,j[1]+1,N);if(v[X]&&v[ue]&&v[K]){v[f(j[0],j[1],j[2])]=!1,v[X]=!1,v[ue]=!1,v[K]=!1;var se=[j[0]/2,j[1]/2,N-1];N-1===I.min_zoom?F.push(se):(U[f(j[0]/2,j[1]/2,N-1)]=!0,$.push(se))}}}for(V=0;V<T.length;V++)j=T[V],v[f(j[0],j[1],j[2])]&&F.push(j);v=U,T=$}return F}function i(v,T,I,F){for(var N=[],U=0;U<I.length;U++){var $=[];o(v,I[U],F,$);for(var V=0,j=$.length,X=j-1;V<j;X=V++){var ue=(V+1)%j,K=$[V][1];(K>$[X][1]||K>$[ue][1])&&(K<$[X][1]||K<$[ue][1])&&K!==$[ue][1]&&N.push($[V])}}for(N.sort(s),U=0;U<N.length;U+=2){K=N[U][1];for(var se=N[U][0]+1;se<N[U+1][0];se++){var Ee=f(se,K,F);v[Ee]||T.push([se,K,F])}}}function s(v,T){return v[1]-T[1]||v[0]-T[0]}function o(v,T,I,F){for(var N,U,$=0;$<T.length-1;$++){var V=r.pointToTileFraction(T[$][0],T[$][1],I),j=r.pointToTileFraction(T[$+1][0],T[$+1][1],I),X=V[0],ue=V[1],K=j[0],se=j[1],Ee=K-X,Ue=se-ue;if(!(Ue===0&&Ee===0)){var de=Ee>0?1:-1,me=Ue>0?1:-1,pe=Math.floor(X),W=Math.floor(ue),re=Ee===0?1/0:Math.abs(((Ee>0?1:0)+pe-X)/Ee),Ce=Ue===0?1/0:Math.abs(((Ue>0?1:0)+W-ue)/Ue),et=Math.abs(de/Ee),_e=Math.abs(me/Ue);for((pe!==N||W!==U)&&(v[f(pe,W,I)]=!0,F&&W!==U&&F.push([pe,W]),N=pe,U=W);re<1||Ce<1;)re<Ce?(re+=et,pe+=de):(Ce+=_e,W+=me),v[f(pe,W,I)]=!0,F&&W!==U&&F.push([pe,W]),N=pe,U=W}}F&&W===F[0][1]&&F.pop()}function l(v,T){for(var I=Object.keys(v),F=0;F<I.length;F++)T.push(A(+I[F]))}function f(v,T,I){var F=2*(1<<I);return(F*T+v)*32+I}function A(v){var T=v%32,I=2*(1<<T),F=(v-T)/32,N=F%I,U=(F-N)/I%I;return[N,U,T]}return xA}Ume();const lk=[0x5555555555555555n,0x3333333333333333n,0x0f0f0f0f0f0f0f0fn,0x00ff00ff00ff00ffn,0x0000ffff0000ffffn,0x00000000ffffffffn],ck=[0n,1n,2n,4n,8n,16n];function zme(r){return BigInt(`0x${r}`)}function L2(r){return r.toString(16)}function Vme(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=ck[5-s],l=lk[4-s];t=(t|t<<o)&l,n=(n|n<<o)&l}return 0x4000000000000000n|1n<<59n|e<<52n|(t|n<<1n)>>12n|0xfffffffffffffn>>e*2n}function uk(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 l=0;l<6;l++){const f=ck[l],A=lk[l];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 cT(r){return r>>52n&0x1fn}function fk(r){const e=cT(r)-1n;return r&~(0x1fn<<52n)|e<<52n|0xfffffffffffffn>>e*2n}function lh(r,e){Zr.assert(r,e)}function Gme(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 Ay(r,e){return`https://unpkg.com/@deck.gl/carto@${e}/dist/${r}-worker.js`}const JA=new Uint16Array,u1={positions:{value:new Float32Array,size:2},properties:[],numericProps:{},featureIds:{value:JA,size:1},globalFeatureIds:{value:JA,size:1}};function hk(){return{shape:"binary-feature-collection",points:{type:"Point",...u1},lines:{type:"LineString",pathIndices:{value:JA,size:1},...u1},polygons:{type:"Polygon",polygonIndices:{value:JA,size:1},primitivePolygonIndices:{value:JA,size:1},...u1}}}function uT(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 dk(r,e){const t={};return e&&Object.keys(e).forEach(n=>{t[n]={value:new Float32Array(r),size:1}}),t}function pk(r,e,t,n){Object.keys(r).forEach(i=>
5171{e[i].value[n]=r[i].value[t]})}function jme(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 l={};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=fk(A);const T=Number(A);if(!(T in l)){l[T]={id:A,count:0,position:[0,0]};for(const{name:U,aggregation:$}of n)$==="any"?l[T][U]=f.properties[U]:l[T][U]=0}const I=l[T].count;l[T].count+=typeof s=="function"?s(f,{}):s;const F=l[T].count,N=F-I;l[T].position[0]=(I*l[T].position[0]+N*v[0])/F,l[T].position[1]=(I*l[T].position[1]+N*v[1])/F;for(const{name:U,aggregation:$}of n){const V=l[T][U],j=f.properties[U];$==="average"?l[T][U]=(I*V+N*j)/F:$==="count"||$==="sum"?l[T][U]=V+j:$==="max"?l[T][U]=Math.max(V,j):$==="min"&&(l[T][U]=Math.min(V,j))}}return e.set(t,Object.values(l)),!0}function Hme(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)||(Zr.warn(`No valid aggregation present in ${n} property`)(),i="any"),e.push({name:n,aggregation:i})}return e}function Wme(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 $me(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{...hk(),points:uT(e,t,t,{},r)}}const Mp=512;class fT extends Q_{getTileIndices(e){return super.getTileIndices(e).map(Vme).map(t=>({q:t,i:L2(t)}))}getTileId({q:e,i:t}){return t||L2(e)}getTileMetadata({q:e}){return super.getTileMetadata(uk(e))}getTileZoom({q:e}){return Number(cT(e))}getParentIndex({q:e}){return{q:fk(e)}}}const PR=512;function Ak(r){const{x:e,y:t,z:n}=uk(r),i=PR/(1<<n);return[e*i,PR-t*i,i]}function Xme(r,e){const[t,n,i]=Ak(r);return[[t,n],[t+e*i,n-e*i]]}function gk(r,e=1){const[t,n]=Xme(r,e),[i,s]=uc(t),[o,l]=uc(n);return[o,s,o,l,i,l,i,s,o,s]}const sm=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),MR=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);MR&&parseFloat(MR[1]);function qme(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function Jme(...r){return Kme(r)}function Kme(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 Zme(r){const e=[];for await(const t of r)e.push(t);return Jme(...e)}function Yme(r){return r&&typeof r=="object"&&r.isBuffer}function om(r){if(Yme(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 am(r){return e=>new Promise((t,n)=>r(e,(i,s)=>i?n(i):t(s)))}class Qme{constructor(e){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(e={}){qme(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 Zme(e)}improveError(e){return e.message.includes(this.name)||(e.message=`${this.name} ${e.message}`),e}}class e_e extends Qme{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(e={}){super(e),this.options=e}async compress(e){if(!sm&&this.options.deflate?.useZlib){const t=this.options.deflate?.gzip?await am(Pu.gzip)(e):await am(Pu.deflate)(e);return om(t)}return this.compressSync(e)}async decompress(e){if(!sm&&this.options.deflate?.useZlib){const t=this.options.deflate?.gzip?await am(Pu.gunzip)(e):await am(Pu.inflate)(e);return om(t)}return this.decompressSync(e)}compressSync(e){if(!sm&&this.options.deflate?.useZlib){const s=this.options.deflate?.gzip?Pu.gzipSync(e):Pu.deflateSync(e);return om(s)}const t=this.options?.deflate||{},n=new Uint8Array(e);return(this.options?.raw?xd.deflateRaw:xd.deflate)(n,t).buffer}decompressSync(e){if(!sm&&this.options.deflate?.useZlib){const s=this.options.deflate?.gzip?Pu.gunzipSync(e):Pu.inflateSync(e);return om(s)}const t=this.options?.deflate||{},n=new Uint8Array(e);return(this.options?.raw?xd.inflateRaw:xd.inflate)(n,t).buffer}async*compressBatches(e){const t=this.options?.deflate||{},n=new xd.Deflate(t);yield*this.transformBatches(n,e)}async*decompressBatches(e){const t=this.options?.deflate||{},n=new xd.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 t_e extends e_e{name="gzip";extensions=["gz","gzip"];contentEncodings=["gzip","x-gzip"];isSupported=!0;constructor(e){super({...e,deflate:{...e?.gzip,gzip:!0}})}}function gy(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 l=new t_e().decompressSync(s);t.value=new r(l)}else t.value=new r(s);return e.pos=i,t.value}class hT{static read(e,t){return e.readFields(hT._readField,{key:"",value:null},t)}static _readField(e,t,n){e===1?t.key=n.readString():e===2&&(t.value=n.readString())}}class vh{static read(e,t){return e.readFields(vh._readField,{},t)}static _readField(e,t,n){if(e===1){const{key:i,value:s}=hT.read(n,n.readVarint()+n.pos);t[i]=s}}}class Pg{static read(e,t){const{value:n,size:i}=e.readFields(Pg._readField,{value:[],size:0},t);return{value:n,size:i}}static _readField(e,t,n){e===1?gy(Float64Array,n,t):e===2&&(t.size=n.readVarint(!0))}}class Fa{static read(e,t){const{value:n,size:i}=e.readFields(Fa._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 Mg{static read(e,t){return e.readFields(Mg._readField,{id:0},t)}static _readField(e,t,n){e===1&&(t.id=n.readVarint())}}class dT{static read(e,t){return e.readFields(dT._readField,{value:[]},t)}static _readField(e,t,n){e===1&&gy(Float64Array,n,t)}}class bh{static read(e,t){return e.readFields(bh._readField,{key:"",value:null},t)}static _readField(e,t,n){e===1?t.key=n.readString():e===2&&(t.value=dT.read(n,n.readVarint()+n.pos))}}class pT{static read(e,t){return e.readFields(pT._readField,{positions:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},t)}static _readField(e,t,n){if(e===1)t.positions=Pg.read(n,n.readVarint()+n.pos);else if(e===2)t.globalFeatureIds=Fa.read(n,n.readVarint()+n.pos);else if(e===3)t.featureIds=Fa.read(n,n.readVarint()+n.pos);else if(e===4)t.properties.push(vh.read(n,n.readVarint()+n.pos));else if(e===5){const i=bh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}else e===6&&t.fields.push(Mg.read(n,n.readVarint()+n.pos))}}class AT{static read(e,t){return e.readFields(AT._readField,{positions:null,pathIndices:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},t)}static _readField(e,t,n){if(e===1)t.positions=Pg.read(n,n.readVarint()+n.pos);else if(e===2)t.pathIndices=Fa.read(n,n.readVarint()+n.pos);else if(e===3)t.globalFeatureIds=Fa.read(n,n.readVarint()+n.pos);else if(e===4)t.featureIds=Fa.read(n,n.readVarint()+n.pos);else if(e===5)t.properties.push(vh.read(n,n.readVarint()+n.pos));else if(e===6){const i=bh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}else e===7&&t.fields.push(Mg.read(n,n.readVarint()+n.pos))}}class gT{static read(e,t){return e.readFields(gT._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=Pg.read(n,n.readVarint()+n.pos);else if(e===2)t.polygonIndices=Fa.read(n,n.readVarint()+n.pos);else if(e===3)t.globalFeatureIds=Fa.read(n,n.readVarint()+n.pos);else if(e===4)t.featureIds=Fa.read(n,n.readVarint()+n.pos);else if(e===5)t.primitivePolygonIndices=Fa.read(n,n.readVarint()+n.pos);else if(e===6)t.triangles=Fa.read(n,n.readVarint()+n.pos);else if(e===7)t.properties.push(vh.read(n,n.readVarint()+n.pos));else if(e===8){const i=bh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}else e===9&&t.fields.push(Mg.read(n,n.readVarint()+n.pos))}}let r_e=class mk{static read(e,t){return e.readFields(mk._readField,{points:null,lines:null,polygons:null},t)}static _readField(e,t,n){e===1?t.points=pT.read(n,n.readVarint()+n.pos):e===2?t.lines=AT.read(n,n.readVarint()+n.pos):e===3&&(t.polygons=gT.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&&gy(BigUint64Array,n,t)}}class _T{static read(e,t){return e.readFields(_T._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(vh.read(n,n.readVarint()+n.pos));else if(e===3){const i=bh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}}}let n_e=class _k{static read(e,t){return e.readFields(_k._readField,{scheme:0,cells:null},t)}static _readField(e,t,n){e===1?t.scheme=n.readVarint():e===2&&(t.cells=_T.read(n,n.readVarint()+n.pos))}};function my(r,e){const t=new Wge(r);return e.read(t)}function i_e(r){const{cells:e,scheme:t}=r,n=e.indices.value.length,i=[];for(let s=0;s<n;s++){const o=t==="h3"?L2(e.indices.value[s]):e.indices.value[s],l={...e.properties[s]};for(const f of Object.keys(e.numericProps))l[f]=e.numericProps[f].value[s];i.push({id:o,properties:l})}return i}const yk="9.1.14",vk="cartoSpatialTile",s_e={cartoSpatialTile:{scheme:"quadbin",workerUrl:Ay(vk,yk)}},bk={name:"CARTO Spatial Tile",version:yk,id:vk,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.c
5171arto-spatial-tile"],category:"geometry",parse:async(r,e)=>RR(r,e),parseSync:RR,worker:!0,options:s_e};function RR(r,e){if(!r)return null;const t=my(r,n_e),{cells:n}=t,i=e?.cartoSpatialTile?.scheme;return i_e({cells:n,scheme:i})}function Rp(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]=Rp(r[i],s,t+1):n[i]=s)}return n}function o_e(r,e){const t={};for(const{geoid:n,...i}of e.properties)n in t?Zr.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 l=null;n==="lines"&&(l=i.pathIndices.value),n==="polygons"&&(l=i.polygonIndices.value);const f=s.value.length/s.size;for(const A in e.numericProps){const v=e.numericProps[A].value,T=v.constructor,I=new T(f);if(i.numericProps[A]={value:I,size:1},l)for(let F=0;F<l.length-1;F++){const N=l[F],U=l[F+1],$=o.value[N];I.fill(v[$],N,U)}else for(let F=0;F<f;F++){const N=o.value[F];I[F]=v[N]}}}return r}const ch={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};Tp([bk]);const xk={data:ch,clusterLevel:{type:"number",value:5,min:1},getPosition:{type:"accessor",value:({id:r})=>gk(r,.5).slice(2,4)},getWeight:{type:"accessor",value:1},refinementStrategy:"no-overlap",tileSize:Mp};class yT extends nu{initializeState(){super.initializeState(),this.state.aggregationCache=new WeakMap}renderLayers(){const e=this.state.tileset?.tiles.filter(I=>I.isLoaded&&I.content&&this.state.tileset.isTileVisible(I));if(!e?.length)return null;e.sort((I,F)=>F.zoom-I.zoom);const{zoom:t}=this.context.viewport,{clusterLevel:n,getPosition:i,getWeight:s}=this.props,{aggregationCache:o}=this.state,l=Hme(e[0]),f=[];let A=!1;for(const I of e){const F=Math.round(t-I.zoom),N=Math.round(n)-F;let U=o.get(I.content);U||(U=new Map,o.set(I.content,U));const $=jme(I,U,N,l,i,s);A||(A=$),f.push(...U.get(N))}f.sort((I,F)=>Number(F.count-I.count));const v=f?.map(I=>I.id);if(A||(A=!rs(v,this.state.clusterIds,1)),this.setState({clusterIds:v}),A){const I=Wme(f,l),F=$me(f);F.points.attributes={stats:I},this.setState({data:F})}const T={...this.props,id:"clusters",data:this.state.data,dataComparator:(I,F)=>{const N=I?.points?.properties?.map($=>$.id),U=F?.points?.properties?.map($=>$.id);return rs(N,U,1)}};return new ru(this.getSubLayerProps(T))}getPickingInfo(e){const t=e.info;if(t.index!==-1){const{data:n}=e.sourceLayer.props;t.object=F2(n,{globalFeatureId:t.index})}return t}_updateAutoHighlight(e){for(const t of this.getSubLayers())t.updateAutoHighlight(e)}filterSubLayer(){return!0}}yT.layerName="ClusterGeoJsonLayer";yT.defaultProps=xk;class vT extends Ss{getLoadOptions(){const e=this.props.data;return Rp(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 yT(this.props,{id:`cluster-geojson-layer-${this.props.id}`,data:t,TilesetClass:fT,maxZoom:n,loadOptions:this.getLoadOptions()})]}}vT.layerName="ClusterTileLayer";vT.defaultProps=xk;const OR=85.051128;function wk({west:r,north:e,east:t,south:n},i,s=1){const f=[[e,t],[n,t],[n,r],[e,r]].map(T=>Rw(T[0],T[1],i)).map(T=>Math.max(...Lce(T).map(I=>Nce(I,op.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,OR),east:t+v,south:Math.max(n-A,-OR),west:r-v}}function Tk({west:r,north:e,east:t,south:n},i){const s=Math.abs(t-r);if(s>180){const l=Math.ceil(s/180);let f=[];for(let A=0;A<l;A++){const v=r+A*180,T=Math.min(v+179.9999999,t);f=f.concat(Tk({west:v,north:e,east:T,south:n},i))}return[...new Set(f)]}return Dce([[e,t],[n,t],[n,r],[e,r],[e,t]],i)}function a_e(r){const e=LL(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),l=Math.max(...t);return wk({west:i,south:s,east:o,north:l},A_(r),.12)}const l_e=2;function k2(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-l_e))}class c_e extends Q_{getTileIndices({viewport:e,minZoom:t,maxZoom:n}){if(e.latitude===void 0)return[];const[i,s,o,l]=e.getBounds(),{tileSize:f}=this.opts;let A=k2(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 T=Rw(e.latitude,e.longitude,n);v=Oce(T,1)}else{const T=wk({west:i,north:l,east:o,south:s},A);v=Tk(T,A)}return v.map(T=>({i:T}))}getTileId({i:e}){return e}getTileMetadata({i:e}){return{bbox:a_e(e)}}getTileZoom({i:e}){return A_(e)}getParentIndex(e){const t=A_(e.i);return{i:Rce(e.i,t-1)}}}Tp([bk]);function u_e(r){return r!=null&&r!==""}const f_e={tileSize:Mp};class _y extends nu{_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;
5171return!u_e(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},l=n.getTileZoom(o);for(;!(l<=i);)o=n.getParentIndex(o),l=n.getTileZoom(o);return o[s]===e.index[s]}}_y.layerName="SpatialIndexTileLayer";_y.defaultProps=f_e;const h_e=r=>{const{data:e}=r,{index:t}=r.tile;return!e||!e.length?null:new Ac(r,{getHexagon:n=>n.id,centerHexagon:t,highPrecision:!0})},d_e={data:ch,tileSize:Mp};class bT extends Ss{initializeState(){Ac._checkH3Lib()}getLoadOptions(){const e=this.props.data;return Rp(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,k2({zoom:this.props.minZoom,latitude:0},this.props.tileSize))),this.props.maxZoom&&(i=Math.min(i,k2({zoom:this.props.maxZoom,latitude:0},this.props.tileSize)));const s=this.getSubLayerClass("spatial-index-tile",_y);return new s(this.props,{id:`h3-tile-layer-${this.props.id}`,data:t,TilesetClass:c_e,renderSubLayers:h_e,minZoom:n,maxZoom:i,loadOptions:this.getLoadOptions()})}}bT.layerName="H3TileLayer";bT.defaultProps=d_e;const p_e=`uniform heatmapUniforms { 5172 vec2 colorDomain; 5173 vec2 delta; 5174 float intensity; 5175 float opacity; 5176 float radiusPixels; 5177} heatmap; 5178 5179uniform sampler2D colorTexture; 5180 5181vec3 colorGradient(float value) { 5182 return texture(colorTexture, vec2(value, 0.5)).rgb; 5183} 5184 5185const vec3 SHIFT = vec3(1.0, 256.0, 256.0 * 256.0); 5186const float MAX_VAL = SHIFT.z * 255.0; 5187const float SCALE = MAX_VAL / 8.0; 5188vec4 pack(float value) { 5189 return vec4(mod(vec3(value, floor(value / SHIFT.yz)), 256.0), 255.0) / 255.0; 5190} 5191float unpack(vec3 color) { 5192 return 255.0 * dot(color, SHIFT); 5193} 5194 5195vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) { 5196 bool firstPass = (heatmap.delta.y < 0.5); 5197 float accumulator = 0.0; 5198 5199 // Controls quality of heatmap, larger values increase quality at expense of performance 5200 float SUPPORT = clamp(heatmap.radiusPixels / 2.0, 8.0, 32.0); 5201 5202 // Gaussian normalization parameters 5203 float sigma = SUPPORT / 3.0; 5204 float a = -0.5 / (sigma * sigma); 5205 float w0 = 0.3989422804014327 / sigma; // 1D normalization 5206 for (float t = -SUPPORT; t <= SUPPORT; t++) { 5207 vec2 percent = (t * heatmap.delta - 0.5) / SUPPORT; 5208 vec2 delta = percent * heatmap.radiusPixels / texSize; 5209 vec4 offsetColor = texture(source, texCoord + delta); 5210 5211 // Unpack float 5212 float value = unpack(offsetColor.rgb); 5213 5214 // Gaussian 5215 float weight = w0 * exp(a * t * t); 5216 5217 accumulator += value * weight; 5218 } 5219 5220 if (firstPass) { 5221 return pack(accumulator); 5222 } 5223 5224 // Undo scaling to obtain normalized density 5225 float density = 10.0 * heatmap.intensity * accumulator / SCALE; 5226 5227 // Domain also in normalized density units 5228 vec2 domain = heatmap.colorDomain; 5229 5230 // Apply domain 5231 float f = (density - domain[0]) / (domain[1] - domain[0]); 5232 5233 // sqrt/log scaling?? 5234 // float f = (log(density) - log(domain[0] + 1.0)) / (log(domain[1] + 1.0) - log(domain[0] + 1.0)); 5235 // f = sqrt(f); 5236 5237 // Color map 5238 vec4 color = vec4(0.0); 5239 color.rgb = colorGradient(f); 5240 5241 color.a = smoothstep(0.0, 0.1, f); 5242 color.a = pow(color.a, 1.0 / 2.2); 5243 color.a *= heatmap.opacity; 5244 5245 return color; 5246} 5247`,A_e={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>",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:p_e,passes:[{sampler:!0,uniforms:{delta:[1,0]}},{sampler:!0,uniforms:{delta:[0,1]}}]},g_e={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function N2(r){for(;r.parent&&!r.applyPostProcess;)r=r.parent;return r}class Ek extends Cs{initializeState(){this.id=`draw-callback-${N2(this).props.id}`}_drawLayer(){N2(this).applyPostProcess()}}Ek.layerName="DrawCallbackLayer";function Ck(r){var e;return e=class extends r{draw(n){const{shaderModuleProps:i}=n,{picking:s}=i,o=N2(this);s.isActive||o.enableRTT(n),super.draw(n),s.isActive||o.disableRTT()}},e.layerName=`RTT-${r.layerName}`,e}function Sk(r,e){var t;return t=class extends r{initializeState(i){super.initializeState(i),this._createTextures(),this.internalState.postProcess=new cW(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 Ek]):null}_createTextures(){const{device:i}=this.context;this.internalState.renderBuffers=[0,1].map(s=>
5247i.createFramebuffer({id:`layer-fbo-${s}`,colorAttachments:[i.createTexture(g_e)],depthStencilAttachment:"depth16unorm"}))}_resizeBuffers(i){const{shaderModuleProps:s}=i,{viewport:o}=this.context,{devicePixelRatio:l}=s.project,f=l*o.width,A=l*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 m_e=`vec4 copy_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) { 5248 return color; 5249} 5250`,__e={name:"copy",fs:m_e,getUniforms:()=>({}),passes:[{filter:!0}]},y_e={getQuadbin:{type:"accessor",value:r=>r.quadbin}};class xT extends lf{indexToBounds(){const{data:e,extruded:t,getQuadbin:n}=this.props,i=t?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(s,o)=>gk(n(s,o),i),updateTriggers:{getPolygon:i}}}}xT.layerName="QuadbinLayer";xT.defaultProps=y_e;const v_e=r=>{const{data:e}=r;if(!e||!e.length)return null;const t=typeof e[0].id=="bigint";return new xT(r,{getQuadbin:t?n=>n.id:n=>zme(n.id)})},b_e={data:ch,tileSize:Mp};class yy extends Ss{getLoadOptions(){const e=this.props.data;return Rp(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",_y);return new i(this.props,{id:`quadbin-tile-layer-${this.props.id}`,data:t,TilesetClass:fT,renderSubLayers:v_e,maxZoom:n,loadOptions:this.getLoadOptions()})}}yy.layerName="QuadbinTileLayer";yy.defaultProps=b_e;const x_e=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]],w_e={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function Ik(r){const e=Number(cT(r));return Math.pow(4,e)}function T_e(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 E_e=`uniform densityUniforms { 5251 float factor; 5252} density; 5253`,C_e={name:"density",vs:E_e,uniformTypes:{factor:"f32"}};class Bk extends Ck(of){getShaders(e){const t=super.getShaders(e);return t.inject={"vs:#main-end":` 5254 // Value from getWeight accessor 5255 float weight = elevations; 5256 5257 // Keep "power" delivered to screen constant when tiles update 5258 // by outputting normalized density 5259 weight *= density.factor; 5260 5261 // Pack float into 3 channels to pass to heatmap shader 5262 // SCALE value important, as we don't want to saturate 5263 // but also want enough definition to avoid banding 5264 const vec3 SHIFT = vec3(1.0, 256.0, 256.0 * 256.0); 5265 const float MAX_VAL = SHIFT.z * 255.0; 5266 const float SCALE = MAX_VAL / 8.0; 5267 weight *= SCALE; 5268 weight = clamp(weight, 0.0, MAX_VAL); 5269 vColor = vec4(mod(vec3(weight, floor(weight / SHIFT.yz)), 256.0), 255.0) / 255.0; 5270`},t.modules=[...t.modules,C_e],t}draw(e){const t=this.props.data[0],n=this.props.elevationScale,i={factor:Ik(t.id)/n};for(const s of this.state.models)s.shaderInputs.setProps({density:i});super.draw(e)}}Bk.layerName="RTTSolidPolygonLayer";const S_e=Sk(yy,A_e),I_e={data:ch,getWeight:{type:"accessor",value:1},onMaxDensityChange:{type:"function",optional:!0,value:null},colorDomain:{type:"array",value:[0,1]},colorRange:x_e,intensity:{type:"number",value:1},radiusPixels:{type:"number",min:0,max:100,value:20}};class wT extends Ss{initializeState(){this.state={isLoaded:!1,tiles:new Set,viewportChanged:!1}}
5270shouldUpdateState({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:l,onMaxDensityChange:f,onViewportLoad:A,onTileLoad:v,onTileUnload:T,...I}=this.props,F={...o,cell:{...o?.cell,_subLayerProps:{...o?.cell?._subLayerProps,fill:{...o?.cell?._subLayerProps?.fill,type:Bk}}}};let N=0,U=0;const $=[...this.state.tiles].filter(K=>K.content),V=$.filter(K=>K.isVisible),j=V.length?V:$;for(const K of j){const se=K.content[0],Ee=Ik(se.id);U=Math.max(K.userData.maxWeight*Ee,U),N=Math.max(K.zoom,N)}const X=this.context.viewport.zoom-N;return U=U*Math.pow(2,X),typeof f=="function"&&f(U),new S_e(I,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:l.getWeight},onViewportLoad:K=>{this.setState({isLoaded:!0}),typeof A=="function"&&A(K)},onTileLoad:K=>{let se=-1/0;if(typeof t!="function")se=t;else if(K.content)for(const Ee of K.content)se=Math.max(t(Ee,{}),se);K.userData={maxWeight:se},this.state.tiles.add(K),typeof v=="function"&&v(K)},onTileUnload:K=>{this.state.tiles.delete(K),typeof T=="function"&&T(K)},transitions:{elevationScale:{type:"spring",stiffness:.3,damping:.5}}}))}_updateColorTexture(e){const{colorRange:t}=e.props;let{colorTexture:n}=this.state;const i=T_e(t);n&&n?.width===t.length?n.setTexture2DData({data:i}):(n?.destroy(),n=this.context.device.createTexture({...w_e,data:i,width:t.length,height:1})),this.setState({colorTexture:n})}}wT.layerName="HeatmapTileLayer";wT.defaultProps=I_e;const[DR,FR,LR,kR]=[0,1,2,3];class Pk extends xg{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) { 5271 vec4 _padding = textBackground.padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);`),{...e,vs:t}}}Pk.layerName="EnhancedTextBackgroundLayer";class Mk extends _h{filterSubLayer({layer:e,renderPass:t}){const n=e.id.includes("primary-background");return t==="collision"?n:!n}}Mk.layerName="EnhancedTextLayer";const B_e={..._h.defaultProps,getRadius:{type:"accessor",value:1},radiusScale:{type:"number",min:0,value:1}};class vy extends Ss{calculatePixelOffset(e){const{getTextAnchor:t,getAlignmentBaseline:n,getRadius:i,getSecondaryText:s,radiusScale:o,secondarySizeScale:l,sizeScale:f}=this.props,A=t==="middle"?0:t==="start"?1:-1,v=n==="center"?0:n==="bottom"?1:-1,T=f/4,I=f*(1+1/4),F=.6*(1-v)*f;let N=e?F:0;t==="middle"&&n==="top"&&s&&(N-=F,N-=l,N+=f);const U=1+1/4;return typeof i=="function"?($,V)=>{const j=(V?i($,V):1)*o*U;return[A*(j+T),v*(j+I)+N]}:[A*(i*o*U+T),v*(i*o*U+I)+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[FR]=s:t==="bottom"?o[kR]=s:(o[FR]=.5*s,o[kR]=.5*s),e==="start"?o[DR]=i:e==="end"?o[LR]=i:(o[DR]=.5*i,o[LR]=.5*i),o}renderTextLayer(e,{updateTriggers:t={},...n}){const{data:i,characterSet:s,fontFamily:o,fontSettings:l,fontWeight:f,outlineColor:A,outlineWidth:v,sizeScale:T,radiusScale:I,getAlignmentBaseline:F,getColor:N,getPosition:U,getTextAnchor:$,updateTriggers:V}=this.props;if(T<2){const j=this.parent?.props?.textSizeScale?"textSizeScale":"sizeScale";Zr.warn(`${j} has small value (${T}). Note getTextSize is not supported on PointLabelLayer`)()}return new Mk(this.getSubLayerProps({id:e,data:i,characterSet:s,fontFamily:o,fontSettings:l,fontWeight:f,outlineColor:A,outlineWidth:v,sizeScale:T,getAlignmentBaseline:F,getColor:N,getPosition:U,getTextAnchor:$,updateTriggers:{...V,...t,getPixelOffset:[V.getRadius,V.getTextAnchor,V.getAlignmentBaseline,I,T]}}),{getSize:1,_subLayerProps:{background:{type:Pk}}},n)}renderLayers(){const{getText:e,getSecondaryColor:t,getSecondaryText:n,secondaryOutlineColor:i,secondarySizeScale:s,updateTriggers:o}=this.props,l=this.calculatePixelOffset(!1),f=this.calculateBackgroun
5271dPadding();return[this.renderTextLayer(`${o.getText}-primary`,{backgroundPadding:f,getText:e,getPixelOffset:l,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}})]}}vy.layerName="PointLabelLayer";vy.defaultProps=B_e;const P_e=`#version 300 es 5272#define SHADER_NAME raster-layer-vertex-shader 5273in vec3 positions; 5274in vec3 normals; 5275in float instanceElevations; 5276in vec4 instanceFillColors; 5277in vec4 instanceLineColors; 5278in vec3 instancePickingColors; 5279out vec4 vColor; 5280#ifdef FLAT_SHADING 5281out vec4 position_commonspace; 5282#endif 5283void main(void) { 5284vec2 tileOrigin = column.offset.xy; 5285float scale = column.widthScale; 5286int yIndex = - (gl_InstanceID / BLOCK_WIDTH); 5287int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH); 5288vec2 cellCenter = scale * vec2(float(xIndex) + 0.5, float(yIndex) - 0.5); 5289vec4 color = column.isStroke ? instanceLineColors : instanceFillColors; 5290float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0); 5291float cellWidth = column.coverage * scale; 5292geometry.position = vec4(tileOrigin, 0.0, 1.0); 5293if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 5294geometry.position.xyz -= project.commonOrigin; 5295} 5296geometry.position.xy += cellCenter; 5297float elevation = 0.0; 5298float strokeOffsetRatio = 1.0; 5299if (column.extruded) { 5300elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale; 5301} else if (column.stroked) { 5302float halfOffset = project_pixel_size(column.widthScale) / cellWidth; 5303if (column.isStroke) { 5304strokeOffsetRatio -= sign(positions.z) * halfOffset; 5305} else { 5306strokeOffsetRatio -= halfOffset; 5307} 5308} 5309geometry.pickingColor = instancePickingColors; 5310vec2 base = positions.xy * scale * strokeOffsetRatio * column.coverage * shouldRender; 5311vec3 cell = vec3(base, project_size(elevation)); 5312DECKGL_FILTER_SIZE(cell, geometry); 5313geometry.position.xyz += cell; 5314gl_Position = project_common_position_to_clipspace(geometry.position); 5315geometry.normal = project_normal(normals); 5316DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 5317if (column.extruded && !column.isStroke) { 5318#ifdef FLAT_SHADING 5319position_commonspace = geometry.position; 5320vColor = vec4(color.rgb, color.a * layer.opacity); 5321#else 5322vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 5323vColor = vec4(lightColor, color.a * layer.opacity); 5324#endif 5325} else { 5326vColor = vec4(color.rgb, color.a * layer.opacity); 5327} 5328DECKGL_FILTER_COLOR(vColor, geometry); 5329} 5330`,M_e={...pc.defaultProps,extruded:!1,diskResolution:4,vertices:[[-.5,-.5],[.5,-.5],[.5,.5],[-.5,.5]]};class Rk extends Ck(pc){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:P_e}}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]}})}}Rk.layerName="RasterColumnLayer";function R_e(r,e){return r.data===e.data&&r.length===e.length}class TT extends Ss{renderLayers(){const{data:e,getElevation:t,getFillColor:n,getLineColor:i,getLineWidth:s,tileIndex:o,updateTriggers:l}=this.props;if(!e||!o)return null;const f=e.blockSize??0,[A,v,T]=Ak(o),I=[A,v],F=T/f,N=this.getSubLayerClass("column",Rk),{highlightedObjectIndex:U,highlightColor:$}=this.state;return new N(this.props,this.getSubLayerProps({id:"cell",updateTriggers:l,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(i),getLineWidth:this.getSubLayerAccessor(s)}),{data:{data:e,length:f*f},dataComparator:R_e,offset:I,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,l=Gme(o.cells,s);return e({properties:l},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})}}}TT.layerName="RasterLayer";TT.defaultProps=M_e;const O_e={uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:BigUint64Array,int8:
5330Int8Array,int16:Int16Array,int32:Int32Array,int64:BigInt64Array,float32:Float32Array,float64:Float64Array};class ET{static read(e,t){return e.readFields(ET._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=O_e[t.type];if(!i)throw Error(`Invalid data type: ${t.type}`);t.data={};const{compression:s}=U2;gy(i,n,t.data,{compression:s})}}}let U2=class Ok{static read(e,t){return e.readFields(Ok._readField,{blockSize:0,bands:[]},t)}static _readField(e,t,n){e===1?t.blockSize=n.readVarint():e===2&&t.bands.push(ET.read(n,n.readVarint()+n.pos))}};const Dk="9.1.14",Fk="cartoRasterTile",D_e={cartoRasterTile:{metadata:null,workerUrl:Ay(Fk,Dk)}},F_e={name:"CARTO Raster Tile",version:Dk,id:Fk,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-raster-tile"],category:"geometry",parse:async(r,e)=>NR(r,e),parseSync:NR,worker:!0,options:D_e};function NR(r,e){const t=e?.cartoRasterTile?.metadata;if(!r||!t)return null;U2.compression=t.compression;const n=my(r,U2),{bands:i,blockSize:s}=n,o={};for(let l=0;l<i.length;l++){const{name:f,data:A}=i[l];o[f]=A}return{blockSize:s,cells:{numericProps:o,properties:[]}}}Tp([F_e]);const L_e=r=>{const e=r.tile?.index?.q;return e?new TT(r,{tileIndex:e}):null},k_e={data:ch,refinementStrategy:"no-overlap",tileSize:Mp};class N_e extends Sk(nu,__e){filterSubLayer(e){const{tile:t}=e.layer.props;return t?super.filterSubLayer(e):!0}}class CT extends Ss{getLoadOptions(){const e=this.props.data;return Rp(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",N_e),l=this.getLoadOptions();return new o(this.props,{id:`raster-tile-layer-${this.props.id}`,data:t,TilesetClass:fT,renderSubLayers:L_e,minZoom:n,maxZoom:i,loadOptions:{...l,cartoRasterTile:{...l?.cartoRasterTile,metadata:s}}})}}CT.layerName="RasterTileLayer";CT.defaultProps=k_e;class ST{static read(e,t){return e.readFields(ST._readField,{properties:[],numericProps:{}},t)}static _readField(e,t,n){if(e===1)t.properties.push(vh.read(n,n.readVarint()+n.pos));else if(e===2){const i=bh.read(n,n.readVarint()+n.pos);t.numericProps[i.key]=i.value}}}const Lk="9.1.14",kk="cartoPropertiesTile",U_e={cartoPropertiesTile:{workerUrl:Ay(kk,Lk)}},z_e={name:"CARTO Properties Tile",version:Lk,id:kk,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-properties-tile"],category:"geometry",worker:!0,parse:async(r,e)=>UR(r),parseSync:UR,options:U_e};function UR(r,e){return r?my(r,ST):null}const Nk="9.1.14",Uk="cartoVectorTile",V_e={cartoVectorTile:{workerUrl:Ay(Uk,Nk)}},G_e={name:"CARTO Vector Tile",version:Nk,id:Uk,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-vector-tile"],category:"geometry",parse:async(r,e)=>zR(r),parseSync:zR,worker:!0,options:V_e};function j_e(r,e,{startPosition:t,endPosition:n,indices:i}){const s=r.positions.size,o=t*s,l=n*s,f=r.positions.value.subarray(o,l),A=i.slice(1).map(T=>T-t),v=YF(f,A,s);for(let T=0,I=v.length;T<I;++T)e.push(t+v[T])}function H_e(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],l=e.value[s+1],f=t.value.indexOf(l),A=t.value.subarray(i,f);i=f,j_e(r,n,{startPosition:o,endPosition:l,indices:A})}r.triangles={value:new Uint32Array(n),size:1}}function zR(r,e){if(!r)return null;const t=my(r,r_e);return t.polygons&&!t.polygons.triangles&&H_e(t.polygons),t}function W_e(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 T=r.pathIndices.value[v],I=r.featureIds.value[T];let F;e===void 0?F=I:t?F=r.numericProps[e].value[T]:r.properties[I]&&e in r.properties[I]?F=r.properties[I][e]:F=void 0;const N=Y_e(r,v);(!n.has(F)||N>n.get(F).length)&&n.set(F,{index:v,length:N})}const i=[],s=[],o=[],l=[],f=dk(n.size,r.numericProps);let A=0;for(const[v,{index:T}]of n){const I=Q_e(r,T);i.push(...I);const F=r.pathIndices.value[T],N=r.featureIds.value[F];o.push(A),s.push(r.properties[N]),l.push(r.globalFeatureIds.value[F]),pk(r.numericProps,f,F,A),A++}return uT(i,o,l,f,s)}function $_e(r,e,t){const{west:n,south:i,east:s,north:o}=e,f=(s-n)*(o-i)*1e-4,A=[],v=[],T=[],I=[],F=dk(r.polygonIndices.value.length-1,r.numericProps);let N=0,U=0;const{extruded:$}=t;for(let V=0;V<r.polygonIndices.value.length-1;V++){const j=r.polygonIndices.value[V],X=r.polygonIndices.value[V+1];if(X_e(r,V)<f)continue;const ue=K_e(r,V);let K=-1,se=[0,0],Ee=!1;for(;U<r.triangles.value.length;){const de=r.triangles.value[U];if(de>=X)break;if(Ee){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),Ce=r.positions.value.subarray(pe*r.positions.size,pe*r.positions.size+r.positions.size);if(J_e(ue,W,re,Ce))Ee=!0;else{const et=zk(W,re,Ce);et>K&&(K=et,se=[(W[0]+re[0]+Ce[0])/3,(W[1]+re[1]+Ce[1])/3])}U+=3}const Ue=Ee?ue:se;if(q_e(Ue,e)){A.push(...Ue);const de=r.featureIds.value[j];if($){const me=t.getElevation(void 0,{data:r,index:de});A.push(me*t.elevationScale)}v.push(r.properties[de]),T.push(N),I.push(r.globalFeatureIds.value[j]),pk(r.numericProps,F,j,N),N++}}
5330return r.numericProps&&Object.keys(F).forEach(V=>{F[V].value=F[V].value.slice(0,N)}),uT(A,T,I,F,v,$?3:2)}function X_e(r,e){const{positions:{value:t,size:n},polygonIndices:{value:i},triangles:{value:s}}=r,o=i[e],l=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>=l)break;const T=s[A+1],I=s[A+2],F=t.subarray(v*n,v*n+n),N=t.subarray(T*n,T*n+n),U=t.subarray(I*n,I*n+n);f+=zk(F,N,U),A+=3}return f}function q_e([r,e],{west:t,east:n,south:i,north:s}){return r>=t&&r<n&&e>=i&&e<s}function J_e(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,l=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+l))<1e-10}function zk([r,e],[t,n],[i,s]){return Math.abs((r*(n-s)+t*(s-e)+i*(e-n))/2)}function K_e(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,l=1/0,f=-1/0,A=-1/0;for(let v=i;v<s;v+=n){const[T,I]=t.subarray(v,v+2);o=Math.min(o,T),l=Math.min(l,I),f=Math.max(f,T),A=Math.max(A,I)}return[(o+f)/2,(l+A)/2]}function Z_e(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 Y_e(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+=Z_e(r,o);return s}function Q_e(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,T]=t.subarray(i,i+4);return[(f+v)/2,(A+T)/2]}const l=i+Math.floor(o/2)*2;return[t[l],t[l+1]]}Tp([z_e,G_e]);const eye={...Ip.defaultProps,autoLabels:!1,data:ch,dataComparator:ch.equal,tileSize:Mp};class IT extends Ip{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 Rp(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=oh(n,e);if(!s)return Promise.reject("Invalid URL");const o=this.getLoadOptions(),{fetch:l}=this.props,{signal:f}=e,A=l(s,{propName:"data",layer:this,loadOptions:o,signal:f});if(!i)return await A;const v=oh(i,e);if(!v)return Promise.reject("Invalid properties URL");const T=l(v,{propName:"data",layer:this,loadOptions:o,signal:f}),[I,F]=await Promise.all([A,T]);return I?F?o_e(I,F):I:null}renderSubLayers(e){if(e.data===null)return null;const t=e.tile.bbox,n=[],i={"points-text":{type:vy,...e?._subLayerProps?.["points-text"],extensions:[new Qw,...e.extensions||[],...e?._subLayerProps?.["points-text"]?.extensions||[]]}};if(this.state.mvt)n.push(super.renderSubLayers(e));else{const{west:s,south:o,east:l,north:f}=t,A=[new uy,...e.extensions||[]],v={clipBounds:[s,o,l,f]},T=F=>({[F]:{...v,...e?._subLayerProps?.[F],extensions:[...A,...e?._subLayerProps?.[F]?.extensions||[]]}}),I={...e,data:{...e.data,tileBbox:t},autoHighlight:!1,_subLayerProps:{...e._subLayerProps,...i,...T("polygons-fill"),...T("polygons-stroke"),...T("linestrings")}};n.push(new ru(I))}if(n[0]&&e.autoLabels){const s=hk();e.data.lines&&e.data.lines.positions.value.length>0&&(s.points=W_e(e.data.lines,typeof e.autoLabels=="object"?e.autoLabels.uniqueIdProperty:void 0)),e.data.polygons&&e.data.polygons.positions.value.length>0&&(s.points=$_e(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}}IT.layerName="VectorTileLayer";IT.defaultProps=eye;var Mn
vendor: 1,823 bytes, line 5330
5330={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 5330
5330,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"]}},
5330tye={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"]},rye={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"]},nye={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"]},iye={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"]},sye={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"]},oye={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"]},aye={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"]},lye={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"]},cye={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"]},uye={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"]},fye={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"]},hye={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"]},dye={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"]},pye={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"]},Aye={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"]},gye={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"]},mye={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"]},_ye={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"]},yye={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"]},vye={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"]},bye={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"]},xye={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"]},wye={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"]},Tye={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"]},Eye={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"]}
5330,Cye={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"]},Sye={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"]},Iye={2:["#A16928","#2887a1"],3:["#A16928","#edeac2","#2887a1"],4:["#A16928","#d6bd8d","#b5c8b8","#2887a1"],5:["#A16928","#caa873","#edeac2","#98b7b2","#2887a1"],6:["#A16928","#c29b64","#e0cfa2","#cbd5bc","#85adaf","#2887a1"],7:["#A16928","#bd925a","#d6bd8d","#edeac2","#b5c8b8","#79a7ac","#2887a1"],tags:["diverging"]},Bye={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"]},Pye={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"]},Mye={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"]},Rye={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"]},Oye={2:["#88CCEE","#CC6677","#888888"],3:["#88CCEE","#CC6677","#DDCC77","#888888"],4
5330:["#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"]},Dye={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"]},Fye={...Mn.BuGn,tags:["quantitative"]},Lye={...Mn.BuPu,tags:["quantitative"]},kye={...Mn.GnBu,tags:["quantitative"]},Nye={...Mn.OrRd,tags:["quantitative"]},Uye={...Mn.PuBu,tags:["quantitative"]},zye={...Mn.PuBuGn,tags:["quantitative"]},Vye={...Mn.PuRd,tags:["quantitative"]},Gye={...Mn.RdPu,tags:["quantitative"]},jye={...Mn.YlGn,tags:["quantitative"]},Hye={...Mn.YlGnBu,tags:["quantitative"]},Wye={...Mn.YlOrBr,tags:["quantitative"]},$ye={...Mn.YlOrRd,tags:["quantitative"]},Xye={...Mn.Accent,tags:["qualitative"]},qye={...Mn.Dark2,tags:["qualitative"]},Jye={...Mn.Paired,tags:["qualitative"]},Kye={...Mn.Pastel1,tags:["qualitative"]},Zye={...Mn.Pastel2,tags:["qualitative"]},Yye={...Mn.Set1,tags:["qualitative"]},Qye={...Mn.Set2,tags:["qualitative"]},eve={...Mn.Set3,tags:["qualitative"]},tve={...Mn.Blues,tags:["quantitative"]},rve={...Mn.Greens,tags:["quantitative"]},nve={...Mn.Greys,tags:["quantitative"]},ive={...Mn.Oranges,tags:["quantitative"]},sve={...Mn.Purples,tags:["quantitative"]},ove={...Mn.Reds,tags:["quantitative"]},ave={...Mn.BrBG,tags:["diverging"]},lve={...Mn.PiYG,tags:["diverging"]},cve={...Mn.PRGn,tags:["diverging"]},uve={...Mn.PuOr,tags:["diverging"]},fve={...Mn.RdBu,tags:["diverging"]},hve={...Mn.RdGy,tags:["diverging"]},dve={...Mn.RdYlBu,tags:["diverging"]},pve={...Mn.RdYlGn,tags:["diverging"]},Ave={...Mn.Spectral,tags:["diverging"]};const gve=Object.freeze(Object.defineProperty({__proto__:null,Antique:Bye,ArmyRose:xye,BluGrn:lye,BluYl:hye,Bold:Pye,BrwnYl:bye,Burg:tye,BurgYl:rye,DarkMint:cye,Earth:Iye,Emrld:uye,Fall:wye,Geyser:Tye,Magenta:_ye,Mint:aye,OrYel:iye,Pastel:Mye,Peach:sye,PinkYl:oye,Prism:Rye,Purp:Aye,PurpOr:gye,RedOr:nye,Safe:Oye,Sunset:mye,SunsetDark:yye,Teal:dye,TealGrn:pye,TealRose:Cye,Temps:Eye,Tropic:Sye,Vivid:Dye,ag_GrnYl:fye,ag_Sunset:vye,cb_Accent:Xye,cb_Blues:tve,cb_BrBG:ave,cb_BuGn:Fye,cb_BuPu:Lye,cb_Dark2:qye,cb_GnBu:kye,cb_Greens:rve,cb_Greys:nve,cb_OrRd:Nye,cb_Oranges:ive,cb_PRGn:cve,cb_Paired:Jye,cb_Pastel1:Kye,cb_Pastel2:Zye,cb_PiYG:lve,cb_PuBu:Uye,cb_PuBuGn:zye,cb_PuOr:uve,cb_PuRd:Vye,cb_Purples:sve,cb_RdBu:fve,cb_RdGy:hve,cb_RdPu:Gye,cb_RdYlBu:dve,cb_RdYlGn:pve,cb_Reds:ove,cb_Set1:Yye,cb_Set2:Qye,cb_Set3:eve,cb_Spectral:Ave,cb_YlGn:jye,cb_YlGnBu:Hye,cb_YlOrBr:Wye,cb_YlOrRd:$ye},Symbol.toStringTag,{value:"Module"})),BT="PurpOr",PT=[204,204,204],mve=[119,119,119];function MT(r,e){const t=gve[r];let n=e;lh(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 l=t[n];return t.tags&&t.tags.includes("qualitative")&&(l=l.slice(0,-1)),l.map(f=>_ve(f))}function _ve(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),lh(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 yve=Object.freeze(["function","string"]);function RT(r,e,t){return lh(typeof e=="object",'Expected "data" to be an object'),lh(yve.includes(typeof r),'Expected "attr" to be a function or string'),typeof r=="function"?r(e,t):e?.properties?.[r]}function vve({attr:r,domain:e,colors:t=BT,nullColor:n=PT}){lh(Array.isArray(e),'Expected "domain" to be an array of numbers');const i=typeof t=="string"?MT(t,e.length+1):t,s=FN().domain(e).range(i);return(o,l)=>{const f=RT(r,o,l);return typeof f=="number"&&Number.isFinite(f)?s(f):n}}function bve({attr:r,domain:e,colors:t=BT,nullColor:n=PT,othersColor:i=mve}){lh(Array.isArray(e),'Expected "domain" to be an array of numbers or strings');const s={},o=typeof t=="string"?MT(t,e.length):t;for(const[l,f]of e.entries())s[f]=o[l];return(l,f)=>{const A=RT(r,l,f);return typeof A=="number"&&Number.isFinite(A)||typeof A=="string"?s[A]||i:n}}function xve({attr:r,domain:e,colors:t=BT,nullColor:n=PT}){lh(Array.isArray(e),'Expected "domain" to be an array of numbers');const i=typeof t=="string"?MT(t,e.length):t,s=LN().domain(e).range(i);return(o,l)=>{const f=RT(r,o,l);return typeof f=="number"&&Number.isFinite(f)?s(f):n}}const wve={ClusterTileLayer:vT,H3TileLayer:bT,HeatmapTileLayer:wT,PointLabelLayer:vy,QuadbinTileLayer:yy,RasterTileLayer:CT,VectorTileLayer:IT};function z2(r,e=""){if(!r)throw new Error(`JSON conversion error ${e}`)}function Tve(r,e){const t=Cve(e);let n=r;for(const i of t)n=Eve(n)?n[i]:void 0;return n}function Eve(r){return r!==null&&typeof r=="object"}const VR={};function Cve(r){if(typeof r=="string"){let e=VR[r];return e||(e=r.split("."),VR[r]=e),e}return Array.isArray(r)?r:[r]}var lm={exports:{}},GR;function Sve(){return GR||(GR=1,(function(r,e){(function(t){var n="Compound",i="Identifier",s="MemberExpression",o="Literal",l="ThisExpression",f="CallExpression",A="UnaryExpression",v="BinaryExpression",T="LogicalExpression",I="ConditionalExpression",F="ArrayExpression",N=46,U=44,$=39,V=34,j=40,X=41,ue=91,K=93,se=63,Ee=59,Ue=58,de=function(It,st){var dr=new Error(It+" at character "+st);throw dr.index=st,dr.description=It,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(It){var st=0,dr;for(var er in It)(dr=er.length)>st&&It.hasOwnProperty(er)&&(st=dr);return st},Ce=re(pe),et=re(W),_e={true:!0,false:!1,null:null}
5330,Le="this",Ve=function(It){return W[It]||0},Ye=function(It,st,dr){var er=It==="||"||It==="&&"?T:v;return{type:er,operator:It,left:st,right:dr}},tt=function(It){return It>=48&&It<=57},rt=function(It){return It===36||It===95||It>=65&&It<=90||It>=97&&It<=122||It>=128&&!W[String.fromCharCode(It)]},ut=function(It){return It===36||It===95||It>=65&&It<=90||It>=97&&It<=122||It>=48&&It<=57||It>=128&&!W[String.fromCharCode(It)]},vt=function(It){for(var st=0,dr=It.charAt,er=It.charCodeAt,Jt=function(Gt){return dr.call(It,Gt)},Nt=function(Gt){return er.call(It,Gt)},Ar=It.length,cn=function(){for(var Gt=Nt(st);Gt===32||Gt===9||Gt===10||Gt===13;)Gt=Nt(++st)},Mr=function(){var Gt=jn(),mr,Rr;if(cn(),Nt(st)===se){if(st++,mr=Mr(),mr||de("Expected expression",st),cn(),Nt(st)===Ue)return st++,Rr=Mr(),Rr||de("Expected expression",st),{type:I,test:Gt,consequent:mr,alternate:Rr};de("Expected :",st)}else return Gt},xr=function(){cn();for(var Gt=It.substr(st,et),mr=Gt.length;mr>0;){if(W.hasOwnProperty(Gt)&&(!rt(Nt(st))||st+Gt.length<It.length&&!ut(Nt(st+Gt.length))))return st+=mr,Gt;Gt=Gt.substr(0,--mr)}return!1},jn=function(){var Gt,mr,Rr,nn,gi,Pe,kt,Wt,cr;if(Pe=_r(),mr=xr(),!mr)return Pe;for(gi={value:mr,prec:Ve(mr)},kt=_r(),kt||de("Expected expression after "+mr,st),nn=[Pe,gi,kt];(mr=xr())&&(Rr=Ve(mr),Rr!==0);){for(gi={value:mr,prec:Rr},cr=mr;nn.length>2&&Rr<=nn[nn.length-2].prec;)kt=nn.pop(),mr=nn.pop().value,Pe=nn.pop(),Gt=Ye(mr,Pe,kt),nn.push(Gt);Gt=_r(),Gt||de("Expected expression after "+cr,st),nn.push(gi,Gt)}for(Wt=nn.length-1,Gt=nn[Wt];Wt>1;)Gt=Ye(nn[Wt-1].value,nn[Wt-2],Gt),Wt-=2;return Gt},_r=function(){var Gt,mr,Rr;if(cn(),Gt=Nt(st),tt(Gt)||Gt===N)return yr();if(Gt===$||Gt===V)return un();if(Gt===ue)return ri();for(mr=It.substr(st,Ce),Rr=mr.length;Rr>0;){if(pe.hasOwnProperty(mr)&&(!rt(Nt(st))||st+mr.length<It.length&&!ut(Nt(st+mr.length))))return st+=Rr,{type:A,operator:mr,argument:_r(),prefix:!0};mr=mr.substr(0,--Rr)}return rt(Gt)||Gt===j?Yn():!1},yr=function(){for(var Gt="",mr,Rr;tt(Nt(st));)Gt+=Jt(st++);if(Nt(st)===N)for(Gt+=Jt(st++);tt(Nt(st));)Gt+=Jt(st++);if(mr=Jt(st),mr==="e"||mr==="E"){for(Gt+=Jt(st++),mr=Jt(st),(mr==="+"||mr==="-")&&(Gt+=Jt(st++));tt(Nt(st));)Gt+=Jt(st++);tt(Nt(st-1))||de("Expected exponent ("+Gt+Jt(st)+")",st)}return Rr=Nt(st),rt(Rr)?de("Variable names cannot start with a number ("+Gt+Jt(st)+")",st):Rr===N&&de("Unexpected period",st),{type:o,value:parseFloat(Gt),raw:Gt}},un=function(){for(var Gt="",mr=Jt(st++),Rr=!1,nn;st<Ar;)if(nn=Jt(st++),nn===mr){Rr=!0;break}else if(nn==="\\")switch(nn=Jt(st++),nn){case"n":Gt+=` 5331`;break;case"r":Gt+="\r";break;case"t":Gt+=" ";break;case"b":Gt+="\b";break;case"f":Gt+="\f";break;case"v":Gt+="\v";break;default:Gt+=nn}else Gt+=nn;return Rr||de('Unclosed quote after "'+Gt+'"',st),{type:o,value:Gt,raw:mr+Gt+mr}},Dr=function(){var Gt=Nt(st),mr=st,Rr;for(rt(Gt)?st++:de("Unexpected "+Jt(st),st);st<Ar&&(Gt=Nt(st),ut(Gt));)st++;return Rr=It.slice(mr,st),_e.hasOwnProperty(Rr)?{type:o,value:_e[Rr],raw:Rr}:Rr===Le?{type:l}:{type:i,name:Rr}},li=function(Gt){for(var mr,Rr=[],nn,gi=!1,Pe=0;st<Ar;)if(cn(),mr=Nt(st),mr===Gt){gi=!0,st++,Gt===X&&Pe&&Pe>=Rr.length&&de("Unexpected token "+String.fromCharCode(Gt),st);break}else if(mr===U){if(st++,Pe++,Pe!==Rr.length){if(Gt===X)de("Unexpected token ,",st);else if(Gt===K)for(var kt=Rr.length;kt<Pe;kt++)Rr.push(null)}}else nn=Mr(),(!nn||nn.type===n)&&de("Expected comma",st),Rr.push(nn);return gi||de("Expected "+String.fromCharCode(Gt),st),Rr},Yn=function(){var Gt,mr;for(Gt=Nt(st),Gt===j?mr=mn():mr=Dr(),cn(),Gt=Nt(st);Gt===N||Gt===ue||Gt===j;)st++,Gt===N?(cn(),mr={type:s,computed:!1,object:mr,property:Dr()}):Gt===ue?(mr={type:s,computed:!0,object:mr,property:Mr()},cn(),Gt=Nt(st),Gt!==K&&de("Unclosed [",st),st++):Gt===j&&(mr={type:f,arguments:li(X),callee:mr}),cn(),Gt=Nt(st);return mr},mn=function(){st++;var Gt=Mr();if(cn(),Nt(st)===X)return st++,Gt;de("Unclosed (",st)},ri=function(){return st++,{type:F,elements:li(K)}},Hn=[],Sn,Qn;st<Ar;)Sn=Nt(st),Sn===Ee||Sn===U?st++:(Qn=Mr())?Hn.push(Qn):st<Ar&&de('Unexpected "'+Jt(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(It){return Ce=Math.max(It.length,Ce),pe[It]=me,this},vt.addBinaryOp=function(It,st){return et=Math.max(It.length,et),W[It]=st,this},vt.addLiteral=function(It,st){return _e[It]=st,this},vt.removeUnaryOp=function(It){return delete pe[It],It.length===Ce&&(Ce=re(pe)),this},vt.removeAllUnaryOps=function(){return pe={},Ce=0,this},vt.removeBinaryOp=function(It){return delete W[It],It.length===et&&(et=re(W)),this},vt.removeAllBinaryOps=function(){return W={},et=0,this},vt.removeLiteral=function(It){return delete _e[It],this},vt.removeAllLiterals=function(){return _e={},this},r.exports?e=r.exports=vt:e.parse=vt})()})(lm,lm.exports)),lm.exports}var Ive=Sve();const Bve=uh(Ive),jR={"||":(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},Pve={"-":r=>-r,"+":r=>+r,"~":r=>~r,"!":r=>!r};function HR(r,e){return r.map(function(t){return Js(t,e)})}function WR(r,e){const t=Js(r.object,e);let n;if(r.computed?n=Js(r.property,e):n=r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error(`Access to member "${n}" disallowed.`);return[t,t[n]]}function Js(r,e){const t=r;switch(t.type){case"ArrayExpression":return HR(t.elements,e);case"BinaryExpression":return jR[t.operator](Js(t.left,e),Js(t.right,e));case"CallExpression":let n,i,s;return t.callee.type==="MemberExpression"?(s=WR(t.callee,e),n=s[0],i=s[1]):i=Js(t.callee,e),typeof i!="function"?void 0:i.apply(n,HR(t.arguments,e));case"ConditionalExpression":return Js(t.test,e)?Js(t.consequent,e):Js(t.alternate,e);case"Identifier":return e[t.name];case"Literal":return t.value;case"LogicalExpression":return t.operator==="||"?Js(t.left,e)||Js(t.right,e):t.operator==="&&"?Js(t.left,e)&&Js(t.right,e):jR[t.operator](Js(t.left,e),Js(t.right,e));case"MemberExpression":return WR(t,e)[1];case"ThisExpression":return e;case"UnaryExpression":return Pve[t.operator](Js(t.argument,e));default:return}}const f1={"-":r=>r};function Vk(r,e){if(r in f1)return f1[r];let t;const n=Bve(r);return n.type==="Identifier"?t=i=>Tve(i,r):(V2(n,i=>
5331{if(i.type==="CallExpression")throw new Error("Function calls not allowed in JSON expressions")}),t=i=>Js(n,i)),f1[r]=t,t}function V2(r,e){if(Array.isArray(r))r.forEach(t=>V2(t,e));else if(r&&typeof r=="object"){r.type&&e(r);for(const t in r)V2(r[t],e)}}const E_="@@=",$R="@@#",Mve="@@type",Gk="@@function",XR=r=>r&&typeof r=="object";class G2{constructor(...e){this.typeKey=Mve,this.functionKey=Gk,this.log=console,this.classes={},this.reactComponents={},this.enumerations={},this.constants={},this.functions={},this.React=null,this.convertFunction=Vk,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]=XR(this[t])?Object.assign(this[t],n):n}}}validate(e){return z2(!this.typeKey||typeof this.typeKey=="string"),z2(XR(this.classes)),!0}}function Rve(r){return typeof r=="string"&&r.startsWith(E_)}function Ove(r){return r.replace(E_,"")}function jk(r,e){const t={};for(const n in r){let i=r[n];Rve(i)&&(i=Ove(i),i=Vk(i)),t[n]=i}return t}function Dve(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?Fve(n,e,t):Lve(i,e,t)}function Fve(r,e,t){return t.preProcessClassProps&&(e=t.preProcessClassProps(r,e,t)),e=jk(e),new r(e)}function Lve(r,e,t){const{React:n}=t,{children:i=[]}=e;return delete e.children,t.preProcessClassProps&&(e=t.preProcessClassProps(r,e,t)),e=jk(e),n.createElement(r,e,i)}function kve(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 Nve(r){return typeof r=="string"?JSON.parse(r):r}const OT=r=>r&&typeof r=="object";class Uve{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 G2?e.configuration:new G2(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=Nve(e);let n=zve(t,this.configuration);return n=this.configuration.postProcessConvertedJson(n),this.convertedJson=n,n}convertJson(e){return this.convert(e)}}function zve(r,e){return e=new G2(e),DT(r,"",e)}function DT(r,e,t){return Array.isArray(r)?r.map((n,i)=>DT(n,String(i),t)):Vve(r,t)?Gve(r,t):OT(r)?Gk in r?jve(r,t):FT(r,t):typeof r=="string"?Hve(r,e,t):r}function Vve(r,e){const{typeKey:t}=e;return OT(r)&&!!r[t]}function Gve(r,e){const{typeKey:t}=e,n=r[t];let i={...r};return delete i[t],i=FT(i,e),Dve(n,i,e)}function jve(r,e){const{functionKey:t}=e,n=r[t];let i={...r};return delete i[t],i=FT(i,e),kve(n,i,e)}function FT(r,e){z2(OT(r));const t={};for(const n in r){const i=r[n];t[n]=DT(i,n,e)}return t}function Hve(r,e,t){if(r.startsWith(E_)&&t.convertFunction)return r=r.replace(E_,""),t.convertFunction(r,t);if(r.startsWith($R)){if(r=r.replace($R,""),t.constants[r])return t.constants[r];const[n,i]=r.split(".");return t.enumerations[n][i]}return r}const Wve={classes:{...Use,...kme,...f0e,...Eue,...wve},functions:{colorBins:vve,colorCategories:bve,colorContinuous:xve}},Hk=new Uve({configuration:Wve}),$ve={[fy.layerName]:["getFillColor"],[ny.layerName]:["getFillColor"],[Ac.layerName]:["getFillColor"],[Ip.layerName]:["getFillColor"],[Z_.layerName]:["getFillColor"],[K_.layerName]:["getFillColor"],[ey.layerName]:["getColor"],[yg.layerName]:["getTargetColor","getSourceColor"],[pc.layerName]:["getFillColor"],[ru.layerName]:["getFillColor"],[Sp.layerName]:["getColor"],[X_.layerName]:["getColor"],[sf.layerName]:["getColor"],[vg.layerName]:["getColor"],[af.layerName]:["getFillColor"],[bg.layerName]:["getFillColor","getColor","getLineColor"],[of.layerName]:["getFillColor"],[_h.layerName]:["getColor"],[Bg.layerName]:["getColor"],[ah.layerName]:["getColor"]},Xve=({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=Hk.convert({originalColor:n}).originalColor(r);return[i[0]||0,i[1]||0,i[2]||0,i[3]||255]}return null},qR=({isSelected:r,object:e,objectInfo:t,opacity:n,originalFillFunction:i})=>{const s=Xve({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]},qve=({isSelected:r,object:e,objectInfo:t,originalFillFunction:n,selectedColor:i,selectedOpacity:s=255,unselectedColor:o,unselectedOpacity:l=Math.floor(255*.4)})=>r?qR({opacity:s,isSelected:!0,object:e,objectInfo:t,originalFillFunction:n})||i:qR({opacity:l,isSelected:!1,object:e,objectInfo:t,originalFillFunction:n})||o,ug={selection:{indices:{},objects:{}}
5331},JR=(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 Jve(r,e){return e.id?r.getElementState(e.id,"selection")??ug:ug}function Kve(r,e){if(!e.id)return ug;const t=r.getStringValue(e);return(t?d1.parse(t):null)??ug}function Zve(r,e,t,n){r.id&&e.setStringValue(r,JSON.stringify(t.value),{fromUi:t.fromUi},n)}const Yve=r=>{const{height:e,width:t,expanded:n}=QR(e4),{element:i,fragmentId:s,isLightTheme:o,theme:l,widgetMgr:f}=r,{selectionMode:A,tooltip:v,useContainerWidth:T}=i,I=n??!1,[F,N]=DN({element:i,getDefaultState:Jve,getStateFromWidgetMgr:Kve,updateWidgetMgrState:Zve,widgetMgr:f,fragmentId:s}),[U,$]=Bt.useState(null),{height:V,width:j}=Ene({element:i,isFullScreen:I,shouldUseContainerWidth:T,container:{height:e,width:t},heightFallback:U?.initialViewState?.height||l.sizes.defaultMapHeight}),[X,ue]=Bt.useState(null),K=A[0],se=K!==void 0,Ee=se&&Object.keys(F.selection.indices).length>0,Ue=Bt.useMemo(()=>Object.freeze(d1.parse(i.json)),[I,o,i.json]),de=Bt.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 Ce=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}`,Ve=F?.selection?.indices?.[Le]||[],Ye=$ve[_e["@@type"]];if(!Ye)return _e;const tt={..._e};return Ye.forEach(rt=>{tt.updateTriggers={[rt]:[...tt.updateTriggers?.[rt]||[],Ve,Ce]};const ut=!Ce,vt=_e[rt];if(ut||!vt)return tt;const It=255,st=Math.floor(255*.4),dr=rC(l.colors.primary),er=[dr[0],dr[1],dr[2],It],Jt=rC(l.colors.gray20),Nt=[Jt[0],Jt[1],Jt[2],st],Ar=(cn,Mr)=>qve({isSelected:Ve.includes(Mr.index),object:cn,objectInfo:Mr,originalFillFunction:vt,selectedColor:er,unselectedColor:Nt,selectedOpacity:It,unselectedOpacity:st});tt[rt]=Ar}),tt})}return delete W?.views,Hk.convert(W)},[F.selection.indices,o,se,Ue,l.colors.gray20,l.colors.primary]);Bt.useEffect(()=>{if(!EN(de.initialViewState,X)){const W=Object.keys(de.initialViewState).reduce((re,Ce)=>de.initialViewState[Ce]===X?.[Ce]?re:{...re,[Ce]:de.initialViewState[Ce]},{});$(re=>({...re,...W})),ue(de.initialViewState)}},[de.initialViewState,X,U]);const me=Bt.useCallback(W=>{if(!W?.object||!v)return null;const re=d1.parse(v);return re.html?re.html=JR(W,re.html):re.text=JR(W,re.text),re},[v]),pe=Bt.useCallback(({viewState:W})=>{$(W)},[$]);return{createTooltip:me,data:F,deck:de,hasActiveSelection:Ee,height:V,isSelectionModeActivated:se,onViewStateChange:pe,selectionMode:K,setSelection:N,viewState:U,width:j}};Tp([zx,i_]);const h1=ug.selection,Qve=[],ebe=r=>{const{disabled:e,disableFullscreenMode:t,element:n,fragmentId:i,heightConfig:s,widgetMgr:o}=r,{mapboxToken:l}=Bt.useContext(CN),f=SN(),{expanded:A,expand:v,collapse:T}=QR(e4),I=!!s?.useStretch,{createTooltip:F,data:N,deck:U,hasActiveSelection:$,isSelectionModeActivated:V,onViewStateChange:j,selectionMode:X,setSelection:ue,viewState:K}=Yve({element:n,fragmentId:i,isLightTheme:YR(f),theme:f,widgetMgr:o}),se=n.mapboxToken||l,Ee=U.mapProvider=="mapbox"||U?.mapStyle&&U.mapStyle?.indexOf("mapbox")>=0,[Ue,de]=Bt.useState(!1);Bt.useEffect(()=>{de(!0)},[]);const me=Bt.useCallback(W=>{if(X===void 0)return;const{index:re,object:Ce}=W,et=`${W.layer?.id||null}`,_e=N,Le=re===-1,Ye=(()=>{if(Le)return h1;switch(X){case iC.SelectionMode.SINGLE_OBJECT:return _e.selection.indices[et]?.[0]===re?h1:{indices:{[`${et}`]:[re]},objects:{[`${et}`]:[Ce]}};case iC.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,Ce),tt.size===0){const{[et]:rt,...ut}=_e.selection.indices,{[et]:vt,...It}=_e.selection.objects;return{indices:ut,objects:It}}return{indices:{..._e.selection.indices,[`${et}`]:Array.from(tt.keys())},objects:{..._e.selection.objects,[`${et}`]:Array.from(tt.values())}}}default:throw IN(X),new Error("Invalid selection mode")}})();JSON.stringify(Ye)!==JSON.stringify(_e.selection)&&ue({fromUi:!0,value:{selection:Ye}})},[X,N,ue]),pe=Bt.useCallback(()=>{ue({value:{selection:h1},fromUi:!0})},[ue]);return nC(kI,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",isStretchHeight:I,children:[Ee?Gf(wne,{}):null,Gf(ON,{isFullScreen:A,disableFullscreenMode:t,onExpand:v,onCollapse:T,target:kI,locked:$&&!e?!0:void 0,children:$&&!e&&Gf(RN,{label:"Clear selection",onClick:pe,icon:PN})}),K&&nC(RJ,{viewState:K,onViewStateChange:j,layers:Ue?U.layers:Qve,getTooltip:F,ContextProvider:mh.Provider,controller:!0,onClick:V&&!e?me:void 0,children:[Gf(tu,{mapStyle:U.mapStyle&&(typeof U.mapStyle=="string"?U.mapStyle:U.mapStyle[0]),mapboxApiAccessToken:se}),Gf(Tne,{children:Gf(yne,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})]})},tbe=MN(ebe),Wbe=Bt.memo(tbe);export{Wbe 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.