@deck.gl/jupyter-widget 9.0.0-beta.8 → 9.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -9
- package/dist/index.js.map +3 -3
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -539,7 +539,7 @@ __p+='`),Ar}),ft+=`';
|
|
|
539
539
|
} catch (error) {
|
|
540
540
|
console.error(error);
|
|
541
541
|
throw error;
|
|
542
|
-
}`}function AC(t,e=!0,r){let i=r||new Set;if(t){if(fF(t))i.add(t);else if(fF(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)AC(t[n],e,i)}}return r===void 0?Array.from(i):[]}function fF(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var mC=()=>{},Wd=class{static isSupported(){return typeof Worker<"u"&&ul||typeof Tg<"u"&&!ul}constructor(e){this.terminated=!1,this._loadableURL="";let{name:r,source:i,url:n}=e;Bl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=mC,this.onError=o=>console.log(o),this.worker=ul?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=mC,this.onError=mC,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||AC(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=uF({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new Tg(i,{eval:!1})}else if(this.source)e=new Tg(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Ay=class{static isSupported(){return Wd.isSupported()}constructor(e){this.name="unnamed",this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,r=(n,o,a)=>n.done(a),i=(n,o)=>n.error(o)){let n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new py(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!ul||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Wd({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return cF?this.maxMobileConcurrency:this.maxConcurrency}};var cZ={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},jc=class{static isSupported(){return Wd.isSupported()}static getWorkerFarm(e={}){return jc._workerFarm=jc._workerFarm||new jc({}),jc._workerFarm.setProps(e),jc._workerFarm}constructor(e){this.workerPools=new Map,this.props={...cZ},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,o=this.workerPools.get(r);return o||(o=new Ay({name:r,source:i,url:n}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};function gC(t,e={}){let r=e[t.id]||{},i=ul?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(ul?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let o=t.version;o==="latest"&&(o=aF);let a=o?`@${o}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${a}/dist/${i}`}return Bl(n),n}function _C(t,e=fy){Bl(t,"no worker provided");let r=t.version;return!(!e||!r)}var yC={};async function of(t,e=null,r={},i=null){return e&&(t=dF(t,e,r,i)),yC[t]=yC[t]||uZ(t),await yC[t]}function dF(t,e,r={},i=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;i=i||t;let n=r.modules||{};return n[i]?n[i]:ul?r.CDN?(Bl(r.CDN.startsWith("http")),`${r.CDN}/${e}@${fy}/dist/libs/${i}`):dy?`../src/libs/${i}`:`modules/${e}/src/libs/${i}`:`modules/${e}/dist/libs/${i}`}async function uZ(t){if(t.endsWith("wasm"))return await fZ(t);if(!ul)try{return Gc&&Gc.requireFromFile&&await Gc.requireFromFile(t)}catch(r){return console.error(r),null}if(dy)return importScripts(t);let e=await dZ(t);return hZ(e,t)}function hZ(t,e){if(!ul)return Gc.requireFromString&&Gc.requireFromString(t,e);if(dy)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function fZ(t){return ul||!Gc.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await Gc.readFileAsArrayBuffer(t)}async function dZ(t){return ul||!Gc.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await Gc.readFileAsText(t)}function vC(t,e){return!jc.isSupported()||!ul&&!e?._nodeWorkers?!1:t.worker&&e?.worker}async function xC(t,e,r,i,n){let o=t.id,a=gC(t,r),u=jc.getWorkerFarm(r).getWorkerPool({name:o,url:a});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let f=await u.startJob("process-on-worker",pZ.bind(null,n));return f.postMessage("process",{input:e,options:r,context:i}),await(await f.result).result}async function pZ(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:o,options:a}=i;try{let l=await t(o,a);e.postMessage("done",{id:n,result:l})}catch(l){let u=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function AF(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?pF(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?pF(t,0,e):""}function pF(t,e,r){if(t.byteLength<=e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function bC(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${AF(t)}"`)}}function wC(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;let i=new Uint8Array(t),n=new Uint8Array(e);for(let o=0;o<i.length;++o)if(i[o]!==n[o])return!1;return!0}function TC(...t){return mF(t)}function mF(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,a)=>o+a.byteLength,0),i=new Uint8Array(r),n=0;for(let o of e)i.set(o,n),n+=o.byteLength;return i.buffer}function my(...t){let e=t,r=e&&e.length>1&&e[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=e.reduce((a,l)=>a+l.length,0),n=new r(i),o=0;for(let a of e)n.set(a,o),o+=a.length;return n}function sA(t,e,r){let i=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(i).buffer}function qd(t,e){return Xn(t>=0),Xn(e>0),t+(e-1)&~(e-1)}function EC(t,e,r){let i;if(t instanceof ArrayBuffer)i=new Uint8Array(t);else{let n=t.byteOffset,o=t.byteLength;i=new Uint8Array(t.buffer||t.arrayBuffer,n,o)}return e.set(i,r),r+qd(i.byteLength,4)}async function SC(t){let e=[];for await(let r of t)e.push(r);return TC(...e)}function gy(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var aA=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=gy(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(gy()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Hl=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof aA?n=e:n=new aA(r,i),this.stats[r]=n),n}};var AZ="Queued Requests",mZ="Active Requests",gZ="Cancelled Requests",_Z="Queued Requests Ever",yZ="Active Requests Ever",vZ={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Xd=class{constructor(e={}){this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.updateTimer=null,this.props={...vZ,...e},this.stats=new Hl({id:this.props.id}),this.stats.get(AZ),this.stats.get(mZ),this.stats.get(gZ),this.stats.get(_Z),this.stats.get(yZ)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(o=>(i.resolve=o,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,n=!1,o=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let i=e[r];this._updateRequest(i)||(e.splice(r,1),this.requestMap.delete(i.handle),r--)}e.sort((r,i)=>r.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var xZ="",gF={};function CC(t){for(let e in gF)if(t.startsWith(e)){let r=gF[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${xZ}${t}`),t}function _F(t){return t&&typeof t=="object"&&t.isBuffer}function Tb(t){if(_F(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Wc={};Gs(Wc,{dirname:()=>wZ,filename:()=>bZ,join:()=>TZ,resolve:()=>EZ});function yF(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function bZ(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function wZ(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function TZ(...t){let e="/";return t=t.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${e}`),"")),i!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function EZ(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",i=!1,n;for(let o=e.length-1;o>=-1&&!i;o--){let a;o>=0?a=e[o]:(n===void 0&&(n=yF()),a=n),a.length!==0&&(r=`${a}/${r}`,i=a.charCodeAt(0)===_y)}return r=SZ(r,!i),i?`/${r}`:r.length>0?r:"."}var _y=47,MC=46;function SZ(t,e){let r="",i=-1,n=0,o,a=!1;for(let l=0;l<=t.length;++l){if(l<t.length)o=t.charCodeAt(l);else{if(o===_y)break;o=_y}if(o===_y){if(!(i===l-1||n===1))if(i!==l-1&&n===2){if(r.length<2||!a||r.charCodeAt(r.length-1)!==MC||r.charCodeAt(r.length-2)!==MC){if(r.length>2){let u=r.length-1,f=u;for(;f>=0&&r.charCodeAt(f)!==_y;--f);if(f!==u){r=f===-1?"":r.slice(0,f),i=l,n=0,a=!1;continue}}else if(r.length===2||r.length===1){r="",i=l,n=0,a=!1;continue}}e&&(r.length>0?r+="/..":r="..",a=!0)}else{let u=t.slice(i+1,l);r.length>0?r+=`/${u}`:r=u,a=!1}i=l,n=0}else o===MC&&n!==-1?++n:n=-1}return r}var Eb=class{constructor(e){this._needsRefresh=!0,this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=CZ(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function CZ(t){let e=t?.fetch;if(e&&typeof e=="function")return(i,n)=>e(i,n);let r=t?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var wu=class extends Eb{};wu.type="template";wu.testURL=t=>!1;var MZ=t=>typeof t=="boolean",yy=t=>typeof t=="function",lA=t=>t!==null&&typeof t=="object",IC=t=>lA(t)&&t.constructor==={}.constructor;var vF=t=>Boolean(t)&&typeof t[Symbol.iterator]=="function",xF=t=>t&&typeof t[Symbol.asyncIterator]=="function";var Tu=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Eu=t=>typeof Blob<"u"&&t instanceof Blob,bF=t=>t&&typeof t=="object"&&t.isBuffer;var IZ=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||lA(t)&&yy(t.tee)&&yy(t.cancel)&&yy(t.getReader);var PZ=t=>lA(t)&&yy(t.read)&&yy(t.pipe)&&MZ(t.readable),Sb=t=>IZ(t)||PZ(t);var RZ=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,BZ=/^([-\w.]+\/[-\w.+]+)/;function wF(t){let e=BZ.exec(t);return e?e[1]:t}function PC(t){let e=RZ.exec(t);return e?e[1]:""}var TF=/\?.*/;function EF(t){let e=t.match(TF);return e&&e[0]}function Eg(t){return t.replace(TF,"")}function cA(t){return Tu(t)?t.url:Eu(t)?t.name||"":typeof t=="string"?t:""}function vy(t){if(Tu(t)){let e=t,r=e.headers.get("content-type")||"",i=Eg(e.url);return wF(r)||PC(i)}return Eu(t)?t.type||"":typeof t=="string"?PC(t):""}function SF(t){return Tu(t)?t.headers["content-length"]||-1:Eu(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function Cb(t){if(Tu(t))return t;let e={},r=SF(t);r>=0&&(e["content-length"]=String(r));let i=cA(t),n=vy(t);n&&(e["content-type"]=n);let o=await DZ(t);o&&(e["x-first-bytes"]=o),typeof t=="string"&&(t=new TextEncoder().encode(t));let a=new Response(t,{headers:e});return Object.defineProperty(a,"url",{value:i}),a}async function CF(t){if(!t.ok){let e=await OZ(t);throw new Error(e)}}async function OZ(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{let r=t.headers.get("Content-Type"),i=t.statusText;r?.includes("application/json")&&(i+=` ${await t.text()}`),e+=i,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}async function DZ(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=o=>i(o?.target?.result),n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${LZ(r)}`}return null}function LZ(t){let e="",r=new Uint8Array(t);for(let i=0;i<r.byteLength;i++)e+=String.fromCharCode(r[i]);return btoa(e)}function FZ(t){return!NZ(t)&&!kZ(t)}function NZ(t){return t.startsWith("http:")||t.startsWith("https:")}function kZ(t){return t.startsWith("data:")}async function Sg(t,e){if(typeof t=="string"){let r=CC(t);return FZ(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,e):await fetch(r,e)}return await Cb(t)}var Mb=globalThis,UZ=globalThis.document||{},Ib=globalThis.process||{},zZ=globalThis.console,MF=globalThis.navigator||{};function Pb(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return Boolean(r&&r.indexOf("Electron")>=0)}function jl(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Pb()}function RC(t){return!t&&!jl()?"Node":Pb(t)?"Electron":(t||MF.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var BC="4.0.7";function HZ(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var Rb=class{constructor(e,r,i="sessionStorage"){this.storage=HZ(i),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function IF(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function PF(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var Bb;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Bb||(Bb={}));var jZ=10;function RF(t){return typeof t!="string"?t:(t=t.toUpperCase(),Bb[t]||Bb.WHITE)}function BF(t,e,r){return!jl&&typeof t=="string"&&(e&&(t=`\x1B[${RF(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${RF(r)+jZ}m${t}\x1B[49m`)),t}function OF(t,e=["constructor"]){let r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r),n=t;for(let o of i){let a=n[o];typeof a=="function"&&(e.find(l=>o===l)||(n[o]=a.bind(t)))}}function xy(t,e){if(!t)throw new Error(e||"Assertion failed")}function uA(){let t;if(jl()&&Mb.performance)t=Mb?.performance?.now?.();else if("hrtime"in Ib){let e=Ib?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var Cg={debug:jl()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},GZ={enabled:!0,level:0};function Mg(){}var DF={},LF={once:!0},Sc=class{constructor({id:e}={id:""}){this.VERSION=BC,this._startTs=uA(),this._deltaTs=uA(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Rb(`__probe-${this.id}__`,GZ),this.timeStamp(`${this.id} started`),OF(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((uA()-this._startTs).toPrecision(10))}getDelta(){return Number((uA()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Cg.warn,arguments,LF)}error(e){return this._getLogFunction(0,e,Cg.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,Cg.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,Cg.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,Cg.debug||Cg.info,arguments,LF)}table(e,r,i){return r?this._getLogFunction(e,r,console.table||Mg,i&&[i],{tag:qZ(r)}):Mg}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||Mg)}group(e,r,i={collapsed:!1}){let n=FF({logLevel:e,message:r,opts:i}),{collapsed:o}=i;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,r,i={}){return this.group(e,r,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Mg)}withGroup(e,r,i){this.group(e,r)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=NF(e)}_getLogFunction(e,r,i,n,o){if(this._shouldLog(e)){o=FF({logLevel:e,message:r,args:n,opts:o}),i=i||o.method,xy(i),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=uA();let a=o.tag||o.message;if(o.once&&a)if(!DF[a])DF[a]=uA();else return Mg;return r=WZ(this.id,o.message,o),i.bind(console,r,...o.args)}return Mg}};Sc.VERSION=BC;function NF(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return xy(Number.isFinite(e)&&e>=0),e}function FF(t){let{logLevel:e,message:r}=t;t.logLevel=NF(e);let i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let n=typeof t.message;return xy(n==="string"||n==="object"),Object.assign(t,{args:i},t.opts)}function WZ(t,e,r){if(typeof e=="string"){let i=r.time?PF(IF(r.total)):"";e=r.time?`${t}: ${i} ${e}`:`${t}: ${e}`,e=BF(e,r.color,r.background)}return e}function qZ(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var OC=new Sc({id:"@probe.gl/log"});var DC=new Sc({id:"loaders.gl"}),Ob=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Db=class{constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var LC={fetch:null,mimeType:void 0,nothrow:!1,log:new Db,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:$f,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},kF={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 FC(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function NC(){let t=FC();return t.globalOptions=t.globalOptions||{...LC},t.globalOptions}function VF(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],XZ(t,r),KZ(e,t,i)}function XZ(t,e){UF(t,null,LC,kF,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};UF(i,r.id,n,o,e)}}function UF(t,e,r,i,n){let o=e||"Top level",a=e?`${e}.`:"";for(let l in t){let u=!e&&lA(t[l]),f=l==="baseUri"&&!e,_=l==="workerUrl"&&e;if(!(l in r)&&!f&&!_){if(l in i)DC.warn(`${o} loader option '${a}${l}' no longer supported, use '${i[l]}'`)();else if(!u){let w=YZ(l,n);DC.warn(`${o} loader option '${a}${l}' not recognized. ${w}`)()}}}}function YZ(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let o in n.options){if(t===o)return`Did you mean '${n.id}.${o}'?`;let a=o.toLowerCase();(r.startsWith(a)||a.startsWith(r))&&(i=i||`Did you mean '${n.id}.${o}'?`)}return i}function KZ(t,e,r){let n={...t.options||{}};return ZZ(n,r),n.log===null&&(n.log=new Ob),zF(n,NC()),zF(n,e),n}function zF(t,e){for(let r in e)if(r in e){let i=e[r];IC(i)&&IC(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function ZZ(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function by(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t?.extensions)):!1}function wy(t){Xn(t,"null loader"),Xn(by(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var HF=()=>{let t=FC();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function hA(t){let e=HF();t=Array.isArray(t)?t:[t];for(let r of t){let i=wy(r);e.find(n=>i===n)||e.unshift(i)}}function jF(){return HF()}var GF=new Sc({id:"loaders.gl"});var JZ=/\.([^.]+)$/;async function XF(t,e=[],r,i){if(!YF(t))return null;let n=WF(t,e,{...r,nothrow:!0},i);if(n)return n;if(Eu(t)&&(t=await t.slice(0,10).arrayBuffer(),n=WF(t,e,r,i)),!n&&!r?.nothrow)throw new Error(KF(t));return n}function WF(t,e=[],r,i){if(!YF(t))return null;if(e&&!Array.isArray(e))return wy(e);let n=[];e&&(n=n.concat(e)),r?.ignoreRegisteredLoaders||n.push(...jF()),$Z(n);let o=QZ(t,n,r,i);if(!o&&!r?.nothrow)throw new Error(KF(t));return o}function QZ(t,e,r,i){let n=cA(t),o=vy(t),a=Eg(n)||i?.url,l=null,u="";return r?.mimeType&&(l=kC(e,r?.mimeType),u=`match forced by supplied MIME type ${r?.mimeType}`),l=l||eJ(e,a),u=u||(l?`matched url ${a}`:""),l=l||kC(e,o),u=u||(l?`matched MIME type ${o}`:""),l=l||rJ(e,t),u=u||(l?`matched initial data ${ZF(t)}`:""),r?.fallbackMimeType&&(l=l||kC(e,r?.fallbackMimeType),u=u||(l?`matched fallback MIME type ${o}`:"")),u&&GF.log(1,`selectLoader selected ${l?.name}: ${u}.`),l}function YF(t){return!(t instanceof Response&&t.status===204)}function KF(t){let e=cA(t),r=vy(t),i="No valid loader found (";i+=e?`${Wc.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?ZF(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function $Z(t){for(let e of t)wy(e)}function eJ(t,e){let r=e&&JZ.exec(e),i=r&&r[1];return i?tJ(t,i):null}function tJ(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function kC(t,e){for(let r of t)if(r.mimeTypes&&r.mimeTypes.includes(e)||e===`application/x.${r.id}`)return r;return null}function rJ(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(iJ(e,r))return r}else if(ArrayBuffer.isView(e)){if(qF(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&qF(e,0,r))return r;return null}function iJ(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function qF(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>nJ(t,e,r,n))}function nJ(t,e,r,i){if(i instanceof ArrayBuffer)return wC(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=UC(t,e,i.length);return i===n;default:return!1}}function ZF(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?UC(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?UC(t,0,e):""}function UC(t,e,r){if(t.byteLength<e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function*JF(t,e){let r=e?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<t.length;){let o=Math.min(t.length-i,r),a=t.slice(i,i+o);i+=o,yield n.encode(a)}}function*QF(t,e={}){let{chunkSize:r=262144}=e,i=0;for(;i<t.byteLength;){let n=Math.min(t.byteLength-i,r),o=new ArrayBuffer(n),a=new Uint8Array(t,i,n);new Uint8Array(o).set(a),i+=n,yield o}}async function*$F(t,e){let r=e?.chunkSize||1048576,i=0;for(;i<t.size;){let n=i+r,o=await t.slice(i,n).arrayBuffer();i=n,yield o}}function zC(t,e){return $f?oJ(t,e):sJ(t,e)}async function*oJ(t,e){let r=t.getReader(),i;try{for(;;){let n=i||r.read();e?._streamReadAhead&&(i=r.read());let{done:o,value:a}=await n;if(o)return;yield Tb(a)}}catch{r.releaseLock()}}async function*sJ(t,e){for await(let r of t)yield Tb(r)}function eN(t,e){if(typeof t=="string")return JF(t,e);if(t instanceof ArrayBuffer)return QF(t,e);if(Eu(t))return $F(t,e);if(Sb(t))return zC(t,e);if(Tu(t))return zC(t.body,e);throw new Error("makeIterator")}var tN="Cannot convert supplied data type";function aJ(t,e,r){if(e.text&&typeof t=="string")return t;if(bF(t)&&(t=t.buffer),t instanceof ArrayBuffer){let i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let i=t.buffer,n=t.byteLength||t.length;return(t.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(t.byteOffset,t.byteOffset+n)),i}throw new Error(tN)}async function rN(t,e,r){let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if(typeof t=="string"||i)return aJ(t,e,r);if(Eu(t)&&(t=await Cb(t)),Tu(t)){let n=t;return await CF(n),e.binary?await n.arrayBuffer():await n.text()}if(Sb(t)&&(t=eN(t,r)),vF(t)||xF(t))return SC(t);throw new Error(tN)}function Lb(t,e){let r=NC(),i=t||r;return typeof i.fetch=="function"?i.fetch:lA(i.fetch)?n=>Sg(n,i.fetch):e?.fetch?e?.fetch:Sg}function iN(t,e,r){if(r)return r;let i={fetch:Lb(e,t),...t};if(i.url){let n=Eg(i.url);i.baseUrl=n,i.queryString=EF(i.url),i.filename=Wc.filename(n),i.baseUrl=Wc.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function nN(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function Yd(t,e,r,i){e&&!Array.isArray(e)&&!by(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=cA(t),a=nN(e,i),l=await XF(t,a,r);return l?(r=VF(r,l,a,n),i=iN({url:n,_parse:Yd,loaders:a},r,i||null),await lJ(l,t,r,i)):null}async function lJ(t,e,r,i){if(_C(t),r=hy(t.options,r),Tu(e)){let o=e,{ok:a,redirected:l,status:u,statusText:f,type:_,url:w}=o,E=Object.fromEntries(o.headers.entries());i.response={headers:E,ok:a,redirected:l,status:u,statusText:f,type:_,url:w}}e=await rN(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(vC(t,r))return await xC(t,e,r,i,Yd);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw Bl(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function Ca(t,e,r,i){let n,o;!Array.isArray(e)&&!by(e)?(n=[],o=e,i=void 0):(n=e,o=r);let a=Lb(o),l=t;return typeof t=="string"&&(l=await a(t)),Eu(t)&&(l=await a(t)),Array.isArray(n)?await Yd(l,n,o):await Yd(l,n,o)}var ar=new Sc({id:"luma.gl"});var VC=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Hl({id:e})),this.stats.get(e)}},Ig=new VC;function cJ(){let t="9.0.0-beta.9",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(jl()&&ar.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:ar,stats:Ig}),t}var oN=cJ();function uJ(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function Kd(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:uJ(t)}var HC={};function ma(t="id"){HC[t]=HC[t]||1;let e=HC[t]++;return`${t}-${e}`}function Zd(t){let e=!0;for(let r in t){e=!1;break}return e}var wn=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,i){if(!e)throw new Error("no device");this._device=e,this.props=hJ(r,i);let n=this.props.id!=="undefined"?this.props.id:ma(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};yi(wn,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function hJ(t,e){let r={...e};for(let i in t)t[i]!==void 0&&(r[i]=t[i]);return r}var Ty=class extends wn{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let i={...r};(r.usage||0)&Ty.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?i.indexType="uint32":r.data instanceof Uint16Array&&(i.indexType="uint16")),super(e,i,Ty.defaultProps),this.usage=r.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,i){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:i,Ty.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(o):r===0&&i===e.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(r,r+o)}},cn=Ty;yi(cn,"defaultProps",{...wn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),yi(cn,"MAP_READ",1),yi(cn,"MAP_WRITE",2),yi(cn,"COPY_SRC",4),yi(cn,"COPY_DST",8),yi(cn,"INDEX",16),yi(cn,"VERTEX",32),yi(cn,"UNIFORM",64),yi(cn,"STORAGE",128),yi(cn,"INDIRECT",256),yi(cn,"QUERY_RESOLVE",512),yi(cn,"DEBUG_DATA_MAX_LENGTH",32);function Fb(t){let e=sN[t],r=fJ(e),i=t.includes("norm"),n=!i&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:sN[t],byteLength:r,integer:n,signed:o,normalized:i}}function fJ(t){return dJ[t]}var sN={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},dJ={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var pJ=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],AJ=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function aN(t){return pJ.some(e=>t.startsWith(e))}function Nb(t){let e=AJ.exec(t);if(e){let[,r,i,n,o,a]=e;if(r){let l=`${n}${i}`,u=Fb(l);return{format:r,components:r.length,srgb:o==="-srgb",unsized:a==="-unsized",webgl:a==="-webgl",...u}}}return gJ(t)}var mJ={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function gJ(t){let e=mJ[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var Ey=class{},Sy=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},jC=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...jC.defaultProps,...e},this.id=this.props.id||ma(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=Ig;_lumaData={};isTextureFormatCompressed(e){return aN(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&cn.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":ar.warn("indices buffer content must be of integer type")()),r}},qc=jC;yi(qc,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(ar.get("debug")),spector:Boolean(ar.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>ar.error(e.message)}),yi(qc,"VERSION",oN);function un(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var fA=new Map,Xc=class{static registerDevices(e){for(let r of e)un(r.type&&r.isSupported&&r.create),fA.set(r.type,r)}static getAvailableDevices(){return Array.from(fA).map(e=>e.type)}static getSupportedDevices(){return Array.from(fA).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(qc.defaultProps,e)}static async createDevice(e={}){e={...qc.defaultProps,...e},e.gl&&(e.type="webgl");let r;switch(e.type){case"webgpu":if(r=fA.get("webgpu"),r)return await r.create(e);break;case"webgl":if(r=fA.get("webgl"),r)return await r.create(e);break;case"best-available":if(r=fA.get("webgpu"),r&&r.isSupported())return await r.create(e);if(r=fA.get("webgl"),r&&r.isSupported())return await r.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};yi(Xc,"stats",Ig),yi(Xc,"log",ar);var _J=jl()&&typeof document<"u",kb=()=>_J&&document.readyState==="complete",yJ={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Jd=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return kb()}constructor(e){if(this.props={...yJ,...e},e=this.props,!jl()){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=bJ(e.canvas):this.canvas=e.canvas;else{let r=wJ(e),i=xJ(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return TJ(e,i,n,o,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(ar.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==i||o.clientHeight!==n||o.devicePixelRatio!==e){let a=e,l=Math.floor(i*a),u=Math.floor(n*a);this.htmlCanvas.width=l,this.htmlCanvas.height=u;let[f,_]=this.getDrawingBufferSize();(f!==l||_!==u)&&(a=Math.min(f/i,_/n),this.htmlCanvas.width=Math.floor(i*a),this.htmlCanvas.height=Math.floor(n*a),ar.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};yi(Jd,"pageLoaded",vJ());function vJ(){return kb()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function xJ(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!kb())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function bJ(t){let e=document.getElementById(t);if(!e&&!kb())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function wJ(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function TJ(t,e,r,i,n){let o=t,a=lN(o[0],e,r),l=cN(o[1],e,i,n),u=lN(o[0]+1,e,r),f=u===r-1?u:u-1;u=cN(o[1]+1,e,i,n);let _;return n?(u=u===0?u:u+1,_=l,l=u):_=u===i-1?u:u-1,{x:a,y:l,width:Math.max(f-a+1,1),height:Math.max(_-l+1,1)}}function lN(t,e,r){return Math.min(Math.round(t*e),r-1)}function cN(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var GC=class extends wn{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=GC.defaultProps){super(e,r,i),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}},Vo=GC;yi(Vo,"defaultProps",{...wn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),yi(Vo,"COPY_SRC",1),yi(Vo,"COPY_DST",2),yi(Vo,"TEXTURE_BINDING",4),yi(Vo,"STORAGE_BINDING",8),yi(Vo,"RENDER_ATTACHMENT",16);var WC=class extends wn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,WC.defaultProps)}},Qd=WC;yi(Qd,"defaultProps",{...wn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function hN(t,e,r){let i="",n=e.split(/\r?\n/),o=t.slice().sort((a,l)=>a.lineNum-l.lineNum);switch(r?.showSourceCode||"no"){case"all":let a=0;for(let l=1;l<=n.length;l++)for(i+=fN(n[l-1],l,r);o.length>a&&o[a].lineNum===l;){let u=o[a++];i+=uN(u,n,u.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let l of t)i+=uN(l,n,l.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function uN(t,e,r,i){if(i?.inlineSource){let n=EJ(e,r),o=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
|
|
542
|
+
}`}function AC(t,e=!0,r){let i=r||new Set;if(t){if(fF(t))i.add(t);else if(fF(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)AC(t[n],e,i)}}return r===void 0?Array.from(i):[]}function fF(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var mC=()=>{},Wd=class{static isSupported(){return typeof Worker<"u"&&ul||typeof Tg<"u"&&!ul}constructor(e){this.terminated=!1,this._loadableURL="";let{name:r,source:i,url:n}=e;Bl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=mC,this.onError=o=>console.log(o),this.worker=ul?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=mC,this.onError=mC,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||AC(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=uF({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new Tg(i,{eval:!1})}else if(this.source)e=new Tg(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Ay=class{static isSupported(){return Wd.isSupported()}constructor(e){this.name="unnamed",this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,r=(n,o,a)=>n.done(a),i=(n,o)=>n.error(o)){let n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new py(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!ul||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Wd({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return cF?this.maxMobileConcurrency:this.maxConcurrency}};var cZ={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},jc=class{static isSupported(){return Wd.isSupported()}static getWorkerFarm(e={}){return jc._workerFarm=jc._workerFarm||new jc({}),jc._workerFarm.setProps(e),jc._workerFarm}constructor(e){this.workerPools=new Map,this.props={...cZ},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,o=this.workerPools.get(r);return o||(o=new Ay({name:r,source:i,url:n}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};function gC(t,e={}){let r=e[t.id]||{},i=ul?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(ul?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let o=t.version;o==="latest"&&(o=aF);let a=o?`@${o}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${a}/dist/${i}`}return Bl(n),n}function _C(t,e=fy){Bl(t,"no worker provided");let r=t.version;return!(!e||!r)}var yC={};async function of(t,e=null,r={},i=null){return e&&(t=dF(t,e,r,i)),yC[t]=yC[t]||uZ(t),await yC[t]}function dF(t,e,r={},i=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;i=i||t;let n=r.modules||{};return n[i]?n[i]:ul?r.CDN?(Bl(r.CDN.startsWith("http")),`${r.CDN}/${e}@${fy}/dist/libs/${i}`):dy?`../src/libs/${i}`:`modules/${e}/src/libs/${i}`:`modules/${e}/dist/libs/${i}`}async function uZ(t){if(t.endsWith("wasm"))return await fZ(t);if(!ul)try{return Gc&&Gc.requireFromFile&&await Gc.requireFromFile(t)}catch(r){return console.error(r),null}if(dy)return importScripts(t);let e=await dZ(t);return hZ(e,t)}function hZ(t,e){if(!ul)return Gc.requireFromString&&Gc.requireFromString(t,e);if(dy)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function fZ(t){return ul||!Gc.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await Gc.readFileAsArrayBuffer(t)}async function dZ(t){return ul||!Gc.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await Gc.readFileAsText(t)}function vC(t,e){return!jc.isSupported()||!ul&&!e?._nodeWorkers?!1:t.worker&&e?.worker}async function xC(t,e,r,i,n){let o=t.id,a=gC(t,r),u=jc.getWorkerFarm(r).getWorkerPool({name:o,url:a});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let f=await u.startJob("process-on-worker",pZ.bind(null,n));return f.postMessage("process",{input:e,options:r,context:i}),await(await f.result).result}async function pZ(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:o,options:a}=i;try{let l=await t(o,a);e.postMessage("done",{id:n,result:l})}catch(l){let u=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function AF(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?pF(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?pF(t,0,e):""}function pF(t,e,r){if(t.byteLength<=e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function bC(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${AF(t)}"`)}}function wC(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;let i=new Uint8Array(t),n=new Uint8Array(e);for(let o=0;o<i.length;++o)if(i[o]!==n[o])return!1;return!0}function TC(...t){return mF(t)}function mF(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,a)=>o+a.byteLength,0),i=new Uint8Array(r),n=0;for(let o of e)i.set(o,n),n+=o.byteLength;return i.buffer}function my(...t){let e=t,r=e&&e.length>1&&e[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=e.reduce((a,l)=>a+l.length,0),n=new r(i),o=0;for(let a of e)n.set(a,o),o+=a.length;return n}function sA(t,e,r){let i=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(i).buffer}function qd(t,e){return Xn(t>=0),Xn(e>0),t+(e-1)&~(e-1)}function EC(t,e,r){let i;if(t instanceof ArrayBuffer)i=new Uint8Array(t);else{let n=t.byteOffset,o=t.byteLength;i=new Uint8Array(t.buffer||t.arrayBuffer,n,o)}return e.set(i,r),r+qd(i.byteLength,4)}async function SC(t){let e=[];for await(let r of t)e.push(r);return TC(...e)}function gy(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var aA=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=gy(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(gy()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Hl=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof aA?n=e:n=new aA(r,i),this.stats[r]=n),n}};var AZ="Queued Requests",mZ="Active Requests",gZ="Cancelled Requests",_Z="Queued Requests Ever",yZ="Active Requests Ever",vZ={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Xd=class{constructor(e={}){this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.updateTimer=null,this.props={...vZ,...e},this.stats=new Hl({id:this.props.id}),this.stats.get(AZ),this.stats.get(mZ),this.stats.get(gZ),this.stats.get(_Z),this.stats.get(yZ)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(o=>(i.resolve=o,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,n=!1,o=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let i=e[r];this._updateRequest(i)||(e.splice(r,1),this.requestMap.delete(i.handle),r--)}e.sort((r,i)=>r.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var xZ="",gF={};function CC(t){for(let e in gF)if(t.startsWith(e)){let r=gF[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${xZ}${t}`),t}function _F(t){return t&&typeof t=="object"&&t.isBuffer}function Tb(t){if(_F(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Wc={};Gs(Wc,{dirname:()=>wZ,filename:()=>bZ,join:()=>TZ,resolve:()=>EZ});function yF(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function bZ(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function wZ(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function TZ(...t){let e="/";return t=t.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${e}`),"")),i!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function EZ(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",i=!1,n;for(let o=e.length-1;o>=-1&&!i;o--){let a;o>=0?a=e[o]:(n===void 0&&(n=yF()),a=n),a.length!==0&&(r=`${a}/${r}`,i=a.charCodeAt(0)===_y)}return r=SZ(r,!i),i?`/${r}`:r.length>0?r:"."}var _y=47,MC=46;function SZ(t,e){let r="",i=-1,n=0,o,a=!1;for(let l=0;l<=t.length;++l){if(l<t.length)o=t.charCodeAt(l);else{if(o===_y)break;o=_y}if(o===_y){if(!(i===l-1||n===1))if(i!==l-1&&n===2){if(r.length<2||!a||r.charCodeAt(r.length-1)!==MC||r.charCodeAt(r.length-2)!==MC){if(r.length>2){let u=r.length-1,f=u;for(;f>=0&&r.charCodeAt(f)!==_y;--f);if(f!==u){r=f===-1?"":r.slice(0,f),i=l,n=0,a=!1;continue}}else if(r.length===2||r.length===1){r="",i=l,n=0,a=!1;continue}}e&&(r.length>0?r+="/..":r="..",a=!0)}else{let u=t.slice(i+1,l);r.length>0?r+=`/${u}`:r=u,a=!1}i=l,n=0}else o===MC&&n!==-1?++n:n=-1}return r}var Eb=class{constructor(e){this._needsRefresh=!0,this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=CZ(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function CZ(t){let e=t?.fetch;if(e&&typeof e=="function")return(i,n)=>e(i,n);let r=t?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var wu=class extends Eb{};wu.type="template";wu.testURL=t=>!1;var MZ=t=>typeof t=="boolean",yy=t=>typeof t=="function",lA=t=>t!==null&&typeof t=="object",IC=t=>lA(t)&&t.constructor==={}.constructor;var vF=t=>Boolean(t)&&typeof t[Symbol.iterator]=="function",xF=t=>t&&typeof t[Symbol.asyncIterator]=="function";var Tu=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Eu=t=>typeof Blob<"u"&&t instanceof Blob,bF=t=>t&&typeof t=="object"&&t.isBuffer;var IZ=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||lA(t)&&yy(t.tee)&&yy(t.cancel)&&yy(t.getReader);var PZ=t=>lA(t)&&yy(t.read)&&yy(t.pipe)&&MZ(t.readable),Sb=t=>IZ(t)||PZ(t);var RZ=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,BZ=/^([-\w.]+\/[-\w.+]+)/;function wF(t){let e=BZ.exec(t);return e?e[1]:t}function PC(t){let e=RZ.exec(t);return e?e[1]:""}var TF=/\?.*/;function EF(t){let e=t.match(TF);return e&&e[0]}function Eg(t){return t.replace(TF,"")}function cA(t){return Tu(t)?t.url:Eu(t)?t.name||"":typeof t=="string"?t:""}function vy(t){if(Tu(t)){let e=t,r=e.headers.get("content-type")||"",i=Eg(e.url);return wF(r)||PC(i)}return Eu(t)?t.type||"":typeof t=="string"?PC(t):""}function SF(t){return Tu(t)?t.headers["content-length"]||-1:Eu(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function Cb(t){if(Tu(t))return t;let e={},r=SF(t);r>=0&&(e["content-length"]=String(r));let i=cA(t),n=vy(t);n&&(e["content-type"]=n);let o=await DZ(t);o&&(e["x-first-bytes"]=o),typeof t=="string"&&(t=new TextEncoder().encode(t));let a=new Response(t,{headers:e});return Object.defineProperty(a,"url",{value:i}),a}async function CF(t){if(!t.ok){let e=await OZ(t);throw new Error(e)}}async function OZ(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{let r=t.headers.get("Content-Type"),i=t.statusText;r?.includes("application/json")&&(i+=` ${await t.text()}`),e+=i,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}async function DZ(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=o=>i(o?.target?.result),n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${LZ(r)}`}return null}function LZ(t){let e="",r=new Uint8Array(t);for(let i=0;i<r.byteLength;i++)e+=String.fromCharCode(r[i]);return btoa(e)}function FZ(t){return!NZ(t)&&!kZ(t)}function NZ(t){return t.startsWith("http:")||t.startsWith("https:")}function kZ(t){return t.startsWith("data:")}async function Sg(t,e){if(typeof t=="string"){let r=CC(t);return FZ(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,e):await fetch(r,e)}return await Cb(t)}var Mb=globalThis,UZ=globalThis.document||{},Ib=globalThis.process||{},zZ=globalThis.console,MF=globalThis.navigator||{};function Pb(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return Boolean(r&&r.indexOf("Electron")>=0)}function jl(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Pb()}function RC(t){return!t&&!jl()?"Node":Pb(t)?"Electron":(t||MF.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var BC="4.0.7";function HZ(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var Rb=class{constructor(e,r,i="sessionStorage"){this.storage=HZ(i),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function IF(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function PF(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var Bb;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Bb||(Bb={}));var jZ=10;function RF(t){return typeof t!="string"?t:(t=t.toUpperCase(),Bb[t]||Bb.WHITE)}function BF(t,e,r){return!jl&&typeof t=="string"&&(e&&(t=`\x1B[${RF(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${RF(r)+jZ}m${t}\x1B[49m`)),t}function OF(t,e=["constructor"]){let r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r),n=t;for(let o of i){let a=n[o];typeof a=="function"&&(e.find(l=>o===l)||(n[o]=a.bind(t)))}}function xy(t,e){if(!t)throw new Error(e||"Assertion failed")}function uA(){let t;if(jl()&&Mb.performance)t=Mb?.performance?.now?.();else if("hrtime"in Ib){let e=Ib?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var Cg={debug:jl()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},GZ={enabled:!0,level:0};function Mg(){}var DF={},LF={once:!0},Sc=class{constructor({id:e}={id:""}){this.VERSION=BC,this._startTs=uA(),this._deltaTs=uA(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Rb(`__probe-${this.id}__`,GZ),this.timeStamp(`${this.id} started`),OF(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((uA()-this._startTs).toPrecision(10))}getDelta(){return Number((uA()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Cg.warn,arguments,LF)}error(e){return this._getLogFunction(0,e,Cg.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,Cg.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,Cg.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,Cg.debug||Cg.info,arguments,LF)}table(e,r,i){return r?this._getLogFunction(e,r,console.table||Mg,i&&[i],{tag:qZ(r)}):Mg}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||Mg)}group(e,r,i={collapsed:!1}){let n=FF({logLevel:e,message:r,opts:i}),{collapsed:o}=i;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,r,i={}){return this.group(e,r,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Mg)}withGroup(e,r,i){this.group(e,r)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=NF(e)}_getLogFunction(e,r,i,n,o){if(this._shouldLog(e)){o=FF({logLevel:e,message:r,args:n,opts:o}),i=i||o.method,xy(i),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=uA();let a=o.tag||o.message;if(o.once&&a)if(!DF[a])DF[a]=uA();else return Mg;return r=WZ(this.id,o.message,o),i.bind(console,r,...o.args)}return Mg}};Sc.VERSION=BC;function NF(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return xy(Number.isFinite(e)&&e>=0),e}function FF(t){let{logLevel:e,message:r}=t;t.logLevel=NF(e);let i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let n=typeof t.message;return xy(n==="string"||n==="object"),Object.assign(t,{args:i},t.opts)}function WZ(t,e,r){if(typeof e=="string"){let i=r.time?PF(IF(r.total)):"";e=r.time?`${t}: ${i} ${e}`:`${t}: ${e}`,e=BF(e,r.color,r.background)}return e}function qZ(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var OC=new Sc({id:"@probe.gl/log"});var DC=new Sc({id:"loaders.gl"}),Ob=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Db=class{constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var LC={fetch:null,mimeType:void 0,nothrow:!1,log:new Db,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:$f,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},kF={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 FC(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function NC(){let t=FC();return t.globalOptions=t.globalOptions||{...LC},t.globalOptions}function VF(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],XZ(t,r),KZ(e,t,i)}function XZ(t,e){UF(t,null,LC,kF,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};UF(i,r.id,n,o,e)}}function UF(t,e,r,i,n){let o=e||"Top level",a=e?`${e}.`:"";for(let l in t){let u=!e&&lA(t[l]),f=l==="baseUri"&&!e,_=l==="workerUrl"&&e;if(!(l in r)&&!f&&!_){if(l in i)DC.warn(`${o} loader option '${a}${l}' no longer supported, use '${i[l]}'`)();else if(!u){let w=YZ(l,n);DC.warn(`${o} loader option '${a}${l}' not recognized. ${w}`)()}}}}function YZ(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let o in n.options){if(t===o)return`Did you mean '${n.id}.${o}'?`;let a=o.toLowerCase();(r.startsWith(a)||a.startsWith(r))&&(i=i||`Did you mean '${n.id}.${o}'?`)}return i}function KZ(t,e,r){let n={...t.options||{}};return ZZ(n,r),n.log===null&&(n.log=new Ob),zF(n,NC()),zF(n,e),n}function zF(t,e){for(let r in e)if(r in e){let i=e[r];IC(i)&&IC(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function ZZ(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function by(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t?.extensions)):!1}function wy(t){Xn(t,"null loader"),Xn(by(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var HF=()=>{let t=FC();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function hA(t){let e=HF();t=Array.isArray(t)?t:[t];for(let r of t){let i=wy(r);e.find(n=>i===n)||e.unshift(i)}}function jF(){return HF()}var GF=new Sc({id:"loaders.gl"});var JZ=/\.([^.]+)$/;async function XF(t,e=[],r,i){if(!YF(t))return null;let n=WF(t,e,{...r,nothrow:!0},i);if(n)return n;if(Eu(t)&&(t=await t.slice(0,10).arrayBuffer(),n=WF(t,e,r,i)),!n&&!r?.nothrow)throw new Error(KF(t));return n}function WF(t,e=[],r,i){if(!YF(t))return null;if(e&&!Array.isArray(e))return wy(e);let n=[];e&&(n=n.concat(e)),r?.ignoreRegisteredLoaders||n.push(...jF()),$Z(n);let o=QZ(t,n,r,i);if(!o&&!r?.nothrow)throw new Error(KF(t));return o}function QZ(t,e,r,i){let n=cA(t),o=vy(t),a=Eg(n)||i?.url,l=null,u="";return r?.mimeType&&(l=kC(e,r?.mimeType),u=`match forced by supplied MIME type ${r?.mimeType}`),l=l||eJ(e,a),u=u||(l?`matched url ${a}`:""),l=l||kC(e,o),u=u||(l?`matched MIME type ${o}`:""),l=l||rJ(e,t),u=u||(l?`matched initial data ${ZF(t)}`:""),r?.fallbackMimeType&&(l=l||kC(e,r?.fallbackMimeType),u=u||(l?`matched fallback MIME type ${o}`:"")),u&&GF.log(1,`selectLoader selected ${l?.name}: ${u}.`),l}function YF(t){return!(t instanceof Response&&t.status===204)}function KF(t){let e=cA(t),r=vy(t),i="No valid loader found (";i+=e?`${Wc.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?ZF(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function $Z(t){for(let e of t)wy(e)}function eJ(t,e){let r=e&&JZ.exec(e),i=r&&r[1];return i?tJ(t,i):null}function tJ(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function kC(t,e){for(let r of t)if(r.mimeTypes&&r.mimeTypes.includes(e)||e===`application/x.${r.id}`)return r;return null}function rJ(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(iJ(e,r))return r}else if(ArrayBuffer.isView(e)){if(qF(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&qF(e,0,r))return r;return null}function iJ(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function qF(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>nJ(t,e,r,n))}function nJ(t,e,r,i){if(i instanceof ArrayBuffer)return wC(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=UC(t,e,i.length);return i===n;default:return!1}}function ZF(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?UC(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?UC(t,0,e):""}function UC(t,e,r){if(t.byteLength<e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function*JF(t,e){let r=e?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<t.length;){let o=Math.min(t.length-i,r),a=t.slice(i,i+o);i+=o,yield n.encode(a)}}function*QF(t,e={}){let{chunkSize:r=262144}=e,i=0;for(;i<t.byteLength;){let n=Math.min(t.byteLength-i,r),o=new ArrayBuffer(n),a=new Uint8Array(t,i,n);new Uint8Array(o).set(a),i+=n,yield o}}async function*$F(t,e){let r=e?.chunkSize||1048576,i=0;for(;i<t.size;){let n=i+r,o=await t.slice(i,n).arrayBuffer();i=n,yield o}}function zC(t,e){return $f?oJ(t,e):sJ(t,e)}async function*oJ(t,e){let r=t.getReader(),i;try{for(;;){let n=i||r.read();e?._streamReadAhead&&(i=r.read());let{done:o,value:a}=await n;if(o)return;yield Tb(a)}}catch{r.releaseLock()}}async function*sJ(t,e){for await(let r of t)yield Tb(r)}function eN(t,e){if(typeof t=="string")return JF(t,e);if(t instanceof ArrayBuffer)return QF(t,e);if(Eu(t))return $F(t,e);if(Sb(t))return zC(t,e);if(Tu(t))return zC(t.body,e);throw new Error("makeIterator")}var tN="Cannot convert supplied data type";function aJ(t,e,r){if(e.text&&typeof t=="string")return t;if(bF(t)&&(t=t.buffer),t instanceof ArrayBuffer){let i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let i=t.buffer,n=t.byteLength||t.length;return(t.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(t.byteOffset,t.byteOffset+n)),i}throw new Error(tN)}async function rN(t,e,r){let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if(typeof t=="string"||i)return aJ(t,e,r);if(Eu(t)&&(t=await Cb(t)),Tu(t)){let n=t;return await CF(n),e.binary?await n.arrayBuffer():await n.text()}if(Sb(t)&&(t=eN(t,r)),vF(t)||xF(t))return SC(t);throw new Error(tN)}function Lb(t,e){let r=NC(),i=t||r;return typeof i.fetch=="function"?i.fetch:lA(i.fetch)?n=>Sg(n,i.fetch):e?.fetch?e?.fetch:Sg}function iN(t,e,r){if(r)return r;let i={fetch:Lb(e,t),...t};if(i.url){let n=Eg(i.url);i.baseUrl=n,i.queryString=EF(i.url),i.filename=Wc.filename(n),i.baseUrl=Wc.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function nN(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function Yd(t,e,r,i){e&&!Array.isArray(e)&&!by(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=cA(t),a=nN(e,i),l=await XF(t,a,r);return l?(r=VF(r,l,a,n),i=iN({url:n,_parse:Yd,loaders:a},r,i||null),await lJ(l,t,r,i)):null}async function lJ(t,e,r,i){if(_C(t),r=hy(t.options,r),Tu(e)){let o=e,{ok:a,redirected:l,status:u,statusText:f,type:_,url:w}=o,E=Object.fromEntries(o.headers.entries());i.response={headers:E,ok:a,redirected:l,status:u,statusText:f,type:_,url:w}}e=await rN(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(vC(t,r))return await xC(t,e,r,i,Yd);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw Bl(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function Ca(t,e,r,i){let n,o;!Array.isArray(e)&&!by(e)?(n=[],o=e,i=void 0):(n=e,o=r);let a=Lb(o),l=t;return typeof t=="string"&&(l=await a(t)),Eu(t)&&(l=await a(t)),Array.isArray(n)?await Yd(l,n,o):await Yd(l,n,o)}var ar=new Sc({id:"luma.gl"});var VC=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Hl({id:e})),this.stats.get(e)}},Ig=new VC;function cJ(){let t="9.0.0-beta.10",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(jl()&&ar.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:ar,stats:Ig}),t}var oN=cJ();function uJ(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function Kd(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:uJ(t)}var HC={};function ma(t="id"){HC[t]=HC[t]||1;let e=HC[t]++;return`${t}-${e}`}function Zd(t){let e=!0;for(let r in t){e=!1;break}return e}var wn=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,i){if(!e)throw new Error("no device");this._device=e,this.props=hJ(r,i);let n=this.props.id!=="undefined"?this.props.id:ma(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};yi(wn,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function hJ(t,e){let r={...e};for(let i in t)t[i]!==void 0&&(r[i]=t[i]);return r}var Ty=class extends wn{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let i={...r};(r.usage||0)&Ty.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?i.indexType="uint32":r.data instanceof Uint16Array&&(i.indexType="uint16")),super(e,i,Ty.defaultProps),this.usage=r.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,i){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:i,Ty.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(o):r===0&&i===e.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(r,r+o)}},cn=Ty;yi(cn,"defaultProps",{...wn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),yi(cn,"MAP_READ",1),yi(cn,"MAP_WRITE",2),yi(cn,"COPY_SRC",4),yi(cn,"COPY_DST",8),yi(cn,"INDEX",16),yi(cn,"VERTEX",32),yi(cn,"UNIFORM",64),yi(cn,"STORAGE",128),yi(cn,"INDIRECT",256),yi(cn,"QUERY_RESOLVE",512),yi(cn,"DEBUG_DATA_MAX_LENGTH",32);function Fb(t){let e=sN[t],r=fJ(e),i=t.includes("norm"),n=!i&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:sN[t],byteLength:r,integer:n,signed:o,normalized:i}}function fJ(t){return dJ[t]}var sN={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},dJ={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var pJ=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],AJ=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function aN(t){return pJ.some(e=>t.startsWith(e))}function Nb(t){let e=AJ.exec(t);if(e){let[,r,i,n,o,a]=e;if(r){let l=`${n}${i}`,u=Fb(l);return{format:r,components:r.length,srgb:o==="-srgb",unsized:a==="-unsized",webgl:a==="-webgl",...u}}}return gJ(t)}var mJ={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function gJ(t){let e=mJ[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var Ey=class{},Sy=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},jC=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...jC.defaultProps,...e},this.id=this.props.id||ma(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=Ig;_lumaData={};isTextureFormatCompressed(e){return aN(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&cn.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":ar.warn("indices buffer content must be of integer type")()),r}},qc=jC;yi(qc,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(ar.get("debug")),spector:Boolean(ar.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>ar.error(e.message)}),yi(qc,"VERSION",oN);function un(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var fA=new Map,Xc=class{static registerDevices(e){for(let r of e)un(r.type&&r.isSupported&&r.create),fA.set(r.type,r)}static getAvailableDevices(){return Array.from(fA).map(e=>e.type)}static getSupportedDevices(){return Array.from(fA).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(qc.defaultProps,e)}static async createDevice(e={}){e={...qc.defaultProps,...e},e.gl&&(e.type="webgl");let r;switch(e.type){case"webgpu":if(r=fA.get("webgpu"),r)return await r.create(e);break;case"webgl":if(r=fA.get("webgl"),r)return await r.create(e);break;case"best-available":if(r=fA.get("webgpu"),r&&r.isSupported())return await r.create(e);if(r=fA.get("webgl"),r&&r.isSupported())return await r.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};yi(Xc,"stats",Ig),yi(Xc,"log",ar);var _J=jl()&&typeof document<"u",kb=()=>_J&&document.readyState==="complete",yJ={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Jd=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return kb()}constructor(e){if(this.props={...yJ,...e},e=this.props,!jl()){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=bJ(e.canvas):this.canvas=e.canvas;else{let r=wJ(e),i=xJ(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return TJ(e,i,n,o,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(ar.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==i||o.clientHeight!==n||o.devicePixelRatio!==e){let a=e,l=Math.floor(i*a),u=Math.floor(n*a);this.htmlCanvas.width=l,this.htmlCanvas.height=u;let[f,_]=this.getDrawingBufferSize();(f!==l||_!==u)&&(a=Math.min(f/i,_/n),this.htmlCanvas.width=Math.floor(i*a),this.htmlCanvas.height=Math.floor(n*a),ar.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};yi(Jd,"pageLoaded",vJ());function vJ(){return kb()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function xJ(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!kb())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function bJ(t){let e=document.getElementById(t);if(!e&&!kb())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function wJ(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function TJ(t,e,r,i,n){let o=t,a=lN(o[0],e,r),l=cN(o[1],e,i,n),u=lN(o[0]+1,e,r),f=u===r-1?u:u-1;u=cN(o[1]+1,e,i,n);let _;return n?(u=u===0?u:u+1,_=l,l=u):_=u===i-1?u:u-1,{x:a,y:l,width:Math.max(f-a+1,1),height:Math.max(_-l+1,1)}}function lN(t,e,r){return Math.min(Math.round(t*e),r-1)}function cN(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var GC=class extends wn{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=GC.defaultProps){super(e,r,i),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}},Vo=GC;yi(Vo,"defaultProps",{...wn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),yi(Vo,"COPY_SRC",1),yi(Vo,"COPY_DST",2),yi(Vo,"TEXTURE_BINDING",4),yi(Vo,"STORAGE_BINDING",8),yi(Vo,"RENDER_ATTACHMENT",16);var WC=class extends wn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,WC.defaultProps)}},Qd=WC;yi(Qd,"defaultProps",{...wn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function hN(t,e,r){let i="",n=e.split(/\r?\n/),o=t.slice().sort((a,l)=>a.lineNum-l.lineNum);switch(r?.showSourceCode||"no"){case"all":let a=0;for(let l=1;l<=n.length;l++)for(i+=fN(n[l-1],l,r);o.length>a&&o[a].lineNum===l;){let u=o[a++];i+=uN(u,n,u.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let l of t)i+=uN(l,n,l.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function uN(t,e,r,i){if(i?.inlineSource){let n=EJ(e,r),o=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
|
|
543
543
|
`:"";return`
|
|
544
544
|
${n}${o}${t.type.toUpperCase()}: ${t.message}
|
|
545
545
|
|
|
@@ -549,7 +549,7 @@ ${n}${o}${t.type.toUpperCase()}: ${t.message}
|
|
|
549
549
|
<code style="user-select:text;"><pre>
|
|
550
550
|
${n}
|
|
551
551
|
</pre></code>`,a.style.top="10px",a.style.left="10px",a.style.position="absolute",a.style.zIndex="9999",a.style.width="100%",a.style.textAlign="left",document.body.appendChild(a);let l=document.getElementsByClassName("luma-compiler-log-error");l[0]?.scrollIntoView&&l[0].scrollIntoView(),a.onclick=()=>{let u=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(u)}}},$d=XC;yi($d,"defaultProps",{...wn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function PJ(t){return qC(t.source).name||t.id||ma(`unnamed ${t.stage}-shader`)}var YC=class extends wn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,YC.defaultProps)}},ep=YC;yi(ep,"defaultProps",{...wn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var KC=class extends wn{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,KC.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];r=r||n!==this.height||i!==this.width,this.width=i,this.height=n}r&&(ar.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(r=>{if(typeof r=="string"){let i=this.createColorTexture(r);return this.attachResource(i),i.view}return r instanceof Vo?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof Vo?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:Vo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:Vo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.device._createTexture({...this.colorAttachments[i].props,width:e,height:r});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}}},sf=KC;yi(sf,"defaultProps",{...wn.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var ZC=class extends wn{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,ZC.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},ah=ZC;yi(ah,"defaultProps",{...wn.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});var JC=class extends wn{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){super(e,r,JC.defaultProps)}},Pg=JC;yi(Pg,"defaultProps",{...wn.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var QC=class extends wn{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,r){super(e,r,QC.defaultProps)}},dA=QC;yi(dA,"defaultProps",{...wn.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var $C=class extends wn{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,r){super(e,r,$C.defaultProps)}},Rg=$C;yi(Rg,"defaultProps",{...wn.defaultProps,measureExecutionTime:void 0});var eM=class extends wn{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,r){super(e,r,eM.defaultProps)}},Bg=eM;yi(Bg,"defaultProps",{...wn.defaultProps});function dN(t){let[e,r]=BJ[t],i=e==="i32"||e==="u32",n=e!=="u32",o=OJ[e]*r,a=RJ(e,r);return{dataType:e,components:r,defaultVertexFormat:a,byteLength:o,integer:i,signed:n}}function RJ(t,e){let r;switch(t){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?r:`${r}x${e}`}var BJ={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]},OJ={f32:4,f16:2,i32:4,u32:4};function tM(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,i]=t.split("x"),n=r,o=i?parseInt(i):1,a=Fb(n),l={type:n,components:o,byteLength:a.byteLength*o,integer:a.integer,signed:a.signed,normalized:a.normalized};return e&&(l.webglOnly=!0),l}function Ub(t,e){let r={};for(let i of t.attributes)r[i.name]=DJ(t,e,i.name);return r}function pN(t,e,r=16){let i=Ub(t,e),n=new Array(r).fill(null);for(let o of Object.values(i))n[o.location]=o;return n}function DJ(t,e,r){let i=LJ(t,r),n=FJ(e,r);if(!i)return null;let o=dN(i.type),a=n?.vertexFormat||o.defaultVertexFormat,l=tM(a);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:a,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:o.integer,stepMode:n?.stepMode||i.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function LJ(t,e){let r=t.attributes.find(i=>i.name===e);return r||ar.warn(`shader layout attribute "${e}" not present in shader`),r||null}function FJ(t,e){NJ(t);let r=kJ(t,e);return r||(r=UJ(t,e),r)?r:(ar.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function NJ(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&ar.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function kJ(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function UJ(t,e){for(let r of t){let i=r.byteStride;if(typeof r.byteStride!="number")for(let o of r.attributes||[]){let a=tM(o.format);i+=a.byteLength}let n=r.attributes?.find(o=>o.attribute===e);if(n)return{attributeName:n.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}function rM(t,e){let r={...t,attributes:t.attributes.map(i=>({...i}))};for(let i of e?.attributes||[]){let n=r.attributes.find(o=>o.name===i.name);n?(n.type=i.type||n.type,n.stepMode=i.stepMode||n.stepMode):ar.warn(`shader layout attribute ${i.name} not present in shader`)}return r}var iM=class extends wn{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,iM.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=pN(r.renderPipeline.shaderLayout,r.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,r){throw new Error("constant attributes not supported")}},Og=iM;yi(Og,"defaultProps",{...wn.defaultProps,renderPipeline:null});var nM=class extends wn{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,nM.defaultProps)}},Dg=nM;yi(Dg,"defaultProps",{...wn.defaultProps,layout:void 0,buffers:{}});var oM=class extends wn{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,oM.defaultProps)}},Lg=oM;yi(Lg,"defaultProps",{...wn.defaultProps,type:void 0,count:void 0});var zJ={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 AN(t){let e=zJ[t];return un(t),e}function mN(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var zb;function Vb(t){return(!zb||zb.byteLength<t)&&(zb=new ArrayBuffer(t)),zb}function sM(t,e){let r=Vb(t.BYTES_PER_ELEMENT*e);return new t(r,0,e)}function aM(t){let{target:e,source:r,start:i=0,count:n=1}=t,o=r.length,a=n*o,l=0;for(let u=i;l<o;l++)e[u++]=r[l];for(;l<a;)l<a-l?(e.copyWithin(i+l,i,i+l),l*=2):(e.copyWithin(i+l,i,i+a-l),l=a);return t.target}var gN=1024,Hb=class{layout={};byteLength;constructor(e){let r=0;for(let[n,o]of Object.entries(e)){let a=AN(o),{type:l,components:u}=a;r=mN(r,u);let f=r;r+=u,this.layout[n]={type:l,size:u,offset:f}}r+=(4-r%4)%4;let i=r*4;this.byteLength=Math.max(i,gN)}getData(e){let r=Math.max(this.byteLength,gN),i=Vb(r),n={i32:new Int32Array(i),u32:new Uint32Array(i),f32:new Float32Array(i),f16:new Uint16Array(i)};for(let[o,a]of Object.entries(e)){let l=this.layout[o];if(!l){ar.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:u,size:f,offset:_}=l,w=n[u];if(f===1){if(typeof a!="number"&&typeof a!="boolean"){ar.warn(`Supplied value for single component uniform ${o} is not a number: ${a}`)();continue}w[_]=Number(a)}else{let E=Kd(a);if(!E){ar.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${a}`)();continue}w.set(E,_)}}return new Uint8Array(i)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function _N(t,e,r=16){if(t!==e)return!1;let i=Kd(t);if(!i)return!1;let n=Kd(e);if(n&&i.length===n.length){for(let o=0;o<i.length;++o)if(n[o]!==i[o])return!1}return!0}function yN(t){let e=Kd(t);return e?e.slice():t}var jb=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,e?.name&&e?.shaderLayout){let r=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!r)throw new Error(e?.name);let i=r;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[r,i]of Object.entries(e))this._setUniform(r,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,r){_N(this.uniforms[e],r)||(this.uniforms[e]=yN(r),this.modifiedUniforms[e]=!0,this.modified=!0)}};var Cy=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[r,i]of Object.entries(e)){let n=r,o=new Hb(i.uniformTypes||{});this.uniformBufferLayouts.set(n,o);let a=new jb({name:r});a.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,a)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[r,i]of Object.entries(e))this.uniformBlocks.get(r).setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let r=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(r)}createUniformBuffer(e,r,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(r),o=e.createBuffer({usage:cn.UNIFORM|cn.COPY_DST,byteLength:n}),a=this.getUniformBufferData(r);return o.write(a),o}getManagedUniformBuffer(e,r){if(!this.uniformBuffers.get(r)){let i=this.getUniformBufferByteLength(r),n=e.createBuffer({usage:cn.UNIFORM|cn.COPY_DST,byteLength:i});this.uniformBuffers.set(r,n)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let e=!1;for(let r of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(r);e||=i}return e&&ar.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let r=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&r.needsRedraw){n||=r.needsRedraw;let o=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(o);let l=this.uniformBlocks.get(e).getAllUniforms();ar.log(4,`Writing to uniform buffer ${String(e)}`,o,l)()}return n}};function Gb(t){let e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function My(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function lM(t,e,r){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=Gb(t);if(n==="uint8"||n==="sint8"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}if(n==="uint16"||n==="sint16"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}return i===1?n:`${n}x${i}`}function vN(t){return Kd(t)!==null||typeof t=="number"||typeof t=="boolean"}function Iy(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let i=t[r];vN(i)?e.uniforms[r]=i:e.bindings[r]=i}),e}function cM(t,e,r){let{removedProps:i={},deprecatedProps:n={},replacedProps:o={}}=r;for(let l in i)if(l in e){let f=i[l]?`${t}.${i[l]}`:"N/A";ar.removed(`${t}.${l}`,f)()}for(let l in n)if(l in e){let u=n[l];ar.deprecated(`${t}.${l}`,`${t}.${u}`)()}let a=null;for(let[l,u]of Object.entries(o))l in e&&(ar.deprecated(`${t}.${l}`,`${t}.${u}`)(),a=a||Object.assign({},e),a[u]=e[l],delete a[l]);return a||e}var VJ="";async function uM(t,e){return await new Promise((r,i)=>{try{let n=new Image;n.onload=()=>r(n),n.onerror=()=>i(new Error(`Could not load image ${t}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=t.startsWith("http")?t:VJ+t}catch(n){i(n)}})}async function Py(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",t),e&&(i.id=e),new Promise((n,o)=>{i.onload=n,i.onerror=a=>o(new Error(`Unable to load script '${t}': ${a}`)),r.appendChild(i)})}function Ry(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!Ry(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!Ry(t[o],e[o],r-1))return!1;return!0}return!1}function hM(t){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function fM(t){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}var af;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(af||(af={}));var Wb={[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},Ma=(t,e,r)=>e?t.enable(r):t.disable(r),xN=(t,e,r)=>t.hint(r,e),Yc=(t,e,r)=>t.pixelStorei(r,e),bN=(t,e,r)=>{let i=r===36006?36009:36008;return t.bindFramebuffer(i,e)},By=(t,e,r)=>{let n={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];t.bindBuffer(n,e)};function dM(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var wN={[3042]:Ma,[32773]:(t,e)=>t.blendColor(...e),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(t,e)=>t.clearColor(...e),[3107]:(t,e)=>t.colorMask(...e),[2884]:Ma,[2885]:(t,e)=>t.cullFace(e),[2929]:Ma,[2931]:(t,e)=>t.clearDepth(e),[2932]:(t,e)=>t.depthFunc(e),[2928]:(t,e)=>t.depthRange(...e),[2930]:(t,e)=>t.depthMask(e),[3024]:Ma,[35723]:xN,[35725]:(t,e)=>t.useProgram(e),[36007]:(t,e)=>t.bindRenderbuffer(36161,e),[36389]:(t,e)=>t.bindTransformFeedback?.(36386,e),[34229]:(t,e)=>t.bindVertexArray(e),[36006]:bN,[36010]:bN,[34964]:By,[36662]:By,[36663]:By,[35053]:By,[35055]:By,[2886]:(t,e)=>t.frontFace(e),[33170]:xN,[2849]:(t,e)=>t.lineWidth(e),[32823]:Ma,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:Ma,[32926]:Ma,[32928]:Ma,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:Ma,[3088]:(t,e)=>t.scissor(...e),[2960]:Ma,[2961]:(t,e)=>t.clearStencil(e),[2968]:(t,e)=>t.stencilMaskSeparate(1028,e),[36005]:(t,e)=>t.stencilMaskSeparate(1029,e),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(t,e)=>t.viewport(...e),[34383]:Ma,[10754]:Ma,[12288]:Ma,[12289]:Ma,[12290]:Ma,[12291]:Ma,[12292]:Ma,[12293]:Ma,[12294]:Ma,[12295]:Ma,[3333]:Yc,[3317]:Yc,[37440]:Yc,[37441]:Yc,[37443]:Yc,[3330]:Yc,[3332]:Yc,[3331]:Yc,[3314]:Yc,[32878]:Yc,[3316]:Yc,[3315]:Yc,[32877]:Yc,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=dM(e)?e:[e,e];let[r,i]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,i)},stencilFunc:(t,e)=>{e=dM(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,a,l]=e;t.stencilFuncSeparate(1028,r,i,n),t.stencilFuncSeparate(1029,o,a,l)},stencilOp:(t,e)=>{e=dM(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,a,l]=e;t.stencilOpSeparate(1028,r,i,n),t.stencilOpSeparate(1029,o,a,l)},viewport:(t,e)=>t.viewport(...e)};function ra(t,e,r){return e[t]!==void 0?e[t]:r[t]}var TN={blendEquation:(t,e,r)=>t.blendEquationSeparate(ra(32777,e,r),ra(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(ra(32969,e,r),ra(32968,e,r),ra(32971,e,r),ra(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(ra(32824,e,r),ra(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(ra(32938,e,r),ra(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,ra(2962,e,r),ra(2967,e,r),ra(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,ra(34816,e,r),ra(36003,e,r),ra(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,ra(2964,e,r),ra(2965,e,r),ra(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,ra(34817,e,r),ra(34818,e,r),ra(34819,e,r))},pM={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({[35725]:e}),bindRenderbuffer:(t,e,r)=>t({[36007]:r}),bindTransformFeedback:(t,e,r)=>t({[36389]:r}),bindVertexArray:(t,e)=>t({[34229]:e}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({[36006]:r,[36010]:r});case 36009:return t({[36006]:r});case 36008:return t({[36010]:r});default:return null}},bindBuffer:(t,e,r)=>{let i={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[e];return i?t({[i]:r}):{valueChanged:!0}},blendColor:(t,e,r,i,n)=>t({[32773]:new Float32Array([e,r,i,n])}),blendEquation:(t,e)=>t({[32777]:e,[34877]:e}),blendEquationSeparate:(t,e,r)=>t({[32777]:e,[34877]:r}),blendFunc:(t,e,r)=>t({[32969]:e,[32968]:r,[32971]:e,[32970]:r}),blendFuncSeparate:(t,e,r,i,n)=>t({[32969]:e,[32968]:r,[32971]:i,[32970]:n}),clearColor:(t,e,r,i,n)=>t({[3106]:new Float32Array([e,r,i,n])}),clearDepth:(t,e)=>t({[2931]:e}),clearStencil:(t,e)=>t({[2961]:e}),colorMask:(t,e,r,i,n)=>t({[3107]:[e,r,i,n]}),cullFace:(t,e)=>t({[2885]:e}),depthFunc:(t,e)=>t({[2932]:e}),depthRange:(t,e,r)=>t({[2928]:new Float32Array([e,r])}),depthMask:(t,e)=>t({[2930]:e}),frontFace:(t,e)=>t({[2886]:e}),lineWidth:(t,e)=>t({[2849]:e}),polygonOffset:(t,e,r)=>t({[32824]:e,[10752]:r}),sampleCoverage:(t,e,r)=>t({[32938]:e,[32939]:r}),scissor:(t,e,r,i,n)=>t({[3088]:new Int32Array([e,r,i,n])}),stencilMask:(t,e)=>t({[2968]:e,[36005]:e}),stencilMaskSeparate:(t,e,r)=>t({[e===1028?2968:36005]:r}),stencilFunc:(t,e,r,i)=>t({[2962]:e,[2967]:r,[2963]:i,[34816]:e,[36003]:r,[36004]:i}),stencilFuncSeparate:(t,e,r,i,n)=>t({[e===1028?2962:34816]:r,[e===1028?2967:36003]:i,[e===1028?2963:36004]:n}),stencilOp:(t,e,r,i)=>t({[2964]:e,[2965]:r,[2966]:i,[34817]:e,[34818]:r,[34819]:i}),stencilOpSeparate:(t,e,r,i,n)=>t({[e===1028?2964:34817]:r,[e===1028?2965:34818]:i,[e===1028?2966:34819]:n}),viewport:(t,e,r,i,n)=>t({[2978]:[e,r,i,n]})},lf=(t,e)=>t.isEnabled(e),AM={[3042]:lf,[2884]:lf,[2929]:lf,[3024]:lf,[32823]:lf,[32926]:lf,[32928]:lf,[3089]:lf,[2960]:lf,[35977]:lf},EN=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 lh(t,e){if(HJ(e))return;let r={};for(let n in e){let o=Number(n),a=wN[n];a&&(typeof a=="string"?r[a]=!0:a(t,e[n],o))}let i=t.state&&t.state.cache;if(i)for(let n in r){let o=TN[n];o(t,e,i)}}function qb(t,e=Wb){if(typeof e=="number"){let n=e,o=AM[n];return o?o(t,n):t.getParameter(n)}let r=Array.isArray(e)?e:Object.keys(e),i={};for(let n of r){let o=AM[n];i[n]=o?o(t,Number(n)):t.getParameter(Number(n))}return i}function HJ(t){for(let e in t)return!1;return!0}function SN(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),i=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&i&&t.length===e.length){for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}return!1}var mM=class{gl;program=null;stateStack=[];enable=!0;cache;log;constructor(e,{copyState:r=!1,log:i=()=>{}}={}){this.gl=e,this.cache=r?qb(e):Object.assign({},Wb),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){un(this.stateStack.length>0);let e=this.stateStack[this.stateStack.length-1];lh(this.gl,e),this.stateStack.pop()}_updateCache(e){let r=!1,i,n=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in e){un(o!==void 0);let a=e[o],l=this.cache[o];SN(a,l)||(r=!0,i=l,n&&!(o in n)&&(n[o]=l),this.cache[o]=a)}return{valueChanged:r,oldValue:i}}};function pA(t){return t.state}function gM(t,e){let{enable:r=!0,copyState:i}=e;if(un(i!==void 0),!t.state){t.state=new mM(t,{copyState:i}),GJ(t);for(let o in pM){let a=pM[o];jJ(t,o,a)}CN(t,"getParameter"),CN(t,"isEnabled")}let n=pA(t);return n.enable=r,t}function tp(t){let e=pA(t);e||(gM(t,{copyState:!1}),e=pA(t)),e.push()}function ed(t){let e=pA(t);un(e),e.pop()}function CN(t,e){let r=t[e].bind(t);t[e]=function(n){if(n===void 0||EN.has(n))return r(n);let o=pA(t);return n in o.cache||(o.cache[n]=r(n)),o.enable?o.cache[n]:r(n)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function jJ(t,e,r){if(!t[e])return;let i=t[e].bind(t);t[e]=function(...o){let a=pA(t),{valueChanged:l,oldValue:u}=r(a._updateCache,...o);return l&&i(...o),u},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function GJ(t){let e=t.useProgram.bind(t);t.useProgram=function(i){let n=pA(t);n.program!==i&&(e(i),n.program=i)}}var WJ={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function MN(t,e){e={...WJ,...e};let r=null,i=o=>r=o.statusMessage||r;t.addEventListener("webglcontextcreationerror",i,!1);let n=null;if(n||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",i,!1),!n)throw new Error(`Failed to create WebGL context: ${r||"Unknown error"}`);if(e.onContextLost){let{onContextLost:o}=e;t.addEventListener("webglcontextlost",a=>o(a),!1)}if(e.onContextRestored){let{onContextRestored:o}=e;t.addEventListener("webglcontextrestored",a=>o(a),!1)}return n}function Su(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function IN(t,e){let r=t.getParameter(7936),i=t.getParameter(7937);Su(t,"WEBGL_debug_renderer_info",e);let n=e.WEBGL_debug_renderer_info,o=t.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),a=t.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),l=o||r,u=a||i,f=t.getParameter(7938),_=PN(l,u),w=qJ(l,u),E=XJ(l,u);return{type:"webgl",gpu:_,gpuType:E,gpuBackend:w,vendor:l,renderer:u,version:f,shadingLanguage:"glsl",shadingLanguageVersion:300}}function PN(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function qJ(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function XJ(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(PN(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Xb(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}var Gl="texture-compression-bc",ns="texture-compression-astc",cf="texture-compression-etc2",YJ="texture-compression-etc1-webgl",Yb="texture-compression-pvrtc-webgl",_M="texture-compression-atc-webgl",Oy="float32-renderable-webgl",yM="float16-renderable-webgl",KJ="rgb9e5ufloat_renderable-webgl",vM="snorm8-renderable-webgl",Dy="norm16-renderable-webgl",xM="snorm16-renderable-webgl",Kb="float32-filterable",RN="float16-filterable-webgl",Ly="WEBGL_compressed_texture_s3tc",Fy="WEBGL_compressed_texture_s3tc_srgb",Fg="EXT_texture_compression_rgtc",Ng="EXT_texture_compression_bptc",ZJ="WEBGL_compressed_texture_etc",JJ="WEBGL_compressed_texture_astc",QJ="WEBGL_compressed_texture_etc1",$J="WEBGL_compressed_texture_pvrtc",eQ="WEBGL_compressed_texture_atc",BN="EXT_texture_norm16",ON="EXT_render_snorm",tQ="EXT_color_buffer_float",Zb={"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":[ON],"norm16-renderable-webgl":[BN],"snorm16-renderable-webgl":[BN,ON],"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":[Ly,Fy,Fg,Ng],"texture-compression-bc5-webgl":[Fg],"texture-compression-bc7-webgl":[Ng],"texture-compression-etc2":[ZJ],"texture-compression-astc":[JJ],"texture-compression-etc1-webgl":[QJ],"texture-compression-pvrtc-webgl":[$J],"texture-compression-atc-webgl":[eQ]};function DN(t){return t in Zb}function LN(t,e,r){return(Zb[e]||[]).every(n=>Su(t,n,r))}var Jb={"rgb8unorm-unsized":{gl:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,rb:!0},r8snorm:{gl:36756,b:1,c:1,render:vM},r8uint:{gl:33330,b:1,c:1,rb:!0},r8sint:{gl:33329,b:1,c:1,rb:!0},rg8unorm:{gl:33323,b:2,c:2,rb:!0},rg8snorm:{gl:36757,b:2,c:2,render:vM},rg8uint:{gl:33336,b:2,c:2,rb:!0},rg8sint:{gl:33335,b:2,c:2,rb:!0},r16uint:{gl:33332,b:2,c:1,rb:!0},r16sint:{gl:33331,b:2,c:1,rb:!0},r16float:{gl:33325,b:2,c:1,render:yM,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:Dy,rb:!0},"r16snorm-webgl":{gl:36760,b:2,c:1,f:xM},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,b:4,c:4,bpp:4},rgba8snorm:{gl:36759,b:4,c:4,render:vM},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:yM,filter:RN,rb:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,render:Dy},"rg16snorm-webgl":{gl:36761,b:2,c:2,render:xM},r32uint:{gl:33334,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,rb:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:Oy,filter:Kb},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:KJ},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:Oy,rb:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:Dy},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:Dy},rg32uint:{gl:33340,b:8,c:2,rb:!0},rg32sint:{gl:33339,b:8,c:2,rb:!0},rg32float:{gl:33328,b:8,c:2,render:Oy,filter:Kb,rb:!0},rgba16uint:{gl:36214,b:8,c:4,rb:!0},rgba16sint:{gl:36232,b:8,c:4,rb:!0},rgba16float:{gl:34842,b:8,c:4,render:yM,filter:RN},"rgba16unorm-webgl":{gl:32859,b:2,c:4,render:Dy,rb:!0},"rgba16snorm-webgl":{gl:36763,b:2,c:4,render:xM},"rgb32float-webgl":{gl:34837,render:Oy,filter:Kb,gl2ext:tQ,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,rb:!0},rgba32sint:{gl:36226,b:16,c:4,rb:!0},rgba32float:{gl:34836,b:16,c:4,render:Oy,filter:Kb,rb:!0},stencil8:{gl:36168,b:1,c:1,attachment:36128,rb:!0},depth16unorm:{gl:33189,b:2,c:1,attachment:36096,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096,dataFormat:6402,types:[5125]},depth32float:{gl:36012,b:4,c:1,attachment:36096,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,dataFormat:34041,types:[34042],rb:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Ly,f:Gl},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Fy,f:Gl},"bc1-rgba-unorm":{gl:33777,x:Ly,f:Gl},"bc1-rgba-unorm-srgb":{gl:35916,x:Fy,f:Gl},"bc2-rgba-unorm":{gl:33778,x:Ly,f:Gl},"bc2-rgba-unorm-srgb":{gl:35918,x:Fy,f:Gl},"bc3-rgba-unorm":{gl:33779,x:Ly,f:Gl},"bc3-rgba-unorm-srgb":{gl:35919,x:Fy,f:Gl},"bc4-r-unorm":{gl:36283,x:Fg,f:Gl},"bc4-r-snorm":{gl:36284,x:Fg,f:Gl},"bc5-rg-unorm":{gl:36285,x:Fg,f:Gl},"bc5-rg-snorm":{gl:36286,x:Fg,f:Gl},"bc6h-rgb-ufloat":{gl:36495,x:Ng,f:Gl},"bc6h-rgb-float":{gl:36494,x:Ng,f:Gl},"bc7-rgba-unorm":{gl:36492,x:Ng,f:Gl},"bc7-rgba-unorm-srgb":{gl:36493,x:Ng,f:Gl},"etc2-rgb8unorm":{gl:37492,f:cf},"etc2-rgb8unorm-srgb":{gl:37494,f:cf},"etc2-rgb8a1unorm":{gl:37496,f:cf},"etc2-rgb8a1unorm-srgb":{gl:37497,f:cf},"etc2-rgba8unorm":{gl:37493,f:cf},"etc2-rgba8unorm-srgb":{gl:37495,f:cf},"eac-r11unorm":{gl:37488,f:cf},"eac-r11snorm":{gl:37489,f:cf},"eac-rg11unorm":{gl:37490,f:cf},"eac-rg11snorm":{gl:37491,f:cf},"astc-4x4-unorm":{gl:37808,f:ns},"astc-4x4-unorm-srgb":{gl:37840,f:ns},"astc-5x4-unorm":{gl:37809,f:ns},"astc-5x4-unorm-srgb":{gl:37841,f:ns},"astc-5x5-unorm":{gl:37810,f:ns},"astc-5x5-unorm-srgb":{gl:37842,f:ns},"astc-6x5-unorm":{gl:37811,f:ns},"astc-6x5-unorm-srgb":{gl:37843,f:ns},"astc-6x6-unorm":{gl:37812,f:ns},"astc-6x6-unorm-srgb":{gl:37844,f:ns},"astc-8x5-unorm":{gl:37813,f:ns},"astc-8x5-unorm-srgb":{gl:37845,f:ns},"astc-8x6-unorm":{gl:37814,f:ns},"astc-8x6-unorm-srgb":{gl:37846,f:ns},"astc-8x8-unorm":{gl:37815,f:ns},"astc-8x8-unorm-srgb":{gl:37847,f:ns},"astc-10x5-unorm":{gl:37819,f:ns},"astc-10x5-unorm-srgb":{gl:37851,f:ns},"astc-10x6-unorm":{gl:37817,f:ns},"astc-10x6-unorm-srgb":{gl:37849,f:ns},"astc-10x8-unorm":{gl:37818,f:ns},"astc-10x8-unorm-srgb":{gl:37850,f:ns},"astc-10x10-unorm":{gl:37819,f:ns},"astc-10x10-unorm-srgb":{gl:37851,f:ns},"astc-12x10-unorm":{gl:37820,f:ns},"astc-12x10-unorm-srgb":{gl:37852,f:ns},"astc-12x12-unorm":{gl:37821,f:ns},"astc-12x12-unorm-srgb":{gl:37853,f:ns},"pvrtc-rgb4unorm-webgl":{gl:35840,f:Yb},"pvrtc-rgba4unorm-webgl":{gl:35842,f:Yb},"pvrtc-rbg2unorm-webgl":{gl:35841,f:Yb},"pvrtc-rgba2unorm-webgl":{gl:35843,f:Yb},"etc1-rbg-unorm-webgl":{gl:36196,f:YJ},"atc-rgb-unorm-webgl":{gl:35986,f:_M},"atc-rgba-unorm-webgl":{gl:35986,f:_M},"atc-rgbai-unorm-webgl":{gl:34798,f:_M}},rQ={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},iQ={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function Qb(t,e,r){let i=Jb[e];if(!i||i.gl===void 0)return!1;let n=i.x||i.gl2ext;return n?Boolean(Su(t,n,r)):!0}function bM(t){let r=Jb[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}function FN(t,e,r){if(!Qb(t,e,r)||e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(Nb(e).signed)return!1}catch{return!1}return e.endsWith("32float")?Boolean(Su(t,"OES_texture_float_linear, extensions",r)):e.endsWith("16float")?Boolean(Su(t,"OES_texture_half_float_linear, extensions",r)):!0}function NN(t,e,r){return!(!Qb(t,e,r)||typeof e=="number")}function kg(t){let e=Jb[t],r=bM(t),i=Nb(t);return{format:r,dataFormat:e?.dataFormat||nQ(i.format,i.integer,i.normalized,r),type:i.dataType?Xb(i.dataType):e?.types?.[0]||5121,compressed:i.compressed}}function kN(t){let e=Jb[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}function wM(t){let e=kg(t),r=rQ[e.dataFormat]||4,i=iQ[e.type]||1;return r*i}function nQ(t,e,r,i){if(i===6408||i===6407)return i;switch(t){case"r":return e&&!r?36244:6403;case"rg":return e&&!r?33320:33319;case"rgb":return e&&!r?36248:6407;case"rgba":return e&&!r?36249:6408;default:return 6408}}var UN={"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"},$b=class extends Sy{gl;extensions;testedFeatures=new Set;constructor(e,r,i){super([],i),this.gl=e,this.extensions=r,Su(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){for(let e of Object.keys(UN))this.has(e)&&(yield e);for(let e of Object.keys(Zb))this.has(e)&&(yield e);return[]}has(e){return this.disabledFeatures[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),DN(e)&&LN(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){for(let e of this);}getWebGLFeature(e){let r=UN[e];return Boolean(typeof r=="string"?Su(this.gl,r,this.extensions):r)}};var ew=class extends Ey{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]}};function Cu(t,e,r){if(oQ(e))return r(t);let{nocatch:i=!0}=e;tp(t),lh(t,e);let n;if(i)n=r(t),ed(t);else try{n=r(t)}finally{ed(t)}return n}function oQ(t){for(let e in t)return!1;return!0}function VN(t,e,r,i){if(Zd(e))return i(t);let n=t;tp(n.gl);try{return sQ(t,e),lh(n.gl,r),i(t)}finally{ed(n.gl)}}function sQ(t,e){let r=t,{gl:i}=r;if(e.cullMode)switch(e.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029);break}if(e.frontFace&&i.frontFace(AA("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&i.enable(34383),e.depthBias!==void 0&&i.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0),t.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex;if(e.provokingVertex){let a=AA("provokingVertex",e.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(a)}}if(t.features.has("polygon-mode-webgl")){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode;if(e.polygonMode){let a=AA("polygonMode",e.provokingVertex,{fill:6914,lint:6913});o?.polygonModeWEBGL(1028,a),o?.polygonModeWEBGL(1029,a)}e.polygonOffsetLine&&i.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&i.enable(12288),e.clipDistance1&&i.enable(12289),e.clipDistance2&&i.enable(12290),e.clipDistance3&&i.enable(12291),e.clipDistance4&&i.enable(12292),e.clipDistance5&&i.enable(12293),e.clipDistance6&&i.enable(12294),e.clipDistance7&&i.enable(12295)),e.depthWriteEnabled!==void 0&&i.depthMask(lQ("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?i.enable(2929):i.disable(2929),i.depthFunc(rw("depthCompare",e.depthCompare))),e.stencilWriteMask){let n=e.stencilWriteMask;i.stencilMaskSeparate(1028,n),i.stencilMaskSeparate(1029,n)}if(e.stencilReadMask&&ar.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let n=e.stencilReadMask||4294967295,o=rw("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,o,0,n),i.stencilFuncSeparate(1029,o,0,n)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let n=TM("stencilPassOperation",e.stencilPassOperation),o=TM("stencilFailOperation",e.stencilFailOperation),a=TM("stencilDepthFailOperation",e.stencilDepthFailOperation);i.stencilOpSeparate(1028,o,a,n),i.stencilOpSeparate(1029,o,a,n)}if(e.blendColorOperation||e.blendAlphaOperation){i.enable(3042);let n=zN("blendColorOperation",e.blendColorOperation||"add"),o=zN("blendAlphaOperation",e.blendAlphaOperation||"add");i.blendEquationSeparate(n,o);let a=tw("blendColorSrcFactor",e.blendColorSrcFactor||"one"),l=tw("blendColorDstFactor",e.blendColorDstFactor||"zero"),u=tw("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),f=tw("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");i.blendFuncSeparate(a,l,u,f)}}function rw(t,e){return AA(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function TM(t,e){return AA(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function zN(t,e){return AA(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function tw(t,e){return AA(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773})}function aQ(t,e){return`Illegal parameter ${e} for ${t}`}function AA(t,e,r){if(!(e in r))throw new Error(aQ(t,e));return r[e]}function lQ(t,e){return e}function iw(t){let e={};return t.addressModeU&&(e[10242]=EM(t.addressModeU)),t.addressModeV&&(e[10243]=EM(t.addressModeV)),t.addressModeW&&(e[32882]=EM(t.addressModeW)),t.magFilter&&(e[10240]=HN(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=cQ(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=rw("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function EM(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function HN(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function cQ(t,e){if(!e)return HN(t);switch(t){case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var lc=class extends cn{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let i=typeof r=="object"?r.handle:void 0;this.handle=i||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=uQ(this.props.usage),this.glUsage=hQ(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(e,r=0,i=e.byteLength+r){let n=this.glTarget;this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.glUsage),this.gl.bufferSubData(n,r,e),this.gl.bindBuffer(n,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(e,r,i),this.trackAllocatedMemory(i)}_initWithByteLength(e){un(e>=0);let r=e;e===0&&(r=new Float32Array(0));let i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let i=new Uint8Array(r),n=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,i,n,r),this.gl.bindBuffer(36662,null),this._setDebugData(i,e,r),i}};function uQ(t){return t&cn.INDEX?34963:t&cn.VERTEX?34962:t&cn.UNIFORM?35345:34962}function hQ(t){return t&cn.INDEX||t&cn.VERTEX?35044:t&cn.UNIFORM?35048:35044}var mA=class extends ep{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=iw(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,i]of Object.entries(e)){let n=Number(r);switch(n){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,n,i);break;default:this.device.gl.samplerParameteri(this.handle,n,i);break}}}};var ch=class extends Qd{device;gl;handle;texture;constructor(e,r){super(e,{...Vo.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var fQ={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},nw=class extends Vo{MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(e,r){super(e,{...fQ,format:"rgba8unorm",...r}),this.device=e,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=dQ(this.props),this.loaded=!1,typeof this.props?.data=="string"&&Object.assign(this.props,{data:uM(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(e){return new ch(this.device,{...e,texture:this})}initialize(e={}){if(this.props.dimension==="cube")return this.initializeCube(e);let r=e.data;if(r instanceof Promise)return r.then(V=>this.initialize(Object.assign({},e,{pixels:V,data:V}))),this;let i=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(i&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(e)),this;let{parameters:n={}}=e,{pixels:o=null,pixelStore:a={},textureUnit:l=void 0,mipmaps:u=!0}=e;r||(r=o);let{width:f,height:_,dataFormat:w,type:E,compressed:M=!1}=e,{depth:D=0}=e,j=bM(e.format);return{width:f,height:_,compressed:M,dataFormat:w,type:E}=this._deduceParameters({format:e.format,type:E,dataFormat:w,compressed:M,data:r,width:f,height:_}),this.width=f,this.height=_,this.glFormat=j,this.type=E,this.dataFormat=w,this.textureUnit=l,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=u,this.setImageData({data:r,width:f,height:_,depth:D,format:j,type:E,dataFormat:w,parameters:a,compressed:M}),this.setSampler(e.sampler),this._setSamplerParameters(n),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),u&&this.device.isTextureFormatFilterable(e.format)&&this.generateMipmap(),i&&(this._video={video:r,parameters:n,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(e){let{mipmaps:r=!0,parameters:i={}}=e;return this.setCubeMapImageData(e).then(()=>{this.loaded=!0,r&&this.generateMipmap(e),this.setSampler(e.sampler),this._setSamplerParameters(i)}),this}setSampler(e={}){let r;e instanceof mA?(this.sampler=e,r=e.props):(this.sampler=new mA(this.device,e),r=e);let i=iw(r);return this._setSamplerParameters(i),this}resize(e){let{height:r,width:i,mipmaps:n=!1}=e;return i!==this.width||r!==this.height?this.initialize({width:i,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:n}):this}update(){if(this._video){let{video:e,parameters:r,lastTime:i}=this._video;if(i===e.currentTime||e.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:e,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=e.currentTime}}generateMipmap(e={}){return this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Cu(this.gl,e,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this}setImageData(e){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(e);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:i=null,level:n=0,glFormat:o=this.glFormat,offset:a=0,parameters:l={}}=e,{data:u=null,type:f=this.type,width:_=this.width,height:w=this.height,dataFormat:E=this.dataFormat,compressed:M=!1}=e;u||(u=i),{type:f,dataFormat:E,compressed:M,width:_,height:w}=this._deduceParameters({format:this.props.format,type:f,dataFormat:E,compressed:M,data:u,width:_,height:w});let{gl:D}=this;D.bindTexture(this.target,this.handle);let j=null;if({data:u,dataType:j}=this._getDataType({data:u,compressed:M}),Cu(this.gl,l,()=>{switch(j){case"null":D.texImage2D(r,n,o,_,w,0,E,f,u);break;case"typed-array":D.texImage2D(r,n,o,_,w,0,E,f,u,a);break;case"buffer":this.device.gl.bindBuffer(35052,u.handle||u),this.device.gl.texImage2D(r,n,o,_,w,0,E,f,a),this.device.gl.bindBuffer(35052,null);break;case"browser-object":D.texImage2D(r,n,o,_,w,0,E,f,u);break;case"compressed":for(let[V,$]of u.entries())D.compressedTexImage2D(r,V,$.format,$.width,$.height,0,$.data);break;default:un(!1,"Unknown image data type")}}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let V=wM(this.props.format);this.trackAllocatedMemory(this.width*this.height*V,"Texture")}return this.loaded=!0,this}setSubImageData({target:e=this.target,pixels:r=null,data:i=null,x:n=0,y:o=0,width:a=this.width,height:l=this.height,level:u=0,glFormat:f=this.glFormat,type:_=this.type,dataFormat:w=this.dataFormat,compressed:E=!1,offset:M=0,parameters:D={}}){if({type:_,dataFormat:w,compressed:E,width:a,height:l}=this._deduceParameters({format:this.props.format,type:_,dataFormat:w,compressed:E,data:i,width:a,height:l}),un(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=r),i&&i.data){let j=i;i=j.data,a=j.shape[0],l=j.shape[1]}i instanceof lc&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Cu(this.gl,D,()=>{E?this.gl.compressedTexSubImage2D(e,u,n,o,a,l,f,i):i===null?this.gl.texSubImage2D(e,u,n,o,a,l,w,_,null):ArrayBuffer.isView(i)?this.gl.texSubImage2D(e,u,n,o,a,l,w,_,i,M):typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer?(this.device.gl.bindBuffer(35052,i),this.device.gl.texSubImage2D(e,u,n,o,a,l,w,_,M),this.device.gl.bindBuffer(35052,null)):this.device.gl.texSubImage2D(e,u,n,o,a,l,w,_,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(e={}){return ar.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,this.handle),e}unbind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,null),e}_getDataType({data:e,compressed:r=!1}){return r?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof lc?{data:e.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(e){let{format:r,data:i}=e,{width:n,height:o,dataFormat:a,type:l,compressed:u}=e,f=kg(r);return a=a||f.dataFormat,l=l||f.type,u=u||f.compressed,{width:n,height:o}=this._deduceImageSize(i,n,o),{dataFormat:a,type:l,compressed:u,width:n,height:o,format:r,data:i}}_deduceImageSize(e,r,i){let n;return typeof ImageData<"u"&&e instanceof ImageData?n={width:e.width,height:e.height}:typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?n={width:e.naturalWidth,height:e.naturalHeight}:typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement?n={width:e.width,height:e.height}:typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n={width:e.width,height:e.height}:typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?n={width:e.videoWidth,height:e.videoHeight}:e?n={width:r,height:i}:n={width:r>=0?r:1,height:i>=0?i:1},un(n,"Could not deduced texture size"),un(r===void 0||n.width===r,"Deduced texture width does not match supplied width"),un(i===void 0||n.height===i,"Deduced texture height does not match supplied height"),n}async setCubeMapImageData(e){let{gl:r}=this,{width:i,height:n,pixels:o,data:a,format:l=6408,type:u=5121}=e,f=o||a,_=await Promise.all(nw.FACES.map(w=>{let E=f[w];return Promise.all(Array.isArray(E)?E:[E])}));this.bind(),nw.FACES.forEach((w,E)=>{_[E].length>1&&this.props.mipmaps!==!1&&ar.warn(`${this.id} has mipmap and multiple LODs.`)(),_[E].forEach((M,D)=>{i&&n?r.texImage2D(w,D,l,i,n,0,l,u,M):r.texImage2D(w,D,l,l,u,M)})}),this.unbind()}setImageDataForFace(e){let{face:r,width:i,height:n,pixels:o,data:a,format:l=6408,type:u=5121}=e,{gl:f}=this,_=o||a;return this.bind(),_ instanceof Promise?_.then(w=>this.setImageDataForFace(Object.assign({},e,{face:r,data:w,pixels:w}))):this.width||this.height?f.texImage2D(r,0,l,i,n,0,l,u,_):f.texImage2D(r,0,l,l,u,_),this}setImageData3D(e){let{level:r=0,dataFormat:i,format:n,type:o,width:a,height:l,depth:u=1,offset:f=0,data:_,parameters:w={}}=e;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let E=kg(n);if(Cu(this.gl,w,()=>{ArrayBuffer.isView(_)&&this.gl.texImage3D(this.target,r,E.format,a,l,u,0,E.dataFormat,E.type,_),_ instanceof lc&&(this.gl.bindBuffer(35052,_.handle),this.gl.texImage3D(this.target,r,i,a,l,u,0,n,o,f))}),_&&_.byteLength)this.trackAllocatedMemory(_.byteLength,"Texture");else{let M=wM(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*M,"Texture")}return this.loaded=!0,this}_setSamplerParameters(e){if(!Zd(e)){pQ(e),this.gl.bindTexture(this.target,this.handle);for(let[r,i]of Object.entries(e)){let n=Number(r),o=i;switch(n){case 33082:case 33083:this.gl.texParameterf(this.target,n,o);break;default:this.gl.texParameteri(this.target,n,o);break}}this.gl.bindTexture(this.target,null)}}},cc=nw;yi(cc,"FACES",[34069,34070,34071,34072,34073,34074]);function dQ(t){switch(t.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(t.dimension)}}function pQ(t){ar.log(1,"texture sampler parameters",t)()}var uf=class extends sf{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(e,r){super(e,r);let i=r.handle===null;if(this.device=e,this.gl=e.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),!i){e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.gl.bindFramebuffer(36160,this.handle);for(let n=0;n<this.colorAttachments.length;++n){let o=this.colorAttachments[n],a=36064+n;o&&this._attachOne(a,o)}if(this.depthStencilAttachment&&this._attachOne(kN(this.depthStencilAttachment.props.format),this.depthStencilAttachment),r.check!==!1){let n=this.gl.checkFramebufferStatus(36160);if(n!==36053)throw new Error(`Framebuffer ${mQ(n)}`)}this.gl.bindFramebuffer(36160,null)}}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}createDepthStencilTexture(e){return new cc(this.device,{id:`${this.id}-depth-stencil`,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;e===void 0&&(e=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let i of this.colorAttachments)i.texture.resize({width:e,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.texture.resize({width:e,height:r}),this}_attachOne(e,r){if(Array.isArray(r)){let[i,n=0,o=0]=r;return this._attachTexture(e,i,n,o),i}if(r instanceof cc)return this._attachTexture(e,r,0,0),r;if(r instanceof ch){let i=r;return this._attachTexture(e,i.texture,i.props.baseMipLevel,i.props.baseArrayLayer),r.texture}throw new Error("attach")}_attachTexture(e,r,i,n){let{gl:o}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:o.framebufferTextureLayer(36160,e,r.target,n,i);break;case 34067:let a=AQ(i);o.framebufferTexture2D(36160,e,a,r.handle,n);break;case 3553:o.framebufferTexture2D(36160,e,3553,r.handle,n);break;default:un(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function AQ(t){return t<34069?t+34069:t}function mQ(t){switch(t){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${t}`}}var ow=class extends Jd{device;presentationSize;_framebuffer=null;constructor(e,r){super(r),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new uf(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(r,e);return}}commit(){}};var gQ={spector:ar.get("spector")||ar.get("inspect")},_Q="https://spectorcdn.babylonjs.com/spector.bundle.js",yQ=1,Cc=null,jN=!1;async function GN(t){if(!globalThis.SPECTOR)try{await Py(_Q)}catch(e){ar.warn(String(e))}}function WN(t){if(t={...gQ,...t},!t?.spector||(!Cc&&globalThis.SPECTOR&&(ar.probe(yQ,"SPECTOR found and initialized")(),Cc=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=Cc)),!Cc))return null;if(jN||(jN=!0,Cc.spyCanvases(),Cc?.onCaptureStarted.add(e=>ar.info("Spector capture started:",e)()),Cc?.onCapture.add(e=>{ar.info("Spector capture complete:",e)(),Cc?.getResultUI(),Cc?.resultView.display(),Cc?.resultView.addCapture(e)})),t?.canvas){if(typeof t.spector=="string"&&t.spector!==t.canvas.id)return Cc;Cc?.startCapture(t?.canvas,500),new Promise(e=>setTimeout(e,2e3)).then(e=>{ar.info("Spector capture stopped after 2 seconds")(),Cc?.stopCapture()})}return Cc}var vQ="https://unpkg.com/webgl-debug@2.0.1/index.js";function qN(t){return t.luma=t.luma||{},t.luma}async function XN(){jl()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await Py(vQ))}function YN(t,e={}){return t?e.debug?bQ(t,e):xQ(t):null}function xQ(t){let e=qN(t);return e.realContext?e.realContext:t}function bQ(t,e){if(!globalThis.WebGLDebugUtils)return ar.warn("webgl-debug not loaded")(),t;let r=qN(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...af,...t});let i=globalThis.WebGLDebugUtils.makeDebugContext(t,wQ.bind(null,e),TQ.bind(null,e));for(let a in af)!(a in i)&&typeof af[a]=="number"&&(i[a]=af[a]);class n{}Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.setPrototypeOf(n,i);let o=Object.create(n);return r.realContext=t,r.debugContext=o,o.debug=!0,o}function SM(t,e){e=Array.from(e).map(i=>i===void 0?"undefined":i);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function wQ(t,e,r,i){i=Array.from(i).map(l=>l===void 0?"undefined":l);let n=globalThis.WebGLDebugUtils.glEnumToString(e),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,i),a=`${n} in gl.${r}(${o})`;ar.error(a)();debugger;if(t.throwOnError)throw new Error(a)}function TQ(t,e,r){let i="";if(ar.level>=1&&(i=SM(e,r),ar.log(1,i)()),t.break&&t.break.length>0&&(i=i||SM(e,r),t.break.every(o=>i.indexOf(o)!==-1)))debugger;for(let n of r)if(n===void 0){if(i=i||SM(e,r),t.throwOnError)throw new Error(`Undefined argument: ${i}`);ar.error(`Undefined argument: ${i}`)();debugger}}function ZN(t){let e=t.split(/\r?\n/),r=[];for(let i of e){if(i.length<=1)continue;let n=i.split(":");if(n.length===2){let[w,E]=n;r.push({message:E.trim(),type:KN(w),lineNum:0,linePos:0});continue}let[o,a,l,...u]=n,f=parseInt(l,10);isNaN(f)&&(f=0);let _=parseInt(a,10);isNaN(_)&&(_=0),r.push({message:u.join(":").trim(),type:KN(o),lineNum:f,linePos:_})}return r}function KN(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var sw=class extends $d{device;handle;constructor(e,r){switch(super(e,r),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return ZN(e)}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)}async _compile(e){e=(n=>n.startsWith("#version ")?n:`#version 100
|
|
552
|
-
${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),ar.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);this.debugShader();return}ar.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),ar.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var EQ=256,SQ=1024,CQ=16384,CM=6144,aw=class extends Pg{device;glParameters;constructor(e,r){super(e,r),this.device=e,tp(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){ed(this.device.gl),this.props.framebuffer&&lh(this.device.gl,{framebuffer:null})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),r.scissorTest=Boolean(e.scissorRect),e.scissorRect&&(r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),this.glParameters=r,lh(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=CQ,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=EQ,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=SQ,e.clearStencil=this.props.clearStencil),r!==0&&Cu(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Cu(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(CM,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(CM,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(CM,e,r);break}})}};var MQ="Failed to deduce GL constant from typed array";function JN(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(MQ)}}function Ny(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var IQ={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},PQ={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},rp=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return Ny(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return un(e.size),Ny(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new rp(IQ,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return rp.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return rp.getBytesPerVertex(this)}_assign(e={}){return e=cM("Accessor",e,PQ),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function QN(t){return RQ.includes(t)}var RQ=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],$N={[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 MM(t){let e=$N[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function e4(t){let e=$N[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function t4(t,e){let r={attributes:[],bindings:[]};r.attributes=BQ(t,e);let i=LQ(t,e);for(let l of i){let u=l.uniforms.map(f=>({name:f.name,format:f.format,byteOffset:f.byteOffset,byteStride:f.byteStride,arrayLength:f.arrayLength}));r.bindings.push({type:"uniform",name:l.name,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:u})}let n=DQ(t,e),o=0;for(let l of n)if(QN(l.type)){let{viewDimension:u,sampleType:f}=NQ(l.type);r.bindings.push({type:"texture",name:l.name,location:o,viewDimension:u,sampleType:f}),l.textureUnit=o,o+=1}n.length&&(r.uniforms=n);let a=OQ(t,e);return a?.length&&(r.varyings=a),r}function BQ(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n<i;n++){let o=t.getActiveAttrib(e,n);if(!o)throw new Error("activeInfo");let{name:a,type:l}=o,u=t.getAttribLocation(e,a);if(u>=0){let{attributeType:f}=e4(l),_=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:u,stepMode:_,type:f})}}return r.sort((n,o)=>n.location-o.location),r}function OQ(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;n<i;n++){let o=t.getTransformFeedbackVarying(e,n);if(!o)throw new Error("activeInfo");let{name:a,type:l,size:u}=o,{glType:f,components:_}=MM(l),w=new rp({type:f,size:u*_}),E={location:n,name:a,accessor:w};r.push(E)}return r.sort((n,o)=>n.location-o.location),r}function DQ(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n<i;n++){let o=t.getActiveUniform(e,n);if(!o)throw new Error("activeInfo");let{name:a,size:l,type:u}=o,{name:f,isArray:_}=kQ(a),w=t.getUniformLocation(e,f),E={location:w,name:f,size:l,type:u,isArray:_};if(r.push(E),E.size>1)for(let M=0;M<E.size;M++){let D=`${f}[${M}]`;w=t.getUniformLocation(e,D);let j={...E,name:D,location:w};r.push(j)}}return r}function LQ(t,e){let r=(o,a)=>t.getActiveUniformBlockParameter(e,o,a),i=[],n=t.getProgramParameter(e,35382);for(let o=0;o<n;o++){let a={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},l=r(o,35395)||[],u=t.getActiveUniforms(e,l,35383),f=t.getActiveUniforms(e,l,35384),_=t.getActiveUniforms(e,l,35387),w=t.getActiveUniforms(e,l,35388);for(let E=0;E<a.uniformCount;++E){let M=t.getActiveUniform(e,l[E]);if(!M)throw new Error("activeInfo");a.uniforms.push({name:M.name,format:MM(u[E]).format,type:u[E],arrayLength:f[E],byteOffset:_[E],byteStride:w[E]})}i.push(a)}return i.sort((o,a)=>o.location-a.location),i}var FQ={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function NQ(t){let e=FQ[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function kQ(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function r4(t,e,r,i){let n=t,o=i;o===!0&&(o=1),o===!1&&(o=0);let a=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,a);case 35664:return t.uniform2fv(e,a);case 35665:return t.uniform3fv(e,a);case 35666:return t.uniform4fv(e,a);case 5124:return t.uniform1iv(e,a);case 35667:return t.uniform2iv(e,a);case 35668:return t.uniform3iv(e,a);case 35669:return t.uniform4iv(e,a);case 35670:return t.uniform1iv(e,a);case 35671:return t.uniform2iv(e,a);case 35672:return t.uniform3iv(e,a);case 35673:return t.uniform4iv(e,a);case 5125:return n.uniform1uiv(e,a,1);case 36294:return n.uniform2uiv(e,a,2);case 36295:return n.uniform3uiv(e,a,3);case 36296:return n.uniform4uiv(e,a,4);case 35674:return t.uniformMatrix2fv(e,!1,a);case 35675:return t.uniformMatrix3fv(e,!1,a);case 35676:return t.uniformMatrix4fv(e,!1,a);case 35685:return n.uniformMatrix2x3fv(e,!1,a);case 35686:return n.uniformMatrix2x4fv(e,!1,a);case 35687:return n.uniformMatrix3x2fv(e,!1,a);case 35688:return n.uniformMatrix3x4fv(e,!1,a);case 35689:return n.uniformMatrix4x2fv(e,!1,a);case 35690:return n.uniformMatrix4x3fv(e,!1,a)}throw new Error("Illegal uniform")}function i4(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function n4(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var o4=4,lw=class extends ah{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),ar.time(0,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=t4(this.device.gl,this.handle),ar.timeEnd(0,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=rM(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":ar.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e){for(let[r,i]of Object.entries(e)){let n=this.shaderLayout.bindings.find(o=>o.name===r)||this.shaderLayout.bindings.find(o=>o.name===`${r}Uniforms`);if(!n){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");ar.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(i||ar.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),n.type){case"uniform":if(!(i instanceof lc)&&!(i.buffer instanceof lc))throw new Error("buffer value");break;case"texture":if(!(i instanceof ch||i instanceof cc||i instanceof uf))throw new Error("texture value");break;case"sampler":ar.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(n.type)}this.bindings[r]=i}}draw(e){let{renderPass:r,vertexArray:i,vertexCount:n,instanceCount:o,firstVertex:a=0,transformFeedback:l}=e,u=i4(this.props.topology),f=Boolean(i.indexBuffer),_=i.indexBuffer?.glIndexType,w=Number(o)>0;if(this.linkStatus!=="success")return ar.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||n===0)return ar.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(n===0)return ar.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),i.bindBeforeRender(r),l&&l.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let E=r;return VN(this.device,this.props.parameters,E.glParameters,()=>{f&&w?this.device.gl.drawElementsInstanced(u,n||0,_,a,o||0):f?this.device.gl.drawElements(u,n||0,_,a):w?this.device.gl.drawArraysInstanced(u,a,n||0,o||0):this.device.gl.drawArrays(u,a,n||0),l&&l.end()}),i.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=Iy(e);Object.keys(r).forEach(i=>{ar.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),ar.time(o4,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),ar.timeEnd(o4,`linkProgram for ${this.id}`)(),ar.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}ar.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),ar.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof cc&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let o=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:a}=n,l=e.getUniformBlockIndex(this.handle,a);if(l===4294967295)throw new Error(`Invalid uniform block name ${a}`);e.uniformBlockBinding(this.handle,i,l),o instanceof lc?e.bindBufferBase(35345,i,o.handle):e.bindBufferRange(35345,i,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),i+=1;break;case"texture":if(!(o instanceof ch||o instanceof cc||o instanceof uf))throw new Error("texture");let u;if(o instanceof ch)u=o.texture;else if(o instanceof cc)u=o;else if(o instanceof uf&&o.colorAttachments[0]instanceof ch)ar.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(u.target,u.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:o}=e,a=this.uniforms[r]??o;a!==void 0&&r4(this.device.gl,i,n,a)}}};var cw=class extends Bg{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":UQ(this.device,r.options);break;case"copy-buffer-to-texture":zQ(this.device,r.options);break;case"copy-texture-to-buffer":VQ(this.device,r.options);break;case"copy-texture-to-texture":HQ(this.device,r.options);break}}};function UQ(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function zQ(t,e){throw new Error("Not implemented")}function VQ(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:o=e.source.width,height:a=e.source.height,depthOrArrayLayers:l=0,origin:u=[0,0],destination:f,byteOffset:_=0,bytesPerRow:w,rowsPerImage:E}=e;if(n!=="all")throw new Error("not supported");if(i!==0||l!==0||w||E)throw new Error("not implemented");let{framebuffer:M,destroyFramebuffer:D}=s4(r);try{let j=f,V=o||M.width,$=a||M.height,te=kg(M.texture.props.format),ne=te.dataFormat,le=te.type;t.gl.bindBuffer(35051,j.handle),t.gl.bindFramebuffer(36160,M.handle),t.gl.readPixels(u[0],u[1],V,$,ne,le,_)}finally{t.gl.bindBuffer(35051,null),t.gl.bindFramebuffer(36160,null),D&&M.destroy()}}function HQ(t,e){let{source:r,origin:i=[0,0],destination:n}=e,{width:o=e.destination.width,height:a=e.destination.width}=e,l=0,u=6408,{framebuffer:f,destroyFramebuffer:_}=s4(r),[w,E]=i,M=!1;t.gl.bindFramebuffer(36160,f.handle);let D=null,j;if(n instanceof cc)D=n,o=Number.isFinite(o)?o:D.width,a=Number.isFinite(a)?a:D.height,D.bind(0),j=D.destination;else throw new Error("whoops");return M||t.gl.copyTexImage2D(j,l,u,w,E,o,a,0),D&&D.unbind(),_&&f.destroy(),D}function s4(t){if(t instanceof Vo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var uw=class extends Rg{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new cw(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var Ug=class extends Og{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return RC()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r}setBuffer(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:o,stride:a,offset:l,normalized:u,integer:f,divisor:_}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),f?this.device.gl.vertexAttribIPointer(e,n,o,a,l):this.device.gl.vertexAttribPointer(e,n,o,u,a,l),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,_||0),this.attributes[e]=i}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}init=!1;bindBeforeRender(){if(this.device.gl.bindVertexArray(this.handle),!this.init){let e=this.indexBuffer;this.device.gl.bindBuffer(34963,e?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let i=Xb(r.bufferDataType);return{size:r.bufferComponents,type:i,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let n=Ug.isConstantAttributeZeroSupported(this.device)||e!==0;(r||n)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let i=jQ(r),n=i.byteLength*e,o=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let a=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),a=a||!GQ(i,this.bufferValue),a){let l=sM(r.constructor,o);aM({target:l,source:i,start:0,count:o}),this.buffer.write(l),this.bufferValue=r}return this.buffer}};function jQ(t){return Array.isArray(t)?new Float32Array(t):t}function GQ(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var hw=class extends Dg{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(n4(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:o,byteOffset:a}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,ar.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:o,byteOffset:a},this.bindOnUse||this._bindBuffer(i,n,a,o)}getBuffer(e){if(a4(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof lc)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(a4(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let o=r&&r.handle;!o||n===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,i,n)}};function a4(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var fw=class extends Lg{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let o=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};function IM(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return un(!1),0}}function l4(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return un(!1),0}}function c4(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:o=36064}=e||{},{target:a=null,sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:_,deleteFramebuffer:w}=h4(t);un(_);let{gl:E,handle:M}=_;l=l||_.width,u=u||_.height;let D=o-36064;f=f||_.colorAttachments[D]?.texture?.type||5121,a=qQ(a,f,n,l,u),f=f||JN(a);let j=E.bindFramebuffer(36160,M);return E.readPixels(r,i,l,u,n,f,a),E.bindFramebuffer(36160,j||null),w&&_.destroy(),a}function u4(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:o=6408,targetByteOffset:a=0}=e||{},{sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:_,deleteFramebuffer:w}=h4(t);un(_),l=l||_.width,u=u||_.height;let E=_;f=f||5121;let M=r;if(!M){let j=IM(o),V=l4(f),$=a+l*u*j*V;M=E.device.createBuffer({byteLength:$})}let D=t.device.createCommandEncoder();return D.copyTextureToBuffer({source:t,width:l,height:u,origin:[i,n],destination:M,byteOffset:a}),D.destroy(),w&&_.destroy(),M}function h4(t){return t instanceof sf?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:WQ(t),deleteFramebuffer:!0}}function WQ(t,e){let{device:r,width:i,height:n,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:i,height:n,colorAttachments:[t]})}function qQ(t,e,r,i,n){if(t)return t;e=e||5121;let o=Ny(e,{clamped:!1}),a=IM(r);return new o(i*n*a)}var XQ=256,YQ=1024,KQ=16384;var ZQ="clear: bad arguments";function f4(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:o=null}=e||{},a={};r&&(a.framebuffer=r);let l=0;i&&(l|=KQ,i!==!0&&(a.clearColor=i)),n&&(l|=XQ,n!==!0&&(a.clearDepth=n)),o&&(l|=YQ,n!==!0&&(a.clearStencil=n)),un(l!==0,ZQ);let u=t.gl;Cu(u,a,()=>{u.clear(l)})}var ky=1,zg=class extends qc{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof zg)return e;if(e?.device instanceof qc)return e.device;if(!JQ(e))throw new Error("Invalid WebGL2RenderingContext");return new zg({gl:e})}static async create(e={}){ar.groupCollapsed(ky,"WebGLDevice created")();let r=[];e.debug&&r.push(XN()),e.spector&&r.push(GN()),typeof e.canvas=="string"&&r.push(Jd.pageLoaded);let i=await Promise.allSettled(r);for(let a of i)a.status==="rejected"&&ar.error(`Failed to initialize debug libraries ${a.reason}`)();if(ar.probe(ky+1,"DOM is loaded")(),e.gl?.device)return ar.warn("reattaching existing device")(),zg.attach(e.gl);let n=new zg(e),o=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return ar.probe(ky,o)(),ar.table(ky,n.info)(),ar.groupEnd(ky)(),n}constructor(e){super({...e,id:e.id||ma("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new ow(this,{...e,canvas:i}),this.lost=new Promise(l=>{this._resolveContextLost=l});let n=e.gl||null;if(n||=MN(this.canvasContext.canvas,{...e,onContextLost:l=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,this.info=IN(this.gl,this._extensions),this.limits=new ew(this.gl),this.features=new $b(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:o=!0,copyState:a=!1}=e;gM(this.gl,{enable:o,copyState:a,log:(...l)=>ar.log(1,...l)()}),e.debug&&(this.gl=YN(this.gl,{...e,throwOnError:!0}),this.debug=!0,ar.level=Math.max(ar.level,1),ar.warn("WebGL debug mode activated. Performance reduced.")()),e.spector&&(this.spectorJS=WN({...this.props,canvas:this.handle.canvas}))}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return Qb(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return FN(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return NN(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new lc(this,r)}_createTexture(e){return new cc(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new mA(this,e)}createShader(e){return new sw(this,e)}createFramebuffer(e){return new uf(this,e)}createVertexArray(e){return new Ug(this,e)}createTransformFeedback(e){return new hw(this,e)}createQuerySet(e){return new fw(this,e)}createRenderPipeline(e){return new lw(this,e)}beginRenderPass(e){return new aw(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 uw(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return c4(e,r)}readPixelsToBufferWebGL(e,r){return u4(e,r)}setParametersWebGL(e){lh(this.gl,e)}getParametersWebGL(e){return qb(this.gl,e)}withParametersWebGL(e,r){Cu(this.gl,e,r)}clearWebGL(e){f4(this,e)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){tp(this.gl)}popState(){ed(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&t$(n,r)&&ar.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:QQ(this,e,r);break;case Int32Array:$Q(this,e,r);break;case Uint32Array:e$(this,e,r);break;default:un(!1)}}getExtension(e){return Su(this.gl,e,this._extensions),this._extensions}},hf=zg;yi(hf,"type","webgl");function JQ(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function QQ(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:un(!1)}}function $Q(t,e,r){t.gl.vertexAttribI4iv(e,r)}function e$(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function t$(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var d4,p4,m4={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function dw(){return document.createElement("div")}function r$(t){if(!t.picked)return null;if(t.object===d4)return p4;let e={html:n$(t.object),style:m4};return p4=e,d4=t.object,e}var i$=new Set(["position","index"]);function n$(t){let e=dw();for(let r in t){if(i$.has(r))continue;let i=dw();i.className="header",i.textContent=r;let n=dw();n.className="value",n.textContent=s$(t[r]);let o=dw();o$(o,i,n),o.appendChild(i),o.appendChild(n),e.appendChild(o)}return e.innerHTML}function o$(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function s$(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function A4(t,e){let r,i=t,n="properties",o=/{[^}]*}/g,a=u=>u.replace(/[{}]/g,""),l=[...new Set(t.match(o).map(a))];for(let u of l){if(u.includes(".")){r=e;let f=u.split(".");for(let _ of f)if(r.hasOwnProperty(_))r=r[_];else{r=void 0;break}}else e.hasOwnProperty(u)?r=e[u]:e[n]&&e[n].hasOwnProperty(u)?r=e[n][u]:r=void 0;i=i.replaceAll(`{${u}}`,r)}return i}function PM(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||m4};return t.html?r.html=A4(t.html,e.object):r.text=A4(t.text,e.object),r}:r$:null}function g4(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function _4(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var v4=sc(y4()),a$="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",OM=v4.default;function x4(t=a$){g4(t)}function b4(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var DM={};function w4(t){if(!DM[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),DM[t]=new Promise(i=>{e.onload=i})}return DM[t]}var T4="4.2.0-alpha.4";var l$=globalThis.loaders?.parseImageNode,LM=typeof Image<"u",FM=typeof ImageBitmap<"u",c$=Boolean(l$),NM=$f?!0:c$;function E4(t){switch(t){case"auto":return FM||LM||NM;case"imagebitmap":return FM;case"image":return LM;case"data":return NM;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function S4(){if(FM)return"imagebitmap";if(LM)return"image";if(NM)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function C4(t){let e=u$(t);if(!e)throw new Error("Not an image");return e}function Uy(t){switch(C4(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function u$(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var h$=/^data:image\/svg\+xml/,f$=/\.svg((\?|#).*)?$/;function pw(t){return t&&(h$.test(t)||f$.test(t))}function M4(t,e){if(pw(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return kM(t,e)}function kM(t,e){if(pw(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function Aw(t,e,r){let i=M4(t,r),n=self.URL||self.webkitURL,o=typeof i!="string"&&n.createObjectURL(i);try{return await d$(o||i,e)}finally{o&&n.revokeObjectURL(o)}}async function d$(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=o=>{let a=o instanceof Error?o.message:"error";n(new Error(a))}}catch(o){n(o)}})}var p$={},I4=!0;async function P4(t,e,r){let i;pw(r)?i=await Aw(t,e,r):i=kM(t,r);let n=e&&e.imagebitmap;return await A$(i,n)}async function A$(t,e=null){if((m$(e)||!I4)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),I4=!1}return await createImageBitmap(t)}function m$(t){for(let e in t||p$)return!1;return!0}function R4(t){return!v$(t,"ftyp",4)||!(t[8]&96)?null:g$(t)}function g$(t){switch(_$(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function _$(t,e,r){return String.fromCharCode(...t.slice(e,r))}function y$(t){return[...t].map(e=>e.charCodeAt(0))}function v$(t,e,r=0){let i=y$(e);for(let n=0;n<i.length;++n)if(i[n]!==t[n+r])return!1;return!0}var ff=!1,zy=!0;function gA(t){let e=Vy(t);return b$(e)||E$(e)||w$(e)||T$(e)||x$(e)}function x$(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=R4(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function b$(t){let e=Vy(t);return e.byteLength>=24&&e.getUint32(0,ff)===2303741511?{mimeType:"image/png",width:e.getUint32(16,ff),height:e.getUint32(20,ff)}:null}function w$(t){let e=Vy(t);return e.byteLength>=10&&e.getUint32(0,ff)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,zy),height:e.getUint16(8,zy)}:null}function T$(t){let e=Vy(t);return e.byteLength>=14&&e.getUint16(0,ff)===16973&&e.getUint32(2,zy)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,zy),height:e.getUint32(22,zy)}:null}function E$(t){let e=Vy(t);if(!(e.byteLength>=3&&e.getUint16(0,ff)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=S$(),o=2;for(;o+9<e.byteLength;){let a=e.getUint16(o,ff);if(n.has(a))return{mimeType:"image/jpeg",height:e.getUint16(o+5,ff),width:e.getUint16(o+7,ff)};if(!i.has(a))return null;o+=2,o+=e.getUint16(o,ff)}return null}function S$(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Vy(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function B4(t,e){let{mimeType:r}=gA(t)||{},i=globalThis.loaders?.parseImageNode;return Xn(i),await i(t,r)}async function O4(t,e,r){e=e||{};let n=(e.image||{}).type||"auto",{url:o}=r||{},a=C$(n),l;switch(a){case"imagebitmap":l=await P4(t,e,o);break;case"image":l=await Aw(t,e,o);break;case"data":l=await B4(t,e);break;default:Xn(!1)}return n==="data"&&(l=Uy(l)),l}function C$(t){switch(t){case"auto":case"data":return S4();default:return E4(t),t}}var M$=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],I$=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],P$={image:{type:"auto",decode:!0}},df={id:"image",module:"images",name:"Images",version:T4,mimeTypes:I$,extensions:M$,parse:O4,tests:[t=>Boolean(gA(new DataView(t)))],options:P$};var UM={};function zM(t){if(UM[t]===void 0){let e=$f?B$(t):R$(t);UM[t]=e}return UM[t]}function R$(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,i=globalThis.loaders?.parseImageNode;return Boolean(i)&&r.includes(t)}function B$(t){switch(t){case"image/avif":case"image/webp":return O$(t);default:return!0}}function O$(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var D$=new Sc({id:"deck"}),br=D$;var VM={};function D4(t){VM=t}function ia(t,e,r,i){br.level>0&&VM[t]&&VM[t].call(null,e,r,i)}function L$(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var L4={id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:L$,parseTextSync:JSON.parse};function F$(){let t="9.0.0-beta.7",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(br.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:br,_registerLoggers:D4},hA([L4,[df,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var mw=F$();function pf(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var HM={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function N4(t){let e={};for(let[r,i]of Object.entries(t))e[r]=N$(i);return e}function k4(t,e,r){let i={};for(let[n,o]of Object.entries(e))t&&n in t&&!o.private?(o.validate&&pf(o.validate(t[n],o),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=o.value;return i}function N$(t){let e=F4(t);if(e!=="object")return{value:t,...HM[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...HM[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=F4(t.value),{...t,...HM[e],type:e}):{type:"object",value:null};throw new Error("props")}function F4(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var U4=`#ifdef MODULE_LOGDEPTH
|
|
552
|
+
${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),ar.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);this.debugShader();return}ar.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),ar.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var EQ=256,SQ=1024,CQ=16384,CM=6144,aw=class extends Pg{device;glParameters;constructor(e,r){super(e,r),this.device=e,tp(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){ed(this.device.gl),this.props.framebuffer&&lh(this.device.gl,{framebuffer:null})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),r.scissorTest=Boolean(e.scissorRect),e.scissorRect&&(r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),this.glParameters=r,lh(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=CQ,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=EQ,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=SQ,e.clearStencil=this.props.clearStencil),r!==0&&Cu(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Cu(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(CM,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(CM,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(CM,e,r);break}})}};var MQ="Failed to deduce GL constant from typed array";function JN(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(MQ)}}function Ny(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var IQ={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},PQ={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},rp=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return Ny(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return un(e.size),Ny(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new rp(IQ,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return rp.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return rp.getBytesPerVertex(this)}_assign(e={}){return e=cM("Accessor",e,PQ),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function QN(t){return RQ.includes(t)}var RQ=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],$N={[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 MM(t){let e=$N[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function e4(t){let e=$N[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function t4(t,e){let r={attributes:[],bindings:[]};r.attributes=BQ(t,e);let i=LQ(t,e);for(let l of i){let u=l.uniforms.map(f=>({name:f.name,format:f.format,byteOffset:f.byteOffset,byteStride:f.byteStride,arrayLength:f.arrayLength}));r.bindings.push({type:"uniform",name:l.name,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:u})}let n=DQ(t,e),o=0;for(let l of n)if(QN(l.type)){let{viewDimension:u,sampleType:f}=NQ(l.type);r.bindings.push({type:"texture",name:l.name,location:o,viewDimension:u,sampleType:f}),l.textureUnit=o,o+=1}n.length&&(r.uniforms=n);let a=OQ(t,e);return a?.length&&(r.varyings=a),r}function BQ(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n<i;n++){let o=t.getActiveAttrib(e,n);if(!o)throw new Error("activeInfo");let{name:a,type:l}=o,u=t.getAttribLocation(e,a);if(u>=0){let{attributeType:f}=e4(l),_=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:u,stepMode:_,type:f})}}return r.sort((n,o)=>n.location-o.location),r}function OQ(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;n<i;n++){let o=t.getTransformFeedbackVarying(e,n);if(!o)throw new Error("activeInfo");let{name:a,type:l,size:u}=o,{glType:f,components:_}=MM(l),w=new rp({type:f,size:u*_}),E={location:n,name:a,accessor:w};r.push(E)}return r.sort((n,o)=>n.location-o.location),r}function DQ(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n<i;n++){let o=t.getActiveUniform(e,n);if(!o)throw new Error("activeInfo");let{name:a,size:l,type:u}=o,{name:f,isArray:_}=kQ(a),w=t.getUniformLocation(e,f),E={location:w,name:f,size:l,type:u,isArray:_};if(r.push(E),E.size>1)for(let M=0;M<E.size;M++){let D=`${f}[${M}]`;w=t.getUniformLocation(e,D);let j={...E,name:D,location:w};r.push(j)}}return r}function LQ(t,e){let r=(o,a)=>t.getActiveUniformBlockParameter(e,o,a),i=[],n=t.getProgramParameter(e,35382);for(let o=0;o<n;o++){let a={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},l=r(o,35395)||[],u=t.getActiveUniforms(e,l,35383),f=t.getActiveUniforms(e,l,35384),_=t.getActiveUniforms(e,l,35387),w=t.getActiveUniforms(e,l,35388);for(let E=0;E<a.uniformCount;++E){let M=t.getActiveUniform(e,l[E]);if(!M)throw new Error("activeInfo");a.uniforms.push({name:M.name,format:MM(u[E]).format,type:u[E],arrayLength:f[E],byteOffset:_[E],byteStride:w[E]})}i.push(a)}return i.sort((o,a)=>o.location-a.location),i}var FQ={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function NQ(t){let e=FQ[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function kQ(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function r4(t,e,r,i){let n=t,o=i;o===!0&&(o=1),o===!1&&(o=0);let a=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,a);case 35664:return t.uniform2fv(e,a);case 35665:return t.uniform3fv(e,a);case 35666:return t.uniform4fv(e,a);case 5124:return t.uniform1iv(e,a);case 35667:return t.uniform2iv(e,a);case 35668:return t.uniform3iv(e,a);case 35669:return t.uniform4iv(e,a);case 35670:return t.uniform1iv(e,a);case 35671:return t.uniform2iv(e,a);case 35672:return t.uniform3iv(e,a);case 35673:return t.uniform4iv(e,a);case 5125:return n.uniform1uiv(e,a,1);case 36294:return n.uniform2uiv(e,a,2);case 36295:return n.uniform3uiv(e,a,3);case 36296:return n.uniform4uiv(e,a,4);case 35674:return t.uniformMatrix2fv(e,!1,a);case 35675:return t.uniformMatrix3fv(e,!1,a);case 35676:return t.uniformMatrix4fv(e,!1,a);case 35685:return n.uniformMatrix2x3fv(e,!1,a);case 35686:return n.uniformMatrix2x4fv(e,!1,a);case 35687:return n.uniformMatrix3x2fv(e,!1,a);case 35688:return n.uniformMatrix3x4fv(e,!1,a);case 35689:return n.uniformMatrix4x2fv(e,!1,a);case 35690:return n.uniformMatrix4x3fv(e,!1,a)}throw new Error("Illegal uniform")}function i4(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function n4(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var o4=4,lw=class extends ah{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),ar.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=t4(this.device.gl,this.handle),ar.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=rM(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":ar.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e){for(let[r,i]of Object.entries(e)){let n=this.shaderLayout.bindings.find(o=>o.name===r)||this.shaderLayout.bindings.find(o=>o.name===`${r}Uniforms`);if(!n){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");ar.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(i||ar.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),n.type){case"uniform":if(!(i instanceof lc)&&!(i.buffer instanceof lc))throw new Error("buffer value");break;case"texture":if(!(i instanceof ch||i instanceof cc||i instanceof uf))throw new Error("texture value");break;case"sampler":ar.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(n.type)}this.bindings[r]=i}}draw(e){let{renderPass:r,vertexArray:i,vertexCount:n,instanceCount:o,firstVertex:a=0,transformFeedback:l}=e,u=i4(this.props.topology),f=Boolean(i.indexBuffer),_=i.indexBuffer?.glIndexType,w=Number(o)>0;if(this.linkStatus!=="success")return ar.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||n===0)return ar.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(n===0)return ar.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),i.bindBeforeRender(r),l&&l.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let E=r;return VN(this.device,this.props.parameters,E.glParameters,()=>{f&&w?this.device.gl.drawElementsInstanced(u,n||0,_,a,o||0):f?this.device.gl.drawElements(u,n||0,_,a):w?this.device.gl.drawArraysInstanced(u,a,n||0,o||0):this.device.gl.drawArrays(u,a,n||0),l&&l.end()}),i.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=Iy(e);Object.keys(r).forEach(i=>{ar.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),ar.time(o4,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),ar.timeEnd(o4,`linkProgram for ${this.id}`)(),ar.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}ar.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),ar.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof cc&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let o=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:a}=n,l=e.getUniformBlockIndex(this.handle,a);if(l===4294967295)throw new Error(`Invalid uniform block name ${a}`);e.uniformBlockBinding(this.handle,i,l),o instanceof lc?e.bindBufferBase(35345,i,o.handle):e.bindBufferRange(35345,i,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),i+=1;break;case"texture":if(!(o instanceof ch||o instanceof cc||o instanceof uf))throw new Error("texture");let u;if(o instanceof ch)u=o.texture;else if(o instanceof cc)u=o;else if(o instanceof uf&&o.colorAttachments[0]instanceof ch)ar.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(u.target,u.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:o}=e,a=this.uniforms[r]??o;a!==void 0&&r4(this.device.gl,i,n,a)}}};var cw=class extends Bg{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":UQ(this.device,r.options);break;case"copy-buffer-to-texture":zQ(this.device,r.options);break;case"copy-texture-to-buffer":VQ(this.device,r.options);break;case"copy-texture-to-texture":HQ(this.device,r.options);break}}};function UQ(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function zQ(t,e){throw new Error("Not implemented")}function VQ(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:o=e.source.width,height:a=e.source.height,depthOrArrayLayers:l=0,origin:u=[0,0],destination:f,byteOffset:_=0,bytesPerRow:w,rowsPerImage:E}=e;if(n!=="all")throw new Error("not supported");if(i!==0||l!==0||w||E)throw new Error("not implemented");let{framebuffer:M,destroyFramebuffer:D}=s4(r);try{let j=f,V=o||M.width,$=a||M.height,te=kg(M.texture.props.format),ne=te.dataFormat,le=te.type;t.gl.bindBuffer(35051,j.handle),t.gl.bindFramebuffer(36160,M.handle),t.gl.readPixels(u[0],u[1],V,$,ne,le,_)}finally{t.gl.bindBuffer(35051,null),t.gl.bindFramebuffer(36160,null),D&&M.destroy()}}function HQ(t,e){let{source:r,origin:i=[0,0],destination:n}=e,{width:o=e.destination.width,height:a=e.destination.width}=e,l=0,u=6408,{framebuffer:f,destroyFramebuffer:_}=s4(r),[w,E]=i,M=!1;t.gl.bindFramebuffer(36160,f.handle);let D=null,j;if(n instanceof cc)D=n,o=Number.isFinite(o)?o:D.width,a=Number.isFinite(a)?a:D.height,D.bind(0),j=D.destination;else throw new Error("whoops");return M||t.gl.copyTexImage2D(j,l,u,w,E,o,a,0),D&&D.unbind(),_&&f.destroy(),D}function s4(t){if(t instanceof Vo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var uw=class extends Rg{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new cw(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var Ug=class extends Og{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return RC()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r}setBuffer(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:o,stride:a,offset:l,normalized:u,integer:f,divisor:_}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),f?this.device.gl.vertexAttribIPointer(e,n,o,a,l):this.device.gl.vertexAttribPointer(e,n,o,u,a,l),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,_||0),this.attributes[e]=i}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}init=!1;bindBeforeRender(){if(this.device.gl.bindVertexArray(this.handle),!this.init){let e=this.indexBuffer;this.device.gl.bindBuffer(34963,e?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let i=Xb(r.bufferDataType);return{size:r.bufferComponents,type:i,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let n=Ug.isConstantAttributeZeroSupported(this.device)||e!==0;(r||n)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let i=jQ(r),n=i.byteLength*e,o=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let a=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),a=a||!GQ(i,this.bufferValue),a){let l=sM(r.constructor,o);aM({target:l,source:i,start:0,count:o}),this.buffer.write(l),this.bufferValue=r}return this.buffer}};function jQ(t){return Array.isArray(t)?new Float32Array(t):t}function GQ(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var hw=class extends Dg{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(n4(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:o,byteOffset:a}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,ar.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:o,byteOffset:a},this.bindOnUse||this._bindBuffer(i,n,a,o)}getBuffer(e){if(a4(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof lc)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(a4(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let o=r&&r.handle;!o||n===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,i,n)}};function a4(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var fw=class extends Lg{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let o=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};function IM(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return un(!1),0}}function l4(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return un(!1),0}}function c4(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:o=36064}=e||{},{target:a=null,sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:_,deleteFramebuffer:w}=h4(t);un(_);let{gl:E,handle:M}=_;l=l||_.width,u=u||_.height;let D=o-36064;f=f||_.colorAttachments[D]?.texture?.type||5121,a=qQ(a,f,n,l,u),f=f||JN(a);let j=E.bindFramebuffer(36160,M);return E.readPixels(r,i,l,u,n,f,a),E.bindFramebuffer(36160,j||null),w&&_.destroy(),a}function u4(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:o=6408,targetByteOffset:a=0}=e||{},{sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:_,deleteFramebuffer:w}=h4(t);un(_),l=l||_.width,u=u||_.height;let E=_;f=f||5121;let M=r;if(!M){let j=IM(o),V=l4(f),$=a+l*u*j*V;M=E.device.createBuffer({byteLength:$})}let D=t.device.createCommandEncoder();return D.copyTextureToBuffer({source:t,width:l,height:u,origin:[i,n],destination:M,byteOffset:a}),D.destroy(),w&&_.destroy(),M}function h4(t){return t instanceof sf?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:WQ(t),deleteFramebuffer:!0}}function WQ(t,e){let{device:r,width:i,height:n,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:i,height:n,colorAttachments:[t]})}function qQ(t,e,r,i,n){if(t)return t;e=e||5121;let o=Ny(e,{clamped:!1}),a=IM(r);return new o(i*n*a)}var XQ=256,YQ=1024,KQ=16384;var ZQ="clear: bad arguments";function f4(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:o=null}=e||{},a={};r&&(a.framebuffer=r);let l=0;i&&(l|=KQ,i!==!0&&(a.clearColor=i)),n&&(l|=XQ,n!==!0&&(a.clearDepth=n)),o&&(l|=YQ,n!==!0&&(a.clearStencil=n)),un(l!==0,ZQ);let u=t.gl;Cu(u,a,()=>{u.clear(l)})}var ky=1,zg=class extends qc{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof zg)return e;if(e?.device instanceof qc)return e.device;if(!JQ(e))throw new Error("Invalid WebGL2RenderingContext");return new zg({gl:e})}static async create(e={}){ar.groupCollapsed(ky,"WebGLDevice created")();let r=[];e.debug&&r.push(XN()),e.spector&&r.push(GN()),typeof e.canvas=="string"&&r.push(Jd.pageLoaded);let i=await Promise.allSettled(r);for(let a of i)a.status==="rejected"&&ar.error(`Failed to initialize debug libraries ${a.reason}`)();if(ar.probe(ky+1,"DOM is loaded")(),e.gl?.device)return ar.warn("reattaching existing device")(),zg.attach(e.gl);let n=new zg(e),o=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return ar.probe(ky,o)(),ar.table(ky,n.info)(),ar.groupEnd(ky)(),n}constructor(e){super({...e,id:e.id||ma("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new ow(this,{...e,canvas:i}),this.lost=new Promise(l=>{this._resolveContextLost=l});let n=e.gl||null;if(n||=MN(this.canvasContext.canvas,{...e,onContextLost:l=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,this.info=IN(this.gl,this._extensions),this.limits=new ew(this.gl),this.features=new $b(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:o=!0,copyState:a=!1}=e;gM(this.gl,{enable:o,copyState:a,log:(...l)=>ar.log(1,...l)()}),e.debug&&(this.gl=YN(this.gl,{...e,throwOnError:!0}),this.debug=!0,ar.level=Math.max(ar.level,1),ar.warn("WebGL debug mode activated. Performance reduced.")()),e.spector&&(this.spectorJS=WN({...this.props,canvas:this.handle.canvas}))}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return Qb(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return FN(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return NN(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new lc(this,r)}_createTexture(e){return new cc(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new mA(this,e)}createShader(e){return new sw(this,e)}createFramebuffer(e){return new uf(this,e)}createVertexArray(e){return new Ug(this,e)}createTransformFeedback(e){return new hw(this,e)}createQuerySet(e){return new fw(this,e)}createRenderPipeline(e){return new lw(this,e)}beginRenderPass(e){return new aw(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 uw(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return c4(e,r)}readPixelsToBufferWebGL(e,r){return u4(e,r)}setParametersWebGL(e){lh(this.gl,e)}getParametersWebGL(e){return qb(this.gl,e)}withParametersWebGL(e,r){Cu(this.gl,e,r)}clearWebGL(e){f4(this,e)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){tp(this.gl)}popState(){ed(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&t$(n,r)&&ar.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:QQ(this,e,r);break;case Int32Array:$Q(this,e,r);break;case Uint32Array:e$(this,e,r);break;default:un(!1)}}getExtension(e){return Su(this.gl,e,this._extensions),this._extensions}},hf=zg;yi(hf,"type","webgl");function JQ(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function QQ(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:un(!1)}}function $Q(t,e,r){t.gl.vertexAttribI4iv(e,r)}function e$(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function t$(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var d4,p4,m4={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function dw(){return document.createElement("div")}function r$(t){if(!t.picked)return null;if(t.object===d4)return p4;let e={html:n$(t.object),style:m4};return p4=e,d4=t.object,e}var i$=new Set(["position","index"]);function n$(t){let e=dw();for(let r in t){if(i$.has(r))continue;let i=dw();i.className="header",i.textContent=r;let n=dw();n.className="value",n.textContent=s$(t[r]);let o=dw();o$(o,i,n),o.appendChild(i),o.appendChild(n),e.appendChild(o)}return e.innerHTML}function o$(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function s$(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function A4(t,e){let r,i=t,n="properties",o=/{[^}]*}/g,a=u=>u.replace(/[{}]/g,""),l=[...new Set(t.match(o).map(a))];for(let u of l){if(u.includes(".")){r=e;let f=u.split(".");for(let _ of f)if(r.hasOwnProperty(_))r=r[_];else{r=void 0;break}}else e.hasOwnProperty(u)?r=e[u]:e[n]&&e[n].hasOwnProperty(u)?r=e[n][u]:r=void 0;i=i.replaceAll(`{${u}}`,r)}return i}function PM(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||m4};return t.html?r.html=A4(t.html,e.object):r.text=A4(t.text,e.object),r}:r$:null}function g4(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function _4(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var v4=sc(y4()),a$="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",OM=v4.default;function x4(t=a$){g4(t)}function b4(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var DM={};function w4(t){if(!DM[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),DM[t]=new Promise(i=>{e.onload=i})}return DM[t]}var T4="4.2.0-alpha.4";var l$=globalThis.loaders?.parseImageNode,LM=typeof Image<"u",FM=typeof ImageBitmap<"u",c$=Boolean(l$),NM=$f?!0:c$;function E4(t){switch(t){case"auto":return FM||LM||NM;case"imagebitmap":return FM;case"image":return LM;case"data":return NM;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function S4(){if(FM)return"imagebitmap";if(LM)return"image";if(NM)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function C4(t){let e=u$(t);if(!e)throw new Error("Not an image");return e}function Uy(t){switch(C4(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function u$(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var h$=/^data:image\/svg\+xml/,f$=/\.svg((\?|#).*)?$/;function pw(t){return t&&(h$.test(t)||f$.test(t))}function M4(t,e){if(pw(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return kM(t,e)}function kM(t,e){if(pw(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function Aw(t,e,r){let i=M4(t,r),n=self.URL||self.webkitURL,o=typeof i!="string"&&n.createObjectURL(i);try{return await d$(o||i,e)}finally{o&&n.revokeObjectURL(o)}}async function d$(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=o=>{let a=o instanceof Error?o.message:"error";n(new Error(a))}}catch(o){n(o)}})}var p$={},I4=!0;async function P4(t,e,r){let i;pw(r)?i=await Aw(t,e,r):i=kM(t,r);let n=e&&e.imagebitmap;return await A$(i,n)}async function A$(t,e=null){if((m$(e)||!I4)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),I4=!1}return await createImageBitmap(t)}function m$(t){for(let e in t||p$)return!1;return!0}function R4(t){return!v$(t,"ftyp",4)||!(t[8]&96)?null:g$(t)}function g$(t){switch(_$(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function _$(t,e,r){return String.fromCharCode(...t.slice(e,r))}function y$(t){return[...t].map(e=>e.charCodeAt(0))}function v$(t,e,r=0){let i=y$(e);for(let n=0;n<i.length;++n)if(i[n]!==t[n+r])return!1;return!0}var ff=!1,zy=!0;function gA(t){let e=Vy(t);return b$(e)||E$(e)||w$(e)||T$(e)||x$(e)}function x$(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=R4(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function b$(t){let e=Vy(t);return e.byteLength>=24&&e.getUint32(0,ff)===2303741511?{mimeType:"image/png",width:e.getUint32(16,ff),height:e.getUint32(20,ff)}:null}function w$(t){let e=Vy(t);return e.byteLength>=10&&e.getUint32(0,ff)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,zy),height:e.getUint16(8,zy)}:null}function T$(t){let e=Vy(t);return e.byteLength>=14&&e.getUint16(0,ff)===16973&&e.getUint32(2,zy)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,zy),height:e.getUint32(22,zy)}:null}function E$(t){let e=Vy(t);if(!(e.byteLength>=3&&e.getUint16(0,ff)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=S$(),o=2;for(;o+9<e.byteLength;){let a=e.getUint16(o,ff);if(n.has(a))return{mimeType:"image/jpeg",height:e.getUint16(o+5,ff),width:e.getUint16(o+7,ff)};if(!i.has(a))return null;o+=2,o+=e.getUint16(o,ff)}return null}function S$(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Vy(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function B4(t,e){let{mimeType:r}=gA(t)||{},i=globalThis.loaders?.parseImageNode;return Xn(i),await i(t,r)}async function O4(t,e,r){e=e||{};let n=(e.image||{}).type||"auto",{url:o}=r||{},a=C$(n),l;switch(a){case"imagebitmap":l=await P4(t,e,o);break;case"image":l=await Aw(t,e,o);break;case"data":l=await B4(t,e);break;default:Xn(!1)}return n==="data"&&(l=Uy(l)),l}function C$(t){switch(t){case"auto":case"data":return S4();default:return E4(t),t}}var M$=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],I$=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],P$={image:{type:"auto",decode:!0}},df={id:"image",module:"images",name:"Images",version:T4,mimeTypes:I$,extensions:M$,parse:O4,tests:[t=>Boolean(gA(new DataView(t)))],options:P$};var UM={};function zM(t){if(UM[t]===void 0){let e=$f?B$(t):R$(t);UM[t]=e}return UM[t]}function R$(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,i=globalThis.loaders?.parseImageNode;return Boolean(i)&&r.includes(t)}function B$(t){switch(t){case"image/avif":case"image/webp":return O$(t);default:return!0}}function O$(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var D$=new Sc({id:"deck"}),br=D$;var VM={};function D4(t){VM=t}function ia(t,e,r,i){br.level>0&&VM[t]&&VM[t].call(null,e,r,i)}function L$(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var L4={id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:L$,parseTextSync:JSON.parse};function F$(){let t="9.0.0-beta.8",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(br.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:br,_registerLoggers:D4},hA([L4,[df,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var mw=F$();function pf(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var HM={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function N4(t){let e={};for(let[r,i]of Object.entries(t))e[r]=N$(i);return e}function k4(t,e,r){let i={};for(let[n,o]of Object.entries(e))t&&n in t&&!o.private?(o.validate&&pf(o.validate(t[n],o),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=o.value;return i}function N$(t){let e=F4(t);if(e!=="object")return{value:t,...HM[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...HM[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=F4(t.value),{...t,...HM[e],type:e}):{type:"object",value:null};throw new Error("props")}function F4(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var U4=`#ifdef MODULE_LOGDEPTH
|
|
553
553
|
logdepth_adjustPosition(gl_Position);
|
|
554
554
|
#endif
|
|
555
555
|
`,z4=`#ifdef MODULE_MATERIAL
|
|
@@ -1712,7 +1712,7 @@ void main() {
|
|
|
1712
1712
|
void main() {
|
|
1713
1713
|
fragColor = ${t}(texSrc, texSize, coordinate);
|
|
1714
1714
|
}
|
|
1715
|
-
`;function jne(t,e){if(e.filter){let r=typeof e.filter=="string"?e.filter:`${t.name}_filterColor`;return Vne(r)}if(e.sampler){let r=typeof e.sampler=="string"?e.sampler:`${t.name}_sampleColor`;return Hne(r)}return""}var X6={blendFunc:[1,0,32771,0],blendEquation:32774},ld=class extends Ah{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,pickingFBO:a,deviceRect:{x:l,y:u,width:f,height:_},cullRect:w,effects:E,pass:M="picking",pickZ:D,moduleParameters:j}){this.pickZ=D;let V=this._resetColorEncoder(D),$=this.device.withParametersWebGL({scissorTest:!0,scissor:[l,u,f,_],depthMask:!0,depthTest:!0,depthRange:[0,1],colorMask:[!0,!0,!0,!0],...X6,blend:!D},()=>super.render({target:a,layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,cullRect:w,effects:E?.filter(ne=>ne.useInPicking),pass:M,isPicking:!0,moduleParameters:j,clearColor:[0,0,0,0]}));return this._colorEncoderState=null,{decodePickingColor:V&&Wne.bind(null,V),stats:$}}shouldDrawLayer(e){let{pickable:r,operation:i}=e.props;return r&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getModuleParameters(){return{picking:{isActive:1,isAttribute:this.pickZ},lightSources:{}}}getLayerParameters(e,r,i){let n={...e.props.parameters},{pickable:o,operation:a}=e.props;return this._colorEncoderState?o&&a.includes("draw")&&(Object.assign(n,X6),n.blend=!0,n.blendColor=Gne(this._colorEncoderState,e,i)):n.blend=!1,a.includes("terrain")&&(n.blend=!1),n}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function Gne(t,e,r){let{byLayer:i,byAlpha:n}=t,o,a=i.get(e);return a?(a.viewports.push(r),o=a.a):(o=i.size+1,o<=255?(a={a:o,layer:e,viewports:[r]},i.set(e,a),n[o]=a):(br.warn("Too many pickable layers, only picking the first 255")(),o=0)),[0,0,0,o/255]}function Wne(t,e){let r=t.byAlpha[e[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(e)}}var Ap={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"},a0=Symbol.for("component"),Nu=Symbol.for("propTypes"),u2=Symbol.for("deprecatedProps"),cd=Symbol.for("asyncPropDefaults"),_f=Symbol.for("asyncPropOriginal"),gh=Symbol.for("asyncPropResolved");function yf(t,e=()=>!0){return Array.isArray(t)?Y6(t,e,[]):e(t)?[t]:[]}function Y6(t,e,r){let i=-1;for(;++i<t.length;){let n=t[i];Array.isArray(n)?Y6(n,e,r):e(n)&&r.push(n)}return r}function h2({target:t,source:e,start:r=0,count:i=1}){let n=e.length,o=i*n,a=0;for(let l=r;a<n;a++)t[l++]=e[a];for(;a<o;)a<o-a?(t.copyWithin(r+a,r,r+a),a*=2):(t.copyWithin(r+a,r,r+o-a),a=o);return t}var yv=class{constructor(e,r,i){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=i,this.setData(r)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,r){if(e===this._data&&!r)return;this._data=e;let i=++this._loadCount,n=e;typeof e=="string"&&(n=Ca(e)),n instanceof Promise?(this.isLoaded=!1,this._loader=n.then(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=o)}).catch(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=o||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(let o of this._subscribers)o.onChange(this.getData())}};var vv=class{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:r,forceUpdate:i=!1,persistent:n=!0}){let o=this._resources[e];o?o.setData(r,i):(o=new yv(e,r,this._context),this._resources[e]=o),o.persistent=n}remove(e){let r=this._resources[e];r&&(r.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){let r=this._consumers[e];if(r){for(let i in r){let n=r[i],o=this._resources[n.resourceId];o&&o.unsubscribe(n)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:r,consumerId:i,requestId:n="default"}){let{_resources:o,protocol:a}=this;e.startsWith(a)&&(e=e.replace(a,""),o[e]||this.add({resourceId:e,data:null,persistent:!1}));let l=o[e];if(this._track(i,n,l,r),l)return l.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let e in this._resources)this._resources[e].delete()}_track(e,r,i,n){let o=this._consumers,a=o[e]=o[e]||{},l=a[r],u=l&&l.resourceId&&this._resources[l.resourceId];u&&(u.unsubscribe(l),this.prune()),i&&(l?(l.onChange=n,l.resourceId=i.id):l={onChange:n,resourceId:i.id},a[r]=l,i.subscribe(l))}_prune(){this._pruneRequest=null;for(let e of Object.keys(this._resources)){let r=this._resources[e];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[e])}}};var qne="layerManager.setLayers",Xne="layerManager.activateViewport",BA=class{constructor(e,r){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this.activateViewport=l=>{ia(Xne,this,l),l&&(this.context.viewport=l)};let{deck:i,stats:n,viewport:o,timeline:a}=r||{};this.layers=[],this.resourceManager=new vv({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:i,shaderAssembler:r0(),pipelineFactory:e&&n2(e),renderPass:void 0,stats:n||new Hl({id:"deck.gl"}),viewport:o||new Za({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:a||new MA,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(let i of this.layers){let n=i.getNeedsRedraw(e);r=r||n}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(r=>e.find(i=>r.id.indexOf(i)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,r){ia(qne,this,r,e),this._lastRenderedLayers=e;let i=yf(e,Boolean);for(let n of i)n.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}_handleError(e,r,i){i.raiseError(r,`${e} of ${i}`)}_updateLayers(e,r){let i={};for(let a of e)i[a.id]?br.warn(`Multiple old layers with same id ${a.id}`)():i[a.id]=a;let n=[];this._updateSublayersRecursively(r,i,n),this._finalizeOldLayers(i);let o=!1;for(let a of n)if(a.hasUniformTransition()){o=`Uniform transition in ${a}`;break}this._needsUpdate=o,this.layers=n}_updateSublayersRecursively(e,r,i){for(let n of e){n.context=this.context;let o=r[n.id];o===null&&br.warn(`Multiple new layers with same id ${n.id}`)(),r[n.id]=null;let a=null;try{this._debug&&o!==n&&n.validateProps(),o?(this._transferLayerState(o,n),this._updateLayer(n)):this._initializeLayer(n),i.push(n),a=n.isComposite?n.getSubLayers():null}catch(l){this._handleError("matching",l,n)}a&&this._updateSublayersRecursively(a,r,i)}}_finalizeOldLayers(e){for(let r in e){let i=e[r];i&&this._finalizeLayer(i)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Ap.INITIALIZED}catch(r){this._handleError("initialization",r,e)}}_transferLayerState(e,r){r._transferState(e),r.lifecycle=Ap.MATCHED,r!==e&&(e.lifecycle=Ap.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(r){this._handleError("update",r,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Ap.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Ap.FINALIZED}catch(r){this._handleError("finalization",r,e)}}};function Ws(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!Ws(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!Ws(t[o],e[o],r-1))return!1;return!0}return!1}var xv=class{constructor(e){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},Object.seal(this),this.setProps(e)}finalize(){for(let e in this.controllers){let r=this.controllers[e];r&&r.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(let e in this.controllers){let r=this.controllers[e];r&&r.updateTransition()}}getViewports(e){return e?this._viewports.filter(r=>r.containsPixel(e)):this._viewports}getViews(){let e={};return this.views.forEach(r=>{e[r.id]=r}),e}getView(e){return this.views.find(r=>r.id===e)}getViewState(e){let r=typeof e=="string"?this.getView(e):e,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(e){return this._viewportMap[e]}unproject(e,r){let i=this.getViewports(),n={x:e[0],y:e[1]};for(let o=i.length-1;o>=0;--o){let a=i[o];if(a.containsPixel(n)){let l=e.slice();return l[0]-=a.x,l[1]-=a.y,a.unproject(l,r)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,r){(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,this.setNeedsUpdate("Size changed"))}_setViews(e){e=yf(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!Ws(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):br.warn("missing `viewState` or `initialViewState`")()}_onViewStateChange(e,r){this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange({...r,viewId:e})}_createController(e,r){let i=r.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,r.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:o=>this.getView(e.id)?.makeViewport({viewState:o,width:this.width,height:this.height})})}_updateController(e,r,i,n){let o=e.controller;if(o&&i){let a={...r,...o,id:e.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!n||n.constructor!==o.type)&&(n=this._createController(e,a)),n&&n.setProps(a),n}return null}_rebuildViewports(){let{views:e}=this,r=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let n=e.length;n--;){let o=e[n],a=this.getViewState(o),l=o.makeViewport({viewState:a,width:this.width,height:this.height}),u=r[o.id],f=Boolean(o.controller);f&&!u&&(i=!0),(i||!f)&&u&&(u.finalize(),u=null),this.controllers[o.id]=this._updateController(o,a,l,u),l&&this._viewports.unshift(l)}for(let n in r){let o=r[n];o&&!this.controllers[n]&&o.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,r){return e.length!==r.length?!0:e.some((i,n)=>!e[n].equals(r[n]))}};var Yne=/([0-9]+\.?[0-9]*)(%|px)/;function ud(t){switch(typeof t){case"number":return{position:t,relative:!1};case"string":let e=Yne.exec(t);if(e&&e.length>=3){let r=e[2]==="%",i=parseFloat(e[1]);return{position:r?i/100:i,relative:r}}default:throw new Error(`Could not parse position string ${t}`)}}function hd(t,e){return t.relative?Math.round(t.position*e):t.position}function ss(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}var uc=class{constructor(e){let{id:r,x:i=0,y:n=0,width:o="100%",height:a="100%",padding:l=null,viewportInstance:u}=e||{};ss(!u||u instanceof Za),this.viewportInstance=u,this.id=r||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=ud(i),this._y=ud(n),this._width=ud(o),this._height=ud(a),this._padding=l&&{left:ud(l.left||0),right:ud(l.right||0),top:ud(l.top||0),bottom:ud(l.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.viewportInstance?e.viewportInstance?this.viewportInstance.equals(e.viewportInstance):!1:this.ViewportType===e.ViewportType&&Ws(this.props,e.props,2)}makeViewport({width:e,height:r,viewState:i}){if(this.viewportInstance)return this.viewportInstance;i=this.filterViewState(i);let n=this.getDimensions({width:e,height:r});return!n.height||!n.width?null:new this.ViewportType({...i,...this.props,...n})}getViewStateId(){let{viewState:e}=this.props;return typeof e=="string"?e:e?.id||this.id}filterViewState(e){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let r={...e};for(let i in this.props.viewState)i!=="id"&&(r[i]=this.props.viewState[i]);return r}return e}getDimensions({width:e,height:r}){let i={x:hd(this._x,e),y:hd(this._y,r),width:hd(this._width,e),height:hd(this._height,r)};return this._padding&&(i.padding={left:hd(this._padding.left,e),top:hd(this._padding.top,r),right:hd(this._padding.right,e),bottom:hd(this._padding.bottom,r)}),i}get controller(){let e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}};var $c=class{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:e,settings:r}=this;this._handle=e.addChannel({delay:e.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var K6=()=>{},bv={BREAK:1,SNAP_TO_END:2,IGNORE:3},Kne=t=>t,Zne=bv.BREAK,wv=class{constructor(e){this._onTransitionUpdate=r=>{let{time:i,settings:{interpolator:n,startProps:o,endProps:a,duration:l,easing:u}}=r,f=u(i/l),_=n.interpolateProps(o,a,f);this.propsInTransition=this.getControllerState({...this.props,..._}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new $c(e.timeline),this.onViewStateChange=e.onViewStateChange||K6,this.onStateChange=e.onStateChange||K6}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let r=!1,i=this.props;if(this.props=e,!i||this._shouldIgnoreViewportChange(i,e))return!1;if(this._isTransitionEnabled(e)){let n=i;if(this.transition.inProgress){let{interruption:o,endProps:a}=this.transition.settings;n={...i,...o===bv.SNAP_TO_END?a:this.propsInTransition||i}}this._triggerTransition(n,e),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(e){let{transitionDuration:r,transitionInterpolator:i}=e;return(r>0||r==="auto")&&Boolean(i)}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,r){return this.transition.inProgress?this.transition.settings.interruption===bv.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(e,r):!0}_triggerTransition(e,r){let i=this.getControllerState(e),n=this.getControllerState(r).shortestPathFrom(i),o=r.transitionInterpolator,a=o.getDuration?o.getDuration(e,r):r.transitionDuration;if(a===0)return;let l=o.initializeProps(e,n);this.propsInTransition={};let u={duration:a,easing:r.transitionEasing||Kne,interpolator:o,interruption:r.transitionInterruption||Zne,startProps:l.start,endProps:l.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(u),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(r)}}};var fd=class{constructor(e){let{compare:r,extract:i,required:n}=e;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=n}arePropsEqual(e,r){for(let i of this._propsToCompare)if(!(i in e)||!(i in r)||!Ns(e[i],r[i]))return!1;return!0}initializeProps(e,r){let i={},n={};for(let o of this._propsToExtract)(o in e||o in r)&&(i[o]=e[o],n[o]=r[o]);return this._checkRequiredProps(i),this._checkRequiredProps(n),{start:i,end:n}}getDuration(e,r){return r.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(r=>{let i=e[r];ss(Number.isFinite(i)||Array.isArray(i),`${r} is required for transition`)})}};var Jne=["longitude","latitude","zoom","bearing","pitch"],Qne=["longitude","latitude","zoom"],Dl=class extends fd{constructor(e={}){let r=Array.isArray(e)?e:e.transitionProps,i=Array.isArray(e)?{}:e;i.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:Jne,required:Qne},super(i.transitionProps),this.opts=i}initializeProps(e,r){let i=super.initializeProps(e,r),{makeViewport:n,around:o}=this.opts;if(n&&o){let a=n(e),l=n(r),u=a.unproject(o);i.start.around=o,Object.assign(i.end,{around:l.project(u),aroundPosition:u,width:r.width,height:r.height})}return i}interpolateProps(e,r,i){let n={};for(let o of this._propsToExtract)n[o]=Xa(e[o]||0,r[o]||0,i);if(r.aroundPosition&&this.opts.makeViewport){let o=this.opts.makeViewport({...r,...n});Object.assign(n,o.panByPosition(r.aroundPosition,Xa(e.around,r.around,i)))}return n}};var mp={transitionDuration:0},$ne=300,f2=t=>1-(1-t)*(1-t),l0={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},OA={},hc=class{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new wv({...e,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){for(let e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;let r=this._eventStartBlocked;switch(e.type){case"panstart":return r?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return r?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"tripanstart":return r?!1:this._onTriplePanStart(e);case"tripanmove":return this._onTriplePan(e);case"tripanend":return this._onTriplePanEnd(e);case"doubletap":return this._onDoubleTap(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){let{x:r,y:i}=this.props,{offsetCenter:n}=e;return[n.x-r,n.y-i]}isPointInBounds(e,r){let{width:i,height:n}=this.props;if(r&&r.handled)return!1;let o=e[0]>=0&&e[0]<=i&&e[1]>=0&&e[1]<=n;return o&&r&&r.stopPropagation(),o}isFunctionKeyPressed(e){let{srcEvent:r}=e;return Boolean(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=r}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:r}=e;this.inertia=Number.isFinite(r)?r:r===!0?$ne:0;let{scrollZoom:i=!0,dragPan:n=!0,dragRotate:o=!0,doubleClickZoom:a=!0,touchZoom:l=!0,touchRotate:u=!1,keyboard:f=!0}=e,_=Boolean(this.onViewStateChange);this.toggleEvents(l0.WHEEL,_&&i),this.toggleEvents(l0.PAN,_),this.toggleEvents(l0.PINCH,_&&(l||u)),this.toggleEvents(l0.TRIPLE_PAN,_&&u),this.toggleEvents(l0.DOUBLE_TAP,_&&a),this.toggleEvents(l0.KEYBOARD,_&&f),this.scrollZoom=i,this.dragPan=n,this.dragRotate=o,this.doubleClickZoom=a,this.touchZoom=l,this.touchRotate=u,this.keyboard=f}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,r){this.eventManager&&e.forEach(i=>{this._events[i]!==r&&(this._events[i]=r,r?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(e,r=null,i={}){let n={...e.getViewportProps(),...r},o=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(i),o){let a=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:n,interactionState:this._interactionState,oldViewState:a})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(i=!i);let n=this.controllerState[i?"panStart":"rotateStart"]({pos:r});return this._panMove=i,this.updateViewport(n,mp,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;let r=this.getCenter(e),i=this.controllerState.pan({pos:r});return this.updateViewport(i,mp,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){let{inertia:r}=this;if(this.dragPan&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],o=this.controllerState.pan({pos:n}).panEnd();this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isPanning:!0})}else{let i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;let r=this.getCenter(e),i=this.controllerState.rotate({pos:r});return this.updateViewport(i,mp,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){let{inertia:r}=this;if(this.dragRotate&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],o=this.controllerState.rotate({pos:n}).rotateEnd();this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isRotating:!0})}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;e.srcEvent.preventDefault();let{speed:i=.01,smooth:n=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:o}=e,a=2/(1+Math.exp(-Math.abs(o*i)));o<0&&a!==0&&(a=1/a);let l=this.controllerState.zoom({pos:r,scale:a});return this.updateViewport(l,{...this._getTransitionProps({around:r}),transitionDuration:n?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.rotateStart({pos:r});return this.updateViewport(i,mp,{isDragging:!0}),!0}_onTriplePan(e){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(e);r[0]-=e.deltaX;let i=this.controllerState.rotate({pos:r});return this.updateViewport(i,mp,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&e.velocityY){let i=this.getCenter(e),n=[i[0],i[1]+=e.velocityY*r/2],o=this.controllerState.rotate({pos:n});this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return OA._startPinchRotation=e.rotation,OA._lastPinchEvent=e,this.updateViewport(i,mp,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=e,n=this.getCenter(e);r=r.zoom({pos:n,scale:i})}if(this.touchRotate){let{rotation:i}=e;r=r.rotate({deltaAngleX:OA._startPinchRotation-i})}return this.updateViewport(r,mp,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),OA._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=OA;if(this.touchZoom&&r&&i&&e.scale!==i.scale){let n=this.getCenter(e),o=this.controllerState.rotateEnd(),a=Math.log2(e.scale),l=(a-Math.log2(i.scale))/(e.deltaTime-i.deltaTime),u=Math.pow(2,a+l*r/2);o=o.zoom({pos:n,scale:u}).zoomEnd(),this.updateViewport(o,{...this._getTransitionProps({around:n}),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let n=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return OA._startPinchRotation=null,OA._lastPinchEvent=null,!0}_onDoubleTap(e){if(!this.doubleClickZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e),n=this.controllerState.zoom({pos:r,scale:i?.5:2});return this.updateViewport(n,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(e),{zoomSpeed:i,moveSpeed:n,rotateSpeedX:o,rotateSpeedY:a}=this.keyboard===!0?{}:this.keyboard,{controllerState:l}=this,u,f={};switch(e.srcEvent.code){case"Minus":u=r?l.zoomOut(i).zoomOut(i):l.zoomOut(i),f.isZooming=!0;break;case"Equal":u=r?l.zoomIn(i).zoomIn(i):l.zoomIn(i),f.isZooming=!0;break;case"ArrowLeft":r?(u=l.rotateLeft(o),f.isRotating=!0):(u=l.moveLeft(n),f.isPanning=!0);break;case"ArrowRight":r?(u=l.rotateRight(o),f.isRotating=!0):(u=l.moveRight(n),f.isPanning=!0);break;case"ArrowUp":r?(u=l.rotateUp(a),f.isRotating=!0):(u=l.moveUp(n),f.isPanning=!0);break;case"ArrowDown":r?(u=l.rotateDown(a),f.isRotating=!0):(u=l.moveDown(n),f.isPanning=!0);break;default:return!1}return this.updateViewport(u,this._getTransitionProps(),f),!0}_getTransitionProps(e){let{transition:r}=this;return!r||!r.transitionInterpolator?mp:e?{...r,transitionInterpolator:new Dl({...e,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var dd=class{constructor(e,r){this._viewportProps=this.applyConstraints(e),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var Z6=5,eoe=1.2,Tv=class extends dd{constructor(e){let{width:r,height:i,latitude:n,longitude:o,zoom:a,bearing:l=0,pitch:u=0,altitude:f=1.5,position:_=[0,0,0],maxZoom:w=20,minZoom:E=0,maxPitch:M=60,minPitch:D=0,startPanLngLat:j,startZoomLngLat:V,startRotatePos:$,startBearing:te,startPitch:ne,startZoom:le,normalize:z=!0}=e;ss(Number.isFinite(o)),ss(Number.isFinite(n)),ss(Number.isFinite(a)),super({width:r,height:i,latitude:n,longitude:o,zoom:a,bearing:l,pitch:u,altitude:f,maxZoom:w,minZoom:E,maxPitch:M,minPitch:D,normalize:z,position:_},{startPanLngLat:j,startZoomLngLat:V,startRotatePos:$,startBearing:te,startPitch:ne,startZoom:le}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:r}){let i=this.getState().startPanLngLat||this._unproject(r);if(!i)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startBearing:o,startPitch:a}=this.getState();if(!n||o===void 0||a===void 0)return this;let l;return e?l=this._getNewRotation(e,n,a,o):l={bearing:o+r,pitch:a+i},this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:i}){let{startZoom:n,startZoomLngLat:o}=this.getState();if(o||(n=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let{maxZoom:a,minZoom:l}=this.getViewportProps(),u=n+Math.log2(i);u=ho(u,l,a);let f=this.makeViewport({...this.getViewportProps(),zoom:u});return this._getUpdatedState({zoom:u,...f.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:o}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),Math.abs(o-r.longitude)>180&&(i.longitude=o<0?o+360:o-360),i}applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n}=e;e.zoom=ho(n,i,r);let{maxPitch:o,minPitch:a,pitch:l}=e;e.pitch=ho(l,a,o);let{normalize:u=!0}=e;return u&&Object.assign(e,PP(e)),e}_zoomFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.zoom({pos:[r/2,i/2],scale:e})}_panFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.pan({startPos:[r/2,i/2],pos:[r/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_getNewRotation(e,r,i,n){let o=e[0]-r[0],a=e[1]-r[1],l=e[1],u=r[1],{width:f,height:_}=this.getViewportProps(),w=o/f,E=0;a>0?Math.abs(_-u)>Z6&&(E=a/(u-_)*eoe):a<0&&u>Z6&&(E=1-l/u),E=ho(E,-1,1);let{minPitch:M,maxPitch:D}=this.getViewportProps(),j=n+180*w,V=i;return E>0?V=i+E*(D-i):E<0&&(V=i-E*(M-i)),{pitch:V,bearing:j}}},DA=class extends hc{constructor(){super(...arguments),this.ControllerState=Tv,this.transition={transitionDuration:300,transitionInterpolator:new Dl({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];let r=this.props;super.setProps(e),(!r||r.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}};var zP=class extends uc{get ViewportType(){return Ic}get ControllerType(){return DA}},LA=zP;(()=>{zP.displayName="MapView"})();var toe=new dp;function roe(t,e){let r=t.order??1/0,i=e.order??1/0;return r-i}var Ev=class{constructor(){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){let r=this._defaultEffects;if(!r.find(i=>i.id===e.id)){let i=r.findIndex(n=>roe(n,e)>0);i<0?r.push(e):r.splice(i,0,e),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(Ws(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(e){let r={};for(let n of this.effects)r[n.id]=n;let i=[];for(let n of e){let o=r[n.id];o&&o!==n?o.setProps?(o.setProps(n.props),i.push(o)):(o.cleanup(),i.push(n)):i.push(n),delete r[n.id]}for(let n in r)r[n].cleanup();this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),e.some(n=>n instanceof dp)||this._resolvedEffects.push(toe),this._needsRedraw="effects changed"}finalize(){for(let e of this._resolvedEffects)e.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Sv=class extends Ah{shouldDrawLayer(e){let{operation:r}=e.props;return r.includes("draw")||r.includes("terrain")}};var ioe="deckRenderer.renderLayers",FA=class{constructor(e){this.device=e,this.gl=e.gl,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Sv(e),this.pickLayersPass=new ld(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};i.effects&&this._preRender(i.effects,i);let n=this.lastPostProcessEffect?this.renderBuffers[0]:i.target;this.lastPostProcessEffect&&(i.clearColor=[0,0,0,0]);let o=r.render({...i,target:n});i.effects&&this._postRender(i.effects,i),this.renderCount++,ia(ioe,this,o,e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:e}=this;for(let r of e)r.delete();e.length=0}_preRender(e,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let i of e)r.preRenderStats[i.id]=i.preRender(this.device,r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:e}=this,r=this.device.canvasContext.getDrawingBufferSize();e.length===0&&[0,1].map(i=>{let n=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"}});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[n]}))});for(let i of e)i.resize(r)}_postRender(e,r){let{renderBuffers:i}=this,n={...r,inputBuffer:i[0],swapBuffer:i[1]};for(let o of e)if(o.postRender){if(o.id===this.lastPostProcessEffect){n.target=r.target,o.postRender(this.device,n);break}let a=o.postRender(this.device,n);n.inputBuffer=a,n.swapBuffer=a===i[0]?i[1]:i[0]}}};var noe={pickedColor:null,pickedObjectIndex:-1};function J6({pickedColors:t,decodePickingColor:e,deviceX:r,deviceY:i,deviceRadius:n,deviceRect:o}){let{x:a,y:l,width:u,height:f}=o,_=n*n,w=-1,E=0;for(let M=0;M<f;M++){let D=M+l-i,j=D*D;if(j>_)E+=4*u;else for(let V=0;V<u;V++){if(t[E+3]-1>=0){let te=V+a-r,ne=te*te+j;ne<=_&&(_=ne,w=E)}E+=4}}if(w>=0){let M=t.slice(w,w+4),D=e(M);if(D){let j=Math.floor(w/4/u),V=w/4-j*u;return{...D,pickedColor:M,pickedX:a+V,pickedY:l+j}}br.error("Picked non-existent layer. Is picking buffer corrupt?")()}return noe}function Q6({pickedColors:t,decodePickingColor:e}){let r=new Map;if(t){for(let i=0;i<t.length;i+=4)if(t[i+3]-1>=0){let o=t.slice(i,i+4),a=o.join(",");if(!r.has(a)){let l=e(o);l?r.set(a,{...l,color:o}):br.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(r.values())}function VP({pickInfo:t,viewports:e,pixelRatio:r,x:i,y:n,z:o}){let a=e[0];e.length>1&&(a=ooe(t?.pickedViewports||e,{x:i,y:n}));let l;if(a){let u=[i-a.x,n-a.y];o!==void 0&&(u[2]=o),l=a.unproject(u)}return{color:null,layer:null,viewport:a,index:-1,picked:!1,x:i,y:n,pixel:[i,n],coordinate:l,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:r}}function $6(t){let{pickInfo:e,lastPickedInfo:r,mode:i,layers:n}=t,{pickedColor:o,pickedLayer:a,pickedObjectIndex:l}=e,u=a?[a]:[];if(i==="hover"){let w=r.index,E=r.layerId,M=a?a.props.id:null;if(M!==E||l!==w){if(M!==E){let D=n.find(j=>j.props.id===E);D&&u.unshift(D)}r.layerId=M,r.index=l,r.info=null}}let f=VP(t),_=new Map;return _.set(null,f),u.forEach(w=>{let E={...f};w===a&&(E.color=o,E.index=l,E.picked=!0),E=HP({layer:w,info:E,mode:i});let M=E.layer;w===a&&i==="hover"&&(r.info=E),_.set(M.id,E),i==="hover"&&M.updateAutoHighlight(E)}),_}function HP({layer:t,info:e,mode:r}){for(;t&&e;){let i=e.layer||null;e.sourceLayer=i,e.layer=t,e=t.getPickingInfo({info:e,mode:r,sourceLayer:i}),t=t.parent}return e}function ooe(t,e){for(let r=t.length-1;r>=0;r--){let i=t[r];if(i.containsPixel(e))return i}return t[0]}var Cv=class{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new ld(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.delete(),this.depthFBO&&(this.depthFBO.colorAttachments[0].delete(),this.depthFBO.delete())}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:r,layers:i,viewports:n},o=this.lastPickedInfo.info){let a=o&&o.layer&&o.layer.id,l=o&&o.viewport&&o.viewport.id,u=a?i.find(E=>E.id===a):null,f=l&&n.find(E=>E.id===l)||n[0],_=f&&f.unproject([e-f.x,r-f.y]);return{...o,...{x:e,y:r,viewport:f,coordinate:_,layer:u}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"]}),this.device.isTextureFormatRenderable("rgba32float"))){let r=this.device.createFramebuffer({colorAttachments:[this.device.createTexture({format:"rgba32float"})]});this.depthFBO=r}let e=this.device.gl;this.pickingFBO?.resize({width:e.canvas.width,height:e.canvas.height}),this.depthFBO?.resize({width:e.canvas.width,height:e.canvas.height})}_getPickable(e){if(this._pickable===!1)return null;let r=e.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return r.length?r:null}_pickClosestObject({layers:e,views:r,viewports:i,x:n,y:o,radius:a=0,depth:l=1,mode:u="query",unproject3D:f,onViewportActive:_,effects:w}){let E=this.device.canvasContext.cssToDeviceRatio(),M=this._getPickable(e);if(!M)return{result:[],emptyInfo:VP({viewports:i,x:n,y:o,pixelRatio:E})};this._resizeBuffer();let D=this.device.canvasContext.cssToDevicePixels([n,o],!0),j=[D.x+Math.floor(D.width/2),D.y+Math.floor(D.height/2)],V=Math.round(a*E),{width:$,height:te}=this.pickingFBO,ne=this._getPickingRect({deviceX:j[0],deviceY:j[1],deviceRadius:V,deviceWidth:$,deviceHeight:te}),le={x:n-a,y:o-a,width:a*2+1,height:a*2+1},z,ke=[],Y=new Set;for(let X=0;X<l;X++){let O;if(ne){let H=this._drawAndSample({layers:M,views:r,viewports:i,onViewportActive:_,deviceRect:ne,cullRect:le,effects:w,pass:`picking:${u}`});O=J6({...H,deviceX:j[0],deviceY:j[1],deviceRadius:V,deviceRect:ne})}else O={pickedColor:null,pickedObjectIndex:-1};let I;if(O.pickedLayer&&f&&this.depthFBO){let{pickedColors:H}=this._drawAndSample({layers:[O.pickedLayer],views:r,viewports:i,onViewportActive:_,deviceRect:{x:O.pickedX,y:O.pickedY,width:1,height:1},cullRect:le,effects:w,pass:`picking:${u}:z`},!0);H[3]&&(I=H[0])}O.pickedLayer&&X+1<l&&(Y.add(O.pickedLayer),O.pickedLayer.disablePickingIndex(O.pickedObjectIndex)),z=$6({pickInfo:O,lastPickedInfo:this.lastPickedInfo,mode:u,layers:M,viewports:i,x:n,y:o,z:I,pixelRatio:E});for(let H of z.values())H.layer&&ke.push(H);if(!O.pickedColor)break}for(let X of Y)X.restorePickingColors();return{result:ke,emptyInfo:z.get(null)}}_pickVisibleObjects({layers:e,views:r,viewports:i,x:n,y:o,width:a=1,height:l=1,mode:u="query",maxObjects:f=null,onViewportActive:_,effects:w}){let E=this._getPickable(e);if(!E)return[];this._resizeBuffer();let M=this.device.canvasContext.cssToDeviceRatio(),D=this.device.canvasContext.cssToDevicePixels([n,o],!0),j=D.x,V=D.y+D.height,$=this.device.canvasContext.cssToDevicePixels([n+a,o+l],!0),te=$.x+$.width,ne=$.y,le={x:j,y:ne,width:te-j,height:V-ne},z=this._drawAndSample({layers:E,views:r,viewports:i,onViewportActive:_,deviceRect:le,cullRect:{x:n,y:o,width:a,height:l},effects:w,pass:`picking:${u}`}),ke=Q6(z),Y=new Map,X=[],O=Number.isFinite(f);for(let I=0;I<ke.length&&!(O&&X.length>=f);I++){let H=ke[I],ie={color:H.pickedColor,layer:null,index:H.pickedObjectIndex,picked:!0,x:n,y:o,pixelRatio:M};ie=HP({layer:H.pickedLayer,info:ie,mode:u});let Q=ie.layer.id;Y.has(Q)||Y.set(Q,new Set);let ye=Y.get(Q),it=ie.object??ie.index;ye.has(it)||(ye.add(it),X.push(ie))}return X}_drawAndSample({layers:e,views:r,viewports:i,onViewportActive:n,deviceRect:o,cullRect:a,effects:l,pass:u},f=!1){let _=f?this.depthFBO:this.pickingFBO,w={layers:e,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:n,pickingFBO:_,deviceRect:o,cullRect:a,effects:l,pass:u,pickZ:f,preRenderStats:{}};for(let te of l)te.useInPicking&&(w.preRenderStats[te.id]=te.preRender(this.device,w));let{decodePickingColor:E}=this.pickLayersPass.render(w),{x:M,y:D,width:j,height:V}=o,$=new(f?Float32Array:Uint8Array)(j*V*4);return this.device.readPixelsToArrayWebGL(_,{sourceX:M,sourceY:D,sourceWidth:j,sourceHeight:V,target:$}),{pickedColors:$,decodePickingColor:E}}_getPickingRect({deviceX:e,deviceY:r,deviceRadius:i,deviceWidth:n,deviceHeight:o}){let a=Math.max(0,e-i),l=Math.max(0,r-i),u=Math.min(n,e+i+1)-a,f=Math.min(o,r+i+1)-l;return u<=0||f<=0?null:{x:a,y:l,width:u,height:f}}};var soe={"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}},aoe="top-left",eU="__root",d2=class{constructor({deck:e,parentElement:r}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,this.parentElement=r}getWidgets(){return this.resolvedWidgets}setProps(e){e.widgets&&!Ws(e.widgets,this.widgets,1)&&this._setWidgets(e.widgets)}finalize(){for(let e of this.getWidgets())this._remove(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(r=>r.id===e.id)||(this._add(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}_setWidgets(e){let r={};for(let i of this.resolvedWidgets)r[i.id]=i;this.resolvedWidgets.length=0;for(let i of this.defaultWidgets)r[i.id]=null,this.resolvedWidgets.push(i);for(let i of e){let n=r[i.id];n?n.viewId!==i.viewId||n.placement!==i.placement?(this._remove(n),this._add(i)):i!==n&&(n.setProps(i.props),i=n):this._add(i),r[i.id]=null,this.resolvedWidgets.push(i)}for(let i in r){let n=r[i];n&&this._remove(n)}this.widgets=e}_add(e){let{viewId:r=null,placement:i=aoe}=e,n=e.onAdd({deck:this.deck,viewId:r});n&&this._getContainer(r,i).append(n),e._element=n}_remove(e){e.onRemove(),e._element&&e._element.remove(),e._element=void 0}_getContainer(e,r){let i=e||eU,n=this.containers[i];n||(n=document.createElement("div"),n.style.pointerEvents="none",n.style.position="absolute",n.style.overflow="hidden",this.parentElement?.append(n),this.containers[i]=n);let o=n.querySelector(`.${r}`);return o||(o=document.createElement("div"),o.className=r,o.style.position="absolute",Object.assign(o.style,soe[r]),n.append(o)),o}_updateContainers(){let e=this.deck.width,r=this.deck.height;for(let i in this.containers){let n=this.lastViewports[i]||null,o=i===eU||n,a=this.containers[i];o?(a.style.display="block",a.style.left=`${n?n.x:0}px`,a.style.top=`${n?n.y:0}px`,a.style.width=`${n?n.width:e}px`,a.style.height=`${n?n.height:r}px`):a.style.display="none"}}onRedraw({viewports:e,layers:r}){let i=e.reduce((o,a)=>(o[a.id]=a,o),{}),{lastViewports:n}=this;for(let o of this.getWidgets()){let{viewId:a}=o;if(a){let l=i[a];l&&(o.onViewportChange&&!l.equals(n[a])&&o.onViewportChange(l),o.onRedraw?.({viewports:[l],layers:r}))}else{if(o.onViewportChange)for(let l of e)l.equals(n[l.id])||o.onViewportChange(l);o.onRedraw?.({viewports:e,layers:r})}}this.lastViewports=i,this._updateContainers()}onHover(e,r){for(let i of this.getWidgets()){let{viewId:n}=i;(!n||n===e.viewport?.id)&&i.onHover?.(e,r)}}onEvent(e,r){let i=rv[r.type];if(i)for(let n of this.getWidgets()){let{viewId:o}=n;(!o||o===e.viewport?.id)&&n[i.handler]?.(e,r)}}};var loe={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},Mv=class{constructor(){this.id="default-tooltip",this.placement="fill",this.props={},this.isVisible=!1}onAdd({deck:e}){let r=document.createElement("div");return r.className="deck-tooltip",Object.assign(r.style,loe),this.deck=e,this.element=r,r}onRemove(){this.deck=void 0,this.element=void 0}setProps(){}onViewportChange(e){this.isVisible&&e.id===this.lastViewport?.id&&e!==this.lastViewport&&this.setTooltip(null)}onHover(e){let{deck:r}=this,i=r&&r.props.getTooltip;if(!i)return;let n=i(e);this.lastViewport=e.viewport,this.setTooltip(n,e.x,e.y)}setTooltip(e,r,i){let n=this.element;if(n){if(typeof e=="string")n.innerText=e;else if(e)e.text&&(n.innerText=e.text),e.html&&(n.innerHTML=e.html),e.className&&(n.className=e.className);else{this.isVisible=!1,n.style.display="none";return}this.isVisible=!0,n.style.display="block",n.style.transform=`translate(${r}px, ${i}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(n.style,e.style)}}};var Iv=sc(tU());var coe={mousedown:1,mousemove:2,mouseup:4};function uoe(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return!0;return!1}function rU(t){let e=t.prototype.handler;t.prototype.handler=function(i){let n=this.store;i.button>0&&i.type==="pointerdown"&&(uoe(n,o=>o.pointerId===i.pointerId)||n.push(i)),e.call(this,i)}}function iU(t){t.prototype.handler=function(r){let i=coe[r.type];i&1&&r.button>=0&&(this.pressed=!0),i&2&&r.which===0&&(i=4),this.pressed&&(i&4&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:"mouse",srcEvent:r}))}}rU(Iv.default.PointerEventInput);iU(Iv.default.MouseInput);var nU=Iv.default.Manager,_h=Iv.default;var yh=class{constructor(e,r,i){this.element=e,this.callback=r,this.options={enable:!0,...i}}};var oU=_h?[[_h.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[_h.Rotate,{enable:!1}],[_h.Pinch,{enable:!1}],[_h.Swipe,{enable:!1}],[_h.Pan,{threshold:0,enable:!1}],[_h.Press,{enable:!1}],[_h.Tap,{event:"doubletap",taps:2,enable:!1}],[_h.Tap,{event:"anytap",enable:!1}],[_h.Tap,{enable:!1}]]:null,jP={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},sU={doubletap:["tap"]},aU={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},c0={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},lU={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"},GP={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"};var cU=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",NA=typeof window<"u"?window:global;var A2=!1;try{let t={get passive(){return A2=!0,!0}};NA.addEventListener("test",null,t),NA.removeEventListener("test",null)}catch{A2=!1}var hoe=cU.indexOf("firefox")!==-1,{WHEEL_EVENTS:foe}=c0,uU="wheel",hU=4.000244140625,doe=40,poe=.25,Pv=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{if(!this.options.enable)return;let o=n.deltaY;NA.WheelEvent&&(hoe&&n.deltaMode===NA.WheelEvent.DOM_DELTA_PIXEL&&(o/=NA.devicePixelRatio),n.deltaMode===NA.WheelEvent.DOM_DELTA_LINE&&(o*=doe)),o!==0&&o%hU===0&&(o=Math.floor(o/hU)),n.shiftKey&&o&&(o=o*poe),this.callback({type:uU,center:{x:n.clientX,y:n.clientY},delta:-o,srcEvent:n,pointerType:"mouse",target:n.target})},this.events=(this.options.events||[]).concat(foe),this.events.forEach(n=>e.addEventListener(n,this.handleEvent,A2?{passive:!1}:!1))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===uU&&(this.options.enable=r)}};var{MOUSE_EVENTS:Aoe}=c0,fU="pointermove",dU="pointerover",pU="pointerout",AU="pointerenter",mU="pointerleave",Rv=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=o=>{this.handleOverEvent(o),this.handleOutEvent(o),this.handleEnterEvent(o),this.handleLeaveEvent(o),this.handleMoveEvent(o)},this.pressed=!1;let{enable:n}=this.options;this.enableMoveEvent=n,this.enableLeaveEvent=n,this.enableEnterEvent=n,this.enableOutEvent=n,this.enableOverEvent=n,this.events=(this.options.events||[]).concat(Aoe),this.events.forEach(o=>e.addEventListener(o,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===fU&&(this.enableMoveEvent=r),e===dU&&(this.enableOverEvent=r),e===pU&&(this.enableOutEvent=r),e===AU&&(this.enableEnterEvent=r),e===mU&&(this.enableLeaveEvent=r)}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit(dU,e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit(pU,e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit(AU,e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit(mU,e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.which===0&&(this.pressed=!1),this.pressed||this._emit(fU,e);break;case"mouseup":this.pressed=!1;break;default:}}_emit(e,r){this.callback({type:e,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})}};var{KEY_EVENTS:moe}=c0,gU="keydown",_U="keyup",Bv=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{let o=n.target||n.srcElement;o.tagName==="INPUT"&&o.type==="text"||o.tagName==="TEXTAREA"||(this.enableDownEvent&&n.type==="keydown"&&this.callback({type:gU,srcEvent:n,key:n.key,target:n.target}),this.enableUpEvent&&n.type==="keyup"&&this.callback({type:_U,srcEvent:n,key:n.key,target:n.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(moe),e.tabIndex=this.options.tabIndex||0,e.style.outline="none",this.events.forEach(n=>e.addEventListener(n,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===gU&&(this.enableDownEvent=r),e===_U&&(this.enableUpEvent=r)}};var yU="contextmenu",Ov=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{this.options.enable&&this.callback({type:yU,center:{x:n.clientX,y:n.clientY},srcEvent:n,pointerType:"mouse",target:n.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,r){e===yU&&(this.options.enable=r)}};var goe={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},_oe=1,yoe=2,voe=3,xoe=0,boe=1,woe=2,Toe=1,Eoe=2,Soe=4;function vU(t){let e=goe[t.srcEvent.type];if(!e)return null;let{buttons:r,button:i,which:n}=t.srcEvent,o=!1,a=!1,l=!1;return e===4||e===2&&!Number.isFinite(r)?(o=n===_oe,a=n===yoe,l=n===voe):e===2?(o=Boolean(r&Toe),a=Boolean(r&Soe),l=Boolean(r&Eoe)):e===1&&(o=i===xoe,a=i===boe,l=i===woe),{leftButton:o,middleButton:a,rightButton:l}}function xU(t,e){let r=t.center;if(!r)return null;let i=e.getBoundingClientRect(),n=i.width/e.offsetWidth||1,o=i.height/e.offsetHeight||1,a={x:(r.x-i.left-e.clientLeft)/n,y:(r.y-i.top-e.clientTop)/o};return{center:r,offsetCenter:a}}var WP={srcElement:"root",priority:0},Dv=class{constructor(e){this.handleEvent=r=>{if(this.isEmpty())return;let i=this._normalizeEvent(r),n=r.srcEvent.target;for(;n&&n!==i.rootElement;){if(this._emit(i,n),i.handled)return;n=n.parentNode}this._emit(i,"root")},this.eventManager=e,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,r,i,n=!1,o=!1){let{handlers:a,handlersByElement:l}=this,u=WP;typeof i=="string"||i&&i.addEventListener?u={...WP,srcElement:i}:i&&(u={...WP,...i});let f=l.get(u.srcElement);f||(f=[],l.set(u.srcElement,f));let _={type:e,handler:r,srcElement:u.srcElement,priority:u.priority};n&&(_.once=!0),o&&(_.passive=!0),a.push(_),this._active=this._active||!_.passive;let w=f.length-1;for(;w>=0&&!(f[w].priority>=_.priority);)w--;f.splice(w+1,0,_)}remove(e,r){let{handlers:i,handlersByElement:n}=this;for(let o=i.length-1;o>=0;o--){let a=i[o];if(a.type===e&&a.handler===r){i.splice(o,1);let l=n.get(a.srcElement);l.splice(l.indexOf(a),1),l.length===0&&n.delete(a.srcElement)}}this._active=i.some(o=>!o.passive)}_emit(e,r){let i=this.handlersByElement.get(r);if(i){let n=!1,o=()=>{e.handled=!0},a=()=>{e.handled=!0,n=!0},l=[];for(let u=0;u<i.length;u++){let{type:f,handler:_,once:w}=i[u];if(_({...e,type:f,stopPropagation:o,stopImmediatePropagation:a}),w&&l.push(i[u]),n)break}for(let u=0;u<l.length;u++){let{type:f,handler:_}=l[u];this.remove(f,_)}}}_normalizeEvent(e){let r=this.eventManager.getElement();return{...e,...vU(e),...xU(e,r),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};var Coe={events:null,recognizers:null,recognizerOptions:{},Manager:nU,touchAction:"none",tabIndex:0},u0=class{constructor(e=null,r){this._onBasicInput=n=>{let{srcEvent:o}=n,a=aU[o.type];a&&this.manager.emit(a,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={...Coe,...r},this.events=new Map,this.setElement(e);let{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(e){if(this.element&&this.destroy(),this.element=e,!e)return;let{options:r}=this,i=r.Manager;this.manager=new i(e,{touchAction:r.touchAction,recognizers:r.recognizers||oU}).on("hammer.input",this._onBasicInput),r.recognizers||Object.keys(jP).forEach(n=>{let o=this.manager.get(n);o&&jP[n].forEach(a=>{o.recognizeWith(a)})});for(let n in r.recognizerOptions){let o=this.manager.get(n);if(o){let a=r.recognizerOptions[n];delete a.enable,o.set(a)}}this.wheelInput=new Pv(e,this._onOtherEvent,{enable:!1}),this.moveInput=new Rv(e,this._onOtherEvent,{enable:!1}),this.keyInput=new Bv(e,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new Ov(e,this._onOtherEvent,{enable:!1});for(let[n,o]of this.events)o.isEmpty()||(this._toggleRecognizer(o.recognizerName,!0),this.manager.on(n,o.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(e,r,i){this._addEventHandler(e,r,i,!1)}once(e,r,i){this._addEventHandler(e,r,i,!0)}watch(e,r,i){this._addEventHandler(e,r,i,!1,!0)}off(e,r){this._removeEventHandler(e,r)}_toggleRecognizer(e,r){let{manager:i}=this;if(!i)return;let n=i.get(e);if(n&&n.options.enable!==r){n.set({enable:r});let o=sU[e];o&&!this.options.recognizers&&o.forEach(a=>{let l=i.get(a);r?(l.requireFailure(e),n.dropRequireFailure(a)):l.dropRequireFailure(e)})}this.wheelInput.enableEventType(e,r),this.moveInput.enableEventType(e,r),this.keyInput.enableEventType(e,r),this.contextmenuInput.enableEventType(e,r)}_addEventHandler(e,r,i,n,o){if(typeof e!="string"){i=r;for(let _ in e)this._addEventHandler(_,e[_],i,n,o);return}let{manager:a,events:l}=this,u=GP[e]||e,f=l.get(u);f||(f=new Dv(this),l.set(u,f),f.recognizerName=lU[u]||u,a&&a.on(u,f.handleEvent)),f.add(e,r,i,n,o),f.isEmpty()||this._toggleRecognizer(f.recognizerName,!0)}_removeEventHandler(e,r){if(typeof e!="string"){for(let a in e)this._removeEventHandler(a,e[a]);return}let{events:i}=this,n=GP[e]||e,o=i.get(n);if(o&&(o.remove(e,r),o.isEmpty())){let{recognizerName:a}=o,l=!1;for(let u of i.values())if(u.recognizerName===a&&!u.isEmpty()){l=!0;break}l||this._toggleRecognizer(a,!1)}}};function gp(){}var Moe=({isDragging:t})=>t?"grabbing":"grab",bU={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{type:"webgl"},gl:null,glOptions:{},canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:gp,onWebGLInitialized:gp,onResize:gp,onViewStateChange:gp,onInteractionStateChange:gp,onBeforeRender:gp,onAfterRender:gp,onLoad:gp,onError:t=>br.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:Moe,getTooltip:null,debug:!1,drawPickingColors:!1},m2=class{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new Hl({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=i=>{let{_pickRequest:n}=this;if(i.type==="pointerleave")n.x=-1,n.y=-1,n.radius=0;else{if(i.leftButton||i.rightButton)return;{let o=i.offsetCenter;if(!o)return;n.x=o.x,n.y=o.y,n.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:n.x,y:n.y}),n.event=i},this._onEvent=i=>{let n=rv[i.type],o=i.offsetCenter;if(!n||!o||!this.layerManager)return;let a=this.layerManager.getLayers(),l=this.deckPicker.getLastPickedObject({x:o.x,y:o.y,layers:a,viewports:this.getViewports(o)},this._lastPointerDownInfo),{layer:u}=l,f=u&&(u[n.handler]||u.props[n.handler]),_=this.props[n.handler],w=!1;f&&(w=f.call(u,l,i)),w||(_?.(l,i),this.widgetManager.onEvent(l,i))},this._onPointerDown=i=>{let n=i.offsetCenter,o=this._pick("pickObject","pickObject Time",{x:n.x,y:n.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=o.result[0]||o.emptyInfo},this.props={...bU,...e},e=this.props,e.viewState&&e.initialViewState&&br.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=e.initialViewState,e.device?this.device=e.device:e.gl&&(e.gl instanceof WebGLRenderingContext&&br.error("WebGL1 context not supported.")(),this.device=hf.attach(e.gl));let r=this.device;r||(Xc.registerDevices([hf]),r=Xc.createDevice({...e.deviceProps,canvas:this._createCanvas(e)}),r.then(i=>{this.device=i})),this.animationLoop=this._createAnimationLoop(r,e),this.setProps(e),e._typedArrayManagerProps&&mh.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.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(e){this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&br.removed("onLayerHover","onHover")(),"onLayerClick"in e&&br.removed("onLayerClick","onClick")(),e.initialViewState&&!Ws(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop?.setProps(r),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r),this.widgetManager.setProps(r)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(e),n=this.layerManager.needsRedraw(e),o=this.effectManager.needsRedraw(e),a=this.deckRenderer.needsRedraw(e);return r=r||i||n||o||a,r}redraw(e){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=e||r,r&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return ss(this.viewManager),this.viewManager.views}getViewports(e){return ss(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){let r=this._pick("pickObject","pickObject Time",e).result;return r.length?r[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_addResources(e,r=!1){for(let i in e)this.layerManager.resourceManager.add({resourceId:i,data:e[i],forceUpdate:r})}_removeResources(e){for(let r of e)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_pick(e,r,i){ss(this.deckPicker);let{stats:n}=this;n.get("Pick Count").incrementCount(),n.get(r).timeStart();let o=this.deckPicker[e]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i});return n.get(r).timeEnd(),o}_createCanvas(e){let r=e.canvas;return typeof r=="string"&&(r=document.getElementById(r),ss(r)),r||(r=document.createElement("canvas"),r.id=e.id||"deckgl-overlay",(e.parent||document.body).appendChild(r)),Object.assign(r.style,e.style),r}_setCanvasSize(e){if(!this.canvas)return;let{width:r,height:i}=e;if(r||r===0){let n=Number.isFinite(r)?`${r}px`:r;this.canvas.style.width=n}if(i||i===0){let n=Number.isFinite(i)?`${i}px`:i;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=n}}_updateCanvasSize(){let{canvas:e}=this;if(!e)return;let r=e.clientWidth??e.width,i=e.clientHeight??e.height;(r!==this.width||i!==this.height)&&(this.width=r,this.height=i,this.viewManager?.setProps({width:r,height:i}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:i}))}_createAnimationLoop(e,r){let{gl:i,onError:n,useDevicePixels:o}=r;return new lv({device:e,useDevicePixels:o,autoResizeDrawingBuffer:!i,autoResizeViewport:!1,onInitialize:a=>this._setDevice(a.device),onRender:this._onRenderFrame.bind(this),onError:n})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let e=this.props.views||[new LA({id:"default-view"})];return e=Array.isArray(e)?e:[e],e.length&&this.props.controller&&(e[0].props.controller=this.props.controller),e}_onContextLost(){let{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){let{_pickRequest:e}=this;if(e.event){let{result:r,emptyInfo:i}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=r.length>0;let n=i,o=!1;for(let a of r)n=a,o=a.layer?.onHover(a,e.event)||o;o||(this.props.onHover?.(n,e.event),this.widgetManager.onHover(n,e.event)),e.event=null}}_updateCursor(){let e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){if(this.device=e,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas),this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device instanceof hf&&this.props.onWebGLInitialized(this.device.gl);let r=new MA;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new u0(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let n in rv)this.eventManager.on(n,this._onEvent);this.viewManager=new xv({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let i=this.viewManager.getViewports()[0];this.layerManager=new BA(this.device,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new Ev,this.deckRenderer=new FA(this.device),this.deckPicker=new Cv(this.device),this.widgetManager=new d2({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new Mv),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,r){let{device:i,gl:n}=this.layerManager.context;i.setParametersWebGL(this.props.parameters),this.props.onBeforeRender({device:i,gl:n});let o={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...r};this.deckRenderer?.renderLayers(o),o.pass==="screen"&&this.widgetManager.onRedraw({viewports:o.viewports,layers:o.layers}),this.props.onAfterRender({device:i,gl:n})}_onRenderFrame(e){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),br.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){let r=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){let{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();let r=this.animationLoop.stats;e.get("GPU Time").addTime(r.get("GPU Time").lastTiming),e.get("CPU Time").addTime(r.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:e,stats:r}=this;e.fps=r.get("frameRate").getHz(),e.setPropsTime=r.get("setProps Time").time,e.updateAttributesTime=r.get("Update Attributes").time,e.framesRedrawn=r.get("Redraw Count").count,e.pickTime=r.get("pickObject Time").time+r.get("pickMultipleObjects Time").time+r.get("pickObjects Time").time,e.pickCount=r.get("Pick Count").count,e.gpuTime=r.get("GPU Time").time,e.cpuTime=r.get("CPU Time").time,e.gpuTimePerFrame=r.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=r.get("CPU Time").getAverageTime();let i=Xc.stats.get("Memory Usage");e.bufferMemory=i.get("Buffer Memory").count,e.textureMemory=i.get("Texture Memory").count,e.renderbufferMemory=i.get("Renderbuffer Memory").count,e.gpuMemory=i.get("GPU Memory").count}},pd=m2;(()=>{m2.defaultProps=bU})(),(()=>{m2.VERSION=mw})();function wU(t){switch(t){case"float64":return Float64Array;default:return My(t)}}var TU=Gb;function Lv(t,e){return{attribute:t,format:e.size>1?`${e.type}x${e.size}`:e.type,byteOffset:e.offset||0}}function _p(t){return t.stride||t.size*t.bytesPerElement}function EU(t,e){return t.type===e.type&&t.size===e.size&&_p(t)===_p(e)&&(t.offset||0)===(e.offset||0)}function qP(t,e){e.offset&&br.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let r=_p(t),i=e.vertexOffset!==void 0?e.vertexOffset:t.vertexOffset||0,n=e.elementOffset||0,o=i*r+n*t.bytesPerElement+(t.offset||0);return{...e,offset:o,stride:r}}function Ioe(t,e){let r=qP(t,e);return{high:r,low:{...r,offset:r.offset+t.size*4}}}var Fv=class{constructor(e,r,i){this._buffer=null,this.device=e,this.id=r.id||"",this.size=r.size||1;let n=r.logicalType||r.type,o=n==="float64",{defaultValue:a}=r;a=Number.isFinite(a)?[a]:a||new Array(this.size).fill(0);let l;o?l="float32":!n&&r.isIndexed?l="uint32":l=n||"float32";let u=wU(n||l);this.doublePrecision=o,o&&r.fp64===!1&&(u=Float32Array),this.value=null,this.settings={...r,defaultType:u,defaultValue:a,logicalType:n,type:l,normalized:l.includes("norm"),size:this.size,bytesPerElement:u.BYTES_PER_ELEMENT},this.state={...i,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let e=this.getAccessor();return e.vertexOffset?e.vertexOffset*_p(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),mh.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,r=null){let i={};if(this.state.constant){let n=this.value;if(r){let o=qP(this.getAccessor(),r),a=o.offset/n.BYTES_PER_ELEMENT,l=o.size||this.size;i[e]=n.subarray(a,a+l)}else i[e]=n}else i[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?i[`${e}64Low`]=i[e]:i[`${e}64Low`]=new Float32Array(this.size)),i}getBufferLayout(e=this.id,r=null){let i=this.getAccessor(),n=[],o={name:this.id,byteStride:_p(i),attributes:n};if(this.doublePrecision){let a=Ioe(i,r||{});n.push(Lv(e,{...i,...a.high}),Lv(`${e}64Low`,{...i,...a.low}))}else if(r){let a=qP(i,r);n.push(Lv(e,{...i,...a}))}else n.push(Lv(e,i));return o}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){let r=Array.from(this.value);e=[r,r]}else{let{value:r,numInstances:i,size:n}=this,o=i*n;if(r&&o&&r.length>=o){let a=new Array(n).fill(1/0),l=new Array(n).fill(-1/0);for(let u=0;u<o;)for(let f=0;f<n;f++){let _=r[u++];_<a[f]&&(a[f]=_),_>l[f]&&(l[f]=_)}e=[a,l]}}return this.state.bounds=e,e}setData(e){let{state:r}=this,i;ArrayBuffer.isView(e)?i={value:e}:e instanceof cn?i={buffer:e}:i=e;let n={...this.settings,...i};if(ArrayBuffer.isView(i.value)){if(!i.type)if(this.doublePrecision&&i.value instanceof Float64Array)n.type="float32";else{let a=TU(i.value);n.type=n.normalized?a.replace("int","norm"):a}n.bytesPerElement=i.value.BYTES_PER_ELEMENT,n.stride=_p(n)}if(r.bounds=null,i.constant){let o=i.value;if(o=this._normalizeValue(o,[],0),this.settings.normalized&&(o=this.normalizeConstant(o)),!(!r.constant||!this._areValuesEqual(o,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=ArrayBuffer.isView(o)?o:new Float32Array(o)}else if(i.buffer){let o=i.buffer;r.externalBuffer=o,r.constant=!1,this.value=i.value||null}else if(i.value){this._checkExternalBuffer(i);let o=i.value;r.externalBuffer=null,r.constant=!1,this.value=o;let{buffer:a}=this,l=_p(n),u=(n.vertexOffset||0)*l;if(this.doublePrecision&&o instanceof Float64Array&&(o=o2(o,n)),this.settings.isIndexed){let _=this.settings.defaultType;o.constructor!==_&&(o=new _(o))}let f=o.byteLength+u+l*2;(!a||a.byteLength<f)&&(a=this._createBuffer(f)),a.write(o,u)}return this.setAccessor(n),!0}updateSubBuffer(e={}){this.state.bounds=null;let r=this.value,{startOffset:i=0,endOffset:n}=e;this.buffer.write(this.doublePrecision&&r instanceof Float64Array?o2(r,{size:this.size,startIndex:i,endIndex:n}):r.subarray(i,n),i*r.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,r=!1){let{state:i}=this,n=i.allocatedValue,o=mh.allocate(n,e+1,{size:this.size,type:this.settings.defaultType,copy:r});this.value=o;let{byteOffset:a}=this,{buffer:l}=this;return(!l||l.byteLength<o.byteLength+a)&&(l=this._createBuffer(o.byteLength+a),r&&n&&l.write(n instanceof Float64Array?o2(n,this):n,a)),i.allocatedValue=o,i.constant=!1,i.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){let{value:r}=e;if(!ArrayBuffer.isView(r))throw new Error(`Attribute ${this.id} value is not TypedArray`);let i=this.settings.defaultType,n=!1;if(this.doublePrecision&&(n=r.BYTES_PER_ELEMENT<4),n)throw new Error(`Attribute ${this.id} does not support ${r.constructor.name}`);!(r instanceof i)&&this.settings.normalized&&!("normalized"in e)&&br.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(r=>(r+128)/255*2-1);case"snorm16":return new Float32Array(e).map(r=>(r+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(r=>r/255);case"unorm16":return new Float32Array(e).map(r=>r/65535);default:return e}}_normalizeValue(e,r,i){let{defaultValue:n,size:o}=this.settings;if(Number.isFinite(e))return r[i]=e,r;if(!e){let a=o;for(;--a>=0;)r[i+a]=n[a];return r}switch(o){case 4:r[i+3]=Number.isFinite(e[3])?e[3]:n[3];case 3:r[i+2]=Number.isFinite(e[2])?e[2]:n[2];case 2:r[i+1]=Number.isFinite(e[1])?e[1]:n[1];case 1:r[i+0]=Number.isFinite(e[0])?e[0]:n[0];break;default:let a=o;for(;--a>=0;)r[i+a]=Number.isFinite(e[a])?e[a]:n[a]}return r}_areValuesEqual(e,r){if(!e||!r)return!1;let{size:i}=this;for(let n=0;n<i;n++)if(e[n]!==r[n])return!1;return!0}_createBuffer(e){this._buffer&&this._buffer.destroy();let{isIndexed:r,type:i}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:r?cn.INDEX:cn.VERTEX,indexType:r?i:void 0,byteLength:e}),this._buffer}};var SU=[],CU=[];function na(t,e=0,r=1/0){let i=SU,n={index:-1,data:t,target:[]};return t?typeof t[Symbol.iterator]=="function"?i=t:t.length>0&&(CU.length=t.length,i=CU):i=SU,(e>0||Number.isFinite(r))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(e,r),n.index=e-1),{iterable:i,objectInfo:n}}function g2(t){return t&&t[Symbol.asyncIterator]}function _2(t,e){let{size:r,stride:i,offset:n,startIndices:o,nested:a}=e,l=t.BYTES_PER_ELEMENT,u=i?i/l:r,f=n?n/l:0,_=Math.floor((t.length-f)/u);return(w,{index:E,target:M})=>{if(!o){let $=E*u+f;for(let te=0;te<r;te++)M[te]=t[$+te];return M}let D=o[E],j=o[E+1]||_,V;if(a){V=new Array(j-D);for(let $=D;$<j;$++){let te=$*u+f;M=new Array(r);for(let ne=0;ne<r;ne++)M[ne]=t[te+ne];V[$-D]=M}}else if(u===r)V=t.subarray(D*r+f,j*r+f);else{V=new t.constructor((j-D)*r);let $=0;for(let te=D;te<j;te++){let ne=te*u+f;for(let le=0;le<r;le++)V[$++]=t[ne+le]}}return V}}var MU=[],Nv=[[0,1/0]];function IU(t,e){if(t===Nv||(e[0]<0&&(e[0]=0),e[0]>=e[1]))return t;let r=[],i=t.length,n=0;for(let o=0;o<i;o++){let a=t[o];a[1]<e[0]?(r.push(a),n=o+1):a[0]>e[1]?r.push(a):e=[Math.min(a[0],e[0]),Math.max(a[1],e[1])]}return r.splice(n,0,e),r}function XP(t){let{source:e,target:r,start:i=0,size:n,getData:o}=t,a=t.end||r.length,l=e.length,u=a-i;if(l>u){r.set(e.subarray(0,u),i);return}if(r.set(e,i),!o)return;let f=l;for(;f<u;){let _=o(f,e);for(let w=0;w<n;w++)r[i+f]=_[w]||0,f++}}function PU({source:t,target:e,size:r,getData:i,sourceStartIndices:n,targetStartIndices:o}){if(!Array.isArray(o))return XP({source:t,target:e,size:r,getData:i}),e;let a=0,l=0,u=i&&((_,w)=>i(_+l,w)),f=Math.min(n.length,o.length);for(let _=1;_<f;_++){let w=n[_]*r,E=o[_]*r;XP({source:t.subarray(a,w),target:e,start:l,end:E,size:r,getData:u}),a=w,l=E}return l<e.length&&XP({source:[],target:e,start:l,size:r,getData:u}),e}var Roe={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function y2(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});let r=t.type||"interpolation";return{...Roe[r],...e,...t,type:r}}function v2(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${t}"`)}}function x2(t){switch(t){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function b2(t){t.push(t.shift())}function kv(t,e){let{doublePrecision:r,settings:i,value:n,size:o}=t,a=r&&n instanceof Float64Array?2:1;return(i.noAlloc?n.length:e*o)*a}function w2({buffer:t,numInstances:e,attribute:r,fromLength:i,fromStartIndices:n,getData:o=a=>a}){let a=r.doublePrecision&&r.value instanceof Float64Array?2:1,l=r.size*a,u=r.byteOffset,f=r.startIndices,_=n&&f,w=kv(r,e),E=r.isConstant;if(!_&&i>=w)return t;let M=E?r.value:RU(r.getBuffer().readSyncWebGL());if(r.settings.normalized&&!E){let $=o;o=(te,ne)=>r.normalizeConstant($(te,ne))}let D=E?($,te)=>o(M,te):($,te)=>o(M.subarray($+u,$+u+l),te),j=RU(t.readSyncWebGL()),V=new Float32Array(w);return PU({source:j,target:V,sourceStartIndices:n,targetStartIndices:f,size:l,getData:D}),t.byteLength<V.byteLength+u&&(t=t.device.createBuffer({byteLength:V.byteLength+u})),t.write(V,u),t}function RU(t){return new Float32Array(t.buffer,t.byteOffset,t.byteLength/Float32Array.BYTES_PER_ELEMENT)}var Ad=class extends Fv{constructor(e,r){super(e,r,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:Nv}),this.constant=!1,this.settings.update=r.update||(r.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){let r=this.state.needsRedraw;return this.state.needsRedraw=r&&!e,r}layoutChanged(){return this.state.layoutChanged}setAccessor(e){this.state.layoutChanged||=!EU(e,this.getAccessor()),super.setAccessor(e)}getUpdateTriggers(){let{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;let{accessor:r}=this.settings,i=this.settings.transition,n=Array.isArray(r)?e[r.find(o=>e[o])]:e[r];return y2(n,i)}setNeedsUpdate(e=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),r){let{startRow:i=0,endRow:n=1/0}=r;this.state.updateRanges=IU(this.state.updateRanges,[i,n])}else this.state.updateRanges=Nv}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=MU}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){let{state:r,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(e,r.updateRanges!==Nv),!0):!1}updateBuffer({numInstances:e,data:r,props:i,context:n}){if(!this.needsUpdate())return!1;let{state:{updateRanges:o},settings:{update:a,noAlloc:l}}=this,u=!0;if(a){for(let[f,_]of o)a.call(n,this,{data:r,startRow:f,endRow:_,props:i,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[f,_]of o){let w=Number.isFinite(f)?this.getVertexOffset(f):0,E=Number.isFinite(_)?this.getVertexOffset(_):l||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:w,endOffset:E})}this._checkAttributeArray()}else u=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),u}setConstantValue(e){return e===void 0||typeof e=="function"?!1:(this.setData({constant:!0,value:e})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}setExternalBuffer(e){let{state:r}=this;return e?(this.clearNeedsUpdate(),r.lastExternalBuffer===e||(r.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e)),!0):(r.lastExternalBuffer=null,!1)}setBinaryValue(e,r=null){let{state:i,settings:n}=this;if(!e)return i.binaryValue=null,i.binaryAccessor=null,!1;if(n.noAlloc)return!1;if(i.binaryValue===e)return this.clearNeedsUpdate(),!0;if(i.binaryValue=e,this.setNeedsRedraw(),n.transform||r!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});let a=e;ss(ArrayBuffer.isView(a.value),`invalid ${n.accessor}`);let l=Boolean(a.size)&&a.size!==this.size;return i.binaryAccessor=_2(a.value,{size:a.size||this.size,stride:a.stride,offset:a.offset,startIndices:r,nested:l}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){let{startIndices:r}=this;return(r?e<r.length?r[e]:this.numInstances:e)*this.size}getValue(){let e=this.settings.shaderAttributes,r=super.getValue();if(!e)return r;for(let i in e)Object.assign(r,super.getValue(i,e[i]));return r}getBufferLayout(){this.state.layoutChanged=!1;let e=this.settings.shaderAttributes,r=super.getBufferLayout();if(!e)return r;for(let i in e){let n=super.getBufferLayout(i,e[i]);r.attributes.push(...n.attributes)}return r}_autoUpdater(e,{data:r,startRow:i,endRow:n,props:o,numInstances:a}){if(e.constant)return;let{settings:l,state:u,value:f,size:_,startIndices:w}=e,{accessor:E,transform:M}=l,D=u.binaryAccessor||(typeof E=="function"?E:o[E]);ss(typeof D=="function",`accessor "${E}" is not a function`);let j=e.getVertexOffset(i),{iterable:V,objectInfo:$}=na(r,i,n);for(let te of V){$.index++;let ne=D(te,$);if(M&&(ne=M.call(this,ne)),w){let le=($.index<w.length-1?w[$.index+1]:a)-w[$.index];if(ne&&Array.isArray(ne[0])){let z=j;for(let ke of ne)e._normalizeValue(ke,f,z),z+=_}else ne&&ne.length>_?f.set(ne,j):(e._normalizeValue(ne,$.target,0),h2({target:f,source:$.target,start:j,count:le}));j+=le*_}else e._normalizeValue(ne,f,j),j+=_}}_validateAttributeUpdaters(){let{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:e}=this,r=Math.min(4,this.size);if(e&&e.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(e[3]);case 3:i=i&&Number.isFinite(e[2]);case 2:i=i&&Number.isFinite(e[1]);case 1:i=i&&Number.isFinite(e[0]);break;default:i=!1}if(!i)throw new Error(`Illegal attribute generated for ${this.id}`)}}};var Uv=class{constructor({device:e,attribute:r,timeline:i}){this.type="interpolation",this.device=e,this.transition=new $c(i),this.attribute=r,this.attributeInTransition=new Ad(e,r.settings),ArrayBuffer.isView(r.value)&&this.attributeInTransition.setData(r.value),this.currentStartIndices=r.startIndices,this.currentLength=0,this.transform=Ooe(e,r);let n={byteLength:r.buffer.byteLength,usage:35050};this.buffers=[e.createBuffer(n),e.createBuffer(n)]}get inProgress(){return this.transition.inProgress}start(e,r){if(e.duration<=0){this.transition.cancel();return}this.settings=e;let{buffers:i,attribute:n}=this;b2(i);let o={numInstances:r,attribute:n,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:e.enter};for(let[a,l]of i.entries()){let u=w2({buffer:l,...o});l!==u&&(l.destroy(),i[a]=u,console.warn(`[GPUInterpolationTransition] Replaced buffer ${l.id} (${l.byteLength} bytes) \u2192 ${u.id} (${u.byteLength} bytes)`))}this.currentStartIndices=n.startIndices,this.currentLength=kv(n,r),this.attributeInTransition.setData({buffer:i[1],value:n.value}),this.transition.start(e),this.transform.model.setVertexCount(Math.floor(this.currentLength/n.size)),this.transform.model.setAttributes(n.getBuffer()?{aFrom:i[0],aTo:n.getBuffer()}:{aFrom:i[0]}),this.transform.transformFeedback.setBuffers({vCurrent:i[1]})}update(){let e=this.transition.update();if(e){let{duration:r,easing:i}=this.settings,{time:n}=this.transition,o=n/r;i&&(o=i(o)),this.transform.model.setUniforms({time:o}),this.transform.run()}return e}cancel(){this.transition.cancel(),this.transform.delete();for(let e of this.buffers)e.delete();this.buffers.length=0}},Boe=`#version 300 es
|
|
1715
|
+
`;function jne(t,e){if(e.filter){let r=typeof e.filter=="string"?e.filter:`${t.name}_filterColor`;return Vne(r)}if(e.sampler){let r=typeof e.sampler=="string"?e.sampler:`${t.name}_sampleColor`;return Hne(r)}return""}var X6={blendFunc:[1,0,32771,0],blendEquation:32774},ld=class extends Ah{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,pickingFBO:a,deviceRect:{x:l,y:u,width:f,height:_},cullRect:w,effects:E,pass:M="picking",pickZ:D,moduleParameters:j}){this.pickZ=D;let V=this._resetColorEncoder(D),$=this.device.withParametersWebGL({scissorTest:!0,scissor:[l,u,f,_],depthMask:!0,depthTest:!0,depthRange:[0,1],colorMask:[!0,!0,!0,!0],...X6,blend:!D},()=>super.render({target:a,layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,cullRect:w,effects:E?.filter(ne=>ne.useInPicking),pass:M,isPicking:!0,moduleParameters:j,clearColor:[0,0,0,0]}));return this._colorEncoderState=null,{decodePickingColor:V&&Wne.bind(null,V),stats:$}}shouldDrawLayer(e){let{pickable:r,operation:i}=e.props;return r&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getModuleParameters(){return{picking:{isActive:1,isAttribute:this.pickZ},lightSources:{}}}getLayerParameters(e,r,i){let n={...e.props.parameters},{pickable:o,operation:a}=e.props;return this._colorEncoderState?o&&a.includes("draw")&&(Object.assign(n,X6),n.blend=!0,n.blendColor=Gne(this._colorEncoderState,e,i)):n.blend=!1,a.includes("terrain")&&(n.blend=!1),n}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function Gne(t,e,r){let{byLayer:i,byAlpha:n}=t,o,a=i.get(e);return a?(a.viewports.push(r),o=a.a):(o=i.size+1,o<=255?(a={a:o,layer:e,viewports:[r]},i.set(e,a),n[o]=a):(br.warn("Too many pickable layers, only picking the first 255")(),o=0)),[0,0,0,o/255]}function Wne(t,e){let r=t.byAlpha[e[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(e)}}var Ap={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"},a0=Symbol.for("component"),Nu=Symbol.for("propTypes"),u2=Symbol.for("deprecatedProps"),cd=Symbol.for("asyncPropDefaults"),_f=Symbol.for("asyncPropOriginal"),gh=Symbol.for("asyncPropResolved");function yf(t,e=()=>!0){return Array.isArray(t)?Y6(t,e,[]):e(t)?[t]:[]}function Y6(t,e,r){let i=-1;for(;++i<t.length;){let n=t[i];Array.isArray(n)?Y6(n,e,r):e(n)&&r.push(n)}return r}function h2({target:t,source:e,start:r=0,count:i=1}){let n=e.length,o=i*n,a=0;for(let l=r;a<n;a++)t[l++]=e[a];for(;a<o;)a<o-a?(t.copyWithin(r+a,r,r+a),a*=2):(t.copyWithin(r+a,r,r+o-a),a=o);return t}var yv=class{constructor(e,r,i){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=i,this.setData(r)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,r){if(e===this._data&&!r)return;this._data=e;let i=++this._loadCount,n=e;typeof e=="string"&&(n=Ca(e)),n instanceof Promise?(this.isLoaded=!1,this._loader=n.then(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=o)}).catch(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=o||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(let o of this._subscribers)o.onChange(this.getData())}};var vv=class{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:r,forceUpdate:i=!1,persistent:n=!0}){let o=this._resources[e];o?o.setData(r,i):(o=new yv(e,r,this._context),this._resources[e]=o),o.persistent=n}remove(e){let r=this._resources[e];r&&(r.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){let r=this._consumers[e];if(r){for(let i in r){let n=r[i],o=this._resources[n.resourceId];o&&o.unsubscribe(n)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:r,consumerId:i,requestId:n="default"}){let{_resources:o,protocol:a}=this;e.startsWith(a)&&(e=e.replace(a,""),o[e]||this.add({resourceId:e,data:null,persistent:!1}));let l=o[e];if(this._track(i,n,l,r),l)return l.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let e in this._resources)this._resources[e].delete()}_track(e,r,i,n){let o=this._consumers,a=o[e]=o[e]||{},l=a[r],u=l&&l.resourceId&&this._resources[l.resourceId];u&&(u.unsubscribe(l),this.prune()),i&&(l?(l.onChange=n,l.resourceId=i.id):l={onChange:n,resourceId:i.id},a[r]=l,i.subscribe(l))}_prune(){this._pruneRequest=null;for(let e of Object.keys(this._resources)){let r=this._resources[e];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[e])}}};var qne="layerManager.setLayers",Xne="layerManager.activateViewport",BA=class{constructor(e,r){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this.activateViewport=l=>{ia(Xne,this,l),l&&(this.context.viewport=l)};let{deck:i,stats:n,viewport:o,timeline:a}=r||{};this.layers=[],this.resourceManager=new vv({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:i,shaderAssembler:r0(),pipelineFactory:e&&n2(e),renderPass:void 0,stats:n||new Hl({id:"deck.gl"}),viewport:o||new Za({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:a||new MA,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(let i of this.layers){let n=i.getNeedsRedraw(e);r=r||n}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(r=>e.find(i=>r.id.indexOf(i)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,r){ia(qne,this,r,e),this._lastRenderedLayers=e;let i=yf(e,Boolean);for(let n of i)n.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}_handleError(e,r,i){i.raiseError(r,`${e} of ${i}`)}_updateLayers(e,r){let i={};for(let a of e)i[a.id]?br.warn(`Multiple old layers with same id ${a.id}`)():i[a.id]=a;let n=[];this._updateSublayersRecursively(r,i,n),this._finalizeOldLayers(i);let o=!1;for(let a of n)if(a.hasUniformTransition()){o=`Uniform transition in ${a}`;break}this._needsUpdate=o,this.layers=n}_updateSublayersRecursively(e,r,i){for(let n of e){n.context=this.context;let o=r[n.id];o===null&&br.warn(`Multiple new layers with same id ${n.id}`)(),r[n.id]=null;let a=null;try{this._debug&&o!==n&&n.validateProps(),o?(this._transferLayerState(o,n),this._updateLayer(n)):this._initializeLayer(n),i.push(n),a=n.isComposite?n.getSubLayers():null}catch(l){this._handleError("matching",l,n)}a&&this._updateSublayersRecursively(a,r,i)}}_finalizeOldLayers(e){for(let r in e){let i=e[r];i&&this._finalizeLayer(i)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Ap.INITIALIZED}catch(r){this._handleError("initialization",r,e)}}_transferLayerState(e,r){r._transferState(e),r.lifecycle=Ap.MATCHED,r!==e&&(e.lifecycle=Ap.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(r){this._handleError("update",r,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Ap.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Ap.FINALIZED}catch(r){this._handleError("finalization",r,e)}}};function Ws(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!Ws(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!Ws(t[o],e[o],r-1))return!1;return!0}return!1}var xv=class{constructor(e){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},Object.seal(this),this.setProps(e)}finalize(){for(let e in this.controllers){let r=this.controllers[e];r&&r.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(let e in this.controllers){let r=this.controllers[e];r&&r.updateTransition()}}getViewports(e){return e?this._viewports.filter(r=>r.containsPixel(e)):this._viewports}getViews(){let e={};return this.views.forEach(r=>{e[r.id]=r}),e}getView(e){return this.views.find(r=>r.id===e)}getViewState(e){let r=typeof e=="string"?this.getView(e):e,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(e){return this._viewportMap[e]}unproject(e,r){let i=this.getViewports(),n={x:e[0],y:e[1]};for(let o=i.length-1;o>=0;--o){let a=i[o];if(a.containsPixel(n)){let l=e.slice();return l[0]-=a.x,l[1]-=a.y,a.unproject(l,r)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,r){(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,this.setNeedsUpdate("Size changed"))}_setViews(e){e=yf(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!Ws(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):br.warn("missing `viewState` or `initialViewState`")()}_onViewStateChange(e,r){this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange({...r,viewId:e})}_createController(e,r){let i=r.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,r.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:o=>this.getView(e.id)?.makeViewport({viewState:o,width:this.width,height:this.height})})}_updateController(e,r,i,n){let o=e.controller;if(o&&i){let a={...r,...o,id:e.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!n||n.constructor!==o.type)&&(n=this._createController(e,a)),n&&n.setProps(a),n}return null}_rebuildViewports(){let{views:e}=this,r=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let n=e.length;n--;){let o=e[n],a=this.getViewState(o),l=o.makeViewport({viewState:a,width:this.width,height:this.height}),u=r[o.id],f=Boolean(o.controller);f&&!u&&(i=!0),(i||!f)&&u&&(u.finalize(),u=null),this.controllers[o.id]=this._updateController(o,a,l,u),l&&this._viewports.unshift(l)}for(let n in r){let o=r[n];o&&!this.controllers[n]&&o.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,r){return e.length!==r.length?!0:e.some((i,n)=>!e[n].equals(r[n]))}};var Yne=/([0-9]+\.?[0-9]*)(%|px)/;function ud(t){switch(typeof t){case"number":return{position:t,relative:!1};case"string":let e=Yne.exec(t);if(e&&e.length>=3){let r=e[2]==="%",i=parseFloat(e[1]);return{position:r?i/100:i,relative:r}}default:throw new Error(`Could not parse position string ${t}`)}}function hd(t,e){return t.relative?Math.round(t.position*e):t.position}function ss(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}var uc=class{constructor(e){let{id:r,x:i=0,y:n=0,width:o="100%",height:a="100%",padding:l=null,viewportInstance:u}=e||{};ss(!u||u instanceof Za),this.viewportInstance=u,this.id=r||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=ud(i),this._y=ud(n),this._width=ud(o),this._height=ud(a),this._padding=l&&{left:ud(l.left||0),right:ud(l.right||0),top:ud(l.top||0),bottom:ud(l.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.viewportInstance?e.viewportInstance?this.viewportInstance.equals(e.viewportInstance):!1:this.ViewportType===e.ViewportType&&Ws(this.props,e.props,2)}makeViewport({width:e,height:r,viewState:i}){if(this.viewportInstance)return this.viewportInstance;i=this.filterViewState(i);let n=this.getDimensions({width:e,height:r});return!n.height||!n.width?null:new this.ViewportType({...i,...this.props,...n})}getViewStateId(){let{viewState:e}=this.props;return typeof e=="string"?e:e?.id||this.id}filterViewState(e){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let r={...e};for(let i in this.props.viewState)i!=="id"&&(r[i]=this.props.viewState[i]);return r}return e}getDimensions({width:e,height:r}){let i={x:hd(this._x,e),y:hd(this._y,r),width:hd(this._width,e),height:hd(this._height,r)};return this._padding&&(i.padding={left:hd(this._padding.left,e),top:hd(this._padding.top,r),right:hd(this._padding.right,e),bottom:hd(this._padding.bottom,r)}),i}get controller(){let e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}};var $c=class{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:e,settings:r}=this;this._handle=e.addChannel({delay:e.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var K6=()=>{},bv={BREAK:1,SNAP_TO_END:2,IGNORE:3},Kne=t=>t,Zne=bv.BREAK,wv=class{constructor(e){this._onTransitionUpdate=r=>{let{time:i,settings:{interpolator:n,startProps:o,endProps:a,duration:l,easing:u}}=r,f=u(i/l),_=n.interpolateProps(o,a,f);this.propsInTransition=this.getControllerState({...this.props,..._}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new $c(e.timeline),this.onViewStateChange=e.onViewStateChange||K6,this.onStateChange=e.onStateChange||K6}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let r=!1,i=this.props;if(this.props=e,!i||this._shouldIgnoreViewportChange(i,e))return!1;if(this._isTransitionEnabled(e)){let n=i;if(this.transition.inProgress){let{interruption:o,endProps:a}=this.transition.settings;n={...i,...o===bv.SNAP_TO_END?a:this.propsInTransition||i}}this._triggerTransition(n,e),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(e){let{transitionDuration:r,transitionInterpolator:i}=e;return(r>0||r==="auto")&&Boolean(i)}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,r){return this.transition.inProgress?this.transition.settings.interruption===bv.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(e,r):!0}_triggerTransition(e,r){let i=this.getControllerState(e),n=this.getControllerState(r).shortestPathFrom(i),o=r.transitionInterpolator,a=o.getDuration?o.getDuration(e,r):r.transitionDuration;if(a===0)return;let l=o.initializeProps(e,n);this.propsInTransition={};let u={duration:a,easing:r.transitionEasing||Kne,interpolator:o,interruption:r.transitionInterruption||Zne,startProps:l.start,endProps:l.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(u),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(r)}}};var fd=class{constructor(e){let{compare:r,extract:i,required:n}=e;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=n}arePropsEqual(e,r){for(let i of this._propsToCompare)if(!(i in e)||!(i in r)||!Ns(e[i],r[i]))return!1;return!0}initializeProps(e,r){let i={},n={};for(let o of this._propsToExtract)(o in e||o in r)&&(i[o]=e[o],n[o]=r[o]);return this._checkRequiredProps(i),this._checkRequiredProps(n),{start:i,end:n}}getDuration(e,r){return r.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(r=>{let i=e[r];ss(Number.isFinite(i)||Array.isArray(i),`${r} is required for transition`)})}};var Jne=["longitude","latitude","zoom","bearing","pitch"],Qne=["longitude","latitude","zoom"],Dl=class extends fd{constructor(e={}){let r=Array.isArray(e)?e:e.transitionProps,i=Array.isArray(e)?{}:e;i.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:Jne,required:Qne},super(i.transitionProps),this.opts=i}initializeProps(e,r){let i=super.initializeProps(e,r),{makeViewport:n,around:o}=this.opts;if(n&&o){let a=n(e),l=n(r),u=a.unproject(o);i.start.around=o,Object.assign(i.end,{around:l.project(u),aroundPosition:u,width:r.width,height:r.height})}return i}interpolateProps(e,r,i){let n={};for(let o of this._propsToExtract)n[o]=Xa(e[o]||0,r[o]||0,i);if(r.aroundPosition&&this.opts.makeViewport){let o=this.opts.makeViewport({...r,...n});Object.assign(n,o.panByPosition(r.aroundPosition,Xa(e.around,r.around,i)))}return n}};var mp={transitionDuration:0},$ne=300,f2=t=>1-(1-t)*(1-t),l0={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},OA={},hc=class{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new wv({...e,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){for(let e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;let r=this._eventStartBlocked;switch(e.type){case"panstart":return r?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return r?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"tripanstart":return r?!1:this._onTriplePanStart(e);case"tripanmove":return this._onTriplePan(e);case"tripanend":return this._onTriplePanEnd(e);case"doubletap":return this._onDoubleTap(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){let{x:r,y:i}=this.props,{offsetCenter:n}=e;return[n.x-r,n.y-i]}isPointInBounds(e,r){let{width:i,height:n}=this.props;if(r&&r.handled)return!1;let o=e[0]>=0&&e[0]<=i&&e[1]>=0&&e[1]<=n;return o&&r&&r.stopPropagation(),o}isFunctionKeyPressed(e){let{srcEvent:r}=e;return Boolean(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=r}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:r}=e;this.inertia=Number.isFinite(r)?r:r===!0?$ne:0;let{scrollZoom:i=!0,dragPan:n=!0,dragRotate:o=!0,doubleClickZoom:a=!0,touchZoom:l=!0,touchRotate:u=!1,keyboard:f=!0}=e,_=Boolean(this.onViewStateChange);this.toggleEvents(l0.WHEEL,_&&i),this.toggleEvents(l0.PAN,_),this.toggleEvents(l0.PINCH,_&&(l||u)),this.toggleEvents(l0.TRIPLE_PAN,_&&u),this.toggleEvents(l0.DOUBLE_TAP,_&&a),this.toggleEvents(l0.KEYBOARD,_&&f),this.scrollZoom=i,this.dragPan=n,this.dragRotate=o,this.doubleClickZoom=a,this.touchZoom=l,this.touchRotate=u,this.keyboard=f}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,r){this.eventManager&&e.forEach(i=>{this._events[i]!==r&&(this._events[i]=r,r?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(e,r=null,i={}){let n={...e.getViewportProps(),...r},o=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(i),o){let a=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:n,interactionState:this._interactionState,oldViewState:a})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(i=!i);let n=this.controllerState[i?"panStart":"rotateStart"]({pos:r});return this._panMove=i,this.updateViewport(n,mp,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;let r=this.getCenter(e),i=this.controllerState.pan({pos:r});return this.updateViewport(i,mp,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){let{inertia:r}=this;if(this.dragPan&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],o=this.controllerState.pan({pos:n}).panEnd();this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isPanning:!0})}else{let i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;let r=this.getCenter(e),i=this.controllerState.rotate({pos:r});return this.updateViewport(i,mp,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){let{inertia:r}=this;if(this.dragRotate&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],o=this.controllerState.rotate({pos:n}).rotateEnd();this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isRotating:!0})}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;e.srcEvent.preventDefault();let{speed:i=.01,smooth:n=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:o}=e,a=2/(1+Math.exp(-Math.abs(o*i)));o<0&&a!==0&&(a=1/a);let l=this.controllerState.zoom({pos:r,scale:a});return this.updateViewport(l,{...this._getTransitionProps({around:r}),transitionDuration:n?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.rotateStart({pos:r});return this.updateViewport(i,mp,{isDragging:!0}),!0}_onTriplePan(e){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(e);r[0]-=e.deltaX;let i=this.controllerState.rotate({pos:r});return this.updateViewport(i,mp,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&e.velocityY){let i=this.getCenter(e),n=[i[0],i[1]+=e.velocityY*r/2],o=this.controllerState.rotate({pos:n});this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return OA._startPinchRotation=e.rotation,OA._lastPinchEvent=e,this.updateViewport(i,mp,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=e,n=this.getCenter(e);r=r.zoom({pos:n,scale:i})}if(this.touchRotate){let{rotation:i}=e;r=r.rotate({deltaAngleX:OA._startPinchRotation-i})}return this.updateViewport(r,mp,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),OA._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=OA;if(this.touchZoom&&r&&i&&e.scale!==i.scale){let n=this.getCenter(e),o=this.controllerState.rotateEnd(),a=Math.log2(e.scale),l=(a-Math.log2(i.scale))/(e.deltaTime-i.deltaTime),u=Math.pow(2,a+l*r/2);o=o.zoom({pos:n,scale:u}).zoomEnd(),this.updateViewport(o,{...this._getTransitionProps({around:n}),transitionDuration:r,transitionEasing:f2},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let n=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return OA._startPinchRotation=null,OA._lastPinchEvent=null,!0}_onDoubleTap(e){if(!this.doubleClickZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e),n=this.controllerState.zoom({pos:r,scale:i?.5:2});return this.updateViewport(n,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(e),{zoomSpeed:i,moveSpeed:n,rotateSpeedX:o,rotateSpeedY:a}=this.keyboard===!0?{}:this.keyboard,{controllerState:l}=this,u,f={};switch(e.srcEvent.code){case"Minus":u=r?l.zoomOut(i).zoomOut(i):l.zoomOut(i),f.isZooming=!0;break;case"Equal":u=r?l.zoomIn(i).zoomIn(i):l.zoomIn(i),f.isZooming=!0;break;case"ArrowLeft":r?(u=l.rotateLeft(o),f.isRotating=!0):(u=l.moveLeft(n),f.isPanning=!0);break;case"ArrowRight":r?(u=l.rotateRight(o),f.isRotating=!0):(u=l.moveRight(n),f.isPanning=!0);break;case"ArrowUp":r?(u=l.rotateUp(a),f.isRotating=!0):(u=l.moveUp(n),f.isPanning=!0);break;case"ArrowDown":r?(u=l.rotateDown(a),f.isRotating=!0):(u=l.moveDown(n),f.isPanning=!0);break;default:return!1}return this.updateViewport(u,this._getTransitionProps(),f),!0}_getTransitionProps(e){let{transition:r}=this;return!r||!r.transitionInterpolator?mp:e?{...r,transitionInterpolator:new Dl({...e,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var dd=class{constructor(e,r){this._viewportProps=this.applyConstraints(e),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var Z6=5,eoe=1.2,Tv=class extends dd{constructor(e){let{width:r,height:i,latitude:n,longitude:o,zoom:a,bearing:l=0,pitch:u=0,altitude:f=1.5,position:_=[0,0,0],maxZoom:w=20,minZoom:E=0,maxPitch:M=60,minPitch:D=0,startPanLngLat:j,startZoomLngLat:V,startRotatePos:$,startBearing:te,startPitch:ne,startZoom:le,normalize:z=!0}=e;ss(Number.isFinite(o)),ss(Number.isFinite(n)),ss(Number.isFinite(a)),super({width:r,height:i,latitude:n,longitude:o,zoom:a,bearing:l,pitch:u,altitude:f,maxZoom:w,minZoom:E,maxPitch:M,minPitch:D,normalize:z,position:_},{startPanLngLat:j,startZoomLngLat:V,startRotatePos:$,startBearing:te,startPitch:ne,startZoom:le}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:r}){let i=this.getState().startPanLngLat||this._unproject(r);if(!i)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startBearing:o,startPitch:a}=this.getState();if(!n||o===void 0||a===void 0)return this;let l;return e?l=this._getNewRotation(e,n,a,o):l={bearing:o+r,pitch:a+i},this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:i}){let{startZoom:n,startZoomLngLat:o}=this.getState();if(o||(n=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let{maxZoom:a,minZoom:l}=this.getViewportProps(),u=n+Math.log2(i);u=ho(u,l,a);let f=this.makeViewport({...this.getViewportProps(),zoom:u});return this._getUpdatedState({zoom:u,...f.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:o}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),Math.abs(o-r.longitude)>180&&(i.longitude=o<0?o+360:o-360),i}applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n}=e;e.zoom=ho(n,i,r);let{maxPitch:o,minPitch:a,pitch:l}=e;e.pitch=ho(l,a,o);let{normalize:u=!0}=e;return u&&Object.assign(e,PP(e)),e}_zoomFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.zoom({pos:[r/2,i/2],scale:e})}_panFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.pan({startPos:[r/2,i/2],pos:[r/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_getNewRotation(e,r,i,n){let o=e[0]-r[0],a=e[1]-r[1],l=e[1],u=r[1],{width:f,height:_}=this.getViewportProps(),w=o/f,E=0;a>0?Math.abs(_-u)>Z6&&(E=a/(u-_)*eoe):a<0&&u>Z6&&(E=1-l/u),E=ho(E,-1,1);let{minPitch:M,maxPitch:D}=this.getViewportProps(),j=n+180*w,V=i;return E>0?V=i+E*(D-i):E<0&&(V=i-E*(M-i)),{pitch:V,bearing:j}}},DA=class extends hc{constructor(){super(...arguments),this.ControllerState=Tv,this.transition={transitionDuration:300,transitionInterpolator:new Dl({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];let r=this.props;super.setProps(e),(!r||r.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}};var zP=class extends uc{get ViewportType(){return Ic}get ControllerType(){return DA}},LA=zP;(()=>{zP.displayName="MapView"})();var toe=new dp;function roe(t,e){let r=t.order??1/0,i=e.order??1/0;return r-i}var Ev=class{constructor(){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){let r=this._defaultEffects;if(!r.find(i=>i.id===e.id)){let i=r.findIndex(n=>roe(n,e)>0);i<0?r.push(e):r.splice(i,0,e),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(Ws(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(e){let r={};for(let n of this.effects)r[n.id]=n;let i=[];for(let n of e){let o=r[n.id];o&&o!==n?o.setProps?(o.setProps(n.props),i.push(o)):(o.cleanup(),i.push(n)):i.push(n),delete r[n.id]}for(let n in r)r[n].cleanup();this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),e.some(n=>n instanceof dp)||this._resolvedEffects.push(toe),this._needsRedraw="effects changed"}finalize(){for(let e of this._resolvedEffects)e.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Sv=class extends Ah{shouldDrawLayer(e){let{operation:r}=e.props;return r.includes("draw")||r.includes("terrain")}};var ioe="deckRenderer.renderLayers",FA=class{constructor(e){this.device=e,this.gl=e.gl,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Sv(e),this.pickLayersPass=new ld(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};i.effects&&this._preRender(i.effects,i);let n=this.lastPostProcessEffect?this.renderBuffers[0]:i.target;this.lastPostProcessEffect&&(i.clearColor=[0,0,0,0]);let o=r.render({...i,target:n});i.effects&&this._postRender(i.effects,i),this.renderCount++,ia(ioe,this,o,e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:e}=this;for(let r of e)r.delete();e.length=0}_preRender(e,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let i of e)r.preRenderStats[i.id]=i.preRender(this.device,r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:e}=this,r=this.device.canvasContext.getDrawingBufferSize();e.length===0&&[0,1].map(i=>{let n=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"}});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[n]}))});for(let i of e)i.resize(r)}_postRender(e,r){let{renderBuffers:i}=this,n={...r,inputBuffer:i[0],swapBuffer:i[1]};for(let o of e)if(o.postRender){if(o.id===this.lastPostProcessEffect){n.target=r.target,o.postRender(this.device,n);break}let a=o.postRender(this.device,n);n.inputBuffer=a,n.swapBuffer=a===i[0]?i[1]:i[0]}}};var noe={pickedColor:null,pickedObjectIndex:-1};function J6({pickedColors:t,decodePickingColor:e,deviceX:r,deviceY:i,deviceRadius:n,deviceRect:o}){let{x:a,y:l,width:u,height:f}=o,_=n*n,w=-1,E=0;for(let M=0;M<f;M++){let D=M+l-i,j=D*D;if(j>_)E+=4*u;else for(let V=0;V<u;V++){if(t[E+3]-1>=0){let te=V+a-r,ne=te*te+j;ne<=_&&(_=ne,w=E)}E+=4}}if(w>=0){let M=t.slice(w,w+4),D=e(M);if(D){let j=Math.floor(w/4/u),V=w/4-j*u;return{...D,pickedColor:M,pickedX:a+V,pickedY:l+j}}br.error("Picked non-existent layer. Is picking buffer corrupt?")()}return noe}function Q6({pickedColors:t,decodePickingColor:e}){let r=new Map;if(t){for(let i=0;i<t.length;i+=4)if(t[i+3]-1>=0){let o=t.slice(i,i+4),a=o.join(",");if(!r.has(a)){let l=e(o);l?r.set(a,{...l,color:o}):br.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(r.values())}function VP({pickInfo:t,viewports:e,pixelRatio:r,x:i,y:n,z:o}){let a=e[0];e.length>1&&(a=ooe(t?.pickedViewports||e,{x:i,y:n}));let l;if(a){let u=[i-a.x,n-a.y];o!==void 0&&(u[2]=o),l=a.unproject(u)}return{color:null,layer:null,viewport:a,index:-1,picked:!1,x:i,y:n,pixel:[i,n],coordinate:l,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:r}}function $6(t){let{pickInfo:e,lastPickedInfo:r,mode:i,layers:n}=t,{pickedColor:o,pickedLayer:a,pickedObjectIndex:l}=e,u=a?[a]:[];if(i==="hover"){let w=r.index,E=r.layerId,M=a?a.props.id:null;if(M!==E||l!==w){if(M!==E){let D=n.find(j=>j.props.id===E);D&&u.unshift(D)}r.layerId=M,r.index=l,r.info=null}}let f=VP(t),_=new Map;return _.set(null,f),u.forEach(w=>{let E={...f};w===a&&(E.color=o,E.index=l,E.picked=!0),E=HP({layer:w,info:E,mode:i});let M=E.layer;w===a&&i==="hover"&&(r.info=E),_.set(M.id,E),i==="hover"&&M.updateAutoHighlight(E)}),_}function HP({layer:t,info:e,mode:r}){for(;t&&e;){let i=e.layer||null;e.sourceLayer=i,e.layer=t,e=t.getPickingInfo({info:e,mode:r,sourceLayer:i}),t=t.parent}return e}function ooe(t,e){for(let r=t.length-1;r>=0;r--){let i=t[r];if(i.containsPixel(e))return i}return t[0]}var Cv=class{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new ld(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.delete(),this.depthFBO&&(this.depthFBO.colorAttachments[0].delete(),this.depthFBO.delete())}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:r,layers:i,viewports:n},o=this.lastPickedInfo.info){let a=o&&o.layer&&o.layer.id,l=o&&o.viewport&&o.viewport.id,u=a?i.find(E=>E.id===a):null,f=l&&n.find(E=>E.id===l)||n[0],_=f&&f.unproject([e-f.x,r-f.y]);return{...o,...{x:e,y:r,viewport:f,coordinate:_,layer:u}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"]}),this.device.isTextureFormatRenderable("rgba32float"))){let r=this.device.createFramebuffer({colorAttachments:[this.device.createTexture({format:"rgba32float"})]});this.depthFBO=r}let e=this.device.gl;this.pickingFBO?.resize({width:e.canvas.width,height:e.canvas.height}),this.depthFBO?.resize({width:e.canvas.width,height:e.canvas.height})}_getPickable(e){if(this._pickable===!1)return null;let r=e.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return r.length?r:null}_pickClosestObject({layers:e,views:r,viewports:i,x:n,y:o,radius:a=0,depth:l=1,mode:u="query",unproject3D:f,onViewportActive:_,effects:w}){let E=this.device.canvasContext.cssToDeviceRatio(),M=this._getPickable(e);if(!M||i.length===0)return{result:[],emptyInfo:VP({viewports:i,x:n,y:o,pixelRatio:E})};this._resizeBuffer();let D=this.device.canvasContext.cssToDevicePixels([n,o],!0),j=[D.x+Math.floor(D.width/2),D.y+Math.floor(D.height/2)],V=Math.round(a*E),{width:$,height:te}=this.pickingFBO,ne=this._getPickingRect({deviceX:j[0],deviceY:j[1],deviceRadius:V,deviceWidth:$,deviceHeight:te}),le={x:n-a,y:o-a,width:a*2+1,height:a*2+1},z,ke=[],Y=new Set;for(let X=0;X<l;X++){let O;if(ne){let H=this._drawAndSample({layers:M,views:r,viewports:i,onViewportActive:_,deviceRect:ne,cullRect:le,effects:w,pass:`picking:${u}`});O=J6({...H,deviceX:j[0],deviceY:j[1],deviceRadius:V,deviceRect:ne})}else O={pickedColor:null,pickedObjectIndex:-1};let I;if(O.pickedLayer&&f&&this.depthFBO){let{pickedColors:H}=this._drawAndSample({layers:[O.pickedLayer],views:r,viewports:i,onViewportActive:_,deviceRect:{x:O.pickedX,y:O.pickedY,width:1,height:1},cullRect:le,effects:w,pass:`picking:${u}:z`},!0);H[3]&&(I=H[0])}O.pickedLayer&&X+1<l&&(Y.add(O.pickedLayer),O.pickedLayer.disablePickingIndex(O.pickedObjectIndex)),z=$6({pickInfo:O,lastPickedInfo:this.lastPickedInfo,mode:u,layers:M,viewports:i,x:n,y:o,z:I,pixelRatio:E});for(let H of z.values())H.layer&&ke.push(H);if(!O.pickedColor)break}for(let X of Y)X.restorePickingColors();return{result:ke,emptyInfo:z.get(null)}}_pickVisibleObjects({layers:e,views:r,viewports:i,x:n,y:o,width:a=1,height:l=1,mode:u="query",maxObjects:f=null,onViewportActive:_,effects:w}){let E=this._getPickable(e);if(!E||i.length===0)return[];this._resizeBuffer();let M=this.device.canvasContext.cssToDeviceRatio(),D=this.device.canvasContext.cssToDevicePixels([n,o],!0),j=D.x,V=D.y+D.height,$=this.device.canvasContext.cssToDevicePixels([n+a,o+l],!0),te=$.x+$.width,ne=$.y,le={x:j,y:ne,width:te-j,height:V-ne},z=this._drawAndSample({layers:E,views:r,viewports:i,onViewportActive:_,deviceRect:le,cullRect:{x:n,y:o,width:a,height:l},effects:w,pass:`picking:${u}`}),ke=Q6(z),Y=new Map,X=[],O=Number.isFinite(f);for(let I=0;I<ke.length&&!(O&&X.length>=f);I++){let H=ke[I],ie={color:H.pickedColor,layer:null,index:H.pickedObjectIndex,picked:!0,x:n,y:o,pixelRatio:M};ie=HP({layer:H.pickedLayer,info:ie,mode:u});let Q=ie.layer.id;Y.has(Q)||Y.set(Q,new Set);let ye=Y.get(Q),it=ie.object??ie.index;ye.has(it)||(ye.add(it),X.push(ie))}return X}_drawAndSample({layers:e,views:r,viewports:i,onViewportActive:n,deviceRect:o,cullRect:a,effects:l,pass:u},f=!1){let _=f?this.depthFBO:this.pickingFBO,w={layers:e,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:n,pickingFBO:_,deviceRect:o,cullRect:a,effects:l,pass:u,pickZ:f,preRenderStats:{}};for(let te of l)te.useInPicking&&(w.preRenderStats[te.id]=te.preRender(this.device,w));let{decodePickingColor:E}=this.pickLayersPass.render(w),{x:M,y:D,width:j,height:V}=o,$=new(f?Float32Array:Uint8Array)(j*V*4);return this.device.readPixelsToArrayWebGL(_,{sourceX:M,sourceY:D,sourceWidth:j,sourceHeight:V,target:$}),{pickedColors:$,decodePickingColor:E}}_getPickingRect({deviceX:e,deviceY:r,deviceRadius:i,deviceWidth:n,deviceHeight:o}){let a=Math.max(0,e-i),l=Math.max(0,r-i),u=Math.min(n,e+i+1)-a,f=Math.min(o,r+i+1)-l;return u<=0||f<=0?null:{x:a,y:l,width:u,height:f}}};var soe={"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}},aoe="top-left",eU="__root",d2=class{constructor({deck:e,parentElement:r}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,this.parentElement=r}getWidgets(){return this.resolvedWidgets}setProps(e){e.widgets&&!Ws(e.widgets,this.widgets,1)&&this._setWidgets(e.widgets)}finalize(){for(let e of this.getWidgets())this._remove(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(r=>r.id===e.id)||(this._add(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}_setWidgets(e){let r={};for(let i of this.resolvedWidgets)r[i.id]=i;this.resolvedWidgets.length=0;for(let i of this.defaultWidgets)r[i.id]=null,this.resolvedWidgets.push(i);for(let i of e){let n=r[i.id];n?n.viewId!==i.viewId||n.placement!==i.placement?(this._remove(n),this._add(i)):i!==n&&(n.setProps(i.props),i=n):this._add(i),r[i.id]=null,this.resolvedWidgets.push(i)}for(let i in r){let n=r[i];n&&this._remove(n)}this.widgets=e}_add(e){let{viewId:r=null,placement:i=aoe}=e,n=e.onAdd({deck:this.deck,viewId:r});n&&this._getContainer(r,i).append(n),e._element=n}_remove(e){e.onRemove(),e._element&&e._element.remove(),e._element=void 0}_getContainer(e,r){let i=e||eU,n=this.containers[i];n||(n=document.createElement("div"),n.style.pointerEvents="none",n.style.position="absolute",n.style.overflow="hidden",this.parentElement?.append(n),this.containers[i]=n);let o=n.querySelector(`.${r}`);return o||(o=document.createElement("div"),o.className=r,o.style.position="absolute",Object.assign(o.style,soe[r]),n.append(o)),o}_updateContainers(){let e=this.deck.width,r=this.deck.height;for(let i in this.containers){let n=this.lastViewports[i]||null,o=i===eU||n,a=this.containers[i];o?(a.style.display="block",a.style.left=`${n?n.x:0}px`,a.style.top=`${n?n.y:0}px`,a.style.width=`${n?n.width:e}px`,a.style.height=`${n?n.height:r}px`):a.style.display="none"}}onRedraw({viewports:e,layers:r}){let i=e.reduce((o,a)=>(o[a.id]=a,o),{}),{lastViewports:n}=this;for(let o of this.getWidgets()){let{viewId:a}=o;if(a){let l=i[a];l&&(o.onViewportChange&&!l.equals(n[a])&&o.onViewportChange(l),o.onRedraw?.({viewports:[l],layers:r}))}else{if(o.onViewportChange)for(let l of e)l.equals(n[l.id])||o.onViewportChange(l);o.onRedraw?.({viewports:e,layers:r})}}this.lastViewports=i,this._updateContainers()}onHover(e,r){for(let i of this.getWidgets()){let{viewId:n}=i;(!n||n===e.viewport?.id)&&i.onHover?.(e,r)}}onEvent(e,r){let i=rv[r.type];if(i)for(let n of this.getWidgets()){let{viewId:o}=n;(!o||o===e.viewport?.id)&&n[i.handler]?.(e,r)}}};var loe={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},Mv=class{constructor(){this.id="default-tooltip",this.placement="fill",this.props={},this.isVisible=!1}onAdd({deck:e}){let r=document.createElement("div");return r.className="deck-tooltip",Object.assign(r.style,loe),this.deck=e,this.element=r,r}onRemove(){this.deck=void 0,this.element=void 0}setProps(){}onViewportChange(e){this.isVisible&&e.id===this.lastViewport?.id&&e!==this.lastViewport&&this.setTooltip(null)}onHover(e){let{deck:r}=this,i=r&&r.props.getTooltip;if(!i)return;let n=i(e);this.lastViewport=e.viewport,this.setTooltip(n,e.x,e.y)}setTooltip(e,r,i){let n=this.element;if(n){if(typeof e=="string")n.innerText=e;else if(e)e.text&&(n.innerText=e.text),e.html&&(n.innerHTML=e.html),e.className&&(n.className=e.className);else{this.isVisible=!1,n.style.display="none";return}this.isVisible=!0,n.style.display="block",n.style.transform=`translate(${r}px, ${i}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(n.style,e.style)}}};var Iv=sc(tU());var coe={mousedown:1,mousemove:2,mouseup:4};function uoe(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return!0;return!1}function rU(t){let e=t.prototype.handler;t.prototype.handler=function(i){let n=this.store;i.button>0&&i.type==="pointerdown"&&(uoe(n,o=>o.pointerId===i.pointerId)||n.push(i)),e.call(this,i)}}function iU(t){t.prototype.handler=function(r){let i=coe[r.type];i&1&&r.button>=0&&(this.pressed=!0),i&2&&r.which===0&&(i=4),this.pressed&&(i&4&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:"mouse",srcEvent:r}))}}rU(Iv.default.PointerEventInput);iU(Iv.default.MouseInput);var nU=Iv.default.Manager,_h=Iv.default;var yh=class{constructor(e,r,i){this.element=e,this.callback=r,this.options={enable:!0,...i}}};var oU=_h?[[_h.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[_h.Rotate,{enable:!1}],[_h.Pinch,{enable:!1}],[_h.Swipe,{enable:!1}],[_h.Pan,{threshold:0,enable:!1}],[_h.Press,{enable:!1}],[_h.Tap,{event:"doubletap",taps:2,enable:!1}],[_h.Tap,{event:"anytap",enable:!1}],[_h.Tap,{enable:!1}]]:null,jP={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},sU={doubletap:["tap"]},aU={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},c0={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},lU={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"},GP={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"};var cU=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",NA=typeof window<"u"?window:global;var A2=!1;try{let t={get passive(){return A2=!0,!0}};NA.addEventListener("test",null,t),NA.removeEventListener("test",null)}catch{A2=!1}var hoe=cU.indexOf("firefox")!==-1,{WHEEL_EVENTS:foe}=c0,uU="wheel",hU=4.000244140625,doe=40,poe=.25,Pv=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{if(!this.options.enable)return;let o=n.deltaY;NA.WheelEvent&&(hoe&&n.deltaMode===NA.WheelEvent.DOM_DELTA_PIXEL&&(o/=NA.devicePixelRatio),n.deltaMode===NA.WheelEvent.DOM_DELTA_LINE&&(o*=doe)),o!==0&&o%hU===0&&(o=Math.floor(o/hU)),n.shiftKey&&o&&(o=o*poe),this.callback({type:uU,center:{x:n.clientX,y:n.clientY},delta:-o,srcEvent:n,pointerType:"mouse",target:n.target})},this.events=(this.options.events||[]).concat(foe),this.events.forEach(n=>e.addEventListener(n,this.handleEvent,A2?{passive:!1}:!1))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===uU&&(this.options.enable=r)}};var{MOUSE_EVENTS:Aoe}=c0,fU="pointermove",dU="pointerover",pU="pointerout",AU="pointerenter",mU="pointerleave",Rv=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=o=>{this.handleOverEvent(o),this.handleOutEvent(o),this.handleEnterEvent(o),this.handleLeaveEvent(o),this.handleMoveEvent(o)},this.pressed=!1;let{enable:n}=this.options;this.enableMoveEvent=n,this.enableLeaveEvent=n,this.enableEnterEvent=n,this.enableOutEvent=n,this.enableOverEvent=n,this.events=(this.options.events||[]).concat(Aoe),this.events.forEach(o=>e.addEventListener(o,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===fU&&(this.enableMoveEvent=r),e===dU&&(this.enableOverEvent=r),e===pU&&(this.enableOutEvent=r),e===AU&&(this.enableEnterEvent=r),e===mU&&(this.enableLeaveEvent=r)}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit(dU,e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit(pU,e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit(AU,e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit(mU,e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.which===0&&(this.pressed=!1),this.pressed||this._emit(fU,e);break;case"mouseup":this.pressed=!1;break;default:}}_emit(e,r){this.callback({type:e,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})}};var{KEY_EVENTS:moe}=c0,gU="keydown",_U="keyup",Bv=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{let o=n.target||n.srcElement;o.tagName==="INPUT"&&o.type==="text"||o.tagName==="TEXTAREA"||(this.enableDownEvent&&n.type==="keydown"&&this.callback({type:gU,srcEvent:n,key:n.key,target:n.target}),this.enableUpEvent&&n.type==="keyup"&&this.callback({type:_U,srcEvent:n,key:n.key,target:n.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(moe),e.tabIndex=this.options.tabIndex||0,e.style.outline="none",this.events.forEach(n=>e.addEventListener(n,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===gU&&(this.enableDownEvent=r),e===_U&&(this.enableUpEvent=r)}};var yU="contextmenu",Ov=class extends yh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{this.options.enable&&this.callback({type:yU,center:{x:n.clientX,y:n.clientY},srcEvent:n,pointerType:"mouse",target:n.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,r){e===yU&&(this.options.enable=r)}};var goe={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},_oe=1,yoe=2,voe=3,xoe=0,boe=1,woe=2,Toe=1,Eoe=2,Soe=4;function vU(t){let e=goe[t.srcEvent.type];if(!e)return null;let{buttons:r,button:i,which:n}=t.srcEvent,o=!1,a=!1,l=!1;return e===4||e===2&&!Number.isFinite(r)?(o=n===_oe,a=n===yoe,l=n===voe):e===2?(o=Boolean(r&Toe),a=Boolean(r&Soe),l=Boolean(r&Eoe)):e===1&&(o=i===xoe,a=i===boe,l=i===woe),{leftButton:o,middleButton:a,rightButton:l}}function xU(t,e){let r=t.center;if(!r)return null;let i=e.getBoundingClientRect(),n=i.width/e.offsetWidth||1,o=i.height/e.offsetHeight||1,a={x:(r.x-i.left-e.clientLeft)/n,y:(r.y-i.top-e.clientTop)/o};return{center:r,offsetCenter:a}}var WP={srcElement:"root",priority:0},Dv=class{constructor(e){this.handleEvent=r=>{if(this.isEmpty())return;let i=this._normalizeEvent(r),n=r.srcEvent.target;for(;n&&n!==i.rootElement;){if(this._emit(i,n),i.handled)return;n=n.parentNode}this._emit(i,"root")},this.eventManager=e,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,r,i,n=!1,o=!1){let{handlers:a,handlersByElement:l}=this,u=WP;typeof i=="string"||i&&i.addEventListener?u={...WP,srcElement:i}:i&&(u={...WP,...i});let f=l.get(u.srcElement);f||(f=[],l.set(u.srcElement,f));let _={type:e,handler:r,srcElement:u.srcElement,priority:u.priority};n&&(_.once=!0),o&&(_.passive=!0),a.push(_),this._active=this._active||!_.passive;let w=f.length-1;for(;w>=0&&!(f[w].priority>=_.priority);)w--;f.splice(w+1,0,_)}remove(e,r){let{handlers:i,handlersByElement:n}=this;for(let o=i.length-1;o>=0;o--){let a=i[o];if(a.type===e&&a.handler===r){i.splice(o,1);let l=n.get(a.srcElement);l.splice(l.indexOf(a),1),l.length===0&&n.delete(a.srcElement)}}this._active=i.some(o=>!o.passive)}_emit(e,r){let i=this.handlersByElement.get(r);if(i){let n=!1,o=()=>{e.handled=!0},a=()=>{e.handled=!0,n=!0},l=[];for(let u=0;u<i.length;u++){let{type:f,handler:_,once:w}=i[u];if(_({...e,type:f,stopPropagation:o,stopImmediatePropagation:a}),w&&l.push(i[u]),n)break}for(let u=0;u<l.length;u++){let{type:f,handler:_}=l[u];this.remove(f,_)}}}_normalizeEvent(e){let r=this.eventManager.getElement();return{...e,...vU(e),...xU(e,r),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};var Coe={events:null,recognizers:null,recognizerOptions:{},Manager:nU,touchAction:"none",tabIndex:0},u0=class{constructor(e=null,r){this._onBasicInput=n=>{let{srcEvent:o}=n,a=aU[o.type];a&&this.manager.emit(a,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={...Coe,...r},this.events=new Map,this.setElement(e);let{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(e){if(this.element&&this.destroy(),this.element=e,!e)return;let{options:r}=this,i=r.Manager;this.manager=new i(e,{touchAction:r.touchAction,recognizers:r.recognizers||oU}).on("hammer.input",this._onBasicInput),r.recognizers||Object.keys(jP).forEach(n=>{let o=this.manager.get(n);o&&jP[n].forEach(a=>{o.recognizeWith(a)})});for(let n in r.recognizerOptions){let o=this.manager.get(n);if(o){let a=r.recognizerOptions[n];delete a.enable,o.set(a)}}this.wheelInput=new Pv(e,this._onOtherEvent,{enable:!1}),this.moveInput=new Rv(e,this._onOtherEvent,{enable:!1}),this.keyInput=new Bv(e,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new Ov(e,this._onOtherEvent,{enable:!1});for(let[n,o]of this.events)o.isEmpty()||(this._toggleRecognizer(o.recognizerName,!0),this.manager.on(n,o.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(e,r,i){this._addEventHandler(e,r,i,!1)}once(e,r,i){this._addEventHandler(e,r,i,!0)}watch(e,r,i){this._addEventHandler(e,r,i,!1,!0)}off(e,r){this._removeEventHandler(e,r)}_toggleRecognizer(e,r){let{manager:i}=this;if(!i)return;let n=i.get(e);if(n&&n.options.enable!==r){n.set({enable:r});let o=sU[e];o&&!this.options.recognizers&&o.forEach(a=>{let l=i.get(a);r?(l.requireFailure(e),n.dropRequireFailure(a)):l.dropRequireFailure(e)})}this.wheelInput.enableEventType(e,r),this.moveInput.enableEventType(e,r),this.keyInput.enableEventType(e,r),this.contextmenuInput.enableEventType(e,r)}_addEventHandler(e,r,i,n,o){if(typeof e!="string"){i=r;for(let _ in e)this._addEventHandler(_,e[_],i,n,o);return}let{manager:a,events:l}=this,u=GP[e]||e,f=l.get(u);f||(f=new Dv(this),l.set(u,f),f.recognizerName=lU[u]||u,a&&a.on(u,f.handleEvent)),f.add(e,r,i,n,o),f.isEmpty()||this._toggleRecognizer(f.recognizerName,!0)}_removeEventHandler(e,r){if(typeof e!="string"){for(let a in e)this._removeEventHandler(a,e[a]);return}let{events:i}=this,n=GP[e]||e,o=i.get(n);if(o&&(o.remove(e,r),o.isEmpty())){let{recognizerName:a}=o,l=!1;for(let u of i.values())if(u.recognizerName===a&&!u.isEmpty()){l=!0;break}l||this._toggleRecognizer(a,!1)}}};function gp(){}var Moe=({isDragging:t})=>t?"grabbing":"grab",bU={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{type:"webgl"},gl:null,glOptions:{},canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:gp,onWebGLInitialized:gp,onResize:gp,onViewStateChange:gp,onInteractionStateChange:gp,onBeforeRender:gp,onAfterRender:gp,onLoad:gp,onError:t=>br.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:Moe,getTooltip:null,debug:!1,drawPickingColors:!1},m2=class{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new Hl({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=i=>{let{_pickRequest:n}=this;if(i.type==="pointerleave")n.x=-1,n.y=-1,n.radius=0;else{if(i.leftButton||i.rightButton)return;{let o=i.offsetCenter;if(!o)return;n.x=o.x,n.y=o.y,n.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:n.x,y:n.y}),n.event=i},this._onEvent=i=>{let n=rv[i.type],o=i.offsetCenter;if(!n||!o||!this.layerManager)return;let a=this.layerManager.getLayers(),l=this.deckPicker.getLastPickedObject({x:o.x,y:o.y,layers:a,viewports:this.getViewports(o)},this._lastPointerDownInfo),{layer:u}=l,f=u&&(u[n.handler]||u.props[n.handler]),_=this.props[n.handler],w=!1;f&&(w=f.call(u,l,i)),w||(_?.(l,i),this.widgetManager.onEvent(l,i))},this._onPointerDown=i=>{let n=i.offsetCenter,o=this._pick("pickObject","pickObject Time",{x:n.x,y:n.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=o.result[0]||o.emptyInfo},this.props={...bU,...e},e=this.props,e.viewState&&e.initialViewState&&br.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=e.initialViewState,e.device?this.device=e.device:e.gl&&(e.gl instanceof WebGLRenderingContext&&br.error("WebGL1 context not supported.")(),this.device=hf.attach(e.gl));let r=this.device;r||(Xc.registerDevices([hf]),r=Xc.createDevice({...e.deviceProps,canvas:this._createCanvas(e)}),r.then(i=>{this.device=i})),this.animationLoop=this._createAnimationLoop(r,e),this.setProps(e),e._typedArrayManagerProps&&mh.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.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(e){this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&br.removed("onLayerHover","onHover")(),"onLayerClick"in e&&br.removed("onLayerClick","onClick")(),e.initialViewState&&!Ws(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop?.setProps(r),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r),this.widgetManager.setProps(r)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(e),n=this.layerManager.needsRedraw(e),o=this.effectManager.needsRedraw(e),a=this.deckRenderer.needsRedraw(e);return r=r||i||n||o||a,r}redraw(e){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=e||r,r&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return ss(this.viewManager),this.viewManager.views}getViewports(e){return ss(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){let r=this._pick("pickObject","pickObject Time",e).result;return r.length?r[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_addResources(e,r=!1){for(let i in e)this.layerManager.resourceManager.add({resourceId:i,data:e[i],forceUpdate:r})}_removeResources(e){for(let r of e)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_pick(e,r,i){ss(this.deckPicker);let{stats:n}=this;n.get("Pick Count").incrementCount(),n.get(r).timeStart();let o=this.deckPicker[e]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i});return n.get(r).timeEnd(),o}_createCanvas(e){let r=e.canvas;return typeof r=="string"&&(r=document.getElementById(r),ss(r)),r||(r=document.createElement("canvas"),r.id=e.id||"deckgl-overlay",(e.parent||document.body).appendChild(r)),Object.assign(r.style,e.style),r}_setCanvasSize(e){if(!this.canvas)return;let{width:r,height:i}=e;if(r||r===0){let n=Number.isFinite(r)?`${r}px`:r;this.canvas.style.width=n}if(i||i===0){let n=Number.isFinite(i)?`${i}px`:i;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=n}}_updateCanvasSize(){let{canvas:e}=this;if(!e)return;let r=e.clientWidth??e.width,i=e.clientHeight??e.height;(r!==this.width||i!==this.height)&&(this.width=r,this.height=i,this.viewManager?.setProps({width:r,height:i}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:i}))}_createAnimationLoop(e,r){let{gl:i,onError:n,useDevicePixels:o}=r;return new lv({device:e,useDevicePixels:o,autoResizeDrawingBuffer:!i,autoResizeViewport:!1,onInitialize:a=>this._setDevice(a.device),onRender:this._onRenderFrame.bind(this),onError:n})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let e=this.props.views||[new LA({id:"default-view"})];return e=Array.isArray(e)?e:[e],e.length&&this.props.controller&&(e[0].props.controller=this.props.controller),e}_onContextLost(){let{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){let{_pickRequest:e}=this;if(e.event){let{result:r,emptyInfo:i}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=r.length>0;let n=i,o=!1;for(let a of r)n=a,o=a.layer?.onHover(a,e.event)||o;o||(this.props.onHover?.(n,e.event),this.widgetManager.onHover(n,e.event)),e.event=null}}_updateCursor(){let e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){if(this.device=e,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas),this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device instanceof hf&&this.props.onWebGLInitialized(this.device.gl);let r=new MA;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new u0(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let n in rv)this.eventManager.on(n,this._onEvent);this.viewManager=new xv({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let i=this.viewManager.getViewports()[0];this.layerManager=new BA(this.device,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new Ev,this.deckRenderer=new FA(this.device),this.deckPicker=new Cv(this.device),this.widgetManager=new d2({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new Mv),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,r){let{device:i,gl:n}=this.layerManager.context;i.setParametersWebGL(this.props.parameters),this.props.onBeforeRender({device:i,gl:n});let o={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...r};this.deckRenderer?.renderLayers(o),o.pass==="screen"&&this.widgetManager.onRedraw({viewports:o.viewports,layers:o.layers}),this.props.onAfterRender({device:i,gl:n})}_onRenderFrame(e){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),br.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){let r=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){let{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();let r=this.animationLoop.stats;e.get("GPU Time").addTime(r.get("GPU Time").lastTiming),e.get("CPU Time").addTime(r.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:e,stats:r}=this;e.fps=r.get("frameRate").getHz(),e.setPropsTime=r.get("setProps Time").time,e.updateAttributesTime=r.get("Update Attributes").time,e.framesRedrawn=r.get("Redraw Count").count,e.pickTime=r.get("pickObject Time").time+r.get("pickMultipleObjects Time").time+r.get("pickObjects Time").time,e.pickCount=r.get("Pick Count").count,e.gpuTime=r.get("GPU Time").time,e.cpuTime=r.get("CPU Time").time,e.gpuTimePerFrame=r.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=r.get("CPU Time").getAverageTime();let i=Xc.stats.get("Memory Usage");e.bufferMemory=i.get("Buffer Memory").count,e.textureMemory=i.get("Texture Memory").count,e.renderbufferMemory=i.get("Renderbuffer Memory").count,e.gpuMemory=i.get("GPU Memory").count}},pd=m2;(()=>{m2.defaultProps=bU})(),(()=>{m2.VERSION=mw})();function wU(t){switch(t){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return My(t)}}var TU=Gb;function Lv(t,e){return{attribute:t,format:e.size>1?`${e.type}x${e.size}`:e.type,byteOffset:e.offset||0}}function _p(t){return t.stride||t.size*t.bytesPerElement}function EU(t,e){return t.type===e.type&&t.size===e.size&&_p(t)===_p(e)&&(t.offset||0)===(e.offset||0)}function qP(t,e){e.offset&&br.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let r=_p(t),i=e.vertexOffset!==void 0?e.vertexOffset:t.vertexOffset||0,n=e.elementOffset||0,o=i*r+n*t.bytesPerElement+(t.offset||0);return{...e,offset:o,stride:r}}function Ioe(t,e){let r=qP(t,e);return{high:r,low:{...r,offset:r.offset+t.size*4}}}var Fv=class{constructor(e,r,i){this._buffer=null,this.device=e,this.id=r.id||"",this.size=r.size||1;let n=r.logicalType||r.type,o=n==="float64",{defaultValue:a}=r;a=Number.isFinite(a)?[a]:a||new Array(this.size).fill(0);let l;o?l="float32":!n&&r.isIndexed?l="uint32":l=n||"float32";let u=wU(n||l);this.doublePrecision=o,o&&r.fp64===!1&&(u=Float32Array),this.value=null,this.settings={...r,defaultType:u,defaultValue:a,logicalType:n,type:l,normalized:l.includes("norm"),size:this.size,bytesPerElement:u.BYTES_PER_ELEMENT},this.state={...i,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let e=this.getAccessor();return e.vertexOffset?e.vertexOffset*_p(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),mh.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,r=null){let i={};if(this.state.constant){let n=this.value;if(r){let o=qP(this.getAccessor(),r),a=o.offset/n.BYTES_PER_ELEMENT,l=o.size||this.size;i[e]=n.subarray(a,a+l)}else i[e]=n}else i[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?i[`${e}64Low`]=i[e]:i[`${e}64Low`]=new Float32Array(this.size)),i}getBufferLayout(e=this.id,r=null){let i=this.getAccessor(),n=[],o={name:this.id,byteStride:_p(i),attributes:n};if(this.doublePrecision){let a=Ioe(i,r||{});n.push(Lv(e,{...i,...a.high}),Lv(`${e}64Low`,{...i,...a.low}))}else if(r){let a=qP(i,r);n.push(Lv(e,{...i,...a}))}else n.push(Lv(e,i));return o}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){let r=Array.from(this.value);e=[r,r]}else{let{value:r,numInstances:i,size:n}=this,o=i*n;if(r&&o&&r.length>=o){let a=new Array(n).fill(1/0),l=new Array(n).fill(-1/0);for(let u=0;u<o;)for(let f=0;f<n;f++){let _=r[u++];_<a[f]&&(a[f]=_),_>l[f]&&(l[f]=_)}e=[a,l]}}return this.state.bounds=e,e}setData(e){let{state:r}=this,i;ArrayBuffer.isView(e)?i={value:e}:e instanceof cn?i={buffer:e}:i=e;let n={...this.settings,...i};if(ArrayBuffer.isView(i.value)){if(!i.type)if(this.doublePrecision&&i.value instanceof Float64Array)n.type="float32";else{let a=TU(i.value);n.type=n.normalized?a.replace("int","norm"):a}n.bytesPerElement=i.value.BYTES_PER_ELEMENT,n.stride=_p(n)}if(r.bounds=null,i.constant){let o=i.value;if(o=this._normalizeValue(o,[],0),this.settings.normalized&&(o=this.normalizeConstant(o)),!(!r.constant||!this._areValuesEqual(o,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=ArrayBuffer.isView(o)?o:new Float32Array(o)}else if(i.buffer){let o=i.buffer;r.externalBuffer=o,r.constant=!1,this.value=i.value||null}else if(i.value){this._checkExternalBuffer(i);let o=i.value;r.externalBuffer=null,r.constant=!1,this.value=o;let{buffer:a}=this,l=_p(n),u=(n.vertexOffset||0)*l;if(this.doublePrecision&&o instanceof Float64Array&&(o=o2(o,n)),this.settings.isIndexed){let _=this.settings.defaultType;o.constructor!==_&&(o=new _(o))}let f=o.byteLength+u+l*2;(!a||a.byteLength<f)&&(a=this._createBuffer(f)),a.write(o,u)}return this.setAccessor(n),!0}updateSubBuffer(e={}){this.state.bounds=null;let r=this.value,{startOffset:i=0,endOffset:n}=e;this.buffer.write(this.doublePrecision&&r instanceof Float64Array?o2(r,{size:this.size,startIndex:i,endIndex:n}):r.subarray(i,n),i*r.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,r=!1){let{state:i}=this,n=i.allocatedValue,o=mh.allocate(n,e+1,{size:this.size,type:this.settings.defaultType,copy:r});this.value=o;let{byteOffset:a}=this,{buffer:l}=this;return(!l||l.byteLength<o.byteLength+a)&&(l=this._createBuffer(o.byteLength+a),r&&n&&l.write(n instanceof Float64Array?o2(n,this):n,a)),i.allocatedValue=o,i.constant=!1,i.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){let{value:r}=e;if(!ArrayBuffer.isView(r))throw new Error(`Attribute ${this.id} value is not TypedArray`);let i=this.settings.defaultType,n=!1;if(this.doublePrecision&&(n=r.BYTES_PER_ELEMENT<4),n)throw new Error(`Attribute ${this.id} does not support ${r.constructor.name}`);!(r instanceof i)&&this.settings.normalized&&!("normalized"in e)&&br.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(r=>(r+128)/255*2-1);case"snorm16":return new Float32Array(e).map(r=>(r+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(r=>r/255);case"unorm16":return new Float32Array(e).map(r=>r/65535);default:return e}}_normalizeValue(e,r,i){let{defaultValue:n,size:o}=this.settings;if(Number.isFinite(e))return r[i]=e,r;if(!e){let a=o;for(;--a>=0;)r[i+a]=n[a];return r}switch(o){case 4:r[i+3]=Number.isFinite(e[3])?e[3]:n[3];case 3:r[i+2]=Number.isFinite(e[2])?e[2]:n[2];case 2:r[i+1]=Number.isFinite(e[1])?e[1]:n[1];case 1:r[i+0]=Number.isFinite(e[0])?e[0]:n[0];break;default:let a=o;for(;--a>=0;)r[i+a]=Number.isFinite(e[a])?e[a]:n[a]}return r}_areValuesEqual(e,r){if(!e||!r)return!1;let{size:i}=this;for(let n=0;n<i;n++)if(e[n]!==r[n])return!1;return!0}_createBuffer(e){this._buffer&&this._buffer.destroy();let{isIndexed:r,type:i}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:r?cn.INDEX:cn.VERTEX,indexType:r?i:void 0,byteLength:e}),this._buffer}};var SU=[],CU=[];function na(t,e=0,r=1/0){let i=SU,n={index:-1,data:t,target:[]};return t?typeof t[Symbol.iterator]=="function"?i=t:t.length>0&&(CU.length=t.length,i=CU):i=SU,(e>0||Number.isFinite(r))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(e,r),n.index=e-1),{iterable:i,objectInfo:n}}function g2(t){return t&&t[Symbol.asyncIterator]}function _2(t,e){let{size:r,stride:i,offset:n,startIndices:o,nested:a}=e,l=t.BYTES_PER_ELEMENT,u=i?i/l:r,f=n?n/l:0,_=Math.floor((t.length-f)/u);return(w,{index:E,target:M})=>{if(!o){let $=E*u+f;for(let te=0;te<r;te++)M[te]=t[$+te];return M}let D=o[E],j=o[E+1]||_,V;if(a){V=new Array(j-D);for(let $=D;$<j;$++){let te=$*u+f;M=new Array(r);for(let ne=0;ne<r;ne++)M[ne]=t[te+ne];V[$-D]=M}}else if(u===r)V=t.subarray(D*r+f,j*r+f);else{V=new t.constructor((j-D)*r);let $=0;for(let te=D;te<j;te++){let ne=te*u+f;for(let le=0;le<r;le++)V[$++]=t[ne+le]}}return V}}var MU=[],Nv=[[0,1/0]];function IU(t,e){if(t===Nv||(e[0]<0&&(e[0]=0),e[0]>=e[1]))return t;let r=[],i=t.length,n=0;for(let o=0;o<i;o++){let a=t[o];a[1]<e[0]?(r.push(a),n=o+1):a[0]>e[1]?r.push(a):e=[Math.min(a[0],e[0]),Math.max(a[1],e[1])]}return r.splice(n,0,e),r}function XP(t){let{source:e,target:r,start:i=0,size:n,getData:o}=t,a=t.end||r.length,l=e.length,u=a-i;if(l>u){r.set(e.subarray(0,u),i);return}if(r.set(e,i),!o)return;let f=l;for(;f<u;){let _=o(f,e);for(let w=0;w<n;w++)r[i+f]=_[w]||0,f++}}function PU({source:t,target:e,size:r,getData:i,sourceStartIndices:n,targetStartIndices:o}){if(!Array.isArray(o))return XP({source:t,target:e,size:r,getData:i}),e;let a=0,l=0,u=i&&((_,w)=>i(_+l,w)),f=Math.min(n.length,o.length);for(let _=1;_<f;_++){let w=n[_]*r,E=o[_]*r;XP({source:t.subarray(a,w),target:e,start:l,end:E,size:r,getData:u}),a=w,l=E}return l<e.length&&XP({source:[],target:e,start:l,size:r,getData:u}),e}var Roe={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function y2(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});let r=t.type||"interpolation";return{...Roe[r],...e,...t,type:r}}function v2(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${t}"`)}}function x2(t){switch(t){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function b2(t){t.push(t.shift())}function kv(t,e){let{doublePrecision:r,settings:i,value:n,size:o}=t,a=r&&n instanceof Float64Array?2:1;return(i.noAlloc?n.length:e*o)*a}function w2({buffer:t,numInstances:e,attribute:r,fromLength:i,fromStartIndices:n,getData:o=a=>a}){let a=r.doublePrecision&&r.value instanceof Float64Array?2:1,l=r.size*a,u=r.byteOffset,f=r.startIndices,_=n&&f,w=kv(r,e),E=r.isConstant;if(!_&&i>=w)return t;let M=E?r.value:RU(r.getBuffer().readSyncWebGL());if(r.settings.normalized&&!E){let $=o;o=(te,ne)=>r.normalizeConstant($(te,ne))}let D=E?($,te)=>o(M,te):($,te)=>o(M.subarray($+u,$+u+l),te),j=RU(t.readSyncWebGL()),V=new Float32Array(w);return PU({source:j,target:V,sourceStartIndices:n,targetStartIndices:f,size:l,getData:D}),t.byteLength<V.byteLength+u&&(t=t.device.createBuffer({byteLength:V.byteLength+u})),t.write(V,u),t}function RU(t){return new Float32Array(t.buffer,t.byteOffset,t.byteLength/Float32Array.BYTES_PER_ELEMENT)}var Ad=class extends Fv{constructor(e,r){super(e,r,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:Nv}),this.constant=!1,this.settings.update=r.update||(r.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){let r=this.state.needsRedraw;return this.state.needsRedraw=r&&!e,r}layoutChanged(){return this.state.layoutChanged}setAccessor(e){this.state.layoutChanged||=!EU(e,this.getAccessor()),super.setAccessor(e)}getUpdateTriggers(){let{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;let{accessor:r}=this.settings,i=this.settings.transition,n=Array.isArray(r)?e[r.find(o=>e[o])]:e[r];return y2(n,i)}setNeedsUpdate(e=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),r){let{startRow:i=0,endRow:n=1/0}=r;this.state.updateRanges=IU(this.state.updateRanges,[i,n])}else this.state.updateRanges=Nv}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=MU}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){let{state:r,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(e,r.updateRanges!==Nv),!0):!1}updateBuffer({numInstances:e,data:r,props:i,context:n}){if(!this.needsUpdate())return!1;let{state:{updateRanges:o},settings:{update:a,noAlloc:l}}=this,u=!0;if(a){for(let[f,_]of o)a.call(n,this,{data:r,startRow:f,endRow:_,props:i,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[f,_]of o){let w=Number.isFinite(f)?this.getVertexOffset(f):0,E=Number.isFinite(_)?this.getVertexOffset(_):l||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:w,endOffset:E})}this._checkAttributeArray()}else u=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),u}setConstantValue(e){return e===void 0||typeof e=="function"?!1:(this.setData({constant:!0,value:e})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}setExternalBuffer(e){let{state:r}=this;return e?(this.clearNeedsUpdate(),r.lastExternalBuffer===e||(r.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e)),!0):(r.lastExternalBuffer=null,!1)}setBinaryValue(e,r=null){let{state:i,settings:n}=this;if(!e)return i.binaryValue=null,i.binaryAccessor=null,!1;if(n.noAlloc)return!1;if(i.binaryValue===e)return this.clearNeedsUpdate(),!0;if(i.binaryValue=e,this.setNeedsRedraw(),n.transform||r!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});let a=e;ss(ArrayBuffer.isView(a.value),`invalid ${n.accessor}`);let l=Boolean(a.size)&&a.size!==this.size;return i.binaryAccessor=_2(a.value,{size:a.size||this.size,stride:a.stride,offset:a.offset,startIndices:r,nested:l}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){let{startIndices:r}=this;return(r?e<r.length?r[e]:this.numInstances:e)*this.size}getValue(){let e=this.settings.shaderAttributes,r=super.getValue();if(!e)return r;for(let i in e)Object.assign(r,super.getValue(i,e[i]));return r}getBufferLayout(){this.state.layoutChanged=!1;let e=this.settings.shaderAttributes,r=super.getBufferLayout();if(!e)return r;for(let i in e){let n=super.getBufferLayout(i,e[i]);r.attributes.push(...n.attributes)}return r}_autoUpdater(e,{data:r,startRow:i,endRow:n,props:o,numInstances:a}){if(e.constant)return;let{settings:l,state:u,value:f,size:_,startIndices:w}=e,{accessor:E,transform:M}=l,D=u.binaryAccessor||(typeof E=="function"?E:o[E]);ss(typeof D=="function",`accessor "${E}" is not a function`);let j=e.getVertexOffset(i),{iterable:V,objectInfo:$}=na(r,i,n);for(let te of V){$.index++;let ne=D(te,$);if(M&&(ne=M.call(this,ne)),w){let le=($.index<w.length-1?w[$.index+1]:a)-w[$.index];if(ne&&Array.isArray(ne[0])){let z=j;for(let ke of ne)e._normalizeValue(ke,f,z),z+=_}else ne&&ne.length>_?f.set(ne,j):(e._normalizeValue(ne,$.target,0),h2({target:f,source:$.target,start:j,count:le}));j+=le*_}else e._normalizeValue(ne,f,j),j+=_}}_validateAttributeUpdaters(){let{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:e}=this,r=Math.min(4,this.size);if(e&&e.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(e[3]);case 3:i=i&&Number.isFinite(e[2]);case 2:i=i&&Number.isFinite(e[1]);case 1:i=i&&Number.isFinite(e[0]);break;default:i=!1}if(!i)throw new Error(`Illegal attribute generated for ${this.id}`)}}};var Uv=class{constructor({device:e,attribute:r,timeline:i}){this.type="interpolation",this.device=e,this.transition=new $c(i),this.attribute=r,this.attributeInTransition=new Ad(e,r.settings),ArrayBuffer.isView(r.value)&&this.attributeInTransition.setData(r.value),this.currentStartIndices=r.startIndices,this.currentLength=0,this.transform=Ooe(e,r);let n={byteLength:r.buffer.byteLength,usage:35050};this.buffers=[e.createBuffer(n),e.createBuffer(n)]}get inProgress(){return this.transition.inProgress}start(e,r){if(e.duration<=0){this.transition.cancel();return}this.settings=e;let{buffers:i,attribute:n}=this;b2(i);let o={numInstances:r,attribute:n,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:e.enter};for(let[a,l]of i.entries()){let u=w2({buffer:l,...o});l!==u&&(l.destroy(),i[a]=u,console.warn(`[GPUInterpolationTransition] Replaced buffer ${l.id} (${l.byteLength} bytes) \u2192 ${u.id} (${u.byteLength} bytes)`))}this.currentStartIndices=n.startIndices,this.currentLength=kv(n,r),this.attributeInTransition.setData({buffer:i[1],value:n.value}),this.transition.start(e),this.transform.model.setVertexCount(Math.floor(this.currentLength/n.size)),this.transform.model.setAttributes(n.getBuffer()?{aFrom:i[0],aTo:n.getBuffer()}:{aFrom:i[0]}),this.transform.transformFeedback.setBuffers({vCurrent:i[1]})}update(){let e=this.transition.update();if(e){let{duration:r,easing:i}=this.settings,{time:n}=this.transition,o=n/r;i&&(o=i(o)),this.transform.model.setUniforms({time:o}),this.transform.run()}return e}cancel(){this.transition.cancel(),this.transform.delete();for(let e of this.buffers)e.delete();this.buffers.length=0}},Boe=`#version 300 es
|
|
1716
1716
|
#define SHADER_NAME interpolation-transition-vertex-shader
|
|
1717
1717
|
|
|
1718
1718
|
uniform float time;
|
|
@@ -2097,7 +2097,7 @@ void main(void) {
|
|
|
2097
2097
|
fragColor.rgb = packUVsIntoRGB(uv);
|
|
2098
2098
|
}
|
|
2099
2099
|
}
|
|
2100
|
-
`;var Use={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:ni.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}},D2=class extends Yn{getShaders(){return super.getShaders({vs:ez,fs:tz,modules:[vo,Po]})}initializeState(){let e=this.getAttributeManager();e.remove(["instancePickingColors"]);let r=!0;e.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:"float64",fp64:this.use64bitPositions(),update:i=>i.value=this.state.mesh.positions,noAlloc:r},texCoords:{size:2,update:i=>i.value=this.state.mesh.texCoords,noAlloc:r}})}updateState({props:e,oldProps:r,changeFlags:i}){let n=this.getAttributeManager();if(i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll()),e.bounds!==r.bounds){let o=this.state.mesh,a=this._createMesh();this.state.model.setVertexCount(a.vertexCount);for(let l in a)o&&o[l]!==a[l]&&n.invalidate(l);this.setState({mesh:a,...this._getCoordinateUniforms()})}else e._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(e){let{image:r}=this.props,i=e.info;if(!i.color||!r)return i.bitmap=null,i;
|
|
2100
|
+
`;var Use={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:ni.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}},D2=class extends Yn{getShaders(){return super.getShaders({vs:ez,fs:tz,modules:[vo,Po]})}initializeState(){let e=this.getAttributeManager();e.remove(["instancePickingColors"]);let r=!0;e.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:"float64",fp64:this.use64bitPositions(),update:i=>i.value=this.state.mesh.positions,noAlloc:r},texCoords:{size:2,update:i=>i.value=this.state.mesh.texCoords,noAlloc:r}})}updateState({props:e,oldProps:r,changeFlags:i}){let n=this.getAttributeManager();if(i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll()),e.bounds!==r.bounds){let o=this.state.mesh,a=this._createMesh();this.state.model.setVertexCount(a.vertexCount);for(let l in a)o&&o[l]!==a[l]&&n.invalidate(l);this.setState({mesh:a,...this._getCoordinateUniforms()})}else e._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(e){let{image:r}=this.props,i=e.info;if(!i.color||!r)return i.bitmap=null,i;let{width:n,height:o}=r;i.index=0;let a=zse(i.color);return i.bitmap={size:{width:n,height:o},uv:a,pixel:[Math.floor(a[0]*n),Math.floor(a[1]*o)]},i}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(e){super._updateAutoHighlight({...e,color:this.encodePickingColor(0)})}_createMesh(){let{bounds:e}=this.props,r=e;return rz(e)&&(r=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),A3(r,this.context.viewport.resolution)}_getModel(){return new qi(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-list",isInstanced:!1})}draw(e){let{uniforms:r,moduleParameters:i}=e,{model:n,coordinateConversion:o,bounds:a,disablePicking:l}=this.state,{image:u,desaturate:f,transparentColor:_,tintColor:w}=this.props;i.picking.isActive&&l||u&&n&&(n.setUniforms(r),n.setBindings({bitmapTexture:u}),n.setUniforms({desaturate:f,transparentColor:_.map(E=>E/255),tintColor:w.slice(0,3).map(E=>E/255),coordinateConversion:o,bounds:a}),n.draw(this.context.renderPass))}_getCoordinateUniforms(){let{LNGLAT:e,CARTESIAN:r,DEFAULT:i}=ni,{_imageCoordinateSystem:n}=this.props;if(n!==i){let{bounds:o}=this.props;if(!rz(o))throw new Error("_imageCoordinateSystem only supports rectangular bounds");let a=this.context.viewport.resolution?e:r;if(n=n===e?e:r,n===e&&a===r)return{coordinateConversion:-1,bounds:o};if(n===r&&a===e){let l=Ka([o[0],o[1]]),u=Ka([o[2],o[3]]);return{coordinateConversion:1,bounds:[l[0],l[1],u[0],u[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}},ZA=D2;(()=>{D2.layerName="BitmapLayer"})(),(()=>{D2.defaultProps=Use})();function zse(t){let[e,r,i]=t,n=(i&240)/256,o=(i&15)/16;return[(e+o)/256,(r+n)/256]}function rz(t){return Number.isFinite(t[0])}var iz=`#version 300 es
|
|
2101
2101
|
#define SHADER_NAME icon-layer-vertex-shader
|
|
2102
2102
|
in vec2 positions;
|
|
2103
2103
|
in vec3 instancePositions;
|
|
@@ -2313,7 +2313,7 @@ discard;
|
|
|
2313
2313
|
fragColor = vColor;
|
|
2314
2314
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
2315
2315
|
}
|
|
2316
|
-
`;var dz=[0,0,0,255],pz=[0,0,1],Qse={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:t=>t.position},getNormal:{type:"accessor",value:pz},getColor:{type:"accessor",value:dz},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};function $se(t){let{header:e,attributes:r}=t
|
|
2316
|
+
`;var dz=[0,0,0,255],pz=[0,0,1],Qse={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:t=>t.position},getNormal:{type:"accessor",value:pz},getColor:{type:"accessor",value:dz},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};function $se(t){let{header:e,attributes:r}=t;if(!(!e||!r)&&(t.length=e.vertexCount,r.POSITION&&(r.instancePositions=r.POSITION),r.NORMAL&&(r.instanceNormals=r.NORMAL),r.COLOR_0)){let{size:i,value:n}=r.COLOR_0;r.instanceColors={size:i,type:"unorm8",value:n}}}var N2=class extends Yn{getShaders(){return super.getShaders({vs:hz,fs:fz,modules:[vo,Ou,Po]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:pz},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:dz}})}updateState(e){let{changeFlags:r,props:i}=e;super.updateState(e),r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),r.dataChanged&&$se(i.data)}draw({uniforms:e}){let{pointSize:r,sizeUnits:i}=this.props,n=this.state.model;n.setUniforms(e),n.setUniforms({sizeUnits:Ss[i],radiusPixels:r}),n.draw(this.context.renderPass)}_getModel(){let e=[];for(let r=0;r<3;r++){let i=r/3*Math.PI*2;e.push(Math.cos(i)*2,Math.sin(i)*2,0)}return new qi(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Un({topology:"triangle-list",attributes:{positions:new Float32Array(e)}}),isInstanced:!0})}},QA=N2;(()=>{N2.layerName="PointCloudLayer"})(),(()=>{N2.defaultProps=Qse})();var Az=`#version 300 es
|
|
2317
2317
|
#define SHADER_NAME scatterplot-layer-vertex-shader
|
|
2318
2318
|
in vec3 positions;
|
|
2319
2319
|
in vec3 instancePositions;
|
|
@@ -2689,7 +2689,7 @@ discard;
|
|
|
2689
2689
|
fragColor = vColor;
|
|
2690
2690
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
2691
2691
|
}
|
|
2692
|
-
`;var Dz=[0,0,0,255],Pae={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:Dz},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},x3={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},X2=class extends Yn{getShaders(){return super.getShaders({vs:Bz,fs:Oz,modules:[vo,Po]})}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:x3,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:x3,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:x3,defaultValue:Dz},instancePickingColors:{size:4,type:"uint8",accessor:(i,{index:n,target:o})=>this.encodePickingColor(i&&i.__source?i.__source.index:n,o)}}),this.setState({pathTesselator:new dx({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);let{props:r,changeFlags:i}=e,n=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:a}=this.state,l=r.data.attributes||{};a.updateGeometry({data:r.data,geometryBuffer:l.getPath,buffers:l,normalize:!r._pathType,loop:r._pathType==="loop",getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:a.instanceCount,startIndices:a.vertexStarts}),i.dataChanged||n.invalidateAll()}i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll())}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,
|
|
2692
|
+
`;var Dz=[0,0,0,255],Pae={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:Dz},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},x3={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},X2=class extends Yn{getShaders(){return super.getShaders({vs:Bz,fs:Oz,modules:[vo,Po]})}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:x3,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:x3,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:x3,defaultValue:Dz},instancePickingColors:{size:4,type:"uint8",accessor:(i,{index:n,target:o})=>this.encodePickingColor(i&&i.__source?i.__source.index:n,o)}}),this.setState({pathTesselator:new dx({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);let{props:r,changeFlags:i}=e,n=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:a}=this.state,l=r.data.attributes||{};a.updateGeometry({data:r.data,geometryBuffer:l.getPath,buffers:l,normalize:!r._pathType,loop:r._pathType==="loop",getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:a.instanceCount,startIndices:a.vertexStarts}),i.dataChanged||n.invalidateAll()}i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll())}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{jointRounded:r,capRounded:i,billboard:n,miterLimit:o,widthUnits:a,widthScale:l,widthMinPixels:u,widthMaxPixels:f}=this.props,_=this.state.model;_.setUniforms(e),_.setUniforms({jointType:Number(r),capType:Number(i),billboard:n,widthUnits:Ss[a],widthScale:l,miterLimit:o,widthMinPixels:u,widthMaxPixels:f}),_.draw(this.context.renderPass)}_getModel(){let e=[0,1,2,1,4,2,1,3,4,3,5,4],r=[0,0,0,-1,0,1,1,-1,1,1,1,0];return new qi(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Un({topology:"triangle-list",attributes:{indices:new Uint16Array(e),positions:{value:new Float32Array(r),size:2}}}),isInstanced:!0})}calculatePositions(e){let{pathTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateSegmentTypes(e){let{pathTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("segmentTypes")}},bh=X2;(()=>{X2.defaultProps=Pae})(),(()=>{X2.layerName="PathLayer"})();var Gz=sc(Uz(),1);var Q2=p0.CLOCKWISE,zz=p0.COUNTER_CLOCKWISE,xp={isClosed:!0};function qae(t){if(t=t&&t.positions||t,!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error("invalid polygon")}function g0(t){return"positions"in t?t.positions:t}function gx(t){return"holeIndices"in t?t.holeIndices:null}function Xae(t){return Array.isArray(t[0])}function Yae(t){return t.length>=1&&t[0].length>=2&&Number.isFinite(t[0][0])}function Kae(t){let e=t[0],r=t[t.length-1];return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}function Zae(t,e,r,i){for(let n=0;n<e;n++)if(t[r+n]!==t[i-e+n])return!1;return!0}function Vz(t,e,r,i,n){let o=e,a=r.length;for(let l=0;l<a;l++)for(let u=0;u<i;u++)t[o++]=r[l][u]||0;if(!Kae(r))for(let l=0;l<i;l++)t[o++]=r[0][l]||0;return xp.start=e,xp.end=o,xp.size=i,em(t,n,xp),o}function Hz(t,e,r,i,n=0,o,a){o=o||r.length;let l=o-n;if(l<=0)return e;let u=e;for(let f=0;f<l;f++)t[u++]=r[n+f];if(!Zae(r,i,n,o))for(let f=0;f<i;f++)t[u++]=r[n+f];return xp.start=e,xp.end=u,xp.size=i,em(t,a,xp),u}function $2(t,e){qae(t);let r=[],i=[];if("positions"in t){let{positions:n,holeIndices:o}=t;if(o){let a=0;for(let l=0;l<=o.length;l++)a=Hz(r,a,n,e,o[l-1],o[l],l===0?Q2:zz),i.push(a);return i.pop(),{positions:r,holeIndices:i}}t=n}if(!Xae(t))return Hz(r,0,t,e,0,r.length,Q2),r;if(!Yae(t)){let n=0;for(let[o,a]of t.entries())n=Vz(r,n,a,e,o===0?Q2:zz),i.push(n);return i.pop(),{positions:r,holeIndices:i}}return Vz(r,0,t,e,Q2),r}function S3(t,e,r){let i=t.length/3,n=0;for(let o=0;o<i;o++){let a=(o+1)%i;n+=t[o*3+e]*t[a*3+r],n-=t[a*3+e]*t[o*3+r]}return Math.abs(n/2)}function jz(t,e,r,i){let n=t.length/3;for(let o=0;o<n;o++){let a=o*3,l=t[a+0],u=t[a+1],f=t[a+2];t[a+e]=l,t[a+r]=u,t[a+i]=f}}function Wz(t,e,r,i){let n=gx(t);n&&(n=n.map(l=>l/e));let o=g0(t),a=i&&e===3;if(r){let l=o.length;o=o.slice();let u=[];for(let f=0;f<l;f+=e){u[0]=o[f],u[1]=o[f+1],a&&(u[2]=o[f+2]);let _=r(u);o[f]=_[0],o[f+1]=_[1],a&&(o[f+2]=_[2])}}if(a){let l=S3(o,0,1),u=S3(o,0,2),f=S3(o,1,2);if(!l&&!u&&!f)return[];l>u&&l>f||(u>f?(r||(o=o.slice()),jz(o,0,2,1)):(r||(o=o.slice()),jz(o,2,0,1)))}return(0,Gz.default)(o,n,e)}var _x=class extends gd{constructor(e){let{fp64:r,IndexType:i=Uint32Array}=e;super({...e,attributes:{positions:{size:3,type:r?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:i,size:1}}})}get(e){let{attributes:r}=this;return e==="indices"?r.indices&&r.indices.subarray(0,this.vertexCount):r[e]}updateGeometry(e){super.updateGeometry(e);let r=this.buffers.indices;if(r)this.vertexCount=(r.value||r).length;else if(this.data&&!this.getGeometry)throw new Error("missing indices buffer")}normalizeGeometry(e){if(this.normalize){let r=$2(e,this.positionSize);return this.opts.resolution?hx(g0(r),gx(r),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?y3(g0(r),gx(r),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):r}return e}getGeometrySize(e){if(Xz(e)){let r=0;for(let i of e)r+=this.getGeometrySize(i);return r}return g0(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,r){if(e&&Xz(e))for(let i of e){let n=this.getGeometrySize(i);r.geometrySize=n,this.updateGeometryAttributes(i,r),r.vertexStart+=n,r.indexStart=this.indexStarts[r.geometryIndex+1]}else{let i=e;this._updateIndices(i,r),this._updatePositions(i,r),this._updateVertexValid(i,r)}}_updateIndices(e,{geometryIndex:r,vertexStart:i,indexStart:n}){let{attributes:o,indexStarts:a,typedArrayManager:l}=this,u=o.indices;if(!u||!e)return;let f=n,_=Wz(e,this.positionSize,this.opts.preproject,this.opts.full3d);u=l.allocate(u,n+_.length,{copy:!0});for(let w=0;w<_.length;w++)u[f++]=_[w]+i;a[r+1]=n+_.length,o.indices=u}_updatePositions(e,{vertexStart:r,geometrySize:i}){let{attributes:{positions:n},positionSize:o}=this;if(!n||!e)return;let a=g0(e);for(let l=r,u=0;u<i;l++,u++){let f=a[u*o],_=a[u*o+1],w=o>2?a[u*o+2]:0;n[l*3]=f,n[l*3+1]=_,n[l*3+2]=w}}_updateVertexValid(e,{vertexStart:r,geometrySize:i}){let{positionSize:n}=this,o=this.attributes.vertexValid,a=e&&gx(e);if(e&&e.edgeTypes?o.set(e.edgeTypes,r):o.fill(1,r,r+i),a)for(let l=0;l<a.length;l++)o[r+a[l]/n-1]=0;o[r+i-1]=0}};function Xz(t){return Array.isArray(t)&&t.length>0&&!Number.isFinite(t[0])}var eT=`uniform bool extruded;
|
|
2693
2693
|
uniform bool isWireframe;
|
|
2694
2694
|
uniform float elevationScale;
|
|
2695
2695
|
uniform float opacity;
|
|
@@ -2807,7 +2807,7 @@ void main(void) {
|
|
|
2807
2807
|
fragColor = vColor;
|
|
2808
2808
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
2809
2809
|
}
|
|
2810
|
-
`;var rT=[0,0,0,255],Jae={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:rT},getLineColor:{type:"accessor",value:rT},material:!0},tT={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},iT=class extends Yn{getShaders(e){return super.getShaders({vs:e==="top"?Yz:Kz,fs:Zz,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[vo,Ou,Po]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{device:e,viewport:r}=this.context,{coordinateSystem:i}=this.props,{_full3d:n}=this.props;r.isGeospatial&&i===ni.DEFAULT&&(i=ni.LNGLAT);let o;i===ni.LNGLAT&&(n?o=r.projectPosition.bind(r):o=r.projectFlat.bind(r)),this.setState({numInstances:0,polygonTesselator:new _x({preproject:o,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let a=this.getAttributeManager(),l=!0;a.remove(["instancePickingColors"]),a.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:l},vertexPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:tT,accessor:"getPolygon",update:this.calculatePositions,noAlloc:l,shaderAttributes:{instancePositions:{vertexOffset:0,divisor:1},instanceNextPositions:{vertexOffset:1,divisor:1}}},instanceVertexValid:{size:1,type:"uint16",divisor:1,update:this.calculateVertexValid,noAlloc:l},elevations:{size:1,transition:tT,accessor:"getElevation",shaderAttributes:{instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:tT,accessor:"getFillColor",defaultValue:rT,shaderAttributes:{instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:tT,accessor:"getLineColor",defaultValue:rT,shaderAttributes:{instanceLineColors:{divisor:1}}},pickingColors:{size:4,type:"uint8",accessor:(u,{index:f,target:_})=>this.encodePickingColor(u&&u.__source?u.__source.index:f,_),shaderAttributes:{instancePickingColors:{divisor:1}}}})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,
|
|
2810
|
+
`;var rT=[0,0,0,255],Jae={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:rT},getLineColor:{type:"accessor",value:rT},material:!0},tT={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},iT=class extends Yn{getShaders(e){return super.getShaders({vs:e==="top"?Yz:Kz,fs:Zz,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[vo,Ou,Po]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{device:e,viewport:r}=this.context,{coordinateSystem:i}=this.props,{_full3d:n}=this.props;r.isGeospatial&&i===ni.DEFAULT&&(i=ni.LNGLAT);let o;i===ni.LNGLAT&&(n?o=r.projectPosition.bind(r):o=r.projectFlat.bind(r)),this.setState({numInstances:0,polygonTesselator:new _x({preproject:o,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let a=this.getAttributeManager(),l=!0;a.remove(["instancePickingColors"]),a.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:l},vertexPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:tT,accessor:"getPolygon",update:this.calculatePositions,noAlloc:l,shaderAttributes:{instancePositions:{vertexOffset:0,divisor:1},instanceNextPositions:{vertexOffset:1,divisor:1}}},instanceVertexValid:{size:1,type:"uint16",divisor:1,update:this.calculateVertexValid,noAlloc:l},elevations:{size:1,transition:tT,accessor:"getElevation",shaderAttributes:{instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:tT,accessor:"getFillColor",defaultValue:rT,shaderAttributes:{instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:tT,accessor:"getLineColor",defaultValue:rT,shaderAttributes:{instanceLineColors:{divisor:1}}},pickingColors:{size:4,type:"uint8",accessor:(u,{index:f,target:_})=>this.encodePickingColor(u&&u.__source?u.__source.index:f,_),shaderAttributes:{instancePickingColors:{divisor:1}}}})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:r,filled:i,wireframe:n,elevationScale:o}=this.props,{topModel:a,sideModel:l,wireframeModel:u,polygonTesselator:f}=this.state,_={...e,extruded:Boolean(r),elevationScale:o};u&&n&&(u.setInstanceCount(f.instanceCount-1),u.setUniforms(_),u.draw(this.context.renderPass)),l&&i&&(l.setInstanceCount(f.instanceCount-1),l.setUniforms(_),l.draw(this.context.renderPass)),a&&i&&(a.setVertexCount(f.vertexCount),a.setUniforms(_),a.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:r,oldProps:i,changeFlags:n}=e,o=this.getAttributeManager();(n.extensionsChanged||r.filled!==i.filled||r.extruded!==i.extruded)&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),o.invalidateAll())}updateGeometry({props:e,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:o}=this.state,a=e.data.attributes||{};o.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:a.getPolygon,buffers:a,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:o.instanceCount,startIndices:o.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:r,extruded:i}=this.props,n,o,a,l=this.getAttributeManager().getBufferLayouts();if(r){let u=this.getShaders("top");u.defines.NON_INSTANCED_MODEL=1,n=new qi(this.context.device,{...u,id:`${e}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:l,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}return i&&(o=new qi(this.context.device,{...this.getShaders("side"),id:`${e}-side`,bufferLayout:l,uniforms:{isWireframe:!1},geometry:new Un({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:1,userData:{excludeAttributes:{indices:!0}}}),a=new qi(this.context.device,{...this.getShaders("side"),id:`${e}-wireframe`,bufferLayout:l,uniforms:{isWireframe:!0},geometry:new Un({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:1,userData:{excludeAttributes:{indices:!0}}})),{models:[o,a,n].filter(Boolean),topModel:n,sideModel:o,wireframeModel:a}}calculateIndices(e){let{polygonTesselator:r}=this.state;e.startIndices=r.indexStarts,e.value=r.get("indices")}calculatePositions(e){let{polygonTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}},wh=iT;(()=>{iT.defaultProps=Jae})(),(()=>{iT.layerName="SolidPolygonLayer"})();function nT({data:t,getIndex:e,dataRange:r,replace:i}){let{startRow:n=0,endRow:o=1/0}=r,a=t.length,l=a,u=a;for(let E=0;E<a;E++){let M=e(t[E]);if(l>E&&M>=n&&(l=E),M>=o){u=E;break}}let f=l,w=u-l!==i.length?t.slice(u):void 0;for(let E=0;E<i.length;E++)t[f++]=i[E];if(w){for(let E=0;E<w.length;E++)t[f++]=w[E];t.length=f}return{startRow:l,endRow:l+i.length}}var Jz=[0,0,0,255],Qae=[0,0,0,255],$ae={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:t=>t.polygon},getFillColor:{type:"accessor",value:Qae},getLineColor:{type:"accessor",value:Jz},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0},oT=class extends As{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&br.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){let r=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(r&&Array.isArray(e.dataChanged)){let i=this.state.paths.slice(),n=e.dataChanged.map(o=>nT({data:i,getIndex:a=>a.__source.index,dataRange:o,replace:this._getPaths(o)}));this.setState({paths:i,pathsDiff:n})}else r&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:r,getPolygon:i,positionFormat:n,_normalize:o}=this.props,a=[],l=n==="XY"?2:3,{startRow:u,endRow:f}=e,{iterable:_,objectInfo:w}=na(r,u,f);for(let E of _){w.index++;let M=i(E,w);o&&(M=$2(M,l));let{holeIndices:D}=M,j=M.positions||M;if(D)for(let V=0;V<=D.length;V++){let $=j.slice(D[V-1]||0,D[V]||j.length);a.push(this.getSubLayerRow({path:$},E,w.index))}else a.push(this.getSubLayerRow({path:j},E,w.index))}return a}renderLayers(){let{data:e,_dataDiff:r,stroked:i,filled:n,extruded:o,wireframe:a,_normalize:l,_windingOrder:u,elevationScale:f,transitions:_,positionFormat:w}=this.props,{lineWidthUnits:E,lineWidthScale:M,lineWidthMinPixels:D,lineWidthMaxPixels:j,lineJointRounded:V,lineMiterLimit:$,lineDashJustified:te}=this.props,{getFillColor:ne,getLineColor:le,getLineWidth:z,getLineDashArray:ke,getElevation:Y,getPolygon:X,updateTriggers:O,material:I}=this.props,{paths:H,pathsDiff:ie}=this.state,Q=this.getSubLayerClass("fill",wh),ye=this.getSubLayerClass("stroke",bh),it=this.shouldRenderSubLayer("fill",H)&&new Q({_dataDiff:r,extruded:o,elevationScale:f,filled:n,wireframe:a,_normalize:l,_windingOrder:u,getElevation:Y,getFillColor:ne,getLineColor:o&&a?le:Jz,material:I,transitions:_},this.getSubLayerProps({id:"fill",updateTriggers:O&&{getPolygon:O.getPolygon,getElevation:O.getElevation,getFillColor:O.getFillColor,lineColors:o&&a,getLineColor:O.getLineColor}}),{data:e,positionFormat:w,getPolygon:X}),jt=!o&&i&&this.shouldRenderSubLayer("stroke",H)&&new ye({_dataDiff:ie&&(()=>ie),widthUnits:E,widthScale:M,widthMinPixels:D,widthMaxPixels:j,jointRounded:V,miterLimit:$,dashJustified:te,_pathType:"loop",transitions:_&&{getWidth:_.getLineWidth,getColor:_.getLineColor,getPath:_.getPolygon},getColor:this.getSubLayerAccessor(le),getWidth:this.getSubLayerAccessor(z),getDashArray:this.getSubLayerAccessor(ke)},this.getSubLayerProps({id:"stroke",updateTriggers:O&&{getWidth:O.getLineWidth,getColor:O.getLineColor,getDashArray:O.getLineDashArray}}),{data:H,positionFormat:w,getPath:nr=>nr.path});return[!o&&it,jt,o&&it]}},Th=oT;(()=>{oT.layerName="PolygonLayer"})(),(()=>{oT.defaultProps=$ae})();function Qz(t,e){if(!t)return null;let r="startIndices"in t?t.startIndices[e]:e,i=t.featureIds.value[r];return r!==-1?ele(t,i,r):null}function ele(t,e,r){let i={properties:{...t.properties[e]}};for(let n in t.numericProps)i.properties[n]=t.numericProps[n].value[r];return i}function $z(t,e){let r={points:null,lines:null,polygons:null};for(let i in r){let n=t[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(n.length*3);let o=[];for(let a=0;a<n.length;a++)e(n[a],o),r[i][a*3+0]=o[0],r[i][a*3+1]=o[1],r[i][a*3+2]=o[2]}return r}var e5=`#version 300 es
|
|
2811
2811
|
#define SHADER_NAME multi-icon-layer-fragment-shader
|
|
2812
2812
|
precision highp float;
|
|
2813
2813
|
uniform float opacity;
|
|
@@ -3304,7 +3304,7 @@ void main() {
|
|
|
3304
3304
|
fragColor = outTexture;
|
|
3305
3305
|
fragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
3306
3306
|
}
|
|
3307
|
-
`;var wce=2,G3={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},X8=[0,0],Tce={SUM:0,MEAN:1},Ece={getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ku,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}},Sce=["float32-renderable-webgl","texture-blend-float-webgl"],Cce={data:{props:["radiusPixels"]}},PT=class extends eu{initializeState(){super.initializeAggregationLayer(Cce),this.setState({colorDomain:X8}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:r,oldProps:i}=e,n=this._getChangeFlags(e);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:o,colorDomain:a}=this.state,{updateTriggers:l,intensity:u,threshold:f,aggregation:_}=this.props,w=this.getSubLayerClass("triangle",Px);return new w(this.getSubLayerProps({id:"triangle-layer",updateTriggers:l}),{coordinateSystem:ni.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:o,aggregationMode:Tce[_]||0,weightsTexture:e,intensity:u,threshold:f,colorDomain:a})}finalizeState(e){super.finalizeState(e);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:o,triPositionBuffer:a,triTexCoordBuffer:l,colorTexture:u,updateTimer:f}=this.state;r?.destroy(),i?.destroy(),n?.destroy(),o?.destroy(),a?.destroy(),l?.destroy(),u?.destroy(),f&&clearTimeout(f)}_getAttributeManager(){return new vh(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",r.viewportChanged=e.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{textureSize:e,format:r}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...G3,width:e,height:e,format:r}),maxWeightsTexture:this.context.device.createTexture({...G3,width:1,height:1,format:r})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,e.limits.maxTextureDimension2D),n=Sce.every(l=>e.features.has(l)),o=n?"rgba32float":"rgba8unorm",a=n?1:1/255;this.setState({textureSize:i,format:o,weightsScale:a}),n||br.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:r}=this.state,{weightsTexture:i}=this.state,n=this.getAttributeManager();r?.destroy(),r=new gf(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:n.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e}),this.setState({weightsTransform:r})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:r,weightsTexture:i,maxWeightsTexture:n}=this.state,o=this.getShaders({vs:H3,fs:j3});this._createWeightsTransform(o);let a=this.getShaders({vs:W8,fs:q8}),l=new gf(e,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:i},uniforms:{textureSize:r},targetTexture:n,...a,vertexCount:r*r,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:i,maxWeightsTexture:n,maxWeightTransform:l,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:H3,fs:j3,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e,textureSize:r}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([r.width,r.height]),r.unproject([0,r.height])].map(l=>l.map(Math.fround)),n=U8(i),o={visibleWorldBounds:n,viewportCorners:i},a=!1;if(e||!this.state.worldBounds||!z8(this.state.worldBounds,n)){let l=this._worldToCommonBounds(n),u=this._commonToWorldBounds(l);this.props.coordinateSystem===ni.LNGLAT&&(u[1]=Math.max(u[1],-85.051129),u[3]=Math.min(u[3],85.051129),u[0]=Math.max(u[0],-360),u[2]=Math.min(u[2],360));let f=this._worldToCommonBounds(u);o.worldBounds=u,o.normalizedCommonBounds=f,a=!0}return this.setState(o),a}_updateTextureRenderingBounds(){let{triPositionBuffer:e,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:n}=this.state,{viewport:o}=this.context;e.write(z3(n,3));let a=n.map(l=>H8(o.projectPosition(l),i));r.write(z3(a,2))}_updateColorTexture(e){let{colorRange:r}=e.props,{colorTexture:i}=this.state,n=wp(r,!1,Uint8Array);i&&i?.width===r.length?i.setSubImageData({data:n}):(i?.destroy(),i=this.context.device.createTexture({...G3,data:n,width:r.length,height:1})),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:e,colorDomain:r,aggregation:i}=this.props,{worldBounds:n,textureSize:o,weightsScale:a}=this.state,l=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let u=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i==="SUM"){let{viewport:j}=this.context,V=j.distanceScales.metersPerUnit[2]*(u[2]-u[0])/o;this.state.colorDomain=r.map($=>$*V*a)}else this.state.colorDomain=r||X8;let _=this.getAttributeManager().getAttributes(),w=this.getModuleSettings(),E=_.positions.buffer,M={radiusPixels:e,commonBounds:u,textureWidth:o,weightsScale:a},D=_.weights.buffer;l.model.setAttributes({positions:E,weights:D}),l.model.setVertexCount(this.getNumInstances()),l.model.setUniforms(M),l.model.updateModuleSettings(w),l.run({parameters:{viewport:[0,0,o,o]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;e?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(e,r={}){let{useLayerCoordinateSystem:i=!1}=r,[n,o,a,l]=e,{viewport:u}=this.context,{textureSize:f}=this.state,{coordinateSystem:_}=this.props,w=i&&(_===ni.LNGLAT_OFFSETS||_===ni.METER_OFFSETS),E=w?u.projectPosition(this.props.coordinateOrigin):[0,0],M=f*wce/u.scale,D,j;return i&&!w?(D=this.projectPosition([n,o,0]),j=this.projectPosition([a,l,0])):(D=u.projectPosition([n,o,0]),j=u.projectPosition([a,l,0])),V8([D[0]-E[0],D[1]-E[1],j[0]-E[0],j[1]-E[1]],M,M)}_commonToWorldBounds(e){let[r,i,n,o]=e,{viewport:a}=this.context,l=a.unprojectPosition([r,i]),u=a.unprojectPosition([n,o]);return l.slice(0,2).concat(u.slice(0,2))}},Rx=PT;(()=>{PT.layerName="HeatmapLayer"})(),(()=>{PT.defaultProps=Ece})();function Mce(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function RT(t){if(Array.isArray(t))return t.map(e=>RT(e));if(t&&typeof t=="object"){let e={};for(let[r,i]of Object.entries(t))e[Mce(r)]=RT(i);return e}return t}var EV=sc(TV(),1);function eR(t,e){if(e?._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(n,o,a,l)=>Boolean(e?.arrayPaths?.some(f=>o===f)),...e?._fastXML},i=Nue(t,r);return e?.uncapitalizeKeys?RT(i):i}function Nue(t,e){return new EV.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var kue="4.2.0-alpha.4",Eh={name:"XML",id:"xml",module:"xml",version:kue,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:Uue,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>eR(new TextDecoder().decode(t),{...Eh.options.xml,...e?.xml}),parseTextSync:(t,e)=>eR(t,{...Eh.options.xml,...e?.xml})};function Uue(t){return t.startsWith("<?xml")}function SV(t,e){let r=Eh.parseTextSync?.(t,e),i=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof i=="string"?i:i.value||i.code||"Unknown error"}var zue="4.2.0-alpha.4",Dx={id:"wms-error",name:"WMS Error",module:"wms",version:zue,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:Vue,options:{wms:{throwOnError:!1}},parse:async(t,e)=>tR(new TextDecoder().decode(t),e),parseSync:(t,e)=>tR(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>tR(t,e)};function Vue(t){return t.startsWith("<?xml")}function tR(t,e){let r={...Dx.options.wms,...e?.wms},i=SV(t,r),n=r.minimalErrors?i:`WMS Service error: ${i}`;if(r.throwOnError)throw new Error(n);return n}function um(t){return Array.isArray(t)?t:t?[t]:[]}function Lx(t){let e=um(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function Fx(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function OT(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function hm(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function rR(t,e){let r=Eh.parseTextSync?.(t,e),i=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,n=Hue(i);if(e?.inheritedLayerProps)for(let o of n.layers)MV(o,null);return e?.includeRawJSON&&(n.json=i),e?.includeXMLText&&(n.xml=t),n}function Hue(t){let e={version:String(t.version||""),name:String(t.Service?.Name||"unnamed"),title:t.Service?.Title?String(t.Service?.Title):void 0,abstract:t.Service?.Abstract?String(t.Service?.Abstract):void 0,keywords:Lx(t.Service?.KeywordList?.Keyword),fees:t.Service?.Fees?JSON.stringify(t.Service?.Fees):void 0,accessConstraints:t.Service?.AccessConstraints?JSON.stringify(t.Service?.AccessConstraints):void 0,layerLimit:OT(t.Service?.LayerLimit),maxWidth:OT(t.Service?.maxWidth),maxHeight:OT(t.Service?.maxHeight),layers:[],requests:jue(t.Capability?.Request),exceptions:Gue(t.Exception)},r=um(t.Capability?.Layer);for(let i of r)e.layers.push(CV(i));for(let[i,n]of Object.entries(e))n===void 0&&delete e[i];return e}function jue(t){let e={};for(let[r,i]of Object.entries(t||{})){let n=Lx(i?.Format);e[r]={mimeTypes:n}}return e}function Gue(t){if(um(t?.Format).length>0)return{mimeTypes:Lx(t)}}function CV(t){let e={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:Lx(t.KeywordList?.Keyword)},r=t?.CRS||t?.SRS;r&&Array.isArray(r)&&r.every(f=>typeof f=="string")&&(e.crs=r);let i=t?.EX_GeographicBoundingBox&&Wue(t?.EX_GeographicBoundingBox);i&&(e.geographicBoundingBox=i),i=t?.LatLonBoundingBox&&que(t?.LatLonBoundingBox),i&&(e.geographicBoundingBox=i);let n=t?.BoundingBox&&Xue(t?.BoundingBox);n&&n.length>0&&(e.boundingBoxes=n);let a=um(t?.Dimension).map(f=>Kue(f));a.length&&(e.dimensions=a),t?.opaque&&(e.opaque=hm(t?.opaque)),t?.cascaded&&(e.cascaded=hm(t?.cascaded)),t?.queryable&&(e.queryable=hm(t?.queryable));let l=um(t?.Layer),u=[];for(let f of l)u.push(CV(f));u.length>0&&(e.layers=u);for(let[f,_]of Object.entries(e))_===void 0&&delete e[f];return e}function Wue(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:i,southBoundLatitude:n}=t;return[[e,n],[i,r]]}function que(t){let{minx:e,miny:r,maxx:i,maxy:n}=t;return[[e,r],[i,n]]}function Xue(t){return um(t).map(r=>Yue(r))}function Yue(t){let{CRS:e,SRS:r,minx:i,miny:n,maxx:o,maxy:a,resx:l,resy:u}=t,f={crs:e||r,boundingBox:[[Fx(i),Fx(n)],[Fx(o),Fx(a)]]};return l&&(f.xResolution=l),u&&(f.yResolution=u),f}function Kue(t){let{name:e,units:r,value:i}=t,n={name:e,units:r,extent:i};return t.unitSymbol&&(n.unitSymbol=t.unitSymbol),t.default&&(n.defaultValue=t.default),t.multipleValues&&(n.multipleValues=hm(t.multipleValues)),t.nearestValue&&(n.nearestValue=hm(t.nearestValue)),t.current&&(n.current=hm(t.current)),n}function MV(t,e){e?.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e?.crs&&!t.crs&&(t.crs=[...e.crs]),e?.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e?.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])MV(r,t)}var Zue="4.2.0-alpha.4",L0={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:Zue,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Jue,options:{wms:{}},parse:async(t,e)=>rR(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>rR(t,e?.wms)};function Jue(t){return t.startsWith("<?xml")}function iR(t,e){let i=(Eh.parseTextSync?.(t,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(i)?i:[i]).map(o=>Que(o))}}function Que(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var IV={...L0,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>iR(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>iR(t,e)};function nR(t,e){return Eh.parseTextSync?.(t,e)}var PV={...L0,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>nR(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>nR(t,e)};function RV(t,e){let{type:r="auto"}=t,i=r==="auto"?ehe(t.url,e):$ue(r,e);if(!i)throw new Error("Not a valid image source type");return i.create(t)}function $ue(t,e){for(let r of e)if(r.type===t)return r;return null}function ehe(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var BV={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new oR(t)},oR=class extends wu{constructor(e){super(e),this.capabilities=null,this.url=e.url,this.data=e.url,this.substituteCRS84=e.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:i,...n}=e,o={bbox:r?[...r[0],...r[1]]:i,...n};return await this.getMap(o)}normalizeMetadata(e){return e}async getCapabilities(e,r){let i=this.getCapabilitiesURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);let a=await L0.parse(o,this.loadOptions);return this.capabilities=a,a}async getMap(e,r){let i=this.getMapURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await df.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await IV.parse(o,this.loadOptions)}async getFeatureInfoText(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),new TextDecoder().decode(o)}async describeLayer(e,r){let i=this.describeLayerURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await PV.parse(o,this.loadOptions)}async getLegendGraphic(e,r){let i=this.getLegendGraphicURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await df.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",i,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let i={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",i,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let i={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",i,r)}describeLayerURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",i,r)}getLegendGraphicURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",i,r)}_parseWMSUrl(e){let[r,i]=e.split("?"),n=i.split("&"),o={};for(let a of n){let[l,u]=a.split("=");o[l]=u}return{url:r,parameters:o}}_getWMSUrl(e,r,i){let n=this.url,o=!0,a={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...i},l=["transparent","time","elevation"];for(let[u,f]of Object.entries(a))(!l.includes(u)||f)&&(n+=o?"?":"&",o=!1,n+=this._getURLParameter(u,f,r));return encodeURI(n)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,i){switch(e){case"crs":i.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":i.version==="1.3.0"&&(e="crs");break;case"bbox":let n=this._flipBoundingBox(r,i);n&&(r=n);break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let i=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),n=e;return i?[n[1],n[0],n[3],n[2]]:n}async _fetchArrayBuffer(e){let r=await this.fetch(e),i=await r.arrayBuffer();return this._checkResponse(r,i),i}_checkResponse(e,r){let i=e.headers["content-type"];if(!e.ok||Dx.mimeTypes.includes(i)){let n=hy(this.loadOptions,{wms:{throwOnError:!0}}),o=Dx.parseSync?.(r,n);throw new Error(o)}}_parseError(e){let r=Dx.parseSync?.(e,this.loadOptions);return new Error(r)}};var F0=class extends wu{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),i=this.getURLFromTemplate(r),o=await(await this.fetch(i)).arrayBuffer();return await df.parse(o)}getGranularParameters(e){let[[r,i],[n,o]]=e.boundingBox;return{...e,east:r,north:i,south:o,west:n}}getURLFromTemplate(e){let r=this.props.url;for(let[i,n]of Object.entries(e))r=r.replace(`\${${i}}`,String(n)),r=r.replace(`{${i}}`,String(n));return r}};F0.type="template";F0.testURL=t=>t.toLowerCase().includes("{");var sR=class extends F0{constructor(e){super(e),this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,i=`size=${e.width},${e.height}`,n={...e,bbox:r,size:i};return delete n.width,delete n.height,this.getUrl("exportImage",n)}getUrl(e,r,i){let n=`${this.props.url}/${e}`,o=!0;for(let[a,l]of Object.entries(r))n+=o?"?":"&",o=!1,Array.isArray(l)?n+=`${a.toUpperCase()}=${l.join(",")}`:n+=`${a.toUpperCase()}=${l?String(l):""}`;return n}async checkResponse(e){if(!e.ok)throw new Error("error")}},OV={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new sR(t)};var the=[BV,OV];function aR(t){return RV(t,the)}var DV=6378137*Math.PI;function lR(t){let e=Ka(t);return e[0]=(e[0]/256-1)*DV,e[1]=(e[1]/256-1)*DV,e}var rhe={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(t,e)=>console.error(e,t)}},LT=class extends As{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:e,props:r,oldProps:i}){let{viewport:n}=this.context;e.dataChanged||r.serviceType!==i.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(n,"image source changed"),0)):Ws(r.layers,i.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(n,"viewport changed")):this.debounce(()=>this.loadImage(n,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:e,image:r,lastRequestParameters:i}=this.state;return r&&new ZA({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:i.srs==="EPSG:4326"?ni.LNGLAT:ni.CARTESIAN,bounds:e,image:r})}async getFeatureInfoText(e,r){let{lastRequestParameters:i}=this.state;return i?await this.state.imageSource.getFeatureInfoText?.({...i,query_layers:i.layers,x:e,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof wu)return e.data;if(typeof e.data=="string")return aR({url:e.data,loadOptions:e.loadOptions,type:e.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:e}=this.state;try{this.state.loadCounter++;let r=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(e,r){let{layers:i,serviceType:n}=this.props;if(n==="wms"&&i.length===0)return;let o=e.getBounds(),{width:a,height:l}=e,u=this.getRequestId(),{srs:f}=this.props;f==="auto"&&(f=e.resolution?"EPSG:4326":"EPSG:3857");let _={width:a,height:l,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:i,crs:f};if(f==="EPSG:3857"){let w=lR([o[0],o[1]]),E=lR([o[2],o[3]]);_.boundingBox=[w,E]}try{this.state.loadCounter++,this.props.onImageLoadStart(u);let w=await this.state.imageSource.getImage(_);this.state.lastRequestId<u&&(this.getCurrentLayer()?.props.onImageLoad(u),this.setState({image:w,bounds:o,lastRequestParameters:_,lastRequestId:u}))}catch(w){this.raiseError(w,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(u,w)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),r)}},DT=LT;(()=>{LT.layerName="WMSLayer"})(),(()=>{LT.defaultProps=rhe})();var ihe={getHeight:{type:"accessor",value:0},greatCircle:!0},FT=class extends KA{},Nx=FT;(()=>{FT.layerName="GreatCircleLayer"})(),(()=>{FT.defaultProps=ihe})();var nhe={...Th.defaultProps},NT=class extends As{indexToBounds(){return null}renderLayers(){let{elevationScale:e,extruded:r,wireframe:i,filled:n,stroked:o,lineWidthUnits:a,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:f,lineJointRounded:_,lineMiterLimit:w,lineDashJustified:E,getElevation:M,getFillColor:D,getLineColor:j,getLineWidth:V}=this.props,{updateTriggers:$,material:te,transitions:ne}=this.props,le=this.getSubLayerClass("cell",Th),{updateTriggers:z,...ke}=this.indexToBounds()||{};return new le({filled:n,wireframe:i,extruded:r,elevationScale:e,stroked:o,lineWidthUnits:a,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:f,lineJointRounded:_,lineMiterLimit:w,lineDashJustified:E,material:te,transitions:ne,getElevation:M,getFillColor:D,getLineColor:j,getLineWidth:V},this.getSubLayerProps({id:"cell",updateTriggers:$&&{...z,getElevation:$.getElevation,getFillColor:$.getFillColor,getLineColor:$.getLineColor,getLineWidth:$.getLineWidth}}),ke)}},tu=NT;(()=>{NT.layerName="GeoCellLayer"})(),(()=>{NT.defaultProps=nhe})();var kT=sc(cR(),1),ohe=3,she=30,ahe=2*she+1,FV=180/Math.PI;function kV(t,e,r){let i=1<<e;return[(t[0]+r[0])/i,(t[1]+r[1])/i]}function NV(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function UV(t){return[NV(t[0]),NV(t[1])]}function zV(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function VV([t,e,r]){let i=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*FV,i*FV]}function HV(t){let e=kT.default.fromString(t,!0,10).toString(2);for(;e.length<ohe+ahe;)e="0"+e;let r=e.lastIndexOf("1"),i=e.substring(0,3),n=e.substring(3,r),o=n.length/2,a=kT.default.fromString(i,!0,2).toString(10),l=kT.default.fromString(n,!0,2).toString(4);for(;l.length<o;)l="0"+l;return`${a}/${l}`}function lhe(t,e,r,i){if(i===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function jV(t){let e=t.split("/"),r=parseInt(e[0],10),i=e[1],n=i.length,o=[0,0],a;for(let l=n-1;l>=0;l--){a=n-l;let u=i[l],f=0,_=0;u==="1"?_=1:u==="2"?(f=1,_=1):u==="3"&&(f=1);let w=Math.pow(2,a-1);lhe(w,o,f,_),o[0]+=w*f,o[1]+=w*_}if(r%2===1){let l=o[0];o[0]=o[1],o[1]=l}return{face:r,ij:o,level:a}}var GV=sc(cR(),1);function che(t){let e=t.padEnd(16,"0");return GV.default.fromString(e,16)}var uhe=100;function hhe({face:t,ij:e,level:r}){let i=[[0,0],[0,1],[1,1],[1,0],[0,0]],n=Math.max(1,Math.ceil(uhe*Math.pow(2,-r))),o=new Float64Array(4*n*2+2),a=0,l=0;for(let u=0;u<4;u++){let f=i[u].slice(0),_=i[u+1],w=(_[0]-f[0])/n,E=(_[1]-f[1])/n;for(let M=0;M<n;M++){f[0]+=w,f[1]+=E;let D=kV(e,r,f),j=UV(D),V=zV(t,j),$=VV(V);Math.abs($[1])>89.999&&($[0]=l);let te=$[0]-l;$[0]+=te>180?-360:te<-180?360:0,o[a++]=$[0],o[a++]=$[1],l=$[0]}}return o[a++]=o[0],o[a++]=o[1],o}function fhe(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=che(t)}return HV(t.toString())}function WV(t){let e=fhe(t),r=jV(e);return hhe(r)}var dhe={getS2Token:{type:"accessor",value:t=>t.token}},UT=class extends tu{indexToBounds(){let{data:e,getS2Token:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>WV(r(i,n))}}},Ux=UT;(()=>{UT.layerName="S2Layer"})(),(()=>{UT.defaultProps=dhe})();var uR=512;function phe(t,e){let r=0,i=0,n=1<<t.length,o=n/uR;for(let a=0;a<t.length;a++){n>>=1;let l=parseInt(t[a]);l%2&&(r|=n),l>1&&(i|=n)}return[[r/o,uR-i/o],[(r+e)/o,uR-(i+e)/o]]}function qV(t,e=1){let[r,i]=phe(t,e),[n,o]=Ol(r),[a,l]=Ol(i);return[a,o,a,l,n,l,n,o,a,o]}var Ahe={getQuadkey:{type:"accessor",value:t=>t.quadkey}},zT=class extends tu{indexToBounds(){let{data:e,extruded:r,getQuadkey:i}=this.props,n=r?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(o,a)=>qV(i(o,a),n),updateTriggers:{getPolygon:n}}}},zx=zT;(()=>{zT.layerName="QuadkeyLayer"})(),(()=>{zT.defaultProps=Ahe})();var fm=class{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:i,onError:n}){let{index:o,id:a,bbox:l,userData:u,zoom:f}=this,_=this._loaderId;this._abortController=new AbortController;let{signal:w}=this._abortController,E=await r.scheduleRequest(this,j=>j.isSelected?1:-1);if(!E){this._isCancelled=!0;return}if(this._isCancelled){E.done();return}let M=null,D;try{M=await e({index:o,id:a,bbox:l,userData:u,zoom:f,signal:w})}catch(j){D=j||!0}finally{E.done()}if(_===this._loaderId){if(this._loader=void 0,this.content=M,this._isCancelled&&!M){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,D?n(D,this):i(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var _a={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var XV=new ht,mhe=new ht,Cp=class{constructor(e=[0,0,0],r=[0,0,0],i){$i(this,"center",void 0),$i(this,"halfDiagonal",void 0),$i(this,"minimum",void 0),$i(this,"maximum",void 0),i=i||XV.copy(e).add(r).scale(.5),this.center=new ht(i),this.halfDiagonal=new ht(r).subtract(this.center),this.minimum=new ht(e),this.maximum=new ht(r)}clone(){return new Cp(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,i=mhe.from(e.normal),n=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),o=this.center.dot(i)+e.distance;return o-n>0?_a.INSIDE:o+n<0?_a.OUTSIDE:_a.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=XV.from(e).subtract(this.center),{halfDiagonal:i}=this,n=0,o;return o=Math.abs(r.x)-i.x,o>0&&(n+=o*o),o=Math.abs(r.y)-i.y,o>0&&(n+=o*o),o=Math.abs(r.z)-i.z,o>0&&(n+=o*o),n}};var Vx=new ht,YV=new ht,Uu=class{constructor(e=[0,0,0],r=0){$i(this,"center",void 0),$i(this,"radius",void 0),this.radius=-0,this.center=new ht,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=Vx.from(r),this.center=new ht().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Uu(this.center,this.radius)}union(e){let r=this.center,i=this.radius,n=e.center,o=e.radius,a=Vx.copy(n).subtract(r),l=a.magnitude();if(i>=l+o)return this.clone();if(o>=l+i)return e.clone();let u=(i+l+o)*.5;return YV.copy(a).scale((-i+u)/l).add(r),this.center.copy(YV),this.radius=u,this}expand(e){let i=Vx.from(e).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(e){this.center.transform(e);let r=ga.getScaling(Vx,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let i=Vx.from(e).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(e){let r=this.center,i=this.radius,o=e.normal.dot(r)+e.distance;return o<-i?_a.OUTSIDE:o<i?_a.INTERSECTING:_a.INSIDE}};var ghe=new ht,_he=new ht,VT=new ht,HT=new ht,jT=new ht,yhe=new ht,vhe=new ht,wd={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Sh=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){$i(this,"center",void 0),$i(this,"halfAxes",void 0),this.center=new ht().from(e),this.halfAxes=new Io(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new ht(e).len(),new ht(r).len(),new ht(i).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),n=new ht(e).normalize(),o=new ht(r).normalize(),a=new ht(i).normalize();return new Bu().fromMatrix3(new Io([...n,...o,...a]))}fromCenterHalfSizeQuaternion(e,r,i){let n=new Bu(i),o=new Io().fromQuaternion(n);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new ht().from(e),this.halfAxes=o,this}clone(){return new Sh(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Uu){let r=this.halfAxes,i=r.getColumn(0,VT),n=r.getColumn(1,HT),o=r.getColumn(2,jT),a=ghe.copy(i).add(n).add(o);return e.center.copy(this.center),e.radius=a.magnitude(),e}intersectPlane(e){let r=this.center,i=e.normal,n=this.halfAxes,o=i.x,a=i.y,l=i.z,u=Math.abs(o*n[wd.COLUMN0ROW0]+a*n[wd.COLUMN0ROW1]+l*n[wd.COLUMN0ROW2])+Math.abs(o*n[wd.COLUMN1ROW0]+a*n[wd.COLUMN1ROW1]+l*n[wd.COLUMN1ROW2])+Math.abs(o*n[wd.COLUMN2ROW0]+a*n[wd.COLUMN2ROW1]+l*n[wd.COLUMN2ROW2]),f=i.dot(r)+e.distance;return f<=-u?_a.OUTSIDE:f>=u?_a.INSIDE:_a.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=_he.from(e).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,VT),o=i.getColumn(1,HT),a=i.getColumn(2,jT),l=n.magnitude(),u=o.magnitude(),f=a.magnitude();n.normalize(),o.normalize(),a.normalize();let _=0,w;return w=Math.abs(r.dot(n))-l,w>0&&(_+=w*w),w=Math.abs(r.dot(o))-u,w>0&&(_+=w*w),w=Math.abs(r.dot(a))-f,w>0&&(_+=w*w),_}computePlaneDistances(e,r,i=[-0,-0]){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=this.center,l=this.halfAxes,u=l.getColumn(0,VT),f=l.getColumn(1,HT),_=l.getColumn(2,jT),w=yhe.copy(u).add(f).add(_).add(a),E=vhe.copy(w).subtract(e),M=r.dot(E);return n=Math.min(M,n),o=Math.max(M,o),w.copy(a).add(u).add(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),w.copy(a).add(u).subtract(f).add(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),w.copy(a).add(u).subtract(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).add(f).add(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).add(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).subtract(f).add(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).subtract(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),i[0]=n,i[1]=o,i}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,VT);r.transformAsPoint(e);let i=this.halfAxes.getColumn(1,HT);i.transformAsPoint(e);let n=this.halfAxes.getColumn(2,jT);return n.transformAsPoint(e),this.halfAxes=new Io([...r,...i,...n]),this}getTransform(){throw new Error("not implemented")}};var KV=new ht,ZV=new ht,pl=class{constructor(e=[0,0,1],r=0){$i(this,"normal",void 0),$i(this,"distance",void 0),this.normal=new ht,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return hl(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=KV.from(e),this.normal.from(r).normalize();let i=-this.normal.dot(e);return this.distance=i,this}fromCoefficients(e,r,i,n){return this.normal.set(e,r,i),hl(Ns(this.normal.len(),1)),this.distance=n,this}clone(){return new pl(this.normal,this.distance)}equals(e){return Ns(this.distance,e.distance)&&Ns(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=ZV.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,r)}projectPointOntoPlane(e,r=[0,0,0]){let i=KV.from(e),n=this.getPointDistance(i),o=ZV.copy(this.normal).scale(n);return i.subtract(o).to(r)}};var JV=[new ht([1,0,0]),new ht([0,1,0]),new ht([0,0,1])],QV=new ht,xhe=new ht,Ra=class{constructor(e=[]){$i(this,"planes",void 0),this.planes=e}fromBoundingSphere(e){this.planes.length=2*JV.length;let r=e.center,i=e.radius,n=0;for(let o of JV){let a=this.planes[n],l=this.planes[n+1];a||(a=this.planes[n]=new pl),l||(l=this.planes[n+1]=new pl);let u=QV.copy(o).scale(-i).add(r);a.fromPointNormal(u,o);let f=QV.copy(o).scale(i).add(r),_=xhe.copy(o).negate();l.fromPointNormal(f,_),n+=2}return this}computeVisibility(e){let r=_a.INSIDE;for(let i of this.planes)switch(e.intersectPlane(i)){case _a.OUTSIDE:return _a.OUTSIDE;case _a.INTERSECTING:r=_a.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(hl(Number.isFinite(r),"parentPlaneMask is required."),r===Ra.MASK_OUTSIDE||r===Ra.MASK_INSIDE)return r;let i=Ra.MASK_INSIDE,n=this.planes;for(let o=0;o<this.planes.length;++o){let a=o<31?1<<o:0;if(o<31&&!(r&a))continue;let l=n[o],u=e.intersectPlane(l);if(u===_a.OUTSIDE)return Ra.MASK_OUTSIDE;u===_a.INTERSECTING&&(i|=a)}return i}};$i(Ra,"MASK_OUTSIDE",4294967295);$i(Ra,"MASK_INSIDE",0);$i(Ra,"MASK_INDETERMINATE",2147483647);var DYe=new ht,LYe=new ht,FYe=new ht,NYe=new ht,kYe=new ht;var WYe=new ht,qYe=new ht,XYe=new ht,YYe=new ht,KYe=new ht,ZYe=new ht,JYe=new ht,QYe=new ht,$Ye=new ht,eKe=new ht,tKe=new ht,rKe=new ht;var bf=new Io,whe=new Io,The=new Io,GT=new Io,$V=new Io;function dR(t,e={}){let r=hh.EPSILON20,i=10,n=0,o=0,a=whe,l=The;a.identity(),l.copy(t);let u=r*Ehe(l);for(;o<i&&She(l)>u;)Che(l,GT),$V.copy(GT).transpose(),l.multiplyRight(GT),l.multiplyLeft($V),a.multiplyRight(GT),++n>2&&(++o,n=0);return e.unitary=a.toTarget(e.unitary),e.diagonal=l.toTarget(e.diagonal),e}function Ehe(t){let e=0;for(let r=0;r<9;++r){let i=t[r];e+=i*i}return Math.sqrt(e)}var hR=[1,0,0],fR=[2,2,1];function She(t){let e=0;for(let r=0;r<3;++r){let i=t[bf.getElementIndex(fR[r],hR[r])];e+=2*i*i}return Math.sqrt(e)}function Che(t,e){let r=hh.EPSILON15,i=0,n=1;for(let f=0;f<3;++f){let _=Math.abs(t[bf.getElementIndex(fR[f],hR[f])]);_>i&&(n=f,i=_)}let o=hR[n],a=fR[n],l=1,u=0;if(Math.abs(t[bf.getElementIndex(a,o)])>r){let f=t[bf.getElementIndex(a,a)],_=t[bf.getElementIndex(o,o)],w=t[bf.getElementIndex(a,o)],E=(f-_)/2/w,M;E<0?M=-1/(-E+Math.sqrt(1+E*E)):M=1/(E+Math.sqrt(1+E*E)),l=1/Math.sqrt(1+M*M),u=M*l}return Io.IDENTITY.to(e),e[bf.getElementIndex(o,o)]=e[bf.getElementIndex(a,a)]=l,e[bf.getElementIndex(a,o)]=u,e[bf.getElementIndex(o,a)]=-u,e}var Mp=new ht,Mhe=new ht,Ihe=new ht,Phe=new ht,Rhe=new ht,Bhe=new Io,Ohe={diagonal:new Io,unitary:new Io};function Hx(t,e=new Sh){if(!t||t.length===0)return e.halfAxes=new Io([0,0,0,0,0,0,0,0,0]),e.center=new ht,e;let r=t.length,i=new ht(0,0,0);for(let O of t)i.add(O);let n=1/r;i.multiplyByScalar(n);let o=0,a=0,l=0,u=0,f=0,_=0;for(let O of t){let I=Mp.copy(O).subtract(i);o+=I.x*I.x,a+=I.x*I.y,l+=I.x*I.z,u+=I.y*I.y,f+=I.y*I.z,_+=I.z*I.z}o*=n,a*=n,l*=n,u*=n,f*=n,_*=n;let w=Bhe;w[0]=o,w[1]=a,w[2]=l,w[3]=a,w[4]=u,w[5]=f,w[6]=l,w[7]=f,w[8]=_;let{unitary:E}=dR(w,Ohe),M=e.halfAxes.copy(E),D=M.getColumn(0,Ihe),j=M.getColumn(1,Phe),V=M.getColumn(2,Rhe),$=-Number.MAX_VALUE,te=-Number.MAX_VALUE,ne=-Number.MAX_VALUE,le=Number.MAX_VALUE,z=Number.MAX_VALUE,ke=Number.MAX_VALUE;for(let O of t)Mp.copy(O),$=Math.max(Mp.dot(D),$),te=Math.max(Mp.dot(j),te),ne=Math.max(Mp.dot(V),ne),le=Math.min(Mp.dot(D),le),z=Math.min(Mp.dot(j),z),ke=Math.min(Mp.dot(V),ke);D=D.multiplyByScalar(.5*(le+$)),j=j.multiplyByScalar(.5*(z+te)),V=V.multiplyByScalar(.5*(ke+ne)),e.center.copy(D).add(j).add(V);let Y=Mhe.set($-le,te-z,ne-ke).multiplyByScalar(.5),X=new Io([Y[0],0,0,0,Y[1],0,0,0,Y[2]]);return e.halfAxes.multiplyRight(X),e}var N0=512,e9=3,t9=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],r9=t9.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Dhe=r9.concat([[.25,.5],[.75,.5]]),Ip=class{constructor(e,r,i){this.x=e,this.y=r,this.z=i}get children(){if(!this._children){let e=this.x*2,r=this.y*2,i=this.z+1;this._children=[new Ip(e,r,i),new Ip(e,r+1,i),new Ip(e+1,r,i),new Ip(e+1,r+1,i)]}return this._children}update(e){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:o,maxZ:a,bounds:l,offset:u,project:f}=e,_=this.getBoundingVolume(n,u,f);if(l&&!this.insideBounds(l)||i.computeVisibility(_)<0)return!1;if(!this.childVisible){let{z:E}=this;if(E<a&&E>=o){let M=_.distanceTo(r.cameraPosition)*r.scale/r.height;E+=Math.floor(Math.log2(M))}if(E>=a)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let E of this.children)E.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,i,n]){let o=Math.pow(2,this.z),a=N0/o;return this.x*a<i&&this.y*a<n&&(this.x+1)*a>e&&(this.y+1)*a>r}getBoundingVolume(e,r,i){if(i){let u=this.z<1?Dhe:this.z<2?r9:t9,f=[];for(let _ of u){let w=WT(this.x+_[0],this.y+_[1],this.z);w[2]=e[0],f.push(i(w)),e[0]!==e[1]&&(w[2]=e[1],f.push(i(w)))}return Hx(f)}let n=Math.pow(2,this.z),o=N0/n,a=this.x*o+r*N0,l=N0-(this.y+1)*o;return new Cp([a,l,e[0]],[a+o,l+o,e[1]])}};function i9(t,e,r,i){let n=t instanceof md&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map(({normal:M,distance:D})=>new pl(M.clone().negate(),D)),a=new Ra(o),l=t.distanceScales.unitsPerMeter[2],u=r&&r[0]*l||0,f=r&&r[1]*l||0,_=t instanceof Ic&&t.pitch<=60?e:0;if(i){let[M,D,j,V]=i,$=Ka([M,V]),te=Ka([j,D]);i=[$[0],N0-$[1],te[0],N0-te[1]]}let w=new Ip(0,0,0),E={viewport:t,project:n,cullingVolume:a,elevationBounds:[u,f],minZ:_,maxZ:e,bounds:i,offset:0};if(w.update(E),t instanceof Ic&&t.subViewports&&t.subViewports.length>1){for(E.offset=-1;w.update(E)&&!(--E.offset<-e9););for(E.offset=1;w.update(E)&&!(++E.offset>e9););}return w.getSelected()}var Td=512,Lhe=[-1/0,-1/0,1/0,1/0],Pp={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}};function o9(t,e){let r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...r.map(n=>n[0])),Math.min(...r.map(n=>n[1])),Math.max(...r.map(n=>n[0])),Math.max(...r.map(n=>n[1]))]}function Fhe(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function wf(t,e){if(!t||!t.length)return null;let{index:r,id:i}=e;if(Array.isArray(t)){let o=Fhe(i)%t.length;t=t[o]}let n=t;for(let o of Object.keys(r)){let a=new RegExp(`{${o}}`,"g");n=n.replace(a,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(n=n.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),n}function Nhe(t,e,r){let i;if(e&&e.length===2){let[n,o]=e,a=t.getBounds({z:n}),l=t.getBounds({z:o});i=[Math.min(a[0],l[0]),Math.min(a[1],l[1]),Math.max(a[2],l[2]),Math.max(a[3],l[3])]}else i=t.getBounds();return t.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function s9({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(n=>pR(n,e||0,r))}function pR(t,e,r){if(!Array.isArray(e)){let o=r.x-t.x,a=r.y-t.y,{width:l,height:u}=r,f={targetZ:e},_=t.unproject([o,a],f),w=t.unproject([o+l,a],f),E=t.unproject([o,a+u],f),M=t.unproject([o+l,a+u],f);return[Math.min(_[0],w[0],E[0],M[0]),Math.min(_[1],w[1],E[1],M[1]),Math.max(_[0],w[0],E[0],M[0]),Math.max(_[1],w[1],E[1],M[1])]}let i=pR(t,e[0],r),n=pR(t,e[1],r);return[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[2],n[2]),Math.max(i[3],n[3])]}function khe(t,e,r){return r?o9(t,r).map(n=>n*e/Td):t.map(i=>i*e/Td)}function AR(t,e){return Math.pow(2,t)*Td/e}function WT(t,e,r){let i=AR(r,Td),n=t/i*360-180,o=Math.PI-2*Math.PI*e/i,a=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[n,a]}function n9(t,e,r,i){let n=AR(r,i);return[t/n*Td,e/n*Td]}function mR(t,e,r,i,n=Td){if(t.isGeospatial){let[f,_]=WT(e,r,i),[w,E]=WT(e+1,r+1,i);return{west:f,north:_,east:w,south:E}}let[o,a]=n9(e,r,i,n),[l,u]=n9(e+1,r+1,i,n);return{left:o,top:a,right:l,bottom:u}}function Uhe(t,e,r,i,n){let o=Nhe(t,null,i),a=AR(e,r),[l,u,f,_]=khe(o,a,n),w=[];for(let E=Math.floor(l);E<f;E++)for(let M=Math.floor(u);M<_;M++)w.push({x:E,y:M,z:e});return w}function gR({viewport:t,maxZoom:e,minZoom:r,zRange:i,extent:n,tileSize:o=Td,modelMatrix:a,modelMatrixInverse:l,zoomOffset:u=0}){let f=t.isGeospatial?Math.round(t.zoom+Math.log2(Td/o))+u:Math.ceil(t.zoom)+u;if(typeof r=="number"&&Number.isFinite(r)&&f<r){if(!n)return[];f=r}typeof e=="number"&&Number.isFinite(e)&&f>e&&(f=e);let _=n;return a&&l&&n&&!t.isGeospatial&&(_=o9(n,a)),t.isGeospatial?i9(t,f,i,n):Uhe(t,f,o,_||Lhe,l)}function _R(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function yR(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function a9(t){let e={},r;return i=>{for(let n in i)if(!zhe(i[n],e[n])){r=t(i),e=i;break}return r}}function zhe(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}return!1}var l9=1,qT=2,Vhe="never",Hhe="no-overlap",jx="best-available",jhe=5,Ghe={[jx]:qhe,[Hhe]:Xhe,[Vhe]:()=>{}},Whe={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},dm=class{constructor(e){this._getCullBounds=a9(s9),this.opts={...Whe,...e},this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new Xd({maxRequests:e.maxRequests,throttleRequests:Boolean(e.maxRequests&&e.maxRequests>0)}),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 ii,this._modelMatrixInverse=new ii,this.setOptions(e)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:i}={zRange:null,modelMatrix:null}){let n=i?new ii(i):new ii,o=!n.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!Ns(this._zRange,r)||o){o&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=e,this._zRange=r;let l=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(u=>this._getTile(u,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(l=>this._getTile(l.index,!0)));let a=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),a&&this._frameNumber++,this._frameNumber}isTileVisible(e,r){if(!e.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:n}=e;for(let[o,a,l,u]of i){let f;if("west"in n)f=n.west<l&&n.east>o&&n.south<u&&n.north>a;else{let _=Math.min(n.top,n.bottom),w=Math.max(n.top,n.bottom);f=n.left<l&&n.right>o&&_<u&&w>a}if(f)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:i,zRange:n,modelMatrix:o,modelMatrixInverse:a}){let{tileSize:l,extent:u,zoomOffset:f}=this.opts;return gR({viewport:e,maxZoom:r,minZoom:i,zRange:n,tileSize:l,extent:u,modelMatrix:o,modelMatrixInverse:a,zoomOffset:f})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:mR(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),i=Math.floor(e.y/2),n=e.z-1;return{x:r,y:i,z:n}}updateTileStates(){let e=this.opts.refinementStrategy||jx,r=new Array(this._cache.size),i=0;for(let n of this._cache.values())r[i++]=n.isVisible,n.isSelected=!1,n.isVisible=!1;for(let n of this._selectedTiles)n.isSelected=!0,n.isVisible=!0;(typeof e=="function"?e:Ghe[e])(Array.from(this._cache.values())),i=0;for(let n of this._cache.values())if(r[i++]!==n.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,r=[],i=0;for(let n of this._cache.values())n.isLoading&&(i++,!n.isSelected&&!n.isVisible&&r.push(n));for(;e>0&&i>e&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let i=this._getNearestAncestor(r);r.parent=i,i?.children&&i.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:jhe*this.selectedTiles.length),n=r.maxCacheByteSize||1/0;if(e.size>i||this._cacheByteSize>n){for(let[a,l]of e)if(!l.isVisible&&!l.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?l.byteLength:0,e.delete(a),this.opts.onTileUnload?.(l)),e.size<=i&&this._cacheByteSize<=n)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((a,l)=>a.zoom-l.zoom),this._dirty=!1)}_getTile(e,r){let i=this.getTileId(e),n=this._cache.get(i),o=!1;return!n&&r?(n=new fm(e),Object.assign(n,this.getTileMetadata(n.index)),Object.assign(n,{id:i,zoom:this.getTileZoom(n.index)}),o=!0,this._cache.set(i,n),this._dirty=!0):n&&n.needsReload&&(o=!0),n&&o&&n.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),n}_getNearestAncestor(e){let{_minZoom:r=0}=this,i=e.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let n=this._getTile(i);if(n)return n}return null}};function qhe(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!c9(e)&&vR(e);for(let e of t)e.isVisible=Boolean(e.state&qT)}function Xhe(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&c9(r);let e=Array.from(t).sort((r,i)=>r.zoom-i.zoom);for(let r of e)if(r.isVisible=Boolean(r.state&qT),r.children&&(r.isVisible||r.state&l9))for(let i of r.children)i.state=l9;else r.isSelected&&vR(r)}function c9(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=qT,!0;e=e.parent}return!1}function vR(t){for(let e of t.children)e.isLoaded||e.content?e.state|=qT:vR(e)}var Yhe={TilesetClass:dm,data:{type:"data",value:[]},dataComparator:Pp.equal,renderSubLayers:{type:"function",value:t=>new xf(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:jx,zRange:null,maxRequests:6,zoomOffset:0},XT=class extends As{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,i=e.propsOrDataChanged||e.updateTriggersChanged,n=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:o,maxZoom:a,minZoom:l,maxRequests:u,zoomOffset:f}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:a,minZoom:l,tileSize:e,refinementStrategy:n,extent:o,maxRequests:u,zoomOffset:f,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:i}=this.props,n=e.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:o}=e,a=this.state.isLoaded!==o,l=this.state.frameNumber!==n;o&&(a||l)&&this._onViewportLoad(),l&&this.setState({frameNumber:n}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:i,fetch:n}=this.props,{signal:o}=e;return e.url=typeof r=="string"||Array.isArray(r)?wf(r,e):null,i?i(e):n&&e.url?n(e.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo({info:e,sourceLayer:r}){let i=r.props.tile;return e.picked&&(e.tile=i),e.sourceTile=i,e}_updateAutoHighlight(e){let r=e.sourceTile;if(r&&r.layers)for(let i of r.layers)i.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(i=>e.layers[0].props[i]!==r[i])&&(e.layers=e.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=yf(i,Boolean).map(n=>n.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:i}=e.props;return this.state.tileset.isTileVisible(i,r)}},Tf=XT;(()=>{XT.defaultProps=Yhe})(),(()=>{XT.layerName="TileLayer"})();var Khe={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:t=>t.timestamps}},YT=class extends bh{getShaders(){let e=super.getShaders();return e.inject={"vs:#decl":`uniform float trailLength;
|
|
3307
|
+
`;var wce=2,G3={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},X8=[0,0],Tce={SUM:0,MEAN:1},Ece={getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ku,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}},Sce=["float32-renderable-webgl","texture-blend-float-webgl"],Cce={data:{props:["radiusPixels"]}},PT=class extends eu{initializeState(){super.initializeAggregationLayer(Cce),this.setState({colorDomain:X8}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:r,oldProps:i}=e,n=this._getChangeFlags(e);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:o,colorDomain:a}=this.state,{updateTriggers:l,intensity:u,threshold:f,aggregation:_}=this.props,w=this.getSubLayerClass("triangle",Px);return new w(this.getSubLayerProps({id:"triangle-layer",updateTriggers:l}),{coordinateSystem:ni.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:o,aggregationMode:Tce[_]||0,weightsTexture:e,intensity:u,threshold:f,colorDomain:a})}finalizeState(e){super.finalizeState(e);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:o,triPositionBuffer:a,triTexCoordBuffer:l,colorTexture:u,updateTimer:f}=this.state;r?.destroy(),i?.destroy(),n?.destroy(),o?.destroy(),a?.destroy(),l?.destroy(),u?.destroy(),f&&clearTimeout(f)}_getAttributeManager(){return new vh(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",r.viewportChanged=e.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{textureSize:e,format:r}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...G3,width:e,height:e,format:r}),maxWeightsTexture:this.context.device.createTexture({...G3,width:1,height:1,format:r})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,e.limits.maxTextureDimension2D),n=Sce.every(l=>e.features.has(l)),o=n?"rgba32float":"rgba8unorm",a=n?1:1/255;this.setState({textureSize:i,format:o,weightsScale:a}),n||br.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:r}=this.state,{weightsTexture:i}=this.state,n=this.getAttributeManager();r?.destroy(),r=new gf(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:n.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e}),this.setState({weightsTransform:r})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:r,weightsTexture:i,maxWeightsTexture:n}=this.state,o=this.getShaders({vs:H3,fs:j3});this._createWeightsTransform(o);let a=this.getShaders({vs:W8,fs:q8}),l=new gf(e,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:i},uniforms:{textureSize:r},targetTexture:n,...a,vertexCount:r*r,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:i,maxWeightsTexture:n,maxWeightTransform:l,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:H3,fs:j3,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e,textureSize:r}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([r.width,r.height]),r.unproject([0,r.height])].map(l=>l.map(Math.fround)),n=U8(i),o={visibleWorldBounds:n,viewportCorners:i},a=!1;if(e||!this.state.worldBounds||!z8(this.state.worldBounds,n)){let l=this._worldToCommonBounds(n),u=this._commonToWorldBounds(l);this.props.coordinateSystem===ni.LNGLAT&&(u[1]=Math.max(u[1],-85.051129),u[3]=Math.min(u[3],85.051129),u[0]=Math.max(u[0],-360),u[2]=Math.min(u[2],360));let f=this._worldToCommonBounds(u);o.worldBounds=u,o.normalizedCommonBounds=f,a=!0}return this.setState(o),a}_updateTextureRenderingBounds(){let{triPositionBuffer:e,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:n}=this.state,{viewport:o}=this.context;e.write(z3(n,3));let a=n.map(l=>H8(o.projectPosition(l),i));r.write(z3(a,2))}_updateColorTexture(e){let{colorRange:r}=e.props,{colorTexture:i}=this.state,n=wp(r,!1,Uint8Array);i&&i?.width===r.length?i.setSubImageData({data:n}):(i?.destroy(),i=this.context.device.createTexture({...G3,data:n,width:r.length,height:1})),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:e,colorDomain:r,aggregation:i}=this.props,{worldBounds:n,textureSize:o,weightsScale:a}=this.state,l=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let u=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i==="SUM"){let{viewport:j}=this.context,V=j.distanceScales.metersPerUnit[2]*(u[2]-u[0])/o;this.state.colorDomain=r.map($=>$*V*a)}else this.state.colorDomain=r||X8;let _=this.getAttributeManager().getAttributes(),w=this.getModuleSettings(),E=_.positions.buffer,M={radiusPixels:e,commonBounds:u,textureWidth:o,weightsScale:a},D=_.weights.buffer;l.model.setAttributes({positions:E,weights:D}),l.model.setVertexCount(this.getNumInstances()),l.model.setUniforms(M),l.model.updateModuleSettings(w),l.run({parameters:{viewport:[0,0,o,o]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;e?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(e,r={}){let{useLayerCoordinateSystem:i=!1}=r,[n,o,a,l]=e,{viewport:u}=this.context,{textureSize:f}=this.state,{coordinateSystem:_}=this.props,w=i&&(_===ni.LNGLAT_OFFSETS||_===ni.METER_OFFSETS),E=w?u.projectPosition(this.props.coordinateOrigin):[0,0],M=f*wce/u.scale,D,j;return i&&!w?(D=this.projectPosition([n,o,0]),j=this.projectPosition([a,l,0])):(D=u.projectPosition([n,o,0]),j=u.projectPosition([a,l,0])),V8([D[0]-E[0],D[1]-E[1],j[0]-E[0],j[1]-E[1]],M,M)}_commonToWorldBounds(e){let[r,i,n,o]=e,{viewport:a}=this.context,l=a.unprojectPosition([r,i]),u=a.unprojectPosition([n,o]);return l.slice(0,2).concat(u.slice(0,2))}},Rx=PT;(()=>{PT.layerName="HeatmapLayer"})(),(()=>{PT.defaultProps=Ece})();function Mce(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function RT(t){if(Array.isArray(t))return t.map(e=>RT(e));if(t&&typeof t=="object"){let e={};for(let[r,i]of Object.entries(t))e[Mce(r)]=RT(i);return e}return t}var EV=sc(TV(),1);function eR(t,e){if(e?._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(n,o,a,l)=>Boolean(e?.arrayPaths?.some(f=>o===f)),...e?._fastXML},i=Nue(t,r);return e?.uncapitalizeKeys?RT(i):i}function Nue(t,e){return new EV.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var kue="4.2.0-alpha.4",Eh={name:"XML",id:"xml",module:"xml",version:kue,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:Uue,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>eR(new TextDecoder().decode(t),{...Eh.options.xml,...e?.xml}),parseTextSync:(t,e)=>eR(t,{...Eh.options.xml,...e?.xml})};function Uue(t){return t.startsWith("<?xml")}function SV(t,e){let r=Eh.parseTextSync?.(t,e),i=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof i=="string"?i:i.value||i.code||"Unknown error"}var zue="4.2.0-alpha.4",Dx={id:"wms-error",name:"WMS Error",module:"wms",version:zue,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:Vue,options:{wms:{throwOnError:!1}},parse:async(t,e)=>tR(new TextDecoder().decode(t),e),parseSync:(t,e)=>tR(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>tR(t,e)};function Vue(t){return t.startsWith("<?xml")}function tR(t,e){let r={...Dx.options.wms,...e?.wms},i=SV(t,r),n=r.minimalErrors?i:`WMS Service error: ${i}`;if(r.throwOnError)throw new Error(n);return n}function um(t){return Array.isArray(t)?t:t?[t]:[]}function Lx(t){let e=um(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function Fx(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function OT(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function hm(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function rR(t,e){let r=Eh.parseTextSync?.(t,e),i=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,n=Hue(i);if(e?.inheritedLayerProps)for(let o of n.layers)MV(o,null);return e?.includeRawJSON&&(n.json=i),e?.includeXMLText&&(n.xml=t),n}function Hue(t){let e={version:String(t.version||""),name:String(t.Service?.Name||"unnamed"),title:t.Service?.Title?String(t.Service?.Title):void 0,abstract:t.Service?.Abstract?String(t.Service?.Abstract):void 0,keywords:Lx(t.Service?.KeywordList?.Keyword),fees:t.Service?.Fees?JSON.stringify(t.Service?.Fees):void 0,accessConstraints:t.Service?.AccessConstraints?JSON.stringify(t.Service?.AccessConstraints):void 0,layerLimit:OT(t.Service?.LayerLimit),maxWidth:OT(t.Service?.maxWidth),maxHeight:OT(t.Service?.maxHeight),layers:[],requests:jue(t.Capability?.Request),exceptions:Gue(t.Exception)},r=um(t.Capability?.Layer);for(let i of r)e.layers.push(CV(i));for(let[i,n]of Object.entries(e))n===void 0&&delete e[i];return e}function jue(t){let e={};for(let[r,i]of Object.entries(t||{})){let n=Lx(i?.Format);e[r]={mimeTypes:n}}return e}function Gue(t){if(um(t?.Format).length>0)return{mimeTypes:Lx(t)}}function CV(t){let e={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:Lx(t.KeywordList?.Keyword)},r=t?.CRS||t?.SRS;r&&Array.isArray(r)&&r.every(f=>typeof f=="string")&&(e.crs=r);let i=t?.EX_GeographicBoundingBox&&Wue(t?.EX_GeographicBoundingBox);i&&(e.geographicBoundingBox=i),i=t?.LatLonBoundingBox&&que(t?.LatLonBoundingBox),i&&(e.geographicBoundingBox=i);let n=t?.BoundingBox&&Xue(t?.BoundingBox);n&&n.length>0&&(e.boundingBoxes=n);let a=um(t?.Dimension).map(f=>Kue(f));a.length&&(e.dimensions=a),t?.opaque&&(e.opaque=hm(t?.opaque)),t?.cascaded&&(e.cascaded=hm(t?.cascaded)),t?.queryable&&(e.queryable=hm(t?.queryable));let l=um(t?.Layer),u=[];for(let f of l)u.push(CV(f));u.length>0&&(e.layers=u);for(let[f,_]of Object.entries(e))_===void 0&&delete e[f];return e}function Wue(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:i,southBoundLatitude:n}=t;return[[e,n],[i,r]]}function que(t){let{minx:e,miny:r,maxx:i,maxy:n}=t;return[[e,r],[i,n]]}function Xue(t){return um(t).map(r=>Yue(r))}function Yue(t){let{CRS:e,SRS:r,minx:i,miny:n,maxx:o,maxy:a,resx:l,resy:u}=t,f={crs:e||r,boundingBox:[[Fx(i),Fx(n)],[Fx(o),Fx(a)]]};return l&&(f.xResolution=l),u&&(f.yResolution=u),f}function Kue(t){let{name:e,units:r,value:i}=t,n={name:e,units:r,extent:i};return t.unitSymbol&&(n.unitSymbol=t.unitSymbol),t.default&&(n.defaultValue=t.default),t.multipleValues&&(n.multipleValues=hm(t.multipleValues)),t.nearestValue&&(n.nearestValue=hm(t.nearestValue)),t.current&&(n.current=hm(t.current)),n}function MV(t,e){e?.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e?.crs&&!t.crs&&(t.crs=[...e.crs]),e?.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e?.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])MV(r,t)}var Zue="4.2.0-alpha.4",L0={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:Zue,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Jue,options:{wms:{}},parse:async(t,e)=>rR(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>rR(t,e?.wms)};function Jue(t){return t.startsWith("<?xml")}function iR(t,e){let i=(Eh.parseTextSync?.(t,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(i)?i:[i]).map(o=>Que(o))}}function Que(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var IV={...L0,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>iR(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>iR(t,e)};function nR(t,e){return Eh.parseTextSync?.(t,e)}var PV={...L0,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>nR(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>nR(t,e)};function RV(t,e){let{type:r="auto"}=t,i=r==="auto"?ehe(t.url,e):$ue(r,e);if(!i)throw new Error("Not a valid image source type");return i.create(t)}function $ue(t,e){for(let r of e)if(r.type===t)return r;return null}function ehe(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var BV={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new oR(t)},oR=class extends wu{constructor(e){super(e),this.capabilities=null,this.url=e.url,this.data=e.url,this.substituteCRS84=e.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:i,...n}=e,o={bbox:r?[...r[0],...r[1]]:i,...n};return await this.getMap(o)}normalizeMetadata(e){return e}async getCapabilities(e,r){let i=this.getCapabilitiesURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);let a=await L0.parse(o,this.loadOptions);return this.capabilities=a,a}async getMap(e,r){let i=this.getMapURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await df.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await IV.parse(o,this.loadOptions)}async getFeatureInfoText(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),new TextDecoder().decode(o)}async describeLayer(e,r){let i=this.describeLayerURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await PV.parse(o,this.loadOptions)}async getLegendGraphic(e,r){let i=this.getLegendGraphicURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await df.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",i,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let i={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",i,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let i={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",i,r)}describeLayerURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",i,r)}getLegendGraphicURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",i,r)}_parseWMSUrl(e){let[r,i]=e.split("?"),n=i.split("&"),o={};for(let a of n){let[l,u]=a.split("=");o[l]=u}return{url:r,parameters:o}}_getWMSUrl(e,r,i){let n=this.url,o=!0,a={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...i},l=["transparent","time","elevation"];for(let[u,f]of Object.entries(a))(!l.includes(u)||f)&&(n+=o?"?":"&",o=!1,n+=this._getURLParameter(u,f,r));return encodeURI(n)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,i){switch(e){case"crs":i.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":i.version==="1.3.0"&&(e="crs");break;case"bbox":let n=this._flipBoundingBox(r,i);n&&(r=n);break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let i=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),n=e;return i?[n[1],n[0],n[3],n[2]]:n}async _fetchArrayBuffer(e){let r=await this.fetch(e),i=await r.arrayBuffer();return this._checkResponse(r,i),i}_checkResponse(e,r){let i=e.headers["content-type"];if(!e.ok||Dx.mimeTypes.includes(i)){let n=hy(this.loadOptions,{wms:{throwOnError:!0}}),o=Dx.parseSync?.(r,n);throw new Error(o)}}_parseError(e){let r=Dx.parseSync?.(e,this.loadOptions);return new Error(r)}};var F0=class extends wu{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),i=this.getURLFromTemplate(r),o=await(await this.fetch(i)).arrayBuffer();return await df.parse(o)}getGranularParameters(e){let[[r,i],[n,o]]=e.boundingBox;return{...e,east:r,north:i,south:o,west:n}}getURLFromTemplate(e){let r=this.props.url;for(let[i,n]of Object.entries(e))r=r.replace(`\${${i}}`,String(n)),r=r.replace(`{${i}}`,String(n));return r}};F0.type="template";F0.testURL=t=>t.toLowerCase().includes("{");var sR=class extends F0{constructor(e){super(e),this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,i=`size=${e.width},${e.height}`,n={...e,bbox:r,size:i};return delete n.width,delete n.height,this.getUrl("exportImage",n)}getUrl(e,r,i){let n=`${this.props.url}/${e}`,o=!0;for(let[a,l]of Object.entries(r))n+=o?"?":"&",o=!1,Array.isArray(l)?n+=`${a.toUpperCase()}=${l.join(",")}`:n+=`${a.toUpperCase()}=${l?String(l):""}`;return n}async checkResponse(e){if(!e.ok)throw new Error("error")}},OV={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new sR(t)};var the=[BV,OV];function aR(t){return RV(t,the)}var DV=6378137*Math.PI;function lR(t){let e=Ka(t);return e[0]=(e[0]/256-1)*DV,e[1]=(e[1]/256-1)*DV,e}var rhe={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(t,e)=>console.error(e,t)}},LT=class extends As{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:e,props:r,oldProps:i}){let{viewport:n}=this.context;e.dataChanged||r.serviceType!==i.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(n,"image source changed"),0)):Ws(r.layers,i.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(n,"viewport changed")):this.debounce(()=>this.loadImage(n,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:e,image:r,lastRequestParameters:i}=this.state;return r&&new ZA({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:i.srs==="EPSG:4326"?ni.LNGLAT:ni.CARTESIAN,bounds:e,image:r})}async getFeatureInfoText(e,r){let{lastRequestParameters:i}=this.state;return i?await this.state.imageSource.getFeatureInfoText?.({...i,query_layers:i.layers,x:e,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof wu)return e.data;if(typeof e.data=="string")return aR({url:e.data,loadOptions:e.loadOptions,type:e.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:e}=this.state;try{this.state.loadCounter++;let r=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(e,r){let{layers:i,serviceType:n}=this.props;if(n==="wms"&&i.length===0)return;let o=e.getBounds(),{width:a,height:l}=e,u=this.getRequestId(),{srs:f}=this.props;f==="auto"&&(f=e.resolution?"EPSG:4326":"EPSG:3857");let _={width:a,height:l,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:i,crs:f};if(f==="EPSG:3857"){let w=lR([o[0],o[1]]),E=lR([o[2],o[3]]);_.boundingBox=[w,E]}try{this.state.loadCounter++,this.props.onImageLoadStart(u);let w=await this.state.imageSource.getImage(_);this.state.lastRequestId<u&&(this.getCurrentLayer()?.props.onImageLoad(u),this.setState({image:w,bounds:o,lastRequestParameters:_,lastRequestId:u}))}catch(w){this.raiseError(w,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(u,w)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),r)}},DT=LT;(()=>{LT.layerName="WMSLayer"})(),(()=>{LT.defaultProps=rhe})();var ihe={getHeight:{type:"accessor",value:0},greatCircle:!0},FT=class extends KA{},Nx=FT;(()=>{FT.layerName="GreatCircleLayer"})(),(()=>{FT.defaultProps=ihe})();var nhe={...Th.defaultProps},NT=class extends As{indexToBounds(){return null}renderLayers(){let{elevationScale:e,extruded:r,wireframe:i,filled:n,stroked:o,lineWidthUnits:a,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:f,lineJointRounded:_,lineMiterLimit:w,lineDashJustified:E,getElevation:M,getFillColor:D,getLineColor:j,getLineWidth:V}=this.props,{updateTriggers:$,material:te,transitions:ne}=this.props,le=this.getSubLayerClass("cell",Th),{updateTriggers:z,...ke}=this.indexToBounds()||{};return new le({filled:n,wireframe:i,extruded:r,elevationScale:e,stroked:o,lineWidthUnits:a,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:f,lineJointRounded:_,lineMiterLimit:w,lineDashJustified:E,material:te,transitions:ne,getElevation:M,getFillColor:D,getLineColor:j,getLineWidth:V},this.getSubLayerProps({id:"cell",updateTriggers:$&&{...z,getElevation:$.getElevation,getFillColor:$.getFillColor,getLineColor:$.getLineColor,getLineWidth:$.getLineWidth}}),ke)}},tu=NT;(()=>{NT.layerName="GeoCellLayer"})(),(()=>{NT.defaultProps=nhe})();var kT=sc(cR(),1),ohe=3,she=30,ahe=2*she+1,FV=180/Math.PI;function kV(t,e,r){let i=1<<e;return[(t[0]+r[0])/i,(t[1]+r[1])/i]}function NV(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function UV(t){return[NV(t[0]),NV(t[1])]}function zV(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function VV([t,e,r]){let i=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*FV,i*FV]}function HV(t){let e=kT.default.fromString(t,!0,10).toString(2);for(;e.length<ohe+ahe;)e="0"+e;let r=e.lastIndexOf("1"),i=e.substring(0,3),n=e.substring(3,r),o=n.length/2,a=kT.default.fromString(i,!0,2).toString(10),l=kT.default.fromString(n,!0,2).toString(4);for(;l.length<o;)l="0"+l;return`${a}/${l}`}function lhe(t,e,r,i){if(i===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function jV(t){let e=t.split("/"),r=parseInt(e[0],10),i=e[1],n=i.length,o=[0,0],a;for(let l=n-1;l>=0;l--){a=n-l;let u=i[l],f=0,_=0;u==="1"?_=1:u==="2"?(f=1,_=1):u==="3"&&(f=1);let w=Math.pow(2,a-1);lhe(w,o,f,_),o[0]+=w*f,o[1]+=w*_}if(r%2===1){let l=o[0];o[0]=o[1],o[1]=l}return{face:r,ij:o,level:a}}var GV=sc(cR(),1);function che(t){let e=t.padEnd(16,"0");return GV.default.fromString(e,16)}var uhe=100;function hhe({face:t,ij:e,level:r}){let i=[[0,0],[0,1],[1,1],[1,0],[0,0]],n=Math.max(1,Math.ceil(uhe*Math.pow(2,-r))),o=new Float64Array(4*n*2+2),a=0,l=0;for(let u=0;u<4;u++){let f=i[u].slice(0),_=i[u+1],w=(_[0]-f[0])/n,E=(_[1]-f[1])/n;for(let M=0;M<n;M++){f[0]+=w,f[1]+=E;let D=kV(e,r,f),j=UV(D),V=zV(t,j),$=VV(V);Math.abs($[1])>89.999&&($[0]=l);let te=$[0]-l;$[0]+=te>180?-360:te<-180?360:0,o[a++]=$[0],o[a++]=$[1],l=$[0]}}return o[a++]=o[0],o[a++]=o[1],o}function fhe(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=che(t)}return HV(t.toString())}function WV(t){let e=fhe(t),r=jV(e);return hhe(r)}var dhe={getS2Token:{type:"accessor",value:t=>t.token}},UT=class extends tu{indexToBounds(){let{data:e,getS2Token:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>WV(r(i,n))}}},Ux=UT;(()=>{UT.layerName="S2Layer"})(),(()=>{UT.defaultProps=dhe})();var uR=512;function phe(t,e){let r=0,i=0,n=1<<t.length,o=n/uR;for(let a=0;a<t.length;a++){n>>=1;let l=parseInt(t[a]);l%2&&(r|=n),l>1&&(i|=n)}return[[r/o,uR-i/o],[(r+e)/o,uR-(i+e)/o]]}function qV(t,e=1){let[r,i]=phe(t,e),[n,o]=Ol(r),[a,l]=Ol(i);return[a,o,a,l,n,l,n,o,a,o]}var Ahe={getQuadkey:{type:"accessor",value:t=>t.quadkey}},zT=class extends tu{indexToBounds(){let{data:e,extruded:r,getQuadkey:i}=this.props,n=r?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(o,a)=>qV(i(o,a),n),updateTriggers:{getPolygon:n}}}},zx=zT;(()=>{zT.layerName="QuadkeyLayer"})(),(()=>{zT.defaultProps=Ahe})();var fm=class{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:i,onError:n}){let{index:o,id:a,bbox:l,userData:u,zoom:f}=this,_=this._loaderId;this._abortController=new AbortController;let{signal:w}=this._abortController,E=await r.scheduleRequest(this,j=>j.isSelected?1:-1);if(!E){this._isCancelled=!0;return}if(this._isCancelled){E.done();return}let M=null,D;try{M=await e({index:o,id:a,bbox:l,userData:u,zoom:f,signal:w})}catch(j){D=j||!0}finally{E.done()}if(_===this._loaderId){if(this._loader=void 0,this.content=M,this._isCancelled&&!M){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,D?n(D,this):i(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var _a={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var XV=new ht,mhe=new ht,Cp=class{constructor(e=[0,0,0],r=[0,0,0],i){$i(this,"center",void 0),$i(this,"halfDiagonal",void 0),$i(this,"minimum",void 0),$i(this,"maximum",void 0),i=i||XV.copy(e).add(r).scale(.5),this.center=new ht(i),this.halfDiagonal=new ht(r).subtract(this.center),this.minimum=new ht(e),this.maximum=new ht(r)}clone(){return new Cp(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,i=mhe.from(e.normal),n=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),o=this.center.dot(i)+e.distance;return o-n>0?_a.INSIDE:o+n<0?_a.OUTSIDE:_a.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=XV.from(e).subtract(this.center),{halfDiagonal:i}=this,n=0,o;return o=Math.abs(r.x)-i.x,o>0&&(n+=o*o),o=Math.abs(r.y)-i.y,o>0&&(n+=o*o),o=Math.abs(r.z)-i.z,o>0&&(n+=o*o),n}};var Vx=new ht,YV=new ht,Uu=class{constructor(e=[0,0,0],r=0){$i(this,"center",void 0),$i(this,"radius",void 0),this.radius=-0,this.center=new ht,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=Vx.from(r),this.center=new ht().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Uu(this.center,this.radius)}union(e){let r=this.center,i=this.radius,n=e.center,o=e.radius,a=Vx.copy(n).subtract(r),l=a.magnitude();if(i>=l+o)return this.clone();if(o>=l+i)return e.clone();let u=(i+l+o)*.5;return YV.copy(a).scale((-i+u)/l).add(r),this.center.copy(YV),this.radius=u,this}expand(e){let i=Vx.from(e).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(e){this.center.transform(e);let r=ga.getScaling(Vx,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let i=Vx.from(e).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(e){let r=this.center,i=this.radius,o=e.normal.dot(r)+e.distance;return o<-i?_a.OUTSIDE:o<i?_a.INTERSECTING:_a.INSIDE}};var ghe=new ht,_he=new ht,VT=new ht,HT=new ht,jT=new ht,yhe=new ht,vhe=new ht,wd={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Sh=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){$i(this,"center",void 0),$i(this,"halfAxes",void 0),this.center=new ht().from(e),this.halfAxes=new Io(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new ht(e).len(),new ht(r).len(),new ht(i).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),n=new ht(e).normalize(),o=new ht(r).normalize(),a=new ht(i).normalize();return new Bu().fromMatrix3(new Io([...n,...o,...a]))}fromCenterHalfSizeQuaternion(e,r,i){let n=new Bu(i),o=new Io().fromQuaternion(n);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new ht().from(e),this.halfAxes=o,this}clone(){return new Sh(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Uu){let r=this.halfAxes,i=r.getColumn(0,VT),n=r.getColumn(1,HT),o=r.getColumn(2,jT),a=ghe.copy(i).add(n).add(o);return e.center.copy(this.center),e.radius=a.magnitude(),e}intersectPlane(e){let r=this.center,i=e.normal,n=this.halfAxes,o=i.x,a=i.y,l=i.z,u=Math.abs(o*n[wd.COLUMN0ROW0]+a*n[wd.COLUMN0ROW1]+l*n[wd.COLUMN0ROW2])+Math.abs(o*n[wd.COLUMN1ROW0]+a*n[wd.COLUMN1ROW1]+l*n[wd.COLUMN1ROW2])+Math.abs(o*n[wd.COLUMN2ROW0]+a*n[wd.COLUMN2ROW1]+l*n[wd.COLUMN2ROW2]),f=i.dot(r)+e.distance;return f<=-u?_a.OUTSIDE:f>=u?_a.INSIDE:_a.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=_he.from(e).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,VT),o=i.getColumn(1,HT),a=i.getColumn(2,jT),l=n.magnitude(),u=o.magnitude(),f=a.magnitude();n.normalize(),o.normalize(),a.normalize();let _=0,w;return w=Math.abs(r.dot(n))-l,w>0&&(_+=w*w),w=Math.abs(r.dot(o))-u,w>0&&(_+=w*w),w=Math.abs(r.dot(a))-f,w>0&&(_+=w*w),_}computePlaneDistances(e,r,i=[-0,-0]){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=this.center,l=this.halfAxes,u=l.getColumn(0,VT),f=l.getColumn(1,HT),_=l.getColumn(2,jT),w=yhe.copy(u).add(f).add(_).add(a),E=vhe.copy(w).subtract(e),M=r.dot(E);return n=Math.min(M,n),o=Math.max(M,o),w.copy(a).add(u).add(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),w.copy(a).add(u).subtract(f).add(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),w.copy(a).add(u).subtract(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).add(f).add(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).add(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).subtract(f).add(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),a.copy(w).subtract(u).subtract(f).subtract(_),E.copy(w).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),i[0]=n,i[1]=o,i}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,VT);r.transformAsPoint(e);let i=this.halfAxes.getColumn(1,HT);i.transformAsPoint(e);let n=this.halfAxes.getColumn(2,jT);return n.transformAsPoint(e),this.halfAxes=new Io([...r,...i,...n]),this}getTransform(){throw new Error("not implemented")}};var KV=new ht,ZV=new ht,pl=class{constructor(e=[0,0,1],r=0){$i(this,"normal",void 0),$i(this,"distance",void 0),this.normal=new ht,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return hl(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=KV.from(e),this.normal.from(r).normalize();let i=-this.normal.dot(e);return this.distance=i,this}fromCoefficients(e,r,i,n){return this.normal.set(e,r,i),hl(Ns(this.normal.len(),1)),this.distance=n,this}clone(){return new pl(this.normal,this.distance)}equals(e){return Ns(this.distance,e.distance)&&Ns(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=ZV.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,r)}projectPointOntoPlane(e,r=[0,0,0]){let i=KV.from(e),n=this.getPointDistance(i),o=ZV.copy(this.normal).scale(n);return i.subtract(o).to(r)}};var JV=[new ht([1,0,0]),new ht([0,1,0]),new ht([0,0,1])],QV=new ht,xhe=new ht,Ra=class{constructor(e=[]){$i(this,"planes",void 0),this.planes=e}fromBoundingSphere(e){this.planes.length=2*JV.length;let r=e.center,i=e.radius,n=0;for(let o of JV){let a=this.planes[n],l=this.planes[n+1];a||(a=this.planes[n]=new pl),l||(l=this.planes[n+1]=new pl);let u=QV.copy(o).scale(-i).add(r);a.fromPointNormal(u,o);let f=QV.copy(o).scale(i).add(r),_=xhe.copy(o).negate();l.fromPointNormal(f,_),n+=2}return this}computeVisibility(e){let r=_a.INSIDE;for(let i of this.planes)switch(e.intersectPlane(i)){case _a.OUTSIDE:return _a.OUTSIDE;case _a.INTERSECTING:r=_a.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(hl(Number.isFinite(r),"parentPlaneMask is required."),r===Ra.MASK_OUTSIDE||r===Ra.MASK_INSIDE)return r;let i=Ra.MASK_INSIDE,n=this.planes;for(let o=0;o<this.planes.length;++o){let a=o<31?1<<o:0;if(o<31&&!(r&a))continue;let l=n[o],u=e.intersectPlane(l);if(u===_a.OUTSIDE)return Ra.MASK_OUTSIDE;u===_a.INTERSECTING&&(i|=a)}return i}};$i(Ra,"MASK_OUTSIDE",4294967295);$i(Ra,"MASK_INSIDE",0);$i(Ra,"MASK_INDETERMINATE",2147483647);var DYe=new ht,LYe=new ht,FYe=new ht,NYe=new ht,kYe=new ht;var WYe=new ht,qYe=new ht,XYe=new ht,YYe=new ht,KYe=new ht,ZYe=new ht,JYe=new ht,QYe=new ht,$Ye=new ht,eKe=new ht,tKe=new ht,rKe=new ht;var bf=new Io,whe=new Io,The=new Io,GT=new Io,$V=new Io;function dR(t,e={}){let r=hh.EPSILON20,i=10,n=0,o=0,a=whe,l=The;a.identity(),l.copy(t);let u=r*Ehe(l);for(;o<i&&She(l)>u;)Che(l,GT),$V.copy(GT).transpose(),l.multiplyRight(GT),l.multiplyLeft($V),a.multiplyRight(GT),++n>2&&(++o,n=0);return e.unitary=a.toTarget(e.unitary),e.diagonal=l.toTarget(e.diagonal),e}function Ehe(t){let e=0;for(let r=0;r<9;++r){let i=t[r];e+=i*i}return Math.sqrt(e)}var hR=[1,0,0],fR=[2,2,1];function She(t){let e=0;for(let r=0;r<3;++r){let i=t[bf.getElementIndex(fR[r],hR[r])];e+=2*i*i}return Math.sqrt(e)}function Che(t,e){let r=hh.EPSILON15,i=0,n=1;for(let f=0;f<3;++f){let _=Math.abs(t[bf.getElementIndex(fR[f],hR[f])]);_>i&&(n=f,i=_)}let o=hR[n],a=fR[n],l=1,u=0;if(Math.abs(t[bf.getElementIndex(a,o)])>r){let f=t[bf.getElementIndex(a,a)],_=t[bf.getElementIndex(o,o)],w=t[bf.getElementIndex(a,o)],E=(f-_)/2/w,M;E<0?M=-1/(-E+Math.sqrt(1+E*E)):M=1/(E+Math.sqrt(1+E*E)),l=1/Math.sqrt(1+M*M),u=M*l}return Io.IDENTITY.to(e),e[bf.getElementIndex(o,o)]=e[bf.getElementIndex(a,a)]=l,e[bf.getElementIndex(a,o)]=u,e[bf.getElementIndex(o,a)]=-u,e}var Mp=new ht,Mhe=new ht,Ihe=new ht,Phe=new ht,Rhe=new ht,Bhe=new Io,Ohe={diagonal:new Io,unitary:new Io};function Hx(t,e=new Sh){if(!t||t.length===0)return e.halfAxes=new Io([0,0,0,0,0,0,0,0,0]),e.center=new ht,e;let r=t.length,i=new ht(0,0,0);for(let O of t)i.add(O);let n=1/r;i.multiplyByScalar(n);let o=0,a=0,l=0,u=0,f=0,_=0;for(let O of t){let I=Mp.copy(O).subtract(i);o+=I.x*I.x,a+=I.x*I.y,l+=I.x*I.z,u+=I.y*I.y,f+=I.y*I.z,_+=I.z*I.z}o*=n,a*=n,l*=n,u*=n,f*=n,_*=n;let w=Bhe;w[0]=o,w[1]=a,w[2]=l,w[3]=a,w[4]=u,w[5]=f,w[6]=l,w[7]=f,w[8]=_;let{unitary:E}=dR(w,Ohe),M=e.halfAxes.copy(E),D=M.getColumn(0,Ihe),j=M.getColumn(1,Phe),V=M.getColumn(2,Rhe),$=-Number.MAX_VALUE,te=-Number.MAX_VALUE,ne=-Number.MAX_VALUE,le=Number.MAX_VALUE,z=Number.MAX_VALUE,ke=Number.MAX_VALUE;for(let O of t)Mp.copy(O),$=Math.max(Mp.dot(D),$),te=Math.max(Mp.dot(j),te),ne=Math.max(Mp.dot(V),ne),le=Math.min(Mp.dot(D),le),z=Math.min(Mp.dot(j),z),ke=Math.min(Mp.dot(V),ke);D=D.multiplyByScalar(.5*(le+$)),j=j.multiplyByScalar(.5*(z+te)),V=V.multiplyByScalar(.5*(ke+ne)),e.center.copy(D).add(j).add(V);let Y=Mhe.set($-le,te-z,ne-ke).multiplyByScalar(.5),X=new Io([Y[0],0,0,0,Y[1],0,0,0,Y[2]]);return e.halfAxes.multiplyRight(X),e}var N0=512,e9=3,t9=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],r9=t9.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Dhe=r9.concat([[.25,.5],[.75,.5]]),Ip=class{constructor(e,r,i){this.x=e,this.y=r,this.z=i}get children(){if(!this._children){let e=this.x*2,r=this.y*2,i=this.z+1;this._children=[new Ip(e,r,i),new Ip(e,r+1,i),new Ip(e+1,r,i),new Ip(e+1,r+1,i)]}return this._children}update(e){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:o,maxZ:a,bounds:l,offset:u,project:f}=e,_=this.getBoundingVolume(n,u,f);if(l&&!this.insideBounds(l)||i.computeVisibility(_)<0)return!1;if(!this.childVisible){let{z:E}=this;if(E<a&&E>=o){let M=_.distanceTo(r.cameraPosition)*r.scale/r.height;E+=Math.floor(Math.log2(M))}if(E>=a)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let E of this.children)E.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,i,n]){let o=Math.pow(2,this.z),a=N0/o;return this.x*a<i&&this.y*a<n&&(this.x+1)*a>e&&(this.y+1)*a>r}getBoundingVolume(e,r,i){if(i){let u=this.z<1?Dhe:this.z<2?r9:t9,f=[];for(let _ of u){let w=WT(this.x+_[0],this.y+_[1],this.z);w[2]=e[0],f.push(i(w)),e[0]!==e[1]&&(w[2]=e[1],f.push(i(w)))}return Hx(f)}let n=Math.pow(2,this.z),o=N0/n,a=this.x*o+r*N0,l=N0-(this.y+1)*o;return new Cp([a,l,e[0]],[a+o,l+o,e[1]])}};function i9(t,e,r,i){let n=t instanceof md&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map(({normal:M,distance:D})=>new pl(M.clone().negate(),D)),a=new Ra(o),l=t.distanceScales.unitsPerMeter[2],u=r&&r[0]*l||0,f=r&&r[1]*l||0,_=t instanceof Ic&&t.pitch<=60?e:0;if(i){let[M,D,j,V]=i,$=Ka([M,V]),te=Ka([j,D]);i=[$[0],N0-$[1],te[0],N0-te[1]]}let w=new Ip(0,0,0),E={viewport:t,project:n,cullingVolume:a,elevationBounds:[u,f],minZ:_,maxZ:e,bounds:i,offset:0};if(w.update(E),t instanceof Ic&&t.subViewports&&t.subViewports.length>1){for(E.offset=-1;w.update(E)&&!(--E.offset<-e9););for(E.offset=1;w.update(E)&&!(++E.offset>e9););}return w.getSelected()}var Td=512,Lhe=[-1/0,-1/0,1/0,1/0],Pp={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}};function o9(t,e){let r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...r.map(n=>n[0])),Math.min(...r.map(n=>n[1])),Math.max(...r.map(n=>n[0])),Math.max(...r.map(n=>n[1]))]}function Fhe(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function wf(t,e){if(!t||!t.length)return null;let{index:r,id:i}=e;if(Array.isArray(t)){let o=Fhe(i)%t.length;t=t[o]}let n=t;for(let o of Object.keys(r)){let a=new RegExp(`{${o}}`,"g");n=n.replace(a,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(n=n.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),n}function Nhe(t,e,r){let i;if(e&&e.length===2){let[n,o]=e,a=t.getBounds({z:n}),l=t.getBounds({z:o});i=[Math.min(a[0],l[0]),Math.min(a[1],l[1]),Math.max(a[2],l[2]),Math.max(a[3],l[3])]}else i=t.getBounds();return t.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function s9({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(n=>pR(n,e||0,r))}function pR(t,e,r){if(!Array.isArray(e)){let o=r.x-t.x,a=r.y-t.y,{width:l,height:u}=r,f={targetZ:e},_=t.unproject([o,a],f),w=t.unproject([o+l,a],f),E=t.unproject([o,a+u],f),M=t.unproject([o+l,a+u],f);return[Math.min(_[0],w[0],E[0],M[0]),Math.min(_[1],w[1],E[1],M[1]),Math.max(_[0],w[0],E[0],M[0]),Math.max(_[1],w[1],E[1],M[1])]}let i=pR(t,e[0],r),n=pR(t,e[1],r);return[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[2],n[2]),Math.max(i[3],n[3])]}function khe(t,e,r){return r?o9(t,r).map(n=>n*e/Td):t.map(i=>i*e/Td)}function AR(t,e){return Math.pow(2,t)*Td/e}function WT(t,e,r){let i=AR(r,Td),n=t/i*360-180,o=Math.PI-2*Math.PI*e/i,a=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[n,a]}function n9(t,e,r,i){let n=AR(r,i);return[t/n*Td,e/n*Td]}function mR(t,e,r,i,n=Td){if(t.isGeospatial){let[f,_]=WT(e,r,i),[w,E]=WT(e+1,r+1,i);return{west:f,north:_,east:w,south:E}}let[o,a]=n9(e,r,i,n),[l,u]=n9(e+1,r+1,i,n);return{left:o,top:a,right:l,bottom:u}}function Uhe(t,e,r,i,n){let o=Nhe(t,null,i),a=AR(e,r),[l,u,f,_]=khe(o,a,n),w=[];for(let E=Math.floor(l);E<f;E++)for(let M=Math.floor(u);M<_;M++)w.push({x:E,y:M,z:e});return w}function gR({viewport:t,maxZoom:e,minZoom:r,zRange:i,extent:n,tileSize:o=Td,modelMatrix:a,modelMatrixInverse:l,zoomOffset:u=0}){let f=t.isGeospatial?Math.round(t.zoom+Math.log2(Td/o))+u:Math.ceil(t.zoom)+u;if(typeof r=="number"&&Number.isFinite(r)&&f<r){if(!n)return[];f=r}typeof e=="number"&&Number.isFinite(e)&&f>e&&(f=e);let _=n;return a&&l&&n&&!t.isGeospatial&&(_=o9(n,a)),t.isGeospatial?i9(t,f,i,n):Uhe(t,f,o,_||Lhe,l)}function _R(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function yR(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function a9(t){let e={},r;return i=>{for(let n in i)if(!zhe(i[n],e[n])){r=t(i),e=i;break}return r}}function zhe(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}return!1}var l9=1,qT=2,Vhe="never",Hhe="no-overlap",jx="best-available",jhe=5,Ghe={[jx]:qhe,[Hhe]:Xhe,[Vhe]:()=>{}},Whe={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:()=>{}},dm=class{constructor(e){this._getCullBounds=a9(s9),this.opts={...Whe,...e},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new Xd({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 ii,this._modelMatrixInverse=new ii}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:i}={zRange:null,modelMatrix:null}){let n=i?new ii(i):new ii,o=!n.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!Ns(this._zRange,r)||o){o&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=e,this._zRange=r;let l=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(u=>this._getTile(u,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(l=>this._getTile(l.index,!0)));let a=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),a&&this._frameNumber++,this._frameNumber}isTileVisible(e,r){if(!e.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:n}=e;for(let[o,a,l,u]of i){let f;if("west"in n)f=n.west<l&&n.east>o&&n.south<u&&n.north>a;else{let _=Math.min(n.top,n.bottom),w=Math.max(n.top,n.bottom);f=n.left<l&&n.right>o&&_<u&&w>a}if(f)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:i,zRange:n,modelMatrix:o,modelMatrixInverse:a}){let{tileSize:l,extent:u,zoomOffset:f}=this.opts;return gR({viewport:e,maxZoom:r,minZoom:i,zRange:n,tileSize:l,extent:u,modelMatrix:o,modelMatrixInverse:a,zoomOffset:f})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:mR(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),i=Math.floor(e.y/2),n=e.z-1;return{x:r,y:i,z:n}}updateTileStates(){let e=this.opts.refinementStrategy||jx,r=new Array(this._cache.size),i=0;for(let n of this._cache.values())r[i++]=n.isVisible,n.isSelected=!1,n.isVisible=!1;for(let n of this._selectedTiles)n.isSelected=!0,n.isVisible=!0;(typeof e=="function"?e:Ghe[e])(Array.from(this._cache.values())),i=0;for(let n of this._cache.values())if(r[i++]!==n.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,r=[],i=0;for(let n of this._cache.values())n.isLoading&&(i++,!n.isSelected&&!n.isVisible&&r.push(n));for(;e>0&&i>e&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let i=this._getNearestAncestor(r);r.parent=i,i?.children&&i.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:jhe*this.selectedTiles.length),n=r.maxCacheByteSize||1/0;if(e.size>i||this._cacheByteSize>n){for(let[a,l]of e)if(!l.isVisible&&!l.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?l.byteLength:0,e.delete(a),this.opts.onTileUnload?.(l)),e.size<=i&&this._cacheByteSize<=n)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((a,l)=>a.zoom-l.zoom),this._dirty=!1)}_getTile(e,r){let i=this.getTileId(e),n=this._cache.get(i),o=!1;return!n&&r?(n=new fm(e),Object.assign(n,this.getTileMetadata(n.index)),Object.assign(n,{id:i,zoom:this.getTileZoom(n.index)}),o=!0,this._cache.set(i,n),this._dirty=!0):n&&n.needsReload&&(o=!0),n&&o&&n.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),n}_getNearestAncestor(e){let{_minZoom:r=0}=this,i=e.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let n=this._getTile(i);if(n)return n}return null}};function qhe(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!c9(e)&&vR(e);for(let e of t)e.isVisible=Boolean(e.state&qT)}function Xhe(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&c9(r);let e=Array.from(t).sort((r,i)=>r.zoom-i.zoom);for(let r of e)if(r.isVisible=Boolean(r.state&qT),r.children&&(r.isVisible||r.state&l9))for(let i of r.children)i.state=l9;else r.isSelected&&vR(r)}function c9(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=qT,!0;e=e.parent}return!1}function vR(t){for(let e of t.children)e.isLoaded||e.content?e.state|=qT:vR(e)}var Yhe={TilesetClass:dm,data:{type:"data",value:[]},dataComparator:Pp.equal,renderSubLayers:{type:"function",value:t=>new xf(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:jx,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},XT=class extends As{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,i=e.propsOrDataChanged||e.updateTriggersChanged,n=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:o,maxZoom:a,minZoom:l,maxRequests:u,debounceTime:f,zoomOffset:_}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:a,minZoom:l,tileSize:e,refinementStrategy:n,extent:o,maxRequests:u,debounceTime:f,zoomOffset:_,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:i}=this.props,n=e.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:o}=e,a=this.state.isLoaded!==o,l=this.state.frameNumber!==n;o&&(a||l)&&this._onViewportLoad(),l&&this.setState({frameNumber:n}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:i,fetch:n}=this.props,{signal:o}=e;return e.url=typeof r=="string"||Array.isArray(r)?wf(r,e):null,i?i(e):n&&e.url?n(e.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo({info:e,sourceLayer:r}){let i=r.props.tile;return e.picked&&(e.tile=i),e.sourceTile=i,e}_updateAutoHighlight(e){let r=e.sourceTile;if(r&&r.layers)for(let i of r.layers)i.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(i=>e.layers[0].props[i]!==r[i])&&(e.layers=e.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=yf(i,Boolean).map(n=>n.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:i}=e.props;return this.state.tileset.isTileVisible(i,r)}},Tf=XT;(()=>{XT.defaultProps=Yhe})(),(()=>{XT.layerName="TileLayer"})();var Khe={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:t=>t.timestamps}},YT=class extends bh{getShaders(){let e=super.getShaders();return e.inject={"vs:#decl":`uniform float trailLength;
|
|
3308
3308
|
in float instanceTimestamps;
|
|
3309
3309
|
in float instanceNextTimestamps;
|
|
3310
3310
|
out float vTime;
|
|
@@ -3668,7 +3668,7 @@ clip_commonPosition = geometry.position.xy;
|
|
|
3668
3668
|
in vec2 clip_commonPosition;
|
|
3669
3669
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
3670
3670
|
if (!clip_isInBounds(clip_commonPosition)) discard;
|
|
3671
|
-
`},eS=class extends XA{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[vge],inject:xge}:{modules:[bge],inject:wge}}draw({uniforms:e}){let{clipBounds:r}=this.props;if(this.state.clipByInstance)e.clip_bounds=r;else{let i=this.projectPosition([r[0],r[1],0]),n=this.projectPosition([r[2],r[3],0]);e.clip_bounds=[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[0],n[0]),Math.max(i[1],n[1])]}}},i_=eS;(()=>{eS.defaultProps=yge})(),(()=>{eS.extensionName="ClipExtension"})();function KB(t,e,r){let i=Tge(t),n=Object.keys(i).filter(o=>i[o]!==Array);return Ege(t,{propArrayTypes:i,...e},{numericPropKeys:r&&r.numericPropKeys||n,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Tge(t){let e={};for(let r of t)if(r.properties)for(let i in r.properties){let n=r.properties[i];e[i]=Rge(n,e[i])}return e}function Ege(t,e,r){let{pointPositionsCount:i,pointFeaturesCount:n,linePositionsCount:o,linePathsCount:a,lineFeaturesCount:l,polygonPositionsCount:u,polygonObjectsCount:f,polygonRingsCount:_,polygonFeaturesCount:w,propArrayTypes:E,coordLength:M}=e,{numericPropKeys:D=[],PositionDataType:j=Float32Array,triangulate:V=!0}=r,$=t[0]&&"id"in t[0],te=t.length>65535?Uint32Array:Uint16Array,ne={type:"Point",positions:new j(i*M),globalFeatureIds:new te(i),featureIds:n>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},le={type:"LineString",pathIndices:o>65535?new Uint32Array(a+1):new Uint16Array(a+1),positions:new j(o*M),globalFeatureIds:new te(o),featureIds:l>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},z={type:"Polygon",polygonIndices:u>65535?new Uint32Array(f+1):new Uint16Array(f+1),primitivePolygonIndices:u>65535?new Uint32Array(_+1):new Uint16Array(_+1),positions:new j(u*M),globalFeatureIds:new te(u),featureIds:w>65535?new Uint32Array(u):new Uint16Array(u),numericProps:{},properties:[],fields:[]};V&&(z.triangles=[]);for(let Y of[ne,le,z])for(let X of D){let O=E[X];Y.numericProps[X]=new O(Y.positions.length/M)}le.pathIndices[a]=o,z.polygonIndices[f]=u,z.primitivePolygonIndices[_]=u;let ke={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let Y of t){let X=Y.geometry,O=Y.properties||{};switch(X.type){case"Point":Sge(X,ne,ke,M,O),ne.properties.push(YB(O,D)),$&&ne.fields.push({id:Y.id}),ke.pointFeature++;break;case"LineString":Cge(X,le,ke,M,O),le.properties.push(YB(O,D)),$&&le.fields.push({id:Y.id}),ke.lineFeature++;break;case"Polygon":Mge(X,z,ke,M,O),z.properties.push(YB(O,D)),$&&z.fields.push({id:Y.id}),ke.polygonFeature++;break;default:throw new Error("Invalid geometry type")}ke.feature++}return Pge(ne,le,z,M)}function Sge(t,e,r,i,n){e.positions.set(t.data,r.pointPosition*i);let o=t.data.length/i;ZB(e,n,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Cge(t,e,r,i,n){e.positions.set(t.data,r.linePosition*i);let o=t.data.length/i;ZB(e,n,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let a=0,l=t.indices.length;a<l;++a){let u=t.indices[a],f=a===l-1?t.data.length:t.indices[a+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(f-u)/i}}function Mge(t,e,r,i,n){e.positions.set(t.data,r.polygonPosition*i);let o=t.data.length/i;ZB(e,n,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let a=0,l=t.indices.length;a<l;++a){let u=r.polygonPosition;e.polygonIndices[r.polygonObject++]=u;let f=t.areas[a],_=t.indices[a],w=t.indices[a+1];for(let M=0,D=_.length;M<D;++M){let j=_[M],V=M===D-1?w===void 0?t.data.length:w[0]:_[M+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(V-j)/i}let E=r.polygonPosition;Ige(e,f,_,{startPosition:u,endPosition:E,coordLength:i})}}function Ige(t,e,r,{startPosition:i,endPosition:n,coordLength:o}){if(!t.triangles)return;let a=i*o,l=n*o,u=t.positions.subarray(a,l),f=r[0],_=r.slice(1).map(E=>(E-f)/o),w=g3(u,_,o,e);for(let E=0,M=w.length;E<M;++E)t.triangles.push(i+w[E])}function XB(t,e){let r={};for(let i in t)r[i]={value:t[i],size:e};return r}function Pge(t,e,r,i){let n={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:i},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:XB(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:i},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:XB(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:i},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:XB(r.numericProps,1)}};return n.polygons&&r.triangles&&(n.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),n}function ZB(t,e,r,i){for(let n in t.numericProps)if(n in e){let o=e[n];t.numericProps[n].fill(o,r,r+i)}}function YB(t,e){let r={};for(let i in t)e.includes(i)||(r[i]=t[i]);return r}function Rge(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function iS(t,e){let r=e?.globalFeatureId;return r!==void 0?Bge(t,r):Oge(t,e?.type)}function Bge(t,e){let r=p7(t);for(let i of r){let n=0,o=i.featureIds.value[0];for(let a=0;a<i.featureIds.value.length;a++){let l=i.featureIds.value[a];if(l!==o){if(e===i.globalFeatureIds.value[n])return tS(i,n,a);n=a,o=l}}if(e===i.globalFeatureIds.value[n])return tS(i,n,i.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function Oge(t,e){let r=p7(t,e);return Dge(r)}function d7(t,e,r){switch(t.type){case"Point":return kge(t,e,r);case"LineString":return Nge(t,e,r);case"Polygon":return A7(t,e,r);default:let i=t;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function p7(t,e){let r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function Dge(t){let e=[];for(let r of t){if(r.featureIds.value.length===0)continue;let i=0,n=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];a!==n&&(e.push(tS(r,i,o)),i=o,n=a)}e.push(tS(r,i,r.featureIds.value.length))}return e}function tS(t,e,r){let i=d7(t,e,r),n=Fge(t,e,r),o=Lge(t,e,r);return{type:"Feature",geometry:i,properties:n,...o}}function Lge(t,e=0,r){return t.fields&&t.fields[t.featureIds.value[e]]}function Fge(t,e=0,r){let i=Object.assign({},t.properties[t.featureIds.value[e]]);for(let n in t.numericProps)i[n]=t.numericProps[n].value[e];return i}function A7(t,e=-1/0,r=1/0){let{positions:i}=t,n=t.polygonIndices.value.filter(u=>u>=e&&u<=r),o=t.primitivePolygonIndices.value.filter(u=>u>=e&&u<=r);if(!(n.length>2)){let u=[];for(let f=0;f<o.length-1;f++){let _=o[f],w=o[f+1],E=rS(i,_,w);u.push(E)}return{type:"Polygon",coordinates:u}}let l=[];for(let u=0;u<n.length-1;u++){let f=n[u],_=n[u+1],w=A7(t,f,_).coordinates;l.push(w)}return{type:"MultiPolygon",coordinates:l}}function Nge(t,e=-1/0,r=1/0){let{positions:i}=t,n=t.pathIndices.value.filter(l=>l>=e&&l<=r);if(!(n.length>2))return{type:"LineString",coordinates:rS(i,n[0],n[1])};let a=[];for(let l=0;l<n.length-1;l++){let u=rS(i,n[l],n[l+1]);a.push(u)}return{type:"MultiLineString",coordinates:a}}function kge(t,e,r){let{positions:i}=t,n=rS(i,e,r);return n.length>1?{type:"MultiPoint",coordinates:n}:{type:"Point",coordinates:n[0]}}function rS(t,e,r){e=e||0,r=r||t.value.length/t.size;let i=[];for(let n=e;n<r;n++){let o=Array();for(let a=n*t.size;a<(n+1)*t.size;a++)o.push(Number(t.value[a]));i.push(o)}return i}var iO=sc(b7(),1);function w7(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let o=0;o<e;o++){let a=r0e(t[o]);a!==0&&(n===void 0&&(n=a<0),n===a<0?(i&&r.push(i),i=[t[o]]):i&&i.push(t[o]))}return i&&r.push(i),r}function r0e(t){let e=0;for(let r=0,i=t.length-1,n,o;r<t.length;i=r++)n=t[r],o=t[i],e+=(o[0]-n[0])*(n[1]+o[1]);return e}function T7(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?i0e(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function i0e(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}var Im=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(e,r,i,n,o){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(T7,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,i=1,n=0,o=0,a=0,l=[],u;for(;e.pos<r;){if(n<=0){let f=e.readVarint();i=f&7,n=f>>3}if(n--,i===1||i===2)o+=e.readSVarint(),a+=e.readSVarint(),i===1&&(u&&l.push(u),u=[]),u&&u.push([o,a]);else if(i===7)u&&u.push(u[0].slice());else throw new Error(`unknown command ${i}`)}return u&&l.push(u),l}bbox(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,i=1,n=0,o=0,a=0,l=1/0,u=-1/0,f=1/0,_=-1/0;for(;e.pos<r;){if(n<=0){let w=e.readVarint();i=w&7,n=w>>3}if(n--,i===1||i===2)o+=e.readSVarint(),a+=e.readSVarint(),o<l&&(l=o),o>u&&(u=o),a<f&&(f=a),a>_&&(_=a);else if(i!==7)throw new Error(`unknown command ${i}`)}return[l,f,u,_]}_toGeoJSON(e){let r=this.loadGeometry(),i=Im.types[this.type],n,o;switch(this.type){case 1:let l=[];for(n=0;n<r.length;n++)l[n]=r[n][0];r=l,e(r,this);break;case 2:for(n=0;n<r.length;n++)e(r[n],this);break;case 3:for(r=w7(r),n=0;n<r.length;n++)for(o=0;o<r[n].length;o++)e(r[n][o],this);break}r.length===1?r=r[0]:i=`Multi${i}`;let a={type:"Feature",geometry:{type:i,coordinates:r},properties:this.properties};return this.id!==null&&(a.id=this.id),a}toGeoJSON(e){if(typeof e=="function")return this._toGeoJSON(e);let{x:r,y:i,z:n}=e,o=this.extent*Math.pow(2,n),a=this.extent*r,l=this.extent*i;function u(f){for(let _=0;_<f.length;_++){let w=f[_];w[0]=(w[0]+a)*360/o-180;let E=180-(w[1]+l)*360/o;w[1]=360/Math.PI*Math.atan(Math.exp(E*Math.PI/180))-90}}return this._toGeoJSON(u)}};var d1=class{constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(n0e,this,r),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new Im(this._pbf,r,this.extent,this._keys,this._values)}};function n0e(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(o0e(r)))}function o0e(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}var p1=class{constructor(e,r){this.layers=e.readFields(s0e,{},r)}};function s0e(t,e,r){if(t===3&&r){let i=new d1(r,r.readVarint()+r.pos);i.length&&e&&(e[i.name]=i)}}function E7(t){let e=t.indices.length,r="Polygon";if(e<=1)return{type:r,data:t.data,areas:[[yp(t.data)]],indices:[t.indices]};let i=[],n=[],o=[],a=[],l,u=0;for(let f,_=0,w;_<e;_++){w=t.indices[_]-u,f=t.indices[_+1]-u||t.data.length;let E=t.data.slice(w,f),M=yp(E);if(M===0){let D=t.data.slice(0,w),j=t.data.slice(f);t.data=D.concat(j),u+=f-w;continue}l===void 0&&(l=M<0),l===M<0?(a.length&&(i.push(o),n.push(a)),a=[w],o=[M]):(o.push(M),a.push(w))}return o&&i.push(o),a.length&&n.push(a),{type:r,areas:i,indices:n,data:t.data}}function S7(t,e,r,i){for(let n=0,o=t.length;n<o;n+=2){t[n]=(t[n]+e)*360/i-180;let a=180-(t[n+1]+r)*360/i;t[n+1]=360/Math.PI*Math.atan(Math.exp(a*Math.PI/180))-90}}function C7(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?a0e(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function a0e(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}var M7,Pm,$B,sS,eO,tO,A1;var m1=class{constructor(e,r,i,n,o,a){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,this._geometryInfo=a,e.readFields(C7,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry,M7=e.readVarint()+e.pos,Pm=1,sS=0,eO=0,tO=0,A1=0;let r=[],i=[];for(;e.pos<M7;)if(sS<=0&&($B=e.readVarint(),Pm=$B&7,sS=$B>>3),sS--,Pm===1||Pm===2)eO+=e.readSVarint(),tO+=e.readSVarint(),Pm===1&&r.push(A1),i.push(eO,tO),A1+=2;else if(Pm===7){if(A1>0){let n=r[r.length-1];i.push(i[n],i[n+1]),A1+=2}}else throw new Error(`unknown command ${Pm}`);return{data:i,indices:r}}_toBinaryCoordinates(e){let r=this.loadGeometry(),i;e(r.data,this);let n=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=r.indices.length,i={type:"Point",...r};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=r.indices.length,this._geometryInfo.linePositionsCount+=r.data.length/n,i={type:"LineString",...r};break;case 3:i=E7(r),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=i.indices.length;for(let a of i.indices)this._geometryInfo.polygonRingsCount+=a.length;this._geometryInfo.polygonPositionsCount+=i.data.length/n;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:i,properties:this.properties};return this.id!==null&&(o.id=this.id),o}toBinaryCoordinates(e){if(typeof e=="function")return this._toBinaryCoordinates(e);let{x:r,y:i,z:n}=e,o=this.extent*Math.pow(2,n),a=this.extent*r,l=this.extent*i;return this._toBinaryCoordinates(u=>S7(u,a,l,o))}};var g1=class{constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(l0e,this,r),this.length=this._features.length}feature(e,r){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let i=this._pbf.readVarint()+this._pbf.pos;return new m1(this._pbf,i,this.extent,this._keys,this._values,r)}};function l0e(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(c0e(r)))}function c0e(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}var _1=class{constructor(e,r){this.layers=e.readFields(u0e,{},r)}};function u0e(t,e,r){if(t===3&&r){let i=new g1(r,r.readVarint()+r.pos);i.length&&e&&(e[i.name]=i)}}function aS(t,e){let r=f0e(e),i=e?.gis?.format||e?.mvt?.shape||e?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:rO(t,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:I7(t,r)};case"geojson":return I7(t,r);case"binary-geometry":return rO(t,r);case"binary":return rO(t,r);default:throw new Error(i||"undefined shape")}}function rO(t,e){let[r,i]=h0e(t,e),n=KB(r,i);return n.byteLength=t.byteLength,n}function h0e(t,e){let r=[],i={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[r,i];let n=new _1(new iO.default(t));return(e&&Array.isArray(e.layers)?e.layers:Object.keys(n.layers)).forEach(a=>{let l=n.layers[a];if(l)for(let u=0;u<l.length;u++){let f=l.feature(u,i),_=p0e(f,e,a);r.push(_)}}),[r,i]}function I7(t,e){if(t.byteLength<=0)return[];let r=[],i=new p1(new iO.default(t));return(Array.isArray(e.layers)?e.layers:Object.keys(i.layers)).forEach(o=>{let a=i.layers[o];if(a)for(let l=0;l<a.length;l++){let u=a.feature(l),f=d0e(u,e,o);r.push(f)}}),r}function f0e(t){if(!t?.mvt)throw new Error("mvt options required");let e=t.mvt?.coordinates==="wgs84",{tileIndex:r}=t.mvt,i=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(e&&!i)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.mvt}function d0e(t,e,r){let i=t.toGeoJSON(e.coordinates==="wgs84"?e.tileIndex:A0e);return e.layerProperty&&(i.properties[e.layerProperty]=r),i}function p0e(t,e,r){let i=t.toBinaryCoordinates(e.coordinates==="wgs84"?e.tileIndex:m0e);return e.layerProperty&&i.properties&&(i.properties[e.layerProperty]=r),i}function A0e(t,e){let{extent:r}=e;for(let i=0;i<t.length;i++){let n=t[i];n[0]/=r,n[1]/=r}}function m0e(t,e){let{extent:r}=e;for(let i=0,n=t.length;i<n;++i)t[i]/=r}var g0e="4.2.0-alpha.4",lS={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:g0e,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}}},_0e={...lS,parse:async(t,e)=>aS(t,e),parseSync:aS,binary:!0};var y0e={Point:P7,MultiPoint:v0e,LineString:R7,MultiLineString:x0e,Polygon:B7,MultiPolygon:b0e};function P7([t,e],[r,i],n){let o=Xa(r[0],i[0],t),a=Xa(r[1],i[1],e);return n.unprojectFlat([o,a])}function nO(t,e,r){return t.map(i=>P7(i,e,r))}function v0e(t,e,r){return nO(t,e,r)}function R7(t,e,r){return nO(t,e,r)}function x0e(t,e,r){return t.map(i=>R7(i,e,r))}function B7(t,e,r){return t.map(i=>nO(i,e,r))}function b0e(t,e,r){return t.map(i=>B7(i,e,r))}function O7(t,e,r){let i=r.projectFlat([e.west,e.north]),n=r.projectFlat([e.east,e.south]),o=[i,n];return{...t,coordinates:y0e[t.type](t.coordinates,o,r)}}var w0e=["points","lines","polygons"];function oO(t,e,r,i){for(let n of w0e){let o=t[n]&&T0e(t[n],e,r,i);if(o>=0)return o}return-1}function T0e(t,e,r,i){let n=t.featureIds.value;if(!n.length)return-1;let o=0,a=n[n.length-1]+1;if(i){let u=E0e(t,i);if(u)o=u[0],a=u[1]+1;else return-1}let l=-1;if(e in t.numericProps){let u=t.numericProps[e].value.findIndex((f,_)=>f===r&&n[_]>=o&&n[_]<a);return u>=0?t.globalFeatureIds.value[u]:-1}else e?l=D7(t.properties,u=>u[e]===r,o,a):t.fields&&(l=D7(t.fields,u=>u.id===r,o,a));return l>=0?S0e(t,l):-1}function E0e(t,e){if(!t.__layers){let r={},{properties:i}=t;for(let n=0;n<i.length;n++){let{layerName:o}=i[n];o&&(r[o]?r[o][1]=n:r[o]=[n,n])}t.__layers=r}return t.__layers[e]}function S0e(t,e){if(!t.__ids){let r=[],i=t.featureIds.value,n=t.globalFeatureIds.value;for(let o=0;o<i.length;o++)r[i[o]]=n[o];t.__ids=r}return t.__ids[e]}function D7(t,e,r,i){for(let n=r;n<i;n++)if(e(t[n],n))return n;return-1}var sO=512,C0e={...xf.defaultProps,data:Pp,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[lS],binary:!0},cS=class extends Tf{constructor(...e){super(...e)}initializeState(){super.initializeState();let e=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:e,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:e,oldProps:r,context:i,changeFlags:n}){n.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:e,oldProps:r,context:i,changeFlags:n}),this._setWGS84PropertyForTiles());let{highlightColor:o}=e;o!==r.highlightColor&&Array.isArray(o)&&this.setState({highlightColor:o})}async _updateTileData(){let e=this.props.data,r=null;if(typeof e=="string"&&!_R(e)){let{onDataLoad:i,fetch:n}=this.props;this.setState({data:null,tileJSON:null});try{r=await n(e,{propName:"data",layer:this,loaders:[]})}catch(o){this.raiseError(o,"loading TileJSON"),e=null}i&&i(r,{propName:"data",layer:this})}else e&&typeof e=="object"&&"tilejson"in e&&(r=e);r&&(e=r.tiles),this.setState({data:e,tileJSON:r})}_getTilesetOptions(){let e=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:i,maxZoom:n}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>i&&(e.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(n)||r.maxzoom<n)&&(e.maxZoom=r.maxzoom)),e}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(e){let{data:r,binary:i}=this.state,{index:n,signal:o}=e,a=wf(r,e);if(!a)return Promise.reject("Invalid URL");let l=this.getLoadOptions(),{fetch:u}=this.props;return l={...l,mimeType:"application/x-protobuf",mvt:{...l?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:n},gis:i?{format:"binary"}:{}},u(a,{propName:"data",layer:this,loadOptions:l,signal:o})}renderSubLayers(e){let{x:r,y:i,z:n}=e.tile.index,o=Math.pow(2,n),a=sO/o,l=-a,u=sO*r/o,f=sO*(1-i/o),_=new ii().scale([a,l,1]);e.autoHighlight=!1,this.context.viewport.resolution||(e.modelMatrix=_,e.coordinateOrigin=[u,f,0],e.coordinateSystem=ni.CARTESIAN,e.extensions=[...e.extensions||[],new i_]);let w=super.renderSubLayers(e);return this.state.binary&&!(w instanceof xf)&&br.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),w}_updateAutoHighlight(e){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:i,hoveredFeatureLayerName:n}=this.state,o=e.object,a=null,l=null;o&&(a=aO(o,r),l=L7(o));let{highlightColor:u}=this.props;typeof u=="function"&&(u=u(e)),(i!==a||n!==l)&&this.setState({highlightColor:u,hoveredFeatureId:a,hoveredFeatureLayerName:l})}getPickingInfo(e){let r=super.getPickingInfo(e),i=Boolean(this.context.viewport.resolution);if(this.state.binary&&r.index!==-1){let{data:n}=e.sourceLayer.props;r.object=iS(n,{globalFeatureId:r.index})}return r.object&&!i&&(r.object=N7(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(e){return{highlightedObjectIndex:this.getHighlightedObjectIndex(e),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(e){let{hoveredFeatureId:r,hoveredFeatureLayerName:i,binary:n}=this.state,{uniqueIdProperty:o,highlightedFeatureId:a}=this.props,l=e.content,u=F7(a);if(!(F7(r)||u))return-1;let _=u?a:r;return Array.isArray(l)?l.findIndex(w=>{let E=aO(w,o)===_,M=u||L7(w)===i;return E&&M}):l&&n?oO(l,o,_,u?"":i):-1}_pickObjects(e){let{deck:r,viewport:i}=this.context,n=i.width,o=i.height,a=i.x,l=i.y,u=[this.id];return r.pickObjects({x:a,y:l,width:n,height:o,layerIds:u,maxObjects:e})}getRenderedFeatures(e=null){let r=this._pickObjects(e),i=new Set,n=[];for(let o of r){let a=aO(o.object,this.props.uniqueIdProperty);a===void 0?n.push(o.object):i.has(a)||(i.add(a),n.push(o.object))}return n}_setWGS84PropertyForTiles(){let e="dataInWGS84";this.state.tileset.selectedTiles.forEach(i=>{i.hasOwnProperty(e)||Object.defineProperty(i,e,{get:()=>{if(!i.content)return null;if(this.state.binary&&Array.isArray(i.content)&&!i.content.length)return[];let{bbox:n}=i;if(i._contentWGS84===void 0&&yR(n)){let o=this.state.binary?iS(i.content):i.content;i._contentWGS84=o.map(a=>N7(a,n,this.context.viewport))}return i._contentWGS84}})})}},y1=cS;(()=>{cS.layerName="MVTLayer"})(),(()=>{cS.defaultProps=C0e})();function aO(t,e){if(t.properties&&e)return t.properties[e];if("id"in t)return t.id}function L7(t){return t.properties?.layerName||null}function F7(t){return t!=null&&t!==""}function N7(t,e,r){let i={...t,geometry:{type:t.geometry.type}};return Object.defineProperty(i.geometry,"coordinates",{get:()=>O7(t.geometry,e,r).coordinates}),i}var k7="0123456789bcdefghjkmnpqrstuvwxyz",U7={};for(let t=0;t<k7.length;t++)U7[k7.charAt(t)]=t;var M0e=-90,I0e=90,P0e=-180,R0e=180;function B0e(t){let e=!0,r=I0e,i=M0e,n=R0e,o=P0e,a,l=0;for(let u=0,f=t.length;u<f;u++){let _=t[u].toLowerCase();l=U7[_];for(let w=4;w>=0;w--){let E=l>>w&1;e?(a=(n+o)/2,E===1?o=a:n=a):(a=(r+i)/2,E===1?i=a:r=a),e=!e}}return[i,o,r,n]}function z7(t){let[e,r,i,n]=B0e(t);return[n,i,n,e,r,e,r,i,n,i]}var O0e={getGeohash:{type:"accessor",value:t=>t.geohash}},uS=class extends tu{indexToBounds(){let{data:e,getGeohash:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>z7(r(i,n))}}},v1=uS;(()=>{uS.layerName="GeohashLayer"})(),(()=>{uS.defaultProps=O0e})();function s_(t,e=""){if(!t)throw new Error(`JSON conversion error ${e}`)}function H7(t,e){let r=L0e(e),i=t;for(let n of r)i=D0e(i)?i[n]:void 0;return i}function D0e(t){return t!==null&&typeof t=="object"}var V7={};function L0e(t){if(typeof t=="string"){let e=V7[t];return e||(e=t.split("."),V7[t]=e),e}return Array.isArray(t)?t:[t]}var cO={};Gs(cO,{addBinaryOp:()=>z0e,addUnaryOp:()=>U0e,compile:()=>N0e,compileAsync:()=>k0e,eval:()=>ml,evalAsync:()=>b1,parse:()=>X7.default});var a_=sc(lO()),X7=sc(lO()),b1=function t(e,r){try{var i,n=e;switch(n.type){case"ArrayExpression":return Promise.resolve(G7(n.elements,r));case"BinaryExpression":return Promise.resolve(Promise.all([t(n.left,r),t(n.right,r)])).then(function(M){return l_[n.operator](M[0],M[1])});case"CallExpression":var o,a,l,u=function(){if(typeof a=="function"){var M=a,D=M.apply,j=o;return Promise.resolve(G7(n.arguments,r)).then(function(V){return Promise.resolve(D.call(M,j,V))})}},f=n.callee.type==="MemberExpression"?Promise.resolve(j7(n.callee,r)).then(function(M){o=(l=M)[0],a=l[1]}):Promise.resolve(t(n.callee,r)).then(function(M){a=M});return Promise.resolve(f&&f.then?f.then(u):u());case"ConditionalExpression":return Promise.resolve(t(n.test,r)).then(function(M){return Promise.resolve(t(M?n.consequent:n.alternate,r))});case"Identifier":return Promise.resolve(r[n.name]);case"Literal":return Promise.resolve(n.value);case"LogicalExpression":var _=function(M){return i?M:Promise.resolve(Promise.all([t(n.left,r),t(n.right,r)])).then(function(D){return l_[n.operator](D[0],D[1])})},w=n.operator==="||"?(i=1,Promise.resolve(t(n.left,r)).then(function(M){return M||Promise.resolve(t(n.right,r))})):function(){if(n.operator==="&&")return i=1,Promise.resolve(t(n.left,r)).then(function(M){return M&&Promise.resolve(t(n.right,r))})}();return Promise.resolve(w&&w.then?w.then(_):_(w));case"MemberExpression":return Promise.resolve(j7(n,r)).then(function(M){return M[1]});case"ThisExpression":return Promise.resolve(r);case"UnaryExpression":var E=fS[n.operator];return Promise.resolve(t(n.argument,r)).then(function(M){return E.call(fS,M)});default:return Promise.resolve(void 0)}}catch(M){return Promise.reject(M)}},j7=function(t,e){try{return Promise.resolve(b1(t.object,e)).then(function(r){function i(){if(/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[r,r[n]]}var n,o=function(){if(t.computed)return Promise.resolve(b1(t.property,e)).then(function(a){n=a});n=t.property.name}();return o&&o.then?o.then(i):i()})}catch(r){return Promise.reject(r)}},G7=function(t,e){try{return Promise.resolve(Promise.all(t.map(function(r){return b1(r,e)})))}catch(r){return Promise.reject(r)}},F0e={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},l_={"||":function(t,e){return t||e},"&&":function(t,e){return t&&e},"|":function(t,e){return t|e},"^":function(t,e){return t^e},"&":function(t,e){return t&e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e},"<":function(t,e){return t<e},">":function(t,e){return t>e},"<=":function(t,e){return t<=e},">=":function(t,e){return t>=e},"<<":function(t,e){return t<<e},">>":function(t,e){return t>>e},">>>":function(t,e){return t>>>e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e}},fS={"-":function(t){return-t},"+":function(t){return+t},"~":function(t){return~t},"!":function(t){return!t}};function W7(t,e){return t.map(function(r){return ml(r,e)})}function q7(t,e){var r,i=ml(t.object,e);if(r=t.computed?ml(t.property,e):t.property.name,/^__proto__|prototype|constructor$/.test(r))throw Error('Access to member "'+r+'" disallowed.');return[i,i[r]]}function ml(t,e){var r=t;switch(r.type){case"ArrayExpression":return W7(r.elements,e);case"BinaryExpression":return l_[r.operator](ml(r.left,e),ml(r.right,e));case"CallExpression":var i,n,o;return r.callee.type==="MemberExpression"?(i=(o=q7(r.callee,e))[0],n=o[1]):n=ml(r.callee,e),typeof n!="function"?void 0:n.apply(i,W7(r.arguments,e));case"ConditionalExpression":return ml(r.test,e)?ml(r.consequent,e):ml(r.alternate,e);case"Identifier":return e[r.name];case"Literal":return r.value;case"LogicalExpression":return r.operator==="||"?ml(r.left,e)||ml(r.right,e):r.operator==="&&"?ml(r.left,e)&&ml(r.right,e):l_[r.operator](ml(r.left,e),ml(r.right,e));case"MemberExpression":return q7(r,e)[1];case"ThisExpression":return e;case"UnaryExpression":return fS[r.operator](ml(r.argument,e));default:return}}function N0e(t){return ml.bind(null,(0,a_.default)(t))}function k0e(t){return b1.bind(null,(0,a_.default)(t))}function U0e(t,e){a_.default.addUnaryOp(t),fS[t]=e}function z0e(t,e,r){r?(a_.default.addBinaryOp(t,e),l_[t]=r):(a_.default.addBinaryOp(t,F0e[t]||1),l_[t]=e)}var{parse:V0e,eval:H0e}=cO,uO={"-":t=>t};function Rm(t,e){if(t in uO)return uO[t];let r,i=V0e(t);return i.type==="Identifier"?r=n=>H7(n,t):(hO(i,n=>{if(n.type==="CallExpression")throw new Error("Function calls not allowed in JSON expressions")}),r=n=>H0e(i,n)),uO[t]=r,r}function hO(t,e){if(Array.isArray(t))t.forEach(r=>hO(r,e));else if(t&&typeof t=="object"){t.type&&e(t);for(let r in t)hO(t[r],e)}}var c_="@@=",fO="@@#",Y7="@@type",dS="@@function";var K7=t=>t&&typeof t=="object",Bd=class{constructor(...e){this.typeKey=Y7,this.functionKey=dS,this.log=console,this.classes={},this.reactComponents={},this.enumerations={},this.constants={},this.functions={},this.React=null,this.convertFunction=Rm,this.preProcessClassProps=(r,i)=>i,this.postProcessConvertedJson=r=>r;for(let r of e)this.merge(r)}merge(e){for(let r in e)switch(r){case"layers":case"views":Object.assign(this.classes,e[r]);break;default:if(r in this){let i=e[r];this[r]=K7(this[r])?Object.assign(this[r],i):i}}}validate(e){return s_(!this.typeKey||typeof this.typeKey=="string"),s_(K7(this.classes)),!0}};function j0e(t){return typeof t=="string"&&t.startsWith(c_)}function G0e(t){return t.replace(c_,"")}function u_(t,e){let r={};for(let i in t){let n=t[i];j0e(n)&&(n=G0e(n),n=Rm(n,e)),r[i]=n}return r}function Z7(t,e,r){let i=r.classes[t],n=r.reactComponents[t];if(!i&&!n){let{log:o}=r;if(o){let a=JSON.stringify(e,null,0).slice(0,40);o.warn(`JSON converter: No registered class of type ${t}(${a}...) `)}return null}return i?W0e(i,e,r):q0e(n,e,r)}function W0e(t,e,r){return r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r)),e=u_(e,r),new t(e)}function q0e(t,e,r){let{React:i}=r,{children:n=[]}=e;return delete e.children,r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r)),e=u_(e,r),i.createElement(t,e,n)}function J7(t,e,r){let i=r.functions[t];if(!i){let{log:n}=r;if(n){let o=JSON.stringify(e,null,0).slice(0,40);n.warn(`JSON converter: No registered function ${t}(${o}...) `)}return null}return i(e)}function dO(t){return typeof t=="string"?JSON.parse(t):t}var pO=t=>t&&typeof t=="object",Bm=class{constructor(e){this.log=console,this.onJSONChange=()=>{},this.json=null,this.convertedJson=null,this.setProps(e)}finalize(){}setProps(e){"configuration"in e&&(this.configuration=e.configuration instanceof Bd?e.configuration:new Bd(e.configuration)),"onJSONChange"in e&&(this.onJSONChange=e.onJSONChange)}mergeConfiguration(e){this.configuration.merge(e)}convert(e){if(!e||e===this.json)return this.convertedJson;this.json=e;let r=dO(e),i=X0e(r,this.configuration);return i=this.configuration.postProcessConvertedJson(i),this.convertedJson=i,i}convertJson(e){return this.convert(e)}};function X0e(t,e){return e=new Bd(e),AO(t,"",e)}function AO(t,e,r){return Array.isArray(t)?t.map((i,n)=>AO(i,String(n),r)):Y0e(t,r)?K0e(t,r):pO(t)?dS in t?Z0e(t,r):mO(t,r):typeof t=="string"?J0e(t,e,r):t}function Y0e(t,e){let{typeKey:r}=e;return pO(t)&&Boolean(t[r])}function K0e(t,e){let{typeKey:r}=e,i=t[r],n={...t};return delete n[r],n=mO(n,e),Z7(i,n,e)}function Z0e(t,e){let{functionKey:r}=e,i=t[r],n={...t};return delete n[r],n=mO(n,e),J7(i,n,e)}function mO(t,e){s_(pO(t));let r={};for(let i in t){let n=t[i];r[i]=AO(n,i,e)}return r}function J0e(t,e,r){if(t.startsWith(c_)&&r.convertFunction)return t=t.replace(c_,""),r.convertFunction(t,r);if(t.startsWith(fO)){if(t=t.replace(fO,""),r.constants[t])return r.constants[t];let[i,n]=t.split(".");return r.enumerations[i][n]}return t}var h_={onInitialize:t=>t,onFinalize:t=>t,onMessage:t=>t},Mf=class{static setCallbacks({onInitialize:e,onFinalize:r,onMessage:i}){e&&(h_.onInitialize=e),r&&(h_.onFinalize=r),i&&(h_.onMessage=i)}constructor(e="Transport"){this._messageQueue=[],this.userData={},this._destroyed=!1,this.name=e}getRootDOMElement(){return typeof document<"u"?document.body:null}sendJSONMessage(){console.error("Back-channel not implemented for this transport")}sendBinaryMessage(){console.error("Back-channel not implemented for this transport")}_initialize(e={}){let r={transport:this,...e};h_.onInitialize(r)}_finalize(e={}){let r={transport:this,...e};h_.onFinalize(r),this._destroyed=!0}_messageReceived(e={}){e={transport:this,...e},console.debug("Delivering transport message",e),h_.onMessage(e)}static _stringifyJSONSafe(e){let r=new Set;return JSON.stringify(e,(i,n)=>{if(typeof n=="object"&&n!==null){if(r.has(n))try{return JSON.parse(JSON.stringify(n))}catch{return}r.add(n)}return n})}};function Q7(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null||Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(!(r in e)||t[r]!==e[r])return!1;for(let r in e)if(!(r in t))return!1;return!0}var pS=class{constructor(e){this.map=null,this.width=0,this.height=0,this.props={...e},this._initialize(this.props)}finalize(){this.map?.remove(),this.map=null}setProps(e){let r=this.props,i={...this.props,...e};if(this.props=i,!this.map)return;this._update(r,i)&&this.redraw()}redraw(){let e=this.map;e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}getMap(){return this.map}_initialize(e){let{mapLib:r}=e;r.accessToken=e.mapboxApiAccessToken||"",this.map=new e.mapLib.Map({maxZoom:24,...e.mapOptions,...$7(e.viewState),style:e.mapStyle,interactive:!1,trackResize:!1});let{container:i}=e;Object.defineProperty(i,"offsetWidth",{get:()=>this.width}),Object.defineProperty(i,"clientWidth",{get:()=>this.width}),Object.defineProperty(i,"offsetHeight",{get:()=>this.height}),Object.defineProperty(i,"clientHeight",{get:()=>this.height}),this.map.resize()}_update(e,r){e.mapStyle!==r.mapStyle&&this.map.setStyle(r.mapStyle);let n=e.width!==r.width||e.height!==r.height;n&&(this.width=r.width,this.height=r.height,this.map.resize());let o=e.viewState,a=r.viewState,l=a.latitude!==o.latitude||a.longitude!==o.longitude||a.zoom!==o.zoom||a.pitch!==o.pitch||a.bearing!==o.bearing;return l&&this.map.jumpTo($7(a)),n||l}};function $7(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}var eG={position:"absolute",left:0,top:0,width:"100%",height:"100%"};function Q0e(t){let{container:e=document.body}=t;if(typeof e=="string"&&(e=document.getElementById(e)),!e)throw Error("Deck: container not found");window.getComputedStyle(e).position==="static"&&(e.style.position="relative");let i=document.createElement("div");e.appendChild(i),Object.assign(i.style,eG);let n=document.createElement("canvas");return e.appendChild(n),Object.assign(n.style,eG),{container:e,mapCanvas:i,deckCanvas:n}}var Om=class extends pd{constructor(e){if(typeof document>"u")throw Error("Deck can only be used in the browser");let{mapCanvas:r,deckCanvas:i}=Q0e(e),n=e.viewState||e.initialViewState,o=Number.isFinite(n&&n.latitude),{map:a=globalThis.mapboxgl||globalThis.maplibregl}=e;super({canvas:i,...e}),a&&a.Map?this._map=o&&new pS({...e,width:0,height:0,viewState:n,container:r,mapLib:a}):this._map=a}getMapboxMap(){return this._map&&this._map.getMap()}finalize(){this._map&&this._map.finalize(),super.finalize()}setProps(e){"mapStyle"in e&&this._map&&this._map.setProps({mapStyle:e.mapStyle}),super.setProps(e)}_drawLayers(e,r){if(this._map){let i=this.getViewports()[0];i&&this._map.setProps({width:i.width,height:i.height,viewState:i})}super._drawLayers(e,r)}};Xc.registerDevices([hf]);var tG=t=>t.charAt(0)===t.charAt(0).toUpperCase(),$0e=t=>t.charAt(0)===t.charAt(0).toLowerCase()&&t.charAt(0)!=="_";function gO(t={},e){let r={},i=Object.keys(t).filter(e);for(let n of i)r[n]=t[n];return r}var e_e={classes:gO(w1,tG),enumerations:{COORDINATE_SYSTEM:ni,GL:af}};hA([uy]);var Lp=new Bm({configuration:e_e});function t_e(t,e){let r={classes:gO(t,tG),functions:gO(t,$0e)};e.mergeConfiguration(r)}function r_e(t,e){if(!t)return;let r={};function i(){Object.values(r).every(o=>o)&&typeof e=="function"&&e()}function n(o,a){t_e(a,Lp),r[o]=a,i()}t.forEach(({libraryName:o,resourceUri:a})=>{if(r[o]=!1,o in window){n(o,window[o]);return}Object.defineProperty(window,o,{set:l=>n(o,l),get:()=>r[o]}),w4(a)})}function rG(t,e){let r=Lp.convert(t);e.setProps(r)}function i_e(t,e){return t.filter(r=>r&&r.id&&!e.find(i=>i.id===r.id))}function n_e({mapProvider:t,props:e,mapboxApiKey:r,googleMapsKey:i,handleEvent:n,getTooltip:o,container:a}){let u={...n?{onClick:f=>n("deck-click-event",f),onHover:f=>n("deck-hover-event",f),onResize:f=>n("deck-resize-event",f),onViewStateChange:({viewState:f,interactionState:_,oldViewState:w})=>{let E=new Ic(f);f.nw=E.unproject([0,0]),f.se=E.unproject([E.width,E.height]),n("deck-view-state-change-event",f)},onDragStart:f=>n("deck-drag-start-event",f),onDrag:f=>n("deck-drag-event",f),onDragEnd:f=>n("deck-drag-end-event",f)}:null,getTooltip:o,container:a};switch(t){case"mapbox":return br.info("Using Mapbox base maps")(),new Om({...u,...e,map:OM,mapboxApiAccessToken:r,onLoad:b4});case"carto":return br.info("Using Carto base maps")(),new Om({map:OM,...u,...e});case"google_maps":return br.info("Using Google Maps base maps")(),KU({...u,...e,googleMapsKey:i});default:return br.info("No recognized map provider specified")(),new Om({...u,...e,map:null,mapboxApiAccessToken:null})}}function AS({mapboxApiKey:t,googleMapsKey:e,container:r,jsonInput:i,tooltip:n,handleEvent:o,customLibraries:a,configuration:l}){let u;try{l&&Lp.mergeConfiguration(l);let f=i.layers||[],_=Lp.convert(i);p3(r,_);let w=(_.layers||[]).filter(V=>V),E=i_e(f,w),M=PM(n),{mapProvider:D}=_;u=n_e({mapProvider:D,props:_,mapboxApiKey:t,googleMapsKey:e,handleEvent:o,getTooltip:M,container:r}),r_e(a,()=>{if(E.length){let $=(Lp.convert({layers:i.layers}).layers||[]).filter(te=>te);$.length>w.length&&u.setProps({layers:$})}})}catch(f){console.error(f)}return u}function mS(){Mf.setCallbacks({onInitialize({transport:t}){let{width:e,height:r,customLibraries:i,mapboxApiKey:n,jsonInput:o,tooltip:a}=l_e(t);x4();let l=t.getRootDOMElement(),u=_4(e,r);l.appendChild(u);let f=JSON.parse(o),_=AS({mapboxApiKey:n,container:u,jsonInput:f,tooltip:a,handleEvent:(w,E)=>a_e(t,w,E),customLibraries:i});t.userData.deck=_},onFinalize({transport:t}){let{deck:e}=t.userData;e.finalize()},onMessage({transport:t,type:e,json:r,binary:i}){let{deck:n}=t.userData,o;switch(e){case"json":o=Lp.convert(r),n.setProps(o);break;case"json-with-binary":o=Lp.convert(r);let a=t.jupyterModel.get("data_buffer"),l=o_e({binary:a,convertedJson:o});n.setProps(l);break;default:}}})}function o_e({binary:t,convertedJson:e}){for(let r=0;r<e.layers.length;r++){let i=e.layers[r].id,n=e.layers[r];e.layers[r]=n.clone({data:t[i]})}return e}function s_e(t,e){return e instanceof Yn?e.id:e}function a_e(t,e,r){if(e==="hover"&&!r.picked&&r.index===-1)return;let i=JSON.parse(JSON.stringify(r,s_e));t.sendJSONMessage(e,i)}function l_e(t){let{jupyterModel:e}=t;if(!e)throw new Error("deck.gl playground currently only works with the Jupyter Widget Transport");return{width:e.get("width"),height:e.get("height"),customLibraries:e.get("custom_libraries"),mapboxApiKey:e.get("mapbox_key"),jsonInput:e.get("json_input"),tooltip:e.get("tooltip")}}var Dm=class extends Mf{constructor(){super("Jupyter Transport (JavaScript <=> Jupyter Kernel)"),this.jupyterModel=null,this.jupyterView=null}getRootDOMElement(){return this.jupyterView.el}sendJSONMessage(e,r){let i=Mf._stringifyJSONSafe({type:e,data:r});this.jupyterModel.send(i)}};var H1={};Gs(H1,{CONTROL_COMM_PROTOCOL_VERSION:()=>GX,CONTROL_COMM_TARGET:()=>jX,CONTROL_COMM_TIMEOUT:()=>WX,DOMWidgetModel:()=>SD,DOMWidgetView:()=>CD,IJupyterWidgetRegistry:()=>Cwe,JUPYTER_WIDGETS_VERSION:()=>CS,JupyterPhosphorPanelWidget:()=>ywe,JupyterPhosphorWidget:()=>TY,LayoutModel:()=>vwe,LayoutView:()=>xwe,ManagerBase:()=>Qbe,PROTOCOL_VERSION:()=>MS,StyleModel:()=>bwe,StyleView:()=>wwe,ViewList:()=>Swe,WidgetModel:()=>Gm,WidgetView:()=>B_,WrappedError:()=>Kbe,assign:()=>Od,base64ToBuffer:()=>jO,bufferToBase64:()=>HO,bufferToHex:()=>Jbe,difference:()=>SS,hexToBuffer:()=>VO,isEqual:()=>x_,put_buffers:()=>Fp,reject:()=>Rf,remove_buffers:()=>O1,resolvePromisesDict:()=>b_,serialize_state:()=>qX,shims:()=>MD,unpack_models:()=>V1,uuid:()=>B1});var ES=sc(oG());var sG;(function(t){t.emptyObject=Object.freeze({}),t.emptyArray=Object.freeze([]);function e(_){return _===null||typeof _=="boolean"||typeof _=="number"||typeof _=="string"}t.isPrimitive=e;function r(_){return Array.isArray(_)}t.isArray=r;function i(_){return!e(_)&&!r(_)}t.isObject=i;function n(_,w){if(_===w)return!0;if(e(_)||e(w))return!1;var E=r(_),M=r(w);return E!==M?!1:E&&M?a(_,w):l(_,w)}t.deepEqual=n;function o(_){return e(_)?_:r(_)?u(_):f(_)}t.deepCopy=o;function a(_,w){if(_===w)return!0;if(_.length!==w.length)return!1;for(var E=0,M=_.length;E<M;++E)if(!n(_[E],w[E]))return!1;return!0}function l(_,w){if(_===w)return!0;for(var E in _)if(_[E]!==void 0&&!(E in w))return!1;for(var E in w)if(w[E]!==void 0&&!(E in _))return!1;for(var E in _){var M=_[E],D=w[E];if(!(M===void 0&&D===void 0)&&(M===void 0||D===void 0||!n(M,D)))return!1}return!0}function u(_){for(var w=new Array(_.length),E=0,M=_.length;E<M;++E)w[E]=o(_[E]);return w}function f(_){var w={};for(var E in _){var M=_[E];M!==void 0&&(w[E]=o(M))}return w}})(sG||(sG={}));var Eat=function(){function t(){this._types=[],this._values=[]}return t.prototype.types=function(){return this._types.slice()},t.prototype.hasData=function(e){return this._types.indexOf(e)!==-1},t.prototype.getData=function(e){var r=this._types.indexOf(e);return r!==-1?this._values[r]:void 0},t.prototype.setData=function(e,r){this.clearData(e),this._types.push(e),this._values.push(r)},t.prototype.clearData=function(e){var r=this._types.indexOf(e);r!==-1&&(this._types.splice(r,1),this._values.splice(r,1))},t.prototype.clear=function(){this._types.length=0,this._values.length=0},t}(),aG=function(){function t(){var e=this;this.promise=new Promise(function(r,i){e._resolve=r,e._reject=i})}return t.prototype.resolve=function(e){var r=this._resolve;r(e)},t.prototype.reject=function(e){var r=this._reject;r(e)},t}(),vO;(function(t){t.getRandomValues=function(){var e=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof yg<"u"&&yO()||null;return e&&typeof e.getRandomValues=="function"?function(i){return e.getRandomValues(i)}:e&&typeof e.randomFillSync=="function"?function(i){return e.randomFillSync(i)}:e&&typeof e.randomBytes=="function"?function(i){for(var n=e.randomBytes(i.length),o=0,a=n.length;o<a;++o)i[o]=n[o]}:function(i){for(var n=0,o=0,a=i.length;o<a;++o)o%4===0&&(n=Math.random()*4294967295>>>0),i[o]=n&255,n>>>=8}}()})(vO||(vO={}));var lG=function(){function t(e){this.name=e,this._tokenStructuralPropertyT=null}return t}(),_S;(function(t){t.uuid4=function(){for(var e=new Uint8Array(16),r=new Array(256),i=0;i<16;++i)r[i]="0"+i.toString(16);for(var i=16;i<256;++i)r[i]=i.toString(16);return function(){return vO.getRandomValues(e),e[6]=64|e[6]&15,e[8]=128|e[8]&63,r[e[0]]+r[e[1]]+r[e[2]]+r[e[3]]+"-"+r[e[4]]+r[e[5]]+"-"+r[e[6]]+r[e[7]]+"-"+r[e[8]]+r[e[9]]+"-"+r[e[10]]+r[e[11]]+r[e[12]]+r[e[13]]+r[e[14]]+r[e[15]]}}()})(_S||(_S={}));var zX=sc(DX()),VX=sc(UX()),Ybe=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),TS=function(){return TS=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},TS.apply(this,arguments)};function SS(t,e){return t.filter(function(r){return e.indexOf(r)===-1})}function x_(t,e){return(0,zX.default)(t,e)}var Od=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};function B1(){return _S.uuid4()}var Kbe=function(t){Ybe(e,t);function e(r,i){var n=t.call(this,r)||this;return console.warn("WrappedError has been deprecated!"),i instanceof e?n.error_stack=i.error_stack:n.error_stack=[i],n.error_stack.push(n),n}return e}(Error);function b_(t){var e=Object.keys(t),r=[];return e.forEach(function(i){r.push(t[i])}),Promise.all(r).then(function(i){for(var n={},o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function Rf(t,e){return function(i){throw e&&console.error(new Error(t)),i}}function Fp(t,e,r){for(var i=0;i<e.length;i++){for(var n=e[i],o=t,a=0;a<n.length-1;a++)o=o[n[a]];o[n[n.length-1]]=r[i]}}function O1(t){var e=[],r=[];function i(o,a){if(o.toJSON&&(o=o.toJSON()),Array.isArray(o))for(var l=!1,u=0;u<o.length;u++){var f=o[u];if(f)if(f instanceof ArrayBuffer||ArrayBuffer.isView(f))l||(o=o.slice(),l=!0),e.push(ArrayBuffer.isView(f)?f.buffer:f),r.push(a.concat([u])),o[u]=null;else{var _=i(f,a.concat([u]));_!==f&&(l||(o=o.slice(),l=!0),o[u]=_)}}else if((0,VX.default)(o))for(var w in o){var l=!1;if(o.hasOwnProperty(w)){var f=o[w];if(f)if(f instanceof ArrayBuffer||ArrayBuffer.isView(f))l||(o=TS({},o),l=!0),e.push(ArrayBuffer.isView(f)?f.buffer:f),r.push(a.concat([w])),delete o[w];else{var _=i(f,a.concat([w]));_!==f&&(l||(o=TS({},o),l=!0),o[w]=_)}}}return o}var n=i(t,[]);return{state:n,buffers:e,buffer_paths:r}}var Zbe=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"];function Jbe(t){for(var e=new Uint8Array(t),r=[],i=0;i<e.length;i++)r.push(Zbe[e[i]]);return r.join("")}function VO(t){for(var e=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)e[r/2]=parseInt(t.slice(r,r+2),16);return e.buffer}function HO(t){return(0,ES.fromByteArray)(new Uint8Array(t))}function jO(t){return(0,ES.toByteArray)(t).buffer}var CS="1.2.0",MS="2.1.0";var D1=function(){return D1=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},D1.apply(this,arguments)},Np=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(_){try{f(i.next(_))}catch(w){a(w)}}function u(_){try{f(i.throw(_))}catch(w){a(w)}}function f(_){_.done?o(_.value):n(_.value).then(l,u)}f((i=i.apply(t,e||[])).next())})},kp=function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(f){return function(_){return u([f,_])}}function u(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(o=f[0]&2?n.return:f[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,f[1])).done)return o;switch(n=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,n=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(_){f=[6,_],n=0}finally{i=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},HX=MS.split(".",1)[0],jX="jupyter.widget.control",GX="1.0.0",WX=4e3,Qbe=function(){function t(){this.comm_target_name="jupyter.widget",this._models=Object.create(null)}return t.prototype.display_model=function(e,r,i){var n=this;return i===void 0&&(i={}),this.create_view(r,i).then(function(o){return n.display_view(e,o,i)}).catch(Rf("Could not create view",!0))},t.prototype.setViewOptions=function(e){return e===void 0&&(e={}),e},t.prototype.create_view=function(e,r){var i=this;r===void 0&&(r={});var n=e.state_change=e.state_change.then(function(){return i.loadClass(e.get("_view_name"),e.get("_view_module"),e.get("_view_module_version")).then(function(a){var l=new a({model:e,options:i.setViewOptions(r)});return l.listenTo(e,"destroy",l.remove),Promise.resolve(l.render()).then(function(){return l})}).catch(Rf("Could not create a view for model id "+e.model_id,!0))}),o=B1();return e.views[o]=n,n.then(function(a){a.once("remove",function(){delete a.model.views[o]},i)}),e.state_change},t.prototype.callbacks=function(e){return{}},t.prototype.get_model=function(e){return this._models[e]},t.prototype.has_model=function(e){return this._models[e]!==void 0},t.prototype.handle_comm_open=function(e,r){var i=(r.metadata||{}).version||"";if(i.split(".",1)[0]!==HX){var n="Wrong widget protocol version: received protocol version '"+i+"', but was expecting major version '"+HX+"'";return console.error(n),Promise.reject(n)}var o=r.content.data,a=o.buffer_paths||[],l=(r.buffers||[]).map(function(u){return u instanceof DataView?u:new DataView(u instanceof ArrayBuffer?u:u.buffer)});return Fp(o.state,a,l),this.new_model({model_name:o.state._model_name,model_module:o.state._model_module,model_module_version:o.state._model_module_version,comm:e},o.state).catch(Rf("Could not create a model.",!0))},t.prototype.new_widget=function(e,r){var i=this;r===void 0&&(r={});var n;if(e.view_name===void 0||e.view_module===void 0||e.view_module_version===void 0)return Promise.reject("new_widget(...) must be given view information in the options.");e.comm?n=Promise.resolve(e.comm):n=this._create_comm(this.comm_target_name,e.model_id,{state:{_model_module:e.model_module,_model_module_version:e.model_module_version,_model_name:e.model_name,_view_module:e.view_module,_view_module_version:e.view_module_version,_view_name:e.view_name}},{version:MS});var o=D1({},e);return n.then(function(a){o.comm=a;var l=i.new_model(o,r);return l.then(function(u){return u.sync("create",u),u})},function(){return o.model_id||(o.model_id=B1()),i.new_model(o,r)})},t.prototype.register_model=function(e,r){var i=this;this._models[e]=r,r.then(function(n){n.once("comm:close",function(){delete i._models[e]})})},t.prototype.new_model=function(e,r){return r===void 0&&(r={}),Np(this,void 0,void 0,function(){var i,n;return kp(this,function(o){switch(o.label){case 0:if(e.model_id)i=e.model_id;else if(e.comm)i=e.model_id=e.comm.comm_id;else throw new Error("Neither comm nor model_id provided in options object. At least one must exist.");return n=this._make_model(e,r),this.register_model(i,n),[4,n];case 1:return[2,o.sent()]}})})},t.prototype._make_model=function(e,r){return r===void 0&&(r={}),Np(this,void 0,void 0,function(){var i,n,o,a,l,u,f;return kp(this,function(_){switch(_.label){case 0:i=e.model_id,n=this.loadClass(e.model_name,e.model_module,e.model_module_version),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,n];case 2:return o=_.sent(),[3,4];case 3:throw a=_.sent(),console.error("Could not instantiate widget"),a;case 4:if(!o)throw new Error("Cannot find model module "+e.model_module+"@"+e.model_module_version+", "+e.model_name);return[4,o._deserialize_state(r,this)];case 5:return l=_.sent(),u={widget_manager:this,model_id:i,comm:e.comm},f=new o(l,u),f.name=e.model_name,f.module=e.model_module,[2,f]}})})},t.prototype._loadFromKernel=function(){return Np(this,void 0,void 0,function(){var e,r,i,n,o,a,l,u,f,_,w,E,M,D=this;return kp(this,function(j){switch(j.label){case 0:return j.trys.push([0,3,,4]),[4,this._create_comm(jX,B1(),{},{version:GX})];case 1:return i=j.sent(),[4,new Promise(function(V,$){i.on_msg(function(te){if(e=te.content.data,e.method!=="update_states"){console.warn(`
|
|
3671
|
+
`},eS=class extends XA{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[vge],inject:xge}:{modules:[bge],inject:wge}}draw({uniforms:e}){let{clipBounds:r}=this.props;if(this.state.clipByInstance)e.clip_bounds=r;else{let i=this.projectPosition([r[0],r[1],0]),n=this.projectPosition([r[2],r[3],0]);e.clip_bounds=[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[0],n[0]),Math.max(i[1],n[1])]}}},i_=eS;(()=>{eS.defaultProps=yge})(),(()=>{eS.extensionName="ClipExtension"})();function KB(t,e,r){let i=Tge(t),n=Object.keys(i).filter(o=>i[o]!==Array);return Ege(t,{propArrayTypes:i,...e},{numericPropKeys:r&&r.numericPropKeys||n,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Tge(t){let e={};for(let r of t)if(r.properties)for(let i in r.properties){let n=r.properties[i];e[i]=Rge(n,e[i])}return e}function Ege(t,e,r){let{pointPositionsCount:i,pointFeaturesCount:n,linePositionsCount:o,linePathsCount:a,lineFeaturesCount:l,polygonPositionsCount:u,polygonObjectsCount:f,polygonRingsCount:_,polygonFeaturesCount:w,propArrayTypes:E,coordLength:M}=e,{numericPropKeys:D=[],PositionDataType:j=Float32Array,triangulate:V=!0}=r,$=t[0]&&"id"in t[0],te=t.length>65535?Uint32Array:Uint16Array,ne={type:"Point",positions:new j(i*M),globalFeatureIds:new te(i),featureIds:n>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},le={type:"LineString",pathIndices:o>65535?new Uint32Array(a+1):new Uint16Array(a+1),positions:new j(o*M),globalFeatureIds:new te(o),featureIds:l>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},z={type:"Polygon",polygonIndices:u>65535?new Uint32Array(f+1):new Uint16Array(f+1),primitivePolygonIndices:u>65535?new Uint32Array(_+1):new Uint16Array(_+1),positions:new j(u*M),globalFeatureIds:new te(u),featureIds:w>65535?new Uint32Array(u):new Uint16Array(u),numericProps:{},properties:[],fields:[]};V&&(z.triangles=[]);for(let Y of[ne,le,z])for(let X of D){let O=E[X];Y.numericProps[X]=new O(Y.positions.length/M)}le.pathIndices[a]=o,z.polygonIndices[f]=u,z.primitivePolygonIndices[_]=u;let ke={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let Y of t){let X=Y.geometry,O=Y.properties||{};switch(X.type){case"Point":Sge(X,ne,ke,M,O),ne.properties.push(YB(O,D)),$&&ne.fields.push({id:Y.id}),ke.pointFeature++;break;case"LineString":Cge(X,le,ke,M,O),le.properties.push(YB(O,D)),$&&le.fields.push({id:Y.id}),ke.lineFeature++;break;case"Polygon":Mge(X,z,ke,M,O),z.properties.push(YB(O,D)),$&&z.fields.push({id:Y.id}),ke.polygonFeature++;break;default:throw new Error("Invalid geometry type")}ke.feature++}return Pge(ne,le,z,M)}function Sge(t,e,r,i,n){e.positions.set(t.data,r.pointPosition*i);let o=t.data.length/i;ZB(e,n,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Cge(t,e,r,i,n){e.positions.set(t.data,r.linePosition*i);let o=t.data.length/i;ZB(e,n,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let a=0,l=t.indices.length;a<l;++a){let u=t.indices[a],f=a===l-1?t.data.length:t.indices[a+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(f-u)/i}}function Mge(t,e,r,i,n){e.positions.set(t.data,r.polygonPosition*i);let o=t.data.length/i;ZB(e,n,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let a=0,l=t.indices.length;a<l;++a){let u=r.polygonPosition;e.polygonIndices[r.polygonObject++]=u;let f=t.areas[a],_=t.indices[a],w=t.indices[a+1];for(let M=0,D=_.length;M<D;++M){let j=_[M],V=M===D-1?w===void 0?t.data.length:w[0]:_[M+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(V-j)/i}let E=r.polygonPosition;Ige(e,f,_,{startPosition:u,endPosition:E,coordLength:i})}}function Ige(t,e,r,{startPosition:i,endPosition:n,coordLength:o}){if(!t.triangles)return;let a=i*o,l=n*o,u=t.positions.subarray(a,l),f=r[0],_=r.slice(1).map(E=>(E-f)/o),w=g3(u,_,o,e);for(let E=0,M=w.length;E<M;++E)t.triangles.push(i+w[E])}function XB(t,e){let r={};for(let i in t)r[i]={value:t[i],size:e};return r}function Pge(t,e,r,i){let n={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:i},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:XB(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:i},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:XB(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:i},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:XB(r.numericProps,1)}};return n.polygons&&r.triangles&&(n.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),n}function ZB(t,e,r,i){for(let n in t.numericProps)if(n in e){let o=e[n];t.numericProps[n].fill(o,r,r+i)}}function YB(t,e){let r={};for(let i in t)e.includes(i)||(r[i]=t[i]);return r}function Rge(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function iS(t,e){let r=e?.globalFeatureId;return r!==void 0?Bge(t,r):Oge(t,e?.type)}function Bge(t,e){let r=p7(t);for(let i of r){let n=0,o=i.featureIds.value[0];for(let a=0;a<i.featureIds.value.length;a++){let l=i.featureIds.value[a];if(l!==o){if(e===i.globalFeatureIds.value[n])return tS(i,n,a);n=a,o=l}}if(e===i.globalFeatureIds.value[n])return tS(i,n,i.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function Oge(t,e){let r=p7(t,e);return Dge(r)}function d7(t,e,r){switch(t.type){case"Point":return kge(t,e,r);case"LineString":return Nge(t,e,r);case"Polygon":return A7(t,e,r);default:let i=t;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function p7(t,e){let r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function Dge(t){let e=[];for(let r of t){if(r.featureIds.value.length===0)continue;let i=0,n=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];a!==n&&(e.push(tS(r,i,o)),i=o,n=a)}e.push(tS(r,i,r.featureIds.value.length))}return e}function tS(t,e,r){let i=d7(t,e,r),n=Fge(t,e,r),o=Lge(t,e,r);return{type:"Feature",geometry:i,properties:n,...o}}function Lge(t,e=0,r){return t.fields&&t.fields[t.featureIds.value[e]]}function Fge(t,e=0,r){let i=Object.assign({},t.properties[t.featureIds.value[e]]);for(let n in t.numericProps)i[n]=t.numericProps[n].value[e];return i}function A7(t,e=-1/0,r=1/0){let{positions:i}=t,n=t.polygonIndices.value.filter(u=>u>=e&&u<=r),o=t.primitivePolygonIndices.value.filter(u=>u>=e&&u<=r);if(!(n.length>2)){let u=[];for(let f=0;f<o.length-1;f++){let _=o[f],w=o[f+1],E=rS(i,_,w);u.push(E)}return{type:"Polygon",coordinates:u}}let l=[];for(let u=0;u<n.length-1;u++){let f=n[u],_=n[u+1],w=A7(t,f,_).coordinates;l.push(w)}return{type:"MultiPolygon",coordinates:l}}function Nge(t,e=-1/0,r=1/0){let{positions:i}=t,n=t.pathIndices.value.filter(l=>l>=e&&l<=r);if(!(n.length>2))return{type:"LineString",coordinates:rS(i,n[0],n[1])};let a=[];for(let l=0;l<n.length-1;l++){let u=rS(i,n[l],n[l+1]);a.push(u)}return{type:"MultiLineString",coordinates:a}}function kge(t,e,r){let{positions:i}=t,n=rS(i,e,r);return n.length>1?{type:"MultiPoint",coordinates:n}:{type:"Point",coordinates:n[0]}}function rS(t,e,r){e=e||0,r=r||t.value.length/t.size;let i=[];for(let n=e;n<r;n++){let o=Array();for(let a=n*t.size;a<(n+1)*t.size;a++)o.push(Number(t.value[a]));i.push(o)}return i}var iO=sc(b7(),1);function w7(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let o=0;o<e;o++){let a=r0e(t[o]);a!==0&&(n===void 0&&(n=a<0),n===a<0?(i&&r.push(i),i=[t[o]]):i&&i.push(t[o]))}return i&&r.push(i),r}function r0e(t){let e=0;for(let r=0,i=t.length-1,n,o;r<t.length;i=r++)n=t[r],o=t[i],e+=(o[0]-n[0])*(n[1]+o[1]);return e}function T7(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?i0e(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function i0e(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}var Im=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(e,r,i,n,o){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(T7,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,i=1,n=0,o=0,a=0,l=[],u;for(;e.pos<r;){if(n<=0){let f=e.readVarint();i=f&7,n=f>>3}if(n--,i===1||i===2)o+=e.readSVarint(),a+=e.readSVarint(),i===1&&(u&&l.push(u),u=[]),u&&u.push([o,a]);else if(i===7)u&&u.push(u[0].slice());else throw new Error(`unknown command ${i}`)}return u&&l.push(u),l}bbox(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,i=1,n=0,o=0,a=0,l=1/0,u=-1/0,f=1/0,_=-1/0;for(;e.pos<r;){if(n<=0){let w=e.readVarint();i=w&7,n=w>>3}if(n--,i===1||i===2)o+=e.readSVarint(),a+=e.readSVarint(),o<l&&(l=o),o>u&&(u=o),a<f&&(f=a),a>_&&(_=a);else if(i!==7)throw new Error(`unknown command ${i}`)}return[l,f,u,_]}_toGeoJSON(e){let r=this.loadGeometry(),i=Im.types[this.type],n,o;switch(this.type){case 1:let l=[];for(n=0;n<r.length;n++)l[n]=r[n][0];r=l,e(r,this);break;case 2:for(n=0;n<r.length;n++)e(r[n],this);break;case 3:for(r=w7(r),n=0;n<r.length;n++)for(o=0;o<r[n].length;o++)e(r[n][o],this);break}r.length===1?r=r[0]:i=`Multi${i}`;let a={type:"Feature",geometry:{type:i,coordinates:r},properties:this.properties};return this.id!==null&&(a.id=this.id),a}toGeoJSON(e){if(typeof e=="function")return this._toGeoJSON(e);let{x:r,y:i,z:n}=e,o=this.extent*Math.pow(2,n),a=this.extent*r,l=this.extent*i;function u(f){for(let _=0;_<f.length;_++){let w=f[_];w[0]=(w[0]+a)*360/o-180;let E=180-(w[1]+l)*360/o;w[1]=360/Math.PI*Math.atan(Math.exp(E*Math.PI/180))-90}}return this._toGeoJSON(u)}};var d1=class{constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(n0e,this,r),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new Im(this._pbf,r,this.extent,this._keys,this._values)}};function n0e(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(o0e(r)))}function o0e(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}var p1=class{constructor(e,r){this.layers=e.readFields(s0e,{},r)}};function s0e(t,e,r){if(t===3&&r){let i=new d1(r,r.readVarint()+r.pos);i.length&&e&&(e[i.name]=i)}}function E7(t){let e=t.indices.length,r="Polygon";if(e<=1)return{type:r,data:t.data,areas:[[yp(t.data)]],indices:[t.indices]};let i=[],n=[],o=[],a=[],l,u=0;for(let f,_=0,w;_<e;_++){w=t.indices[_]-u,f=t.indices[_+1]-u||t.data.length;let E=t.data.slice(w,f),M=yp(E);if(M===0){let D=t.data.slice(0,w),j=t.data.slice(f);t.data=D.concat(j),u+=f-w;continue}l===void 0&&(l=M<0),l===M<0?(a.length&&(i.push(o),n.push(a)),a=[w],o=[M]):(o.push(M),a.push(w))}return o&&i.push(o),a.length&&n.push(a),{type:r,areas:i,indices:n,data:t.data}}function S7(t,e,r,i){for(let n=0,o=t.length;n<o;n+=2){t[n]=(t[n]+e)*360/i-180;let a=180-(t[n+1]+r)*360/i;t[n+1]=360/Math.PI*Math.atan(Math.exp(a*Math.PI/180))-90}}function C7(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?a0e(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function a0e(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}var M7,Pm,$B,sS,eO,tO,A1;var m1=class{constructor(e,r,i,n,o,a){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,this._geometryInfo=a,e.readFields(C7,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry,M7=e.readVarint()+e.pos,Pm=1,sS=0,eO=0,tO=0,A1=0;let r=[],i=[];for(;e.pos<M7;)if(sS<=0&&($B=e.readVarint(),Pm=$B&7,sS=$B>>3),sS--,Pm===1||Pm===2)eO+=e.readSVarint(),tO+=e.readSVarint(),Pm===1&&r.push(A1),i.push(eO,tO),A1+=2;else if(Pm===7){if(A1>0){let n=r[r.length-1];i.push(i[n],i[n+1]),A1+=2}}else throw new Error(`unknown command ${Pm}`);return{data:i,indices:r}}_toBinaryCoordinates(e){let r=this.loadGeometry(),i;e(r.data,this);let n=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=r.indices.length,i={type:"Point",...r};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=r.indices.length,this._geometryInfo.linePositionsCount+=r.data.length/n,i={type:"LineString",...r};break;case 3:i=E7(r),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=i.indices.length;for(let a of i.indices)this._geometryInfo.polygonRingsCount+=a.length;this._geometryInfo.polygonPositionsCount+=i.data.length/n;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:i,properties:this.properties};return this.id!==null&&(o.id=this.id),o}toBinaryCoordinates(e){if(typeof e=="function")return this._toBinaryCoordinates(e);let{x:r,y:i,z:n}=e,o=this.extent*Math.pow(2,n),a=this.extent*r,l=this.extent*i;return this._toBinaryCoordinates(u=>S7(u,a,l,o))}};var g1=class{constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(l0e,this,r),this.length=this._features.length}feature(e,r){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let i=this._pbf.readVarint()+this._pbf.pos;return new m1(this._pbf,i,this.extent,this._keys,this._values,r)}};function l0e(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(c0e(r)))}function c0e(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}var _1=class{constructor(e,r){this.layers=e.readFields(u0e,{},r)}};function u0e(t,e,r){if(t===3&&r){let i=new g1(r,r.readVarint()+r.pos);i.length&&e&&(e[i.name]=i)}}function aS(t,e){let r=f0e(e),i=e?.gis?.format||e?.mvt?.shape||e?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:rO(t,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:I7(t,r)};case"geojson":return I7(t,r);case"binary-geometry":return rO(t,r);case"binary":return rO(t,r);default:throw new Error(i||"undefined shape")}}function rO(t,e){let[r,i]=h0e(t,e),n=KB(r,i);return n.byteLength=t.byteLength,n}function h0e(t,e){let r=[],i={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[r,i];let n=new _1(new iO.default(t));return(e&&Array.isArray(e.layers)?e.layers:Object.keys(n.layers)).forEach(a=>{let l=n.layers[a];if(l)for(let u=0;u<l.length;u++){let f=l.feature(u,i),_=p0e(f,e,a);r.push(_)}}),[r,i]}function I7(t,e){if(t.byteLength<=0)return[];let r=[],i=new p1(new iO.default(t));return(Array.isArray(e.layers)?e.layers:Object.keys(i.layers)).forEach(o=>{let a=i.layers[o];if(a)for(let l=0;l<a.length;l++){let u=a.feature(l),f=d0e(u,e,o);r.push(f)}}),r}function f0e(t){if(!t?.mvt)throw new Error("mvt options required");let e=t.mvt?.coordinates==="wgs84",{tileIndex:r}=t.mvt,i=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(e&&!i)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.mvt}function d0e(t,e,r){let i=t.toGeoJSON(e.coordinates==="wgs84"?e.tileIndex:A0e);return e.layerProperty&&(i.properties[e.layerProperty]=r),i}function p0e(t,e,r){let i=t.toBinaryCoordinates(e.coordinates==="wgs84"?e.tileIndex:m0e);return e.layerProperty&&i.properties&&(i.properties[e.layerProperty]=r),i}function A0e(t,e){let{extent:r}=e;for(let i=0;i<t.length;i++){let n=t[i];n[0]/=r,n[1]/=r}}function m0e(t,e){let{extent:r}=e;for(let i=0,n=t.length;i<n;++i)t[i]/=r}var g0e="4.2.0-alpha.4",lS={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:g0e,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}}},_0e={...lS,parse:async(t,e)=>aS(t,e),parseSync:aS,binary:!0};var y0e={Point:P7,MultiPoint:v0e,LineString:R7,MultiLineString:x0e,Polygon:B7,MultiPolygon:b0e};function P7([t,e],[r,i],n){let o=Xa(r[0],i[0],t),a=Xa(r[1],i[1],e);return n.unprojectFlat([o,a])}function nO(t,e,r){return t.map(i=>P7(i,e,r))}function v0e(t,e,r){return nO(t,e,r)}function R7(t,e,r){return nO(t,e,r)}function x0e(t,e,r){return t.map(i=>R7(i,e,r))}function B7(t,e,r){return t.map(i=>nO(i,e,r))}function b0e(t,e,r){return t.map(i=>B7(i,e,r))}function O7(t,e,r){let i=r.projectFlat([e.west,e.north]),n=r.projectFlat([e.east,e.south]),o=[i,n];return{...t,coordinates:y0e[t.type](t.coordinates,o,r)}}var w0e=["points","lines","polygons"];function oO(t,e,r,i){for(let n of w0e){let o=t[n]&&T0e(t[n],e,r,i);if(o>=0)return o}return-1}function T0e(t,e,r,i){let n=t.featureIds.value;if(!n.length)return-1;let o=0,a=n[n.length-1]+1;if(i){let u=E0e(t,i);if(u)o=u[0],a=u[1]+1;else return-1}let l=-1;if(e in t.numericProps){let u=t.numericProps[e].value.findIndex((f,_)=>f===r&&n[_]>=o&&n[_]<a);return u>=0?t.globalFeatureIds.value[u]:-1}else e?l=D7(t.properties,u=>u[e]===r,o,a):t.fields&&(l=D7(t.fields,u=>u.id===r,o,a));return l>=0?S0e(t,l):-1}function E0e(t,e){if(!t.__layers){let r={},{properties:i}=t;for(let n=0;n<i.length;n++){let{layerName:o}=i[n];o&&(r[o]?r[o][1]=n:r[o]=[n,n])}t.__layers=r}return t.__layers[e]}function S0e(t,e){if(!t.__ids){let r=[],i=t.featureIds.value,n=t.globalFeatureIds.value;for(let o=0;o<i.length;o++)r[i[o]]=n[o];t.__ids=r}return t.__ids[e]}function D7(t,e,r,i){for(let n=r;n<i;n++)if(e(t[n],n))return n;return-1}var sO=512,C0e={...xf.defaultProps,data:Pp,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[lS],binary:!0},cS=class extends Tf{initializeState(){super.initializeState();let e=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:e,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:e,oldProps:r,context:i,changeFlags:n}){n.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:e,oldProps:r,context:i,changeFlags:n}),this._setWGS84PropertyForTiles());let{highlightColor:o}=e;o!==r.highlightColor&&Array.isArray(o)&&this.setState({highlightColor:o})}async _updateTileData(){let e=this.props.data,r=null;if(typeof e=="string"&&!_R(e)){let{onDataLoad:i,fetch:n}=this.props;this.setState({data:null,tileJSON:null});try{r=await n(e,{propName:"data",layer:this,loaders:[]})}catch(o){this.raiseError(o,"loading TileJSON"),e=null}i&&i(r,{propName:"data",layer:this})}else e&&typeof e=="object"&&"tilejson"in e&&(r=e);r&&(e=r.tiles),this.setState({data:e,tileJSON:r})}_getTilesetOptions(){let e=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:i,maxZoom:n}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>i&&(e.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(n)||r.maxzoom<n)&&(e.maxZoom=r.maxzoom)),e}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(e){let{data:r,binary:i}=this.state,{index:n,signal:o}=e,a=wf(r,e);if(!a)return Promise.reject("Invalid URL");let l=this.getLoadOptions(),{fetch:u}=this.props;return l={...l,mimeType:"application/x-protobuf",mvt:{...l?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:n},gis:i?{format:"binary"}:{}},u(a,{propName:"data",layer:this,loadOptions:l,signal:o})}renderSubLayers(e){let{x:r,y:i,z:n}=e.tile.index,o=Math.pow(2,n),a=sO/o,l=-a,u=sO*r/o,f=sO*(1-i/o),_=new ii().scale([a,l,1]);e.autoHighlight=!1,this.context.viewport.resolution||(e.modelMatrix=_,e.coordinateOrigin=[u,f,0],e.coordinateSystem=ni.CARTESIAN,e.extensions=[...e.extensions||[],new i_]);let w=super.renderSubLayers(e);return this.state.binary&&!(w instanceof xf)&&br.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),w}_updateAutoHighlight(e){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:i,hoveredFeatureLayerName:n}=this.state,o=e.object,a=null,l=null;o&&(a=aO(o,r),l=L7(o));let{highlightColor:u}=this.props;typeof u=="function"&&(u=u(e)),(i!==a||n!==l)&&this.setState({highlightColor:u,hoveredFeatureId:a,hoveredFeatureLayerName:l})}getPickingInfo(e){let r=super.getPickingInfo(e),i=Boolean(this.context.viewport.resolution);if(this.state.binary&&r.index!==-1){let{data:n}=e.sourceLayer.props;r.object=iS(n,{globalFeatureId:r.index})}return r.object&&!i&&(r.object=N7(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(e){return{highlightedObjectIndex:this.getHighlightedObjectIndex(e),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(e){let{hoveredFeatureId:r,hoveredFeatureLayerName:i,binary:n}=this.state,{uniqueIdProperty:o,highlightedFeatureId:a}=this.props,l=e.content,u=F7(a);if(!(F7(r)||u))return-1;let _=u?a:r;return Array.isArray(l)?l.findIndex(w=>{let E=aO(w,o)===_,M=u||L7(w)===i;return E&&M}):l&&n?oO(l,o,_,u?"":i):-1}_pickObjects(e){let{deck:r,viewport:i}=this.context,n=i.width,o=i.height,a=i.x,l=i.y,u=[this.id];return r.pickObjects({x:a,y:l,width:n,height:o,layerIds:u,maxObjects:e})}getRenderedFeatures(e=null){let r=this._pickObjects(e),i=new Set,n=[];for(let o of r){let a=aO(o.object,this.props.uniqueIdProperty);a===void 0?n.push(o.object):i.has(a)||(i.add(a),n.push(o.object))}return n}_setWGS84PropertyForTiles(){let e="dataInWGS84";this.state.tileset.selectedTiles.forEach(i=>{i.hasOwnProperty(e)||Object.defineProperty(i,e,{get:()=>{if(!i.content)return null;if(this.state.binary&&Array.isArray(i.content)&&!i.content.length)return[];let{bbox:n}=i;if(i._contentWGS84===void 0&&yR(n)){let o=this.state.binary?iS(i.content):i.content;i._contentWGS84=o.map(a=>N7(a,n,this.context.viewport))}return i._contentWGS84}})})}},y1=cS;(()=>{cS.layerName="MVTLayer"})(),(()=>{cS.defaultProps=C0e})();function aO(t,e){if(t.properties&&e)return t.properties[e];if("id"in t)return t.id}function L7(t){return t.properties?.layerName||null}function F7(t){return t!=null&&t!==""}function N7(t,e,r){let i={...t,geometry:{type:t.geometry.type}};return Object.defineProperty(i.geometry,"coordinates",{get:()=>O7(t.geometry,e,r).coordinates}),i}var k7="0123456789bcdefghjkmnpqrstuvwxyz",U7={};for(let t=0;t<k7.length;t++)U7[k7.charAt(t)]=t;var M0e=-90,I0e=90,P0e=-180,R0e=180;function B0e(t){let e=!0,r=I0e,i=M0e,n=R0e,o=P0e,a,l=0;for(let u=0,f=t.length;u<f;u++){let _=t[u].toLowerCase();l=U7[_];for(let w=4;w>=0;w--){let E=l>>w&1;e?(a=(n+o)/2,E===1?o=a:n=a):(a=(r+i)/2,E===1?i=a:r=a),e=!e}}return[i,o,r,n]}function z7(t){let[e,r,i,n]=B0e(t);return[n,i,n,e,r,e,r,i,n,i]}var O0e={getGeohash:{type:"accessor",value:t=>t.geohash}},uS=class extends tu{indexToBounds(){let{data:e,getGeohash:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>z7(r(i,n))}}},v1=uS;(()=>{uS.layerName="GeohashLayer"})(),(()=>{uS.defaultProps=O0e})();function s_(t,e=""){if(!t)throw new Error(`JSON conversion error ${e}`)}function H7(t,e){let r=L0e(e),i=t;for(let n of r)i=D0e(i)?i[n]:void 0;return i}function D0e(t){return t!==null&&typeof t=="object"}var V7={};function L0e(t){if(typeof t=="string"){let e=V7[t];return e||(e=t.split("."),V7[t]=e),e}return Array.isArray(t)?t:[t]}var cO={};Gs(cO,{addBinaryOp:()=>z0e,addUnaryOp:()=>U0e,compile:()=>N0e,compileAsync:()=>k0e,eval:()=>ml,evalAsync:()=>b1,parse:()=>X7.default});var a_=sc(lO()),X7=sc(lO()),b1=function t(e,r){try{var i,n=e;switch(n.type){case"ArrayExpression":return Promise.resolve(G7(n.elements,r));case"BinaryExpression":return Promise.resolve(Promise.all([t(n.left,r),t(n.right,r)])).then(function(M){return l_[n.operator](M[0],M[1])});case"CallExpression":var o,a,l,u=function(){if(typeof a=="function"){var M=a,D=M.apply,j=o;return Promise.resolve(G7(n.arguments,r)).then(function(V){return Promise.resolve(D.call(M,j,V))})}},f=n.callee.type==="MemberExpression"?Promise.resolve(j7(n.callee,r)).then(function(M){o=(l=M)[0],a=l[1]}):Promise.resolve(t(n.callee,r)).then(function(M){a=M});return Promise.resolve(f&&f.then?f.then(u):u());case"ConditionalExpression":return Promise.resolve(t(n.test,r)).then(function(M){return Promise.resolve(t(M?n.consequent:n.alternate,r))});case"Identifier":return Promise.resolve(r[n.name]);case"Literal":return Promise.resolve(n.value);case"LogicalExpression":var _=function(M){return i?M:Promise.resolve(Promise.all([t(n.left,r),t(n.right,r)])).then(function(D){return l_[n.operator](D[0],D[1])})},w=n.operator==="||"?(i=1,Promise.resolve(t(n.left,r)).then(function(M){return M||Promise.resolve(t(n.right,r))})):function(){if(n.operator==="&&")return i=1,Promise.resolve(t(n.left,r)).then(function(M){return M&&Promise.resolve(t(n.right,r))})}();return Promise.resolve(w&&w.then?w.then(_):_(w));case"MemberExpression":return Promise.resolve(j7(n,r)).then(function(M){return M[1]});case"ThisExpression":return Promise.resolve(r);case"UnaryExpression":var E=fS[n.operator];return Promise.resolve(t(n.argument,r)).then(function(M){return E.call(fS,M)});default:return Promise.resolve(void 0)}}catch(M){return Promise.reject(M)}},j7=function(t,e){try{return Promise.resolve(b1(t.object,e)).then(function(r){function i(){if(/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[r,r[n]]}var n,o=function(){if(t.computed)return Promise.resolve(b1(t.property,e)).then(function(a){n=a});n=t.property.name}();return o&&o.then?o.then(i):i()})}catch(r){return Promise.reject(r)}},G7=function(t,e){try{return Promise.resolve(Promise.all(t.map(function(r){return b1(r,e)})))}catch(r){return Promise.reject(r)}},F0e={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},l_={"||":function(t,e){return t||e},"&&":function(t,e){return t&&e},"|":function(t,e){return t|e},"^":function(t,e){return t^e},"&":function(t,e){return t&e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e},"<":function(t,e){return t<e},">":function(t,e){return t>e},"<=":function(t,e){return t<=e},">=":function(t,e){return t>=e},"<<":function(t,e){return t<<e},">>":function(t,e){return t>>e},">>>":function(t,e){return t>>>e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e}},fS={"-":function(t){return-t},"+":function(t){return+t},"~":function(t){return~t},"!":function(t){return!t}};function W7(t,e){return t.map(function(r){return ml(r,e)})}function q7(t,e){var r,i=ml(t.object,e);if(r=t.computed?ml(t.property,e):t.property.name,/^__proto__|prototype|constructor$/.test(r))throw Error('Access to member "'+r+'" disallowed.');return[i,i[r]]}function ml(t,e){var r=t;switch(r.type){case"ArrayExpression":return W7(r.elements,e);case"BinaryExpression":return l_[r.operator](ml(r.left,e),ml(r.right,e));case"CallExpression":var i,n,o;return r.callee.type==="MemberExpression"?(i=(o=q7(r.callee,e))[0],n=o[1]):n=ml(r.callee,e),typeof n!="function"?void 0:n.apply(i,W7(r.arguments,e));case"ConditionalExpression":return ml(r.test,e)?ml(r.consequent,e):ml(r.alternate,e);case"Identifier":return e[r.name];case"Literal":return r.value;case"LogicalExpression":return r.operator==="||"?ml(r.left,e)||ml(r.right,e):r.operator==="&&"?ml(r.left,e)&&ml(r.right,e):l_[r.operator](ml(r.left,e),ml(r.right,e));case"MemberExpression":return q7(r,e)[1];case"ThisExpression":return e;case"UnaryExpression":return fS[r.operator](ml(r.argument,e));default:return}}function N0e(t){return ml.bind(null,(0,a_.default)(t))}function k0e(t){return b1.bind(null,(0,a_.default)(t))}function U0e(t,e){a_.default.addUnaryOp(t),fS[t]=e}function z0e(t,e,r){r?(a_.default.addBinaryOp(t,e),l_[t]=r):(a_.default.addBinaryOp(t,F0e[t]||1),l_[t]=e)}var{parse:V0e,eval:H0e}=cO,uO={"-":t=>t};function Rm(t,e){if(t in uO)return uO[t];let r,i=V0e(t);return i.type==="Identifier"?r=n=>H7(n,t):(hO(i,n=>{if(n.type==="CallExpression")throw new Error("Function calls not allowed in JSON expressions")}),r=n=>H0e(i,n)),uO[t]=r,r}function hO(t,e){if(Array.isArray(t))t.forEach(r=>hO(r,e));else if(t&&typeof t=="object"){t.type&&e(t);for(let r in t)hO(t[r],e)}}var c_="@@=",fO="@@#",Y7="@@type",dS="@@function";var K7=t=>t&&typeof t=="object",Bd=class{constructor(...e){this.typeKey=Y7,this.functionKey=dS,this.log=console,this.classes={},this.reactComponents={},this.enumerations={},this.constants={},this.functions={},this.React=null,this.convertFunction=Rm,this.preProcessClassProps=(r,i)=>i,this.postProcessConvertedJson=r=>r;for(let r of e)this.merge(r)}merge(e){for(let r in e)switch(r){case"layers":case"views":Object.assign(this.classes,e[r]);break;default:if(r in this){let i=e[r];this[r]=K7(this[r])?Object.assign(this[r],i):i}}}validate(e){return s_(!this.typeKey||typeof this.typeKey=="string"),s_(K7(this.classes)),!0}};function j0e(t){return typeof t=="string"&&t.startsWith(c_)}function G0e(t){return t.replace(c_,"")}function u_(t,e){let r={};for(let i in t){let n=t[i];j0e(n)&&(n=G0e(n),n=Rm(n,e)),r[i]=n}return r}function Z7(t,e,r){let i=r.classes[t],n=r.reactComponents[t];if(!i&&!n){let{log:o}=r;if(o){let a=JSON.stringify(e,null,0).slice(0,40);o.warn(`JSON converter: No registered class of type ${t}(${a}...) `)}return null}return i?W0e(i,e,r):q0e(n,e,r)}function W0e(t,e,r){return r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r)),e=u_(e,r),new t(e)}function q0e(t,e,r){let{React:i}=r,{children:n=[]}=e;return delete e.children,r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r)),e=u_(e,r),i.createElement(t,e,n)}function J7(t,e,r){let i=r.functions[t];if(!i){let{log:n}=r;if(n){let o=JSON.stringify(e,null,0).slice(0,40);n.warn(`JSON converter: No registered function ${t}(${o}...) `)}return null}return i(e)}function dO(t){return typeof t=="string"?JSON.parse(t):t}var pO=t=>t&&typeof t=="object",Bm=class{constructor(e){this.log=console,this.onJSONChange=()=>{},this.json=null,this.convertedJson=null,this.setProps(e)}finalize(){}setProps(e){"configuration"in e&&(this.configuration=e.configuration instanceof Bd?e.configuration:new Bd(e.configuration)),"onJSONChange"in e&&(this.onJSONChange=e.onJSONChange)}mergeConfiguration(e){this.configuration.merge(e)}convert(e){if(!e||e===this.json)return this.convertedJson;this.json=e;let r=dO(e),i=X0e(r,this.configuration);return i=this.configuration.postProcessConvertedJson(i),this.convertedJson=i,i}convertJson(e){return this.convert(e)}};function X0e(t,e){return e=new Bd(e),AO(t,"",e)}function AO(t,e,r){return Array.isArray(t)?t.map((i,n)=>AO(i,String(n),r)):Y0e(t,r)?K0e(t,r):pO(t)?dS in t?Z0e(t,r):mO(t,r):typeof t=="string"?J0e(t,e,r):t}function Y0e(t,e){let{typeKey:r}=e;return pO(t)&&Boolean(t[r])}function K0e(t,e){let{typeKey:r}=e,i=t[r],n={...t};return delete n[r],n=mO(n,e),Z7(i,n,e)}function Z0e(t,e){let{functionKey:r}=e,i=t[r],n={...t};return delete n[r],n=mO(n,e),J7(i,n,e)}function mO(t,e){s_(pO(t));let r={};for(let i in t){let n=t[i];r[i]=AO(n,i,e)}return r}function J0e(t,e,r){if(t.startsWith(c_)&&r.convertFunction)return t=t.replace(c_,""),r.convertFunction(t,r);if(t.startsWith(fO)){if(t=t.replace(fO,""),r.constants[t])return r.constants[t];let[i,n]=t.split(".");return r.enumerations[i][n]}return t}var h_={onInitialize:t=>t,onFinalize:t=>t,onMessage:t=>t},Mf=class{static setCallbacks({onInitialize:e,onFinalize:r,onMessage:i}){e&&(h_.onInitialize=e),r&&(h_.onFinalize=r),i&&(h_.onMessage=i)}constructor(e="Transport"){this._messageQueue=[],this.userData={},this._destroyed=!1,this.name=e}getRootDOMElement(){return typeof document<"u"?document.body:null}sendJSONMessage(){console.error("Back-channel not implemented for this transport")}sendBinaryMessage(){console.error("Back-channel not implemented for this transport")}_initialize(e={}){let r={transport:this,...e};h_.onInitialize(r)}_finalize(e={}){let r={transport:this,...e};h_.onFinalize(r),this._destroyed=!0}_messageReceived(e={}){e={transport:this,...e},console.debug("Delivering transport message",e),h_.onMessage(e)}static _stringifyJSONSafe(e){let r=new Set;return JSON.stringify(e,(i,n)=>{if(typeof n=="object"&&n!==null){if(r.has(n))try{return JSON.parse(JSON.stringify(n))}catch{return}r.add(n)}return n})}};function Q7(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null||Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(!(r in e)||t[r]!==e[r])return!1;for(let r in e)if(!(r in t))return!1;return!0}var pS=class{constructor(e){this.map=null,this.width=0,this.height=0,this.props={...e},this._initialize(this.props)}finalize(){this.map?.remove(),this.map=null}setProps(e){let r=this.props,i={...this.props,...e};if(this.props=i,!this.map)return;this._update(r,i)&&this.redraw()}redraw(){let e=this.map;e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}getMap(){return this.map}_initialize(e){let{mapLib:r}=e;r.accessToken=e.mapboxApiAccessToken||"",this.map=new e.mapLib.Map({maxZoom:24,...e.mapOptions,...$7(e.viewState),style:e.mapStyle,interactive:!1,trackResize:!1});let{container:i}=e;Object.defineProperty(i,"offsetWidth",{get:()=>this.width}),Object.defineProperty(i,"clientWidth",{get:()=>this.width}),Object.defineProperty(i,"offsetHeight",{get:()=>this.height}),Object.defineProperty(i,"clientHeight",{get:()=>this.height}),this.map.resize()}_update(e,r){e.mapStyle!==r.mapStyle&&this.map.setStyle(r.mapStyle);let n=e.width!==r.width||e.height!==r.height;n&&(this.width=r.width,this.height=r.height,this.map.resize());let o=e.viewState,a=r.viewState,l=a.latitude!==o.latitude||a.longitude!==o.longitude||a.zoom!==o.zoom||a.pitch!==o.pitch||a.bearing!==o.bearing;return l&&this.map.jumpTo($7(a)),n||l}};function $7(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}var eG={position:"absolute",left:0,top:0,width:"100%",height:"100%"};function Q0e(t){let{container:e=document.body}=t;if(typeof e=="string"&&(e=document.getElementById(e)),!e)throw Error("Deck: container not found");window.getComputedStyle(e).position==="static"&&(e.style.position="relative");let i=document.createElement("div");e.appendChild(i),Object.assign(i.style,eG);let n=document.createElement("canvas");return e.appendChild(n),Object.assign(n.style,eG),{container:e,mapCanvas:i,deckCanvas:n}}var Om=class extends pd{constructor(e){if(typeof document>"u")throw Error("Deck can only be used in the browser");let{mapCanvas:r,deckCanvas:i}=Q0e(e),n=e.viewState||e.initialViewState,o=Number.isFinite(n&&n.latitude),{map:a=globalThis.mapboxgl||globalThis.maplibregl}=e;super({canvas:i,...e}),a&&a.Map?this._map=o&&new pS({...e,width:0,height:0,viewState:n,container:r,mapLib:a}):this._map=a}getMapboxMap(){return this._map&&this._map.getMap()}finalize(){this._map&&this._map.finalize(),super.finalize()}setProps(e){"mapStyle"in e&&this._map&&this._map.setProps({mapStyle:e.mapStyle}),super.setProps(e)}_drawLayers(e,r){if(this._map){let i=this.getViewports()[0];i&&this._map.setProps({width:i.width,height:i.height,viewState:i})}super._drawLayers(e,r)}};Xc.registerDevices([hf]);var tG=t=>t.charAt(0)===t.charAt(0).toUpperCase(),$0e=t=>t.charAt(0)===t.charAt(0).toLowerCase()&&t.charAt(0)!=="_";function gO(t={},e){let r={},i=Object.keys(t).filter(e);for(let n of i)r[n]=t[n];return r}var e_e={classes:gO(w1,tG),enumerations:{COORDINATE_SYSTEM:ni,GL:af}};hA([uy]);var Lp=new Bm({configuration:e_e});function t_e(t,e){let r={classes:gO(t,tG),functions:gO(t,$0e)};e.mergeConfiguration(r)}function r_e(t,e){if(!t)return;let r={};function i(){Object.values(r).every(o=>o)&&typeof e=="function"&&e()}function n(o,a){t_e(a,Lp),r[o]=a,i()}t.forEach(({libraryName:o,resourceUri:a})=>{if(r[o]=!1,o in window){n(o,window[o]);return}Object.defineProperty(window,o,{set:l=>n(o,l),get:()=>r[o]}),w4(a)})}function rG(t,e){let r=Lp.convert(t);e.setProps(r)}function i_e(t,e){return t.filter(r=>r&&r.id&&!e.find(i=>i.id===r.id))}function n_e({mapProvider:t,props:e,mapboxApiKey:r,googleMapsKey:i,handleEvent:n,getTooltip:o,container:a}){let u={...n?{onClick:f=>n("deck-click-event",f),onHover:f=>n("deck-hover-event",f),onResize:f=>n("deck-resize-event",f),onViewStateChange:({viewState:f,interactionState:_,oldViewState:w})=>{let E=new Ic(f);f.nw=E.unproject([0,0]),f.se=E.unproject([E.width,E.height]),n("deck-view-state-change-event",f)},onDragStart:f=>n("deck-drag-start-event",f),onDrag:f=>n("deck-drag-event",f),onDragEnd:f=>n("deck-drag-end-event",f)}:null,getTooltip:o,container:a};switch(t){case"mapbox":return br.info("Using Mapbox base maps")(),new Om({...u,...e,map:OM,mapboxApiAccessToken:r,onLoad:b4});case"carto":return br.info("Using Carto base maps")(),new Om({map:OM,...u,...e});case"google_maps":return br.info("Using Google Maps base maps")(),KU({...u,...e,googleMapsKey:i});default:return br.info("No recognized map provider specified")(),new Om({...u,...e,map:null,mapboxApiAccessToken:null})}}function AS({mapboxApiKey:t,googleMapsKey:e,container:r,jsonInput:i,tooltip:n,handleEvent:o,customLibraries:a,configuration:l}){let u;try{l&&Lp.mergeConfiguration(l);let f=i.layers||[],_=Lp.convert(i);p3(r,_);let w=(_.layers||[]).filter(V=>V),E=i_e(f,w),M=PM(n),{mapProvider:D}=_;u=n_e({mapProvider:D,props:_,mapboxApiKey:t,googleMapsKey:e,handleEvent:o,getTooltip:M,container:r}),r_e(a,()=>{if(E.length){let $=(Lp.convert({layers:i.layers}).layers||[]).filter(te=>te);$.length>w.length&&u.setProps({layers:$})}})}catch(f){console.error(f)}return u}function mS(){Mf.setCallbacks({onInitialize({transport:t}){let{width:e,height:r,customLibraries:i,mapboxApiKey:n,jsonInput:o,tooltip:a}=l_e(t);x4();let l=t.getRootDOMElement(),u=_4(e,r);l.appendChild(u);let f=JSON.parse(o),_=AS({mapboxApiKey:n,container:u,jsonInput:f,tooltip:a,handleEvent:(w,E)=>a_e(t,w,E),customLibraries:i});t.userData.deck=_},onFinalize({transport:t}){let{deck:e}=t.userData;e.finalize()},onMessage({transport:t,type:e,json:r,binary:i}){let{deck:n}=t.userData,o;switch(e){case"json":o=Lp.convert(r),n.setProps(o);break;case"json-with-binary":o=Lp.convert(r);let a=t.jupyterModel.get("data_buffer"),l=o_e({binary:a,convertedJson:o});n.setProps(l);break;default:}}})}function o_e({binary:t,convertedJson:e}){for(let r=0;r<e.layers.length;r++){let i=e.layers[r].id,n=e.layers[r];e.layers[r]=n.clone({data:t[i]})}return e}function s_e(t,e){return e instanceof Yn?e.id:e}function a_e(t,e,r){if(e==="hover"&&!r.picked&&r.index===-1)return;let i=JSON.parse(JSON.stringify(r,s_e));t.sendJSONMessage(e,i)}function l_e(t){let{jupyterModel:e}=t;if(!e)throw new Error("deck.gl playground currently only works with the Jupyter Widget Transport");return{width:e.get("width"),height:e.get("height"),customLibraries:e.get("custom_libraries"),mapboxApiKey:e.get("mapbox_key"),jsonInput:e.get("json_input"),tooltip:e.get("tooltip")}}var Dm=class extends Mf{constructor(){super("Jupyter Transport (JavaScript <=> Jupyter Kernel)"),this.jupyterModel=null,this.jupyterView=null}getRootDOMElement(){return this.jupyterView.el}sendJSONMessage(e,r){let i=Mf._stringifyJSONSafe({type:e,data:r});this.jupyterModel.send(i)}};var H1={};Gs(H1,{CONTROL_COMM_PROTOCOL_VERSION:()=>GX,CONTROL_COMM_TARGET:()=>jX,CONTROL_COMM_TIMEOUT:()=>WX,DOMWidgetModel:()=>SD,DOMWidgetView:()=>CD,IJupyterWidgetRegistry:()=>Cwe,JUPYTER_WIDGETS_VERSION:()=>CS,JupyterPhosphorPanelWidget:()=>ywe,JupyterPhosphorWidget:()=>TY,LayoutModel:()=>vwe,LayoutView:()=>xwe,ManagerBase:()=>Qbe,PROTOCOL_VERSION:()=>MS,StyleModel:()=>bwe,StyleView:()=>wwe,ViewList:()=>Swe,WidgetModel:()=>Gm,WidgetView:()=>B_,WrappedError:()=>Kbe,assign:()=>Od,base64ToBuffer:()=>jO,bufferToBase64:()=>HO,bufferToHex:()=>Jbe,difference:()=>SS,hexToBuffer:()=>VO,isEqual:()=>x_,put_buffers:()=>Fp,reject:()=>Rf,remove_buffers:()=>O1,resolvePromisesDict:()=>b_,serialize_state:()=>qX,shims:()=>MD,unpack_models:()=>V1,uuid:()=>B1});var ES=sc(oG());var sG;(function(t){t.emptyObject=Object.freeze({}),t.emptyArray=Object.freeze([]);function e(_){return _===null||typeof _=="boolean"||typeof _=="number"||typeof _=="string"}t.isPrimitive=e;function r(_){return Array.isArray(_)}t.isArray=r;function i(_){return!e(_)&&!r(_)}t.isObject=i;function n(_,w){if(_===w)return!0;if(e(_)||e(w))return!1;var E=r(_),M=r(w);return E!==M?!1:E&&M?a(_,w):l(_,w)}t.deepEqual=n;function o(_){return e(_)?_:r(_)?u(_):f(_)}t.deepCopy=o;function a(_,w){if(_===w)return!0;if(_.length!==w.length)return!1;for(var E=0,M=_.length;E<M;++E)if(!n(_[E],w[E]))return!1;return!0}function l(_,w){if(_===w)return!0;for(var E in _)if(_[E]!==void 0&&!(E in w))return!1;for(var E in w)if(w[E]!==void 0&&!(E in _))return!1;for(var E in _){var M=_[E],D=w[E];if(!(M===void 0&&D===void 0)&&(M===void 0||D===void 0||!n(M,D)))return!1}return!0}function u(_){for(var w=new Array(_.length),E=0,M=_.length;E<M;++E)w[E]=o(_[E]);return w}function f(_){var w={};for(var E in _){var M=_[E];M!==void 0&&(w[E]=o(M))}return w}})(sG||(sG={}));var Eat=function(){function t(){this._types=[],this._values=[]}return t.prototype.types=function(){return this._types.slice()},t.prototype.hasData=function(e){return this._types.indexOf(e)!==-1},t.prototype.getData=function(e){var r=this._types.indexOf(e);return r!==-1?this._values[r]:void 0},t.prototype.setData=function(e,r){this.clearData(e),this._types.push(e),this._values.push(r)},t.prototype.clearData=function(e){var r=this._types.indexOf(e);r!==-1&&(this._types.splice(r,1),this._values.splice(r,1))},t.prototype.clear=function(){this._types.length=0,this._values.length=0},t}(),aG=function(){function t(){var e=this;this.promise=new Promise(function(r,i){e._resolve=r,e._reject=i})}return t.prototype.resolve=function(e){var r=this._resolve;r(e)},t.prototype.reject=function(e){var r=this._reject;r(e)},t}(),vO;(function(t){t.getRandomValues=function(){var e=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof yg<"u"&&yO()||null;return e&&typeof e.getRandomValues=="function"?function(i){return e.getRandomValues(i)}:e&&typeof e.randomFillSync=="function"?function(i){return e.randomFillSync(i)}:e&&typeof e.randomBytes=="function"?function(i){for(var n=e.randomBytes(i.length),o=0,a=n.length;o<a;++o)i[o]=n[o]}:function(i){for(var n=0,o=0,a=i.length;o<a;++o)o%4===0&&(n=Math.random()*4294967295>>>0),i[o]=n&255,n>>>=8}}()})(vO||(vO={}));var lG=function(){function t(e){this.name=e,this._tokenStructuralPropertyT=null}return t}(),_S;(function(t){t.uuid4=function(){for(var e=new Uint8Array(16),r=new Array(256),i=0;i<16;++i)r[i]="0"+i.toString(16);for(var i=16;i<256;++i)r[i]=i.toString(16);return function(){return vO.getRandomValues(e),e[6]=64|e[6]&15,e[8]=128|e[8]&63,r[e[0]]+r[e[1]]+r[e[2]]+r[e[3]]+"-"+r[e[4]]+r[e[5]]+"-"+r[e[6]]+r[e[7]]+"-"+r[e[8]]+r[e[9]]+"-"+r[e[10]]+r[e[11]]+r[e[12]]+r[e[13]]+r[e[14]]+r[e[15]]}}()})(_S||(_S={}));var zX=sc(DX()),VX=sc(UX()),Ybe=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),TS=function(){return TS=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},TS.apply(this,arguments)};function SS(t,e){return t.filter(function(r){return e.indexOf(r)===-1})}function x_(t,e){return(0,zX.default)(t,e)}var Od=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};function B1(){return _S.uuid4()}var Kbe=function(t){Ybe(e,t);function e(r,i){var n=t.call(this,r)||this;return console.warn("WrappedError has been deprecated!"),i instanceof e?n.error_stack=i.error_stack:n.error_stack=[i],n.error_stack.push(n),n}return e}(Error);function b_(t){var e=Object.keys(t),r=[];return e.forEach(function(i){r.push(t[i])}),Promise.all(r).then(function(i){for(var n={},o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function Rf(t,e){return function(i){throw e&&console.error(new Error(t)),i}}function Fp(t,e,r){for(var i=0;i<e.length;i++){for(var n=e[i],o=t,a=0;a<n.length-1;a++)o=o[n[a]];o[n[n.length-1]]=r[i]}}function O1(t){var e=[],r=[];function i(o,a){if(o.toJSON&&(o=o.toJSON()),Array.isArray(o))for(var l=!1,u=0;u<o.length;u++){var f=o[u];if(f)if(f instanceof ArrayBuffer||ArrayBuffer.isView(f))l||(o=o.slice(),l=!0),e.push(ArrayBuffer.isView(f)?f.buffer:f),r.push(a.concat([u])),o[u]=null;else{var _=i(f,a.concat([u]));_!==f&&(l||(o=o.slice(),l=!0),o[u]=_)}}else if((0,VX.default)(o))for(var w in o){var l=!1;if(o.hasOwnProperty(w)){var f=o[w];if(f)if(f instanceof ArrayBuffer||ArrayBuffer.isView(f))l||(o=TS({},o),l=!0),e.push(ArrayBuffer.isView(f)?f.buffer:f),r.push(a.concat([w])),delete o[w];else{var _=i(f,a.concat([w]));_!==f&&(l||(o=TS({},o),l=!0),o[w]=_)}}}return o}var n=i(t,[]);return{state:n,buffers:e,buffer_paths:r}}var Zbe=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"];function Jbe(t){for(var e=new Uint8Array(t),r=[],i=0;i<e.length;i++)r.push(Zbe[e[i]]);return r.join("")}function VO(t){for(var e=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)e[r/2]=parseInt(t.slice(r,r+2),16);return e.buffer}function HO(t){return(0,ES.fromByteArray)(new Uint8Array(t))}function jO(t){return(0,ES.toByteArray)(t).buffer}var CS="1.2.0",MS="2.1.0";var D1=function(){return D1=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},D1.apply(this,arguments)},Np=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(_){try{f(i.next(_))}catch(w){a(w)}}function u(_){try{f(i.throw(_))}catch(w){a(w)}}function f(_){_.done?o(_.value):n(_.value).then(l,u)}f((i=i.apply(t,e||[])).next())})},kp=function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(f){return function(_){return u([f,_])}}function u(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(o=f[0]&2?n.return:f[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,f[1])).done)return o;switch(n=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,n=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(_){f=[6,_],n=0}finally{i=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},HX=MS.split(".",1)[0],jX="jupyter.widget.control",GX="1.0.0",WX=4e3,Qbe=function(){function t(){this.comm_target_name="jupyter.widget",this._models=Object.create(null)}return t.prototype.display_model=function(e,r,i){var n=this;return i===void 0&&(i={}),this.create_view(r,i).then(function(o){return n.display_view(e,o,i)}).catch(Rf("Could not create view",!0))},t.prototype.setViewOptions=function(e){return e===void 0&&(e={}),e},t.prototype.create_view=function(e,r){var i=this;r===void 0&&(r={});var n=e.state_change=e.state_change.then(function(){return i.loadClass(e.get("_view_name"),e.get("_view_module"),e.get("_view_module_version")).then(function(a){var l=new a({model:e,options:i.setViewOptions(r)});return l.listenTo(e,"destroy",l.remove),Promise.resolve(l.render()).then(function(){return l})}).catch(Rf("Could not create a view for model id "+e.model_id,!0))}),o=B1();return e.views[o]=n,n.then(function(a){a.once("remove",function(){delete a.model.views[o]},i)}),e.state_change},t.prototype.callbacks=function(e){return{}},t.prototype.get_model=function(e){return this._models[e]},t.prototype.has_model=function(e){return this._models[e]!==void 0},t.prototype.handle_comm_open=function(e,r){var i=(r.metadata||{}).version||"";if(i.split(".",1)[0]!==HX){var n="Wrong widget protocol version: received protocol version '"+i+"', but was expecting major version '"+HX+"'";return console.error(n),Promise.reject(n)}var o=r.content.data,a=o.buffer_paths||[],l=(r.buffers||[]).map(function(u){return u instanceof DataView?u:new DataView(u instanceof ArrayBuffer?u:u.buffer)});return Fp(o.state,a,l),this.new_model({model_name:o.state._model_name,model_module:o.state._model_module,model_module_version:o.state._model_module_version,comm:e},o.state).catch(Rf("Could not create a model.",!0))},t.prototype.new_widget=function(e,r){var i=this;r===void 0&&(r={});var n;if(e.view_name===void 0||e.view_module===void 0||e.view_module_version===void 0)return Promise.reject("new_widget(...) must be given view information in the options.");e.comm?n=Promise.resolve(e.comm):n=this._create_comm(this.comm_target_name,e.model_id,{state:{_model_module:e.model_module,_model_module_version:e.model_module_version,_model_name:e.model_name,_view_module:e.view_module,_view_module_version:e.view_module_version,_view_name:e.view_name}},{version:MS});var o=D1({},e);return n.then(function(a){o.comm=a;var l=i.new_model(o,r);return l.then(function(u){return u.sync("create",u),u})},function(){return o.model_id||(o.model_id=B1()),i.new_model(o,r)})},t.prototype.register_model=function(e,r){var i=this;this._models[e]=r,r.then(function(n){n.once("comm:close",function(){delete i._models[e]})})},t.prototype.new_model=function(e,r){return r===void 0&&(r={}),Np(this,void 0,void 0,function(){var i,n;return kp(this,function(o){switch(o.label){case 0:if(e.model_id)i=e.model_id;else if(e.comm)i=e.model_id=e.comm.comm_id;else throw new Error("Neither comm nor model_id provided in options object. At least one must exist.");return n=this._make_model(e,r),this.register_model(i,n),[4,n];case 1:return[2,o.sent()]}})})},t.prototype._make_model=function(e,r){return r===void 0&&(r={}),Np(this,void 0,void 0,function(){var i,n,o,a,l,u,f;return kp(this,function(_){switch(_.label){case 0:i=e.model_id,n=this.loadClass(e.model_name,e.model_module,e.model_module_version),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,n];case 2:return o=_.sent(),[3,4];case 3:throw a=_.sent(),console.error("Could not instantiate widget"),a;case 4:if(!o)throw new Error("Cannot find model module "+e.model_module+"@"+e.model_module_version+", "+e.model_name);return[4,o._deserialize_state(r,this)];case 5:return l=_.sent(),u={widget_manager:this,model_id:i,comm:e.comm},f=new o(l,u),f.name=e.model_name,f.module=e.model_module,[2,f]}})})},t.prototype._loadFromKernel=function(){return Np(this,void 0,void 0,function(){var e,r,i,n,o,a,l,u,f,_,w,E,M,D=this;return kp(this,function(j){switch(j.label){case 0:return j.trys.push([0,3,,4]),[4,this._create_comm(jX,B1(),{},{version:GX})];case 1:return i=j.sent(),[4,new Promise(function(V,$){i.on_msg(function(te){if(e=te.content.data,e.method!=="update_states"){console.warn(`
|
|
3672
3672
|
Unknown `+e.method+` message on the Control channel
|
|
3673
3673
|
`);return}r=(te.buffers||[]).map(function(ne){return ne instanceof DataView?ne:new DataView(ne instanceof ArrayBuffer?ne:ne.buffer)}),V(null)}),i.on_close(function(){return $("Control comm was closed too early")}),i.send({method:"request_states"},{}),setTimeout(function(){return $("Control comm did not respond in time")},WX)})];case 2:return j.sent(),i.close(),[3,4];case 3:return n=j.sent(),console.warn('Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason:',n),[2,this._loadFromKernelModels()];case 4:for(o=e.states,a={},l={},u=0;u<e.buffer_paths.length;u++)f=e.buffer_paths[u],_=f[0],w=f.slice(1),E=r[u],a[_]||(a[_]=[],l[_]=[]),a[_].push(w),l[_].push(E);return[4,Promise.all(Object.keys(o).map(function(V){return Np(D,void 0,void 0,function(){var $,te;return kp(this,function(ne){switch(ne.label){case 0:return this.has_model(V)?(te=void 0,[3,3]):[3,1];case 1:return[4,this._create_comm("jupyter.widget",V)];case 2:te=ne.sent(),ne.label=3;case 3:return $=te,[2,{widget_id:V,comm:$}]}})})}))];case 5:return M=j.sent(),[4,Promise.all(M.map(function(V){var $=V.widget_id,te=V.comm;return Np(D,void 0,void 0,function(){var ne,le,z;return kp(this,function(ke){switch(ke.label){case 0:ne=o[$],$ in a&&Fp(ne,a[$],l[$]),ke.label=1;case 1:return ke.trys.push([1,6,,7]),te?[4,this.new_model({model_name:ne.model_name,model_module:ne.model_module,model_module_version:ne.model_module_version,model_id:$,comm:te},ne.state)]:[3,3];case 2:return ke.sent(),[3,5];case 3:return[4,this.get_model($)];case 4:le=ke.sent(),le.set_state(ne.state),ke.label=5;case 5:return[3,7];case 6:return z=ke.sent(),console.error(z),[3,7];case 7:return[2]}})})}))];case 6:return j.sent(),[2]}})})},t.prototype._loadFromKernelModels=function(){return Np(this,void 0,void 0,function(){var e,r,i=this;return kp(this,function(n){switch(n.label){case 0:return[4,this._get_comm_info()];case 1:return e=n.sent(),[4,Promise.all(Object.keys(e).map(function(o){return Np(i,void 0,void 0,function(){var a,l,u;return kp(this,function(f){switch(f.label){case 0:return this.has_model(o)?[2]:[4,this._create_comm(this.comm_target_name,o)];case 1:return a=f.sent(),l="",u=new aG,a.on_msg(function(_){if(_.parent_header.msg_id===l&&_.header.msg_type==="comm_msg"&&_.content.data.method==="update"){var w=_.content.data,E=w.buffer_paths||[],M=_.buffers||[];Fp(w.state,E,M),u.resolve({comm:a,msg:_})}}),l=a.send({method:"request_state"},this.callbacks(void 0)),[2,u.promise]}})})}))];case 2:return r=n.sent(),[4,Promise.all(r.map(function(o){return Np(i,void 0,void 0,function(){var a;return kp(this,function(l){switch(l.label){case 0:return o?(a=o.msg.content,[4,this.new_model({model_name:a.data.state._model_name,model_module:a.data.state._model_module,model_module_version:a.data.state._model_module_version,comm:o.comm},a.data.state)]):[2];case 1:return l.sent(),[2]}})})}))];case 3:return n.sent(),[2]}})})},t.prototype.clear_state=function(){var e=this;return b_(this._models).then(function(r){Object.keys(r).forEach(function(i){return r[i].close()}),e._models=Object.create(null)})},t.prototype.get_state=function(e){var r=this;e===void 0&&(e={});var i=Object.keys(this._models).map(function(n){return r._models[n]});return Promise.all(i).then(function(n){return qX(n,e)})},t.prototype.set_state=function(e){var r=this;if(!(e.version_major&&e.version_major<=2))throw"Unsupported widget state format";var i=e.state,n=this._get_comm_info().then(function(o){return Promise.all(Object.keys(i).map(function(a){var l={base64:jO,hex:VO},u=i[a],f=u.state;if(u.buffers){var _=u.buffers.map(function(M){return M.path}),w=u.buffers.map(function(M){return new DataView(l[M.encoding](M.data))});Fp(u.state,_,w)}if(r.has_model(a))return r.get_model(a).then(function(M){return M.constructor._deserialize_state(f||{},r).then(function(D){return M.set_state(D),M})});var E={model_id:a,model_name:u.model_name,model_module:u.model_module,model_module_version:u.model_module_version};return o.hasOwnProperty(a)?r._create_comm(r.comm_target_name,a).then(function(M){return E.comm=M,r.new_model(E)}):r.new_model(E,f)}))});return n},t.prototype.disconnect=function(){var e=this;Object.keys(this._models).forEach(function(r){e._models[r].then(function(i){i.comm_live=!1})})},t.prototype.resolveUrl=function(e){return Promise.resolve(e)},t.prototype.filterExistingModelState=function(e){var r=this,i=e.state;return i=Object.keys(i).filter(function(n){return!r.has_model(n)}).reduce(function(n,o){return n[o]=i[o],n},{}),D1(D1({},e),{state:i})},t}();function qX(t,e){e===void 0&&(e={});var r={};return t.forEach(function(i){var n=i.model_id,o=O1(i.serialize(i.get_state(e.drop_defaults))),a=o.buffers.map(function(l,u){return{data:HO(l),path:o.buffer_paths[u],encoding:"base64"}});r[n]={model_name:i.name,model_module:i.module,model_module_version:i.get("_model_module_version"),state:o.state},a.length>0&&(r[n].buffers=a)}),{version_major:2,version_minor:0,state:r}}var WO=function(){return WO=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},WO.apply(this,arguments)};function XX(t,e,r){if(t==null)return this;var i;if(typeof t=="object"?(i=t,r=e):(i={})[t]=e,r||(r={}),!this._validate(i,r))return!1;var n=r.unset,o=r.silent,a=[],l=this._changing;this._changing=!0;try{l||(this._previousAttributes=WO({},this.attributes),this.changed={});var u=this.attributes,f=this.changed,_=this._previousAttributes;for(var w in i)e=i[w],x_(u[w],e)||a.push(w),x_(_[w],e)?delete f[w]:f[w]=e,n?delete u[w]:u[w]=e;if(this.id=this.get(this.idAttribute),!o){a.length&&(this._pending=r);for(var E=0;E<a.length;E++)this.trigger("change:"+a[E],this,u[a[E]],r)}if(l)return this;if(!o)for(;this._pending;)r=this._pending,this._pending=!1,this.trigger("change",this,r)}finally{this._pending=!1,this._changing=!1}return this}var wY=sc(ZO()),ED=sc(YO());var ZX=sc(ZO()),ewe=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),L1=Element.prototype,twe=L1.matches||L1.webkitMatchesSelector||L1.mozMatchesSelector||L1.msMatchesSelector||L1.oMatchesSelector||function(e){for(var r=(this.document||this.ownerDocument).querySelectorAll(e),i=r.length;--i>=0&&r.item(i)!==this;);return i>-1},JX=function(t){ewe(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype._removeElement=function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.prototype._setElement=function(r){this.el=r},e.prototype._setAttributes=function(r){for(var i in r)i in this.el?this.el[i]=r[i]:this.el.setAttribute(i,r[i])},e.prototype.delegate=function(r,i,n){typeof i!="string"&&(n=i,i=null),this._domEvents===void 0&&(this._domEvents=[]);var o=this.el,a=i?function(l){for(var u=l.target||l.srcElement;u&&u!==o;u=u.parentNode)if(twe.call(u,i))return l.delegateTarget=u,n.handleEvent?n.handleEvent(l):n(l)}:n;return this.el.addEventListener(r,a,!1),this._domEvents.push({eventName:r,handler:a,listener:n,selector:i}),a},e.prototype.undelegate=function(r,i,n){if(typeof i=="function"&&(n=i,i=null),this.el&&this._domEvents)for(var o=this._domEvents.slice(),a=o.length;a--;){var l=o[a],u=l.eventName===r&&(n?l.listener===n:!0)&&(i?l.selector===i:!0);u&&(this.el.removeEventListener(l.eventName,l.handler,!1),this._domEvents.splice(a,1))}return this},e.prototype.undelegateEvents=function(){if(this.el&&this._domEvents){for(var r=this._domEvents.length,i=0;i<r;i++){var n=this._domEvents[i];this.el.removeEventListener(n.eventName,n.handler,!1)}this._domEvents.length=0}return this},e}(ZX.View);var ei;(function(t){function e(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(Y[ye]===X)return ye}return-1}t.firstIndexOf=e;function r(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(Y[ye]===X)return ye}return-1}t.lastIndexOf=r;function i(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(X(Y[ye],ye))return ye}return-1}t.findFirstIndex=i;function n(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(X(Y[ye],ye))return ye}return-1}t.findLastIndex=n;function o(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=i(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findFirstValue=o;function a(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=n(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findLastValue=a;function l(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)<0?(Q=jt+1,ye-=it+1):ye=it}return Q}t.lowerBound=l;function u(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)>0?ye=it:(Q=jt+1,ye-=it+1)}return Q}t.upperBound=u;function f(Y,X,O){if(Y===X)return!0;if(Y.length!==X.length)return!1;for(var I=0,H=Y.length;I<H;++I)if(O?!O(Y[I],X[I]):Y[I]!==X[I])return!1;return!0}t.shallowEqual=f;function _(Y,X){X===void 0&&(X={});var O=X.start,I=X.stop,H=X.step;if(H===void 0&&(H=1),H===0)throw new Error("Slice `step` cannot be zero.");var ie=Y.length;O===void 0?O=H<0?ie-1:0:O<0?O=Math.max(O+ie,H<0?-1:0):O>=ie&&(O=H<0?ie-1:ie),I===void 0?I=H<0?-1:ie:I<0?I=Math.max(I+ie,H<0?-1:0):I>=ie&&(I=H<0?ie-1:ie);var Q;H<0&&I>=O||H>0&&O>=I?Q=0:H<0?Q=Math.floor((I-O+1)/H+1):Q=Math.floor((I-O-1)/H+1);for(var ye=[],it=0;it<Q;++it)ye[it]=Y[O+it*H];return ye}t.slice=_;function w(Y,X,O){var I=Y.length;if(!(I<=1)&&(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1),X!==O)){for(var H=Y[X],ie=X<O?1:-1,Q=X;Q!==O;Q+=ie)Y[Q]=Y[Q+ie];Y[O]=H}}t.move=w;function E(Y,X,O){X===void 0&&(X=0),O===void 0&&(O=-1);var I=Y.length;if(!(I<=1))for(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1);X<O;){var H=Y[X],ie=Y[O];Y[X++]=ie,Y[O--]=H}}t.reverse=E;function M(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(!(H<=1)&&(O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1),!(O>=I))){var ie=I-O+1;if(X>0?X=X%ie:X<0&&(X=(X%ie+ie)%ie),X!==0){var Q=O+X;E(Y,O,Q-1),E(Y,Q,I),E(Y,O,I)}}}t.rotate=M;function D(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H!==0){O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q)Y[(O+Q)%H]=X}}t.fill=D;function j(Y,X,O){var I=Y.length;X<0?X=Math.max(0,X+I):X=Math.min(X,I);for(var H=I;H>X;--H)Y[H]=Y[H-1];Y[X]=O}t.insert=j;function V(Y,X){var O=Y.length;if(X<0&&(X+=O),!(X<0||X>=O)){for(var I=Y[X],H=X+1;H<O;++H)Y[H-1]=Y[H];return Y.length=O-1,I}}t.removeAt=V;function $(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=e(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeFirstOf=$;function te(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=r(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeLastOf=te;function ne(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&Y[Q]===X||I<O&&(Q<=I||Q>=O)&&Y[Q]===X?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllOf=ne;function le(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H,ie=i(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeFirstWhere=le;function z(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H,ie=n(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeLastWhere=z;function ke(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&X(Y[Q],Q)||I<O&&(Q<=I||Q>=O)&&X(Y[Q],Q)?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllWhere=ke})(ei||(ei={}));function Rh(t){var e;return typeof t.iter=="function"?e=t.iter():e=new rwe(t),e}function hn(t,e){for(var r=0,i=Rh(t),n;(n=i.next())!==void 0;)if(e(n,r++)===!1)return}function QX(t){for(var e=0,r=[],i=Rh(t),n;(n=i.next())!==void 0;)r[e++]=n;return r}var rwe=function(){function t(e){this._index=0,this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}(),mct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}},t}(),gct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}},t}(),_ct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}},t}(),yct=function(){function t(e){this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},t.prototype.next=function(){return this._fn.call(void 0)},t}();function QO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new km(Rh(t.map(Rh)))}var km=function(){function t(e){this._cloned=!1,this._source=e,this._active=void 0}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone());return e._active=this._active&&this._active.clone(),e._cloned=!0,this._cloned=!0,e},t.prototype.next=function(){if(this._active===void 0){var e=this._source.next();if(e===void 0)return;this._active=this._cloned?e.clone():e}var r=this._active.next();return r!==void 0?r:(this._active=void 0,this.next())},t}();function Bf(){return new iwe}var iwe=function(){function t(){}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t},t.prototype.next=function(){},t}();var vct=function(){function t(e,r){this._source=e,this._index=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._index)},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return[this._index++,e]},t}();function $X(t,e){return new nwe(Rh(t),e)}var nwe=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){for(var e=this._fn,r=this._source,i;(i=r.next())!==void 0;)if(e(i,this._index++))return i},t}();function T_(t,e){for(var r=0,i=Rh(t),n;(n=i.next())!==void 0;)if(e(n,r++))return n}function eY(t,e){var r=Rh(t),i=r.next();if(i!==void 0){for(var n=i;(i=r.next())!==void 0;)e(i,n)>0&&(n=i);return n}}function Up(t,e){return new owe(Rh(t),e)}var owe=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return this._fn.call(void 0,e,this._index++)},t}();var xct=function(){function t(e,r,i){this._index=0,this._start=e,this._stop=r,this._step=i,this._length=JO.rangeLength(e,r,i)}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},t}(),JO;(function(t){function e(r,i,n){return n===0?1/0:r>i&&n>0||r<i&&n<0?0:Math.ceil((i-r)/n)}t.rangeLength=e})(JO||(JO={}));function $O(t,e,r){var i=0,n=Rh(t),o=n.next();if(o===void 0&&r===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(o===void 0)return r;var a=n.next();if(a===void 0&&r===void 0)return o;if(a===void 0)return e(r,o,i++);var l;r===void 0?l=e(o,a,i++):l=e(e(r,o,i++),a,i++);for(var u;(u=n.next())!==void 0;)l=e(l,u,i++);return l}function F1(t){return new swe(t,1)}var swe=function(){function t(e,r){this._value=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._value,this._count)},t.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},t}();var bct=function(){function t(e){this._source=e,this._index=e.length-1}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},t}();var wct=function(){function t(e,r){this._source=e,this._step=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var e=this._source.next(),r=this._step-1;r>0;--r)this._source.next();return e},t}(),w_;(function(t){function e(a,l,u){u===void 0&&(u=0);for(var f=new Array(l.length),_=0,w=u,E=l.length;_<E;++_,++w){if(w=a.indexOf(l[_],w),w===-1)return null;f[_]=w}return f}t.findIndices=e;function r(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=0,E=f.length;w<E;++w){var M=f[w]-u;_+=M*M}return{score:_,indices:f}}t.matchSumOfSquares=r;function i(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=u-1,E=0,M=f.length;E<M;++E){var D=f[E];_+=D-w-1,w=D}return{score:_,indices:f}}t.matchSumOfDeltas=i;function n(a,l,u){for(var f=[],_=0,w=0,E=l.length;_<E;){for(var M=l[_],D=l[_];++_<E&&l[_]===D+1;)D++;w<M&&f.push(a.slice(w,M)),M<D+1&&f.push(u(a.slice(M,D+1))),w=D+1}return w<a.length&&f.push(a.slice(w)),f}t.highlight=n;function o(a,l){return a<l?-1:a>l?1:0}t.cmp=o})(w_||(w_={}));var Tct=function(){function t(e,r){this._source=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._count)},t.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(e!==void 0)return this._count--,e}},t}();var Ect=function(){function t(e){this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.map(function(e){return e.clone()}))},t.prototype.next=function(){for(var e=new Array(this._source.length),r=0,i=this._source.length;r<i;++r){var n=this._source[r].next();if(n===void 0)return;e[r]=n}return e},t}();var tY;(function(t){function e(r){var i=document.body,n=function(o){o.preventDefault(),o.stopPropagation(),o.clipboardData.setData("text",r),i.removeEventListener("copy",n,!0)};i.addEventListener("copy",n,!0),document.execCommand("copy")}t.copyText=e})(tY||(tY={}));var Bo;(function(t){function e(o){var a=window.getComputedStyle(o),l=parseFloat(a.borderTopWidth)||0,u=parseFloat(a.borderLeftWidth)||0,f=parseFloat(a.borderRightWidth)||0,_=parseFloat(a.borderBottomWidth)||0,w=parseFloat(a.paddingTop)||0,E=parseFloat(a.paddingLeft)||0,M=parseFloat(a.paddingRight)||0,D=parseFloat(a.paddingBottom)||0,j=u+E+M+f,V=l+w+D+_;return{borderTop:l,borderLeft:u,borderRight:f,borderBottom:_,paddingTop:w,paddingLeft:E,paddingRight:M,paddingBottom:D,horizontalSum:j,verticalSum:V}}t.boxSizing=e;function r(o){var a=window.getComputedStyle(o),l=parseFloat(a.minWidth)||0,u=parseFloat(a.minHeight)||0,f=parseFloat(a.maxWidth)||1/0,_=parseFloat(a.maxHeight)||1/0;return f=Math.max(l,f),_=Math.max(u,_),{minWidth:l,minHeight:u,maxWidth:f,maxHeight:_}}t.sizeLimits=r;function i(o,a,l){var u=o.getBoundingClientRect();return a>=u.left&&a<u.right&&l>=u.top&&l<u.bottom}t.hitTest=i;function n(o,a){var l=o.getBoundingClientRect(),u=a.getBoundingClientRect();if(!(u.top<=l.top&&u.bottom>=l.bottom)){if(u.top<l.top&&u.height<=l.height){o.scrollTop-=l.top-u.top;return}if(u.bottom>l.bottom&&u.height>=l.height){o.scrollTop-=l.top-u.top;return}if(u.top<l.top&&u.height>l.height){o.scrollTop-=l.bottom-u.bottom;return}if(u.bottom>l.bottom&&u.height<l.height){o.scrollTop-=l.bottom-u.bottom;return}}}t.scrollIntoViewIfNeeded=n})(Bo||(Bo={}));var Jl;(function(t){t.IS_MAC=!!navigator.platform.match(/Mac/i),t.IS_WIN=!!navigator.platform.match(/Win/i),t.IS_IE=/Trident/.test(navigator.userAgent),t.IS_EDGE=/Edge/.test(navigator.userAgent);function e(r){return t.IS_MAC?r.metaKey:r.ctrlKey}t.accelKey=e})(Jl||(Jl={}));var Oh;(function(t){function e(n){if(n in Bh.specificityCache)return Bh.specificityCache[n];var o=Bh.calculateSingle(n);return Bh.specificityCache[n]=o}t.calculateSpecificity=e;function r(n){if(n in Bh.validityCache)return Bh.validityCache[n];var o=!0;try{Bh.testElem.querySelector(n)}catch{o=!1}return Bh.validityCache[n]=o}t.isValid=r;function i(n,o){return Bh.protoMatchFunc.call(n,o)}t.matches=i})(Oh||(Oh={}));var Bh;(function(t){t.specificityCache=Object.create(null),t.validityCache=Object.create(null),t.testElem=document.createElement("div"),t.protoMatchFunc=function(){var _=Element.prototype;return _.matches||_.matchesSelector||_.mozMatchesSelector||_.msMatchesSelector||_.oMatchesSelector||_.webkitMatchesSelector||function(w){var E=this,M=E.ownerDocument?E.ownerDocument.querySelectorAll(w):[];return Array.prototype.indexOf.call(M,E)!==-1}}();function e(_){_=_.split(",",1)[0];var w=0,E=0,M=0;function D(j){var V=_.match(j);return V===null?!1:(_=_.slice(V[0].length),!0)}for(_=_.replace(f," $1 ");_.length>0;){if(D(r)){w++;continue}if(D(i)){E++;continue}if(D(n)){E++;continue}if(D(a)){M++;continue}if(D(l)){E++;continue}if(D(o)){M++;continue}if(!D(u))return 0}return w=Math.min(w,255),E=Math.min(E,255),M=Math.min(M,255),w<<16|E<<8|M}t.calculateSingle=e;var r=/^#[^\s\+>~#\.\[:]+/,i=/^\.[^\s\+>~#\.\[:]+/,n=/^\[[^\]]+\]/,o=/^[^\s\+>~#\.\[:]+/,a=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,l=/^:[^\s\+>~#\.\[:]+/,u=/^[\s\+>~\*]+/,f=/:not\(([^\)]+)\)/g})(Bh||(Bh={}));var N1;(function(t){function e(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(Y[ye]===X)return ye}return-1}t.firstIndexOf=e;function r(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(Y[ye]===X)return ye}return-1}t.lastIndexOf=r;function i(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(X(Y[ye],ye))return ye}return-1}t.findFirstIndex=i;function n(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(X(Y[ye],ye))return ye}return-1}t.findLastIndex=n;function o(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=i(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findFirstValue=o;function a(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=n(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findLastValue=a;function l(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)<0?(Q=jt+1,ye-=it+1):ye=it}return Q}t.lowerBound=l;function u(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)>0?ye=it:(Q=jt+1,ye-=it+1)}return Q}t.upperBound=u;function f(Y,X,O){if(Y===X)return!0;if(Y.length!==X.length)return!1;for(var I=0,H=Y.length;I<H;++I)if(O?!O(Y[I],X[I]):Y[I]!==X[I])return!1;return!0}t.shallowEqual=f;function _(Y,X){X===void 0&&(X={});var O=X.start,I=X.stop,H=X.step;if(H===void 0&&(H=1),H===0)throw new Error("Slice `step` cannot be zero.");var ie=Y.length;O===void 0?O=H<0?ie-1:0:O<0?O=Math.max(O+ie,H<0?-1:0):O>=ie&&(O=H<0?ie-1:ie),I===void 0?I=H<0?-1:ie:I<0?I=Math.max(I+ie,H<0?-1:0):I>=ie&&(I=H<0?ie-1:ie);var Q;H<0&&I>=O||H>0&&O>=I?Q=0:H<0?Q=Math.floor((I-O+1)/H+1):Q=Math.floor((I-O-1)/H+1);for(var ye=[],it=0;it<Q;++it)ye[it]=Y[O+it*H];return ye}t.slice=_;function w(Y,X,O){var I=Y.length;if(!(I<=1)&&(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1),X!==O)){for(var H=Y[X],ie=X<O?1:-1,Q=X;Q!==O;Q+=ie)Y[Q]=Y[Q+ie];Y[O]=H}}t.move=w;function E(Y,X,O){X===void 0&&(X=0),O===void 0&&(O=-1);var I=Y.length;if(!(I<=1))for(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1);X<O;){var H=Y[X],ie=Y[O];Y[X++]=ie,Y[O--]=H}}t.reverse=E;function M(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(!(H<=1)&&(O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1),!(O>=I))){var ie=I-O+1;if(X>0?X=X%ie:X<0&&(X=(X%ie+ie)%ie),X!==0){var Q=O+X;E(Y,O,Q-1),E(Y,Q,I),E(Y,O,I)}}}t.rotate=M;function D(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H!==0){O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q)Y[(O+Q)%H]=X}}t.fill=D;function j(Y,X,O){var I=Y.length;X<0?X=Math.max(0,X+I):X=Math.min(X,I);for(var H=I;H>X;--H)Y[H]=Y[H-1];Y[X]=O}t.insert=j;function V(Y,X){var O=Y.length;if(X<0&&(X+=O),!(X<0||X>=O)){for(var I=Y[X],H=X+1;H<O;++H)Y[H-1]=Y[H];return Y.length=O-1,I}}t.removeAt=V;function $(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=e(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeFirstOf=$;function te(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=r(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeLastOf=te;function ne(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&Y[Q]===X||I<O&&(Q<=I||Q>=O)&&Y[Q]===X?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllOf=ne;function le(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H,ie=i(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeFirstWhere=le;function z(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H,ie=n(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeLastWhere=z;function ke(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&X(Y[Q],Q)||I<O&&(Q<=I||Q>=O)&&X(Y[Q],Q)?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllWhere=ke})(N1||(N1={}));function tD(t){var e;return typeof t.iter=="function"?e=t.iter():e=new awe(t),e}function iY(t,e){for(var r=0,i=tD(t),n;(n=i.next())!==void 0;)if(e(n,r++)===!1)return}function nY(t,e){for(var r=0,i=tD(t),n;(n=i.next())!==void 0;)if(!e(n,r++))return!1;return!0}function oY(t,e){for(var r=0,i=tD(t),n;(n=i.next())!==void 0;)if(e(n,r++))return!0;return!1}var awe=function(){function t(e){this._index=0,this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}(),Mct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}},t}(),Ict=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}},t}(),Pct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}},t}(),Rct=function(){function t(e){this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},t.prototype.next=function(){return this._fn.call(void 0)},t}();var Bct=function(){function t(e){this._cloned=!1,this._source=e,this._active=void 0}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone());return e._active=this._active&&this._active.clone(),e._cloned=!0,this._cloned=!0,e},t.prototype.next=function(){if(this._active===void 0){var e=this._source.next();if(e===void 0)return;this._active=this._cloned?e.clone():e}var r=this._active.next();return r!==void 0?r:(this._active=void 0,this.next())},t}();var Oct=function(){function t(){}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t},t.prototype.next=function(){},t}();var Dct=function(){function t(e,r){this._source=e,this._index=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._index)},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return[this._index++,e]},t}();var Lct=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){for(var e=this._fn,r=this._source,i;(i=r.next())!==void 0;)if(e(i,this._index++))return i},t}();var Fct=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return this._fn.call(void 0,e,this._index++)},t}();var Nct=function(){function t(e,r,i){this._index=0,this._start=e,this._stop=r,this._step=i,this._length=eD.rangeLength(e,r,i)}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},t}(),eD;(function(t){function e(r,i,n){return n===0?1/0:r>i&&n>0||r<i&&n<0?0:Math.ceil((i-r)/n)}t.rangeLength=e})(eD||(eD={}));var kct=function(){function t(e,r){this._value=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._value,this._count)},t.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},t}();function sY(t){var e;return typeof t.retro=="function"?e=t.retro():e=new lwe(t),e}var lwe=function(){function t(e){this._source=e,this._index=e.length-1}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},t}();var Uct=function(){function t(e,r){this._source=e,this._step=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var e=this._source.next(),r=this._step-1;r>0;--r)this._source.next();return e},t}(),rY;(function(t){function e(a,l,u){u===void 0&&(u=0);for(var f=new Array(l.length),_=0,w=u,E=l.length;_<E;++_,++w){if(w=a.indexOf(l[_],w),w===-1)return null;f[_]=w}return f}t.findIndices=e;function r(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=0,E=f.length;w<E;++w){var M=f[w]-u;_+=M*M}return{score:_,indices:f}}t.matchSumOfSquares=r;function i(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=u-1,E=0,M=f.length;E<M;++E){var D=f[E];_+=D-w-1,w=D}return{score:_,indices:f}}t.matchSumOfDeltas=i;function n(a,l,u){for(var f=[],_=0,w=0,E=l.length;_<E;){for(var M=l[_],D=l[_];++_<E&&l[_]===D+1;)D++;w<M&&f.push(a.slice(w,M)),M<D+1&&f.push(u(a.slice(M,D+1))),w=D+1}return w<a.length&&f.push(a.slice(w)),f}t.highlight=n;function o(a,l){return a<l?-1:a>l?1:0}t.cmp=o})(rY||(rY={}));var zct=function(){function t(e,r){this._source=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._count)},t.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(e!==void 0)return this._count--,e}},t}();var Vct=function(){function t(e){this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.map(function(e){return e.clone()}))},t.prototype.next=function(){for(var e=new Array(this._source.length),r=0,i=this._source.length;r<i;++r){var n=this._source[r].next();if(n===void 0)return;e[r]=n}return e},t}();var Ql;(function(t){function e(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(Y[ye]===X)return ye}return-1}t.firstIndexOf=e;function r(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(Y[ye]===X)return ye}return-1}t.lastIndexOf=r;function i(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(X(Y[ye],ye))return ye}return-1}t.findFirstIndex=i;function n(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(X(Y[ye],ye))return ye}return-1}t.findLastIndex=n;function o(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=i(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findFirstValue=o;function a(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=n(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findLastValue=a;function l(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)<0?(Q=jt+1,ye-=it+1):ye=it}return Q}t.lowerBound=l;function u(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)>0?ye=it:(Q=jt+1,ye-=it+1)}return Q}t.upperBound=u;function f(Y,X,O){if(Y===X)return!0;if(Y.length!==X.length)return!1;for(var I=0,H=Y.length;I<H;++I)if(O?!O(Y[I],X[I]):Y[I]!==X[I])return!1;return!0}t.shallowEqual=f;function _(Y,X){X===void 0&&(X={});var O=X.start,I=X.stop,H=X.step;if(H===void 0&&(H=1),H===0)throw new Error("Slice `step` cannot be zero.");var ie=Y.length;O===void 0?O=H<0?ie-1:0:O<0?O=Math.max(O+ie,H<0?-1:0):O>=ie&&(O=H<0?ie-1:ie),I===void 0?I=H<0?-1:ie:I<0?I=Math.max(I+ie,H<0?-1:0):I>=ie&&(I=H<0?ie-1:ie);var Q;H<0&&I>=O||H>0&&O>=I?Q=0:H<0?Q=Math.floor((I-O+1)/H+1):Q=Math.floor((I-O-1)/H+1);for(var ye=[],it=0;it<Q;++it)ye[it]=Y[O+it*H];return ye}t.slice=_;function w(Y,X,O){var I=Y.length;if(!(I<=1)&&(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1),X!==O)){for(var H=Y[X],ie=X<O?1:-1,Q=X;Q!==O;Q+=ie)Y[Q]=Y[Q+ie];Y[O]=H}}t.move=w;function E(Y,X,O){X===void 0&&(X=0),O===void 0&&(O=-1);var I=Y.length;if(!(I<=1))for(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1);X<O;){var H=Y[X],ie=Y[O];Y[X++]=ie,Y[O--]=H}}t.reverse=E;function M(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(!(H<=1)&&(O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1),!(O>=I))){var ie=I-O+1;if(X>0?X=X%ie:X<0&&(X=(X%ie+ie)%ie),X!==0){var Q=O+X;E(Y,O,Q-1),E(Y,Q,I),E(Y,O,I)}}}t.rotate=M;function D(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H!==0){O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q)Y[(O+Q)%H]=X}}t.fill=D;function j(Y,X,O){var I=Y.length;X<0?X=Math.max(0,X+I):X=Math.min(X,I);for(var H=I;H>X;--H)Y[H]=Y[H-1];Y[X]=O}t.insert=j;function V(Y,X){var O=Y.length;if(X<0&&(X+=O),!(X<0||X>=O)){for(var I=Y[X],H=X+1;H<O;++H)Y[H-1]=Y[H];return Y.length=O-1,I}}t.removeAt=V;function $(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=e(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeFirstOf=$;function te(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=r(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeLastOf=te;function ne(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&Y[Q]===X||I<O&&(Q<=I||Q>=O)&&Y[Q]===X?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllOf=ne;function le(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H,ie=i(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeFirstWhere=le;function z(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H,ie=n(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeLastWhere=z;function ke(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&X(Y[Q],Q)||I<O&&(Q<=I||Q>=O)&&X(Y[Q],Q)?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllWhere=ke})(Ql||(Ql={}));function cwe(t){var e;return typeof t.iter=="function"?e=t.iter():e=new uwe(t),e}function PS(t,e){for(var r=0,i=cwe(t),n;(n=i.next())!==void 0;)if(e(n,r++)===!1)return}var uwe=function(){function t(e){this._index=0,this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}(),jct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}},t}(),Gct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}},t}(),Wct=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}},t}(),qct=function(){function t(e){this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},t.prototype.next=function(){return this._fn.call(void 0)},t}();var Xct=function(){function t(e){this._cloned=!1,this._source=e,this._active=void 0}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone());return e._active=this._active&&this._active.clone(),e._cloned=!0,this._cloned=!0,e},t.prototype.next=function(){if(this._active===void 0){var e=this._source.next();if(e===void 0)return;this._active=this._cloned?e.clone():e}var r=this._active.next();return r!==void 0?r:(this._active=void 0,this.next())},t}();function iD(){return new hwe}var hwe=function(){function t(){}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t},t.prototype.next=function(){},t}();var Yct=function(){function t(e,r){this._source=e,this._index=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._index)},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return[this._index++,e]},t}();var Kct=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){for(var e=this._fn,r=this._source,i;(i=r.next())!==void 0;)if(e(i,this._index++))return i},t}();var Zct=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return this._fn.call(void 0,e,this._index++)},t}();var Jct=function(){function t(e,r,i){this._index=0,this._start=e,this._stop=r,this._step=i,this._length=rD.rangeLength(e,r,i)}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},t}(),rD;(function(t){function e(r,i,n){return n===0?1/0:r>i&&n>0||r<i&&n<0?0:Math.ceil((i-r)/n)}t.rangeLength=e})(rD||(rD={}));var Qct=function(){function t(e,r){this._value=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._value,this._count)},t.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},t}();var $ct=function(){function t(e){this._source=e,this._index=e.length-1}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},t}();var eut=function(){function t(e,r){this._source=e,this._step=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var e=this._source.next(),r=this._step-1;r>0;--r)this._source.next();return e},t}(),aY;(function(t){function e(a,l,u){u===void 0&&(u=0);for(var f=new Array(l.length),_=0,w=u,E=l.length;_<E;++_,++w){if(w=a.indexOf(l[_],w),w===-1)return null;f[_]=w}return f}t.findIndices=e;function r(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=0,E=f.length;w<E;++w){var M=f[w]-u;_+=M*M}return{score:_,indices:f}}t.matchSumOfSquares=r;function i(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=u-1,E=0,M=f.length;E<M;++E){var D=f[E];_+=D-w-1,w=D}return{score:_,indices:f}}t.matchSumOfDeltas=i;function n(a,l,u){for(var f=[],_=0,w=0,E=l.length;_<E;){for(var M=l[_],D=l[_];++_<E&&l[_]===D+1;)D++;w<M&&f.push(a.slice(w,M)),M<D+1&&f.push(u(a.slice(M,D+1))),w=D+1}return w<a.length&&f.push(a.slice(w)),f}t.highlight=n;function o(a,l){return a<l?-1:a>l?1:0}t.cmp=o})(aY||(aY={}));var tut=function(){function t(e,r){this._source=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._count)},t.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(e!==void 0)return this._count--,e}},t}();var rut=function(){function t(e){this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.map(function(e){return e.clone()}))},t.prototype.next=function(){for(var e=new Array(this._source.length),r=0,i=this._source.length;r<i;++r){var n=this._source[r].next();if(n===void 0)return;e[r]=n}return e},t}();var lY=function(){function t(e){this._root=new va.LeafNode,this.cmp=e}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this._root.size===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"first",{get:function(){var e=va.firstLeaf(this._root);return e.size>0?e.items[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"last",{get:function(){var e=va.lastLeaf(this._root);return e.size>0?e.items[e.size-1]:void 0},enumerable:!0,configurable:!0}),t.prototype.iter=function(){return va.iterItems(this._root)},t.prototype.retro=function(){return va.retroItems(this._root)},t.prototype.slice=function(e,r){return va.sliceItems(this._root,e,r)},t.prototype.retroSlice=function(e,r){return va.retroSliceItems(this._root,e,r)},t.prototype.at=function(e){return va.itemAt(this._root,e)},t.prototype.has=function(e,r){return va.hasItem(this._root,e,r)},t.prototype.indexOf=function(e,r){return va.indexOf(this._root,e,r)},t.prototype.get=function(e,r){return va.getItem(this._root,e,r)},t.prototype.assign=function(e){this.clear(),this.update(e)},t.prototype.insert=function(e){var r=va.insertItem(this._root,e,this.cmp);return this._root=va.maybeSplitRoot(this._root),r},t.prototype.update=function(e){var r=this;PS(e,function(i){r.insert(i)})},t.prototype.delete=function(e,r){var i=va.deleteItem(this._root,e,r);return this._root=va.maybeExtractRoot(this._root),i},t.prototype.remove=function(e){var r=va.removeItem(this._root,e);return this._root=va.maybeExtractRoot(this._root),r},t.prototype.clear=function(){va.clear(this._root),this._root=new va.LeafNode},t}();(function(t){function e(r,i){var n=new t(i);return n.assign(r),n}t.from=e})(lY||(lY={}));var va;(function(t){var e=function(){function Q(){this.items=[],this.sizes=[],this.children=[]}return Object.defineProperty(Q.prototype,"type",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(Q.prototype,"size",{get:function(){return this.sizes[this.sizes.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(Q.prototype,"width",{get:function(){return this.children.length},enumerable:!0,configurable:!0}),Q}();t.BranchNode=e;var r=function(){function Q(){this.next=null,this.prev=null,this.items=[]}return Object.defineProperty(Q.prototype,"type",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(Q.prototype,"size",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(Q.prototype,"width",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),Q}();t.LeafNode=r;function i(Q){for(;Q.type===0;)Q=Q.children[0];return Q}t.firstLeaf=i;function n(Q){for(;Q.type===0;)Q=Q.children[Q.children.length-1];return Q}t.lastLeaf=n;function o(Q){var ye=i(Q);return new z(ye,0,-1)}t.iterItems=o;function a(Q){var ye=n(Q);return new ke(ye,ye.size-1,-1)}t.retroItems=a;function l(Q,ye,it){ye===void 0?ye=0:ye<0?ye=Math.max(0,ye+Q.size):ye=Math.min(ye,Q.size),it===void 0?it=Q.size:it<0?it=Math.max(0,it+Q.size):it=Math.min(it,Q.size);var jt=Math.max(0,it-ye);if(jt===0)return iD();for(;Q.type===0;){var nr=Y(Q.sizes,ye);nr>0&&(ye-=Q.sizes[nr-1]),Q=Q.children[nr]}return new z(Q,ye,jt)}t.sliceItems=l;function u(Q,ye,it){ye===void 0?ye=Q.size-1:ye<0?ye=Math.max(-1,ye+Q.size):ye=Math.min(ye,Q.size-1),it===void 0?it=-1:it<0?it=Math.max(-1,it+Q.size):it=Math.min(it,Q.size-1);var jt=Math.max(0,ye-it);if(jt===0)return iD();for(;Q.type===0;){var nr=Y(Q.sizes,ye);nr>0&&(ye-=Q.sizes[nr-1]),Q=Q.children[nr]}return new ke(Q,ye,jt)}t.retroSliceItems=u;function f(Q,ye){if(ye<0&&(ye+=Q.size),!(ye<0||ye>=Q.size)){for(;Q.type===0;){var it=Y(Q.sizes,ye);it>0&&(ye-=Q.sizes[it-1]),Q=Q.children[it]}return Q.items[ye]}}t.itemAt=f;function _(Q,ye,it){for(;Q.type===0;){var jt=X(Q.items,ye,it);Q=Q.children[jt]}var nr=O(Q.items,ye,it);return nr>=0}t.hasItem=_;function w(Q,ye,it){for(var jt=0;Q.type===0;){var nr=X(Q.items,ye,it);nr>0&&(jt+=Q.sizes[nr-1]),Q=Q.children[nr]}var Sr=O(Q.items,ye,it);return Sr>=0?jt+Sr:-jt+Sr}t.indexOf=w;function E(Q,ye,it){for(;Q.type===0;){var jt=X(Q.items,ye,it);Q=Q.children[jt]}var nr=O(Q.items,ye,it);return nr>=0?Q.items[nr]:void 0}t.getItem=E;function M(Q,ye,it){if(Q.type===1){var jt=O(Q.items,ye,it),nr;return jt>=0?(nr=Q.items[jt],Q.items[jt]=ye):(nr=void 0,Ql.insert(Q.items,-jt-1,ye)),nr}var Sr=X(Q.items,ye,it),Or=Q.children[Sr],Cr=Or.size,mr=M(Or,ye,it),hi=Or.size;if(Q.items[Sr]=Or.items[0],Cr===hi)return mr;if(Or.width>ne){var or=H(Or);Ql.insert(Q.children,Sr+1,or),Ql.insert(Q.items,Sr+1,or.items[0])}return I(Q,Sr),mr}t.insertItem=M;function D(Q,ye,it){if(Q.type===1){var jt=O(Q.items,ye,it);return jt<0?void 0:Ql.removeAt(Q.items,jt)}var nr=X(Q.items,ye,it),Sr=Q.children[nr],Or=Sr.size,Cr=D(Sr,ye,it),mr=Sr.size;return Or===mr||(Q.items[nr]=Sr.items[0],Sr.width<le&&(nr=ie(Q,nr)),I(Q,nr)),Cr}t.deleteItem=D;function j(Q,ye){if(ye<0&&(ye+=Q.size),!(ye<0||ye>=Q.size)){if(Q.type===1)return Ql.removeAt(Q.items,ye);var it=Y(Q.sizes,ye);it>0&&(ye-=Q.sizes[it]);var jt=Q.children[it],nr=j(jt,ye);return Q.items[it]=jt.items[0],jt.width<le&&(it=ie(Q,it)),I(Q,it),nr}}t.removeItem=j;function V(Q){Q.type===0?(PS(Q.children,V),Q.children.length=0,Q.sizes.length=0,Q.items.length=0):(Q.items.length=0,Q.next=null,Q.prev=null)}t.clear=V;function $(Q){if(Q.width<=ne)return Q;var ye=new e,it=H(Q);return ye.sizes[0]=Q.size,ye.sizes[1]=Q.size+it.size,ye.children[0]=Q,ye.children[1]=it,ye.items[0]=Q.items[0],ye.items[1]=it.items[0],ye}t.maybeSplitRoot=$;function te(Q){if(Q.type===1||Q.children.length>1)return Q;var ye=Q.children.pop();return V(Q),ye}t.maybeExtractRoot=te;var ne=32,le=ne>>1,z=function(){function Q(ye,it,jt){this._node=ye,this._index=it,this._count=jt}return Q.prototype.iter=function(){return this},Q.prototype.clone=function(){return new Q(this._node,this._index,this._count)},Q.prototype.next=function(){if(!(this._node===null||this._count===0))return this._index>=this._node.size?(this._node=this._node.next,this._index=0,this.next()):(this._count>0&&this._count--,this._node.items[this._index++])},Q}(),ke=function(){function Q(ye,it,jt){this._node=ye,this._index=it,this._count=jt}return Q.prototype.iter=function(){return this},Q.prototype.clone=function(){return new Q(this._node,this._index,this._count)},Q.prototype.next=function(){if(!(this._node===null||this._count===0))return this._index>=this._node.size&&(this._index=this._node.size-1),this._index<0?(this._node=this._node.prev,this._index=this._node?this._node.size-1:-1,this.next()):(this._count>0&&this._count--,this._node.items[this._index--])},Q}();function Y(Q,ye){for(var it=Q.length,jt=0;jt<it;++jt)if(Q[jt]>ye)return jt;return it-1}function X(Q,ye,it){for(var jt=Q.length,nr=1;nr<jt;++nr)if(it(Q[nr],ye)>0)return nr-1;return jt-1}function O(Q,ye,it){for(var jt=Q.length,nr=0;nr<jt;++nr){var Sr=it(Q[nr],ye);if(Sr===0)return nr;if(Sr>0)return-nr-1}return-jt-1}function I(Q,ye){for(var it=Q.sizes,jt=Q.children,nr=ye>0?it[ye-1]:0,Sr=jt.length;ye<Sr;++ye)nr=it[ye]=nr+jt[ye].size;it.length=jt.length}function H(Q){if(Q.type===1){for(var ye=new r,it=Q.items,jt=ye.items,nr=le,Sr=it.length;nr<Sr;++nr)jt.push(it[nr]);return it.length=le,Q.next&&(Q.next.prev=ye),ye.next=Q.next,ye.prev=Q,Q.next=ye,ye}for(var Or=new e,Cr=Q.children,mr=Or.children,nr=le,Sr=Cr.length;nr<Sr;++nr)mr.push(Cr[nr]);Cr.length=le;for(var hi=Q.items,or=Or.items,nr=le,Sr=hi.length;nr<Sr;++nr)or.push(hi[nr]);return hi.length=le,I(Q,le),I(Or,0),Or}function ie(Q,ye){var it,jt,nr,Sr,Or,Cr,mr=Q.children[ye],hi=ye===0?Q.children[ye+1]:Q.children[ye-1],or=ye===0,ir=mr.type===1,Bi=hi.width>le;if(ir&&Bi&&or){var de=mr,be=hi;return de.items.push(be.items.shift()),Q.items[ye+1]=be.items[0],ye}if(ir&&Bi&&!or){var de=mr,be=hi;return de.items.unshift(be.items.pop()),Q.items[ye]=de.items[0],ye-1}if(ir&&!Bi&&or){var de=mr,be=hi;return(it=be.items).unshift.apply(it,de.items),Ql.removeAt(Q.children,ye),Ql.removeAt(Q.items,ye+1),de.prev&&(de.prev.next=be),be.prev=de.prev,V(de),ye}if(ir&&!Bi&&!or){var de=mr,be=hi;return(jt=be.items).push.apply(jt,de.items),Ql.removeAt(Q.children,ye),Ql.removeAt(Q.items,ye),de.next&&(de.next.prev=be),be.next=de.next,V(de),ye-1}if(!ir&&Bi&&or){var de=mr,be=hi;return de.children.push(be.children.shift()),de.items.push(be.items.shift()),Q.items[ye+1]=be.items[0],I(de,de.width-1),I(be,0),ye}if(!ir&&Bi&&!or){var de=mr,be=hi;return de.children.unshift(be.children.pop()),de.items.unshift(be.items.pop()),Q.items[ye]=de.items[0],I(de,0),I(be,be.width-1),ye-1}if(!ir&&!Bi&&or){var de=mr,be=hi;return(nr=be.children).unshift.apply(nr,de.children),(Sr=be.items).unshift.apply(Sr,de.items),Ql.removeAt(Q.children,ye),Ql.removeAt(Q.items,ye+1),I(be,0),de.children.length=0,V(de),ye}if(!ir&&!Bi&&!or){var de=mr,be=hi;return(Or=be.children).push.apply(Or,de.children),(Cr=be.items).push.apply(Cr,de.items),Ql.removeAt(Q.children,ye),Ql.removeAt(Q.items,ye),I(be,0),de.children.length=0,V(de),ye-1}throw"unreachable"}})(va||(va={}));var RS=function(){function t(){this._first=null,this._last=null,this._size=0}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this._size===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"first",{get:function(){return this._first?this._first.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"last",{get:function(){return this._last?this._last.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstNode",{get:function(){return this._first},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastNode",{get:function(){return this._last},enumerable:!0,configurable:!0}),t.prototype.iter=function(){return new t.ForwardValueIterator(this._first)},t.prototype.retro=function(){return new t.RetroValueIterator(this._last)},t.prototype.nodes=function(){return new t.ForwardNodeIterator(this._first)},t.prototype.retroNodes=function(){return new t.RetroNodeIterator(this._last)},t.prototype.assign=function(e){var r=this;this.clear(),PS(e,function(i){r.addLast(i)})},t.prototype.push=function(e){this.addLast(e)},t.prototype.pop=function(){return this.removeLast()},t.prototype.shift=function(e){this.addFirst(e)},t.prototype.unshift=function(){return this.removeFirst()},t.prototype.addFirst=function(e){var r=new Dd.LinkedListNode(this,e);return this._first?(r.next=this._first,this._first.prev=r,this._first=r):(this._first=r,this._last=r),this._size++,r},t.prototype.addLast=function(e){var r=new Dd.LinkedListNode(this,e);return this._last?(r.prev=this._last,this._last.next=r,this._last=r):(this._first=r,this._last=r),this._size++,r},t.prototype.insertBefore=function(e,r){if(!r||r===this._first)return this.addFirst(e);if(!(r instanceof Dd.LinkedListNode)||r.list!==this)throw new Error("Reference node is not owned by the list.");var i=new Dd.LinkedListNode(this,e),n=r,o=n.prev;return i.next=n,i.prev=o,n.prev=i,o.next=i,this._size++,i},t.prototype.insertAfter=function(e,r){if(!r||r===this._last)return this.addLast(e);if(!(r instanceof Dd.LinkedListNode)||r.list!==this)throw new Error("Reference node is not owned by the list.");var i=new Dd.LinkedListNode(this,e),n=r,o=n.next;return i.next=o,i.prev=n,n.next=i,o.prev=i,this._size++,i},t.prototype.removeFirst=function(){var e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},t.prototype.removeLast=function(){var e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},t.prototype.removeNode=function(e){if(!(e instanceof Dd.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");var r=e;r===this._first&&r===this._last?(this._first=null,this._last=null):r===this._first?(this._first=r.next,this._first.prev=null):r===this._last?(this._last=r.prev,this._last.next=null):(r.next.prev=r.prev,r.prev.next=r.next),r.list=null,r.next=null,r.prev=null,this._size--},t.prototype.clear=function(){for(var e=this._first;e;){var r=e.next;e.list=null,e.prev=null,e.next=null,e=r}this._first=null,this._last=null,this._size=0},t}();(function(t){function e(a){var l=new t;return l.assign(a),l}t.from=e;var r=function(){function a(l){this._node=l}return a.prototype.iter=function(){return this},a.prototype.clone=function(){return new a(this._node)},a.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.next,l.value}},a}();t.ForwardValueIterator=r;var i=function(){function a(l){this._node=l}return a.prototype.iter=function(){return this},a.prototype.clone=function(){return new a(this._node)},a.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.prev,l.value}},a}();t.RetroValueIterator=i;var n=function(){function a(l){this._node=l}return a.prototype.iter=function(){return this},a.prototype.clone=function(){return new a(this._node)},a.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.next,l}},a}();t.ForwardNodeIterator=n;var o=function(){function a(l){this._node=l}return a.prototype.iter=function(){return this},a.prototype.clone=function(){return new a(this._node)},a.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.prev,l}},a}();t.RetroNodeIterator=o})(RS||(RS={}));var Dd;(function(t){var e=function(){function r(i,n){this.list=null,this.next=null,this.prev=null,this.list=i,this.value=n}return r}();t.LinkedListNode=e})(Dd||(Dd={}));var nD=function(t,e){return nD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},nD(t,e)};function fwe(t,e){nD(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var iu=function(){function t(e){this.type=e}return Object.defineProperty(t.prototype,"isConflatable",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.conflate=function(e){return!1},t}(),E_=function(t){fwe(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"isConflatable",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.conflate=function(r){return!0},e}(iu),Pr;(function(t){function e(O,I){var H=_.get(O);if(!H||H.length===0){te(O,I);return}var ie=nY(sY(H),function(Q){return Q?$(Q,O,I):!0});ie&&te(O,I)}t.sendMessage=e;function r(O,I){if(!I.isConflatable){ne(O,I);return}var H=oY(f,function(ie){return ie.handler!==O||!ie.msg||ie.msg.type!==I.type||!ie.msg.isConflatable?!1:ie.msg.conflate(I)});H||ne(O,I)}t.postMessage=r;function i(O,I){var H=_.get(O);H&&H.indexOf(I)!==-1||(H?H.push(I):_.set(O,[I]))}t.installMessageHook=i;function n(O,I){var H=_.get(O);if(H){var ie=H.indexOf(I);ie!==-1&&(H[ie]=null,z(H))}}t.removeMessageHook=n;function o(O){var I=_.get(O);I&&I.length>0&&(N1.fill(I,null),z(I)),iY(f,function(H){H.handler===O&&(H.handler=null,H.msg=null)})}t.clearData=o;function a(){D||M===0||(V(M),D=!0,le(),D=!1)}t.flush=a;function l(){return E}t.getExceptionHandler=l;function u(O){var I=E;return E=O,I}t.setExceptionHandler=u;var f=new RS,_=new WeakMap,w=new Set,E=function(O){console.error(O)},M=0,D=!1,j=function(){var O=typeof requestAnimationFrame=="function";return O?requestAnimationFrame:setImmediate}(),V=function(){var O=typeof cancelAnimationFrame=="function";return O?cancelAnimationFrame:clearImmediate}();function $(O,I,H){var ie=!0;try{typeof O=="function"?ie=O(I,H):ie=O.messageHook(I,H)}catch(Q){E(Q)}return ie}function te(O,I){try{O.processMessage(I)}catch(H){E(H)}}function ne(O,I){f.addLast({handler:O,msg:I}),M===0&&(M=j(le))}function le(){if(M=0,!f.isEmpty){var O={handler:null,msg:null};for(f.addLast(O);;){var I=f.removeFirst();if(I===O)return;I.handler&&I.msg&&e(I.handler,I.msg)}}}function z(O){w.size===0&&j(ke),w.add(O)}function ke(){w.forEach(Y),w.clear()}function Y(O){N1.removeAllWhere(O,X)}function X(O){return O===null}})(Pr||(Pr={}));var nu=function(){function t(e){this._pid=Um.nextPID(),this.name=e.name,this._create=e.create,this._coerce=e.coerce||null,this._compare=e.compare||null,this._changed=e.changed||null}return t.prototype.get=function(e){var r,i=Um.ensureMap(e);return this._pid in i?r=i[this._pid]:r=i[this._pid]=this._createValue(e),r},t.prototype.set=function(e,r){var i,n=Um.ensureMap(e);this._pid in n?i=n[this._pid]:i=n[this._pid]=this._createValue(e);var o=this._coerceValue(e,r);this._maybeNotify(e,i,n[this._pid]=o)},t.prototype.coerce=function(e){var r,i=Um.ensureMap(e);this._pid in i?r=i[this._pid]:r=i[this._pid]=this._createValue(e);var n=this._coerceValue(e,r);this._maybeNotify(e,r,i[this._pid]=n)},t.prototype._createValue=function(e){var r=this._create;return r(e)},t.prototype._coerceValue=function(e,r){var i=this._coerce;return i?i(e,r):r},t.prototype._compareValue=function(e,r){var i=this._compare;return i?i(e,r):e===r},t.prototype._maybeNotify=function(e,r,i){var n=this._changed;n&&!this._compareValue(r,i)&&n(e,r,i)},t}();(function(t){function e(r){Um.ownerData.delete(r)}t.clearData=e})(nu||(nu={}));var Um;(function(t){t.ownerData=new WeakMap,t.nextPID=function(){var r=0;return function(){var i=Math.random(),n=(""+i).slice(2);return"pid-"+n+"-"+r++}}();function e(r){var i=t.ownerData.get(r);return i||(i=Object.create(null),t.ownerData.set(r,i),i)}t.ensureMap=e})(Um||(Um={}));var Eo=function(){function t(e){this.sender=e}return t.prototype.connect=function(e,r){return ou.connect(this,e,r)},t.prototype.disconnect=function(e,r){return ou.disconnect(this,e,r)},t.prototype.emit=function(e){ou.emit(this,e)},t}();(function(t){function e(u,f){ou.disconnectBetween(u,f)}t.disconnectBetween=e;function r(u){ou.disconnectSender(u)}t.disconnectSender=r;function i(u){ou.disconnectReceiver(u)}t.disconnectReceiver=i;function n(u){ou.disconnectAll(u)}t.disconnectAll=n;function o(u){ou.disconnectAll(u)}t.clearData=o;function a(){return ou.exceptionHandler}t.getExceptionHandler=a;function l(u){var f=ou.exceptionHandler;return ou.exceptionHandler=u,f}t.setExceptionHandler=l})(Eo||(Eo={}));var ou;(function(t){t.exceptionHandler=function(te){console.error(te)};function e(te,ne,le){le=le||void 0;var z=u.get(te.sender);if(z||(z=[],u.set(te.sender,z)),E(z,te,ne,le))return!1;var ke=le||ne,Y=f.get(ke);Y||(Y=[],f.set(ke,Y));var X={signal:te,slot:ne,thisArg:le};return z.push(X),Y.push(X),!0}t.connect=e;function r(te,ne,le){le=le||void 0;var z=u.get(te.sender);if(!z||z.length===0)return!1;var ke=E(z,te,ne,le);if(!ke)return!1;var Y=le||ne,X=f.get(Y);return ke.signal=null,D(z),D(X),!0}t.disconnect=r;function i(te,ne){var le=u.get(te);if(!(!le||le.length===0)){var z=f.get(ne);!z||z.length===0||(hn(z,function(ke){ke.signal&&ke.signal.sender===te&&(ke.signal=null)}),D(le),D(z))}}t.disconnectBetween=i;function n(te){var ne=u.get(te);!ne||ne.length===0||(hn(ne,function(le){if(le.signal){var z=le.thisArg||le.slot;le.signal=null,D(f.get(z))}}),D(ne))}t.disconnectSender=n;function o(te){var ne=f.get(te);!ne||ne.length===0||(hn(ne,function(le){if(le.signal){var z=le.signal.sender;le.signal=null,D(u.get(z))}}),D(ne))}t.disconnectReceiver=o;function a(te){n(te),o(te)}t.disconnectAll=a;function l(te,ne){var le=u.get(te.sender);if(!(!le||le.length===0))for(var z=0,ke=le.length;z<ke;++z){var Y=le[z];Y.signal===te&&M(Y,ne)}}t.emit=l;var u=new WeakMap,f=new WeakMap,_=new Set,w=function(){var te=typeof requestAnimationFrame=="function";return te?requestAnimationFrame:setImmediate}();function E(te,ne,le,z){return T_(te,function(ke){return ke.signal===ne&&ke.slot===le&&ke.thisArg===z})}function M(te,ne){var le=te.signal,z=te.slot,ke=te.thisArg;try{z.call(ke,le.sender,ne)}catch(Y){t.exceptionHandler(Y)}}function D(te){_.size===0&&w(j),_.add(te)}function j(){_.forEach(V),_.clear()}function V(te){ei.removeAllWhere(te,$)}function $(te){return te.signal===null}})(ou||(ou={}));var oa;(function(t){t.emptyObject=Object.freeze({}),t.emptyArray=Object.freeze([]);function e(_){return _===null||typeof _=="boolean"||typeof _=="number"||typeof _=="string"}t.isPrimitive=e;function r(_){return Array.isArray(_)}t.isArray=r;function i(_){return!e(_)&&!r(_)}t.isObject=i;function n(_,w){if(_===w)return!0;if(e(_)||e(w))return!1;var E=r(_),M=r(w);return E!==M?!1:E&&M?a(_,w):l(_,w)}t.deepEqual=n;function o(_){return e(_)?_:r(_)?u(_):f(_)}t.deepCopy=o;function a(_,w){if(_===w)return!0;if(_.length!==w.length)return!1;for(var E=0,M=_.length;E<M;++E)if(!n(_[E],w[E]))return!1;return!0}function l(_,w){if(_===w)return!0;for(var E in _)if(_[E]!==void 0&&!(E in w))return!1;for(var E in w)if(w[E]!==void 0&&!(E in _))return!1;for(var E in _){var M=_[E],D=w[E];if(!(M===void 0&&D===void 0)&&(M===void 0||D===void 0||!n(M,D)))return!1}return!0}function u(_){for(var w=new Array(_.length),E=0,M=_.length;E<M;++E)w[E]=o(_[E]);return w}function f(_){var w={};for(var E in _){var M=_[E];M!==void 0&&(w[E]=o(M))}return w}})(oa||(oa={}));var uY=function(){function t(){this._types=[],this._values=[]}return t.prototype.types=function(){return this._types.slice()},t.prototype.hasData=function(e){return this._types.indexOf(e)!==-1},t.prototype.getData=function(e){var r=this._types.indexOf(e);return r!==-1?this._values[r]:void 0},t.prototype.setData=function(e,r){this.clearData(e),this._types.push(e),this._values.push(r)},t.prototype.clearData=function(e){var r=this._types.indexOf(e);r!==-1&&(this._types.splice(r,1),this._values.splice(r,1))},t.prototype.clear=function(){this._types.length=0,this._values.length=0},t}(),fut=function(){function t(){var e=this;this.promise=new Promise(function(r,i){e._resolve=r,e._reject=i})}return t.prototype.resolve=function(e){var r=this._resolve;r(e)},t.prototype.reject=function(e){var r=this._reject;r(e)},t}(),oD;(function(t){t.getRandomValues=function(){var e=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof yg<"u"&&yO()||null;return e&&typeof e.getRandomValues=="function"?function(i){return e.getRandomValues(i)}:e&&typeof e.randomFillSync=="function"?function(i){return e.randomFillSync(i)}:e&&typeof e.randomBytes=="function"?function(i){for(var n=e.randomBytes(i.length),o=0,a=n.length;o<a;++o)i[o]=n[o]}:function(i){for(var n=0,o=0,a=i.length;o<a;++o)o%4===0&&(n=Math.random()*4294967295>>>0),i[o]=n&255,n>>>=8}}()})(oD||(oD={}));var dut=function(){function t(e){this.name=e,this._tokenStructuralPropertyT=null}return t}(),cY;(function(t){t.uuid4=function(){for(var e=new Uint8Array(16),r=new Array(256),i=0;i<16;++i)r[i]="0"+i.toString(16);for(var i=16;i<256;++i)r[i]=i.toString(16);return function(){return oD.getRandomValues(e),e[6]=64|e[6]&15,e[8]=128|e[8]&63,r[e[0]]+r[e[1]]+r[e[2]]+r[e[3]]+"-"+r[e[4]]+r[e[5]]+"-"+r[e[6]]+r[e[7]]+"-"+r[e[8]]+r[e[9]]+"-"+r[e[10]]+r[e[11]]+r[e[12]]+r[e[13]]+r[e[14]]+r[e[15]]}}()})(cY||(cY={}));var sD=function(t,e){return sD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},sD(t,e)};function fY(t,e){sD(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var S_=function(){function t(e){this._fn=e}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return!this._fn},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this._fn){var e=this._fn;this._fn=null,e()}},t}(),_ut=function(t){fY(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._disposed=new Eo(r),r}return Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),Eo.clearData(this))},e}(S_),aD=function(){function t(){this._isDisposed=!1,this._items=new Set}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(function(e){e.dispose()}),this._items.clear())},t.prototype.contains=function(e){return this._items.has(e)},t.prototype.add=function(e){this._items.add(e)},t.prototype.remove=function(e){this._items.delete(e)},t.prototype.clear=function(){this._items.clear()},t}();(function(t){function e(r){var i=new t;return hn(r,function(n){i.add(n)}),i}t.from=e})(aD||(aD={}));var hY=function(t){fY(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._disposed=new Eo(r),r}return Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),Eo.clearData(this))},e}(aD);(function(t){function e(r){var i=new t;return hn(r,function(n){i.add(n)}),i}t.from=e})(hY||(hY={}));function k1(){return cD.keyboardLayout}var lD=function(){function t(e,r){this.name=e,this._codes=r,this._keys=t.extractKeys(r)}return t.prototype.keys=function(){return Object.keys(this._keys)},t.prototype.isValidKey=function(e){return e in this._keys},t.prototype.keyForKeydownEvent=function(e){return this._codes[e.keyCode]||""},t}();(function(t){function e(r){var i=Object.create(null);for(var n in r)i[r[n]]=!0;return i}t.extractKeys=e})(lD||(lD={}));var dwe=new lD("en-us",{8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}),cD;(function(t){t.keyboardLayout=dwe})(cD||(cD={}));var C_=function(){function t(){this._timerID=0,this._replaying=!1,this._keystrokes=[],this._keydownEvents=[],this._keyBindings=[],this._exactKeyMatch=null,this._commands=Object.create(null),this._commandChanged=new Eo(this),this._commandExecuted=new Eo(this),this._keyBindingChanged=new Eo(this)}return Object.defineProperty(t.prototype,"commandChanged",{get:function(){return this._commandChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"commandExecuted",{get:function(){return this._commandExecuted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keyBindingChanged",{get:function(){return this._keyBindingChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keyBindings",{get:function(){return this._keyBindings},enumerable:!0,configurable:!0}),t.prototype.listCommands=function(){return Object.keys(this._commands)},t.prototype.hasCommand=function(e){return e in this._commands},t.prototype.addCommand=function(e,r){var i=this;if(e in this._commands)throw new Error("Command '"+e+"' already registered.");return this._commands[e]=zm.createCommand(r),this._commandChanged.emit({id:e,type:"added"}),new S_(function(){delete i._commands[e],i._commandChanged.emit({id:e,type:"removed"})})},t.prototype.notifyCommandChanged=function(e){if(e!==void 0&&!(e in this._commands))throw new Error("Command '"+e+"' is not registered.");this._commandChanged.emit({id:e,type:e?"changed":"many-changed"})},t.prototype.label=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.label.call(void 0,r):""},t.prototype.mnemonic=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.mnemonic.call(void 0,r):-1},t.prototype.icon=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.icon.call(void 0,r):""},t.prototype.iconClass=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.iconClass.call(void 0,r):""},t.prototype.iconLabel=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.iconLabel.call(void 0,r):""},t.prototype.caption=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.caption.call(void 0,r):""},t.prototype.usage=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.usage.call(void 0,r):""},t.prototype.className=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.className.call(void 0,r):""},t.prototype.dataset=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.dataset.call(void 0,r):{}},t.prototype.isEnabled=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.isEnabled.call(void 0,r):!1},t.prototype.isToggled=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.isToggled.call(void 0,r):!1},t.prototype.isVisible=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];return i?i.isVisible.call(void 0,r):!1},t.prototype.execute=function(e,r){r===void 0&&(r=oa.emptyObject);var i=this._commands[e];if(!i)return Promise.reject(new Error("Command '"+e+"' not registered."));var n;try{n=i.execute.call(void 0,r)}catch(a){n=Promise.reject(a)}var o=Promise.resolve(n);return this._commandExecuted.emit({id:e,args:r,result:o}),o},t.prototype.addKeyBinding=function(e){var r=this,i=zm.createKeyBinding(e);return this._keyBindings.push(i),this._keyBindingChanged.emit({binding:i,type:"added"}),new S_(function(){ei.removeFirstOf(r._keyBindings,i),r._keyBindingChanged.emit({binding:i,type:"removed"})})},t.prototype.processKeydownEvent=function(e){if(!this._replaying){var r=t.keystrokeForKeydownEvent(e);if(!r){this._replayKeydownEvents(),this._clearPendingState();return}this._keystrokes.push(r);var i=zm.matchKeyBinding(this._keyBindings,this._keystrokes,e),n=i.exact,o=i.partial;if(!n&&!o){this._replayKeydownEvents(),this._clearPendingState();return}if(e.preventDefault(),e.stopPropagation(),n&&!o){this._executeKeyBinding(n),this._clearPendingState();return}n&&(this._exactKeyMatch=n),this._keydownEvents.push(e),this._startTimer()}},t.prototype._startTimer=function(){var e=this;this._clearTimer(),this._timerID=window.setTimeout(function(){e._onPendingTimeout()},zm.CHORD_TIMEOUT)},t.prototype._clearTimer=function(){this._timerID!==0&&(clearTimeout(this._timerID),this._timerID=0)},t.prototype._replayKeydownEvents=function(){this._keydownEvents.length!==0&&(this._replaying=!0,this._keydownEvents.forEach(zm.replayKeyEvent),this._replaying=!1)},t.prototype._executeKeyBinding=function(e){var r=e.command,i=e.args;if(!this.hasCommand(r)||!this.isEnabled(r,i)){var n=this.hasCommand(r)?"enabled":"registered",o=e.keys.join(", "),a="Cannot execute key binding '"+o+"':",l="command '"+r+"' is not "+n+".";console.warn(a+" "+l);return}this.execute(r,i)},t.prototype._clearPendingState=function(){this._clearTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0},t.prototype._onPendingTimeout=function(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()},t}();(function(t){function e(a){for(var l="",u=!1,f=!1,_=!1,w=!1,E=0,M=a.split(/\s+/);E<M.length;E++){var D=M[E];D==="Accel"?Jl.IS_MAC?f=!0:_=!0:D==="Alt"?u=!0:D==="Cmd"?f=!0:D==="Ctrl"?_=!0:D==="Shift"?w=!0:D.length>0&&(l=D)}return{cmd:f,ctrl:_,alt:u,shift:w,key:l}}t.parseKeystroke=e;function r(a){var l="",u=e(a);return u.ctrl&&(l+="Ctrl "),u.alt&&(l+="Alt "),u.shift&&(l+="Shift "),u.cmd&&Jl.IS_MAC&&(l+="Cmd "),l+u.key}t.normalizeKeystroke=r;function i(a){var l;return Jl.IS_WIN?l=a.winKeys||a.keys:Jl.IS_MAC?l=a.macKeys||a.keys:l=a.linuxKeys||a.keys,l.map(r)}t.normalizeKeys=i;function n(a){var l="",u=e(a);return Jl.IS_MAC?(u.ctrl&&(l+="\u2303 "),u.alt&&(l+="\u2325 "),u.shift&&(l+="\u21E7 "),u.cmd&&(l+="\u2318 ")):(u.ctrl&&(l+="Ctrl+"),u.alt&&(l+="Alt+"),u.shift&&(l+="Shift+")),l+u.key}t.formatKeystroke=n;function o(a){var l=k1().keyForKeydownEvent(a);if(!l)return"";var u="";return a.ctrlKey&&(u+="Ctrl "),a.altKey&&(u+="Alt "),a.shiftKey&&(u+="Shift "),a.metaKey&&Jl.IS_MAC&&(u+="Cmd "),u+l}t.keystrokeForKeydownEvent=o})(C_||(C_={}));var zm;(function(t){t.CHORD_TIMEOUT=1e3;function e(V){var $,te;return!V.icon||typeof V.icon=="string"?(te=w(V.iconClass||V.icon,o),$=te):(te=w(V.iconClass,o),$=w(V.icon,_)),{execute:V.execute,label:w(V.label,o),mnemonic:w(V.mnemonic,a),icon:$,iconClass:te,iconLabel:w(V.iconLabel,o),caption:w(V.caption,o),usage:w(V.usage,o),className:w(V.className,o),dataset:w(V.dataset,f),isEnabled:V.isEnabled||l,isToggled:V.isToggled||u,isVisible:V.isVisible||l}}t.createCommand=e;function r(V){return{keys:C_.normalizeKeys(V),selector:E(V),command:V.command,args:V.args||oa.emptyObject}}t.createKeyBinding=r;function i(V,$,te){for(var ne=null,le=!1,z=1/0,ke=0,Y=0,X=V.length;Y<X;++Y){var O=V[Y],I=M(O.keys,$);if(I!==0){if(I===2){!le&&D(O.selector,te)!==-1&&(le=!0);continue}var H=D(O.selector,te);if(!(H===-1||H>z)){var ie=Oh.calculateSpecificity(O.selector);(!ne||H<z||ie>=ke)&&(ne=O,z=H,ke=ie)}}}return{exact:ne,partial:le}}t.matchKeyBinding=i;function n(V){V.target.dispatchEvent(j(V))}t.replayKeyEvent=n;var o=function(){return""},a=function(){return-1},l=function(){return!0},u=function(){return!1},f=function(){return{}},_=function(){};function w(V,$){return V===void 0?$:typeof V=="function"?V:function(){return V}}function E(V){if(V.selector.indexOf(",")!==-1)throw new Error("Selector cannot contain commas: "+V.selector);if(!Oh.isValid(V.selector))throw new Error("Invalid selector: "+V.selector);return V.selector}function M(V,$){if(V.length<$.length)return 0;for(var te=0,ne=$.length;te<ne;++te)if(V[te]!==$[te])return 0;return V.length>$.length?2:1}function D(V,$){for(var te=$.target,ne=$.currentTarget,le=0;te!==null;te=te.parentElement,++le){if(te.hasAttribute("data-lm-suppress-shortcuts")||te.hasAttribute("data-p-suppress-shortcuts"))return-1;if(Oh.matches(te,V))return le;if(te===ne)return-1}return-1}function j(V){var $=document.createEvent("Event"),te=V.bubbles||!0,ne=V.cancelable||!0;return $.initEvent(V.type||"keydown",te,ne),$.key=V.key||"",$.keyCode=V.keyCode||0,$.which=V.keyCode||0,$.ctrlKey=V.ctrlKey||!1,$.altKey=V.altKey||!1,$.shiftKey=V.shiftKey||!1,$.metaKey=V.metaKey||!1,$.view=V.view||window,$}})(zm||(zm={}));var zp;(function(t){function e(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(Y[ye]===X)return ye}return-1}t.firstIndexOf=e;function r(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(Y[ye]===X)return ye}return-1}t.lastIndexOf=r;function i(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(X(Y[ye],ye))return ye}return-1}t.findFirstIndex=i;function n(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(X(Y[ye],ye))return ye}return-1}t.findLastIndex=n;function o(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=i(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findFirstValue=o;function a(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=n(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findLastValue=a;function l(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)<0?(Q=jt+1,ye-=it+1):ye=it}return Q}t.lowerBound=l;function u(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)>0?ye=it:(Q=jt+1,ye-=it+1)}return Q}t.upperBound=u;function f(Y,X,O){if(Y===X)return!0;if(Y.length!==X.length)return!1;for(var I=0,H=Y.length;I<H;++I)if(O?!O(Y[I],X[I]):Y[I]!==X[I])return!1;return!0}t.shallowEqual=f;function _(Y,X){X===void 0&&(X={});var O=X.start,I=X.stop,H=X.step;if(H===void 0&&(H=1),H===0)throw new Error("Slice `step` cannot be zero.");var ie=Y.length;O===void 0?O=H<0?ie-1:0:O<0?O=Math.max(O+ie,H<0?-1:0):O>=ie&&(O=H<0?ie-1:ie),I===void 0?I=H<0?-1:ie:I<0?I=Math.max(I+ie,H<0?-1:0):I>=ie&&(I=H<0?ie-1:ie);var Q;H<0&&I>=O||H>0&&O>=I?Q=0:H<0?Q=Math.floor((I-O+1)/H+1):Q=Math.floor((I-O-1)/H+1);for(var ye=[],it=0;it<Q;++it)ye[it]=Y[O+it*H];return ye}t.slice=_;function w(Y,X,O){var I=Y.length;if(!(I<=1)&&(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1),X!==O)){for(var H=Y[X],ie=X<O?1:-1,Q=X;Q!==O;Q+=ie)Y[Q]=Y[Q+ie];Y[O]=H}}t.move=w;function E(Y,X,O){X===void 0&&(X=0),O===void 0&&(O=-1);var I=Y.length;if(!(I<=1))for(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1);X<O;){var H=Y[X],ie=Y[O];Y[X++]=ie,Y[O--]=H}}t.reverse=E;function M(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(!(H<=1)&&(O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1),!(O>=I))){var ie=I-O+1;if(X>0?X=X%ie:X<0&&(X=(X%ie+ie)%ie),X!==0){var Q=O+X;E(Y,O,Q-1),E(Y,Q,I),E(Y,O,I)}}}t.rotate=M;function D(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H!==0){O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q)Y[(O+Q)%H]=X}}t.fill=D;function j(Y,X,O){var I=Y.length;X<0?X=Math.max(0,X+I):X=Math.min(X,I);for(var H=I;H>X;--H)Y[H]=Y[H-1];Y[X]=O}t.insert=j;function V(Y,X){var O=Y.length;if(X<0&&(X+=O),!(X<0||X>=O)){for(var I=Y[X],H=X+1;H<O;++H)Y[H-1]=Y[H];return Y.length=O-1,I}}t.removeAt=V;function $(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=e(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeFirstOf=$;function te(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=r(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeLastOf=te;function ne(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&Y[Q]===X||I<O&&(Q<=I||Q>=O)&&Y[Q]===X?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllOf=ne;function le(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H,ie=i(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeFirstWhere=le;function z(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H,ie=n(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeLastWhere=z;function ke(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&X(Y[Q],Q)||I<O&&(Q<=I||Q>=O)&&X(Y[Q],Q)?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllWhere=ke})(zp||(zp={}));var Mut=function(){function t(e){this._index=0,this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}(),Iut=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}},t}(),Put=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}},t}(),Rut=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}},t}(),But=function(){function t(e){this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},t.prototype.next=function(){return this._fn.call(void 0)},t}();var Out=function(){function t(e){this._cloned=!1,this._source=e,this._active=void 0}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone());return e._active=this._active&&this._active.clone(),e._cloned=!0,this._cloned=!0,e},t.prototype.next=function(){if(this._active===void 0){var e=this._source.next();if(e===void 0)return;this._active=this._cloned?e.clone():e}var r=this._active.next();return r!==void 0?r:(this._active=void 0,this.next())},t}();var Dut=function(){function t(){}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t},t.prototype.next=function(){},t}();var Lut=function(){function t(e,r){this._source=e,this._index=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._index)},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return[this._index++,e]},t}();var Fut=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){for(var e=this._fn,r=this._source,i;(i=r.next())!==void 0;)if(e(i,this._index++))return i},t}();var Nut=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return this._fn.call(void 0,e,this._index++)},t}();var kut=function(){function t(e,r,i){this._index=0,this._start=e,this._stop=r,this._step=i,this._length=uD.rangeLength(e,r,i)}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},t}(),uD;(function(t){function e(r,i,n){return n===0?1/0:r>i&&n>0||r<i&&n<0?0:Math.ceil((i-r)/n)}t.rangeLength=e})(uD||(uD={}));var Uut=function(){function t(e,r){this._value=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._value,this._count)},t.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},t}();var zut=function(){function t(e){this._source=e,this._index=e.length-1}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},t}();var Vut=function(){function t(e,r){this._source=e,this._step=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var e=this._source.next(),r=this._step-1;r>0;--r)this._source.next();return e},t}(),dY;(function(t){function e(a,l,u){u===void 0&&(u=0);for(var f=new Array(l.length),_=0,w=u,E=l.length;_<E;++_,++w){if(w=a.indexOf(l[_],w),w===-1)return null;f[_]=w}return f}t.findIndices=e;function r(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=0,E=f.length;w<E;++w){var M=f[w]-u;_+=M*M}return{score:_,indices:f}}t.matchSumOfSquares=r;function i(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=u-1,E=0,M=f.length;E<M;++E){var D=f[E];_+=D-w-1,w=D}return{score:_,indices:f}}t.matchSumOfDeltas=i;function n(a,l,u){for(var f=[],_=0,w=0,E=l.length;_<E;){for(var M=l[_],D=l[_];++_<E&&l[_]===D+1;)D++;w<M&&f.push(a.slice(w,M)),M<D+1&&f.push(u(a.slice(M,D+1))),w=D+1}return w<a.length&&f.push(a.slice(w)),f}t.highlight=n;function o(a,l){return a<l?-1:a>l?1:0}t.cmp=o})(dY||(dY={}));var Hut=function(){function t(e,r){this._source=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._count)},t.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(e!==void 0)return this._count--,e}},t}();var jut=function(){function t(e){this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.map(function(e){return e.clone()}))},t.prototype.next=function(){for(var e=new Array(this._source.length),r=0,i=this._source.length;r<i;++r){var n=this._source[r].next();if(n===void 0)return;e[r]=n}return e},t}();var hD=function(t,e){return hD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},hD(t,e)};function pwe(t,e){hD(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var BS=function(){function t(e){this.type="text",this.content=e}return t}(),OS=function(){function t(e,r,i,n){this.type="element",this.tag=e,this.attrs=r,this.children=i,this.renderer=n}return t}(),qut=function(t){pwe(e,t);function e(r,i,n){return t.call(this,r,i,[],n||void 0)||this}return e}(OS);function Oo(t){for(var e={},r,i=[],n=1,o=arguments.length;n<o;++n){var a=arguments[n];typeof a=="string"?i.push(new BS(a)):a instanceof BS||a instanceof OS?i.push(a):a instanceof Array?l(i,a):(n===1||n===2)&&a&&typeof a=="object"&&("render"in a?r=a:e=a)}return new OS(t,e,i,r);function l(u,f){for(var _=0,w=f;_<w.length;_++){var E=w[_];typeof E=="string"?u.push(new BS(E)):(E instanceof BS||E instanceof OS)&&u.push(E)}}}(function(t){t.a=t.bind(void 0,"a"),t.abbr=t.bind(void 0,"abbr"),t.address=t.bind(void 0,"address"),t.area=t.bind(void 0,"area"),t.article=t.bind(void 0,"article"),t.aside=t.bind(void 0,"aside"),t.audio=t.bind(void 0,"audio"),t.b=t.bind(void 0,"b"),t.bdi=t.bind(void 0,"bdi"),t.bdo=t.bind(void 0,"bdo"),t.blockquote=t.bind(void 0,"blockquote"),t.br=t.bind(void 0,"br"),t.button=t.bind(void 0,"button"),t.canvas=t.bind(void 0,"canvas"),t.caption=t.bind(void 0,"caption"),t.cite=t.bind(void 0,"cite"),t.code=t.bind(void 0,"code"),t.col=t.bind(void 0,"col"),t.colgroup=t.bind(void 0,"colgroup"),t.data=t.bind(void 0,"data"),t.datalist=t.bind(void 0,"datalist"),t.dd=t.bind(void 0,"dd"),t.del=t.bind(void 0,"del"),t.dfn=t.bind(void 0,"dfn"),t.div=t.bind(void 0,"div"),t.dl=t.bind(void 0,"dl"),t.dt=t.bind(void 0,"dt"),t.em=t.bind(void 0,"em"),t.embed=t.bind(void 0,"embed"),t.fieldset=t.bind(void 0,"fieldset"),t.figcaption=t.bind(void 0,"figcaption"),t.figure=t.bind(void 0,"figure"),t.footer=t.bind(void 0,"footer"),t.form=t.bind(void 0,"form"),t.h1=t.bind(void 0,"h1"),t.h2=t.bind(void 0,"h2"),t.h3=t.bind(void 0,"h3"),t.h4=t.bind(void 0,"h4"),t.h5=t.bind(void 0,"h5"),t.h6=t.bind(void 0,"h6"),t.header=t.bind(void 0,"header"),t.hr=t.bind(void 0,"hr"),t.i=t.bind(void 0,"i"),t.iframe=t.bind(void 0,"iframe"),t.img=t.bind(void 0,"img"),t.input=t.bind(void 0,"input"),t.ins=t.bind(void 0,"ins"),t.kbd=t.bind(void 0,"kbd"),t.label=t.bind(void 0,"label"),t.legend=t.bind(void 0,"legend"),t.li=t.bind(void 0,"li"),t.main=t.bind(void 0,"main"),t.map=t.bind(void 0,"map"),t.mark=t.bind(void 0,"mark"),t.meter=t.bind(void 0,"meter"),t.nav=t.bind(void 0,"nav"),t.noscript=t.bind(void 0,"noscript"),t.object=t.bind(void 0,"object"),t.ol=t.bind(void 0,"ol"),t.optgroup=t.bind(void 0,"optgroup"),t.option=t.bind(void 0,"option"),t.output=t.bind(void 0,"output"),t.p=t.bind(void 0,"p"),t.param=t.bind(void 0,"param"),t.pre=t.bind(void 0,"pre"),t.progress=t.bind(void 0,"progress"),t.q=t.bind(void 0,"q"),t.rp=t.bind(void 0,"rp"),t.rt=t.bind(void 0,"rt"),t.ruby=t.bind(void 0,"ruby"),t.s=t.bind(void 0,"s"),t.samp=t.bind(void 0,"samp"),t.section=t.bind(void 0,"section"),t.select=t.bind(void 0,"select"),t.small=t.bind(void 0,"small"),t.source=t.bind(void 0,"source"),t.span=t.bind(void 0,"span"),t.strong=t.bind(void 0,"strong"),t.sub=t.bind(void 0,"sub"),t.summary=t.bind(void 0,"summary"),t.sup=t.bind(void 0,"sup"),t.table=t.bind(void 0,"table"),t.tbody=t.bind(void 0,"tbody"),t.td=t.bind(void 0,"td"),t.textarea=t.bind(void 0,"textarea"),t.tfoot=t.bind(void 0,"tfoot"),t.th=t.bind(void 0,"th"),t.thead=t.bind(void 0,"thead"),t.time=t.bind(void 0,"time"),t.title=t.bind(void 0,"title"),t.tr=t.bind(void 0,"tr"),t.track=t.bind(void 0,"track"),t.u=t.bind(void 0,"u"),t.ul=t.bind(void 0,"ul"),t.var_=t.bind(void 0,"var"),t.video=t.bind(void 0,"video"),t.wbr=t.bind(void 0,"wbr")})(Oo||(Oo={}));var Ld;(function(t){function e(i){return Vm.createDOMNode(i)}t.realize=e;function r(i,n){var o=Vm.hostMap.get(n)||[],a=Vm.asContentArray(i);Vm.hostMap.set(n,a),Vm.updateContent(n,o,a)}t.render=r})(Ld||(Ld={}));var Vm;(function(t){t.hostMap=new WeakMap;function e(M){return M?M instanceof Array?M:[M]:[]}t.asContentArray=e;function r(M){var D=arguments[1]||null,j=arguments[2]||null;if(D)D.insertBefore(r(M),j);else{if(M.type==="text")return document.createTextNode(M.content);if(D=document.createElement(M.tag),a(D,M.attrs),M.renderer)return M.renderer.render(D,{attrs:M.attrs,children:M.children}),D;for(var V=0,$=M.children.length;V<$;++V)r(M.children[V],D)}return D}t.createDOMNode=r;function i(M,D,j){if(D!==j){for(var V=E(M,D),$=D.slice(),te=M.firstChild,ne=j.length,le=0;le<ne;++le){if(le>=$.length){r(j[le],M);continue}var z=$[le],ke=j[le];if(z===ke){te=te.nextSibling;continue}if(z.type==="text"&&ke.type==="text"){te.textContent=ke.content,te=te.nextSibling;continue}if(z.type==="text"||ke.type==="text"){zp.insert($,le,ke),r(ke,M,te);continue}if(!z.renderer!=!ke.renderer){zp.insert($,le,ke),r(ke,M,te);continue}var Y=ke.attrs.key;if(Y&&Y in V){var X=V[Y];X.vNode!==z&&(zp.move($,$.indexOf(X.vNode,le+1),le),M.insertBefore(X.element,te),z=X.vNode,te=X.element)}if(z===ke){te=te.nextSibling;continue}var O=z.attrs.key;if(O&&O!==Y){zp.insert($,le,ke),r(ke,M,te);continue}if(z.tag!==ke.tag){zp.insert($,le,ke),r(ke,M,te);continue}l(te,z.attrs,ke.attrs),ke.renderer?ke.renderer.render(te,{attrs:ke.attrs,children:ke.children}):i(te,z.children,ke.children),te=te.nextSibling}n(M,$,ne,!0)}}t.updateContent=i;function n(M,D,j,V){for(var $=D.length-1;$>=j;--$){var te=D[$],ne=V?M.lastChild:M.childNodes[$];te.type==="text"||(te.renderer&&te.renderer.unrender?te.renderer.unrender(ne,{attrs:te.attrs,children:te.children}):n(ne,te.children,0,!1)),V&&M.removeChild(ne)}}var o={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function a(M,D){for(var j in D)j in o||(j.substr(0,2)==="on"?M[j]=D[j]:M.setAttribute(j,D[j]));D.className!==void 0&&M.setAttribute("class",D.className),D.htmlFor!==void 0&&M.setAttribute("for",D.htmlFor),D.dataset&&u(M,D.dataset),D.style&&_(M,D.style)}function l(M,D,j){if(D!==j){var V;for(V in D)V in o||V in j||(V.substr(0,2)==="on"?M[V]=null:M.removeAttribute(V));for(V in j)V in o||D[V]===j[V]||(V.substr(0,2)==="on"?M[V]=j[V]:M.setAttribute(V,j[V]));D.className!==j.className&&(j.className!==void 0?M.setAttribute("class",j.className):M.removeAttribute("class")),D.htmlFor!==j.htmlFor&&(j.htmlFor!==void 0?M.setAttribute("for",j.htmlFor):M.removeAttribute("for")),D.dataset!==j.dataset&&f(M,D.dataset||{},j.dataset||{}),D.style!==j.style&&w(M,D.style||{},j.style||{})}}function u(M,D){for(var j in D)M.setAttribute("data-"+j,D[j])}function f(M,D,j){for(var V in D)V in j||M.removeAttribute("data-"+V);for(var $ in j)D[$]!==j[$]&&M.setAttribute("data-"+$,j[$])}function _(M,D){var j=M.style,V;for(V in D)j[V]=D[V]}function w(M,D,j){var V=M.style,$;for($ in D)$ in j||(V[$]="");for($ in j)D[$]!==j[$]&&(V[$]=j[$])}function E(M,D){for(var j=M.firstChild,V=Object.create(null),$=0,te=D;$<te.length;$++){var ne=te[$];ne.type==="element"&&ne.attrs.key&&(V[ne.attrs.key]={vNode:ne,element:j}),j=j.nextSibling}return V}})(Vm||(Vm={}));var DS;(function(t){function e(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(Y[ye]===X)return ye}return-1}t.firstIndexOf=e;function r(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(Y[ye]===X)return ye}return-1}t.lastIndexOf=r;function i(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q){var ye=(O+Q)%H;if(X(Y[ye],ye))return ye}return-1}t.findFirstIndex=i;function n(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=Y.length;if(H===0)return-1;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;O<I?ie=O+1+(H-I):ie=O-I+1;for(var Q=0;Q<ie;++Q){var ye=(O-Q+H)%H;if(X(Y[ye],ye))return ye}return-1}t.findLastIndex=n;function o(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=i(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findFirstValue=o;function a(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=n(Y,X,O,I);return H!==-1?Y[H]:void 0}t.findLastValue=a;function l(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)<0?(Q=jt+1,ye-=it+1):ye=it}return Q}t.lowerBound=l;function u(Y,X,O,I,H){I===void 0&&(I=0),H===void 0&&(H=-1);var ie=Y.length;if(ie===0)return 0;I<0?I=Math.max(0,I+ie):I=Math.min(I,ie-1),H<0?H=Math.max(0,H+ie):H=Math.min(H,ie-1);for(var Q=I,ye=H-I+1;ye>0;){var it=ye>>1,jt=Q+it;O(Y[jt],X)>0?ye=it:(Q=jt+1,ye-=it+1)}return Q}t.upperBound=u;function f(Y,X,O){if(Y===X)return!0;if(Y.length!==X.length)return!1;for(var I=0,H=Y.length;I<H;++I)if(O?!O(Y[I],X[I]):Y[I]!==X[I])return!1;return!0}t.shallowEqual=f;function _(Y,X){X===void 0&&(X={});var O=X.start,I=X.stop,H=X.step;if(H===void 0&&(H=1),H===0)throw new Error("Slice `step` cannot be zero.");var ie=Y.length;O===void 0?O=H<0?ie-1:0:O<0?O=Math.max(O+ie,H<0?-1:0):O>=ie&&(O=H<0?ie-1:ie),I===void 0?I=H<0?-1:ie:I<0?I=Math.max(I+ie,H<0?-1:0):I>=ie&&(I=H<0?ie-1:ie);var Q;H<0&&I>=O||H>0&&O>=I?Q=0:H<0?Q=Math.floor((I-O+1)/H+1):Q=Math.floor((I-O-1)/H+1);for(var ye=[],it=0;it<Q;++it)ye[it]=Y[O+it*H];return ye}t.slice=_;function w(Y,X,O){var I=Y.length;if(!(I<=1)&&(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1),X!==O)){for(var H=Y[X],ie=X<O?1:-1,Q=X;Q!==O;Q+=ie)Y[Q]=Y[Q+ie];Y[O]=H}}t.move=w;function E(Y,X,O){X===void 0&&(X=0),O===void 0&&(O=-1);var I=Y.length;if(!(I<=1))for(X<0?X=Math.max(0,X+I):X=Math.min(X,I-1),O<0?O=Math.max(0,O+I):O=Math.min(O,I-1);X<O;){var H=Y[X],ie=Y[O];Y[X++]=ie,Y[O--]=H}}t.reverse=E;function M(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(!(H<=1)&&(O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1),!(O>=I))){var ie=I-O+1;if(X>0?X=X%ie:X<0&&(X=(X%ie+ie)%ie),X!==0){var Q=O+X;E(Y,O,Q-1),E(Y,Q,I),E(Y,O,I)}}}t.rotate=M;function D(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H!==0){O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);var ie;I<O?ie=I+1+(H-O):ie=I-O+1;for(var Q=0;Q<ie;++Q)Y[(O+Q)%H]=X}}t.fill=D;function j(Y,X,O){var I=Y.length;X<0?X=Math.max(0,X+I):X=Math.min(X,I);for(var H=I;H>X;--H)Y[H]=Y[H-1];Y[X]=O}t.insert=j;function V(Y,X){var O=Y.length;if(X<0&&(X+=O),!(X<0||X>=O)){for(var I=Y[X],H=X+1;H<O;++H)Y[H-1]=Y[H];return Y.length=O-1,I}}t.removeAt=V;function $(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=e(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeFirstOf=$;function te(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H=r(Y,X,O,I);return H!==-1&&V(Y,H),H}t.removeLastOf=te;function ne(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&Y[Q]===X||I<O&&(Q<=I||Q>=O)&&Y[Q]===X?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllOf=ne;function le(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H,ie=i(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeFirstWhere=le;function z(Y,X,O,I){O===void 0&&(O=-1),I===void 0&&(I=0);var H,ie=n(Y,X,O,I);return ie!==-1&&(H=V(Y,ie)),{index:ie,value:H}}t.removeLastWhere=z;function ke(Y,X,O,I){O===void 0&&(O=0),I===void 0&&(I=-1);var H=Y.length;if(H===0)return 0;O<0?O=Math.max(0,O+H):O=Math.min(O,H-1),I<0?I=Math.max(0,I+H):I=Math.min(I,H-1);for(var ie=0,Q=0;Q<H;++Q)O<=I&&Q>=O&&Q<=I&&X(Y[Q],Q)||I<O&&(Q<=I||Q>=O)&&X(Y[Q],Q)?ie++:ie>0&&(Y[Q-ie]=Y[Q]);return ie>0&&(Y.length=H-ie),ie}t.removeAllWhere=ke})(DS||(DS={}));function AY(t){var e;return typeof t.iter=="function"?e=t.iter():e=new Awe(t),e}function Hm(t,e){for(var r=0,i=AY(t),n;(n=i.next())!==void 0;)if(e(n,r++)===!1)return}var Awe=function(){function t(e){this._index=0,this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}(),Yut=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}},t}(),Kut=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}},t}(),Zut=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}},t}(),Jut=function(){function t(e){this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},t.prototype.next=function(){return this._fn.call(void 0)},t}();var Qut=function(){function t(e){this._cloned=!1,this._source=e,this._active=void 0}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone());return e._active=this._active&&this._active.clone(),e._cloned=!0,this._cloned=!0,e},t.prototype.next=function(){if(this._active===void 0){var e=this._source.next();if(e===void 0)return;this._active=this._cloned?e.clone():e}var r=this._active.next();return r!==void 0?r:(this._active=void 0,this.next())},t}();var $ut=function(){function t(){}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t},t.prototype.next=function(){},t}();var eht=function(){function t(e,r){this._source=e,this._index=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._index)},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return[this._index++,e]},t}();var tht=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){for(var e=this._fn,r=this._source,i;(i=r.next())!==void 0;)if(e(i,this._index++))return i},t}();function mY(t,e){for(var r=0,i=AY(t),n;(n=i.next())!==void 0;)if(e(n,r++))return n}var rht=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return this._fn.call(void 0,e,this._index++)},t}();var iht=function(){function t(e,r,i){this._index=0,this._start=e,this._stop=r,this._step=i,this._length=fD.rangeLength(e,r,i)}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},t}(),fD;(function(t){function e(r,i,n){return n===0?1/0:r>i&&n>0||r<i&&n<0?0:Math.ceil((i-r)/n)}t.rangeLength=e})(fD||(fD={}));var nht=function(){function t(e,r){this._value=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._value,this._count)},t.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},t}();var oht=function(){function t(e){this._source=e,this._index=e.length-1}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},t}();var sht=function(){function t(e,r){this._source=e,this._step=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var e=this._source.next(),r=this._step-1;r>0;--r)this._source.next();return e},t}(),pY;(function(t){function e(a,l,u){u===void 0&&(u=0);for(var f=new Array(l.length),_=0,w=u,E=l.length;_<E;++_,++w){if(w=a.indexOf(l[_],w),w===-1)return null;f[_]=w}return f}t.findIndices=e;function r(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=0,E=f.length;w<E;++w){var M=f[w]-u;_+=M*M}return{score:_,indices:f}}t.matchSumOfSquares=r;function i(a,l,u){u===void 0&&(u=0);var f=e(a,l,u);if(!f)return null;for(var _=0,w=u-1,E=0,M=f.length;E<M;++E){var D=f[E];_+=D-w-1,w=D}return{score:_,indices:f}}t.matchSumOfDeltas=i;function n(a,l,u){for(var f=[],_=0,w=0,E=l.length;_<E;){for(var M=l[_],D=l[_];++_<E&&l[_]===D+1;)D++;w<M&&f.push(a.slice(w,M)),M<D+1&&f.push(u(a.slice(M,D+1))),w=D+1}return w<a.length&&f.push(a.slice(w)),f}t.highlight=n;function o(a,l){return a<l?-1:a>l?1:0}t.cmp=o})(pY||(pY={}));var aht=function(){function t(e,r){this._source=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._count)},t.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(e!==void 0)return this._count--,e}},t}();var lht=function(){function t(e){this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.map(function(e){return e.clone()}))},t.prototype.next=function(){for(var e=new Array(this._source.length),r=0,i=this._source.length;r<i;++r){var n=this._source[r].next();if(n===void 0)return;e[r]=n}return e},t}();var jm=function(){function t(e){this.sender=e}return t.prototype.connect=function(e,r){return su.connect(this,e,r)},t.prototype.disconnect=function(e,r){return su.disconnect(this,e,r)},t.prototype.emit=function(e){su.emit(this,e)},t}();(function(t){function e(u,f){su.disconnectBetween(u,f)}t.disconnectBetween=e;function r(u){su.disconnectSender(u)}t.disconnectSender=r;function i(u){su.disconnectReceiver(u)}t.disconnectReceiver=i;function n(u){su.disconnectAll(u)}t.disconnectAll=n;function o(u){su.disconnectAll(u)}t.clearData=o;function a(){return su.exceptionHandler}t.getExceptionHandler=a;function l(u){var f=su.exceptionHandler;return su.exceptionHandler=u,f}t.setExceptionHandler=l})(jm||(jm={}));var su;(function(t){t.exceptionHandler=function(te){console.error(te)};function e(te,ne,le){le=le||void 0;var z=u.get(te.sender);if(z||(z=[],u.set(te.sender,z)),E(z,te,ne,le))return!1;var ke=le||ne,Y=f.get(ke);Y||(Y=[],f.set(ke,Y));var X={signal:te,slot:ne,thisArg:le};return z.push(X),Y.push(X),!0}t.connect=e;function r(te,ne,le){le=le||void 0;var z=u.get(te.sender);if(!z||z.length===0)return!1;var ke=E(z,te,ne,le);if(!ke)return!1;var Y=le||ne,X=f.get(Y);return ke.signal=null,D(z),D(X),!0}t.disconnect=r;function i(te,ne){var le=u.get(te);if(!(!le||le.length===0)){var z=f.get(ne);!z||z.length===0||(Hm(z,function(ke){ke.signal&&ke.signal.sender===te&&(ke.signal=null)}),D(le),D(z))}}t.disconnectBetween=i;function n(te){var ne=u.get(te);!ne||ne.length===0||(Hm(ne,function(le){if(le.signal){var z=le.thisArg||le.slot;le.signal=null,D(f.get(z))}}),D(ne))}t.disconnectSender=n;function o(te){var ne=f.get(te);!ne||ne.length===0||(Hm(ne,function(le){if(le.signal){var z=le.signal.sender;le.signal=null,D(u.get(z))}}),D(ne))}t.disconnectReceiver=o;function a(te){n(te),o(te)}t.disconnectAll=a;function l(te,ne){var le=u.get(te.sender);if(!(!le||le.length===0))for(var z=0,ke=le.length;z<ke;++z){var Y=le[z];Y.signal===te&&M(Y,ne)}}t.emit=l;var u=new WeakMap,f=new WeakMap,_=new Set,w=function(){var te=typeof requestAnimationFrame=="function";return te?requestAnimationFrame:setImmediate}();function E(te,ne,le,z){return mY(te,function(ke){return ke.signal===ne&&ke.slot===le&&ke.thisArg===z})}function M(te,ne){var le=te.signal,z=te.slot,ke=te.thisArg;try{z.call(ke,le.sender,ne)}catch(Y){t.exceptionHandler(Y)}}function D(te){_.size===0&&w(j),_.add(te)}function j(){_.forEach(V),_.clear()}function V(te){DS.removeAllWhere(te,$)}function $(te){return te.signal===null}})(su||(su={}));var dD=function(t,e){return dD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},dD(t,e)};function _Y(t,e){dD(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var AD=function(){function t(e){this._fn=e}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return!this._fn},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this._fn){var e=this._fn;this._fn=null,e()}},t}(),pht=function(t){_Y(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._disposed=new jm(r),r}return Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),jm.clearData(this))},e}(AD),pD=function(){function t(){this._isDisposed=!1,this._items=new Set}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(function(e){e.dispose()}),this._items.clear())},t.prototype.contains=function(e){return this._items.has(e)},t.prototype.add=function(e){this._items.add(e)},t.prototype.remove=function(e){this._items.delete(e)},t.prototype.clear=function(){this._items.clear()},t}();(function(t){function e(r){var i=new t;return Hm(r,function(n){i.add(n)}),i}t.from=e})(pD||(pD={}));var gY=function(t){_Y(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._disposed=new jm(r),r}return Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),jm.clearData(this))},e}(pD);(function(t){function e(r){var i=new t;return Hm(r,function(n){i.add(n)}),i}t.from=e})(gY||(gY={}));var Vp=function(){function t(e){var r=this;this._onScrollFrame=function(){if(r._scrollTarget){var i=r._scrollTarget,n=i.element,o=i.edge,a=i.distance,l=$l.SCROLL_EDGE_SIZE-a,u=Math.pow(l/$l.SCROLL_EDGE_SIZE,2),f=Math.max(1,Math.round(u*$l.SCROLL_EDGE_SIZE));switch(o){case"top":n.scrollTop-=f;break;case"left":n.scrollLeft-=f;break;case"right":n.scrollLeft+=f;break;case"bottom":n.scrollTop+=f;break}requestAnimationFrame(r._onScrollFrame)}},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.mimeData=e.mimeData,this.dragImage=e.dragImage||null,this.proposedAction=e.proposedAction||"copy",this.supportedActions=e.supportedActions||"all",this.source=e.source||null}return t.prototype.dispose=function(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){var e=$l.createMouseEvent("mouseup",-1,-1);$l.dispatchDragLeave(this,this._currentTarget,null,e)}this._finalize("none")}},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.start=function(e,r){var i=this;if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(e,r),this._promise=new Promise(function(o,a){i._resolve=o});var n=$l.createMouseEvent("mousemove",e,r);return document.dispatchEvent(n),this._promise},t.prototype.handleEvent=function(e){switch(e.type){case"mousemove":this._evtMouseMove(e);break;case"mouseup":this._evtMouseUp(e);break;case"keydown":this._evtKeyDown(e);break;default:e.preventDefault(),e.stopPropagation();break}},t.prototype._evtMouseMove=function(e){e.preventDefault(),e.stopPropagation(),this._updateCurrentTarget(e),this._updateDragScroll(e),this._moveDragImage(e.clientX,e.clientY)},t.prototype._evtMouseUp=function(e){if(e.preventDefault(),e.stopPropagation(),e.button===0){if(this._updateCurrentTarget(e),!this._currentTarget){this._finalize("none");return}if(this._dropAction==="none"){$l.dispatchDragLeave(this,this._currentTarget,null,e),this._finalize("none");return}var r=$l.dispatchDrop(this,this._currentTarget,e);this._finalize(r)}},t.prototype._evtKeyDown=function(e){e.preventDefault(),e.stopPropagation(),e.keyCode===27&&this.dispose()},t.prototype._addListeners=function(){document.addEventListener("mousedown",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("mouseenter",this,!0),document.addEventListener("mouseleave",this,!0),document.addEventListener("mouseover",this,!0),document.addEventListener("mouseout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)},t.prototype._removeListeners=function(){document.removeEventListener("mousedown",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mouseenter",this,!0),document.removeEventListener("mouseleave",this,!0),document.removeEventListener("mouseover",this,!0),document.removeEventListener("mouseout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)},t.prototype._updateDragScroll=function(e){var r=$l.findScrollTarget(e);!this._scrollTarget&&!r||(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=r)},t.prototype._updateCurrentTarget=function(e){var r=this._currentTarget,i=this._currentTarget,n=this._currentElement,o=document.elementFromPoint(e.clientX,e.clientY);this._currentElement=o,o!==n&&o!==i&&$l.dispatchDragExit(this,i,o,e),o!==n&&o!==i&&(i=$l.dispatchDragEnter(this,o,i,e)),i!==r&&(this._currentTarget=i,$l.dispatchDragLeave(this,r,i,e));var a=$l.dispatchDragOver(this,i,e);this._setDropAction(a)},t.prototype._attachDragImage=function(e,r){if(this.dragImage){this.dragImage.classList.add("lm-mod-drag-image"),this.dragImage.classList.add("p-mod-drag-image");var i=this.dragImage.style;i.pointerEvents="none",i.position="fixed",i.top=r+"px",i.left=e+"px",document.body.appendChild(this.dragImage)}},t.prototype._moveDragImage=function(e,r){if(this.dragImage){var i=this.dragImage.style;i.top=r+"px",i.left=e+"px"}},t.prototype._detachDragImage=function(){if(this.dragImage){var e=this.dragImage.parentNode;e&&e.removeChild(this.dragImage)}},t.prototype._setDropAction=function(e){if(e=$l.validateAction(e,this.supportedActions),!(this._override&&this._dropAction===e))switch(e){case"none":this._dropAction=e,this._override=t.overrideCursor("no-drop");break;case"copy":this._dropAction=e,this._override=t.overrideCursor("copy");break;case"link":this._dropAction=e,this._override=t.overrideCursor("alias");break;case"move":this._dropAction=e,this._override=t.overrideCursor("move");break}},t.prototype._finalize=function(e){var r=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,r&&r(e)},t}();(function(t){function e(i){var n=++r;return document.body.style.cursor=i,document.body.classList.add("lm-mod-override-cursor"),document.body.classList.add("p-mod-override-cursor"),new AD(function(){n===r&&(document.body.style.cursor="",document.body.classList.remove("lm-mod-override-cursor"),document.body.classList.remove("p-mod-override-cursor"))})}t.overrideCursor=e;var r=0})(Vp||(Vp={}));var $l;(function(t){t.SCROLL_EDGE_SIZE=20;function e(E,M){return f[E]&_[M]?E:"none"}t.validateAction=e;function r(E,M,D){var j=document.createEvent("MouseEvent");return j.initMouseEvent(E,!0,!0,window,0,0,0,M,D,!1,!1,!1,!1,0,null),j}t.createMouseEvent=r;function i(E){for(var M=E.clientX,D=E.clientY,j=document.elementFromPoint(M,D);j;j=j.parentElement){var V=j.hasAttribute("data-lm-dragscroll");if(V=V||j.hasAttribute("data-p-dragscroll"),!!V){var $=0,te=0;j===document.body&&($=window.pageXOffset,te=window.pageYOffset);var ne=j.getBoundingClientRect(),le=ne.top+te,z=ne.left+$,ke=z+ne.width,Y=le+ne.height;if(!(M<z||M>=ke||D<le||D>=Y)){var X=M-z+1,O=D-le+1,I=ke-M,H=Y-D,ie=Math.min(X,O,I,H);if(!(ie>t.SCROLL_EDGE_SIZE)){var Q=void 0;switch(ie){case H:Q="bottom";break;case O:Q="top";break;case I:Q="right";break;case X:Q="left";break;default:throw"unreachable"}var ye=j.scrollWidth-j.clientWidth,it=j.scrollHeight-j.clientHeight,jt=void 0;switch(Q){case"top":jt=it>0&&j.scrollTop>0;break;case"left":jt=ye>0&&j.scrollLeft>0;break;case"right":jt=ye>0&&j.scrollLeft<ye;break;case"bottom":jt=it>0&&j.scrollTop<it;break;default:throw"unreachable"}if(jt)return{element:j,edge:Q,distance:ie}}}}}return null}t.findScrollTarget=i;function n(E,M,D,j){if(!M)return null;var V=w("lm-dragenter",E,j,D),$=!M.dispatchEvent(V);return $||(V=w("p-dragenter",E,j,D),$=!M.dispatchEvent(V),$)?M:M===document.body?D:(V=w("lm-dragenter",E,j,D),document.body.dispatchEvent(V),V=w("p-dragenter",E,j,D),document.body.dispatchEvent(V),document.body)}t.dispatchDragEnter=n;function o(E,M,D,j){if(M){var V=w("lm-dragexit",E,j,D);M.dispatchEvent(V),V=w("p-dragexit",E,j,D),M.dispatchEvent(V)}}t.dispatchDragExit=o;function a(E,M,D,j){if(M){var V=w("lm-dragleave",E,j,D);M.dispatchEvent(V),V=w("p-dragleave",E,j,D),M.dispatchEvent(V)}}t.dispatchDragLeave=a;function l(E,M,D){if(!M)return"none";var j=w("lm-dragover",E,D,null),V=!M.dispatchEvent(j);return V||(j=w("p-dragover",E,D,null),V=!M.dispatchEvent(j),V)?j.dropAction:"none"}t.dispatchDragOver=l;function u(E,M,D){if(!M)return"none";var j=w("lm-drop",E,D,null),V=!M.dispatchEvent(j);return V||(j=w("p-drop",E,D,null),V=!M.dispatchEvent(j),V)?j.dropAction:"none"}t.dispatchDrop=u;var f={none:0,copy:1,link:2,move:4},_={none:f.none,copy:f.copy,link:f.link,move:f.move,"copy-link":f.copy|f.link,"copy-move":f.copy|f.move,"link-move":f.link|f.move,all:f.copy|f.link|f.move};function w(E,M,D,j){var V=document.createEvent("MouseEvent");return V.initMouseEvent(E,!0,!0,window,0,D.screenX,D.screenY,D.clientX,D.clientY,D.ctrlKey,D.altKey,D.shiftKey,D.metaKey,D.button,j),V.dropAction="none",V.mimeData=M.mimeData,V.proposedAction=M.proposedAction,V.supportedActions=M.supportedActions,V.source=M.source,V}})($l||($l={}));var jp=function(){function t(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}return t}(),au;(function(t){function e(o,a){var l=o.length;if(l===0)return a;for(var u=0,f=0,_=0,w=0,E=0,M=0;M<l;++M){var D=o[M],j=D.minSize,V=D.maxSize,$=D.sizeHint;D.done=!1,D.size=Math.max(j,Math.min($,V)),_+=D.size,u+=j,f+=V,D.stretch>0&&(w+=D.stretch,E++)}if(a===_)return 0;if(a<=u){for(var M=0;M<l;++M){var D=o[M];D.size=D.minSize}return a-u}if(a>=f){for(var M=0;M<l;++M){var D=o[M];D.size=D.maxSize}return a-f}var te=.01,ne=l;if(a<_){for(var le=_-a;E>0&&le>te;)for(var z=le,ke=w,M=0;M<l;++M){var D=o[M];if(!(D.done||D.stretch===0)){var Y=D.stretch*z/ke;D.size-Y<=D.minSize?(le-=D.size-D.minSize,w-=D.stretch,D.size=D.minSize,D.done=!0,ne--,E--):(le-=Y,D.size-=Y)}}for(;ne>0&&le>te;)for(var Y=le/ne,M=0;M<l;++M){var D=o[M];D.done||(D.size-Y<=D.minSize?(le-=D.size-D.minSize,D.size=D.minSize,D.done=!0,ne--):(le-=Y,D.size-=Y))}}else{for(var le=a-_;E>0&&le>te;)for(var z=le,ke=w,M=0;M<l;++M){var D=o[M];if(!(D.done||D.stretch===0)){var Y=D.stretch*z/ke;D.size+Y>=D.maxSize?(le-=D.maxSize-D.size,w-=D.stretch,D.size=D.maxSize,D.done=!0,ne--,E--):(le-=Y,D.size+=Y)}}for(;ne>0&&le>te;)for(var Y=le/ne,M=0;M<l;++M){var D=o[M];D.done||(D.size+Y>=D.maxSize?(le-=D.maxSize-D.size,D.size=D.maxSize,D.done=!0,ne--):(le-=Y,D.size+=Y))}}return 0}t.calc=e;function r(o,a,l){o.length===0||l===0||(l>0?i(o,a,l):n(o,a,-l))}t.adjust=r;function i(o,a,l){for(var u=0,f=0;f<=a;++f){var _=o[f];u+=_.maxSize-_.size}for(var w=0,f=a+1,E=o.length;f<E;++f){var _=o[f];w+=_.size-_.minSize}l=Math.min(l,u,w);for(var M=l,f=a;f>=0&&M>0;--f){var _=o[f],D=_.maxSize-_.size;D>=M?(_.sizeHint=_.size+M,M=0):(_.sizeHint=_.size+D,M-=D)}for(var j=l,f=a+1,E=o.length;f<E&&j>0;++f){var _=o[f],D=_.size-_.minSize;D>=j?(_.sizeHint=_.size-j,j=0):(_.sizeHint=_.size-D,j-=D)}}function n(o,a,l){for(var u=0,f=a+1,_=o.length;f<_;++f){var w=o[f];u+=w.maxSize-w.size}for(var E=0,f=0;f<=a;++f){var w=o[f];E+=w.size-w.minSize}l=Math.min(l,u,E);for(var M=l,f=a+1,_=o.length;f<_&&M>0;++f){var w=o[f],D=w.maxSize-w.size;D>=M?(w.sizeHint=w.size+M,M=0):(w.sizeHint=w.size+D,M-=D)}for(var j=l,f=a;f>=0&&j>0;--f){var w=o[f],D=w.size-w.minSize;D>=j?(w.sizeHint=w.size-j,j=0):(w.sizeHint=w.size-D,j-=D)}}})(au||(au={}));var mD=function(t,e){return mD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},mD(t,e)};function Oa(t,e){mD(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Of=function(){return Of=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Of.apply(this,arguments)},gD=function(){function t(e){this._label="",this._caption="",this._mnemonic=-1,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new Eo(this),this.owner=e.owner,e.label!==void 0&&(this._label=e.label),e.mnemonic!==void 0&&(this._mnemonic=e.mnemonic),e.icon!==void 0?typeof e.icon=="string"?(this._icon=null,this._iconClass=e.icon):this._icon=e.icon:this._icon=null,e.iconClass!==void 0&&(this._iconClass=e.iconClass),e.iconLabel!==void 0&&(this._iconLabel=e.iconLabel),e.iconRenderer!==void 0&&(this._icon=e.iconRenderer),e.caption!==void 0&&(this._caption=e.caption),e.className!==void 0&&(this._className=e.className),e.closable!==void 0&&(this._closable=e.closable),this._dataset=e.dataset||{}}return Object.defineProperty(t.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){return this._label},set:function(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mnemonic",{get:function(){return this._mnemonic},set:function(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon===null?this.iconClass:this._icon},set:function(e){if(typeof e=="string")this._icon=null,this.iconClass=e;else{if(this._icon===e)return;this._icon=e,this._changed.emit(void 0)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconClass",{get:function(){return this._iconClass},set:function(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconLabel",{get:function(){return this._iconLabel},set:function(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconRenderer",{get:function(){return this._icon||void 0},set:function(e){this.icon=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"caption",{get:function(){return this._caption},set:function(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return this._className},set:function(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"closable",{get:function(){return this._closable},set:function(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataset",{get:function(){return this._dataset},set:function(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),t}(),ai=function(){function t(e){e===void 0&&(e={}),this._flags=0,this._layout=null,this._parent=null,this._disposed=new Eo(this),this.node=LS.createNode(e),this.addClass("lm-Widget"),this.addClass("p-Widget")}return t.prototype.dispose=function(){this.isDisposed||(this.setFlag(t.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&t.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),Eo.clearData(this),Pr.clearData(this),nu.clearData(this))},Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.testFlag(t.Flag.IsDisposed)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){return this.testFlag(t.Flag.IsAttached)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.testFlag(t.Flag.IsHidden)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.testFlag(t.Flag.IsVisible)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return LS.titleProperty.get(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.node.id},set:function(e){this.node.id=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataset",{get:function(){return this.node.dataset},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){var r=new t.ChildMessage("child-removed",this);Pr.sendMessage(this._parent,r)}if(this._parent=e,this._parent&&!this._parent.isDisposed){var r=new t.ChildMessage("child-added",this);Pr.sendMessage(this._parent,r)}this.isDisposed||Pr.sendMessage(this,t.Msg.ParentChanged)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){return this._layout},set:function(e){if(this._layout!==e){if(this.testFlag(t.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}},enumerable:!0,configurable:!0}),t.prototype.children=function(){return this._layout?this._layout.iter():Bf()},t.prototype.contains=function(e){for(var r=e;r;r=r._parent)if(r===this)return!0;return!1},t.prototype.hasClass=function(e){return this.node.classList.contains(e)},t.prototype.addClass=function(e){this.node.classList.add(e)},t.prototype.removeClass=function(e){this.node.classList.remove(e)},t.prototype.toggleClass=function(e,r){return r===!0?(this.node.classList.add(e),!0):r===!1?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)},t.prototype.update=function(){Pr.postMessage(this,t.Msg.UpdateRequest)},t.prototype.fit=function(){Pr.postMessage(this,t.Msg.FitRequest)},t.prototype.activate=function(){Pr.postMessage(this,t.Msg.ActivateRequest)},t.prototype.close=function(){Pr.sendMessage(this,t.Msg.CloseRequest)},t.prototype.show=function(){if(this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&Pr.sendMessage(this,t.Msg.BeforeShow),this.clearFlag(t.Flag.IsHidden),this.removeClass("lm-mod-hidden"),this.removeClass("p-mod-hidden"),this.isAttached&&(!this.parent||this.parent.isVisible)&&Pr.sendMessage(this,t.Msg.AfterShow),this.parent)){var e=new t.ChildMessage("child-shown",this);Pr.sendMessage(this.parent,e)}},t.prototype.hide=function(){if(!this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&Pr.sendMessage(this,t.Msg.BeforeHide),this.setFlag(t.Flag.IsHidden),this.addClass("lm-mod-hidden"),this.addClass("p-mod-hidden"),this.isAttached&&(!this.parent||this.parent.isVisible)&&Pr.sendMessage(this,t.Msg.AfterHide),this.parent)){var e=new t.ChildMessage("child-hidden",this);Pr.sendMessage(this.parent,e)}},t.prototype.setHidden=function(e){e?this.hide():this.show()},t.prototype.testFlag=function(e){return(this._flags&e)!==0},t.prototype.setFlag=function(e){this._flags|=e},t.prototype.clearFlag=function(e){this._flags&=~e},t.prototype.processMessage=function(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":!this.isHidden&&(!this.parent||this.parent.isVisible)&&this.setFlag(t.Flag.IsVisible),this.setFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(t.Flag.IsVisible),this.clearFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e);break}},t.prototype.notifyLayout=function(e){this._layout&&this._layout.processParentMessage(e)},t.prototype.onCloseRequest=function(e){this.parent?this.parent=null:this.isAttached&&t.detach(this)},t.prototype.onResize=function(e){},t.prototype.onUpdateRequest=function(e){},t.prototype.onFitRequest=function(e){},t.prototype.onActivateRequest=function(e){},t.prototype.onBeforeShow=function(e){},t.prototype.onAfterShow=function(e){},t.prototype.onBeforeHide=function(e){},t.prototype.onAfterHide=function(e){},t.prototype.onBeforeAttach=function(e){},t.prototype.onAfterAttach=function(e){},t.prototype.onBeforeDetach=function(e){},t.prototype.onAfterDetach=function(e){},t.prototype.onChildAdded=function(e){},t.prototype.onChildRemoved=function(e){},t}();(function(t){var e;(function(l){l[l.IsDisposed=1]="IsDisposed",l[l.IsAttached=2]="IsAttached",l[l.IsHidden=4]="IsHidden",l[l.IsVisible=8]="IsVisible",l[l.DisallowLayout=16]="DisallowLayout"})(e=t.Flag||(t.Flag={}));var r;(function(l){l.BeforeShow=new iu("before-show"),l.AfterShow=new iu("after-show"),l.BeforeHide=new iu("before-hide"),l.AfterHide=new iu("after-hide"),l.BeforeAttach=new iu("before-attach"),l.AfterAttach=new iu("after-attach"),l.BeforeDetach=new iu("before-detach"),l.AfterDetach=new iu("after-detach"),l.ParentChanged=new iu("parent-changed"),l.UpdateRequest=new E_("update-request"),l.FitRequest=new E_("fit-request"),l.ActivateRequest=new E_("activate-request"),l.CloseRequest=new E_("close-request")})(r=t.Msg||(t.Msg={}));var i=function(l){Oa(u,l);function u(f,_){var w=l.call(this,f)||this;return w.child=_,w}return u}(iu);t.ChildMessage=i;var n=function(l){Oa(u,l);function u(f,_){var w=l.call(this,"resize")||this;return w.width=f,w.height=_,w}return u}(iu);t.ResizeMessage=n,function(l){l.UnknownSize=new l(-1,-1)}(n=t.ResizeMessage||(t.ResizeMessage={}));function o(l,u,f){if(f===void 0&&(f=null),l.parent)throw new Error("Cannot attach a child widget.");if(l.isAttached||document.body.contains(l.node))throw new Error("Widget is already attached.");if(!document.body.contains(u))throw new Error("Host is not attached.");Pr.sendMessage(l,t.Msg.BeforeAttach),u.insertBefore(l.node,f),Pr.sendMessage(l,t.Msg.AfterAttach)}t.attach=o;function a(l){if(l.parent)throw new Error("Cannot detach a child widget.");if(!l.isAttached||!document.body.contains(l.node))throw new Error("Widget is not attached.");Pr.sendMessage(l,t.Msg.BeforeDetach),l.node.parentNode.removeChild(l.node),Pr.sendMessage(l,t.Msg.AfterDetach)}t.detach=a})(ai||(ai={}));var LS;(function(t){t.titleProperty=new nu({name:"title",create:function(r){return new gD({owner:r})}});function e(r){return r.node||document.createElement("div")}t.createNode=e})(LS||(LS={}));var Gp=function(){function t(e){e===void 0&&(e={}),this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}return t.prototype.dispose=function(){this._parent=null,this._disposed=!0,Eo.clearData(this),nu.clearData(this)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fitPolicy",{get:function(){return this._fitPolicy},set:function(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){var r=this._parent.node.style;r.minWidth="",r.minHeight="",r.maxWidth="",r.maxHeight="",this._parent.fit()}},enumerable:!0,configurable:!0}),t.prototype.processParentMessage=function(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e);break}},t.prototype.init=function(){var e=this;hn(this,function(r){r.parent=e.parent})},t.prototype.onResize=function(e){hn(this,function(r){Pr.sendMessage(r,ai.ResizeMessage.UnknownSize)})},t.prototype.onUpdateRequest=function(e){hn(this,function(r){Pr.sendMessage(r,ai.ResizeMessage.UnknownSize)})},t.prototype.onBeforeAttach=function(e){hn(this,function(r){Pr.sendMessage(r,e)})},t.prototype.onAfterAttach=function(e){hn(this,function(r){Pr.sendMessage(r,e)})},t.prototype.onBeforeDetach=function(e){hn(this,function(r){Pr.sendMessage(r,e)})},t.prototype.onAfterDetach=function(e){hn(this,function(r){Pr.sendMessage(r,e)})},t.prototype.onBeforeShow=function(e){hn(this,function(r){r.isHidden||Pr.sendMessage(r,e)})},t.prototype.onAfterShow=function(e){hn(this,function(r){r.isHidden||Pr.sendMessage(r,e)})},t.prototype.onBeforeHide=function(e){hn(this,function(r){r.isHidden||Pr.sendMessage(r,e)})},t.prototype.onAfterHide=function(e){hn(this,function(r){r.isHidden||Pr.sendMessage(r,e)})},t.prototype.onChildRemoved=function(e){this.removeWidget(e.child)},t.prototype.onFitRequest=function(e){},t.prototype.onChildShown=function(e){},t.prototype.onChildHidden=function(e){},t}();(function(t){function e(o){return M_.horizontalAlignmentProperty.get(o)}t.getHorizontalAlignment=e;function r(o,a){M_.horizontalAlignmentProperty.set(o,a)}t.setHorizontalAlignment=r;function i(o){return M_.verticalAlignmentProperty.get(o)}t.getVerticalAlignment=i;function n(o,a){M_.verticalAlignmentProperty.set(o,a)}t.setVerticalAlignment=n})(Gp||(Gp={}));var U1=function(){function t(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute"}return t.prototype.dispose=function(){if(!this._disposed){this._disposed=!0;var e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height=""}},Object.defineProperty(t.prototype,"minWidth",{get:function(){return this._minWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minHeight",{get:function(){return this._minHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){return this._maxWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxHeight",{get:function(){return this._maxHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.widget.isHidden},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.widget.isVisible},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){return this.widget.isAttached},enumerable:!0,configurable:!0}),t.prototype.fit=function(){var e=Bo.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight},t.prototype.update=function(e,r,i,n){var o=Math.max(this._minWidth,Math.min(i,this._maxWidth)),a=Math.max(this._minHeight,Math.min(n,this._maxHeight));if(o<i)switch(Gp.getHorizontalAlignment(this.widget)){case"left":break;case"center":e+=(i-o)/2;break;case"right":e+=i-o;break;default:throw"unreachable"}if(a<n)switch(Gp.getVerticalAlignment(this.widget)){case"top":break;case"center":r+=(n-a)/2;break;case"bottom":r+=n-a;break;default:throw"unreachable"}var l=!1,u=this.widget.node.style;if(this._top!==r&&(this._top=r,u.top=r+"px"),this._left!==e&&(this._left=e,u.left=e+"px"),this._width!==o&&(l=!0,this._width=o,u.width=o+"px"),this._height!==a&&(l=!0,this._height=a,u.height=a+"px"),l){var f=new ai.ResizeMessage(o,a);Pr.sendMessage(this.widget,f)}},t}(),M_;(function(t){t.horizontalAlignmentProperty=new nu({name:"horizontalAlignment",create:function(){return"center"},changed:e}),t.verticalAlignmentProperty=new nu({name:"verticalAlignment",create:function(){return"top"},changed:e});function e(r){r.parent&&r.parent.layout&&r.parent.update()}})(M_||(M_={}));var zS=function(t){Oa(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._widgets=[],r}return e.prototype.dispose=function(){for(;this._widgets.length>0;)this._widgets.pop().dispose();t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return Rh(this._widgets)},e.prototype.addWidget=function(r){this.insertWidget(this._widgets.length,r)},e.prototype.insertWidget=function(r,i){i.parent=this.parent;var n=this._widgets.indexOf(i),o=Math.max(0,Math.min(r,this._widgets.length));if(n===-1){ei.insert(this._widgets,o,i),this.parent&&this.attachWidget(o,i);return}o===this._widgets.length&&o--,n!==o&&(ei.move(this._widgets,n,o),this.parent&&this.moveWidget(n,o,i))},e.prototype.removeWidget=function(r){this.removeWidgetAt(this._widgets.indexOf(r))},e.prototype.removeWidgetAt=function(r){var i=ei.removeAt(this._widgets,r);i&&this.parent&&this.detachWidget(r,i)},e.prototype.init=function(){var r=this;t.prototype.init.call(this),hn(this,function(i,n){r.attachWidget(n,i)})},e.prototype.attachWidget=function(r,i){var n=this.parent.node.children[r];this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,n),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterAttach)},e.prototype.moveWidget=function(r,i,n){this.parent.isAttached&&Pr.sendMessage(n,ai.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&Pr.sendMessage(n,ai.Msg.AfterDetach);var o=this.parent.node.children[i];this.parent.isAttached&&Pr.sendMessage(n,ai.Msg.BeforeAttach),this.parent.node.insertBefore(n.node,o),this.parent.isAttached&&Pr.sendMessage(n,ai.Msg.AfterAttach)},e.prototype.detachWidget=function(r,i){this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterDetach)},e}(Gp),Lh=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;return i._fixed=0,i._spacing=4,i._dirty=!1,i._sizers=[],i._items=[],i._box=null,i._alignment="start",i._direction="top-to-bottom",r.direction!==void 0&&(i._direction=r.direction),r.alignment!==void 0&&(i._alignment=r.alignment),r.spacing!==void 0&&(i._spacing=Fd.clampSpacing(r.spacing)),i}return e.prototype.dispose=function(){hn(this._items,function(r){r.dispose()}),this._box=null,this._items.length=0,this._sizers.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"direction",{get:function(){return this._direction},set:function(r){this._direction!==r&&(this._direction=r,this.parent&&(this.parent.dataset.direction=r,this.parent.fit()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this._alignment},set:function(r){this._alignment!==r&&(this._alignment=r,this.parent&&(this.parent.dataset.alignment=r,this.parent.update()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(r){r=Fd.clampSpacing(r),this._spacing!==r&&(this._spacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),e.prototype.init=function(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,t.prototype.init.call(this)},e.prototype.attachWidget=function(r,i){ei.insert(this._items,r,new U1(i)),ei.insert(this._sizers,r,new jp),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterAttach),this.parent.fit()},e.prototype.moveWidget=function(r,i,n){ei.move(this._items,r,i),ei.move(this._sizers,r,i),this.parent.update()},e.prototype.detachWidget=function(r,i){var n=ei.removeAt(this._items,r);ei.removeAt(this._sizers,r),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterDetach),n.dispose(),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var r=0,i=0,n=this._items.length;i<n;++i)r+=+!this._items[i].isHidden;this._fixed=this._spacing*Math.max(0,r-1);for(var o=Fd.isHorizontal(this._direction),a=o?this._fixed:0,l=o?0:this._fixed,i=0,n=this._items.length;i<n;++i){var u=this._items[i],f=this._sizers[i];if(u.isHidden){f.minSize=0,f.maxSize=0;continue}u.fit(),f.sizeHint=e.getSizeBasis(u.widget),f.stretch=e.getStretch(u.widget),o?(f.minSize=u.minWidth,f.maxSize=u.maxWidth,a+=u.minWidth,l=Math.max(l,u.minHeight)):(f.minSize=u.minHeight,f.maxSize=u.maxHeight,l+=u.minHeight,a=Math.max(a,u.minWidth))}var _=this._box=Bo.boxSizing(this.parent.node);a+=_.horizontalSum,l+=_.verticalSum;var w=this.parent.node.style;w.minWidth=a+"px",w.minHeight=l+"px",this._dirty=!0,this.parent.parent&&Pr.sendMessage(this.parent.parent,ai.Msg.FitRequest),this._dirty&&Pr.sendMessage(this.parent,ai.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1;for(var n=0,o=0,a=this._items.length;o<a;++o)n+=+!this._items[o].isHidden;if(n!==0){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=Bo.boxSizing(this.parent.node));var l=this._box.paddingTop,u=this._box.paddingLeft,f=r-this._box.horizontalSum,_=i-this._box.verticalSum,w;switch(this._direction){case"left-to-right":w=au.calc(this._sizers,Math.max(0,f-this._fixed));break;case"top-to-bottom":w=au.calc(this._sizers,Math.max(0,_-this._fixed));break;case"right-to-left":w=au.calc(this._sizers,Math.max(0,f-this._fixed)),u+=f;break;case"bottom-to-top":w=au.calc(this._sizers,Math.max(0,_-this._fixed)),l+=_;break;default:throw"unreachable"}var E=0,M=0;if(w>0)switch(this._alignment){case"start":break;case"center":E=0,M=w/2;break;case"end":E=0,M=w;break;case"justify":E=w/n,M=0;break;default:throw"unreachable"}for(var o=0,a=this._items.length;o<a;++o){var D=this._items[o];if(!D.isHidden){var j=this._sizers[o].size;switch(this._direction){case"left-to-right":D.update(u+M,l,j+E,_),u+=j+E+this._spacing;break;case"top-to-bottom":D.update(u,l+M,f,j+E),l+=j+E+this._spacing;break;case"right-to-left":D.update(u-M-j-E,l,j+E,_),u-=j+E+this._spacing;break;case"bottom-to-top":D.update(u,l-M-j-E,f,j+E),l-=j+E+this._spacing;break;default:throw"unreachable"}}}}},e}(zS);(function(t){function e(o){return Fd.stretchProperty.get(o)}t.getStretch=e;function r(o,a){Fd.stretchProperty.set(o,a)}t.setStretch=r;function i(o){return Fd.sizeBasisProperty.get(o)}t.getSizeBasis=i;function n(o,a){Fd.sizeBasisProperty.set(o,a)}t.setSizeBasis=n})(Lh||(Lh={}));var Fd;(function(t){t.stretchProperty=new nu({name:"stretch",create:function(){return 0},coerce:function(n,o){return Math.max(0,Math.floor(o))},changed:i}),t.sizeBasisProperty=new nu({name:"sizeBasis",create:function(){return 0},coerce:function(n,o){return Math.max(0,Math.floor(o))},changed:i});function e(n){return n==="left-to-right"||n==="right-to-left"}t.isHorizontal=e;function r(n){return Math.max(0,Math.floor(n))}t.clampSpacing=r;function i(n){n.parent&&n.parent.layout instanceof Lh&&n.parent.fit()}})(Fd||(Fd={}));var z1=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;return i.addClass("lm-Panel"),i.addClass("p-Panel"),i.layout=_D.createLayout(r),i}return Object.defineProperty(e.prototype,"widgets",{get:function(){return this.layout.widgets},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(r){this.layout.addWidget(r)},e.prototype.insertWidget=function(r,i){this.layout.insertWidget(r,i)},e}(ai),_D;(function(t){function e(r){return r.layout||new zS}t.createLayout=e})(_D||(_D={}));var yY=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{layout:yD.createLayout(r)})||this;return i.addClass("lm-BoxPanel"),i.addClass("p-BoxPanel"),i}return Object.defineProperty(e.prototype,"direction",{get:function(){return this.layout.direction},set:function(r){this.layout.direction=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this.layout.alignment},set:function(r){this.layout.alignment=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(r){this.layout.spacing=r},enumerable:!0,configurable:!0}),e.prototype.onChildAdded=function(r){r.child.addClass("lm-BoxPanel-child"),r.child.addClass("p-BoxPanel-child")},e.prototype.onChildRemoved=function(r){r.child.removeClass("lm-BoxPanel-child"),r.child.removeClass("p-BoxPanel-child")},e}(z1);(function(t){function e(o){return Lh.getStretch(o)}t.getStretch=e;function r(o,a){Lh.setStretch(o,a)}t.setStretch=r;function i(o){return Lh.getSizeBasis(o)}t.getSizeBasis=i;function n(o,a){Lh.setSizeBasis(o,a)}t.setSizeBasis=n})(yY||(yY={}));var yD;(function(t){function e(r){return r.layout||new Lh(r)}t.createLayout=e})(yD||(yD={}));var vY=function(t){Oa(e,t);function e(r){var i=t.call(this,{node:Hp.createNode()})||this;return i._activeIndex=-1,i._items=[],i._results=null,i.addClass("lm-CommandPalette"),i.addClass("p-CommandPalette"),i.setFlag(ai.Flag.DisallowLayout),i.commands=r.commands,i.renderer=r.renderer||e.defaultRenderer,i.commands.commandChanged.connect(i._onGenericChange,i),i.commands.keyBindingChanged.connect(i._onGenericChange,i),i}return e.prototype.dispose=function(){this._items.length=0,this._results=null,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"searchNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),e.prototype.addItem=function(r){var i=Hp.createItem(this.commands,r);return this._items.push(i),this.refresh(),i},e.prototype.removeItem=function(r){this.removeItemAt(this._items.indexOf(r))},e.prototype.removeItemAt=function(r){var i=ei.removeAt(this._items,r);i&&this.refresh()},e.prototype.clearItems=function(){this._items.length!==0&&(this._items.length=0,this.refresh())},e.prototype.refresh=function(){if(this._results=null,this.inputNode.value!==""){var r=this.node.getElementsByClassName("lm-close-icon")[0];r.style.display="inherit"}else{var r=this.node.getElementsByClassName("lm-close-icon")[0];r.style.display="none"}this.update()},e.prototype.handleEvent=function(r){switch(r.type){case"click":this._evtClick(r);break;case"keydown":this._evtKeyDown(r);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)},e.prototype.onActivateRequest=function(r){if(this.isAttached){var i=this.inputNode;i.focus(),i.select()}},e.prototype.onUpdateRequest=function(r){var i=this.inputNode.value,n=this.contentNode,o=this._results;if(o||(o=this._results=Hp.search(this._items,i),this._activeIndex=i?ei.findFirstIndex(o,Hp.canActivate):-1),!i&&o.length===0){Ld.render(null,n);return}if(i&&o.length===0){var a=this.renderer.renderEmptyMessage({query:i});Ld.render(a,n);return}for(var l=this.renderer,u=this._activeIndex,f=new Array(o.length),_=0,w=o.length;_<w;++_){var E=o[_];if(E.type==="header"){var M=E.indices,D=E.category;f[_]=l.renderHeader({category:D,indices:M})}else{var j=E.item,M=E.indices,V=_===u;f[_]=l.renderItem({item:j,indices:M,active:V})}}if(Ld.render(f,n),u<0||u>=o.length)n.scrollTop=0;else{var $=n.children[u];Bo.scrollIntoViewIfNeeded(n,$)}},e.prototype._evtClick=function(r){if(r.button===0){if(r.target.classList.contains("lm-close-icon")){this.inputNode.value="",this.refresh();return}var i=ei.findFirstIndex(this.contentNode.children,function(n){return n.contains(r.target)});i!==-1&&(r.preventDefault(),r.stopPropagation(),this._execute(i))}},e.prototype._evtKeyDown=function(r){if(!(r.altKey||r.ctrlKey||r.metaKey||r.shiftKey))switch(r.keyCode){case 13:r.preventDefault(),r.stopPropagation(),this._execute(this._activeIndex);break;case 38:r.preventDefault(),r.stopPropagation(),this._activatePreviousItem();break;case 40:r.preventDefault(),r.stopPropagation(),this._activateNextItem();break}},e.prototype._activateNextItem=function(){if(!(!this._results||this._results.length===0)){var r=this._activeIndex,i=this._results.length,n=r<i-1?r+1:0,o=n===0?i-1:n-1;this._activeIndex=ei.findFirstIndex(this._results,Hp.canActivate,n,o),this.update()}},e.prototype._activatePreviousItem=function(){if(!(!this._results||this._results.length===0)){var r=this._activeIndex,i=this._results.length,n=r<=0?i-1:r-1,o=n===i-1?0:n+1;this._activeIndex=ei.findLastIndex(this._results,Hp.canActivate,n,o),this.update()}},e.prototype._execute=function(r){if(this._results){var i=this._results[r];if(i){if(i.type==="header"){var n=this.inputNode;n.value=i.category.toLowerCase()+" ",n.focus(),this.refresh();return}i.item.isEnabled&&(this.commands.execute(i.item.command,i.item.args),this.inputNode.value="",this.refresh())}}},e.prototype._toggleFocused=function(){var r=document.activeElement===this.inputNode;this.toggleClass("lm-mod-focused",r),this.toggleClass("p-mod-focused",r)},e.prototype._onGenericChange=function(){this.refresh()},e}(ai);(function(t){var e=function(){function r(){}return r.prototype.renderHeader=function(i){var n=this.formatHeader(i);return Oo.li({className:"lm-CommandPalette-header p-CommandPalette-header"},n)},r.prototype.renderItem=function(i){var n=this.createItemClass(i),o=this.createItemDataset(i);return Oo.li({className:n,dataset:o},this.renderItemIcon(i),this.renderItemContent(i),this.renderItemShortcut(i))},r.prototype.renderEmptyMessage=function(i){var n=this.formatEmptyMessage(i);return Oo.li({className:"lm-CommandPalette-emptyMessage p-CommandPalette-emptyMessage"},n)},r.prototype.renderItemIcon=function(i){var n=this.createIconClass(i);return typeof i.item.icon=="string"?Oo.div({className:n},i.item.iconLabel):Oo.div({className:n},i.item.icon,i.item.iconLabel)},r.prototype.renderItemContent=function(i){return Oo.div({className:"lm-CommandPalette-itemContent p-CommandPalette-itemContent"},this.renderItemLabel(i),this.renderItemCaption(i))},r.prototype.renderItemLabel=function(i){var n=this.formatItemLabel(i);return Oo.div({className:"lm-CommandPalette-itemLabel p-CommandPalette-itemLabel"},n)},r.prototype.renderItemCaption=function(i){var n=this.formatItemCaption(i);return Oo.div({className:"lm-CommandPalette-itemCaption p-CommandPalette-itemCaption"},n)},r.prototype.renderItemShortcut=function(i){var n=this.formatItemShortcut(i);return Oo.div({className:"lm-CommandPalette-itemShortcut p-CommandPalette-itemShortcut"},n)},r.prototype.createItemClass=function(i){var n="lm-CommandPalette-item";n+=" p-CommandPalette-item",i.item.isEnabled||(n+=" lm-mod-disabled",n+=" p-mod-disabled"),i.item.isToggled&&(n+=" lm-mod-toggled",n+=" p-mod-toggled"),i.active&&(n+=" lm-mod-active",n+=" p-mod-active");var o=i.item.className;return o&&(n+=" "+o),n},r.prototype.createItemDataset=function(i){return Of(Of({},i.item.dataset),{command:i.item.command})},r.prototype.createIconClass=function(i){var n="lm-CommandPalette-itemIcon";n+=" p-CommandPalette-itemIcon";var o=i.item.iconClass;return o?n+" "+o:n},r.prototype.formatHeader=function(i){return!i.indices||i.indices.length===0?i.category:w_.highlight(i.category,i.indices,Oo.mark)},r.prototype.formatEmptyMessage=function(i){return"No commands found that match '"+i.query+"'"},r.prototype.formatItemShortcut=function(i){var n=i.item.keyBinding;return n?n.keys.map(C_.formatKeystroke).join(", "):null},r.prototype.formatItemLabel=function(i){return!i.indices||i.indices.length===0?i.item.label:w_.highlight(i.item.label,i.indices,Oo.mark)},r.prototype.formatItemCaption=function(i){return i.item.caption},r}();t.Renderer=e,t.defaultRenderer=new e})(vY||(vY={}));var Hp;(function(t){function e(){var E=document.createElement("div"),M=document.createElement("div"),D=document.createElement("div"),j=document.createElement("input"),V=document.createElement("ul"),$=document.createElement("button");return M.className="lm-CommandPalette-search",D.className="lm-CommandPalette-wrapper",j.className="lm-CommandPalette-input",$.className="lm-close-icon",V.className="lm-CommandPalette-content",M.classList.add("p-CommandPalette-search"),D.classList.add("p-CommandPalette-wrapper"),j.classList.add("p-CommandPalette-input"),V.classList.add("p-CommandPalette-content"),j.spellcheck=!1,D.appendChild(j),D.appendChild($),M.appendChild(D),E.appendChild(M),E.appendChild(V),E}t.createNode=e;function r(E,M){return new w(E,M)}t.createItem=r;function i(E,M){var D=l(E,M);return D.sort(f),_(D)}t.search=i;function n(E){return E.type==="item"&&E.item.isEnabled}t.canActivate=n;function o(E){return E.trim().replace(/\s+/g," ")}function a(E){return E.replace(/\s+/g,"").toLowerCase()}function l(E,M){M=a(M);for(var D=[],j=0,V=E.length;j<V;++j){var $=E[j];if($.isVisible){if(!M){D.push({matchType:3,categoryIndices:null,labelIndices:null,score:0,item:$});continue}var te=u($,M);te&&($.isEnabled||(te.score+=1e3),D.push(te))}}return D}function u(E,M){for(var D=E.category.toLowerCase(),j=E.label.toLowerCase(),V=D+" "+j,$=1/0,te=null,ne=/\b\w/g;;){var le=ne.exec(V);if(!le)break;var z=w_.matchSumOfDeltas(V,M,le.index);if(!z)break;z&&z.score<=$&&($=z.score,te=z.indices)}if(!te||$===1/0)return null;for(var ke=D.length+1,Y=ei.lowerBound(te,ke,function(ie,Q){return ie-Q}),X=te.slice(0,Y),O=te.slice(Y),I=0,H=O.length;I<H;++I)O[I]-=ke;return X.length===0?{matchType:0,categoryIndices:null,labelIndices:O,score:$,item:E}:O.length===0?{matchType:1,categoryIndices:X,labelIndices:null,score:$,item:E}:{matchType:2,categoryIndices:X,labelIndices:O,score:$,item:E}}function f(E,M){var D=E.matchType-M.matchType;if(D!==0)return D;var j=E.score-M.score;if(j!==0)return j;var V=0,$=0;switch(E.matchType){case 0:V=E.labelIndices[0],$=M.labelIndices[0];break;case 1:case 2:V=E.categoryIndices[0],$=M.categoryIndices[0];break}if(V!==$)return V-$;var te=E.item.category.localeCompare(M.item.category);if(te!==0)return te;var ne=E.item.rank,le=M.item.rank;return ne!==le?ne<le?-1:1:E.item.label.localeCompare(M.item.label)}function _(E){var M=new Array(E.length);ei.fill(M,!1);for(var D=[],j=0,V=E.length;j<V;++j)if(!M[j]){var $=E[j],te=$.item,ne=$.categoryIndices,le=te.category;D.push({type:"header",category:le,indices:ne});for(var z=j;z<V;++z)if(!M[z]){var ke=E[z],Y=ke.item,X=ke.labelIndices;Y.category===le&&(D.push({type:"item",item:Y,indices:X}),M[z]=!0)}}return D}var w=function(){function E(M,D){this._commands=M,this.category=o(D.category),this.command=D.command,this.args=D.args||oa.emptyObject,this.rank=D.rank!==void 0?D.rank:1/0}return Object.defineProperty(E.prototype,"label",{get:function(){return this._commands.label(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"icon",{get:function(){return this._commands.icon(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"iconClass",{get:function(){return this._commands.iconClass(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"iconLabel",{get:function(){return this._commands.iconLabel(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"caption",{get:function(){return this._commands.caption(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"className",{get:function(){return this._commands.className(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"dataset",{get:function(){return this._commands.dataset(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"isEnabled",{get:function(){return this._commands.isEnabled(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"isToggled",{get:function(){return this._commands.isToggled(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"isVisible",{get:function(){return this._commands.isVisible(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"keyBinding",{get:function(){var M=this,D=M.command,j=M.args;return ei.findLastValue(this._commands.keyBindings,function(V){return V.command===D&&oa.deepEqual(V.args,j)})||null},enumerable:!0,configurable:!0}),E}()})(Hp||(Hp={}));var vD=function(t){Oa(e,t);function e(r){var i=t.call(this,{node:Lc.createNode()})||this;return i._childIndex=-1,i._activeIndex=-1,i._openTimerID=0,i._closeTimerID=0,i._items=[],i._childMenu=null,i._parentMenu=null,i._aboutToClose=new Eo(i),i._menuRequested=new Eo(i),i.addClass("lm-Menu"),i.addClass("p-Menu"),i.setFlag(ai.Flag.DisallowLayout),i.commands=r.commands,i.renderer=r.renderer||e.defaultRenderer,i}return e.prototype.dispose=function(){this.close(),this._items.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"aboutToClose",{get:function(){return this._aboutToClose},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menuRequested",{get:function(){return this._menuRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentMenu",{get:function(){return this._parentMenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childMenu",{get:function(){return this._childMenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rootMenu",{get:function(){for(var r=this;r._parentMenu;)r=r._parentMenu;return r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leafMenu",{get:function(){for(var r=this;r._childMenu;)r=r._childMenu;return r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-Menu-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this._items[this._activeIndex]||null},set:function(r){this.activeIndex=r?this._items.indexOf(r):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(r){(r<0||r>=this._items.length)&&(r=-1),r!==-1&&!Lc.canActivate(this._items[r])&&(r=-1),this._activeIndex!==r&&(this._activeIndex=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),e.prototype.activateNextItem=function(){var r=this._items.length,i=this._activeIndex,n=i<r-1?i+1:0,o=n===0?r-1:n-1;this.activeIndex=ei.findFirstIndex(this._items,Lc.canActivate,n,o)},e.prototype.activatePreviousItem=function(){var r=this._items.length,i=this._activeIndex,n=i<=0?r-1:i-1,o=n===r-1?0:n+1;this.activeIndex=ei.findLastIndex(this._items,Lc.canActivate,n,o)},e.prototype.triggerActiveItem=function(){if(this.isAttached){var r=this.activeItem;if(r){if(this._cancelOpenTimer(),this._cancelCloseTimer(),r.type==="submenu"){this._openChildMenu(!0);return}this.rootMenu.close();var i=r.command,n=r.args;this.commands.isEnabled(i,n)?this.commands.execute(i,n):console.log("Command '"+i+"' is disabled.")}}},e.prototype.addItem=function(r){return this.insertItem(this._items.length,r)},e.prototype.insertItem=function(r,i){this.isAttached&&this.close(),this.activeIndex=-1;var n=Math.max(0,Math.min(r,this._items.length)),o=Lc.createItem(this,i);return ei.insert(this._items,n,o),this.update(),o},e.prototype.removeItem=function(r){this.removeItemAt(this._items.indexOf(r))},e.prototype.removeItemAt=function(r){this.isAttached&&this.close(),this.activeIndex=-1;var i=ei.removeAt(this._items,r);i&&this.update()},e.prototype.clearItems=function(){this.isAttached&&this.close(),this.activeIndex=-1,this._items.length!==0&&(this._items.length=0,this.update())},e.prototype.open=function(r,i,n){if(n===void 0&&(n={}),!this.isAttached){var o=n.forceX||!1,a=n.forceY||!1;Lc.openRootMenu(this,r,i,o,a),this.activate()}},e.prototype.handleEvent=function(r){switch(r.type){case"keydown":this._evtKeyDown(r);break;case"mouseup":this._evtMouseUp(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseenter":this._evtMouseEnter(r);break;case"mouseleave":this._evtMouseLeave(r);break;case"mousedown":this._evtMouseDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("keydown",this),this.node.addEventListener("mouseup",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseenter",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this),document.addEventListener("mousedown",this,!0)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mouseup",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseenter",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),document.removeEventListener("mousedown",this,!0)},e.prototype.onActivateRequest=function(r){this.isAttached&&this.node.focus()},e.prototype.onUpdateRequest=function(r){for(var i=this._items,n=this.renderer,o=this._activeIndex,a=Lc.computeCollapsed(i),l=new Array(i.length),u=0,f=i.length;u<f;++u){var _=i[u],w=u===o,E=a[u];l[u]=n.renderItem({item:_,active:w,collapsed:E})}Ld.render(l,this.contentNode)},e.prototype.onCloseRequest=function(r){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;var i=this._childMenu;i&&(this._childIndex=-1,this._childMenu=null,i._parentMenu=null,i.close());var n=this._parentMenu;n&&(this._parentMenu=null,n._childIndex=-1,n._childMenu=null,n.activate()),this.isAttached&&this._aboutToClose.emit(void 0),t.prototype.onCloseRequest.call(this,r)},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation();var i=r.keyCode;if(i===13){this.triggerActiveItem();return}if(i===27){this.close();return}if(i===37){this._parentMenu?this.close():this._menuRequested.emit("previous");return}if(i===38){this.activatePreviousItem();return}if(i===39){var n=this.activeItem;n&&n.type==="submenu"?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next");return}if(i===40){this.activateNextItem();return}var o=k1().keyForKeydownEvent(r);if(o){var a=this._activeIndex+1,l=Lc.findMnemonic(this._items,o,a);l.index!==-1&&!l.multiple?(this.activeIndex=l.index,this.triggerActiveItem()):l.index!==-1?this.activeIndex=l.index:l.auto!==-1&&(this.activeIndex=l.auto)}},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this.triggerActiveItem())},e.prototype._evtMouseMove=function(r){var i=ei.findFirstIndex(this.contentNode.children,function(o){return Bo.hitTest(o,r.clientX,r.clientY)});if(i!==this._activeIndex){if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex){this._cancelOpenTimer(),this._cancelCloseTimer();return}this._childIndex!==-1&&this._startCloseTimer(),this._cancelOpenTimer();var n=this.activeItem;!n||n.type!=="submenu"||!n.submenu||this._startOpenTimer()}},e.prototype._evtMouseEnter=function(r){for(var i=this._parentMenu;i;i=i._parentMenu)i._cancelOpenTimer(),i._cancelCloseTimer(),i.activeIndex=i._childIndex},e.prototype._evtMouseLeave=function(r){if(this._cancelOpenTimer(),!this._childMenu){this.activeIndex=-1;return}var i=r.clientX,n=r.clientY;if(Bo.hitTest(this._childMenu.node,i,n)){this._cancelCloseTimer();return}this.activeIndex=-1,this._startCloseTimer()},e.prototype._evtMouseDown=function(r){this._parentMenu||(Lc.hitTestMenus(this,r.clientX,r.clientY)?(r.preventDefault(),r.stopPropagation()):this.close())},e.prototype._openChildMenu=function(r){r===void 0&&(r=!1);var i=this.activeItem;if(!i||i.type!=="submenu"||!i.submenu){this._closeChildMenu();return}var n=i.submenu;if(n!==this._childMenu){this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,Pr.sendMessage(this,ai.Msg.UpdateRequest);var o=this.contentNode.children[this._activeIndex];Lc.openSubmenu(n,o),r&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}},e.prototype._closeChildMenu=function(){this._childMenu&&this._childMenu.close()},e.prototype._startOpenTimer=function(){var r=this;this._openTimerID===0&&(this._openTimerID=window.setTimeout(function(){r._openTimerID=0,r._openChildMenu()},Lc.TIMER_DELAY))},e.prototype._startCloseTimer=function(){var r=this;this._closeTimerID===0&&(this._closeTimerID=window.setTimeout(function(){r._closeTimerID=0,r._closeChildMenu()},Lc.TIMER_DELAY))},e.prototype._cancelOpenTimer=function(){this._openTimerID!==0&&(clearTimeout(this._openTimerID),this._openTimerID=0)},e.prototype._cancelCloseTimer=function(){this._closeTimerID!==0&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)},e}(ai);(function(t){var e=function(){function r(){}return r.prototype.renderItem=function(i){var n=this.createItemClass(i),o=this.createItemDataset(i);return Oo.li({className:n,dataset:o},this.renderIcon(i),this.renderLabel(i),this.renderShortcut(i),this.renderSubmenu(i))},r.prototype.renderIcon=function(i){var n=this.createIconClass(i);return typeof i.item.icon=="string"?Oo.div({className:n},i.item.iconLabel):Oo.div({className:n},i.item.icon,i.item.iconLabel)},r.prototype.renderLabel=function(i){var n=this.formatLabel(i);return Oo.div({className:"lm-Menu-itemLabel p-Menu-itemLabel"},n)},r.prototype.renderShortcut=function(i){var n=this.formatShortcut(i);return Oo.div({className:"lm-Menu-itemShortcut p-Menu-itemShortcut"},n)},r.prototype.renderSubmenu=function(i){return Oo.div({className:"lm-Menu-itemSubmenuIcon p-Menu-itemSubmenuIcon"})},r.prototype.createItemClass=function(i){var n="lm-Menu-item";n+=" p-Menu-item",i.item.isEnabled||(n+=" lm-mod-disabled",n+=" p-mod-disabled"),i.item.isToggled&&(n+=" lm-mod-toggled",n+=" p-mod-toggled"),i.item.isVisible||(n+=" lm-mod-hidden",n+=" p-mod-hidden"),i.active&&(n+=" lm-mod-active",n+=" p-mod-active"),i.collapsed&&(n+=" lm-mod-collapsed",n+=" p-mod-collapsed");var o=i.item.className;return o&&(n+=" "+o),n},r.prototype.createItemDataset=function(i){var n,o=i.item,a=o.type,l=o.command,u=o.dataset;return a==="command"?n=Of(Of({},u),{type:a,command:l}):n=Of(Of({},u),{type:a}),n},r.prototype.createIconClass=function(i){var n="lm-Menu-itemIcon";n+=" p-Menu-itemIcon";var o=i.item.iconClass;return o?n+" "+o:n},r.prototype.formatLabel=function(i){var n=i.item,o=n.label,a=n.mnemonic;if(a<0||a>=o.length)return o;var l=o.slice(0,a),u=o.slice(a+1),f=o[a],_=Oo.span({className:"lm-Menu-itemMnemonic p-Menu-itemMnemonic"},f);return[l,_,u]},r.prototype.formatShortcut=function(i){var n=i.item.keyBinding;return n?n.keys.map(C_.formatKeystroke).join(", "):null},r}();t.Renderer=e,t.defaultRenderer=new e})(vD||(vD={}));var Lc;(function(t){t.TIMER_DELAY=300,t.SUBMENU_OVERLAP=3;function e(){var _=document.createElement("div"),w=document.createElement("ul");return w.className="lm-Menu-content",w.classList.add("p-Menu-content"),_.appendChild(w),_.tabIndex=-1,_}t.createNode=e;function r(_){return _.type!=="separator"&&_.isEnabled&&_.isVisible}t.canActivate=r;function i(_,w){return new f(_.commands,w)}t.createItem=i;function n(_,w,E){for(var M=_;M;M=M.childMenu)if(Bo.hitTest(M.node,w,E))return!0;return!1}t.hitTestMenus=n;function o(_){var w=new Array(_.length);ei.fill(w,!1);for(var E=0,M=_.length;E<M;++E){var D=_[E];if(D.isVisible){if(D.type!=="separator")break;w[E]=!0}}for(var j=M-1;j>=0;--j){var D=_[j];if(D.isVisible){if(D.type!=="separator")break;w[j]=!0}}for(var V=!1;++E<j;){var D=_[E];D.isVisible&&(D.type!=="separator"?V=!1:V?w[E]=!0:V=!0)}return w}t.computeCollapsed=o;function a(_,w,E,M,D){Pr.sendMessage(_,ai.Msg.UpdateRequest);var j=window.pageXOffset,V=window.pageYOffset,$=document.documentElement.clientWidth,te=document.documentElement.clientHeight,ne=te-(D?E:0),le=_.node,z=le.style;z.top="",z.left="",z.width="",z.height="",z.visibility="hidden",z.maxHeight=ne+"px",ai.attach(_,document.body);var ke=le.getBoundingClientRect(),Y=ke.width,X=ke.height;!M&&w+Y>j+$&&(w=j+$-Y),!D&&E+X>V+te&&(E>V+te?E=V+te-X:E=E-X),z.top=Math.max(0,E)+"px",z.left=Math.max(0,w)+"px",z.visibility=""}t.openRootMenu=a;function l(_,w){Pr.sendMessage(_,ai.Msg.UpdateRequest);var E=window.pageXOffset,M=window.pageYOffset,D=document.documentElement.clientWidth,j=document.documentElement.clientHeight,V=j,$=_.node,te=$.style;te.top="",te.left="",te.width="",te.height="",te.visibility="hidden",te.maxHeight=V+"px",ai.attach(_,document.body);var ne=$.getBoundingClientRect(),le=ne.width,z=ne.height,ke=Bo.boxSizing(_.node),Y=w.getBoundingClientRect(),X=Y.right-t.SUBMENU_OVERLAP;X+le>E+D&&(X=Y.left+t.SUBMENU_OVERLAP-le);var O=Y.top-ke.borderTop-ke.paddingTop;O+z>M+j&&(O=Y.bottom+ke.borderBottom+ke.paddingBottom-z),te.top=Math.max(0,O)+"px",te.left=Math.max(0,X)+"px",te.visibility=""}t.openSubmenu=l;function u(_,w,E){for(var M=-1,D=-1,j=!1,V=w.toUpperCase(),$=0,te=_.length;$<te;++$){var ne=($+E)%te,le=_[ne];if(r(le)){var z=le.label;if(z.length!==0){var ke=le.mnemonic;if(ke>=0&&ke<z.length){z[ke].toUpperCase()===V&&(M===-1?M=ne:j=!0);continue}D===-1&&z[0].toUpperCase()===V&&(D=ne)}}}return{index:M,multiple:j,auto:D}}t.findMnemonic=u;var f=function(){function _(w,E){this._commands=w,this.type=E.type||"command",this.command=E.command||"",this.args=E.args||oa.emptyObject,this.submenu=E.submenu||null}return Object.defineProperty(_.prototype,"label",{get:function(){return this.type==="command"?this._commands.label(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.label:""},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"mnemonic",{get:function(){return this.type==="command"?this._commands.mnemonic(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.mnemonic:-1},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"icon",{get:function(){return this.type==="command"?this._commands.icon(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.icon:this.iconClass},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"iconClass",{get:function(){return this.type==="command"?this._commands.iconClass(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconClass:""},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"iconLabel",{get:function(){return this.type==="command"?this._commands.iconLabel(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconLabel:""},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"caption",{get:function(){return this.type==="command"?this._commands.caption(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.caption:""},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"className",{get:function(){return this.type==="command"?this._commands.className(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.className:""},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"dataset",{get:function(){return this.type==="command"?this._commands.dataset(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.dataset:{}},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"isEnabled",{get:function(){return this.type==="command"?this._commands.isEnabled(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"isToggled",{get:function(){return this.type==="command"?this._commands.isToggled(this.command,this.args):!1},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"isVisible",{get:function(){return this.type==="command"?this._commands.isVisible(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"keyBinding",{get:function(){if(this.type==="command"){var w=this,E=w.command,M=w.args;return ei.findLastValue(this._commands.keyBindings,function(D){return D.command===E&&oa.deepEqual(D.args,M)})||null}return null},enumerable:!0,configurable:!0}),_}()})(Lc||(Lc={}));var Iht=function(){function t(e){this._idTick=0,this._items=[],this.menu=new vD(e)}return t.prototype.addItem=function(e){var r=this,i=FS.createItem(e,this._idTick++);return this._items.push(i),new S_(function(){ei.removeFirstOf(r._items,i)})},t.prototype.open=function(e){var r=this;if(this.menu.clearItems(),this._items.length===0)return!1;var i=FS.matchItems(this._items,e);return!i||i.length===0?!1:(hn(i,function(n){r.menu.addItem(n)}),this.menu.open(e.clientX,e.clientY),!0)},t}(),FS;(function(t){function e(o,a){var l=i(o.selector),u=o.rank!==void 0?o.rank:1/0;return Of(Of({},o),{selector:l,rank:u,id:a})}t.createItem=e;function r(o,a){var l=a.target;if(!l)return null;var u=a.currentTarget;if(!u||!u.contains(l)&&(l=document.elementFromPoint(a.clientX,a.clientY),!l||!u.contains(l)))return null;for(var f=[],_=o.slice();l!==null;){for(var w=[],E=0,M=_.length;E<M;++E){var D=_[E];D&&Oh.matches(l,D.selector)&&(w.push(D),_[E]=null)}if(w.length!==0&&(w.sort(n),f.push.apply(f,w)),l===u)break;l=l.parentElement}return f}t.matchItems=r;function i(o){if(o.indexOf(",")!==-1)throw new Error("Selector cannot contain commas: "+o);if(!Oh.isValid(o))throw new Error("Invalid selector: "+o);return o}function n(o,a){var l=Oh.calculateSpecificity(o.selector),u=Oh.calculateSpecificity(a.selector);if(l!==u)return u-l;var f=o.rank,_=a.rank;return f!==_?f<_?-1:1:o.id-a.id}})(FS||(FS={}));var mwe=function(t){Oa(e,t);function e(r){var i=t.call(this)||this;return i._spacing=4,i._dirty=!1,i._root=null,i._box=null,i._items=new Map,i.renderer=r.renderer,r.spacing!==void 0&&(i._spacing=gl.clampSpacing(r.spacing)),i}return e.prototype.dispose=function(){var r=this.iter();this._items.forEach(function(i){i.dispose()}),this._box=null,this._root=null,this._items.clear(),hn(r,function(i){i.dispose()}),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(r){r=gl.clampSpacing(r),this._spacing!==r&&(this._spacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this._root===null},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return this._root?this._root.iterAllWidgets():Bf()},e.prototype.widgets=function(){return this._root?this._root.iterUserWidgets():Bf()},e.prototype.selectedWidgets=function(){return this._root?this._root.iterSelectedWidgets():Bf()},e.prototype.tabBars=function(){return this._root?this._root.iterTabBars():Bf()},e.prototype.handles=function(){return this._root?this._root.iterHandles():Bf()},e.prototype.moveHandle=function(r,i,n){var o=r.classList.contains("lm-mod-hidden");if(o=o||r.classList.contains("p-mod-hidden"),!(!this._root||o)){var a=this._root.findSplitNode(r);if(a){var l;a.node.orientation==="horizontal"?l=i-r.offsetLeft:l=n-r.offsetTop,l!==0&&(a.node.holdSizes(),au.adjust(a.node.sizers,a.index,l),this.parent&&this.parent.update())}}},e.prototype.saveLayout=function(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}},e.prototype.restoreLayout=function(r){var i=this,n=new Set,o;r.main?o=gl.normalizeAreaConfig(r.main,n):o=null;var a=this.widgets(),l=this.tabBars(),u=this.handles();this._root=null,hn(a,function(f){n.has(f)||(f.parent=null)}),hn(l,function(f){f.dispose()}),hn(u,function(f){f.parentNode&&f.parentNode.removeChild(f)}),n.forEach(function(f){f.parent=i.parent}),o?this._root=gl.realizeAreaConfig(o,{createTabBar:function(){return i._createTabBar()},createHandle:function(){return i._createHandle()}}):this._root=null,this.parent&&(n.forEach(function(f){i.attachWidget(f)}),this.parent.fit())},e.prototype.addWidget=function(r,i){i===void 0&&(i={});var n=i.ref||null,o=i.mode||"tab-after",a=null;if(this._root&&n&&(a=this._root.findTabNode(n)),n&&!a)throw new Error("Reference widget is not in the layout.");switch(r.parent=this.parent,o){case"tab-after":this._insertTab(r,n,a,!0);break;case"tab-before":this._insertTab(r,n,a,!1);break;case"split-top":this._insertSplit(r,n,a,"vertical",!1);break;case"split-left":this._insertSplit(r,n,a,"horizontal",!1);break;case"split-right":this._insertSplit(r,n,a,"horizontal",!0);break;case"split-bottom":this._insertSplit(r,n,a,"vertical",!0);break}this.parent&&(this.attachWidget(r),this.parent.fit())},e.prototype.removeWidget=function(r){this._removeWidget(r),this.parent&&(this.detachWidget(r),this.parent.fit())},e.prototype.hitTestTabAreas=function(r,i){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=Bo.boxSizing(this.parent.node));var n=this.parent.node.getBoundingClientRect(),o=r-n.left-this._box.borderLeft,a=i-n.top-this._box.borderTop,l=this._root.hitTestTabNodes(o,a);if(!l)return null;var u=l.tabBar,f=l.top,_=l.left,w=l.width,E=l.height,M=this._box.borderLeft+this._box.borderRight,D=this._box.borderTop+this._box.borderBottom,j=n.width-M-(_+w),V=n.height-D-(f+E);return{tabBar:u,x:o,y:a,top:f,left:_,right:j,bottom:V,width:w,height:E}},e.prototype.init=function(){var r=this;t.prototype.init.call(this),hn(this,function(i){r.attachWidget(i)}),hn(this.handles(),function(i){r.parent.node.appendChild(i)}),this.parent.fit()},e.prototype.attachWidget=function(r){this.parent.node!==r.node.parentNode&&(this._items.set(r,new U1(r)),this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.AfterAttach))},e.prototype.detachWidget=function(r){if(this.parent.node===r.node.parentNode){this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.AfterDetach);var i=this._items.get(r);i&&(this._items.delete(r),i.dispose())}},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._removeWidget=function(r){if(this._root){var i=this._root.findTabNode(r);if(i){if(i.tabBar.titles.length>1){i.tabBar.removeTab(r.title);return}if(i.tabBar.dispose(),this._root===i){this._root=null;return}this._root.holdAllSizes();var n=i.parent;i.parent=null;var o=ei.removeFirstOf(n.children,i),a=ei.removeAt(n.handles,o);if(ei.removeAt(n.sizers,o),a.parentNode&&a.parentNode.removeChild(a),n.children.length>1){n.syncHandles();return}var l=n.parent;n.parent=null;var u=n.children[0],f=n.handles[0];if(n.children.length=0,n.handles.length=0,n.sizers.length=0,f.parentNode&&f.parentNode.removeChild(f),this._root===n){u.parent=null,this._root=u;return}var _=l,w=_.children.indexOf(n);if(u instanceof gl.TabLayoutNode){u.parent=_,_.children[w]=u;return}var E=ei.removeAt(_.handles,w);ei.removeAt(_.children,w),ei.removeAt(_.sizers,w),E.parentNode&&E.parentNode.removeChild(E);for(var M=0,D=u.children.length;M<D;++M){var j=u.children[M],V=u.handles[M],$=u.sizers[M];ei.insert(_.children,w+M,j),ei.insert(_.handles,w+M,V),ei.insert(_.sizers,w+M,$),j.parent=_}u.children.length=0,u.handles.length=0,u.sizers.length=0,u.parent=null,_.syncHandles()}}},e.prototype._insertTab=function(r,i,n,o){if(r!==i){if(!this._root){var a=new gl.TabLayoutNode(this._createTabBar());a.tabBar.addTab(r.title),this._root=a;return}n||(n=this._root.findFirstTabNode()),n.tabBar.titles.indexOf(r.title)===-1&&(this._removeWidget(r),r.hide());var l;i?l=n.tabBar.titles.indexOf(i.title):l=n.tabBar.currentIndex,n.tabBar.insertTab(l+(o?1:0),r.title)}},e.prototype._insertSplit=function(r,i,n,o,a){if(!(r===i&&n&&n.tabBar.titles.length===1)){this._removeWidget(r);var l=new gl.TabLayoutNode(this._createTabBar());if(l.tabBar.addTab(r.title),!this._root){this._root=l;return}if(!n||!n.parent){var u=this._splitRoot(o),f=a?u.children.length:0;u.normalizeSizes();var _=gl.createSizer(n?1:gl.GOLDEN_RATIO);ei.insert(u.children,f,l),ei.insert(u.sizers,f,_),ei.insert(u.handles,f,this._createHandle()),l.parent=u,u.normalizeSizes(),u.syncHandles();return}var w=n.parent;if(w.orientation===o){var E=w.children.indexOf(n);w.normalizeSizes();var M=w.sizers[E].sizeHint/=2,D=E+(a?1:0);ei.insert(w.children,D,l),ei.insert(w.sizers,D,gl.createSizer(M)),ei.insert(w.handles,D,this._createHandle()),l.parent=w,w.syncHandles();return}var j=ei.removeFirstOf(w.children,n),V=new gl.SplitLayoutNode(o);V.normalized=!0,V.children.push(n),V.sizers.push(gl.createSizer(.5)),V.handles.push(this._createHandle()),n.parent=V;var $=a?1:0;ei.insert(V.children,$,l),ei.insert(V.sizers,$,gl.createSizer(.5)),ei.insert(V.handles,$,this._createHandle()),l.parent=V,V.syncHandles(),ei.insert(w.children,j,V),V.parent=w}},e.prototype._splitRoot=function(r){var i=this._root;if(i instanceof gl.SplitLayoutNode&&i.orientation===r)return i;var n=this._root=new gl.SplitLayoutNode(r);return i&&(n.children.push(i),n.sizers.push(gl.createSizer(0)),n.handles.push(this._createHandle()),i.parent=n),n},e.prototype._fit=function(){var r=0,i=0;if(this._root){var n=this._root.fit(this._spacing,this._items);r=n.minWidth,i=n.minHeight}var o=this._box=Bo.boxSizing(this.parent.node);r+=o.horizontalSum,i+=o.verticalSum;var a=this.parent.node.style;a.minWidth=r+"px",a.minHeight=i+"px",this._dirty=!0,this.parent.parent&&Pr.sendMessage(this.parent.parent,ai.Msg.FitRequest),this._dirty&&Pr.sendMessage(this.parent,ai.Msg.UpdateRequest)},e.prototype._update=function(r,i){if(this._dirty=!1,!!this._root){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=Bo.boxSizing(this.parent.node));var n=this._box.paddingTop,o=this._box.paddingLeft,a=r-this._box.horizontalSum,l=i-this._box.verticalSum;this._root.update(n,o,a,l,this._spacing,this._items)}},e.prototype._createTabBar=function(){var r=this.renderer.createTabBar();return r.orientation="horizontal",this.parent&&(r.parent=this.parent,this.attachWidget(r)),r},e.prototype._createHandle=function(){var r=this.renderer.createHandle(),i=r.style;return i.position="absolute",i.top="0",i.left="0",i.width="0",i.height="0",this.parent&&this.parent.node.appendChild(r),r},e}(Gp),gl;(function(t){t.GOLDEN_RATIO=.618;function e(w){return Math.max(0,Math.floor(w))}t.clampSpacing=e;function r(w){var E=new jp;return E.sizeHint=w,E.size=w,E}t.createSizer=r;function i(w,E){var M;return w.type==="tab-area"?M=l(w,E):M=u(w,E),M}t.normalizeAreaConfig=i;function n(w,E){var M;return w.type==="tab-area"?M=f(w,E):M=_(w,E),M}t.realizeAreaConfig=n;var o=function(){function w(E){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;var M=new jp,D=new jp;M.stretch=0,D.stretch=1,this.tabBar=E,this.sizers=[M,D]}return Object.defineProperty(w.prototype,"top",{get:function(){return this._top},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"left",{get:function(){return this._left},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),w.prototype.iterAllWidgets=function(){return QO(F1(this.tabBar),this.iterUserWidgets())},w.prototype.iterUserWidgets=function(){return Up(this.tabBar.titles,function(E){return E.owner})},w.prototype.iterSelectedWidgets=function(){var E=this.tabBar.currentTitle;return E?F1(E.owner):Bf()},w.prototype.iterTabBars=function(){return F1(this.tabBar)},w.prototype.iterHandles=function(){return Bf()},w.prototype.findTabNode=function(E){return this.tabBar.titles.indexOf(E.title)!==-1?this:null},w.prototype.findSplitNode=function(E){return null},w.prototype.findFirstTabNode=function(){return this},w.prototype.hitTestTabNodes=function(E,M){return E<this._left||E>=this._left+this._width||M<this._top||M>=this._top+this._height?null:this},w.prototype.createConfig=function(){var E=this.tabBar.titles.map(function(D){return D.owner}),M=this.tabBar.currentIndex;return{type:"tab-area",widgets:E,currentIndex:M}},w.prototype.holdAllSizes=function(){},w.prototype.fit=function(E,M){var D=0,j=0,V=1/0,$=1/0,te=M.get(this.tabBar),ne=this.tabBar.currentTitle,le=ne?M.get(ne.owner):void 0,z=this.sizers,ke=z[0],Y=z[1];return te&&te.fit(),le&&le.fit(),te&&!te.isHidden?(D=Math.max(D,te.minWidth),j+=te.minHeight,ke.minSize=te.minHeight,ke.maxSize=te.maxHeight):(ke.minSize=0,ke.maxSize=0),le&&!le.isHidden?(D=Math.max(D,le.minWidth),j+=le.minHeight,Y.minSize=le.minHeight,Y.maxSize=1/0):(Y.minSize=0,Y.maxSize=1/0),{minWidth:D,minHeight:j,maxWidth:V,maxHeight:$}},w.prototype.update=function(E,M,D,j,V,$){this._top=M,this._left=E,this._width=D,this._height=j;var te=$.get(this.tabBar),ne=this.tabBar.currentTitle,le=ne?$.get(ne.owner):void 0;if(au.calc(this.sizers,j),te&&!te.isHidden){var z=this.sizers[0].size;te.update(E,M,D,z),M+=z}if(le&&!le.isHidden){var z=this.sizers[1].size;le.update(E,M,D,z)}},w}();t.TabLayoutNode=o;var a=function(){function w(E){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=E}return w.prototype.iterAllWidgets=function(){var E=Up(this.children,function(M){return M.iterAllWidgets()});return new km(E)},w.prototype.iterUserWidgets=function(){var E=Up(this.children,function(M){return M.iterUserWidgets()});return new km(E)},w.prototype.iterSelectedWidgets=function(){var E=Up(this.children,function(M){return M.iterSelectedWidgets()});return new km(E)},w.prototype.iterTabBars=function(){var E=Up(this.children,function(M){return M.iterTabBars()});return new km(E)},w.prototype.iterHandles=function(){var E=Up(this.children,function(M){return M.iterHandles()});return QO(this.handles,new km(E))},w.prototype.findTabNode=function(E){for(var M=0,D=this.children.length;M<D;++M){var j=this.children[M].findTabNode(E);if(j)return j}return null},w.prototype.findSplitNode=function(E){var M=this.handles.indexOf(E);if(M!==-1)return{index:M,node:this};for(var D=0,j=this.children.length;D<j;++D){var V=this.children[D].findSplitNode(E);if(V)return V}return null},w.prototype.findFirstTabNode=function(){return this.children.length===0?null:this.children[0].findFirstTabNode()},w.prototype.hitTestTabNodes=function(E,M){for(var D=0,j=this.children.length;D<j;++D){var V=this.children[D].hitTestTabNodes(E,M);if(V)return V}return null},w.prototype.createConfig=function(){var E=this.orientation,M=this.createNormalizedSizes(),D=this.children.map(function(j){return j.createConfig()});return{type:"split-area",orientation:E,children:D,sizes:M}},w.prototype.syncHandles=function(){var E=this;hn(this.handles,function(M,D){M.setAttribute("data-orientation",E.orientation),D===E.handles.length-1?(M.classList.add("lm-mod-hidden"),M.classList.add("p-mod-hidden")):(M.classList.remove("lm-mod-hidden"),M.classList.remove("p-mod-hidden"))})},w.prototype.holdSizes=function(){hn(this.sizers,function(E){E.sizeHint=E.size})},w.prototype.holdAllSizes=function(){hn(this.children,function(E){return E.holdAllSizes()}),this.holdSizes()},w.prototype.normalizeSizes=function(){var E=this.sizers.length;if(E!==0){this.holdSizes();var M=$O(this.sizers,function(D,j){return D+j.sizeHint},0);M===0?hn(this.sizers,function(D){D.size=D.sizeHint=1/E}):hn(this.sizers,function(D){D.size=D.sizeHint/=M}),this.normalized=!0}},w.prototype.createNormalizedSizes=function(){var E=this.sizers.length;if(E===0)return[];var M=this.sizers.map(function(j){return j.size}),D=$O(M,function(j,V){return j+V},0);return D===0?hn(M,function(j,V){M[V]=1/E}):hn(M,function(j,V){M[V]=j/D}),M},w.prototype.fit=function(E,M){for(var D=this.orientation==="horizontal",j=Math.max(0,this.children.length-1)*E,V=D?j:0,$=D?0:j,te=1/0,ne=1/0,le=0,z=this.children.length;le<z;++le){var ke=this.children[le].fit(E,M);D?($=Math.max($,ke.minHeight),V+=ke.minWidth,this.sizers[le].minSize=ke.minWidth):(V=Math.max(V,ke.minWidth),$+=ke.minHeight,this.sizers[le].minSize=ke.minHeight)}return{minWidth:V,minHeight:$,maxWidth:te,maxHeight:ne}},w.prototype.update=function(E,M,D,j,V,$){var te=this.orientation==="horizontal",ne=Math.max(0,this.children.length-1)*V,le=Math.max(0,(te?D:j)-ne);this.normalized&&(hn(this.sizers,function(I){I.sizeHint*=le}),this.normalized=!1),au.calc(this.sizers,le);for(var z=0,ke=this.children.length;z<ke;++z){var Y=this.children[z],X=this.sizers[z].size,O=this.handles[z].style;te?(Y.update(E,M,X,j,V,$),E+=X,O.top=M+"px",O.left=E+"px",O.width=V+"px",O.height=j+"px",E+=V):(Y.update(E,M,D,X,V,$),M+=X,O.top=M+"px",O.left=E+"px",O.width=D+"px",O.height=V+"px",M+=V)}},w}();t.SplitLayoutNode=a;function l(w,E){if(w.widgets.length===0)return null;var M=[];if(hn(w.widgets,function(j){E.has(j)||(E.add(j),M.push(j))}),M.length===0)return null;var D=w.currentIndex;return D!==-1&&(D<0||D>=M.length)&&(D=0),{type:"tab-area",widgets:M,currentIndex:D}}function u(w,E){for(var M=w.orientation,D=[],j=[],V=0,$=w.children.length;V<$;++V){var te=i(w.children[V],E);te&&(te.type==="tab-area"||te.orientation!==M?(D.push(te),j.push(Math.abs(w.sizes[V]||0))):(D.push.apply(D,te.children),j.push.apply(j,te.sizes)))}return D.length===0?null:D.length===1?D[0]:{type:"split-area",orientation:M,children:D,sizes:j}}function f(w,E){var M=E.createTabBar();return hn(w.widgets,function(D){D.hide(),M.addTab(D.title)}),M.currentIndex=w.currentIndex,new o(M)}function _(w,E){var M=new a(w.orientation);return hn(w.children,function(D,j){var V=n(D,E),$=r(w.sizes[j]),te=E.createHandle();M.children.push(V),M.handles.push(te),M.sizers.push($),V.parent=M}),M.syncHandles(),M.normalizeSizes(),M}})(gl||(gl={}));var NS=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{node:Wu.createNode()})||this;return i._currentIndex=-1,i._titles=[],i._previousTitle=null,i._dragData=null,i._tabMoved=new Eo(i),i._currentChanged=new Eo(i),i._tabCloseRequested=new Eo(i),i._tabDetachRequested=new Eo(i),i._tabActivateRequested=new Eo(i),i.addClass("lm-TabBar"),i.addClass("p-TabBar"),i.setFlag(ai.Flag.DisallowLayout),i.tabsMovable=r.tabsMovable||!1,i.allowDeselect=r.allowDeselect||!1,i.insertBehavior=r.insertBehavior||"select-tab-if-needed",i.removeBehavior=r.removeBehavior||"select-tab-after",i.renderer=r.renderer||e.defaultRenderer,i._orientation=r.orientation||"horizontal",i.dataset.orientation=i._orientation,i}return e.prototype.dispose=function(){this._releaseMouse(),this._titles.length=0,this._previousTitle=null,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabMoved",{get:function(){return this._tabMoved},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabActivateRequested",{get:function(){return this._tabActivateRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabCloseRequested",{get:function(){return this._tabCloseRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabDetachRequested",{get:function(){return this._tabDetachRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTitle",{get:function(){return this._titles[this._currentIndex]||null},set:function(r){this.currentIndex=r?this._titles.indexOf(r):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this._currentIndex},set:function(r){if((r<0||r>=this._titles.length)&&(r=-1),this._currentIndex!==r){var i=this._currentIndex,n=this._titles[i]||null,o=r,a=this._titles[o]||null;this._currentIndex=o,this._previousTitle=n,this.update(),this._currentChanged.emit({previousIndex:i,previousTitle:n,currentIndex:o,currentTitle:a})}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(r){this._orientation!==r&&(this._releaseMouse(),this._orientation=r,this.dataset.orientation=r)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"titles",{get:function(){return this._titles},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-TabBar-content")[0]},enumerable:!0,configurable:!0}),e.prototype.addTab=function(r){return this.insertTab(this._titles.length,r)},e.prototype.insertTab=function(r,i){this._releaseMouse();var n=Wu.asTitle(i),o=this._titles.indexOf(n),a=Math.max(0,Math.min(r,this._titles.length));return o===-1?(ei.insert(this._titles,a,n),n.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,n),n):(a===this._titles.length&&a--,o===a||(ei.move(this._titles,o,a),this.update(),this._adjustCurrentForMove(o,a)),n)},e.prototype.removeTab=function(r){this.removeTabAt(this._titles.indexOf(r))},e.prototype.removeTabAt=function(r){this._releaseMouse();var i=ei.removeAt(this._titles,r);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(r,i))},e.prototype.clearTabs=function(){if(this._titles.length!==0){this._releaseMouse();for(var r=0,i=this._titles;r<i.length;r++){var n=i[r];n.changed.disconnect(this._onTitleChanged,this)}var o=this.currentIndex,a=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),o!==-1&&this._currentChanged.emit({previousIndex:o,previousTitle:a,currentIndex:-1,currentTitle:null})}},e.prototype.releaseMouse=function(){this._releaseMouse()},e.prototype.handleEvent=function(r){switch(r.type){case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("mousedown",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("mousedown",this),this._releaseMouse()},e.prototype.onUpdateRequest=function(r){for(var i=this._titles,n=this.renderer,o=this.currentTitle,a=new Array(i.length),l=0,u=i.length;l<u;++l){var f=i[l],_=f===o,w=_?u:u-l-1;a[l]=n.renderTab({title:f,current:_,zIndex:w})}Ld.render(a,this.contentNode)},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation(),r.keyCode===27&&this._releaseMouse()},e.prototype._evtMouseDown=function(r){if(!(r.button!==0&&r.button!==1)&&!this._dragData){var i=this.contentNode.children,n=ei.findFirstIndex(i,function(a){return Bo.hitTest(a,r.clientX,r.clientY)});if(n!==-1&&(r.preventDefault(),r.stopPropagation(),this._dragData={tab:i[n],index:n,pressX:r.clientX,pressY:r.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},document.addEventListener("mouseup",this,!0),r.button!==1)){var o=i[n].querySelector(this.renderer.closeIconSelector);o&&o.contains(r.target)||(this.tabsMovable&&(document.addEventListener("mousemove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===n?this.currentIndex=-1:this.currentIndex=n,this.currentIndex!==-1&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}}},e.prototype._evtMouseMove=function(r){var i=this._dragData;if(i){r.preventDefault(),r.stopPropagation();var n=this.contentNode.children;if(!(!i.dragActive&&!Wu.dragExceeded(i,r))){if(!i.dragActive){var o=i.tab.getBoundingClientRect();this._orientation==="horizontal"?(i.tabPos=i.tab.offsetLeft,i.tabSize=o.width,i.tabPressPos=i.pressX-o.left):(i.tabPos=i.tab.offsetTop,i.tabSize=o.height,i.tabPressPos=i.pressY-o.top),i.tabLayout=Wu.snapTabLayout(n,this._orientation),i.contentRect=this.contentNode.getBoundingClientRect(),i.override=Vp.overrideCursor("default"),i.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),i.tab.classList.add("p-mod-dragging"),this.addClass("p-mod-dragging"),i.dragActive=!0}if(!i.detachRequested&&Wu.detachExceeded(i,r)){i.detachRequested=!0;var a=i.index,l=r.clientX,u=r.clientY,f=n[a],_=this._titles[a];if(this._tabDetachRequested.emit({index:a,title:_,tab:f,clientX:l,clientY:u}),i.dragAborted)return}Wu.layoutTabs(n,i,r,this._orientation)}}},e.prototype._evtMouseUp=function(r){var i=this;if(!(r.button!==0&&r.button!==1)){var n=this._dragData;if(n){if(r.preventDefault(),r.stopPropagation(),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),!n.dragActive){this._dragData=null;var o=this.contentNode.children,a=ei.findFirstIndex(o,function(_){return Bo.hitTest(_,r.clientX,r.clientY)});if(a!==n.index)return;var l=this._titles[a];if(!l.closable)return;if(r.button===1){this._tabCloseRequested.emit({index:a,title:l});return}var u=o[a].querySelector(this.renderer.closeIconSelector);if(u&&u.contains(r.target)){this._tabCloseRequested.emit({index:a,title:l});return}return}if(r.button===0){Wu.finalizeTabPosition(n,this._orientation),n.tab.classList.remove("lm-mod-dragging"),n.tab.classList.remove("p-mod-dragging");var f=Wu.parseTransitionDuration(n.tab);setTimeout(function(){if(!n.dragAborted){i._dragData=null,Wu.resetTabPositions(i.contentNode.children,i._orientation),n.override.dispose(),i.removeClass("lm-mod-dragging"),i.removeClass("p-mod-dragging");var _=n.index,w=n.targetIndex;w===-1||_===w||(ei.move(i._titles,_,w),i._adjustCurrentForMove(_,w),i._tabMoved.emit({fromIndex:_,toIndex:w,title:i._titles[w]}),Pr.sendMessage(i,ai.Msg.UpdateRequest))}},f)}}}},e.prototype._releaseMouse=function(){var r=this._dragData;r&&(this._dragData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),r.dragAborted=!0,r.dragActive&&(Wu.resetTabPositions(this.contentNode.children,this._orientation),r.override.dispose(),r.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging"),r.tab.classList.remove("p-mod-dragging"),this.removeClass("p-mod-dragging")))},e.prototype._adjustCurrentForInsert=function(r,i){var n=this.currentTitle,o=this._currentIndex,a=this.insertBehavior;if(a==="select-tab"||a==="select-tab-if-needed"&&o===-1){this._currentIndex=r,this._previousTitle=n,this._currentChanged.emit({previousIndex:o,previousTitle:n,currentIndex:r,currentTitle:i});return}o>=r&&this._currentIndex++},e.prototype._adjustCurrentForMove=function(r,i){this._currentIndex===r?this._currentIndex=i:this._currentIndex<r&&this._currentIndex>=i?this._currentIndex++:this._currentIndex>r&&this._currentIndex<=i&&this._currentIndex--},e.prototype._adjustCurrentForRemove=function(r,i){var n=this._currentIndex,o=this.removeBehavior;if(n!==r){n>r&&this._currentIndex--;return}if(this._titles.length===0){this._currentIndex=-1,this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:-1,currentTitle:null});return}if(o==="select-tab-after"){this._currentIndex=Math.min(r,this._titles.length-1),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(o==="select-tab-before"){this._currentIndex=Math.max(0,r-1),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(o==="select-previous-tab"){this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(r,this._titles.length-1),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}this._currentIndex=-1,this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:-1,currentTitle:null})},e.prototype._onTitleChanged=function(r){this.update()},e}(ai);(function(t){var e=function(){function r(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap}return r.prototype.renderTab=function(i){var n=i.title.caption,o=this.createTabKey(i),a=this.createTabStyle(i),l=this.createTabClass(i),u=this.createTabDataset(i);return Oo.li({key:o,className:l,title:n,style:a,dataset:u},this.renderIcon(i),this.renderLabel(i),this.renderCloseIcon(i))},r.prototype.renderIcon=function(i){var n=i.title,o=this.createIconClass(i);return typeof n.icon=="string"?Oo.div({className:o},n.iconLabel):Oo.div({className:o},n.icon,n.iconLabel)},r.prototype.renderLabel=function(i){return Oo.div({className:"lm-TabBar-tabLabel p-TabBar-tabLabel"},i.title.label)},r.prototype.renderCloseIcon=function(i){return Oo.div({className:"lm-TabBar-tabCloseIcon p-TabBar-tabCloseIcon"})},r.prototype.createTabKey=function(i){var n=this._tabKeys.get(i.title);return n===void 0&&(n="tab-key-"+this._tabID++,this._tabKeys.set(i.title,n)),n},r.prototype.createTabStyle=function(i){return{zIndex:""+i.zIndex}},r.prototype.createTabClass=function(i){var n="lm-TabBar-tab";return n+=" p-TabBar-tab",i.title.className&&(n+=" "+i.title.className),i.title.closable&&(n+=" lm-mod-closable",n+=" p-mod-closable"),i.current&&(n+=" lm-mod-current",n+=" p-mod-current"),n},r.prototype.createTabDataset=function(i){return i.title.dataset},r.prototype.createIconClass=function(i){var n="lm-TabBar-tabIcon";n+=" p-TabBar-tabIcon";var o=i.title.iconClass;return o?n+" "+o:n},r}();t.Renderer=e,t.defaultRenderer=new e})(NS||(NS={}));var Wu;(function(t){t.DRAG_THRESHOLD=5,t.DETACH_THRESHOLD=20;function e(){var _=document.createElement("div"),w=document.createElement("ul");return w.className="lm-TabBar-content",w.classList.add("p-TabBar-content"),_.appendChild(w),_}t.createNode=e;function r(_){return _ instanceof gD?_:new gD(_)}t.asTitle=r;function i(_){var w=window.getComputedStyle(_);return 1e3*(parseFloat(w.transitionDuration)||0)}t.parseTransitionDuration=i;function n(_,w){for(var E=new Array(_.length),M=0,D=_.length;M<D;++M){var j=_[M],V=window.getComputedStyle(j);w==="horizontal"?E[M]={pos:j.offsetLeft,size:j.offsetWidth,margin:parseFloat(V.marginLeft)||0}:E[M]={pos:j.offsetTop,size:j.offsetHeight,margin:parseFloat(V.marginTop)||0}}return E}t.snapTabLayout=n;function o(_,w){var E=Math.abs(w.clientX-_.pressX),M=Math.abs(w.clientY-_.pressY);return E>=t.DRAG_THRESHOLD||M>=t.DRAG_THRESHOLD}t.dragExceeded=o;function a(_,w){var E=_.contentRect;return w.clientX<E.left-t.DETACH_THRESHOLD||w.clientX>=E.right+t.DETACH_THRESHOLD||w.clientY<E.top-t.DETACH_THRESHOLD||w.clientY>=E.bottom+t.DETACH_THRESHOLD}t.detachExceeded=a;function l(_,w,E,M){var D,j,V,$;M==="horizontal"?(D=w.pressX,j=E.clientX-w.contentRect.left,V=E.clientX,$=w.contentRect.width):(D=w.pressY,j=E.clientY-w.contentRect.top,V=E.clientY,$=w.contentRect.height);for(var te=w.index,ne=j-w.tabPressPos,le=ne+w.tabSize,z=0,ke=_.length;z<ke;++z){var Y=void 0,X=w.tabLayout[z],O=X.pos+(X.size>>1);if(z<w.index&&ne<O)Y=w.tabSize+w.tabLayout[z+1].margin+"px",te=Math.min(te,z);else if(z>w.index&&le>O)Y=-w.tabSize-X.margin+"px",te=Math.max(te,z);else if(z===w.index){var I=V-D,H=$-(w.tabPos+w.tabSize);Y=Math.max(-w.tabPos,Math.min(I,H))+"px"}else Y="";M==="horizontal"?_[z].style.left=Y:_[z].style.top=Y}w.targetIndex=te}t.layoutTabs=l;function u(_,w){var E;w==="horizontal"?E=_.contentRect.width:E=_.contentRect.height;var M;if(_.targetIndex===_.index)M=0;else if(_.targetIndex>_.index){var D=_.tabLayout[_.targetIndex];M=D.pos+D.size-_.tabSize-_.tabPos}else{var D=_.tabLayout[_.targetIndex];M=D.pos-_.tabPos}var j=E-(_.tabPos+_.tabSize),V=Math.max(-_.tabPos,Math.min(M,j));w==="horizontal"?_.tab.style.left=V+"px":_.tab.style.top=V+"px"}t.finalizeTabPosition=u;function f(_,w){hn(_,function(E){w==="horizontal"?E.style.left="":E.style.top=""})}t.resetTabPositions=f})(Wu||(Wu={}));var xY=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;i._drag=null,i._tabsMovable=!0,i._pressData=null,i._layoutModified=new Eo(i),i.addClass("lm-DockPanel"),i.addClass("p-DockPanel"),i._mode=r.mode||"multiple-document",i._renderer=r.renderer||e.defaultRenderer,i._edges=r.edges||sa.DEFAULT_EDGES,r.tabsMovable!==void 0&&(i._tabsMovable=r.tabsMovable),i.dataset.mode=i._mode;var n={createTabBar:function(){return i._createTabBar()},createHandle:function(){return i._createHandle()}};return i.layout=new mwe({renderer:n,spacing:r.spacing}),i.overlay=r.overlay||new e.Overlay,i.node.appendChild(i.overlay.node),i}return e.prototype.dispose=function(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"layoutModified",{get:function(){return this._layoutModified},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this.layout.renderer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(r){this.layout.spacing=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(r){if(this._mode!==r){this._mode=r,this.dataset.mode=r;var i=this.layout;switch(r){case"multiple-document":hn(i.tabBars(),function(n){n.show()});break;case"single-document":i.restoreLayout(sa.createSingleDocumentConfig(this));break;default:throw"unreachable"}Pr.postMessage(this,sa.LayoutModified)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsMovable",{get:function(){return this._tabsMovable},set:function(r){this._tabsMovable=r,hn(this.tabBars(),function(i){return i.tabsMovable=r})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.layout.isEmpty},enumerable:!0,configurable:!0}),e.prototype.widgets=function(){return this.layout.widgets()},e.prototype.selectedWidgets=function(){return this.layout.selectedWidgets()},e.prototype.tabBars=function(){return this.layout.tabBars()},e.prototype.handles=function(){return this.layout.handles()},e.prototype.selectWidget=function(r){var i=T_(this.tabBars(),function(n){return n.titles.indexOf(r.title)!==-1});if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=r.title},e.prototype.activateWidget=function(r){this.selectWidget(r),r.activate()},e.prototype.saveLayout=function(){return this.layout.saveLayout()},e.prototype.restoreLayout=function(r){this._mode="multiple-document",this.layout.restoreLayout(r),(Jl.IS_EDGE||Jl.IS_IE)&&Pr.flush(),Pr.postMessage(this,sa.LayoutModified)},e.prototype.addWidget=function(r,i){i===void 0&&(i={}),this._mode==="single-document"?this.layout.addWidget(r):this.layout.addWidget(r,i),Pr.postMessage(this,sa.LayoutModified)},e.prototype.processMessage=function(r){r.type==="layout-modified"?this._layoutModified.emit(void 0):t.prototype.processMessage.call(this,r)},e.prototype.handleEvent=function(r){switch(r.type){case"lm-dragenter":this._evtDragEnter(r);break;case"lm-dragleave":this._evtDragLeave(r);break;case"lm-dragover":this._evtDragOver(r);break;case"lm-drop":this._evtDrop(r);break;case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("mousedown",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("mousedown",this),this._releaseMouse()},e.prototype.onChildAdded=function(r){sa.isGeneratedTabBarProperty.get(r.child)||(r.child.addClass("lm-DockPanel-widget"),r.child.addClass("p-DockPanel-widget"))},e.prototype.onChildRemoved=function(r){sa.isGeneratedTabBarProperty.get(r.child)||(r.child.removeClass("lm-DockPanel-widget"),r.child.removeClass("p-DockPanel-widget"),Pr.postMessage(this,sa.LayoutModified))},e.prototype._evtDragEnter=function(r){r.mimeData.hasData("application/vnd.lumino.widget-factory")&&(r.preventDefault(),r.stopPropagation())},e.prototype._evtDragLeave=function(r){r.preventDefault(),r.stopPropagation(),this.overlay.hide(1)},e.prototype._evtDragOver=function(r){r.preventDefault(),r.stopPropagation(),this._showOverlay(r.clientX,r.clientY)==="invalid"?r.dropAction="none":r.dropAction=r.proposedAction},e.prototype._evtDrop=function(r){if(r.preventDefault(),r.stopPropagation(),this.overlay.hide(0),r.proposedAction==="none"){r.dropAction="none";return}var i=r.clientX,n=r.clientY,o=sa.findDropTarget(this,i,n,this._edges),a=o.zone,l=o.target;if(a==="invalid"){r.dropAction="none";return}var u=r.mimeData,f=u.getData("application/vnd.lumino.widget-factory");if(typeof f!="function"){r.dropAction="none";return}var _=f();if(!(_ instanceof ai)){r.dropAction="none";return}if(_.contains(this)){r.dropAction="none";return}var w=l?sa.getDropRef(l.tabBar):null;switch(a){case"root-all":this.addWidget(_);break;case"root-top":this.addWidget(_,{mode:"split-top"});break;case"root-left":this.addWidget(_,{mode:"split-left"});break;case"root-right":this.addWidget(_,{mode:"split-right"});break;case"root-bottom":this.addWidget(_,{mode:"split-bottom"});break;case"widget-all":this.addWidget(_,{mode:"tab-after",ref:w});break;case"widget-top":this.addWidget(_,{mode:"split-top",ref:w});break;case"widget-left":this.addWidget(_,{mode:"split-left",ref:w});break;case"widget-right":this.addWidget(_,{mode:"split-right",ref:w});break;case"widget-bottom":this.addWidget(_,{mode:"split-bottom",ref:w});break;case"widget-tab":this.addWidget(_,{mode:"tab-after",ref:w});break;default:throw"unreachable"}r.dropAction=r.proposedAction,this.activateWidget(_)},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation(),r.keyCode===27&&(this._releaseMouse(),Pr.postMessage(this,sa.LayoutModified))},e.prototype._evtMouseDown=function(r){if(r.button===0){var i=this.layout,n=r.target,o=T_(i.handles(),function(w){return w.contains(n)});if(o){r.preventDefault(),r.stopPropagation(),document.addEventListener("keydown",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("contextmenu",this,!0);var a=o.getBoundingClientRect(),l=r.clientX-a.left,u=r.clientY-a.top,f=window.getComputedStyle(o),_=Vp.overrideCursor(f.cursor);this._pressData={handle:o,deltaX:l,deltaY:u,override:_}}}},e.prototype._evtMouseMove=function(r){if(this._pressData){r.preventDefault(),r.stopPropagation();var i=this.node.getBoundingClientRect(),n=r.clientX-i.left-this._pressData.deltaX,o=r.clientY-i.top-this._pressData.deltaY,a=this.layout;a.moveHandle(this._pressData.handle,n,o)}},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this._releaseMouse(),Pr.postMessage(this,sa.LayoutModified))},e.prototype._releaseMouse=function(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("keydown",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("contextmenu",this,!0))},e.prototype._showOverlay=function(r,i){var n=sa.findDropTarget(this,r,i,this._edges),o=n.zone,a=n.target;if(o==="invalid")return this.overlay.hide(100),o;var l,u,f,_,w=Bo.boxSizing(this.node),E=this.node.getBoundingClientRect();switch(o){case"root-all":l=w.paddingTop,u=w.paddingLeft,f=w.paddingRight,_=w.paddingBottom;break;case"root-top":l=w.paddingTop,u=w.paddingLeft,f=w.paddingRight,_=E.height*sa.GOLDEN_RATIO;break;case"root-left":l=w.paddingTop,u=w.paddingLeft,f=E.width*sa.GOLDEN_RATIO,_=w.paddingBottom;break;case"root-right":l=w.paddingTop,u=E.width*sa.GOLDEN_RATIO,f=w.paddingRight,_=w.paddingBottom;break;case"root-bottom":l=E.height*sa.GOLDEN_RATIO,u=w.paddingLeft,f=w.paddingRight,_=w.paddingBottom;break;case"widget-all":l=a.top,u=a.left,f=a.right,_=a.bottom;break;case"widget-top":l=a.top,u=a.left,f=a.right,_=a.bottom+a.height/2;break;case"widget-left":l=a.top,u=a.left,f=a.right+a.width/2,_=a.bottom;break;case"widget-right":l=a.top,u=a.left+a.width/2,f=a.right,_=a.bottom;break;case"widget-bottom":l=a.top+a.height/2,u=a.left,f=a.right,_=a.bottom;break;case"widget-tab":var M=a.tabBar.node.getBoundingClientRect().height;l=a.top,u=a.left,f=a.right,_=a.bottom+a.height-M;break;default:throw"unreachable"}return this.overlay.show({top:l,left:u,right:f,bottom:_}),o},e.prototype._createTabBar=function(){var r=this._renderer.createTabBar();return sa.isGeneratedTabBarProperty.set(r,!0),this._mode==="single-document"&&r.hide(),r.tabsMovable=this._tabsMovable,r.allowDeselect=!1,r.removeBehavior="select-previous-tab",r.insertBehavior="select-tab-if-needed",r.tabMoved.connect(this._onTabMoved,this),r.currentChanged.connect(this._onCurrentChanged,this),r.tabCloseRequested.connect(this._onTabCloseRequested,this),r.tabDetachRequested.connect(this._onTabDetachRequested,this),r.tabActivateRequested.connect(this._onTabActivateRequested,this),r},e.prototype._createHandle=function(){return this._renderer.createHandle()},e.prototype._onTabMoved=function(){Pr.postMessage(this,sa.LayoutModified)},e.prototype._onCurrentChanged=function(r,i){var n=i.previousTitle,o=i.currentTitle;n&&n.owner.hide(),o&&o.owner.show(),(Jl.IS_EDGE||Jl.IS_IE)&&Pr.flush(),Pr.postMessage(this,sa.LayoutModified)},e.prototype._onTabActivateRequested=function(r,i){i.title.owner.activate()},e.prototype._onTabCloseRequested=function(r,i){i.title.owner.close()},e.prototype._onTabDetachRequested=function(r,i){var n=this;if(!this._drag){r.releaseMouse();var o=i.title,a=i.tab,l=i.clientX,u=i.clientY,f=new uY,_=function(){return o.owner};f.setData("application/vnd.lumino.widget-factory",_);var w=a.cloneNode(!0);this._drag=new Vp({mimeData:f,dragImage:w,proposedAction:"move",supportedActions:"move"}),a.classList.add("lm-mod-hidden"),a.classList.add("p-mod-hidden");var E=function(){n._drag=null,a.classList.remove("lm-mod-hidden"),a.classList.remove("p-mod-hidden")};this._drag.start(l,u).then(E)}},e}(ai);(function(t){var e=function(){function i(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.classList.add("p-DockPanel-overlay"),this.node.classList.add("p-mod-hidden"),this.node.style.position="absolute"}return i.prototype.show=function(n){var o=this.node.style;o.top=n.top+"px",o.left=n.left+"px",o.right=n.right+"px",o.bottom=n.bottom+"px",clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"),this.node.classList.remove("p-mod-hidden"))},i.prototype.hide=function(n){var o=this;if(!this._hidden){if(n<=0){clearTimeout(this._timer),this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden"),this.node.classList.add("p-mod-hidden");return}this._timer===-1&&(this._timer=window.setTimeout(function(){o._timer=-1,o._hidden=!0,o.node.classList.add("lm-mod-hidden"),o.node.classList.add("p-mod-hidden")},n))}},i}();t.Overlay=e;var r=function(){function i(){}return i.prototype.createTabBar=function(){var n=new NS;return n.addClass("lm-DockPanel-tabBar"),n.addClass("p-DockPanel-tabBar"),n},i.prototype.createHandle=function(){var n=document.createElement("div");return n.className="lm-DockPanel-handle",n.classList.add("p-DockPanel-handle"),n},i}();t.Renderer=r,t.defaultRenderer=new r})(xY||(xY={}));var sa;(function(t){t.GOLDEN_RATIO=.618,t.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},t.LayoutModified=new E_("layout-modified"),t.isGeneratedTabBarProperty=new nu({name:"isGeneratedTabBar",create:function(){return!1}});function e(n){if(n.isEmpty)return{main:null};var o=QX(n.widgets()),a=n.selectedWidgets().next(),l=a?o.indexOf(a):-1;return{main:{type:"tab-area",widgets:o,currentIndex:l}}}t.createSingleDocumentConfig=e;function r(n,o,a,l){if(!Bo.hitTest(n.node,o,a))return{zone:"invalid",target:null};var u=n.layout;if(u.isEmpty)return{zone:"root-all",target:null};if(n.mode==="multiple-document"){var f=n.node.getBoundingClientRect(),_=o-f.left+1,w=a-f.top+1,E=f.right-o,M=f.bottom-a,D=Math.min(w,E,M,_);switch(D){case w:if(w<l.top)return{zone:"root-top",target:null};break;case E:if(E<l.right)return{zone:"root-right",target:null};break;case M:if(M<l.bottom)return{zone:"root-bottom",target:null};break;case _:if(_<l.left)return{zone:"root-left",target:null};break;default:throw"unreachable"}}var j=u.hitTestTabAreas(o,a);if(!j)return{zone:"invalid",target:null};if(n.mode==="single-document")return{zone:"widget-all",target:j};var V=j.x-j.left+1,$=j.y-j.top+1,te=j.left+j.width-j.x,ne=j.top+j.height-j.y,le=j.tabBar.node.getBoundingClientRect().height;if($<le)return{zone:"widget-tab",target:j};var z=Math.round(j.width/3),ke=Math.round(j.height/3);if(V>z&&te>z&&$>ke&&ne>ke)return{zone:"widget-all",target:j};V/=z,$/=ke,te/=z,ne/=ke;var Y=Math.min(V,$,te,ne),X;switch(Y){case V:X="widget-left";break;case $:X="widget-top";break;case te:X="widget-right";break;case ne:X="widget-bottom";break;default:throw"unreachable"}return{zone:X,target:j}}t.findDropTarget=r;function i(n){return n.titles.length===0?null:n.currentTitle?n.currentTitle.owner:n.titles[n.titles.length-1].owner}t.getDropRef=i})(sa||(sa={}));var Pht=function(){function t(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new Eo(this),this._currentChanged=new Eo(this)}return t.prototype.dispose=function(){var e=this;this._counter<0||(this._counter=-1,Eo.clearData(this),hn(this._widgets,function(r){r.node.removeEventListener("focus",e,!0),r.node.removeEventListener("blur",e,!0)}),this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0)},Object.defineProperty(t.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activeChanged",{get:function(){return this._activeChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._counter<0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentWidget",{get:function(){return this._currentWidget},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activeWidget",{get:function(){return this._activeWidget},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),t.prototype.focusNumber=function(e){var r=this._numbers.get(e);return r===void 0?-1:r},t.prototype.has=function(e){return this._numbers.has(e)},t.prototype.add=function(e){if(!this._numbers.has(e)){var r=e.node.contains(document.activeElement),i=r?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),r&&this._setWidgets(e,e)}},t.prototype.remove=function(e){var r=this;if(this._numbers.has(e)&&(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),ei.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget===e)){var i=$X(this._widgets,function(o){return r._numbers.get(o)!==-1}),n=eY(i,function(o,a){var l=r._numbers.get(o),u=r._numbers.get(a);return l-u})||null;this._setWidgets(n,null)}},t.prototype.handleEvent=function(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e);break}},t.prototype._setWidgets=function(e,r){var i=this._currentWidget;this._currentWidget=e;var n=this._activeWidget;this._activeWidget=r,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),n!==r&&this._activeChanged.emit({oldValue:n,newValue:r})},t.prototype._evtFocus=function(e){var r=this._nodes.get(e.currentTarget);r!==this._currentWidget&&this._numbers.set(r,this._counter++),this._setWidgets(r,r)},t.prototype._evtBlur=function(e){var r=this._nodes.get(e.currentTarget),i=e.relatedTarget;if(!i){this._setWidgets(this._currentWidget,null);return}if(!r.node.contains(i)&&!T_(this._widgets,function(n){return n.node.contains(i)})){this._setWidgets(this._currentWidget,null);return}},t.prototype._onWidgetDisposed=function(e){this.remove(e)},t}(),xD=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,r)||this;return i._dirty=!1,i._rowSpacing=4,i._columnSpacing=4,i._items=[],i._rowStarts=[],i._columnStarts=[],i._rowSizers=[new jp],i._columnSizers=[new jp],i._box=null,r.rowCount!==void 0&&$a.reallocSizers(i._rowSizers,r.rowCount),r.columnCount!==void 0&&$a.reallocSizers(i._columnSizers,r.columnCount),r.rowSpacing!==void 0&&(i._rowSpacing=$a.clampValue(r.rowSpacing)),r.columnSpacing!==void 0&&(i._columnSpacing=$a.clampValue(r.columnSpacing)),i}return e.prototype.dispose=function(){hn(this._items,function(r){var i=r.widget;r.dispose(),i.dispose()}),this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"rowCount",{get:function(){return this._rowSizers.length},set:function(r){r!==this.rowCount&&($a.reallocSizers(this._rowSizers,r),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnCount",{get:function(){return this._columnSizers.length},set:function(r){r!==this.columnCount&&($a.reallocSizers(this._columnSizers,r),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowSpacing",{get:function(){return this._rowSpacing},set:function(r){r=$a.clampValue(r),this._rowSpacing!==r&&(this._rowSpacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnSpacing",{get:function(){return this._columnSpacing},set:function(r){r=$a.clampValue(r),this._columnSpacing!==r&&(this._columnSpacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),e.prototype.rowStretch=function(r){var i=this._rowSizers[r];return i?i.stretch:-1},e.prototype.setRowStretch=function(r,i){var n=this._rowSizers[r];n&&(i=$a.clampValue(i),n.stretch!==i&&(n.stretch=i,this.parent&&this.parent.update()))},e.prototype.columnStretch=function(r){var i=this._columnSizers[r];return i?i.stretch:-1},e.prototype.setColumnStretch=function(r,i){var n=this._columnSizers[r];n&&(i=$a.clampValue(i),n.stretch!==i&&(n.stretch=i,this.parent&&this.parent.update()))},e.prototype.iter=function(){return Up(this._items,function(r){return r.widget})},e.prototype.addWidget=function(r){var i=ei.findFirstIndex(this._items,function(n){return n.widget===r});i===-1&&(this._items.push(new U1(r)),this.parent&&this.attachWidget(r))},e.prototype.removeWidget=function(r){var i=ei.findFirstIndex(this._items,function(o){return o.widget===r});if(i!==-1){var n=ei.removeAt(this._items,i);this.parent&&this.detachWidget(r),n.dispose()}},e.prototype.init=function(){var r=this;t.prototype.init.call(this),hn(this,function(i){r.attachWidget(i)})},e.prototype.attachWidget=function(r){this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.AfterAttach),this.parent.fit()},e.prototype.detachWidget=function(r){this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.AfterDetach),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var r=0,i=this.rowCount;r<i;++r)this._rowSizers[r].minSize=0;for(var r=0,i=this.columnCount;r<i;++r)this._columnSizers[r].minSize=0;for(var n=this._items.filter(function($){return!$.isHidden}),r=0,i=n.length;r<i;++r)n[r].fit();var o=this.rowCount-1,a=this.columnCount-1;n.sort($a.rowSpanCmp);for(var r=0,i=n.length;r<i;++r){var l=n[r],u=e.getCellConfig(l.widget),f=Math.min(u.row,o),_=Math.min(u.row+u.rowSpan-1,o);$a.distributeMin(this._rowSizers,f,_,l.minHeight)}n.sort($a.columnSpanCmp);for(var r=0,i=n.length;r<i;++r){var l=n[r],u=e.getCellConfig(l.widget),w=Math.min(u.column,a),E=Math.min(u.column+u.columnSpan-1,a);$a.distributeMin(this._columnSizers,w,E,l.minWidth)}if(this.fitPolicy==="set-no-constraint"){Pr.sendMessage(this.parent,ai.Msg.UpdateRequest);return}for(var M=o*this._rowSpacing,D=a*this._columnSpacing,r=0,i=this.rowCount;r<i;++r)M+=this._rowSizers[r].minSize;for(var r=0,i=this.columnCount;r<i;++r)D+=this._columnSizers[r].minSize;var j=this._box=Bo.boxSizing(this.parent.node);D+=j.horizontalSum,M+=j.verticalSum;var V=this.parent.node.style;V.minWidth=D+"px",V.minHeight=M+"px",this._dirty=!0,this.parent.parent&&Pr.sendMessage(this.parent.parent,ai.Msg.FitRequest),this._dirty&&Pr.sendMessage(this.parent,ai.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1,r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=Bo.boxSizing(this.parent.node));var n=this._box.paddingTop,o=this._box.paddingLeft,a=r-this._box.horizontalSum,l=i-this._box.verticalSum,u=this.rowCount-1,f=this.columnCount-1,_=u*this._rowSpacing,w=f*this._columnSpacing;au.calc(this._rowSizers,Math.max(0,l-_)),au.calc(this._columnSizers,Math.max(0,a-w));for(var E=0,M=n,D=this.rowCount;E<D;++E)this._rowStarts[E]=M,M+=this._rowSizers[E].size+this._rowSpacing;for(var E=0,M=o,D=this.columnCount;E<D;++E)this._columnStarts[E]=M,M+=this._columnSizers[E].size+this._columnSpacing;for(var E=0,D=this._items.length;E<D;++E){var j=this._items[E];if(!j.isHidden){var V=e.getCellConfig(j.widget),$=Math.min(V.row,u),te=Math.min(V.column,f),ne=Math.min(V.row+V.rowSpan-1,u),le=Math.min(V.column+V.columnSpan-1,f),z=this._columnStarts[te],ke=this._rowStarts[$],Y=this._columnStarts[le]+this._columnSizers[le].size-z,X=this._rowStarts[ne]+this._rowSizers[ne].size-ke;j.update(z,ke,Y,X)}}},e}(Gp);(function(t){function e(i){return $a.cellConfigProperty.get(i)}t.getCellConfig=e;function r(i,n){$a.cellConfigProperty.set(i,$a.normalizeConfig(n))}t.setCellConfig=r})(xD||(xD={}));var $a;(function(t){t.cellConfigProperty=new nu({name:"cellConfig",create:function(){return{row:0,column:0,rowSpan:1,columnSpan:1}},changed:l});function e(u){var f=Math.max(0,Math.floor(u.row||0)),_=Math.max(0,Math.floor(u.column||0)),w=Math.max(1,Math.floor(u.rowSpan||0)),E=Math.max(1,Math.floor(u.columnSpan||0));return{row:f,column:_,rowSpan:w,columnSpan:E}}t.normalizeConfig=e;function r(u){return Math.max(0,Math.floor(u))}t.clampValue=r;function i(u,f){var _=t.cellConfigProperty.get(u.widget),w=t.cellConfigProperty.get(f.widget);return _.rowSpan-w.rowSpan}t.rowSpanCmp=i;function n(u,f){var _=t.cellConfigProperty.get(u.widget),w=t.cellConfigProperty.get(f.widget);return _.columnSpan-w.columnSpan}t.columnSpanCmp=n;function o(u,f){for(f=Math.max(1,Math.floor(f));u.length<f;)u.push(new jp);u.length>f&&(u.length=f)}t.reallocSizers=o;function a(u,f,_,w){if(!(_<f)){if(f===_){var E=u[f];E.minSize=Math.max(E.minSize,w);return}for(var M=0,D=f;D<=_;++D)M+=u[D].minSize;if(!(M>=w))for(var j=(w-M)/(_-f+1),D=f;D<=_;++D)u[D].minSize+=j}}t.distributeMin=a;function l(u){u.parent&&u.parent.layout instanceof xD&&u.parent.fit()}})($a||($a={}));var bY=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{node:kS.createNode()})||this;return i._activeIndex=-1,i._menus=[],i._childMenu=null,i.addClass("lm-MenuBar"),i.addClass("p-MenuBar"),i.setFlag(ai.Flag.DisallowLayout),i.renderer=r.renderer||e.defaultRenderer,i}return e.prototype.dispose=function(){this._closeChildMenu(),this._menus.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"childMenu",{get:function(){return this._childMenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeMenu",{get:function(){return this._menus[this._activeIndex]||null},set:function(r){this.activeIndex=r?this._menus.indexOf(r):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(r){(r<0||r>=this._menus.length)&&(r=-1),this._activeIndex!==r&&(this._activeIndex=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menus",{get:function(){return this._menus},enumerable:!0,configurable:!0}),e.prototype.openActiveMenu=function(){this._activeIndex!==-1&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))},e.prototype.addMenu=function(r){this.insertMenu(this._menus.length,r)},e.prototype.insertMenu=function(r,i){this._closeChildMenu();var n=this._menus.indexOf(i),o=Math.max(0,Math.min(r,this._menus.length));if(n===-1){ei.insert(this._menus,o,i),i.addClass("lm-MenuBar-menu"),i.addClass("p-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),this.update();return}o===this._menus.length&&o--,n!==o&&(ei.move(this._menus,n,o),this.update())},e.prototype.removeMenu=function(r){this.removeMenuAt(this._menus.indexOf(r))},e.prototype.removeMenuAt=function(r){this._closeChildMenu();var i=ei.removeAt(this._menus,r);i&&(i.aboutToClose.disconnect(this._onMenuAboutToClose,this),i.menuRequested.disconnect(this._onMenuMenuRequested,this),i.title.changed.disconnect(this._onTitleChanged,this),i.removeClass("lm-MenuBar-menu"),i.removeClass("p-MenuBar-menu"),this.update())},e.prototype.clearMenus=function(){if(this._menus.length!==0){this._closeChildMenu();for(var r=0,i=this._menus;r<i.length;r++){var n=i[r];n.aboutToClose.disconnect(this._onMenuAboutToClose,this),n.menuRequested.disconnect(this._onMenuMenuRequested,this),n.title.changed.disconnect(this._onTitleChanged,this),n.removeClass("lm-MenuBar-menu"),n.removeClass("p-MenuBar-menu")}this._menus.length=0,this.update()}},e.prototype.handleEvent=function(r){switch(r.type){case"keydown":this._evtKeyDown(r);break;case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseleave":this._evtMouseLeave(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()},e.prototype.onActivateRequest=function(r){this.isAttached&&this.node.focus()},e.prototype.onUpdateRequest=function(r){for(var i=this._menus,n=this.renderer,o=this._activeIndex,a=new Array(i.length),l=0,u=i.length;l<u;++l){var f=i[l].title,_=l===o;a[l]=n.renderItem({title:f,active:_})}Ld.render(a,this.contentNode)},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation();var i=r.keyCode;if(i===13||i===38||i===40){this.openActiveMenu();return}if(i===27){this._closeChildMenu(),this.activeIndex=-1,this.node.blur();return}if(i===37){var n=this._activeIndex,o=this._menus.length;this.activeIndex=n===0?o-1:n-1;return}if(i===39){var n=this._activeIndex,o=this._menus.length;this.activeIndex=n===o-1?0:n+1;return}var a=k1().keyForKeydownEvent(r);if(a){var l=this._activeIndex+1,u=kS.findMnemonic(this._menus,a,l);u.index!==-1&&!u.multiple?(this.activeIndex=u.index,this.openActiveMenu()):u.index!==-1?this.activeIndex=u.index:u.auto!==-1&&(this.activeIndex=u.auto)}},e.prototype._evtMouseDown=function(r){if(Bo.hitTest(this.node,r.clientX,r.clientY)){r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation();var i=ei.findFirstIndex(this.contentNode.children,function(n){return Bo.hitTest(n,r.clientX,r.clientY)});if(i===-1){this._closeChildMenu();return}r.button===0&&(this._childMenu?(this._closeChildMenu(),this.activeIndex=i):(this.activeIndex=i,this._openChildMenu()))}},e.prototype._evtMouseMove=function(r){var i=ei.findFirstIndex(this.contentNode.children,function(n){return Bo.hitTest(n,r.clientX,r.clientY)});i!==this._activeIndex&&(i===-1&&this._childMenu||(this.activeIndex=i,this._childMenu&&this._openChildMenu()))},e.prototype._evtMouseLeave=function(r){this._childMenu||(this.activeIndex=-1)},e.prototype._openChildMenu=function(){var r=this.activeMenu;if(!r){this._closeChildMenu();return}var i=this._childMenu;if(i!==r){this._childMenu=r,i?i.close():(this.addClass("lm-mod-active"),this.addClass("p-mod-active"),document.addEventListener("mousedown",this,!0)),Pr.sendMessage(this,ai.Msg.UpdateRequest);var n=this.contentNode.children[this._activeIndex],o=n.getBoundingClientRect(),a=o.left,l=o.bottom;r.open(a,l,{forceX:!0,forceY:!0})}},e.prototype._closeChildMenu=function(){if(this._childMenu){this.removeClass("lm-mod-active"),this.removeClass("p-mod-active"),document.removeEventListener("mousedown",this,!0);var r=this._childMenu;this._childMenu=null,r.close(),this.activeIndex=-1}},e.prototype._onMenuAboutToClose=function(r){r===this._childMenu&&(this.removeClass("lm-mod-active"),this.removeClass("p-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)},e.prototype._onMenuMenuRequested=function(r,i){if(r===this._childMenu){var n=this._activeIndex,o=this._menus.length;switch(i){case"next":this.activeIndex=n===o-1?0:n+1;break;case"previous":this.activeIndex=n===0?o-1:n-1;break}this.openActiveMenu()}},e.prototype._onTitleChanged=function(){this.update()},e}(ai);(function(t){var e=function(){function r(){}return r.prototype.renderItem=function(i){var n=this.createItemClass(i),o=this.createItemDataset(i);return Oo.li({className:n,dataset:o},this.renderIcon(i),this.renderLabel(i))},r.prototype.renderIcon=function(i){var n=this.createIconClass(i);return typeof i.title.icon=="string"?Oo.div({className:n},i.title.iconLabel):Oo.div({className:n},i.title.icon,i.title.iconLabel)},r.prototype.renderLabel=function(i){var n=this.formatLabel(i);return Oo.div({className:"lm-MenuBar-itemLabel p-MenuBar-itemLabel"},n)},r.prototype.createItemClass=function(i){var n="lm-MenuBar-item";return n+=" p-MenuBar-item",i.title.className&&(n+=" "+i.title.className),i.active&&(n+=" lm-mod-active",n+=" p-mod-active"),n},r.prototype.createItemDataset=function(i){return i.title.dataset},r.prototype.createIconClass=function(i){var n="lm-MenuBar-itemIcon";n+=" p-MenuBar-itemIcon";var o=i.title.iconClass;return o?n+" "+o:n},r.prototype.formatLabel=function(i){var n=i.title,o=n.label,a=n.mnemonic;if(a<0||a>=o.length)return o;var l=o.slice(0,a),u=o.slice(a+1),f=o[a],_=Oo.span({className:"lm-MenuBar-itemMnemonic p-MenuBar-itemMnemonic"},f);return[l,_,u]},r}();t.Renderer=e,t.defaultRenderer=new e})(bY||(bY={}));var kS;(function(t){function e(){var i=document.createElement("div"),n=document.createElement("ul");return n.className="lm-MenuBar-content",n.classList.add("p-MenuBar-content"),i.appendChild(n),i.tabIndex=-1,i}t.createNode=e;function r(i,n,o){for(var a=-1,l=-1,u=!1,f=n.toUpperCase(),_=0,w=i.length;_<w;++_){var E=(_+o)%w,M=i[E].title;if(M.label.length!==0){var D=M.mnemonic;if(D>=0&&D<M.label.length){M.label[D].toUpperCase()===f&&(a===-1?a=E:u=!0);continue}l===-1&&M.label[0].toUpperCase()===f&&(l=E)}}return{index:a,multiple:u,auto:l}}t.findMnemonic=r})(kS||(kS={}));var Rht=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{node:US.createNode()})||this;return i._onRepeat=function(){if(i._repeatTimer=-1,!!i._pressData){var n=i._pressData.part;if(n!=="thumb"){i._repeatTimer=window.setTimeout(i._onRepeat,20);var o=i._pressData.mouseX,a=i._pressData.mouseY;if(n==="decrement"){if(!Bo.hitTest(i.decrementNode,o,a))return;i._stepRequested.emit("decrement");return}if(n==="increment"){if(!Bo.hitTest(i.incrementNode,o,a))return;i._stepRequested.emit("increment");return}if(n==="track"){if(!Bo.hitTest(i.trackNode,o,a))return;var l=i.thumbNode;if(Bo.hitTest(l,o,a))return;var u=l.getBoundingClientRect(),f=void 0;i._orientation==="horizontal"?f=o<u.left?"decrement":"increment":f=a<u.top?"decrement":"increment",i._pageRequested.emit(f);return}}}},i._value=0,i._page=10,i._maximum=100,i._repeatTimer=-1,i._pressData=null,i._thumbMoved=new Eo(i),i._stepRequested=new Eo(i),i._pageRequested=new Eo(i),i.addClass("lm-ScrollBar"),i.addClass("p-ScrollBar"),i.setFlag(ai.Flag.DisallowLayout),i._orientation=r.orientation||"vertical",i.dataset.orientation=i._orientation,r.maximum!==void 0&&(i._maximum=Math.max(0,r.maximum)),r.page!==void 0&&(i._page=Math.max(0,r.page)),r.value!==void 0&&(i._value=Math.max(0,Math.min(r.value,i._maximum))),i}return Object.defineProperty(e.prototype,"thumbMoved",{get:function(){return this._thumbMoved},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stepRequested",{get:function(){return this._stepRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageRequested",{get:function(){return this._pageRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(r){this._orientation!==r&&(this._releaseMouse(),this._orientation=r,this.dataset.orientation=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(r){r=Math.max(0,Math.min(r,this._maximum)),this._value!==r&&(this._value=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){return this._page},set:function(r){r=Math.max(0,r),this._page!==r&&(this._page=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(r){r=Math.max(0,r),this._maximum!==r&&(this._maximum=r,this._value=Math.min(this._value,r),this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"decrementNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-button")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"incrementNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-button")[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trackNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-track")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thumbNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-thumb")[0]},enumerable:!0,configurable:!0}),e.prototype.handleEvent=function(r){switch(r.type){case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("mousedown",this),this.update()},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("mousedown",this),this._releaseMouse()},e.prototype.onUpdateRequest=function(r){var i=this._value*100/this._maximum,n=this._page*100/(this._page+this._maximum);i=Math.max(0,Math.min(i,100)),n=Math.max(0,Math.min(n,100));var o=this.thumbNode.style;this._orientation==="horizontal"?(o.top="",o.height="",o.left=i+"%",o.width=n+"%",o.transform="translate("+-i+"%, 0%)"):(o.left="",o.width="",o.top=i+"%",o.height=n+"%",o.transform="translate(0%, "+-i+"%)")},e.prototype._evtKeyDown=function(r){if(r.preventDefault(),r.stopPropagation(),r.keyCode===27){var i=this._pressData?this._pressData.value:-1;this._releaseMouse(),i!==-1&&this._moveThumb(i)}},e.prototype._evtMouseDown=function(r){if(r.button===0&&(this.activate(),!this._pressData)){var i=US.findPart(this,r.target);if(i){r.preventDefault(),r.stopPropagation();var n=Vp.overrideCursor("default");if(this._pressData={part:i,override:n,delta:-1,value:-1,mouseX:r.clientX,mouseY:r.clientY},document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0),i==="thumb"){var o=this.thumbNode,a=o.getBoundingClientRect();this._orientation==="horizontal"?this._pressData.delta=r.clientX-a.left:this._pressData.delta=r.clientY-a.top,o.classList.add("lm-mod-active"),o.classList.add("p-mod-active"),this._pressData.value=this._value;return}if(i==="track"){var a=this.thumbNode.getBoundingClientRect(),l=void 0;this._orientation==="horizontal"?l=r.clientX<a.left?"decrement":"increment":l=r.clientY<a.top?"decrement":"increment",this._repeatTimer=window.setTimeout(this._onRepeat,350),this._pageRequested.emit(l);return}if(i==="decrement"){this.decrementNode.classList.add("lm-mod-active"),this.decrementNode.classList.add("p-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),this._stepRequested.emit("decrement");return}if(i==="increment"){this.incrementNode.classList.add("lm-mod-active"),this.incrementNode.classList.add("p-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),this._stepRequested.emit("increment");return}}}},e.prototype._evtMouseMove=function(r){if(this._pressData&&(r.preventDefault(),r.stopPropagation(),this._pressData.mouseX=r.clientX,this._pressData.mouseY=r.clientY,this._pressData.part==="thumb")){var i=this.thumbNode.getBoundingClientRect(),n=this.trackNode.getBoundingClientRect(),o,a;this._orientation==="horizontal"?(o=r.clientX-n.left-this._pressData.delta,a=n.width-i.width):(o=r.clientY-n.top-this._pressData.delta,a=n.height-i.height);var l=a===0?0:o*this._maximum/a;this._moveThumb(l)}},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this._releaseMouse())},e.prototype._releaseMouse=function(){this._pressData&&(clearTimeout(this._repeatTimer),this._repeatTimer=-1,this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),this.thumbNode.classList.remove("lm-mod-active"),this.decrementNode.classList.remove("lm-mod-active"),this.incrementNode.classList.remove("lm-mod-active"),this.thumbNode.classList.remove("p-mod-active"),this.decrementNode.classList.remove("p-mod-active"),this.incrementNode.classList.remove("p-mod-active"))},e.prototype._moveThumb=function(r){r=Math.max(0,Math.min(r,this._maximum)),this._value!==r&&(this._value=r,this.update(),this._thumbMoved.emit(r))},e}(ai),US;(function(t){function e(){var i=document.createElement("div"),n=document.createElement("div"),o=document.createElement("div"),a=document.createElement("div"),l=document.createElement("div");return n.className="lm-ScrollBar-button",o.className="lm-ScrollBar-button",n.dataset.action="decrement",o.dataset.action="increment",a.className="lm-ScrollBar-track",l.className="lm-ScrollBar-thumb",n.classList.add("p-ScrollBar-button"),o.classList.add("p-ScrollBar-button"),a.classList.add("p-ScrollBar-track"),l.classList.add("p-ScrollBar-thumb"),a.appendChild(l),i.appendChild(n),i.appendChild(a),i.appendChild(o),i}t.createNode=e;function r(i,n){return i.thumbNode.contains(n)?"thumb":i.trackNode.contains(n)?"track":i.decrementNode.contains(n)?"decrement":i.incrementNode.contains(n)?"increment":null}t.findPart=r})(US||(US={}));var Bht=function(t){Oa(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._widget=null,r}return e.prototype.dispose=function(){if(this._widget){var r=this._widget;this._widget=null,r.dispose()}t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"widget",{get:function(){return this._widget},set:function(r){r&&(r.parent=this.parent),this._widget!==r&&(this._widget&&this._widget.dispose(),this._widget=r,this.parent&&r&&this.attachWidget(r))},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return this._widget?F1(this._widget):Bf()},e.prototype.removeWidget=function(r){this._widget===r&&(this._widget=null,this.parent&&this.detachWidget(r))},e.prototype.init=function(){var r=this;t.prototype.init.call(this),hn(this,function(i){r.attachWidget(i)})},e.prototype.attachWidget=function(r){this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.AfterAttach)},e.prototype.detachWidget=function(r){this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&Pr.sendMessage(r,ai.Msg.AfterDetach)},e}(Gp),P_=function(t){Oa(e,t);function e(r){var i=t.call(this)||this;return i._fixed=0,i._spacing=4,i._dirty=!1,i._hasNormedSizes=!1,i._sizers=[],i._items=[],i._handles=[],i._box=null,i._alignment="start",i._orientation="horizontal",i.renderer=r.renderer,r.orientation!==void 0&&(i._orientation=r.orientation),r.alignment!==void 0&&(i._alignment=r.alignment),r.spacing!==void 0&&(i._spacing=Dh.clampSpacing(r.spacing)),i}return e.prototype.dispose=function(){hn(this._items,function(r){r.dispose()}),this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(r){this._orientation!==r&&(this._orientation=r,this.parent&&(this.parent.dataset.orientation=r,this.parent.fit()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this._alignment},set:function(r){this._alignment!==r&&(this._alignment=r,this.parent&&(this.parent.dataset.alignment=r,this.parent.update()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(r){r=Dh.clampSpacing(r),this._spacing!==r&&(this._spacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"handles",{get:function(){return this._handles},enumerable:!0,configurable:!0}),e.prototype.relativeSizes=function(){return Dh.normalize(this._sizers.map(function(r){return r.size}))},e.prototype.setRelativeSizes=function(r){for(var i=this._sizers.length,n=r.slice(0,i);n.length<i;)n.push(0);for(var o=Dh.normalize(n),a=0;a<i;++a){var l=this._sizers[a];l.sizeHint=o[a],l.size=o[a]}this._hasNormedSizes=!0,this.parent&&this.parent.update()},e.prototype.moveHandle=function(r,i){var n=this._handles[r];if(!(!n||n.classList.contains("lm-mod-hidden"))){var o;if(this._orientation==="horizontal"?o=i-n.offsetLeft:o=i-n.offsetTop,o!==0){for(var a=0,l=this._sizers;a<l.length;a++){var u=l[a];u.size>0&&(u.sizeHint=u.size)}au.adjust(this._sizers,r,o),this.parent&&this.parent.update()}}},e.prototype.init=function(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,t.prototype.init.call(this)},e.prototype.attachWidget=function(r,i){var n=new U1(i),o=Dh.createHandle(this.renderer),a=Dh.averageSize(this._sizers),l=Dh.createSizer(a);ei.insert(this._items,r,n),ei.insert(this._sizers,r,l),ei.insert(this._handles,r,o),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(o),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterAttach),this.parent.fit()},e.prototype.moveWidget=function(r,i,n){ei.move(this._items,r,i),ei.move(this._sizers,r,i),ei.move(this._handles,r,i),this.parent.fit()},e.prototype.detachWidget=function(r,i){var n=ei.removeAt(this._items,r),o=ei.removeAt(this._handles,r);ei.removeAt(this._sizers,r),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(o),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterDetach),n.dispose(),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var r=0,i=-1,n=0,o=this._items.length;n<o;++n)this._items[n].isHidden?(this._handles[n].classList.add("lm-mod-hidden"),this._handles[n].classList.add("p-mod-hidden")):(this._handles[n].classList.remove("lm-mod-hidden"),this._handles[n].classList.remove("p-mod-hidden"),i=n,r++);i!==-1&&(this._handles[i].classList.add("lm-mod-hidden"),this._handles[i].classList.add("p-mod-hidden")),this._fixed=this._spacing*Math.max(0,r-1);for(var a=this._orientation==="horizontal",l=a?this._fixed:0,u=a?0:this._fixed,n=0,o=this._items.length;n<o;++n){var f=this._items[n],_=this._sizers[n];if(_.size>0&&(_.sizeHint=_.size),f.isHidden){_.minSize=0,_.maxSize=0;continue}f.fit(),_.stretch=e.getStretch(f.widget),a?(_.minSize=f.minWidth,_.maxSize=f.maxWidth,l+=f.minWidth,u=Math.max(u,f.minHeight)):(_.minSize=f.minHeight,_.maxSize=f.maxHeight,u+=f.minHeight,l=Math.max(l,f.minWidth))}var w=this._box=Bo.boxSizing(this.parent.node);l+=w.horizontalSum,u+=w.verticalSum;var E=this.parent.node.style;E.minWidth=l+"px",E.minHeight=u+"px",this._dirty=!0,this.parent.parent&&Pr.sendMessage(this.parent.parent,ai.Msg.FitRequest),this._dirty&&Pr.sendMessage(this.parent,ai.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1;for(var n=0,o=0,a=this._items.length;o<a;++o)n+=+!this._items[o].isHidden;if(n!==0){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=Bo.boxSizing(this.parent.node));var l=this._box.paddingTop,u=this._box.paddingLeft,f=r-this._box.horizontalSum,_=i-this._box.verticalSum,w,E=this._orientation==="horizontal";if(E?w=Math.max(0,f-this._fixed):w=Math.max(0,_-this._fixed),this._hasNormedSizes){for(var M=0,D=this._sizers;M<D.length;M++){var j=D[M];j.sizeHint*=w}this._hasNormedSizes=!1}var V=au.calc(this._sizers,w),$=0,te=0;if(V>0)switch(this._alignment){case"start":break;case"center":$=0,te=V/2;break;case"end":$=0,te=V;break;case"justify":$=V/n,te=0;break;default:throw"unreachable"}for(var o=0,a=this._items.length;o<a;++o){var ne=this._items[o];if(!ne.isHidden){var le=this._sizers[o].size,z=this._handles[o].style;E?(ne.update(u+te,l,le+$,_),u+=le+$,z.top=l+"px",z.left=u+te+"px",z.width=this._spacing+"px",z.height=_+"px",u+=this._spacing):(ne.update(u,l+te,f,le+$),l+=le+$,z.top=l+te+"px",z.left=u+"px",z.width=f+"px",z.height=this._spacing+"px",l+=this._spacing)}}}},e}(zS);(function(t){function e(i){return Dh.stretchProperty.get(i)}t.getStretch=e;function r(i,n){Dh.stretchProperty.set(i,n)}t.setStretch=r})(P_||(P_={}));var Dh;(function(t){t.stretchProperty=new nu({name:"stretch",create:function(){return 0},coerce:function(l,u){return Math.max(0,Math.floor(u))},changed:a});function e(l){var u=new jp;return u.sizeHint=Math.floor(l),u}t.createSizer=e;function r(l){var u=l.createHandle();return u.style.position="absolute",u}t.createHandle=r;function i(l){return Math.max(0,Math.floor(l))}t.clampSpacing=i;function n(l){return l.reduce(function(u,f){return u+f.size},0)/l.length||0}t.averageSize=n;function o(l){var u=l.length;if(u===0)return[];var f=l.reduce(function(_,w){return _+Math.abs(w)},0);return f===0?l.map(function(_){return 1/u}):l.map(function(_){return _/f})}t.normalize=o;function a(l){l.parent&&l.parent.layout instanceof P_&&l.parent.fit()}})(Dh||(Dh={}));var bD=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{layout:wD.createLayout(r)})||this;return i._pressData=null,i.addClass("lm-SplitPanel"),i.addClass("p-SplitPanel"),i}return e.prototype.dispose=function(){this._releaseMouse(),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"orientation",{get:function(){return this.layout.orientation},set:function(r){this.layout.orientation=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this.layout.alignment},set:function(r){this.layout.alignment=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(r){this.layout.spacing=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this.layout.renderer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"handles",{get:function(){return this.layout.handles},enumerable:!0,configurable:!0}),e.prototype.relativeSizes=function(){return this.layout.relativeSizes()},e.prototype.setRelativeSizes=function(r){this.layout.setRelativeSizes(r)},e.prototype.handleEvent=function(r){switch(r.type){case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("mousedown",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("mousedown",this),this._releaseMouse()},e.prototype.onChildAdded=function(r){r.child.addClass("lm-SplitPanel-child"),r.child.addClass("p-SplitPanel-child"),this._releaseMouse()},e.prototype.onChildRemoved=function(r){r.child.removeClass("lm-SplitPanel-child"),r.child.removeClass("p-SplitPanel-child"),this._releaseMouse()},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation(),r.keyCode===27&&this._releaseMouse()},e.prototype._evtMouseDown=function(r){if(r.button===0){var i=this.layout,n=ei.findFirstIndex(i.handles,function(_){return _.contains(r.target)});if(n!==-1){r.preventDefault(),r.stopPropagation(),document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);var o,a=i.handles[n],l=a.getBoundingClientRect();i.orientation==="horizontal"?o=r.clientX-l.left:o=r.clientY-l.top;var u=window.getComputedStyle(a),f=Vp.overrideCursor(u.cursor);this._pressData={index:n,delta:o,override:f}}}},e.prototype._evtMouseMove=function(r){r.preventDefault(),r.stopPropagation();var i,n=this.layout,o=this.node.getBoundingClientRect();n.orientation==="horizontal"?i=r.clientX-o.left-this._pressData.delta:i=r.clientY-o.top-this._pressData.delta,n.moveHandle(this._pressData.index,i)},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this._releaseMouse())},e.prototype._releaseMouse=function(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("mouseup",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0))},e}(z1);(function(t){var e=function(){function n(){}return n.prototype.createHandle=function(){var o=document.createElement("div");return o.className="lm-SplitPanel-handle",o.classList.add("p-SplitPanel-handle"),o},n}();t.Renderer=e,t.defaultRenderer=new e;function r(n){return P_.getStretch(n)}t.getStretch=r;function i(n,o){P_.setStretch(n,o)}t.setStretch=i})(bD||(bD={}));var wD;(function(t){function e(r){return r.layout||new P_({renderer:r.renderer||bD.defaultRenderer,orientation:r.orientation,alignment:r.alignment,spacing:r.spacing})}t.createLayout=e})(wD||(wD={}));var gwe=function(t){Oa(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._dirty=!1,r._items=[],r._box=null,r}return e.prototype.dispose=function(){hn(this._items,function(r){r.dispose()}),this._box=null,this._items.length=0,t.prototype.dispose.call(this)},e.prototype.attachWidget=function(r,i){ei.insert(this._items,r,new U1(i)),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterAttach),this.parent.fit()},e.prototype.moveWidget=function(r,i,n){ei.move(this._items,r,i),this.parent.update()},e.prototype.detachWidget=function(r,i){var n=ei.removeAt(this._items,r);this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&Pr.sendMessage(i,ai.Msg.AfterDetach),n.widget.node.style.zIndex="",n.dispose(),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var r=0,i=0,n=0,o=this._items.length;n<o;++n){var a=this._items[n];a.isHidden||(a.fit(),r=Math.max(r,a.minWidth),i=Math.max(i,a.minHeight))}var l=this._box=Bo.boxSizing(this.parent.node);r+=l.horizontalSum,i+=l.verticalSum;var u=this.parent.node.style;u.minWidth=r+"px",u.minHeight=i+"px",this._dirty=!0,this.parent.parent&&Pr.sendMessage(this.parent.parent,ai.Msg.FitRequest),this._dirty&&Pr.sendMessage(this.parent,ai.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1;for(var n=0,o=0,a=this._items.length;o<a;++o)n+=+!this._items[o].isHidden;if(n!==0){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=Bo.boxSizing(this.parent.node));for(var l=this._box.paddingTop,u=this._box.paddingLeft,f=r-this._box.horizontalSum,_=i-this._box.verticalSum,o=0,a=this._items.length;o<a;++o){var w=this._items[o];w.isHidden||(w.widget.node.style.zIndex=""+o,w.update(u,l,f,_))}}},e}(zS),_we=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{layout:TD.createLayout(r)})||this;return i._widgetRemoved=new Eo(i),i.addClass("lm-StackedPanel"),i.addClass("p-StackedPanel"),i}return Object.defineProperty(e.prototype,"widgetRemoved",{get:function(){return this._widgetRemoved},enumerable:!0,configurable:!0}),e.prototype.onChildAdded=function(r){r.child.addClass("lm-StackedPanel-child"),r.child.addClass("p-StackedPanel-child")},e.prototype.onChildRemoved=function(r){r.child.removeClass("lm-StackedPanel-child"),r.child.removeClass("p-StackedPanel-child"),this._widgetRemoved.emit(r.child)},e}(z1),TD;(function(t){function e(r){return r.layout||new gwe}t.createLayout=e})(TD||(TD={}));var Oht=function(t){Oa(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;i._currentChanged=new Eo(i),i.addClass("lm-TabPanel"),i.addClass("p-TabPanel"),i.tabBar=new NS(r),i.tabBar.addClass("lm-TabPanel-tabBar"),i.stackedPanel=new _we,i.stackedPanel.addClass("lm-TabPanel-stackedPanel"),i.tabBar.addClass("p-TabPanel-tabBar"),i.stackedPanel.addClass("p-TabPanel-stackedPanel"),i.tabBar.tabMoved.connect(i._onTabMoved,i),i.tabBar.currentChanged.connect(i._onCurrentChanged,i),i.tabBar.tabCloseRequested.connect(i._onTabCloseRequested,i),i.tabBar.tabActivateRequested.connect(i._onTabActivateRequested,i),i.stackedPanel.widgetRemoved.connect(i._onWidgetRemoved,i),i._tabPlacement=r.tabPlacement||"top";var n=I_.directionFromPlacement(i._tabPlacement),o=I_.orientationFromPlacement(i._tabPlacement);i.tabBar.orientation=o,i.tabBar.dataset.placement=i._tabPlacement;var a=new Lh({direction:n,spacing:0});return Lh.setStretch(i.tabBar,0),Lh.setStretch(i.stackedPanel,1),a.addWidget(i.tabBar),a.addWidget(i.stackedPanel),i.layout=a,i}return Object.defineProperty(e.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this.tabBar.currentIndex},set:function(r){this.tabBar.currentIndex=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentWidget",{get:function(){var r=this.tabBar.currentTitle;return r?r.owner:null},set:function(r){this.tabBar.currentTitle=r?r.title:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsMovable",{get:function(){return this.tabBar.tabsMovable},set:function(r){this.tabBar.tabsMovable=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabPlacement",{get:function(){return this._tabPlacement},set:function(r){if(this._tabPlacement!==r){this._tabPlacement=r;var i=I_.directionFromPlacement(r),n=I_.orientationFromPlacement(r);this.tabBar.orientation=n,this.tabBar.dataset.placement=r,this.layout.direction=i}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"widgets",{get:function(){return this.stackedPanel.widgets},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(r){this.insertWidget(this.widgets.length,r)},e.prototype.insertWidget=function(r,i){i!==this.currentWidget&&i.hide(),this.stackedPanel.insertWidget(r,i),this.tabBar.insertTab(r,i.title)},e.prototype._onCurrentChanged=function(r,i){var n=i.previousIndex,o=i.previousTitle,a=i.currentIndex,l=i.currentTitle,u=o?o.owner:null,f=l?l.owner:null;u&&u.hide(),f&&f.show(),this._currentChanged.emit({previousIndex:n,previousWidget:u,currentIndex:a,currentWidget:f}),(Jl.IS_EDGE||Jl.IS_IE)&&Pr.flush()},e.prototype._onTabActivateRequested=function(r,i){i.title.owner.activate()},e.prototype._onTabCloseRequested=function(r,i){i.title.owner.close()},e.prototype._onTabMoved=function(r,i){this.stackedPanel.insertWidget(i.toIndex,i.title.owner)},e.prototype._onWidgetRemoved=function(r,i){this.tabBar.removeTab(i.title)},e}(ai),I_;(function(t){function e(o){return i[o]}t.orientationFromPlacement=e;function r(o){return n[o]}t.directionFromPlacement=r;var i={top:"horizontal",left:"vertical",right:"vertical",bottom:"horizontal"},n={top:"top-to-bottom",left:"left-to-right",right:"right-to-left",bottom:"bottom-to-top"}})(I_||(I_={}));var R_=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Wp=function(){return Wp=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},Wp.apply(this,arguments)};function V1(t,e){if(Array.isArray(t)){var r=[];return t.forEach(function(n,o){r.push(V1(n,e))}),Promise.all(r)}else if(t instanceof Object){var i={};return Object.keys(t).forEach(function(n){i[n]=V1(t[n],e)}),b_(i)}else return typeof t=="string"&&t.slice(0,10)==="IPY_MODEL_"?e.get_model(t.slice(10,t.length)):Promise.resolve(t)}var Gm=function(t){R_(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){return{_model_module:"@jupyter-widgets/base",_model_name:"WidgetModel",_model_module_version:CS,_view_module:"@jupyter-widgets/base",_view_name:null,_view_module_version:CS,_view_count:null}},e.prototype.isNew=function(){return!1},e.prototype.initialize=function(r,i){this._expectedEchoMsgIds={},this._attrsToUpdate={},t.prototype.initialize.call(this,r,i),this.widget_manager=i.widget_manager,this.model_id=i.model_id;var n=i.comm;this.views=Object.create(null),this.state_change=Promise.resolve(),this._closed=!1,this._state_lock=null,this._msg_buffer=null,this._msg_buffer_callbacks=null,this._pending_msgs=0,this._buffered_state_diff={},n?(this.comm=n,n.on_close(this._handle_comm_closed.bind(this)),n.on_msg(this._handle_comm_msg.bind(this)),this.comm_live=!0):this.comm_live=!1},Object.defineProperty(e.prototype,"comm_live",{get:function(){return this._comm_live},set:function(r){this._comm_live=r,this.trigger("comm_live_update")},enumerable:!0,configurable:!0}),e.prototype.send=function(r,i,n){if(this.comm!==void 0){var o={method:"custom",content:r};this.comm.send(o,i,{},n)}},e.prototype.close=function(r){var i=this;if(r===void 0&&(r=!1),!this._closed){this._closed=!0,this.comm&&!r&&this.comm.close(),this.stopListening(),this.trigger("destroy",this),this.comm&&delete this.comm;var n=Object.keys(this.views).map(function(o){return i.views[o].then(function(a){return a.remove()})});return delete this.views,Promise.all(n).then(function(){})}},e.prototype._handle_comm_closed=function(r){this.trigger("comm:close"),this.close(!0)},e.prototype._handle_comm_msg=function(r){var i=this,n=r.content.data,o=n.method;switch(o){case"update":case"echo_update":return this.state_change=this.state_change.then(function(){var a,l,u,f=n.state,_=(a=n.buffer_paths,a??[]),w=(u=(l=r.buffers)===null||l===void 0?void 0:l.slice(0,_.length),u??[]).map(function(D){return D instanceof DataView?D:new DataView(D instanceof ArrayBuffer?D:D.buffer)});if(Fp(f,_,w),r.parent_header&&o==="echo_update"){var E=r.parent_header.msg_id,M=Object.keys(f).filter(function(D){return i._expectedEchoMsgIds.hasOwnProperty(D)});M.forEach(function(D){var j=i._expectedEchoMsgIds[D]!==E;j?delete f[D]:(delete i._expectedEchoMsgIds[D],i._msg_buffer!==null&&Object.prototype.hasOwnProperty.call(i._msg_buffer,D)&&delete f[D])})}return i.constructor._deserialize_state(f,i.widget_manager)}).then(function(a){i.set_state(a)}).catch(Rf("Could not process update msg for model id: "+this.model_id,!0)),this.state_change;case"custom":return this.trigger("msg:custom",n.content,r.buffers),Promise.resolve()}},e.prototype.set_state=function(r){this._state_lock=r;try{this.set(r)}catch(i){console.error("Error setting state: "+i.message)}finally{this._state_lock=null}},e.prototype.get_state=function(r){var i=this.attributes;if(r){var n=this.defaults,o=typeof n=="function"?n.call(this):n,a={};return Object.keys(i).forEach(function(l){x_(i[l],o[l])||(a[l]=i[l])}),a}else return Wp({},i)},e.prototype._handle_status=function(r){if(this.comm!==void 0&&r.content.execution_state==="idle"&&(this._pending_msgs--,this._pending_msgs<0&&(console.error("Jupyter Widgets message throttle: Pending messages < 0 (="+this._pending_msgs+"), which is unexpected. Resetting to 0 to continue."),this._pending_msgs=0),this._msg_buffer!==null&&this._pending_msgs<1)){var i=this.send_sync_message(this._msg_buffer,this._msg_buffer_callbacks);this.rememberLastUpdateFor(i),this._msg_buffer=null,this._msg_buffer_callbacks=null}},e.prototype.callbacks=function(r){return this.widget_manager.callbacks(r)},e.prototype.set=function(r,i,n){var o=XX.call(this,r,i,n);if(this._buffered_state_diff!==void 0){var a=this.changedAttributes()||{};if(this._state_lock)for(var l=0,u=Object.keys(this._state_lock);l<u.length;l++){var f=u[l];a[f]===this._state_lock[f]&&delete a[f]}this._buffered_state_diff=Od(this._buffered_state_diff,a)}return o},e.prototype.sync=function(r,i,n){var o=this;if(n===void 0&&(n={}),this.comm===void 0)throw"Syncing error: no comm channel defined";var a=r==="patch"?n.attrs:i.get_state(n.drop_defaults);if(this._state_lock)for(var l=0,u=Object.keys(this._state_lock);l<u.length;l++){var f=u[l];a[f]===this._state_lock[f]&&delete a[f]}Object.keys(a).forEach(function(M){o._attrsToUpdate[M]=!0});var _=this.serialize(a);if(Object.keys(_).length>0){var w=n.callbacks||this.callbacks();if(this._pending_msgs>=1){switch(r){case"patch":this._msg_buffer=Od(this._msg_buffer||{},_);break;case"update":case"create":this._msg_buffer=_;break;default:throw"unrecognized syncing method"}this._msg_buffer_callbacks=w}else{var E=this.send_sync_message(a,w);this.rememberLastUpdateFor(E)}}},e.prototype.rememberLastUpdateFor=function(r){var i=this;Object.keys(this._attrsToUpdate).forEach(function(n){i._expectedEchoMsgIds[n]=r}),this._attrsToUpdate={}},e.prototype.serialize=function(r){for(var i=this.constructor.serializers||{},n=0,o=Object.keys(r);n<o.length;n++){var a=o[n];try{i[a]&&i[a].serialize?r[a]=i[a].serialize(r[a],this):r[a]=JSON.parse(JSON.stringify(r[a])),r[a]&&r[a].toJSON&&(r[a]=r[a].toJSON())}catch(l){throw console.error("Error serializing widget state attribute: ",a),l}}return r},e.prototype.send_sync_message=function(r,i){var n=this;if(i===void 0&&(i={}),!this.comm)return"";try{i={shell:Wp({},i.shell),iopub:Wp({},i.iopub),input:i.input};var o=i.iopub.status;i.iopub.status=function(u){n._handle_status(u),o&&o(u)};var a=O1(r),l=this.comm.send({method:"update",state:a.state,buffer_paths:a.buffer_paths},i,{},a.buffers);return this._pending_msgs++,l}catch(u){console.error("Could not send widget sync message",u)}return""},e.prototype.save_changes=function(r){if(this.comm_live){var i={patch:!0};r&&(i.callbacks=r),this.save(this._buffered_state_diff,i),this._buffered_state_diff={}}},e.prototype.on_some_change=function(r,i,n){var o=this;this.on("change",function(){r.some(o.hasChanged,o)&&i.apply(n,arguments)},this)},e.prototype.toJSON=function(r){return"IPY_MODEL_"+this.model_id},e._deserialize_state=function(r,i){var n=this.serializers,o;if(n){o={};for(var a in r)n[a]&&n[a].deserialize?o[a]=n[a].deserialize(r[a],i):o[a]=r[a]}else o=r;return b_(o)},e}(wY.Model);var SD=function(t){R_(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){return Od(t.prototype.defaults.call(this),{_dom_classes:[]})},e.serializers=Wp(Wp({},Gm.serializers),{layout:{deserialize:V1},style:{deserialize:V1}}),e}(Gm);var B_=function(t){R_(e,t);function e(r){return t.call(this,r)||this}return e.prototype.initialize=function(r){var i=this;this.listenTo(this.model,"change",function(){var n=Object.keys(i.model.changedAttributes()||{});n[0]==="_view_count"&&n.length===1||i.update()}),this.options=r.options,this.once("remove",function(){typeof i.model.get("_view_count")=="number"&&(i.model.set("_view_count",i.model.get("_view_count")-1),i.model.save_changes())}),this.once("displayed",function(){typeof i.model.get("_view_count")=="number"&&(i.model.set("_view_count",i.model.get("_view_count")+1),i.model.save_changes())}),this.displayed=new Promise(function(n,o){i.once("displayed",n)})},e.prototype.update=function(r){},e.prototype.render=function(){},e.prototype.create_child_view=function(r,i){return i===void 0&&(i={}),i=Wp({parent:this},i),this.model.widget_manager.create_view(r,i).catch(Rf("Could not create child view",!0))},e.prototype.callbacks=function(){return this.model.callbacks(this)},e.prototype.send=function(r,i){this.model.send(r,this.callbacks(),i)},e.prototype.touch=function(){this.model.save_changes(this.callbacks())},e.prototype.remove=function(){return t.prototype.remove.call(this),this.trigger("remove"),this},e}(JX);var TY=function(t){R_(e,t);function e(r){var i=this,n=r.view;return delete r.view,i=t.call(this,r)||this,i._view=n,i}return e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._view&&this._view.remove(),this._view=null)},e.prototype.processMessage=function(r){t.prototype.processMessage.call(this,r),this._view.processPhosphorMessage(r)},e}(ai);var ywe=function(t){R_(e,t);function e(r){var i=this,n=r.view;return delete r.view,i=t.call(this,r)||this,i._view=n,i}return e.prototype.processMessage=function(r){t.prototype.processMessage.call(this,r),this._view.processPhosphorMessage(r)},e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._view&&this._view.remove(),this._view=null)},e}(z1);var CD=function(t){R_(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initialize=function(r){var i=this;t.prototype.initialize.call(this,r),this.listenTo(this.model,"change:_dom_classes",function(n,o){var a=n.previous("_dom_classes");i.update_classes(a,o)}),this.layoutPromise=Promise.resolve(),this.listenTo(this.model,"change:layout",function(n,o){i.setLayout(o,n.previous("layout"))}),this.stylePromise=Promise.resolve(),this.listenTo(this.model,"change:style",function(n,o){i.setStyle(o,n.previous("style"))}),this.displayed.then(function(){i.update_classes([],i.model.get("_dom_classes")),i.setLayout(i.model.get("layout")),i.setStyle(i.model.get("style"))}),this._comm_live_update(),this.listenTo(this.model,"comm_live_update",function(){i._comm_live_update()})},e.prototype.setLayout=function(r,i){var n=this;r&&(this.layoutPromise=this.layoutPromise.then(function(o){return o&&(o.unlayout(),n.stopListening(o.model),o.remove()),n.create_child_view(r).then(function(a){return n.displayed.then(function(){return a.trigger("displayed"),n.listenTo(a.model,"change",function(){Pr.postMessage(n.pWidget,ai.ResizeMessage.UnknownSize)}),Pr.postMessage(n.pWidget,ai.ResizeMessage.UnknownSize),a})}).catch(Rf("Could not add LayoutView to DOMWidgetView",!0))}))},e.prototype.setStyle=function(r,i){var n=this;r&&(this.stylePromise=this.stylePromise.then(function(o){return o&&(o.unstyle(),n.stopListening(o.model),o.remove()),n.create_child_view(r).then(function(a){return n.displayed.then(function(){return a.trigger("displayed"),a})}).catch(Rf("Could not add styleView to DOMWidgetView",!0))}))},e.prototype.update_classes=function(r,i,n){n===void 0&&(n=this.el),SS(r,i).map(function(o){n.classList?n.classList.remove(o):n.setAttribute("class",n.getAttribute("class").replace(o,""))}),SS(i,r).map(function(o){n.classList?n.classList.add(o):n.setAttribute("class",n.getAttribute("class").concat(" ",o))})},e.prototype.update_mapped_classes=function(r,i,n){var o=this.model.previous(i),a=r[o]?r[o]:[];o=this.model.get(i);var l=r[o]?r[o]:[];this.update_classes(a,l,n||this.el)},e.prototype.set_mapped_classes=function(r,i,n){var o=this.model.get(i),a=r[o]?r[o]:[];this.update_classes([],a,n||this.el)},e.prototype._setElement=function(r){this.pWidget&&this.pWidget.dispose(),this.$el=r instanceof ED.default?r:(0,ED.default)(r),this.el=this.$el[0],this.pWidget=new TY({node:r,view:this})},e.prototype.remove=function(){return this.pWidget&&this.pWidget.dispose(),t.prototype.remove.call(this)},e.prototype.processPhosphorMessage=function(r){switch(r.type){case"after-attach":this.trigger("displayed");break}},e.prototype._comm_live_update=function(){this.model.comm_live?this.pWidget.removeClass("jupyter-widgets-disconnected"):this.pWidget.addClass("jupyter-widgets-disconnected")},e}(B_);var EY=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),SY={align_content:null,align_items:null,align_self:null,border:null,bottom:null,display:null,flex:null,flex_flow:null,height:null,justify_content:null,justify_items:null,left:null,margin:null,max_height:null,max_width:null,min_height:null,min_width:null,overflow:null,overflow_x:null,overflow_y:null,order:null,padding:null,right:null,top:null,visibility:null,width:null,object_fit:null,object_position:null,grid_auto_columns:null,grid_auto_flow:null,grid_auto_rows:null,grid_gap:null,grid_template_rows:null,grid_template_columns:null,grid_template_areas:null,grid_row:null,grid_column:null,grid_area:null},vwe=function(t){EY(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){return Od(t.prototype.defaults.call(this),{_model_name:"LayoutModel",_view_name:"LayoutView"},SY)},e}(Gm);var xwe=function(t){EY(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initialize=function(r){this._traitNames=[],t.prototype.initialize.call(this,r);for(var i=0,n=Object.keys(SY);i<n.length;i++){var o=n[i];this.registerTrait(o)}},e.prototype.registerTrait=function(r){var i=this;if(this._traitNames.push(r),r==="overflow_x"||r==="overflow_y"){this.listenTo(this.model,"change:"+r,function(n,o){i.handleOverflowChange(r,o)}),this.handleOverflowChange(r,this.model.get(r));return}this.listenTo(this.model,"change:"+r,function(n,o){i.handleChange(r,o)}),this.handleChange(r,this.model.get(r))},e.prototype.css_name=function(r){return r.replace(/_/g,"-")},e.prototype.handleChange=function(r,i){var n=this.options.parent;n?i===null?n.el.style.removeProperty(this.css_name(r)):n.el.style[this.css_name(r)]=i:console.warn("Style not applied because a parent view does not exist")},e.prototype.handleOverflowChange=function(r,i){var n=this.options.parent;n?i===null?this.model.get("overflow")===null&&n.el.style.removeProperty(this.css_name(r)):n.el.style[this.css_name(r)]=i:console.warn("Style not applied because a parent view does not exist")},e.prototype.unlayout=function(){var r=this,i=this.options.parent;this._traitNames.forEach(function(n){i?i.el.style.removeProperty(r.css_name(n)):console.warn("Style not removed because a parent view does not exist")},this)},e}(B_);var CY=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),bwe=function(t){CY(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){var r=this.constructor;return Od(t.prototype.defaults.call(this),{_model_name:"StyleModel",_view_name:"StyleView"},Object.keys(r.styleProperties).reduce(function(i,n){return i[n]=r.styleProperties[n].default,i},{}))},e.styleProperties={},e}(Gm);var wwe=function(t){CY(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initialize=function(r){this._traitNames=[],t.prototype.initialize.call(this,r);for(var i=this.model.constructor,n=0,o=Object.keys(i.styleProperties);n<o.length;n++){var a=o[n];this.registerTrait(a)}this.style()},e.prototype.registerTrait=function(r){var i=this;this._traitNames.push(r),this.listenTo(this.model,"change:"+r,function(n,o){i.handleChange(r,o)})},e.prototype.handleChange=function(r,i){var n=this.options.parent;if(n){var o=this.model.constructor,a=o.styleProperties,l=a[r].attribute,u=a[r].selector,f=u?n.el.querySelectorAll(u):[n.el];if(i===null)for(var _=0;_!==f.length;++_)f[_].style.removeProperty(l);else for(var _=0;_!==f.length;++_)f[_].style[l]=i}else console.warn("Style not applied because a parent view does not exist")},e.prototype.style=function(){for(var r=0,i=this._traitNames;r<i.length;r++){var n=i[r];this.handleChange(n,this.model.get(n))}},e.prototype.unstyle=function(){var r=this.options.parent,i=this.model.constructor,n=i.styleProperties;this._traitNames.forEach(function(o){if(r)for(var a=n[o].attribute,l=n[o].selector,u=l?r.el.querySelectorAll(l):[r.el],f=0;f!==u.length;++f)u[f].style.removeProperty(a);else console.warn("Style not removed because a parent view does not exist")},this)},e}(B_);var Twe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(_){try{f(i.next(_))}catch(w){a(w)}}function u(_){try{f(i.throw(_))}catch(w){a(w)}}function f(_){_.done?o(_.value):n(_.value).then(l,u)}f((i=i.apply(t,e||[])).next())})},Ewe=function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(f){return function(_){return u([f,_])}}function u(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(o=f[0]&2?n.return:f[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,f[1])).done)return o;switch(n=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,n=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(_){f=[6,_],n=0}finally{i=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},MD;(function(t){var e;(function(r){var i=function(){function o(a){this.targets=Object.create(null),this.comms=Object.create(null),this.kernel=null,this.jsServicesKernel=null,this.init_kernel(a)}return o.prototype.init_kernel=function(a){this.kernel=a,this.jsServicesKernel=a},o.prototype.new_comm=function(a,l,u,f,_,w){return Twe(this,void 0,void 0,function(){var E,M;return Ewe(this,function(D){return E=this.jsServicesKernel.createComm(a,_),M=new n(E),this.register_comm(M),M.open(l,u,f,w),[2,M]})})},o.prototype.register_target=function(a,l){var u=this,f=this.jsServicesKernel.registerCommTarget(a,function(_,w){var E=new n(_);u.register_comm(E);try{return l(E,w)}catch(M){E.close(),console.error(M),console.error(new Error("Exception opening new comm"))}});this.targets[a]=f},o.prototype.unregister_target=function(a,l){var u=this.targets[a];u.dispose(),delete this.targets[a]},o.prototype.register_comm=function(a){return this.comms[a.comm_id]=Promise.resolve(a),a.kernel=this.kernel,a.comm_id},o}();r.CommManager=i;var n=function(){function o(a){this.jsServicesComm=null,this.kernel=null,this.jsServicesComm=a}return Object.defineProperty(o.prototype,"comm_id",{get:function(){return this.jsServicesComm.commId},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"target_name",{get:function(){return this.jsServicesComm.targetName},enumerable:!0,configurable:!0}),o.prototype.open=function(a,l,u,f){var _=this.jsServicesComm.open(a,u,f);return this._hookupCallbacks(_,l),_.msg.header.msg_id},o.prototype.send=function(a,l,u,f){var _=this.jsServicesComm.send(a,u,f);return this._hookupCallbacks(_,l),_.msg.header.msg_id},o.prototype.close=function(a,l,u,f){var _=this.jsServicesComm.close(a,u,f);return this._hookupCallbacks(_,l),_.msg.header.msg_id},o.prototype.on_msg=function(a){this.jsServicesComm.onMsg=a.bind(this)},o.prototype.on_close=function(a){this.jsServicesComm.onClose=a.bind(this)},o.prototype._hookupCallbacks=function(a,l){l&&(a.onReply=function(u){l.shell&&l.shell.reply&&l.shell.reply(u)},a.onStdin=function(u){l.input&&l.input(u)},a.onIOPub=function(u){if(l.iopub){if(l.iopub.status&&u.header.msg_type==="status")l.iopub.status(u);else if(l.iopub.clear_output&&u.header.msg_type==="clear_output")l.iopub.clear_output(u);else if(l.iopub.output)switch(u.header.msg_type){case"display_data":case"execute_result":case"stream":case"error":l.iopub.output(u);break;default:break}}})},o}();r.Comm=n})(e=t.services||(t.services={}))})(MD||(MD={}));var Swe=function(){function t(e,r,i){this.initialize(e,r,i)}return t.prototype.initialize=function(e,r,i){this._handler_context=i||this,this._models=[],this.views=[],this._create_view=e,this._remove_view=r||function(n){n.remove()}},t.prototype.update=function(e,r,i,n){var o=i||this._remove_view,a=r||this._create_view;n=n||this._handler_context;for(var l=0;l<e.length&&!(l>=this._models.length||e[l]!==this._models[l]);l++);for(var u=l,f=this.views.splice(u,this.views.length-u),_=0;_<f.length;_++)f[_].then(function(w){o.call(n,w)});for(;l<e.length;l++)this.views.push(Promise.resolve(a.call(n,e[l],l)));return this._models=e.slice(),Promise.all(this.views)},t.prototype.remove=function(){var e=this;return Promise.all(this.views).then(function(r){r.forEach(function(i){return e._remove_view.call(e._handler_context,i)}),e.views=[],e._models=[]})},t.prototype.dispose=function(){this.views=null,this._models=null},t}();var Cwe=new lG("jupyter.extensions.jupyterWidgetRegistry");function Mwe(t){switch(t){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"float32":return Float32Array;case"float64":return Float64Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`Unrecognized dtype ${t}`)}}function MY(t,e){if(!t)return null;for(let r in t){let i=t[r].attributes;for(let n in i){let{dtype:o,value:a}=i[n],l=Mwe(o);i[n].value=new l(a.buffer)}}return t}var qp=null,ID=H1&&SD;if(ID){class t extends ID{defaults(){return{...super.defaults(),_model_name:qp.model_name,_model_module:qp.model_module,_model_module_version:qp.model_module_version,_view_name:qp.view_name,_view_module:qp.view_module,_view_module_version:qp.view_module_version,custom_libraries:[],json_input:null,mapbox_key:null,selected_data:[],data_buffer:null,tooltip:null,width:"100%",height:500,js_warning:!1}}static get serializers(){return{...ID.serializers,data_buffer:{deserialize:MY}}}static get model_name(){return"JupyterTransportModel"}static get model_module(){return sy}static get model_module_version(){return oy}static get view_name(){return"JupyterTransportView"}static get view_module(){return sy}static get view_module_version(){return oy}}qp=t}var IY=qp;var RY=null,PY=H1&&CD;if(PY){class t extends PY{initialize(){this.listenTo(this.model,"destroy",this.remove),this.transport=new Dm,this.transport.jupyterModel=this.model,this.transport.jupyterView=this,this.transport._initialize(),super.initialize.apply(this,arguments)}remove(){this.transport&&(this.transport._finalize(),this.transport.jupyterModel=null,this.transport.jupyterView=null,this.transport=null)}render(){super.render(),this.model.on("change:json_input",this.onJsonChanged.bind(this)),this.model.on("change:data_buffer",this.onDataBufferChanged.bind(this)),this.onDataBufferChanged()}onJsonChanged(){let r=JSON.parse(this.model.get("json_input"));this.transport._messageReceived({type:"json",json:r})}onDataBufferChanged(){let r=this.model.get("json_input"),i=this.model.get("data_buffer");r&&i?this.transport._messageReceived({type:"json-with-binary",json:r,binary:i}):this.transport._messageReceived({type:"json",json:r})}}RY=t}var BY=RY;var PD={};Gs(PD,{Buffer:()=>cn,CubeGeometry:()=>sd,Device:()=>qc,Framebuffer:()=>sf,Geometry:()=>Un,GroupNode:()=>Qc,Model:()=>qi,ModelNode:()=>ph,ScenegraphNode:()=>Jc,SphereGeometry:()=>hv,Texture:()=>Vo,TextureTransform:()=>gf});var RD={};Gs(RD,{fetchFile:()=>Sg,load:()=>Ca,parse:()=>Yd,registerLoaders:()=>hA});var OY=document.body&&document.body.getAttribute("data-base-url");OY&&(window.__webpack_public_path__=`${OY}nbextensions/pydeck/nb_extension`);mS();globalThis.deck=globalThis.deck||{};Object.assign(globalThis.deck,w1);globalThis.luma=globalThis.luma||{};Object.assign(globalThis.luma,PD);globalThis.loaders=globalThis.loaders||{};Object.assign(globalThis.loaders,RD);return qK(Iwe);})();
|
|
3674
3674
|
return __exports__;
|